summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@0d.be>2011-12-06 18:27:35 (GMT)
committerFrédéric Péters <fpeters@0d.be>2011-12-06 18:27:35 (GMT)
commit01aa1811197b56f0773ca9068fef6a7c451e3adc (patch)
tree14804719b6d4b00ed14c05734f22e1a19b983d1e
parent32001fbdef34dfb8dd7d7dfb66cccd9b0f047dc1 (diff)
downloadtabellio.searchform-01aa1811197b56f0773ca9068fef6a7c451e3adc.zip
tabellio.searchform-01aa1811197b56f0773ca9068fef6a7c451e3adc.tar.gz
tabellio.searchform-01aa1811197b56f0773ca9068fef6a7c451e3adc.tar.bz2
factored pfb questions out of common code for topics and authors fields (#1121)
-rw-r--r--tabellio/searchform/form.py35
1 files changed, 32 insertions, 3 deletions
diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py
index ea56c04..0558f87 100644
--- a/tabellio/searchform/form.py
+++ b/tabellio/searchform/form.py
@@ -478,11 +478,40 @@ class QuestionSearchForm(form.Form):
def handleApply(self, action):
pass
-class QuestionPfbSearchForm(QuestionSearchForm):
- fields = field.Fields(IQuestionSearch)
+
+class IQuestionPfbSearch(interface.Interface):
+ search_type_is_question = schema.TextLine(title=u'Search Type', default=u'1', required=False)
+
+ l_questypes = schema.List(title=_(u'Question Type'), required=False,
+ value_type=schema.Choice(title=_(u'Type'), required=False,
+ source=possible_question_types))
+ ttitle = schema.TextLine(title=_(u'Title'), required=False)
+ l_topics = schema.List(title=_(u'Topics'), required=False,
+ value_type=schema.Choice(required=False,
+ source=possible_topics));
+ authors = schema.TextLine(title=_(u'Authors'), required=False)
+ session = schema.Choice(title=_(u'Legislature / Session'), required=False,
+ source=possible_sessions)
+ start = schema.Date(title=_(u'Start'), required=False)
+ end = schema.Date(title=_(u'End'), required=False)
+
+ sort_on = schema.Choice(title=_(u'Sort By'), required=True,
+ default=_(u'Session'),
+ values=[_(u'Session'), _(u'Type')])
+
+class QuestionPfbSearchForm(form.Form):
+ prefix = 'question'
+ ignoreContext = True
+ template = ViewPageTemplateFile('form_templates/view_form.pt')
+ fields = field.Fields(IQuestionPfbSearch)
fields['authors'].title = _(u'Author(s)')
- del fields['l_polgroups']
+ fields['authors'].widgetFactory = FieldAuthorsWidget
fields['l_questypes'].widgetFactory = FieldDroppedCheckboxWidget
+ fields['l_topics'].widgetFactory = FieldDroppedCheckboxWidget
+
+ def updateWidgets(self):
+ super(QuestionPfbSearchForm, self).updateWidgets()
+ self.widgets['search_type_is_question'].mode = z3c.form.interfaces.HIDDEN_MODE
@button.buttonAndHandler(_(u'Submit'))
def handleApply(self, action):