Commit 4093e549 authored by Vincent Desmares's avatar Vincent Desmares

2008-08-05 vincentd

* Add two new parameter for jumping with the method Base_jumpToRelatedObject, one for
chose to take another item as context and another for choosing a different form_id if there is only one object for jump

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22883 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3b052fa2
...@@ -69,12 +69,17 @@ ...@@ -69,12 +69,17 @@
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
checkPerm = context.portal_membership.checkPermission\n checkPerm = context.portal_membership.checkPermission\n
\n \n
if jump_from_relative_url is None: \n
relation = context \n
else: \n
relation = context.getPortalObject().restrictedTraverse(jump_from_relative_url)\n
\n
# FIXME: performance problem getting *all* related documents URL is not scalable.\n # FIXME: performance problem getting *all* related documents URL is not scalable.\n
getter_base_name = \'\'.join([x.capitalize() for x in base_category.split(\'_\')])\n getter_base_name = \'\'.join([x.capitalize() for x in base_category.split(\'_\')])\n
if related:\n if related:\n
search_method = getattr(context, \'get%sRelatedList\' % getter_base_name)\n search_method = getattr(relation, \'get%sRelatedList\' % getter_base_name)\n
else:\n else:\n
search_method = getattr(context, \'get%sList\' % getter_base_name)\n search_method = getattr(relation, \'get%sList\' % getter_base_name)\n
\n \n
related_list = search_method(portal_type = portal_type)\n related_list = search_method(portal_type = portal_type)\n
\n \n
...@@ -97,6 +102,8 @@ elif len(related_list) == 1:\n ...@@ -97,6 +102,8 @@ elif len(related_list) == 1:\n
"%s/%s" % (base_category, related_list[0]))\n "%s/%s" % (base_category, related_list[0]))\n
\n \n
if related_object is not None and checkPerm("View", related_object) :\n if related_object is not None and checkPerm("View", related_object) :\n
if target_form_id is not None:\n
form_id = target_form_id\n
url = related_object.absolute_url()\n url = related_object.absolute_url()\n
message = N_(\n message = N_(\n
# first, try to get a full translated message with portal types\n # first, try to get a full translated message with portal types\n
...@@ -118,9 +125,9 @@ else:\n ...@@ -118,9 +125,9 @@ else:\n
if module_id is not None:\n if module_id is not None:\n
if related:\n if related:\n
return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n
\'view\', keep_items={\'%s_uid\' % base_category: context.getUid(),\n \'view\', keep_items={\'%s_uid\' % base_category: relation.getUid(),\n
\'reset\': 1})\n \'reset\': 1})\n
get_uid_method = getattr(context, \'get%sUidList\' % getter_base_name)\n get_uid_method = getattr(relation, \'get%sUidList\' % getter_base_name)\n
return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n return context.getPortalObject().getDefaultModule(portal_type[0]).Base_redirect(\n
\'view\', keep_items=dict(\n \'view\', keep_items=dict(\n
reset=1,\n reset=1,\n
...@@ -158,8 +165,6 @@ if selection_name and not relation_found:\n ...@@ -158,8 +165,6 @@ if selection_name and not relation_found:\n
query_params[\'selection_name\'] = selection_name\n query_params[\'selection_name\'] = selection_name\n
query_params[\'selection_index\'] = selection_index\n query_params[\'selection_index\'] = selection_index\n
\n \n
if relation_found:\n
form_id = \'view\'\n
\n \n
redirect_url = \'%s/%s?%s\' % (url, form_id, make_query(query_params))\n redirect_url = \'%s/%s?%s\' % (url, form_id, make_query(query_params))\n
return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
...@@ -185,7 +190,7 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -185,7 +190,7 @@ return 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=(), related=1, selection_name="", selection_index=0, form_id=\'view\'</string> </value> <value> <string>base_category, portal_type=(), related=1, selection_name="", selection_index=0, form_id=\'view\', target_form_id=None, jump_from_relative_url=None</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -205,7 +210,7 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -205,7 +210,7 @@ return 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>6</int> </value> <value> <int>8</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -217,12 +222,16 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -217,12 +222,16 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>selection_name</string> <string>selection_name</string>
<string>selection_index</string> <string>selection_index</string>
<string>form_id</string> <string>form_id</string>
<string>target_form_id</string>
<string>jump_from_relative_url</string>
<string>ZTUtils</string> <string>ZTUtils</string>
<string>make_query</string> <string>make_query</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>N_</string> <string>N_</string>
<string>checkPerm</string> <string>checkPerm</string>
<string>None</string>
<string>relation</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
...@@ -238,7 +247,6 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -238,7 +247,6 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string>_getitem_</string> <string>_getitem_</string>
<string>unicode</string> <string>unicode</string>
<string>message</string> <string>message</string>
<string>None</string>
<string>related_object</string> <string>related_object</string>
<string>module_id</string> <string>module_id</string>
<string>get_uid_method</string> <string>get_uid_method</string>
...@@ -269,6 +277,8 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n ...@@ -269,6 +277,8 @@ return context.REQUEST[ \'RESPONSE\' ].redirect(redirect_url)\n
<string></string> <string></string>
<int>0</int> <int>0</int>
<string>view</string> <string>view</string>
<none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
2008-08-05 vincentd
* Add two new parameter for jumping with the method Base_jumpToRelatedObject, one for
chose to take another item as context and another for choosing a different form_id if there is only one object for jump
2008-07-29 nicolas 2008-07-29 nicolas
Change brain class of TrackingList results Change brain class of TrackingList results
......
926 928
\ No newline at end of file \ No newline at end of file
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