source: products/vendor/Products.CacheSetup/current/Products/CacheSetup/skins/cache_setup/cache_folder_position.cpy @ 3296

Last change on this file since 3296 was 3296, checked in by fenix, 13 years ago

Load Products.CacheSetup?-1.2.1 into vendor/Products.CacheSetup?/current.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1## Controller Python Script "folder_position"
2##title=Move objects in a ordered folder
3##bind container=container
4##bind context=context
5##bind namespace=
6##bind script=script
7##bind state=state
8##bind subpath=traverse_subpath
9##parameters=position, id, template_id='folder_contents'
10##
11
12from Products.CMFPlone import PloneMessageFactory as _
13from Products.CacheSetup import config
14
15position=position.lower()
16
17if   position=='up':
18    context.moveObjectsUp(id)
19elif position=='down':
20    context.moveObjectsDown(id)
21elif position=='top':
22    context.moveObjectsToTop(id)
23elif position=='bottom':
24    context.moveObjectsToBottom(id)
25# order folder by field
26# id in this case is the field
27elif position=='ordered':
28    context.orderObjects(id)
29
30context.plone_utils.reindexOnReorder(context)
31
32msg=_(u'Item\'s position has changed.')
33context.plone_utils.addPortalMessage(msg)
34
35new_context = context.portal_cache_settings
36pt = context.portal_type
37path = ''
38
39if pt == config.TOOL_TYPE:
40    path = 'cache_policy_config'
41else:
42    new_context = new_context.getDisplayPolicy()
43    if pt == config.RULEFOLDER_TYPE:
44        path = 'rules'
45    elif pt == config.HEADERSETFOLDER_TYPE:
46        path = 'headersets'
47
48target = '%s/%s' %(new_context.absolute_url(), path)
49return context.REQUEST.RESPONSE.redirect(target)
50
Note: See TracBrowser for help on using the repository browser.