From 16ae9a84282da4c39c3876a48609115f92d1cf52 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 12 Jul 2006 22:27:27 +0000
Subject: [PATCH] 2006-07-12 yo * Do not reset selections if not present in
 ListBoxZuite_reset. * Accept keyword parameters in ListBox_setPropertyList.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8427 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../listbox_zuite/testPageTemplate.xml        | 110 ++++++++++++++++++
 .../erp5_ui_test/FooModule_renderListBox.xml  |  74 ++++++++++++
 .../FooModule_viewFooList/listbox.xml         |  36 +-----
 .../erp5_ui_test/ListBoxZuite_reset.xml       |  12 +-
 .../erp5_ui_test/ListBox_setPropertyList.xml  |   3 +-
 bt5/erp5_ui_test/bt/change_log                |   4 +
 bt5/erp5_ui_test/bt/revision                  |   2 +-
 7 files changed, 201 insertions(+), 40 deletions(-)
 create mode 100644 bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testPageTemplate.xml
 create mode 100644 bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_renderListBox.xml

diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testPageTemplate.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testPageTemplate.xml
new file mode 100644
index 0000000000..49c626e708
--- /dev/null
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testPageTemplate.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <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_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
+      xmlns:metal="http://xml.zope.org/namespaces/metal">\n
+<head>\n
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
+<title>Test Page Template</title>\n
+</head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="3">Test Page Template</td></tr>\n
+</thead><tbody>\n
+<tal:block metal:use-macro="here/ListBoxZuite_CommonTemplate/macros/init" />\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>/erp5/foo_module/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_page_template=FooModule_renderListBox</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>assertTextPresent</td>\n
+\t<td>Set Successfully.</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>open</td>\n
+\t<td>/erp5/foo_module/view</td>\n
+\t<td></td>\n
+</tr>\n
+<tr>\n
+\t<td>assertTextPresent</td>\n
+\t<td>This is just a test</td>\n
+\t<td></td>\n
+</tr>\n
+\n
+</tbody></table>\n
+</body>\n
+</html>\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>testPageTemplate</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_renderListBox.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_renderListBox.xml
new file mode 100644
index 0000000000..5749644b71
--- /dev/null
+++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_renderListBox.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <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_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<div><p>This is just a test.</p></div>
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>FooModule_renderListBox</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_viewFooList/listbox.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_viewFooList/listbox.xml
index 02a579af76..f657df2e9b 100644
--- a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_viewFooList/listbox.xml
+++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooModule_viewFooList/listbox.xml
@@ -436,7 +436,7 @@
                 </item>
                 <item>
                     <key> <string>page_template</string> </key>
-                    <value> <string></string> </value>
+                    <value> <string>FooModule_renderListBox</string> </value>
                 </item>
                 <item>
                     <key> <string>portal_types</string> </key>
@@ -497,23 +497,12 @@
                 <item>
                     <key> <string>stat_columns</string> </key>
                     <value>
-                      <list>
-                        <tuple>
-                          <string>id</string>
-                          <string>FooModule_statId</string>
-                        </tuple>
-                        <tuple>
-                          <string>title</string>
-                          <string>FooModule_statTitle</string>
-                        </tuple>
-                      </list>
+                      <list/>
                     </value>
                 </item>
                 <item>
                     <key> <string>stat_method</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
-                    </value>
+                    <value> <string></string> </value>
                 </item>
                 <item>
                     <key> <string>title</string> </key>
@@ -569,23 +558,4 @@
       </dictionary>
     </pickle>
   </record>
-  <record id="4" aka="AAAAAAAAAAQ=">
-    <pickle>
-      <tuple>
-        <tuple>
-          <string>Products.Formulator.MethodField</string>
-          <string>Method</string>
-        </tuple>
-        <none/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>method_name</string> </key>
-            <value> <string>portal_catalog</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
 </ZopeData>
diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_reset.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_reset.xml
index 7a1269d92e..8d3a468078 100644
--- a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_reset.xml
+++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_reset.xml
@@ -87,11 +87,13 @@ result = form.listbox.ListBox_setPropertyList()\n
 \n
 # Reset the selection.\n
 def resetSelection(selection_name):\n
-  context.portal_selections.setSelectionToAll(selection_name, reset_domain_tree=True, reset_report_tree=True)\n
-  context.portal_selections.setSelectionSortOrder(selection_name, [])\n
-  context.portal_selections.setSelectionColumns(selection_name, [])\n
-  context.portal_selections.setSelectionStats(selection_name, [])\n
-  context.portal_selections.setListboxDisplayMode(context.REQUEST, \'FlatListMode\', selection_name)\n
+  selection_tool = context.portal_selections\n
+  if selection_tool.getSelectionFor(selection_name) is not None:\n
+    selection_tool.setSelectionToAll(selection_name, reset_domain_tree=True, reset_report_tree=True)\n
+    selection_tool.setSelectionSortOrder(selection_name, [])\n
+    selection_tool.setSelectionColumns(selection_name, [])\n
+    selection_tool.setSelectionStats(selection_name, [])\n
+    selection_tool.setListboxDisplayMode(context.REQUEST, \'FlatListMode\', selection_name)\n
 \n
 resetSelection(\'foo_selection\')\n
 resetSelection(\'foo_line_selection\')\n
diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBox_setPropertyList.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBox_setPropertyList.xml
index 90e6c5c55f..7b2eae7c0b 100644
--- a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBox_setPropertyList.xml
+++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBox_setPropertyList.xml
@@ -109,6 +109,7 @@
 )\n
 \n
 d.update(context.REQUEST)\n
+d.update(kw)\n
 #context.log(\'ListBox_setPropertyList\', \'kw = %r, d = %r\' % (kw, d,))\n
 r = context.form.validate(d)\n
 context.manage_edit_xmlrpc(r)\n
@@ -166,7 +167,7 @@ return \'Set Successfully.\'\n
                             <string>dict</string>
                             <string>_getattr_</string>
                             <string>d</string>
-<string>context</string>
+                            <string>context</string>
                             <string>r</string>
                           </tuple>
                         </value>
diff --git a/bt5/erp5_ui_test/bt/change_log b/bt5/erp5_ui_test/bt/change_log
index 0e2fe0507d..28fb944b1b 100644
--- a/bt5/erp5_ui_test/bt/change_log
+++ b/bt5/erp5_ui_test/bt/change_log
@@ -1,3 +1,7 @@
+2006-07-12 yo
+* Do not reset selections if not present in ListBoxZuite_reset.
+* Accept keyword parameters in ListBox_setPropertyList.
+
 2006-07-12 yo
 * Add missing properties to Listbox_setPropertyList.
 
diff --git a/bt5/erp5_ui_test/bt/revision b/bt5/erp5_ui_test/bt/revision
index 7813681f5b..9d607966b7 100644
--- a/bt5/erp5_ui_test/bt/revision
+++ b/bt5/erp5_ui_test/bt/revision
@@ -1 +1 @@
-5
\ No newline at end of file
+11
\ No newline at end of file
-- 
2.30.9