source: WAeUP_SRP/trunk/skins/cps_custom/changeDisplayParams.py @ 8794

Last change on this file since 8794 was 2217, checked in by Henrik Bettermann, 17 years ago

move content from waeup_custom to cps_custom

File size: 1.5 KB
Line 
1## Script (Python) "changeDisplayParams"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST
8##title=
9##
10# $Id: changeDisplayParams.py 486 2006-09-06 10:09:39Z joachim $
11"""
12Change the order/style of the item display within a folder.
13"""
14from Products.CMFCore.utils import getToolByName
15
16context_url = REQUEST.get('context_url', context.getContextUrl())
17
18ti = getToolByName(context, 'portal_types').getTypeInfo(context.portal_type)
19
20# Retrieve display preference from session
21display_params = REQUEST.SESSION.get('cps_display_params', {})
22
23form = REQUEST.form
24
25if form is not None:
26    # Order and direction
27    display_order = form.get('display_order')
28    # "None" means use folder ordering
29    if display_order == 'None' or not display_order:
30        sort_by = None
31        direction = None
32    else:
33        sort_by, direction = display_order.split('_')
34
35    display_params['sort_by'] = sort_by
36    display_params['direction'] = direction
37
38    # Style
39    format = form.get('display_style')
40    if format:
41        # XXX:
42        # "None" means default here whereas None means "don't change"
43        if format == 'None':
44            format = None
45        display_params['format'] = format
46
47    # Update session
48    REQUEST.SESSION['cps_display_params'] = display_params
49
50meth_id = ti.queryMethodID('view', 'folder_contents')
51redirection_url = context_url + '/' + meth_id
52REQUEST.RESPONSE.redirect(redirection_url)
Note: See TracBrowser for help on using the repository browser.