1 ##parameters=b_start=0, key='', reverse=0, ids=(), new_ids=(), rename='', cancel='', ajax=''
3 from Products
.CMFCore
.utils
import getToolByName
4 from Products
.CMFDefault
.utils
import html_marshal
6 utool
= getToolByName(script
, 'portal_url')
10 form
= context
.REQUEST
.form
11 default_kw
= {'b_start': b_start
, 'key': key
, 'reverse': reverse
}
13 default_kw
.update({'ajax' : ajax
})
15 context
.folder_rename_control(**form
) and \
16 context
.setRedirect(context
, 'object/folderContents', **default_kw
):
19 context
.setRedirect(context
, 'object/folderContents', **default_kw
):
25 c
= context
.aq_explicit
26 raw_items
= [ getattr(c
, id) for id in ids
if hasattr(c
, id) ]
27 raw_items
= [ item
for item
in raw_items
if item
.cb_isMoveable() ]
29 for item
in raw_items
:
30 item_icon
= item
.getIcon(1)
31 items
.append( { 'icon': item_icon
and ( '%s/%s' % (portal_url
, item_icon
) ) or '',
33 'title': item
.Title(),
34 'type': item
.Type() or None } )
35 options
['batch'] = { 'listItemInfos': tuple(items
) }
37 target
= context
.getActionInfo('object/rename_items')['url']
39 default_kw
.pop('ajax', None)
40 for name
, value
in html_marshal(**default_kw
):
41 hidden_vars
.append( {'name': name
, 'value': value
} )
43 buttons
.append( {'name': 'rename', 'value': 'Rename'} )
44 buttons
.append( {'name': 'cancel', 'value': 'Cancel'} )
45 options
['form'] = { 'action': target
,
46 'listHiddenVarInfos': tuple(hidden_vars
),
47 'listButtonInfos': tuple(buttons
) }
49 return context
.folder_rename_template(**options
)