From eb10014322350ebfee8d787708175b0f30f60f46 Mon Sep 17 00:00:00 2001
From: Mame Coumba Sall <mame@nexedi.com>
Date: Wed, 10 Sep 2008 12:46:09 +0000
Subject: [PATCH] 2008-09-10 * Add tales expression on listbox so that it's
 only activated when there are subcategories defines in currency_exchange_type
 *Title of start_date property changed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23550 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...yExchangeLine_shouldListboxBeActivated.xml | 156 ++++++++++++++++++
 .../CurrencyExchangeLine_view/listbox.xml     |  77 +++++++--
 .../my_start_date.xml                         |   8 +-
 bt5/erp5_base/bt/revision                     |   2 +-
 4 files changed, 223 insertions(+), 20 deletions(-)
 create mode 100644 bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_shouldListboxBeActivated.xml

diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_shouldListboxBeActivated.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_shouldListboxBeActivated.xml
new file mode 100644
index 0000000000..14793d0ca2
--- /dev/null
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_shouldListboxBeActivated.xml
@@ -0,0 +1,156 @@
+<?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 encoding="cdata"><![CDATA[
+
+curr_ex_cell_list = context.portal_categories.currency_exchange_type.objectValues()\n
+if len(curr_ex_cell_list)>0:\n
+  return 0\n
+elif len(curr_ex_cell_list)==0:\n
+  return 1\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>_owner</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>_getattr_</string>
+<string>context</string>
+                            <string>curr_ex_cell_list</string>
+                            <string>len</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>CurrencyExchangeLine_shouldListboxBeActivated</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view/listbox.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view/listbox.xml
index 55cca57cea..d500e27dfe 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view/listbox.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/CurrencyExchangeLine_view/listbox.xml
@@ -13,12 +13,12 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>lines</string>
-                <string>all_editable_columns</string>
                 <string>title</string>
+                <string>hidden</string>
+                <string>lines</string>
                 <string>columns</string>
-                <string>editable_columns</string>
                 <string>list_method</string>
+                <string>editable_columns</string>
                 <string>list_action</string>
               </list>
             </value>
@@ -61,6 +61,14 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key>                 <string>columns</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key>                 <string>editable_columns</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -69,10 +77,32 @@
                     <key> <string>form_id</string> </key>
                     <value> <string></string> </value>
                 </item>
+                <item>
+                    <key>                 <string>hidden</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key>                 <string>lines</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key>                 <string>list_action</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key>                 <string>list_method</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>target</string> </key>
                     <value> <string></string> </value>
                 </item>
+                <item>
+                    <key>                 <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
               </dictionary>
             </value>
         </item>
@@ -87,7 +117,7 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>columns</string> </key>
+                    <key>                 <string>columns</string> </key>
                     <value>
                       <list>
                         <tuple>
@@ -106,7 +136,7 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>editable_columns</string> </key>
+                    <key>                 <string>editable_columns</string> </key>
                     <value>
                       <list>
                         <tuple>
@@ -129,17 +159,21 @@
                     <value> <string>Base_viewFieldLibrary</string> </value>
                 </item>
                 <item>
-                    <key> <string>lines</string> </key>
+                    <key>                 <string>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key>                 <string>lines</string> </key>
                     <value> <int>10</int> </value>
                 </item>
                 <item>
-                    <key> <string>list_action</string> </key>
+                    <key>                 <string>list_action</string> </key>
                     <value> <string>Folder_viewContentList</string> </value>
                 </item>
                 <item>
-                    <key> <string>list_method</string> </key>
+                    <key>                 <string>list_method</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -147,7 +181,7 @@
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
-                    <key> <string>title</string> </key>
+                    <key>                 <string>title</string> </key>
                     <value> <string>Currency Exchange Cells</string> </value>
                 </item>
               </dictionary>
@@ -159,11 +193,24 @@
   <record id="2" aka="AAAAAAAAAAI=">
     <pickle>
       <tuple>
-        <tuple>
-          <string>Products.Formulator.MethodField</string>
-          <string>Method</string>
-        </tuple>
-        <none/>
+        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python:here.CurrencyExchangeLine_shouldListboxBeActivated()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="Method" module="Products.Formulator.MethodField"/>
+        <tuple/>
       </tuple>
     </pickle>
     <pickle>
diff --git a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Currency_viewFieldLibrary/my_start_date.xml b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Currency_viewFieldLibrary/my_start_date.xml
index 691ac6cd8d..eec9ba3d23 100644
--- a/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Currency_viewFieldLibrary/my_start_date.xml
+++ b/bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Currency_viewFieldLibrary/my_start_date.xml
@@ -83,11 +83,11 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>date_only</string> </key>
+                    <key>                 <string>date_only</string> </key>
                     <value> <int>0</int> </value>
                 </item>
                 <item>
-                    <key> <string>description</string> </key>
+                    <key>                 <string>description</string> </key>
                     <value> <string>The beginning date for validity of the currency exchange rate.</string> </value>
                 </item>
                 <item>
@@ -103,8 +103,8 @@
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
-                    <key> <string>title</string> </key>
-                    <value> <string>Validity Start Date</string> </value>
+                    <key>                 <string>title</string> </key>
+                    <value> <string>Validity Beginning Date</string> </value>
                 </item>
               </dictionary>
             </value>
diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision
index 1e59c84a3a..97964b3fde 100644
--- a/bt5/erp5_base/bt/revision
+++ b/bt5/erp5_base/bt/revision
@@ -1 +1 @@
-420
\ No newline at end of file
+422
\ No newline at end of file
-- 
2.30.9