added loops.search package

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1283 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2006-08-04 12:14:13 +00:00
parent 6cabe58f9f
commit 89ae9aeab0
10 changed files with 149 additions and 2 deletions

View file

@ -319,6 +319,7 @@
<include package=".knowledge" />
<include package=".organize" />
<include package=".process" />
<include package=".search" />
<include package=".browser" />
</configure>

View file

@ -50,7 +50,7 @@
<zope:adapter
name="mystuff"
for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest"
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
factory="loops.organize.browser.MyStuff"
permission="zope.View"
@ -66,7 +66,7 @@
factory="cybertools.browser.widget.SimpleListDisplayWidget"
permission="zope.Public"
/>
<!-- member registration -->
<zope:adapter factory="loops.organize.member.MemberRegistrationManager"

6
search/README.txt Executable file
View file

@ -0,0 +1,6 @@
===================================================================
loops.search - Provide search functionality for the loops framework
===================================================================
($Id$)

4
search/__init__.py Normal file
View file

@ -0,0 +1,4 @@
"""
$Id$
"""

View file

@ -0,0 +1,4 @@
"""
$Id$
"""

48
search/browser/base.py Normal file
View file

@ -0,0 +1,48 @@
#
# Copyright (c) 2004 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Definition of basic view classes and other browser related stuff for the
loops.search package.
$Id$
"""
from zope import interface, component
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from zope.formlib.namedtemplate import NamedTemplate, NamedTemplateImplementation
from zope.i18nmessageid import MessageFactory
from loops.browser.common import BaseView
_ = MessageFactory('zope')
search_macros = NamedTemplateImplementation(
ViewPageTemplateFile('search.pt'))
class Search(BaseView):
template = NamedTemplate('loops.search_macros')
@Lazy
def macro(self):
return self.template.macros['search']

View file

@ -0,0 +1,26 @@
<!-- $Id$ -->
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="zope">
<!-- named templates -->
<zope:adapter
factory="loops.search.browser.base.search_macros"
for="loops.browser.common.BaseView"
name="loops.search_macros" />
<!-- the real view -->
<zope:adapter
name="search"
for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
factory="loops.search.browser.base.Search"
permission="zope.View"
/>
</configure>

22
search/browser/search.pt Normal file
View file

@ -0,0 +1,22 @@
<metal:search define-macro="search">
<div>
<h3 tal:attributes="class string:content-$level;
ondblclick item/openEditWindow">
Search
</h3>
<div metal:define-macro="search_form">
<fieldset class="box">
<form action=".">
<input name="search" />
</form>
</fieldset>
</div>
<div metal:define-macro="search_results">
<fieldset class="box">
</fieldset>
</div>
</div>
</metal:search>

10
search/configure.zcml Normal file
View file

@ -0,0 +1,10 @@
<!-- $Id$ -->
<configure
xmlns="http://namespaces.zope.org/zope"
i18n_domain="zope"
>
<include package=".browser" />
</configure>

26
search/tests.py Executable file
View file

@ -0,0 +1,26 @@
# $Id$
import unittest, doctest
from zope.testing.doctestunit import DocFileSuite
from zope.interface.verify import verifyClass
#from loops.search.interfaces import ...
class Test(unittest.TestCase):
"Basic tests for the loops.search package."
def testBase(self):
pass
def test_suite():
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
return unittest.TestSuite((
unittest.makeSuite(Test),
DocFileSuite('README.txt',
optionflags=flags,),
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')