diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml index 03c9867b192c0b4bf2ecb14d539cc7fd0ff38d75..91fded4b8a74d3fc2ca2f217a0ab5fa82746064e 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml @@ -50,40 +50,29 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>REQUEST=context.REQUEST\n -error_message = \'\'\n -Base_translateString = context.Base_translateString\n + <value> <string>portal = context.getPortalObject()\n \n if context.cb_dataValid:\n - # We first look if the content of objects to paste is allowed\n - # inside this folder\n object_list = context.cb_dataItems()\n try:\n - portal_type_list = [x.getPortalType() for x in object_list]\n + portal_type_set = set(x.getPortalType() for x in object_list)\n except AttributeError:\n - error_message = Base_translateString(\'Sorry, you can not paste these items here.\')\n + error_message = \'Sorry, you can not paste these items here.\'\n else:\n - allowed_type_list = [x for x in context.getVisibleAllowedContentTypeList()]\n - for portal_type in portal_type_list:\n - if portal_type not in allowed_type_list:\n - error_message = Base_translateString(\'Sorry, you can not paste these items here.\')\n -\n -if context.cb_dataValid and error_message==\'\':\n - try:\n - new_item_list = context.manage_pasteObjects(REQUEST[\'__cp\'])\n - except KeyError:\n - return context.Base_redirect(form_id,\n - keep_items=dict(portal_status_message=Base_translateString(\'Nothing to paste.\')))\n - else:\n - new_id_list = [i[\'new_id\'] for i in new_item_list]\n - return context.Base_redirect(form_id,\n - keep_items=dict(portal_status_message=Base_translateString(\'Items paste in progress.\')))\n -\n -elif context.cb_dataValid and error_message != \'\':\n - return context.Base_redirect(form_id, keep_items=dict(portal_status_message=error_message))\n -\n -error_message = Base_translateString(\'Copy or cut one or more items to paste first.\')\n -return context.Base_redirect(form_id, keep_items=dict(portal_status_message=error_message))\n + if portal_type_set.issubset(context.getVisibleAllowedContentTypeList()):\n + try:\n + new_item_list = context.manage_pasteObjects(portal.REQUEST[\'__cp\'])\n + except KeyError:\n + error_message = \'Nothing to paste.\'\n + else:\n + #new_id_list = [i[\'new_id\'] for i in new_item_list]\n + error_message = \'Items paste in progress.\'\n + else:\n + error_message = \'Sorry, you can not paste these items here.\'\n +else:\n + error_message = \'Copy or cut one or more items to paste first.\'\n +return context.Base_redirect(form_id, keep_items=dict(\n + portal_status_message=portal.Base_translateString(error_message)))\n </string> </value> </item> <item> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 600f83f0cbba2cc4ce85c86193f28a80b1d1b1e3..5c7ff143290a18daeaf87a8411db52e0cd980e51 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41093 \ No newline at end of file +41094 \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createCloneDocument.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createCloneDocument.xml index 2997ca497f1e60b0197dff9edcce2434668fbaf6..0465545c475f5b654e55ac120cc3b56aefb84509 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createCloneDocument.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createCloneDocument.xml @@ -56,8 +56,9 @@ \n Pretty messages are provided to the user.\n """\n -translateString = context.Base_translateString\n -form_data = context.REQUEST.form\n +portal = context.getPortalObject()\n +translateString = portal.Base_translateString\n +form_data = portal.REQUEST.form\n \n if clone:\n portal_type = context.getPortalType()\n @@ -65,10 +66,12 @@ else:\n portal_type = form_data[\'clone_portal_type\']\n \n # We copy contents in place if possible\n -directory = getattr(context, \'original_container\', None) or context.getParentValue()\n -allowed_type_list = directory.getVisibleAllowedContentTypeList()\n -is_user_allowed_copy_or_move = context.Base_checkPermission(context.getRelativeUrl(), \'Copy or Move\')\n -if portal_type not in allowed_type_list or not is_user_allowed_copy_or_move:\n +try:\n + directory = context.aq_explicit.original_container\n +except AttributeError:\n + directory = context.getParentValue()\n +if not (portal_type in directory.getVisibleAllowedContentTypeList() and\n + portal.portal_membership.checkPermission(\'Copy or Move\', context)):\n if batch_mode:\n return None\n else:\n @@ -90,7 +93,10 @@ if web_mode:\n # Standard cloning method\n if clone:\n # Copy and paste the object\n - original_id = getattr(context, \'original_id\', None) or context.getId()\n + try:\n + original_id = context.aq_explicit.original_id\n + except AttributeError:\n + original_id = context.getId()\n # This is required for objects acquired in Web Section\n clipboard = directory.manage_copyObjects(ids=[original_id])\n context.REQUEST.set(\'__cp\', clipboard) # CopySupport is using this to set\n diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index dfc8356d7417668b2a8d3090e9153779f51b59c2..39987d00115702c8569a806825d47b5908efa0ee 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -1098 \ No newline at end of file +1099 \ No newline at end of file