Commit 8c941634 authored by Jérome Perrin's avatar Jérome Perrin

- support translated categories

- always display listfield for categories, even if column is not marked as
  searchable
- always add a full text search field


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36401 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 128df931
...@@ -218,25 +218,26 @@ def getSearchDialog(self, REQUEST=None): ...@@ -218,25 +218,26 @@ def getSearchDialog(self, REQUEST=None):
listbox.widget, listbox, request).getSearchColumnIdSet() listbox.widget, listbox, request).getSearchColumnIdSet()
for column_id, column_title in column_list: for column_id, column_title in column_list:
if column_id in search_list: # is it a base category ?
# is it a base category ? short_column_id = column_id
short_column_id = column_id # strip the usuale default_ and _title that are on standard fields.
# strip the usuale default_ and _title that are on standard fields. if short_column_id.endswith('_translated_title'):
if short_column_id.endswith('_title'): short_column_id = short_column_id[:-len('_translated_title')]
short_column_id = short_column_id[:-6] if short_column_id.endswith('_title'):
if short_column_id.startswith('default_'): short_column_id = short_column_id[:-len('_title')]
short_column_id = short_column_id[8:] if short_column_id.startswith('default_'):
if short_column_id in base_category_list: short_column_id = short_column_id[len('default_'):]
# is this base category empty ? then it might be used to relate documents, if short_column_id in base_category_list:
# in that case, simply provide a text input # is this base category empty ? then it might be used to relate documents,
if not len(category_tool[short_column_id]): # in that case, simply provide a text input
default_search_key = 'ExactMatch' if not len(category_tool[short_column_id]):
if column_id in sql_catalog_keyword_search_keys: default_search_key = 'ExactMatch'
default_search_key = 'Keyword' if column_id in sql_catalog_keyword_search_keys:
addKeywordSearchStringField(column_id, column_title, default_search_key = 'Keyword'
default_search_key=default_search_key) addKeywordSearchStringField(column_id, column_title,
else: default_search_key=default_search_key)
addListField(short_column_id, column_title) else:
addListField(short_column_id, column_title)
continue continue
...@@ -263,8 +264,6 @@ def getSearchDialog(self, REQUEST=None): ...@@ -263,8 +264,6 @@ def getSearchDialog(self, REQUEST=None):
addKeywordSearchStringField(column_id, column_title, addKeywordSearchStringField(column_id, column_title,
default_search_key=default_search_key) default_search_key=default_search_key)
# TODO always add SearchableText ?
allowed_content_types = self.getTypeInfo().getTypeAllowedContentTypeList() allowed_content_types = self.getTypeInfo().getTypeAllowedContentTypeList()
# remember which workflow we already displayed # remember which workflow we already displayed
workflow_dict = dict() workflow_dict = dict()
...@@ -325,6 +324,8 @@ def getSearchDialog(self, REQUEST=None): ...@@ -325,6 +324,8 @@ def getSearchDialog(self, REQUEST=None):
['title', 'items', 'default']) ['title', 'items', 'default'])
addFullTextStringField('SearchableText', 'Full Text Search')
# Order fields # Order fields
default_group = temp_form.group_list[0] default_group = temp_form.group_list[0]
field_list = temp_form.get_fields() field_list = temp_form.get_fields()
...@@ -332,7 +333,8 @@ def getSearchDialog(self, REQUEST=None): ...@@ -332,7 +333,8 @@ def getSearchDialog(self, REQUEST=None):
field_id = field.getId() field_id = field.getId()
if field_id.endswith('search_key') or field_id.endswith('_usage_'): if field_id.endswith('search_key') or field_id.endswith('_usage_'):
temp_form.move_field_group([field_id], default_group, 'right') 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') temp_form.move_field_group([field_id], default_group, 'center')
if REQUEST is not None: if REQUEST is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment