[Erp5-report] r36401 jerome - /erp5/trunk/products/ERP5Form/Extensions/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 16 16:16:11 CEST 2010


Author: jerome
Date: Wed Jun 16 16:16:10 2010
New Revision: 36401

URL: http://svn.erp5.org?rev=36401&view=rev
Log:
- support translated categories
- always display listfield for categories, even if column is not marked as
  searchable
- always add a full text search field

Modified:
    erp5/trunk/products/ERP5Form/Extensions/Folder_viewSearchDialog.py

Modified: erp5/trunk/products/ERP5Form/Extensions/Folder_viewSearchDialog.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Extensions/Folder_viewSearchDialog.py?rev=36401&r1=36400&r2=36401&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Extensions/Folder_viewSearchDialog.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Extensions/Folder_viewSearchDialog.py [utf8] Wed Jun 16 16:16:10 2010
@@ -218,25 +218,26 @@ def getSearchDialog(self, REQUEST=None):
                       listbox.widget, listbox, request).getSearchColumnIdSet()
 
   for column_id, column_title in column_list:
-    if column_id in search_list:
-      # is it a base category ?
-      short_column_id = column_id
-      # strip the usuale default_ and _title that are on standard fields.
-      if short_column_id.endswith('_title'):
-        short_column_id = short_column_id[:-6]
-      if short_column_id.startswith('default_'):
-        short_column_id = short_column_id[8:]
-      if short_column_id in base_category_list:
-        # is this base category empty ? then it might be used to relate documents,
-        # in that case, simply provide a text input
-        if not len(category_tool[short_column_id]):
-          default_search_key = 'ExactMatch'
-          if column_id in sql_catalog_keyword_search_keys:
-            default_search_key = 'Keyword'
-          addKeywordSearchStringField(column_id, column_title,
-                                      default_search_key=default_search_key)
-        else:
-          addListField(short_column_id, column_title)
+    # is it a base category ?
+    short_column_id = column_id
+    # strip the usuale default_ and _title that are on standard fields.
+    if short_column_id.endswith('_translated_title'):
+      short_column_id = short_column_id[:-len('_translated_title')]
+    if short_column_id.endswith('_title'):
+      short_column_id = short_column_id[:-len('_title')]
+    if short_column_id.startswith('default_'):
+      short_column_id = short_column_id[len('default_'):]
+    if short_column_id in base_category_list:
+      # is this base category empty ? then it might be used to relate documents,
+      # in that case, simply provide a text input
+      if not len(category_tool[short_column_id]):
+        default_search_key = 'ExactMatch'
+        if column_id in sql_catalog_keyword_search_keys:
+          default_search_key = 'Keyword'
+        addKeywordSearchStringField(column_id, column_title,
+                                    default_search_key=default_search_key)
+      else:
+        addListField(short_column_id, column_title)
         continue
 
 
@@ -263,8 +264,6 @@ def getSearchDialog(self, REQUEST=None):
             addKeywordSearchStringField(column_id, column_title,
                             default_search_key=default_search_key)
 
-  # TODO always add SearchableText ?
-
   allowed_content_types = self.getTypeInfo().getTypeAllowedContentTypeList()
   # remember which workflow we already displayed
   workflow_dict = dict()
@@ -325,6 +324,8 @@ def getSearchDialog(self, REQUEST=None):
             ['title', 'items', 'default'])
 
 
+  addFullTextStringField('SearchableText', 'Full Text Search')
+
   # Order fields
   default_group = temp_form.group_list[0]
   field_list = temp_form.get_fields()
@@ -332,7 +333,8 @@ def getSearchDialog(self, REQUEST=None):
     field_id = field.getId()
     if field_id.endswith('search_key') or field_id.endswith('_usage_'):
       temp_form.move_field_group([field_id], default_group, 'right')
-    elif field.get_value('field_id') == 'your_category_list':
+    elif field.get_value('field_id') == 'your_category_list' \
+        or field_id == 'your_SearchableText':
       temp_form.move_field_group([field_id], default_group, 'center')
 
   if REQUEST is not None:




More information about the Erp5-report mailing list