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

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 20 20:09:39 CET 2007


Author: jerome
Date: Tue Nov 20 20:09:39 2007
New Revision: 17714

URL: http://svn.erp5.org?rev=17714&view=rev
Log:
Use ERP5Form/Extensions/Folder_viewSearchDialog to have a contextual generic search dialog based on listbox configuration and allowed content types instead or the old not-so-usefull dialog. Folder_search is now used as search action.

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

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml?rev=17714&r1=17713&r2=17714&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml Tue Nov 20 20:09:39 2007
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.PythonScripts.PythonScript</string>
-          <string>PythonScript</string>
-        </tuple>
-        <none/>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -68,9 +65,67 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>REQUEST=context.REQUEST\n
-return getattr(context,form_id)(REQUEST)\n
-</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+request = container.REQUEST\n
+\n
+def sorted(seq):\n
+  seq = [x for x in seq]\n
+  seq.sort()\n
+  return seq\n
+\n
+# Convert mapping from request.form into something the catalog can understand\n
+# This script uses ad-hoc values that are understood by\n
+# Folder_viewSearchDialog: x_value_ and x_usage_ are used to remember what was\n
+# the entered value, and what was the usage.\n
+\n
+# Note that we don\'t use queries, because we want to let the catalog filter out\n
+# ignored parameters  by itself.\n
+\n
+usage_map =  dict(min=\'>=\',\n
+                  max=\'<\',\n
+                  ngt=\'<=\',\n
+                  nlt=\'>\',)\n
+\n
+new_mapping = dict()\n
+for key in sorted(request.form.keys()):\n
+  # we use sorted to make sure x_search_key appears before x\n
+  value = request.form[key]\n
+\n
+  # workaround the bogus case where a value is passed ?value=None\n
+  if value == \'None\':\n
+    value = None\n
+\n
+  # remove Formulator markers\n
+  if key.startswith(\'default_\') or key.startswith(\'field_\'):\n
+    request.form.pop(key)\n
+    continue\n
+\n
+  if key.endswith(\'_search_key\') and value:\n
+    real_key = key[:-11]\n
+    new_mapping[real_key] = dict(query=new_mapping[real_key], key=value)\n
+\n
+  elif key.endswith(\'_usage_\') and value:\n
+    request.form.pop(key)\n
+    real_key = key[:-7]\n
+    new_mapping[\'%s_value_\' % real_key] = new_mapping[real_key]\n
+    new_mapping[\'%s_usage_\' % real_key] = value\n
+    # TODO: this is a quick and dirty implementation of what should be done by\n
+    # Query.asSearchTextExpression. Instead of keeping \'%s_value_\' and \'%s_usage_\',\n
+    # we\'ll simply keep the query.\n
+    new_mapping[real_key] = \'%s %s\' % (usage_map[value], new_mapping[real_key])\n
+\n
+  else:\n
+    new_mapping[key] = value\n
+\n
+# set selection parameters\n
+container.portal_selections.setSelectionParamsFor(selection_name, new_mapping)\n
+\n
+request.form.update(new_mapping)\n
+return getattr(context, form_id)(request)\n
+
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>_code</string> </key>
@@ -86,7 +141,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>form_id=\'\'</string> </value>
+            <value> <string>form_id=\'\', selection_name=\'\', **kw</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -106,17 +161,31 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>2</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
                             <string>form_id</string>
+                            <string>selection_name</string>
+                            <string>kw</string>
                             <string>_getattr_</string>
+                            <string>container</string>
+                            <string>request</string>
+                            <string>sorted</string>
+                            <string>dict</string>
+                            <string>usage_map</string>
+                            <string>new_mapping</string>
+                            <string>_getiter_</string>
+                            <string>key</string>
+                            <string>_getitem_</string>
+                            <string>value</string>
+                            <string>None</string>
+                            <string>real_key</string>
+                            <string>_write_</string>
+                            <string>getattr</string>
                             <string>context</string>
-                            <string>REQUEST</string>
-                            <string>getattr</string>
                           </tuple>
                         </value>
                     </item>
@@ -130,6 +199,7 @@
             <value>
               <tuple>
                 <string></string>
+                <string></string>
               </tuple>
             </value>
         </item>
@@ -139,7 +209,7 @@
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Paste objects to a folder from the clipboard</string> </value>
+            <value>                 <string></string> </value>
         </item>
         <item>
             <key> <string>warnings</string> </key>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewSearchDialog.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewSearchDialog.xml?rev=17714&r1=17713&r2=17714&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewSearchDialog.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewSearchDialog.xml Tue Nov 20 20:09:39 2007
@@ -3,11 +3,8 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.ERP5Form.Form</string>
-          <string>ERP5Form</string>
-        </tuple>
-        <none/>
+        <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
@@ -19,75 +16,17 @@
             </value>
         </item>
         <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary/>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
+            <key> <string>_function</string> </key>
+            <value> <string>getSearchDialog</string> </value>
         </item>
         <item>
-            <key> <string>_objects</string> </key>
-            <value>
-              <tuple/>
-            </value>
+            <key> <string>_module</string> </key>
+            <value> <string>ERP5Form.Folder_viewSearchDialog</string> </value>
         </item>
         <item>
-            <key> <string>action</string> </key>
-            <value> <string>Base_searchHandler</string> </value>
-        </item>
-        <item>
-            <key> <string>encoding</string> </key>
-            <value> <string>UTF-8</string> </value>
-        </item>
-        <item>
-            <key> <string>enctype</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>group_list</string> </key>
+            <key> <string>_owner</string> </key>
             <value>
-              <list>
-                <string>left</string>
-                <string>right</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>groups</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>left</string> </key>
-                    <value>
-                      <list>
-                        <string>your_list_form_id</string>
-                        <string>your_description</string>
-                        <string>your_id</string>
-                        <string>your_title</string>
-                      </list>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>right</string> </key>
-                    <value>
-                      <list/>
-                    </value>
-                </item>
-              </dictionary>
+              <none/>
             </value>
         </item>
         <item>
@@ -95,35 +34,7 @@
             <value> <string>Folder_viewSearchDialog</string> </value>
         </item>
         <item>
-            <key> <string>method</string> </key>
-            <value> <string>POST</string> </value>
-        </item>
-        <item>
-            <key> <string>name</string> </key>
-            <value> <string>Folder_viewSearchDialog</string> </value>
-        </item>
-        <item>
-            <key> <string>pt</string> </key>
-            <value> <string>form_dialog</string> </value>
-        </item>
-        <item>
-            <key> <string>row_length</string> </key>
-            <value> <int>4</int> </value>
-        </item>
-        <item>
-            <key> <string>stored_encoding</string> </key>
-            <value> <string>UTF-8</string> </value>
-        </item>
-        <item>
             <key> <string>title</string> </key>
-            <value> <string>Search</string> </value>
-        </item>
-        <item>
-            <key> <string>unicode_mode</string> </key>
-            <value> <int>0</int> </value>
-        </item>
-        <item>
-            <key> <string>update_action</string> </key>
             <value> <string></string> </value>
         </item>
       </dictionary>

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=17714&r1=17713&r2=17714&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision Tue Nov 20 20:09:39 2007
@@ -1,1 +1,1 @@
-579
+580




More information about the Erp5-report mailing list