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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jul 24 13:20:51 CEST 2008


Author: jerome
Date: Thu Jul 24 13:20:46 2008
New Revision: 22637

URL: http://svn.erp5.org?rev=22637&view=rev
Log:
Base_jumpToRelatedObject: redirect to the module, instead of showing a listbox with id, title and portal type when there are more than one document found (if we can guess the corresponding module, and were are using related=1

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

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml?rev=22637&r1=22636&r2=22637&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml Thu Jul 24 13:20:46 2008
@@ -69,6 +69,7 @@
 N_ = context.Base_translateString\n
 checkPerm = context.portal_membership.checkPermission\n
 \n
+# FIXME: performance problem getting *all* related documents URL is not scalable.\n
 if related:\n
   search_method = getattr(context, \'get%sRelatedList\' %\n
           string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n
@@ -110,7 +111,15 @@
     url = context.absolute_url()\n
     message = N_("You are not authorized to view the related document.")\n
     relation_found = 0\n
-else :\n
+\n
+else:\n
+  # jump to the module if we can guess it\n
+  if related and len(portal_type) == 1:\n
+    module_id = context.getPortalObject().getDefaultModuleId(portal_type[0], None)\n
+    if module_id is not None:\n
+      return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n
+                 \'view\', keep_items={\'%s_uid\' % base_category: context.getUid(), })\n
+\n
   # compute the list of objects we are actually authorized to view\n
   related_object_list = []\n
   for path in search_method(portal_type=portal_type) :\n
@@ -218,6 +227,7 @@
                             <string>message</string>
                             <string>None</string>
                             <string>related_object</string>
+                            <string>module_id</string>
                             <string>related_object_list</string>
                             <string>path</string>
                             <string>obj</string>
@@ -257,6 +267,12 @@
             <value>                 <string></string> </value>
         </item>
         <item>
+            <key> <string>uid</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
             <key> <string>warnings</string> </key>
             <value>
               <tuple/>

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=22637&r1=22636&r2=22637&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Thu Jul 24 13:20:46 2008
@@ -1,1 +1,1 @@
-916
+917




More information about the Erp5-report mailing list