diff --git a/gen/plone25/descriptors.py b/gen/plone25/descriptors.py index bf99bed..2b03d03 100644 --- a/gen/plone25/descriptors.py +++ b/gen/plone25/descriptors.py @@ -237,8 +237,7 @@ class ArchetypeFieldDescriptor: self.classDescr.addDefaultMethod(methodName, self) # - put an index on this field? if self.appyType.indexed: - if (self.appyType.type == 'String') and \ - (self.appyType.isMultiValued()): + if (self.appyType.type == 'String') and (self.appyType.isSelect): self.fieldParams['index'] = 'ZCTextIndex, lexicon_id=' \ 'plone_lexicon, index_type=Okapi BM25 Rank' else: diff --git a/gen/plone25/generator.py b/gen/plone25/generator.py index a760935..cd3a569 100644 --- a/gen/plone25/generator.py +++ b/gen/plone25/generator.py @@ -124,6 +124,8 @@ class Generator(AbstractGenerator): msg('search_new', '', msg.SEARCH_NEW), msg('search_from', '', msg.SEARCH_FROM), msg('search_to', '', msg.SEARCH_TO), + msg('search_or', '', msg.SEARCH_OR), + msg('search_and', '', msg.SEARCH_AND), msg('ref_invalid_index', '', msg.REF_INVALID_INDEX), msg('bad_int', '', msg.BAD_INT), msg('bad_float', '', msg.BAD_FLOAT), diff --git a/gen/plone25/mixins/ToolMixin.py b/gen/plone25/mixins/ToolMixin.py index 6ca8fd6..9933526 100644 --- a/gen/plone25/mixins/ToolMixin.py +++ b/gen/plone25/mixins/ToolMixin.py @@ -443,6 +443,7 @@ class ToolMixin(AbstractMixin): # given field. attrValue = rq.form[attrName] if attrName.find('*') != -1: + # The type of the value is encoded after char "*". attrName, attrType = attrName.split('*') if attrType == 'bool': exec 'attrValue = %s' % attrValue @@ -471,7 +472,12 @@ class ToolMixin(AbstractMixin): toDate = self._getDateTime(year, month, day, False) attrValue = (fromDate, toDate) if isinstance(attrValue, list): - attrValue = ' OR '.join(attrValue) + # It is a list of values. Check if we have an operator for + # the field, to see if we make an "and" or "or" for all + # those values. "or" will be the default. + operKey = 'o_%s' % attrName[2:] + oper = ' %s ' % rq.form.get(operKey, 'or').upper() + attrValue = oper.join(attrValue) criteria[attrName[2:]] = attrValue rq.SESSION['searchCriteria'] = criteria # Goto the screen that displays search results diff --git a/gen/plone25/skin/widgets.pt b/gen/plone25/skin/widgets.pt index c59308f..fb66c5b 100644 --- a/gen/plone25/skin/widgets.pt +++ b/gen/plone25/skin/widgets.pt @@ -28,8 +28,19 @@ - Show a multi-selection box for fields whose validator defines a list of values. + Show a multi-selection box for fields whose validator defines a list of values, with a "AND/OR" checkbox. + The "and" / "or" radio buttons + + + + +
+
+ The list of values