From ff2af166c5507f9b854a530d74715d6f3a719a22 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 19 Sep 2006 13:36:52 +0000 Subject: [PATCH] Check allowedContentTypes on the parent level, instead of raising a error. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10169 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_xhtml_style/Base_createNewDocument.xml | 13 +++++++++---- product/ERP5/bootstrap/erp5_xhtml_style/bt/revision | 2 +- .../ERP5/bootstrap/erp5_xhtml_style/bt/short_title | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 product/ERP5/bootstrap/erp5_xhtml_style/bt/short_title 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 39d122d154..63d436753a 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 @@ -76,13 +76,18 @@ parent = context.aq_parent\n \n # XXX May be this need to be changed in order to get something else than\n # the permission "Add portal content"\n -new_id = parent.generateNewId()\n -context.portal_types.constructContent(type_name=context.portal_type,\n +if not parent.allowedContentTypes():\n + return context.ERP5XhtmlStyle_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 + \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 -\n -return context.ERP5XhtmlStyle_redirect(\'%s/%s/view\' % (parent.getUrl(), new_id), keep_items={\'portal_status_message\': N_("Object Created.")})\n + return context.ERP5XhtmlStyle_redirect(\'%s/%s/view\' % (parent.getUrl(), new_id), \n + keep_items={\'portal_status_message\': N_("Object Created.")})\n </string> </value> </item> <item> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 6e16ebf9e9..274ccca8ac 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -208 \ No newline at end of file +209 \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/short_title b/product/ERP5/bootstrap/erp5_xhtml_style/bt/short_title new file mode 100644 index 0000000000..4af18322e3 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/short_title @@ -0,0 +1 @@ +None \ No newline at end of file -- 2.30.9