[Erp5-report] r10869 - in /erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style: SkinTemplat...
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Oct 22 22:05:48 CEST 2006
Author: jerome
Date: Sun Oct 22 22:05:45 2006
New Revision: 10869
URL: http://svn.erp5.org?rev=10869&view=rev
Log:
Checks that a same object has the context can be added in the container using
visible content types in Base_createNewDocument. If the content is an hidden
allowed content type, refuse to create a new document of this type.
Modified:
erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml
erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml?rev=10869&r1=10868&r2=10869&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_createNewDocument.xml Sun Oct 22 22:05:45 2006
@@ -68,32 +68,46 @@
</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
+parent = context.aq_parent\n
+allowed_type_list = parent.getVisibleAllowedContentTypeList()\n
\n
-# Add an object of the same type as self in the container.\n
-parent = context.aq_parent\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>
<key> <string>_code</string> </key>
<value>
<none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_dav_writelocks</string> </key>
+ <value>
+ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
@@ -135,6 +149,8 @@
<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 @@
</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>
Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision?rev=10869&r1=10868&r2=10869&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision Sun Oct 22 22:05:45 2006
@@ -1,1 +1,1 @@
-276
+277
More information about the Erp5-report
mailing list