[Erp5-report] r20725 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTemplateItem/p...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Apr 21 18:00:29 CEST 2008


Author: jerome
Date: Mon Apr 21 18:00:29 2008
New Revision: 20725

URL: http://svn.erp5.org?rev=20725&view=rev
Log:
Base_createNewDocument : copy erp5_xhtml_version, and use absolute_url to make it work in virtual hosting environment.

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_createNewDocument.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_createNewDocument.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_createNewDocument.xml?rev=20725&r1=20724&r2=20725&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_createNewDocument.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_createNewDocument.xml Mon Apr 21 18:00:29 2008
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -68,27 +65,28 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>REQUEST=context.REQUEST\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.getParentValue()\n
+allowed_type_list = parent.getVisibleAllowedContentTypeList()\n
 \n
-# Add an object of the same type as self\n
-parent = context.getParentValue()\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
-                        container=parent,\n
-                        id=str(new_id),\n
-                        RESPONSE=REQUEST.RESPONSE)\n
-# parent[new_id].flushActivity(invoke=1)\n
-# parent.invokeFactory(type_name=context.portal_type,\n
-#       id=str(parent.generateNewId()),\n
-#        RESPONSE=REQUEST.RESPONSE)\n
-#parent.portal_types.constructContent(type_name=context.portal_type,\n
-#     container=context,\n
-#     id=str(parent.generateNewId()),\n
-#      RESPONSE=REQUEST.RESPONSE)\n
+if not allowed_type_list:\n
+  return context.ERP5Site_redirect(\'%s/%s\' % (context.absolute_url(), form_id),\n
+        keep_items={\'portal_status_message\':\n
+           N_("You are not allowed to add new content in this context.")})\n
 \n
-return REQUEST.RESPONSE\n
+if context.getPortalType() not in allowed_type_list:\n
+  return context.ERP5Site_redirect(\'%s/%s\' % (context.absolute_url(), form_id),\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
+new_content = parent.newContent(portal_type=context.getPortalType())\n
+return context.ERP5Site_redirect(\'%s/%s\' % (new_content.absolute_url(), form_id),\n
+              keep_items={\'portal_status_message\': N_("Object Created.")})\n
 </string> </value>
         </item>
         <item>
@@ -102,6 +100,16 @@
             <value>
               <none/>
             </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>form_id=\'view\'</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -121,18 +129,21 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>0</int> </value>
+                        <value> <int>1</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
+                            <string>form_id</string>
                             <string>_getattr_</string>
                             <string>context</string>
+                            <string>N_</string>
                             <string>REQUEST</string>
                             <string>parent</string>
-                            <string>new_id</string>
-                            <string>str</string>
+                            <string>allowed_type_list</string>
+                            <string>dict</string>
+                            <string>new_content</string>
                           </tuple>
                         </value>
                     </item>
@@ -144,7 +155,9 @@
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <string>view</string>
+              </tuple>
             </value>
         </item>
         <item>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=20725&r1=20724&r2=20725&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Mon Apr 21 18:00:29 2008
@@ -1,1 +1,1 @@
-808
+810




More information about the Erp5-report mailing list