diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml index b89fb847e22a25f2c598efb3bb263ca6837a8f52..17e1b53ce359be0a4070c1edfbdce677c895993b 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Folder_create.xml @@ -69,18 +69,13 @@ <item> <key> <string>_body</string> </key> <value> <string>N_ = context.getPortalObject().Base_translateString\n +allowed_type_list = context.getVisibleAllowedContentTypeList()\n \n -# Add an object of the same type as the container\n -# or if allowed content types is 1 add that type\n -try:\n - new_object = context.newContent()\n -except IndexError:\n - # return only a portal_status_message if the IndexError is raised because\n - # there are no elemnts in context.allowedContentTypes()\n - if not context.allowedContentTypes():\n - return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n - else:\n - raise\n +if not allowed_type_list:\n + return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n +\n +# newContent will add the first allowed type when we do not specify portal_type=\n +new_object = context.newContent()\n \n return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\n </string> </value> @@ -134,8 +129,8 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke <string>_getattr_</string> <string>context</string> <string>N_</string> + <string>allowed_type_list</string> <string>new_object</string> - <string>IndexError</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 5160788e93f43d2400cb3892ce16f12d2c87b590..4d8531622899210414712b39239174e8b4c32008 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -307 \ No newline at end of file +308 \ No newline at end of file