From 01a5211add8f35f98231886f6b33d05d73d0c353 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Algrain?= <fxalgrain@tiolive.com>
Date: Tue, 4 Jan 2011 17:18:47 +0000
Subject: [PATCH] Add possibility to define a default portal type. So update
 search portal type list widget

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42007 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...ection_viewKMMinimalThemeConfiguration.xml |   1 +
 .../my_layout_search_default_portal_type.xml  | 135 ++++++++++++++++++
 .../my_layout_search_portal_type_list.xml     |   4 +-
 .../your_search_portal_type.xml               |  42 +++++-
 bt5/erp5_km/bt/revision                       |   2 +-
 5 files changed, 175 insertions(+), 9 deletions(-)
 create mode 100644 bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_default_portal_type.xml

diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration.xml
index 2909c413f8..61f53d36f8 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration.xml
@@ -122,6 +122,7 @@
                         <string>my_layout_display_toolbar_widget</string>
                         <string>my_layout_display_search_widget</string>
                         <string>my_layout_search_portal_type_list</string>
+                        <string>my_layout_search_default_portal_type</string>
                         <string>my_layout_display_anonymous_user_registration</string>
                       </list>
                     </value>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_default_portal_type.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_default_portal_type.xml
new file mode 100644
index 0000000000..91ff6d8803
--- /dev/null
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_default_portal_type.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>description</string>
+                <string>items</string>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_layout_search_default_portal_type</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </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>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>description</string> </key>
+                    <value> <string>Force the fast search to a defined portal type. Else we display a list of portal type.</string> </value>
+                </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_list_field</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>items</string> </key>
+                    <value>
+                      <list/>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Default Search Portal Type</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: [["",""],[context.Base_translateString(\'All Documents\'), \'all\'],] + [[context.Base_translateString(x), x]  for x in context.getPortalDocumentTypeList()]</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_portal_type_list.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_portal_type_list.xml
index 230430474c..5993d6e56b 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_portal_type_list.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewKMMinimalThemeConfiguration/my_layout_search_portal_type_list.xml
@@ -94,7 +94,7 @@
               <dictionary>
                 <item>
                     <key> <string>description</string> </key>
-                    <value> <string>Force the fast search to a defined portal type. Else we display a list of portal type.</string> </value>
+                    <value> <string>Define list of available portal type</string> </value>
                 </item>
                 <item>
                     <key> <string>field_id</string> </key>
@@ -136,7 +136,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: [[x,  x] for x in context.getPortalDocumentTypeList()]</string> </value>
+            <value> <string>python: [[context.Base_translateString(x),  x] for x in context.getPortalDocumentTypeList()]</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/your_search_portal_type.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/your_search_portal_type.xml
index ef4fad8baa..d2606d0b68 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/your_search_portal_type.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/your_search_portal_type.xml
@@ -118,7 +118,9 @@
                 </item>
                 <item>
                     <key> <string>default</string> </key>
-                    <value> <string></string> </value>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
                 </item>
                 <item>
                     <key> <string>description</string> </key>
@@ -131,7 +133,7 @@
                 <item>
                     <key> <string>enabled</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -152,12 +154,14 @@
                 </item>
                 <item>
                     <key> <string>hidden</string> </key>
-                    <value> <string></string> </value>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+                    </value>
                 </item>
                 <item>
                     <key> <string>items</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -271,7 +275,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.getLayoutProperty(\'layout_display_search_widget\',True)</string> </value>
+            <value> <string>python: here.getLayoutProperty(\'layout_search_default_portal_type\',"all")</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -284,7 +288,33 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:[[ context.Base_translateString(\'All Documents\'), \'all\'], [context.Base_translateString(\'Everything\'), \'\']] + [[context.Base_translateString(x), x] for x in context.getLayoutProperty(\'layout_search_portal_type_list\', [])]</string> </value>
+            <value> <string>python: here.getLayoutProperty(\'layout_display_search_widget\',True)</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: here.getLayoutProperty(\'layout_search_default_portal_type\',"") != ""</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="5" aka="AAAAAAAAAAU=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python:[[context.Base_translateString(\'All Documents\'), \'all\'], [context.Base_translateString(\'Everything\'), \'\']] + [[context.Base_translateString(x), x] for x in context.getLayoutProperty(\'layout_search_portal_type_list\', [])]</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision
index 78d5c2a3dd..cfc3b26d4d 100644
--- a/bt5/erp5_km/bt/revision
+++ b/bt5/erp5_km/bt/revision
@@ -1 +1 @@
-1730
+1731
\ No newline at end of file
-- 
2.30.9