From d7ee2767ff2062f819140291f7fd1a92ad7908b0 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 26 Jan 2011 10:23:28 +0000
Subject: [PATCH] Reset fast input page on entry.

Some users might get stuck with an unnusable fast input if they
select a high-number page (this fast-input list method doesn't
scale well). Reseting page allows them to recover.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42678 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Checkbook%20Delivery/fastinput.xml        |  16 +-
 .../fastinput.xml                             |  16 +-
 .../fastinput.xml                             |  16 +-
 .../Traveler%20Check%20Purchase/fastinput.xml |   2 +-
 .../Traveler%20Check%20Sale/fastinput.xml     |   2 +-
 .../CheckbookDelivery_initFastInputForm.xml   | 146 ++++++++++++++++++
 bt5/erp5_banking_check/bt/revision            |   2 +-
 7 files changed, 167 insertions(+), 33 deletions(-)
 create mode 100644 bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_initFastInputForm.xml

diff --git a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Delivery/fastinput.xml b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Delivery/fastinput.xml
index 89e9f31f42d..204d51a1c27 100644
--- a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Delivery/fastinput.xml
+++ b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Delivery/fastinput.xml
@@ -10,17 +10,15 @@
     <pickle>
       <dictionary>
         <item>
-            <key> <string>action</string> </key>
+            <key> <string>__ac_local_roles__</string> </key>
             <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+              <none/>
             </value>
         </item>
         <item>
-            <key> <string>categories</string> </key>
+            <key> <string>action</string> </key>
             <value>
-              <tuple>
-                <string>action_type/object_button</string>
-              </tuple>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
             </value>
         </item>
         <item>
@@ -33,9 +31,7 @@
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value>
-              <none/>
-            </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>icon</string> </key>
@@ -81,7 +77,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm?your_fast_input_type=checkbook_delivery</string> </value>
+            <value> <string>string:${object_url}/CheckbookDelivery_initFastInputForm?your_fast_input_type=checkbook_delivery</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Usual%20Cash%20Transfer/fastinput.xml b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Usual%20Cash%20Transfer/fastinput.xml
index 34adadf8e23..0d427be4508 100644
--- a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Usual%20Cash%20Transfer/fastinput.xml
+++ b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Usual%20Cash%20Transfer/fastinput.xml
@@ -10,17 +10,15 @@
     <pickle>
       <dictionary>
         <item>
-            <key> <string>action</string> </key>
+            <key> <string>__ac_local_roles__</string> </key>
             <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+              <none/>
             </value>
         </item>
         <item>
-            <key> <string>categories</string> </key>
+            <key> <string>action</string> </key>
             <value>
-              <tuple>
-                <string>action_type/object_button</string>
-              </tuple>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
             </value>
         </item>
         <item>
@@ -33,9 +31,7 @@
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value>
-              <none/>
-            </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>icon</string> </key>
@@ -81,7 +77,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm?your_fast_input_type=checkbook_usual_cash_transfer</string> </value>
+            <value> <string>string:${object_url}/CheckbookDelivery_initFastInputForm?your_fast_input_type=checkbook_usual_cash_transfer</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Vault%20Transfer/fastinput.xml b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Vault%20Transfer/fastinput.xml
index 9daca17ff0c..c4ab7a203b3 100644
--- a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Vault%20Transfer/fastinput.xml
+++ b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Checkbook%20Vault%20Transfer/fastinput.xml
@@ -10,17 +10,15 @@
     <pickle>
       <dictionary>
         <item>
-            <key> <string>action</string> </key>
+            <key> <string>__ac_local_roles__</string> </key>
             <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+              <none/>
             </value>
         </item>
         <item>
-            <key> <string>categories</string> </key>
+            <key> <string>action</string> </key>
             <value>
-              <tuple>
-                <string>action_type/object_button</string>
-              </tuple>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
             </value>
         </item>
         <item>
@@ -33,9 +31,7 @@
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value>
-              <none/>
-            </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>icon</string> </key>
@@ -81,7 +77,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm?your_fast_input_type=checkbook_vault_transfer</string> </value>
+            <value> <string>string:${object_url}/CheckbookDelivery_initFastInputForm?your_fast_input_type=checkbook_vault_transfer</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Purchase/fastinput.xml b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Purchase/fastinput.xml
index 0384b76cb2b..8ec16f81061 100644
--- a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Purchase/fastinput.xml
+++ b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Purchase/fastinput.xml
@@ -77,7 +77,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm?fast_input_type=your_traveler_check_purchase</string> </value>
+            <value> <string>string:${object_url}/CheckbookDelivery_initFastInputForm?fast_input_type=your_traveler_check_purchase</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Sale/fastinput.xml b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Sale/fastinput.xml
index aa79d06ab45..ffd7cc6b48a 100644
--- a/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Sale/fastinput.xml
+++ b/bt5/erp5_banking_check/ActionTemplateItem/portal_types/Traveler%20Check%20Sale/fastinput.xml
@@ -77,7 +77,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${object_url}/CheckbookDelivery_fastInputForm?your_fast_input_type=traveler_check_sale</string> </value>
+            <value> <string>string:${object_url}/CheckbookDelivery_initFastInputForm?your_fast_input_type=traveler_check_sale</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_initFastInputForm.xml b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_initFastInputForm.xml
new file mode 100644
index 00000000000..d6293a8989e
--- /dev/null
+++ b/bt5/erp5_banking_check/SkinTemplateItem/portal_skins/erp5_banking_check_operation/CheckbookDelivery_initFastInputForm.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string># TODO: pre-select entries in fast input for checkbooks already present on context.\n
+# Resuires modification to fast input listbox and checking all portal types using this script.\n
+# See CashContainer_initFastInputForm.\n
+\n
+context.REQUEST.form[\'list_start\'] = 0\n
+return context.CheckbookDelivery_fastInputForm()\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_write_</string>
+                            <string>_getattr_</string>
+<string>context</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>CheckbookDelivery_initFastInputForm</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_banking_check/bt/revision b/bt5/erp5_banking_check/bt/revision
index 281cd661318..941d0e591f2 100644
--- a/bt5/erp5_banking_check/bt/revision
+++ b/bt5/erp5_banking_check/bt/revision
@@ -1 +1 @@
-469
\ No newline at end of file
+479
\ No newline at end of file
-- 
2.30.9