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:
parent
6cabe58f9f
commit
89ae9aeab0
10 changed files with 149 additions and 2 deletions
|
@ -319,6 +319,7 @@
|
||||||
<include package=".knowledge" />
|
<include package=".knowledge" />
|
||||||
<include package=".organize" />
|
<include package=".organize" />
|
||||||
<include package=".process" />
|
<include package=".process" />
|
||||||
|
<include package=".search" />
|
||||||
<include package=".browser" />
|
<include package=".browser" />
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<zope:adapter
|
<zope:adapter
|
||||||
name="mystuff"
|
name="mystuff"
|
||||||
for="loops.interfaces.IConcept
|
for="loops.interfaces.IConcept
|
||||||
zope.publisher.interfaces.browser.IBrowserRequest"
|
zope.publisher.interfaces.browser.IBrowserRequest"
|
||||||
provides="zope.interface.Interface"
|
provides="zope.interface.Interface"
|
||||||
factory="loops.organize.browser.MyStuff"
|
factory="loops.organize.browser.MyStuff"
|
||||||
permission="zope.View"
|
permission="zope.View"
|
||||||
|
|
6
search/README.txt
Executable file
6
search/README.txt
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
===================================================================
|
||||||
|
loops.search - Provide search functionality for the loops framework
|
||||||
|
===================================================================
|
||||||
|
|
||||||
|
($Id$)
|
||||||
|
|
4
search/__init__.py
Normal file
4
search/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
4
search/browser/__init__.py
Normal file
4
search/browser/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
48
search/browser/base.py
Normal file
48
search/browser/base.py
Normal 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']
|
||||||
|
|
26
search/browser/configure.zcml
Normal file
26
search/browser/configure.zcml
Normal 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
22
search/browser/search.pt
Normal 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
10
search/configure.zcml
Normal 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
26
search/tests.py
Executable 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')
|
Loading…
Add table
Reference in a new issue