X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/3c4367d8e03450e9a73e61f4247145d2b6c86a33..959d888c17d1403d2eeecc19bc4b5e2c8d1debf6:/Products/Plinn/skins/custom_generic/folder_rename_form.py diff --git a/Products/Plinn/skins/custom_generic/folder_rename_form.py b/Products/Plinn/skins/custom_generic/folder_rename_form.py new file mode 100644 index 0000000..b643e76 --- /dev/null +++ b/Products/Plinn/skins/custom_generic/folder_rename_form.py @@ -0,0 +1,43 @@ +##parameters=ids=[], items=[], rename='', cancel='', ajax='' +## +from Products.CMFCore.utils import getToolByName +from Products.CMFDefault.utils import html_marshal + +utool = getToolByName(script, 'portal_url') +portal_url = utool() + + +form = context.REQUEST.form +if rename and \ + context.folder_rename_control(**form) and \ + context.setRedirect(context, 'object/folderContents', **form): + return +elif cancel and \ + context.setRedirect(context, 'object/folderContents', **form): + return + +options = {} +c = context.aq_explicit + +if not ids : + ids = [i['id'] for i in items] +itemInfos = [] +for id in ids : + if hasattr(c, id) : + item = getattr(c, id) + if item.cb_isMoveable() : + item_icon = item.getIcon(1) + itemInfos.append( { 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '', + 'id': item.getId(), + 'title': item.Title(), + 'type': item.Type() or None } ) + +options['batch'] = { 'listItemInfos': itemInfos } +action = context.getActionInfo('object/rename_items')['url'] +buttons = [] +buttons.append( {'name': 'rename', 'value': 'Rename'} ) +buttons.append( {'name': 'cancel', 'value': 'Cancel'} ) +options['form'] = {'action': action, + 'listButtonInfos': tuple(buttons)} + +return context.folder_rename_template(**options)