diff --git a/tabellio/searchform/advsearch-pfb.pt b/tabellio/searchform/advsearch-pfb.pt index f08bb5d..cecf3c1 100644 --- a/tabellio/searchform/advsearch-pfb.pt +++ b/tabellio/searchform/advsearch-pfb.pt @@ -24,8 +24,8 @@

Députés

-
- ... + +
diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index c6ef8df..cfefb45 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -440,6 +440,28 @@ class DocumentPfbSearchForm(form.Form): return +class IDeputySearch(interface.Interface): + search_type_is_deputy = schema.TextLine(title=u'Search Type', default=u'1', required=False) + + name = schema.TextLine(title=_(u'Name'), required=False) + polgroup = schema.Choice(title=_(u'Political Group'), + required=False, source=possible_polgroups) + + +class DeputySearchForm(form.Form): + prefix = 'deputy' + fields = field.Fields(IDeputySearch) + ignoreContext = True + template = ViewPageTemplateFile('form_templates/view_deputy_search.pt') + + def updateWidgets(self): + super(DeputySearchForm, self).updateWidgets() + self.widgets['search_type_is_deputy'].mode = z3c.form.interfaces.HIDDEN_MODE + + @button.buttonAndHandler(_(u'Submit')) + def handleApply(self, action): + pass + class IGlobalSearchForm(interface.Interface): search_type_is_document = schema.TextLine(title=u'Search Type', required=False) search_type_is_dossier = schema.TextLine(title=u'Search Type', required=False) @@ -638,6 +660,11 @@ class SearchView(BrowserView): catalog = getToolByName(self.context, 'portal_catalog') return catalog(**kw) + def deputy_search_form(self): + f = DeputySearchForm(self.context, self.request) + f.update() + return f.render() + def document_pfb_search_form(self): f = DocumentPfbSearchForm(self.context, self.request) f.update() @@ -677,6 +704,18 @@ class SearchView(BrowserView): except IndexError: return '#' + def deputiesform_url(self): + catalog = getToolByName(self.context, 'portal_catalog') + try: + return catalog( + portal_type='Folder', + object_provides=('tabellio.webviews.deputy.IDeputiesAndOthersFolderView', + 'tabellio.webviews.deputy.IPfbDeputiesFolderView', + 'tabellio.webviews.deputy.IFolderView'), + limit=1)[0].getObject().absolute_url() + except IndexError: + return '#' + class Reflex(BrowserView): def __call__(self): diff --git a/tabellio/searchform/form_templates/view_deputy_search.pt b/tabellio/searchform/form_templates/view_deputy_search.pt new file mode 100644 index 0000000..824f8fe --- /dev/null +++ b/tabellio/searchform/form_templates/view_deputy_search.pt @@ -0,0 +1,8 @@ + + + + + + +