From 6ea149df98a3bbf207334c8895480d28d525ff36 Mon Sep 17 00:00:00 2001
From: Yusei Tahara <yusei@nexedi.com>
Date: Wed, 14 Jan 2009 16:07:59 +0000
Subject: [PATCH] 2009-01-14 kazuhiko * improve Glossary to Field/Workflow
 comparison dialogues.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25110 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ossaryModule_getBusinessFieldFieldList.xml | 14 ++++++--
 ...aryModule_getBusinessFieldWorkflowList.xml | 14 ++++++--
 .../listbox.xml                               | 24 ++++---------
 .../listbox_term.xml                          | 34 ++++++------------
 .../listbox.xml                               | 30 +++++-----------
 .../listbox_term.xml                          | 36 +++++++------------
 bt5/erp5_forge/bt/revision                    |  2 +-
 7 files changed, 61 insertions(+), 93 deletions(-)

diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldFieldList.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldFieldList.xml
index ee77126718..0f5d12887e 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldFieldList.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldFieldList.xml
@@ -64,11 +64,12 @@ def get_term_list(business_field, reference):\n
   term_list = portal_catalog(portal_type=\'Glossary Term\',\n
                              validation_state=\'validated\',\n
                              language_id=\'en\',\n
-                             business_field_title=business_field,\n
+                             business_field_title=(\'core\', business_field),\n
                              reference=reference)\n
   return [i.getObject() for i in term_list]\n
 \n
 def get_field_and_reference_list(business_field):\n
+  business_field = business_field.split(\'/\')[0]\n
   result = []\n
   skin_folder = getattr(portal_skins, \'erp5_%s\' % business_field, None)\n
   if skin_folder is None:\n
@@ -99,7 +100,6 @@ for business_field in business_field_list:\n
                                field.aq_parent.getId(),\n
                                field.getId())\n
 \n
-    line = newTempBase(context, \'tmp_glossary_field_%s\' %  c)\n
     c += 1\n
     field_title = field.get_value(\'title\')\n
     field_description = field.get_value(\'description\')\n
@@ -110,6 +110,12 @@ for business_field in business_field_list:\n
       elif field.get_tales_expression(\'title\') is not None:\n
         field_note_list.append(\'Tales is used.\')\n
 \n
+    if len(term_list) == 1 and \\\n
+        term_list[0].getTitle() == field_title and \\\n
+        term_list[0].getDescription() == field_description:\n
+      continue\n
+\n
+    line = newTempBase(context, \'tmp_glossary_field_%s\' %  c)\n
     line.edit(field_title=field_title,\n
               field_path=field_path,\n
               field_edit_url = \'%s/manage_main\' % field.absolute_url(),\n
@@ -181,13 +187,15 @@ return line_list\n
                             <string>reference</string>
                             <string>term_list</string>
                             <string>field_path</string>
-                            <string>line</string>
                             <string>_inplacevar_</string>
                             <string>field_title</string>
                             <string>field_description</string>
                             <string>field_note_list</string>
                             <string>True</string>
                             <string>None</string>
+                            <string>len</string>
+                            <string>_getitem_</string>
+                            <string>line</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldWorkflowList.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldWorkflowList.xml
index 249410d40a..4ccaa6d640 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldWorkflowList.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getBusinessFieldWorkflowList.xml
@@ -66,11 +66,12 @@ def get_term_list(business_field, reference):\n
   term_list = portal_catalog(portal_type=\'Glossary Term\',\n
                              validation_state=\'validated\',\n
                              language_id=\'en\',\n
-                             business_field_title=business_field,\n
+                             business_field_title=(\'core\', business_field),\n
                              reference=reference)\n
   return [i.getObject() for i in term_list]\n
 \n
 def get_obj_and_reference_list(business_field):\n
+  business_field = business_field.split(\'/\')[0]\n
   result = []\n
   # XXX this might be too simple: some business template include more than one skin folder\n
   bt = portal_templates.getInstalledBusinessTemplate("erp5_%s" % business_field)\n
@@ -97,7 +98,6 @@ for business_field in business_field_list:\n
     if not term_list:\n
       continue\n
 \n
-    line = newTempBase(context, \'tmp_glossary_wf_item_%s\' %  c)\n
     c += 1\n
     if type == \'workflow\':\n
       wf_item_path = wf_item.id\n
@@ -113,6 +113,12 @@ for business_field in business_field_list:\n
       wf_item_title = wf_item.actbox_name\n
     wf_item_description = wf_item.description\n
 \n
+    if len(term_list) == 1 and \\\n
+        term_list[0].getTitle() == wf_item_title and \\\n
+        term_list[0].getDescription() == wf_item_description:\n
+      continue\n
+\n
+    line = newTempBase(context, \'tmp_glossary_wf_item_%s\' %  c)\n
     line.edit(wf_item_path=wf_item_path,\n
               wf_item_type=type,\n
               wf_item_title=wf_item_title,\n
@@ -185,11 +191,13 @@ return line_list\n
                             <string>reference</string>
                             <string>type</string>
                             <string>term_list</string>
-                            <string>line</string>
                             <string>_inplacevar_</string>
                             <string>wf_item_path</string>
                             <string>wf_item_title</string>
                             <string>wf_item_description</string>
+                            <string>len</string>
+                            <string>_getitem_</string>
+                            <string>line</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox.xml
index 206775533c..1b8f4b26a1 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox.xml
@@ -344,17 +344,9 @@
                           <string>field_note</string>
                           <string>Note</string>
                         </tuple>
-                        <tuple>
-                          <string>field_title</string>
-                          <string>Title</string>
-                        </tuple>
-                        <tuple>
-                          <string>field_description</string>
-                          <string>Current Description</string>
-                        </tuple>
                         <tuple>
                           <string>term</string>
-                          <string>Term</string>
+                          <string>Title / Description</string>
                         </tuple>
                       </list>
                     </value>
@@ -504,6 +496,12 @@
                     <key> <string>title</string> </key>
                     <value> <string>Field List</string> </value>
                 </item>
+                <item>
+                    <key> <string>untranslatable_columns</string> </key>
+                    <value>
+                      <list/>
+                    </value>
+                </item>
                 <item>
                     <key> <string>url_columns</string> </key>
                     <value>
@@ -520,14 +518,6 @@
                           <string>field_note</string>
                           <string></string>
                         </tuple>
-                        <tuple>
-                          <string>field_title</string>
-                          <string></string>
-                        </tuple>
-                        <tuple>
-                          <string>term</string>
-                          <string></string>
-                        </tuple>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox_term.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox_term.xml
index c2a2420b68..ddca7adb0c 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox_term.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewFieldAndTermComparisonDialog/listbox_term.xml
@@ -3,7 +3,7 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="ListField" module="Products.Formulator.StandardFields"/>
+        <global name="RadioField" module="Products.Formulator.StandardFields"/>
         <tuple/>
       </tuple>
     </pickle>
@@ -64,10 +64,6 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
                     <value> <string></string> </value>
@@ -85,11 +81,11 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>orientation</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -141,10 +137,6 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
                     <value> <string></string> </value>
@@ -164,11 +156,11 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>orientation</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -218,10 +210,6 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
                     <value> <string></string> </value>
@@ -241,12 +229,12 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
-                    <value> <int>0</int> </value>
+                    <key> <string>orientation</string> </key>
+                    <value> <string>vertical</string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
-                    <value> <int>1</int> </value>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
                 </item>
                 <item>
                     <key> <string>title</string> </key>
@@ -277,7 +265,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.REQUEST.get(\'auto_select\', 0) == 1 and len(CONTEXTS[\'cell\'].term_list) == 1 and CONTEXTS[\'cell\'].term_list[0].getUid() or None</string> </value>
+            <value> <string>python:here.REQUEST.get(\'auto_select\', 0) == 1 and len(cell.term_list) == 1 and cell.term_list[0].getUid() or None</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -293,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:[(\'\', \'\')] + [("%s, %s" %(i.getTitle(), i.getDescription()[:50]), i.getUid()) for i in CONTEXTS[\'cell\'].term_list]</string> </value>
+            <value> <string>python:[(\'(current) %s / %s\' % (cell.field_title, cell.field_description), \'\')] + [("[%s] %s / %s" %(i.getBusinessFieldTitle(), i.getTitle(), i.getDescription()), i.getUid()) for i in cell.term_list]</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox.xml
index abede01cf8..308af29342 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox.xml
@@ -340,17 +340,9 @@
                           <string>wf_item_type</string>
                           <string>Type</string>
                         </tuple>
-                        <tuple>
-                          <string>wf_item_title</string>
-                          <string>Title</string>
-                        </tuple>
-                        <tuple>
-                          <string>wf_item_description</string>
-                          <string>Current Description</string>
-                        </tuple>
                         <tuple>
                           <string>term</string>
-                          <string>Term</string>
+                          <string>Title / Description</string>
                         </tuple>
                       </list>
                     </value>
@@ -393,7 +385,7 @@
                       <list>
                         <tuple>
                           <string>term</string>
-                          <string>Term</string>
+                          <string>Title / Description</string>
                         </tuple>
                       </list>
                     </value>
@@ -500,6 +492,12 @@
                     <key> <string>title</string> </key>
                     <value> <string>Field List</string> </value>
                 </item>
+                <item>
+                    <key> <string>untranslatable_columns</string> </key>
+                    <value>
+                      <list/>
+                    </value>
+                </item>
                 <item>
                     <key> <string>url_columns</string> </key>
                     <value>
@@ -508,18 +506,6 @@
                           <string>wf_item_path</string>
                           <string>GlossaryModule_getWorkflowItemEditUrl</string>
                         </tuple>
-                        <tuple>
-                          <string>wf_item_type</string>
-                          <string></string>
-                        </tuple>
-                        <tuple>
-                          <string>wf_item_title</string>
-                          <string></string>
-                        </tuple>
-                        <tuple>
-                          <string>term</string>
-                          <string></string>
-                        </tuple>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox_term.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox_term.xml
index 9499af6ae9..bb99898488 100644
--- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox_term.xml
+++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_viewWorkflowAndTermComparisonDialog/listbox_term.xml
@@ -3,7 +3,7 @@
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
       <tuple>
-        <global name="ListField" module="Products.Formulator.StandardFields"/>
+        <global name="RadioField" module="Products.Formulator.StandardFields"/>
         <tuple/>
       </tuple>
     </pickle>
@@ -64,10 +64,6 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
                     <value> <string></string> </value>
@@ -85,11 +81,11 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>orientation</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -141,10 +137,6 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
                     <value> <string></string> </value>
@@ -164,11 +156,11 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
+                    <key> <string>orientation</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
+                    <key> <string>required</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
@@ -218,13 +210,9 @@
                     <key> <string>external_validator</string> </key>
                     <value> <string></string> </value>
                 </item>
-                <item>
-                    <key> <string>extra</string> </key>
-                    <value> <string></string> </value>
-                </item>
                 <item>
                     <key> <string>extra_item</string> </key>
-                    <value> <string></string> </value>
+                    <value> <string>style="text-align:left"</string> </value>
                 </item>
                 <item>
                     <key> <string>first_item</string> </key>
@@ -241,16 +229,16 @@
                     </value>
                 </item>
                 <item>
-                    <key> <string>required</string> </key>
-                    <value> <int>0</int> </value>
+                    <key> <string>orientation</string> </key>
+                    <value> <string>vertical</string> </value>
                 </item>
                 <item>
-                    <key> <string>size</string> </key>
-                    <value> <int>1</int> </value>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
                 </item>
                 <item>
                     <key> <string>title</string> </key>
-                    <value> <string>Term</string> </value>
+                    <value> <string>Description</string> </value>
                 </item>
                 <item>
                     <key> <string>unicode</string> </key>
@@ -293,7 +281,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:[(\'\', \'\')] + [("%s, %s" %(i.getTitle(), i.getDescription()[:30]), i.getUid()) for i in CONTEXTS[\'cell\'].term_list]</string> </value>
+            <value> <string>python:[(\'(current) %s / %s\' % (cell.wf_item_title, cell.wf_item_description), \'\')] + [("[%s] %s / %s" %(i.getBusinessFieldTitle(), i.getTitle(), i.getDescription()), i.getUid()) for i in CONTEXTS[\'cell\'].term_list]</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_forge/bt/revision b/bt5/erp5_forge/bt/revision
index a71e551f35..bc56e7649a 100644
--- a/bt5/erp5_forge/bt/revision
+++ b/bt5/erp5_forge/bt/revision
@@ -1 +1 @@
-430
\ No newline at end of file
+431
\ No newline at end of file
-- 
2.30.9