# HG changeset patch # User Thierry Florac # Date 1568729468 -7200 # Node ID 4aca0ad81b2b494ada5c6bc738054ff1026dc579 # Parent ae293e87441751a3f7577118737576968cd9a637 Added datatype criteria in advanced search form diff -r ae293e874417 -r 4aca0ad81b2b src/pyams_content/shared/common/zmi/search.py --- a/src/pyams_content/shared/common/zmi/search.py Tue Sep 17 15:33:20 2019 +0200 +++ b/src/pyams_content/shared/common/zmi/search.py Tue Sep 17 16:11:08 2019 +0200 @@ -9,6 +9,8 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # +from pyams_content.shared.common.interfaces.types import DATA_TYPES_VOCABULARY, ITypedSharedTool + __docformat__ = 'restructuredtext' @@ -173,6 +175,10 @@ vocabulary=SHARED_TOOL_WORKFLOW_STATES_VOCABULARY, required=False) + data_type = Choice(title=_("Data type"), + vocabulary=DATA_TYPES_VOCABULARY, + required=False) + created_after = Datetime(title=_("Created after..."), required=False) @@ -214,6 +220,8 @@ workflow = IWorkflow(self.context) fields = field.Fields(ISharedToolAdvancedSearchFields) fields['status'].vocabulary = workflow.states + if not ITypedSharedTool.providedBy(self.context): + fields = fields.omit('data_type') fields['tags'].widgetFactory = ThesaurusTermsTreeFieldWidget if IThemesManagerTarget.providedBy(self.context): fields['themes'].widgetFactory = ThesaurusTermsTreeFieldWidget @@ -274,6 +282,8 @@ params &= Eq(catalog['role:owner'], data['owner']) if data.get('status'): params &= Eq(catalog['workflow_state'], data['status']) + if data.get('data_type'): + params &= Eq(catalog['data_type'], data['data_type']) if data.get('created_after'): params &= Ge(catalog['created_date'], data['created_after']) if data.get('created_before'): diff -r ae293e874417 -r 4aca0ad81b2b src/pyams_content/shared/common/zmi/templates/advanced-search.pt --- a/src/pyams_content/shared/common/zmi/templates/advanced-search.pt Tue Sep 17 15:33:20 2019 +0200 +++ b/src/pyams_content/shared/common/zmi/templates/advanced-search.pt Tue Sep 17 16:11:08 2019 +0200 @@ -124,6 +124,29 @@ + + + +
+
+ +
+
+
+