changed searchform to be a view for IFolderWithDocuments folders

This commit is contained in:
Frédéric Péters 2011-10-02 13:42:25 +02:00
parent 5daab1a1fd
commit 1b94a77533
5 changed files with 44 additions and 8 deletions

View File

@ -11,9 +11,10 @@
<include package="plone.app.z3cform" />
<browser:page
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="searchform"
for=".form.IFolderWithDocuments"
name="folder_listing"
class=".form.SearchView"
template="docsearch.pt"
permission="zope2.View"/>
</configure>

View File

@ -0,0 +1,25 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="tabellio.searchform">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading" tal:content="context/title" />
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div tal:replace="structure view/search_form"/>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
</body>
</html>

View File

@ -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()

View File

@ -8,13 +8,10 @@
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main"
tal:define="toLocalizedTime nocall:context/@@plone/toLocalizedTime">
<tal:main-macro metal:define-macro="main">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading" tal:content="context/title" />
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div tal:replace="structure view/search_form"/>

View File

@ -5,7 +5,7 @@
<dl class="enableFormTabbing" id="search-tabs">
<dt>Documents parlementaires</dt>
<dd>
<form method="post" action="." tal:attributes="action context/absolute_url">
<form method="post" action=".">
<metal:use use-macro="context/@@ploneform-macros/fields" />
<metal:use use-macro="context/@@ploneform-macros/actions" />
</form>