Commit 401950a9 authored by Jérome Perrin's avatar Jérome Perrin

merge Base_jumpToRelationObject and Base_jumpToRelatedObject implementation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7177 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 78f54de3
...@@ -70,10 +70,15 @@ ...@@ -70,10 +70,15 @@
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
checkPerm = context.portal_membership.checkPermission\n checkPerm = context.portal_membership.checkPermission\n
\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 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 related_list = search_method(portal_type = portal_type)\n
\n \n
if same_type(portal_type, \'\'):\n if same_type(portal_type, \'\'):\n
portal_type = [portal_type]\n portal_type = [portal_type]\n
\n \n
...@@ -120,7 +125,7 @@ else :\n ...@@ -120,7 +125,7 @@ else :\n
uids=selection_uid_list, REQUEST=request)\n uids=selection_uid_list, REQUEST=request)\n
\n \n
redirect_url = \'%s/%s?%s\' % (url, \'view\', make_query({\'portal_status_message\': message}))\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> </string> </value>
</item> </item>
<item> <item>
...@@ -141,7 +146,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -141,7 +146,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <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>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -161,7 +166,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -161,7 +166,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>2</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -169,6 +174,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -169,6 +174,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<tuple> <tuple>
<string>base_category</string> <string>base_category</string>
<string>portal_type</string> <string>portal_type</string>
<string>related</string>
<string>ZTUtils</string> <string>ZTUtils</string>
<string>make_query</string> <string>make_query</string>
<string>_getattr_</string> <string>_getattr_</string>
...@@ -211,6 +217,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -211,6 +217,7 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<value> <value>
<tuple> <tuple>
<tuple/> <tuple/>
<int>1</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -66,32 +66,7 @@ ...@@ -66,32 +66,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>search_method = getattr(context, \'get%sValueList\' %\n <value> <string>return context.Base_jumpToRelatedObject(base_category, portal_type=portal_type, related=0)\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
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -140,24 +115,8 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -140,24 +115,8 @@ context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<tuple> <tuple>
<string>base_category</string> <string>base_category</string>
<string>portal_type</string> <string>portal_type</string>
<string>getattr</string>
<string>context</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>string</string> <string>context</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>
</tuple> </tuple>
</value> </value>
</item> </item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment