From 6f1a033d23d2ebede7de749d759947e31b146156 Mon Sep 17 00:00:00 2001
From: Christophe Dumez <christophe@nexedi.com>
Date: Fri, 30 Jun 2006 12:32:04 +0000
Subject: [PATCH] - Use dialog_id instead of form_id to fix some redirecting
 problems

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8248 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_core/Base_doSelect.xml   | 13 ++++++-------
 .../portal_skins/erp5_core/Folder_copy.xml     | 18 ++++++------------
 .../portal_skins/erp5_core/Folder_cut.xml      | 18 ++++++------------
 .../erp5_core/Folder_deleteObjectList.xml      |  6 +++---
 .../portal_skins/erp5_core/Folder_paste.xml    | 12 ++++++------
 5 files changed, 27 insertions(+), 40 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_doSelect.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_doSelect.xml
index 0aa7b97f8e..d0bcfd0e7f 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_doSelect.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_doSelect.xml
@@ -88,7 +88,7 @@ else:\n
 if list_method_id:\n
   try:\n
     # Define form basic fields\n
-    form = getattr(context,form_id)\n
+    form = getattr(context,dialog_id)\n
     listbox_field = None\n
     # Search listbox\n
     for f in form.get_fields():\n
@@ -101,19 +101,18 @@ if list_method_id:\n
       v = request.form.get(col_id, \'\')\n
       kw[col_id] = v\n
     # Redirect\n
-    request.RESPONSE.redirect(\'%s/%s?%s\' % (context.absolute_url(), form_id, make_query(kw)))\n
+    request.RESPONSE.redirect(\'%s/%s?%s\' % (context.absolute_url(), dialog_id, make_query(kw)))\n
   except ConflictError:\n
     raise\n
   except:\n
     # Default behaviour is not as great but returns something\n
-    return getattr(context,form_id)(request)\n
+    return getattr(context,dialog_id)(request)\n
 else:\n
   # Default behaviour is not as great but returns something\n
   kw.update(request.form)\n
   if kw.has_key(\'listbox_uid\'): del kw[\'listbox_uid\']\n
   if kw.has_key(\'list_start\'): del kw[\'list_start\']\n
-  request.RESPONSE.redirect(\'%s/%s?%s\' % (context.absolute_url(), form_id, make_query(kw)))\n
-  #return getattr(context,form_id)(request)\n
+  request.RESPONSE.redirect(\'%s/%s?%s\' % (context.absolute_url(), dialog_id, make_query(kw)))\n
 </string> </value>
         </item>
         <item>
@@ -128,7 +127,7 @@ else:\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id=\'\', selection_index=\'\', selection_name=\'\', list_method_id=None</string> </value>
+            <value> <string>dialog_id=\'\', selection_index=\'\', selection_name=\'\', list_method_id=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -154,7 +153,7 @@ else:\n
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>form_id</string>
+                            <string>dialog_id</string>
                             <string>selection_index</string>
                             <string>selection_name</string>
                             <string>list_method_id</string>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_copy.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_copy.xml
index 6237014c1f..f501b4fd17 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_copy.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_copy.xml
@@ -76,20 +76,14 @@ uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
 # make sure nothing is checked after\n
 context.portal_selections.setSelectionCheckedUidsFor(selection_name, [])\n
 \n
+request=context.REQUEST\n
 \n
-REQUEST=context.REQUEST\n
-# Do we still needs ids ???\n
-#if REQUEST.has_key(\'ids\'):\n
-#  context.manage_copyObjects(ids=REQUEST[\'ids\'], REQUEST=REQUEST, RESPONSE=REQUEST.RESPONSE)\n
-#  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=Item(s)+Copied.\')\n
-#elif REQUEST.has_key(\'uids\'):\n
 if uids != []:\n
-  #context.manage_copyObjects(uids=REQUEST[\'uids\'], REQUEST=REQUEST, RESPONSE=REQUEST.RESPONSE)\n
-  context.manage_copyObjects(uids=uids, REQUEST=REQUEST, RESPONSE=REQUEST.RESPONSE)\n
+  context.manage_copyObjects(uids=uids, REQUEST=request, RESPONSE=request.RESPONSE)\n
   message = N_("Item(s)+Copied.")\n
 else:\n
   message = N_("Please+select+one+or+more+items+to+copy+first.")\n
-return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=%s\' % message)\n
+return request.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=%s\' % message)\n
 </string> </value>
         </item>
         <item>
@@ -104,7 +98,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id, uids=[], listbox_uid=[],selection_name=\'\'</string> </value>
+            <value> <string>dialog_id, uids=[], listbox_uid=[],selection_name=\'\'</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
@@ -136,7 +130,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>form_id</string>
+                            <string>dialog_id</string>
                             <string>uids</string>
                             <string>listbox_uid</string>
                             <string>selection_name</string>
@@ -145,7 +139,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
                             <string>portal</string>
                             <string>N_</string>
                             <string>selected_uids</string>
-                            <string>REQUEST</string>
+                            <string>request</string>
                             <string>message</string>
                           </tuple>
                         </value>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.xml
index dd4b238e88..2ed04b5021 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_cut.xml
@@ -75,20 +75,14 @@ selected_uids = context.portal_selections.updateSelectionCheckedUidList(selectio
 uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
 # make sure nothing is checked after\n
 context.portal_selections.setSelectionCheckedUidsFor(selection_name, [])\n
+request=context.REQUEST\n
 \n
-REQUEST=context.REQUEST\n
-# do we still need ids ? XXX finish the work here\n
-#if REQUEST.has_key(\'ids\'):\n
-#  context.manage_cutObjects(REQUEST[\'ids\'], REQUEST)\n
-#  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'/Folder_viewContentList?portal_status_message=Item(s)+Cut.\')\n
-#elif REQUEST.has_key(\'uids\'):\n
 if uids != []:\n
-  #context.manage_cutObjects(uids=REQUEST[\'uids\'], REQUEST=REQUEST)\n
-  context.manage_cutObjects(uids=uids, REQUEST=REQUEST)\n
+  context.manage_cutObjects(uids=uids, REQUEST=request)\n
   message = N_("Item(s)+Cut.")\n
 else:\n
   message = N_("Please+select+one+or+more+items+to+cut+first.")\n
-return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=%s\' % message)\n
+return request.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=%s\' % message)\n
 </string> </value>
         </item>
         <item>
@@ -103,7 +97,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id,selection_name=\'\',uids=[],listbox_uid=[]</string> </value>
+            <value> <string>dialog_id,selection_name=\'\',uids=[],listbox_uid=[]</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -129,7 +123,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>form_id</string>
+                            <string>dialog_id</string>
                             <string>selection_name</string>
                             <string>uids</string>
                             <string>listbox_uid</string>
@@ -138,7 +132,7 @@ return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?p
                             <string>portal</string>
                             <string>N_</string>
                             <string>selected_uids</string>
-                            <string>REQUEST</string>
+                            <string>request</string>
                             <string>message</string>
                           </tuple>
                         </value>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_deleteObjectList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_deleteObjectList.xml
index 164852a4f9..1eb774e1b9 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_deleteObjectList.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_deleteObjectList.xml
@@ -78,7 +78,7 @@ uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
 if uids == []:\n
   message = N_("Please+select+one+or+more+items+to+delete+first.")\n
   qs = \'?portal_status_message=%s\' % message\n
-  return context.REQUEST.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n
+  return request.RESPONSE.redirect( context.absolute_url() + \'/\' + dialog_id + qs )\n
 \n
 kw = {\'uid\': uids}\n
 request.set(\'object_uid\', context.getUid())\n
@@ -99,7 +99,7 @@ return context.Folder_viewDeleteDialog(uids=uids, REQUEST=request)\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>selection_index=None,form_id=\'\',uids=[], listbox_uid=[],selection_name=\'\'</string> </value>
+            <value> <string>selection_index=None,dialog_id=\'\',uids=[], listbox_uid=[],selection_name=\'\'</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -126,7 +126,7 @@ return context.Folder_viewDeleteDialog(uids=uids, REQUEST=request)\n
                         <value>
                           <tuple>
                             <string>selection_index</string>
-                            <string>form_id</string>
+                            <string>dialog_id</string>
                             <string>uids</string>
                             <string>listbox_uid</string>
                             <string>selection_name</string>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml
index 402509cffe..61c2de8224 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_paste.xml
@@ -87,17 +87,17 @@ if context.cb_dataValid and error_message==\'\':\n
   try:\n
     new_item_list = context.manage_pasteObjects(REQUEST[\'__cp\'])\n
   except KeyError:\n
-    return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=Nothing+To+Paste.\')\n
+    return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=Nothing+To+Paste.\')\n
   else:\n
     new_id_list = [i[\'new_id\'] for i in new_item_list]\n
     for my_id in new_id_list:\n
       context[my_id].flushActivity(invoke=0, method_id=\'immediateReindexObject\')\n
       context[my_id].recursiveImmediateReindexObject()\n
-    return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=Item(s)+Pasted.\')\n
+    return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=Item(s)+Pasted.\')\n
 elif context.cb_dataValid and error_message!=\'\':\n
-  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=%s\' % error_message)\n
+  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=%s\' % error_message)\n
 else:\n
-  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + form_id + \'?portal_status_message=Copy+or+cut+one+or+more+items+to+paste+first.\')\n
+  return REQUEST.RESPONSE.redirect(context.absolute_url() + \'/\' + dialog_id + \'?portal_status_message=Copy+or+cut+one+or+more+items+to+paste+first.\')\n
 </string> </value>
         </item>
         <item>
@@ -112,7 +112,7 @@ else:\n
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id</string> </value>
+            <value> <string>dialog_id</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -138,7 +138,7 @@ else:\n
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>form_id</string>
+                            <string>dialog_id</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>REQUEST</string>
-- 
2.30.9