diff --git a/tabellio/searchform/advsearch-pfb.pt b/tabellio/searchform/advsearch-pfb.pt index 2d4ca4c..b9f819f 100644 --- a/tabellio/searchform/advsearch-pfb.pt +++ b/tabellio/searchform/advsearch-pfb.pt @@ -53,45 +53,9 @@
+ + diff --git a/tabellio/searchform/docsearchpfb.pt b/tabellio/searchform/docsearchpfb.pt index 13a85af..6fa5a4a 100644 --- a/tabellio/searchform/docsearchpfb.pt +++ b/tabellio/searchform/docsearchpfb.pt @@ -103,79 +103,7 @@ - - + diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index 87f48e1..c0ebb28 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -22,6 +22,7 @@ from z3c.form.browser.radio import RadioWidget from z3c.relationfield.schema import RelationChoice, RelationList from plone.formwidget.contenttree import ObjPathSourceBinder +import plone.directives.form from tabellio.searchform.interfaces import MessageFactory as _ @@ -278,6 +279,28 @@ def possible_polgroups(context): terms.append(SimpleVocabulary.createTerm(polgroup_id, polgroup_id, polgroup_str)) return SimpleVocabulary(terms) +@grok.provider(IContextSourceBinder) +def possible_active_polgroups(context): + terms = [] + + current = getToolByName(context, 'portal_url').getPortalObject() + settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False) + for part in settings.polgroupsPath.split('/'): + if not part: + continue + current = getattr(current, part) + + for object in current.objectValues(): + if object.portal_type != 'themis.datatypes.polgroup': + continue + if not object.active: + continue + polgroup_id = object.id + polgroup_str = object.Title() + terms.append(SimpleVocabulary.createTerm(polgroup_id, polgroup_id, polgroup_str)) + return SimpleVocabulary(terms) + + @grok.provider(IContextSourceBinder) def possible_topics(context): @@ -320,7 +343,7 @@ class DocumentSearchForm(form.Form): fields['topics'].widgetFactory = FieldTopicsWidget fields['sort_on'].widgetFactory = FieldRadioboxesWidget ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_effectivesearch.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(DocumentSearchForm, self).updateWidgets() @@ -369,7 +392,7 @@ class DossierSearchForm(form.Form): fields['topics'].widgetFactory = FieldTopicsWidget fields['sort_on'].widgetFactory = FieldRadioboxesWidget ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_dossier_search.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(DossierSearchForm, self).updateWidgets() @@ -412,7 +435,7 @@ class QuestionSearchForm(form.Form): fields['topics'].widgetFactory = FieldTopicsWidget fields['sort_on'].widgetFactory = FieldRadioboxesWidget ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_question_search.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(QuestionSearchForm, self).updateWidgets() @@ -464,7 +487,7 @@ class DocumentPfbSearchForm(form.Form): fields['l_topics'].widgetFactory = FieldDroppedCheckboxWidget fields['sort_on'].widgetFactory = FieldRadioboxesWidget ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_pfbdocsearch.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(DocumentPfbSearchForm, self).updateWidgets() @@ -485,14 +508,14 @@ class IDeputySearch(interface.Interface): name = schema.TextLine(title=_(u'Name'), required=False) polgroup = schema.Choice(title=_(u'Political Group'), - required=False, source=possible_polgroups) + required=False, source=possible_active_polgroups) class DeputySearchForm(form.Form): prefix = 'deputy' fields = field.Fields(IDeputySearch) ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_deputy_search.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(DeputySearchForm, self).updateWidgets() @@ -529,7 +552,7 @@ class DeputySearchForm(form.Form): prefix = 'deputy' fields = field.Fields(IDeputySearch) ignoreContext = True - template = ViewPageTemplateFile('form_templates/view_deputy_search.pt') + template = ViewPageTemplateFile('form_templates/view_form.pt') def updateWidgets(self): super(DeputySearchForm, self).updateWidgets() @@ -591,6 +614,7 @@ class GlobalSearchForm(form.Form): class SearchView(BrowserView): batch_macros = ViewPageTemplateFile('batch_macros.pt') + js_macros = ViewPageTemplateFile('js_macros.pt') def portal_url(self): return getToolByName(self.context, 'portal_url').getPortalPath() diff --git a/tabellio/searchform/form_templates/view.pt b/tabellio/searchform/form_templates/view.pt deleted file mode 100644 index b18baed..0000000 --- a/tabellio/searchform/form_templates/view.pt +++ /dev/null @@ -1,40 +0,0 @@ - - - -/ +