diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml index 6da598672be18708511214fe7e05289ca1b67e73..494102eb4052eeeeee2ec24b0c362e391ae45c20 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml @@ -68,26 +68,34 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>N_ = context.getPortalObject().Base_translateString\n + <value> <string>"""Add an object of the same type as self in the container, unless\n +this type cannot be added in the container.\n +"""\n +N_ = context.getPortalObject().Base_translateString\n REQUEST=context.REQUEST\n -\n -# Add an object of the same type as self in the container.\n parent = context.aq_parent\n +allowed_type_list = parent.getVisibleAllowedContentTypeList()\n +\n +if not allowed_type_list:\n + return context.ERP5Site_redirect(\'%s/%s/view\' % (\n + parent.getUrl(), context.getId()),\n + keep_items={\'portal_status_message\':\n + N_("You are not allowed to add new content in this context.")})\n \n -# XXX May be this need to be changed in order to get something else than\n -# the permission "Add portal content"\n -if not parent.allowedContentTypes():\n - return context.ERP5Site_redirect(\'%s/%s/view\' % (parent.getUrl(), context.getId()), \n - keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n +if context.getPortalType() not in allowed_type_list:\n + return context.ERP5Site_redirect(\'%s/%s/view\' % (\n + parent.getUrl(), context.getId()),\n + keep_items={\'portal_status_message\':\n + N_("You are not allowed to add ${portal_type} in this context.",\n + mapping=dict(portal_type=context.getTranslatedPortalType()))})\n \n -else:\n - new_id = parent.generateNewId()\n - context.portal_types.constructContent(type_name=context.portal_type,\n - container=parent,\n - id=str(new_id),\n - RESPONSE=REQUEST.RESPONSE)\n - return context.ERP5Site_redirect(\'%s/%s/view\' % (parent.getUrl(), new_id), \n - keep_items={\'portal_status_message\': N_("Object Created.")})\n +new_id = parent.generateNewId()\n +context.portal_types.constructContent(type_name=context.portal_type,\n + container=parent,\n + id=str(new_id),\n + RESPONSE=REQUEST.RESPONSE)\n +return context.ERP5Site_redirect(\'%s/%s/view\' % (parent.getUrl(), new_id),\n + keep_items={\'portal_status_message\': N_("Object Created.")})\n </string> </value> </item> <item> @@ -96,6 +104,12 @@ else:\n <none/> </value> </item> + <item> + <key> <string>_dav_writelocks</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> <item> <key> <string>_filepath</string> </key> <value> @@ -135,6 +149,8 @@ else:\n <string>N_</string> <string>REQUEST</string> <string>parent</string> + <string>allowed_type_list</string> + <string>dict</string> <string>new_id</string> <string>str</string> </tuple> @@ -164,4 +180,25 @@ else:\n </dictionary> </pickle> </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <tuple> + <string>Persistence</string> + <string>PersistentMapping</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_container</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 8bc94cb760413754f1d334f731fb0318bd2cc365..6610e117a35d94836d6a459d7e963a2333541531 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -276 \ No newline at end of file +277 \ No newline at end of file