From 1b94a775338a5bf0eafaac9069bcf7c7440475c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 2 Oct 2011 13:42:25 +0200 Subject: [PATCH] changed searchform to be a view for IFolderWithDocuments folders --- tabellio/searchform/configure.zcml | 5 ++-- tabellio/searchform/docsearch.pt | 25 +++++++++++++++++++ tabellio/searchform/form.py | 15 ++++++++++- tabellio/searchform/form_templates/view.pt | 5 +--- .../form_templates/view_effectivesearch.pt | 2 +- 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 tabellio/searchform/docsearch.pt diff --git a/tabellio/searchform/configure.zcml b/tabellio/searchform/configure.zcml index 31a81d9..cdc4c85 100644 --- a/tabellio/searchform/configure.zcml +++ b/tabellio/searchform/configure.zcml @@ -11,9 +11,10 @@ diff --git a/tabellio/searchform/docsearch.pt b/tabellio/searchform/docsearch.pt new file mode 100644 index 0000000..9ea6852 --- /dev/null +++ b/tabellio/searchform/docsearch.pt @@ -0,0 +1,25 @@ + + + + + + +
+

+
+ +
+ +
+ + + + + + diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index f0b8fbf..c9dcddf 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -9,6 +9,13 @@ from plone.formwidget.contenttree import ObjPathSourceBinder from tabellio.searchform.interfaces import MessageFactory as _ +from Products.Five import BrowserView +from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile + + +class IFolderWithDocuments(interface.Interface): + pass + class ISearch(interface.Interface): nodoc = schema.TextLine(title=_(u'Document Number'), required=False) nosuite = schema.TextLine(title=_(u'Suite Number'), required=False) @@ -41,5 +48,11 @@ class SearchForm(form.Form): return self.request.response.redirect('./') return -SearchView = wrap_form(SearchForm) +SearchFormView = wrap_form(SearchForm) + +class SearchView(BrowserView): + def search_form(self): + f = SearchForm(self.context, self.request) + f.update() + return f.render() diff --git a/tabellio/searchform/form_templates/view.pt b/tabellio/searchform/form_templates/view.pt index bb9354e..9ea6852 100644 --- a/tabellio/searchform/form_templates/view.pt +++ b/tabellio/searchform/form_templates/view.pt @@ -8,13 +8,10 @@ - +
-

-
diff --git a/tabellio/searchform/form_templates/view_effectivesearch.pt b/tabellio/searchform/form_templates/view_effectivesearch.pt index 94665d6..6b5cad7 100644 --- a/tabellio/searchform/form_templates/view_effectivesearch.pt +++ b/tabellio/searchform/form_templates/view_effectivesearch.pt @@ -5,7 +5,7 @@
Documents parlementaires
-
+