Retrait messages de debug.
[Plinn.git] / skins / custom_generic / folder_rename_form.py
1 ##parameters=ids=[], items=[], rename='', cancel='', ajax=''
2 ##
3 from Products.CMFCore.utils import getToolByName
4 from Products.CMFDefault.utils import html_marshal
5
6 utool = getToolByName(script, 'portal_url')
7 portal_url = utool()
8
9
10 form = context.REQUEST.form
11 if rename and \
12 context.folder_rename_control(**form) and \
13 context.setRedirect(context, 'object/folderContents', **form):
14 return
15 elif cancel and \
16 context.setRedirect(context, 'object/folderContents', **form):
17 return
18
19 options = {}
20 c = context.aq_explicit
21
22 if not ids :
23 ids = [i['id'] for i in items]
24 itemInfos = []
25 for id in ids :
26 if hasattr(c, id) :
27 item = getattr(c, id)
28 if item.cb_isMoveable() :
29 item_icon = item.getIcon(1)
30 itemInfos.append( { 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '',
31 'id': item.getId(),
32 'title': item.Title(),
33 'type': item.Type() or None } )
34
35 options['batch'] = { 'listItemInfos': itemInfos }
36 action = context.getActionInfo('object/rename_items')['url']
37 buttons = []
38 buttons.append( {'name': 'rename', 'value': 'Rename'} )
39 buttons.append( {'name': 'cancel', 'value': 'Cancel'} )
40 options['form'] = {'action': action,
41 'listButtonInfos': tuple(buttons)}
42
43 return context.folder_rename_template(**options)