From 401950a9b4b9326b53a8d3234805fdb5454a96be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 11 May 2006 00:19:55 +0000 Subject: [PATCH] merge Base_jumpToRelationObject and Base_jumpToRelatedObject implementation git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7177 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/Base_jumpToRelatedObject.xml | 17 ++++--- .../erp5_core/Base_jumpToRelationObject.xml | 45 +------------------ 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml index 3bae9d97b6..1f7bfb4920 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelatedObject.xml @@ -70,10 +70,15 @@ N_ = context.Base_translateString\n checkPerm = context.portal_membership.checkPermission\n \n -search_method = getattr(context, \'get%sRelatedList\' %\n +if related:\n + search_method = getattr(context, \'get%sRelatedList\' %\n string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n +else:\n + search_method = getattr(context, \'get%sList\' %\n + string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n +\n related_list = search_method(portal_type = portal_type)\n - \n +\n if same_type(portal_type, \'\'):\n portal_type = [portal_type]\n \n @@ -120,7 +125,7 @@ else :\n uids=selection_uid_list, REQUEST=request)\n \n redirect_url = \'%s/%s?%s\' % (url, \'view\', make_query({\'portal_status_message\': message}))\n -context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n +return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n </string> </value> </item> <item> @@ -141,7 +146,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n </item> <item> <key> <string>_params</string> </key> - <value> <string>base_category, portal_type=()</string> </value> + <value> <string>base_category, portal_type=(), related=1</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -161,7 +166,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>2</int> </value> + <value> <int>3</int> </value> </item> <item> <key> <string>co_varnames</string> </key> @@ -169,6 +174,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n <tuple> <string>base_category</string> <string>portal_type</string> + <string>related</string> <string>ZTUtils</string> <string>make_query</string> <string>_getattr_</string> @@ -211,6 +217,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n <value> <tuple> <tuple/> + <int>1</int> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelationObject.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelationObject.xml index bd8f520103..5ce7458c85 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelationObject.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_jumpToRelationObject.xml @@ -66,32 +66,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>search_method = getattr(context, \'get%sValueList\' %\n - string.join([string.capitalize(x) for x in base_category.split(\'_\')], \'\'))\n -related_object_list = search_method(portal_type=portal_type)\n -\n -if len(related_object_list)==0:\n - url = context.absolute_url()\n - message = \'No+%s+related.\' % portal_type.replace(\' \', \'+\')\n -\n -elif len(related_object_list)==1:\n - url = related_object_list[0].absolute_url()\n - message = \'%s+related+to+%s:+%s.\' %\\\n - (portal_type.replace(\' \', \'+\'),\n - context.getPortalType().replace(\' \', \'+\'), \n - context.getTitleOrId())\n -\n -else:\n - request=context.REQUEST\n - selection_uid_list = [x.getUid() for x in related_object_list]\n - kw = {\'uid\': selection_uid_list}\n - context.portal_selections.setSelectionParamsFor(\'Base_jumpToRelatedObjectList\', kw)\n - request.set(\'object_uid\', context.getUid())\n - request.set(\'uids\', selection_uid_list)\n - return context.Base_jumpToRelatedObjectList(uids=selection_uid_list, REQUEST=request)\n -\n -redirect_url = \'%s/%s?%s\' % (url, \'view\', \'portal_status_message=%s\' % message)\n -context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n + <value> <string>return context.Base_jumpToRelatedObject(base_category, portal_type=portal_type, related=0)\n </string> </value> </item> <item> @@ -140,24 +115,8 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n <tuple> <string>base_category</string> <string>portal_type</string> - <string>getattr</string> -<string>context</string> <string>_getattr_</string> - <string>string</string> - <string>append</string> - <string>$append0</string> - <string>_getiter_</string> - <string>x</string> - <string>search_method</string> - <string>related_object_list</string> - <string>len</string> - <string>url</string> - <string>message</string> - <string>_getitem_</string> - <string>request</string> - <string>selection_uid_list</string> - <string>kw</string> - <string>redirect_url</string> + <string>context</string> </tuple> </value> </item> -- 2.30.9