source: WAeUP_SRP/branches/srpp_on_branch/skins/waeup_custom/changeDisplayParams.py @ 11156

Last change on this file since 11156 was 486, checked in by joachim, 18 years ago

svn -R propset svn:keywords "Id" .
added layout_application_/edit/create/view
and cleaned that up.

  • Property svn:keywords set to Id
File size: 1.4 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.