[Checkins] SVN: jquery.demo/trunk/src/jquery/demo/ Implemented live
search demo
Roger Ineichen
roger at projekt01.ch
Fri May 25 02:16:29 EDT 2007
Log message for revision 75954:
Implemented live search demo
Changed:
U jquery.demo/trunk/src/jquery/demo/configure.zcml
U jquery.demo/trunk/src/jquery/demo/jsonform/browser.py
A jquery.demo/trunk/src/jquery/demo/livesearch/
A jquery.demo/trunk/src/jquery/demo/livesearch/__init__.py
A jquery.demo/trunk/src/jquery/demo/livesearch/app.py
A jquery.demo/trunk/src/jquery/demo/livesearch/browser.py
A jquery.demo/trunk/src/jquery/demo/livesearch/browser.zcml
A jquery.demo/trunk/src/jquery/demo/livesearch/configure.zcml
A jquery.demo/trunk/src/jquery/demo/livesearch/index.pt
A jquery.demo/trunk/src/jquery/demo/livesearch/interfaces.py
A jquery.demo/trunk/src/jquery/demo/livesearch/json.py
A jquery.demo/trunk/src/jquery/demo/livesearch/json.zcml
A jquery.demo/trunk/src/jquery/demo/livesearch/website_json.pt
-=-
Modified: jquery.demo/trunk/src/jquery/demo/configure.zcml
===================================================================
--- jquery.demo/trunk/src/jquery/demo/configure.zcml 2007-05-25 06:11:38 UTC (rev 75953)
+++ jquery.demo/trunk/src/jquery/demo/configure.zcml 2007-05-25 06:16:28 UTC (rev 75954)
@@ -6,6 +6,7 @@
<include package=".resteditor" />
<include package=".jsonform" />
+ <include package=".livesearch" />
<!-- register additional JQuery javascripts for z3c.website -->
Modified: jquery.demo/trunk/src/jquery/demo/jsonform/browser.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/jsonform/browser.py 2007-05-25 06:11:38 UTC (rev 75953)
+++ jquery.demo/trunk/src/jquery/demo/jsonform/browser.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -35,7 +35,7 @@
class AddForm(SampleAddForm):
- label = _('Add JSON form sample')
+ label = _('Add JSONForm sample')
factory = app.JSONFormSample
Added: jquery.demo/trunk/src/jquery/demo/livesearch/__init__.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/__init__.py (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/__init__.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
Added: jquery.demo/trunk/src/jquery/demo/livesearch/app.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/app.py (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/app.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,26 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import zope.interface
+from z3c.website import sample
+from jquery.demo.livesearch import interfaces
+
+
+class LiveSearchSample(sample.Sample):
+ """Live search sample."""
+
+ zope.interface.implements(interfaces.ILiveSearchSample)
Added: jquery.demo/trunk/src/jquery/demo/livesearch/browser.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/browser.py (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/browser.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,43 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.component
+
+from z3c.website.i18n import MessageFactory as _
+from z3c.website.browser.page import PageAddForm
+from z3c.demo.calculator import calculator
+
+from z3c.template.interfaces import ILayoutTemplate
+from z3c.form.interfaces import IWidgets
+from z3c.form import form
+from z3c.form import field
+from z3c.pagelet import browser
+from z3c.website.browser.sample import SampleAddForm
+from jquery.demo.livesearch import interfaces
+from jquery.demo.livesearch import app
+
+
+class AddForm(SampleAddForm):
+
+ label = _('Add LiveSearch sample')
+ factory = app.LiveSearchSample
+
+
+class SamplePagelet(browser.BrowserPagelet):
+ """Sample live search form"""
Added: jquery.demo/trunk/src/jquery/demo/livesearch/browser.zcml
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/browser.zcml (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/browser.zcml 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,66 @@
+<configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ xmlns:z3c="http://namespaces.zope.org/z3c"
+ xmlns:jsonrpc="http://namespaces.zope.org/jsonrpc"
+ i18n_domain="jquery.demo">
+
+ <z3c:pagelet
+ name="addJQueryLiveSearch.html"
+ for="z3c.website.interfaces.ISamples"
+ provides="z3c.website.interfaces.ISampleAddForm"
+ class=".browser.AddForm"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ permission="z3c.website.ManageSite"
+ />
+
+ <z3c:pagelet
+ name="index.html"
+ for=".interfaces.ILiveSearchSample"
+ class=".browser.SamplePagelet"
+ provides="z3c.website.interfaces.ISamplePagelet"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ permission="zope.Public"
+ />
+
+ <z3c:template
+ template="index.pt"
+ for=".browser.SamplePagelet"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ />
+
+ <!-- json validator -->
+ <configure package="jquery.livesearch">
+ <resource
+ name="jquery.livesearch.js"
+ file="jquery.livesearch.js"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ />
+ <resource
+ name="jquery.livesearch.css"
+ file="jquery.livesearch.css"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ />
+
+ <viewlet
+ name="jquery.livesearch.js"
+ for="*"
+ manager="z3c.website.layer.IJavaScript"
+ class=".browser.LiveSearchJavaScriptViewlet"
+ permission="zope.Public"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ weight="100"
+ />
+
+ <viewlet
+ name="jquery.livesearch.css"
+ for="*"
+ manager="z3c.website.layer.ICSS"
+ class=".browser.LiveSearchCSSViewlet"
+ permission="zope.Public"
+ layer="z3c.website.layer.IWebSiteBrowserLayer"
+ weight="100"
+ />
+ </configure>
+
+</configure>
Added: jquery.demo/trunk/src/jquery/demo/livesearch/configure.zcml
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/configure.zcml (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/configure.zcml 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,19 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ i18n_domain="jquery.demo">
+
+ <class class=".app.LiveSearchSample">
+ <require
+ permission="zope.Public"
+ interface=".interfaces.ILiveSearchSample"
+ />
+ <require
+ permission="z3c.website.ManageContent"
+ set_schema=".interfaces.ILiveSearchSample"
+ />
+ </class>
+
+ <include file="browser.zcml" />
+ <include file="json.zcml" />
+
+</configure>
Added: jquery.demo/trunk/src/jquery/demo/livesearch/index.pt
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/index.pt (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/index.pt 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,8 @@
+<form id="liveSearch" name="liveSearch" action="." method="post">
+ <div class="title" i18n:translate="">
+ Live Search
+ </div>
+ <input id="liveSearchInput" type="text" name="liveSearchInput" />
+ <div id="liveSearchResultContainer" style="display: none;">
+ </div>
+</form>
Added: jquery.demo/trunk/src/jquery/demo/livesearch/interfaces.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/interfaces.py (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/interfaces.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+from z3c.website import interfaces
+
+
+class ILiveSearchSample(interfaces.ISample):
+ """Live search sample."""
Added: jquery.demo/trunk/src/jquery/demo/livesearch/json.py
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/json.py (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/json.py 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+$Id: layer.py 197 2007-04-13 05:03:32Z rineichen $
+"""
+
+import zope.component
+import zope.interface
+from zope.app.catalog.interfaces import ICatalog
+
+from jquery.livesearch.json import JSONLiveSearch
+
+
+class SampleLiveSearch(JSONLiveSearch):
+ """JSON live search method with template for rendering the result."""
+
+ indexName = 'text'
+
+ def getCatalog(self):
+ """Returns the right catalog.
+
+ Since we have only one search on the demo site, we ignore the searchId.
+ """
+ return zope.component.getUtility(ICatalog, name='WebSiteCatalog')
+
+
+class JSONWebSiteLiveSearch(JSONLiveSearch):
+ """JSON live search method with template for rendering the result."""
+
+ indexName = 'text'
+
+ def getCatalog(self):
+ """Returns the right catalog.
+
+ Since we have only one search on the demo site, we ignore the searchId.
+ """
+ return zope.component.getUtility(ICatalog, name='WebSiteCatalog')
+
+ def getWebSiteLiveSearchResult(self, searchString):
+ return super(JSONWebSiteLiveSearch, self).getLiveSearchResult(
+ searchString)
Added: jquery.demo/trunk/src/jquery/demo/livesearch/json.zcml
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/json.zcml (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/json.zcml 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,29 @@
+<configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser"
+ xmlns:z3c="http://namespaces.zope.org/z3c"
+ xmlns:jsonrpc="http://namespaces.zope.org/jsonrpc"
+ i18n_domain="jquery.demo">
+
+ <!-- register live search for the website -->
+ <jsonrpc:view
+ for="z3c.website.interfaces.IContent"
+ class=".json.SampleLiveSearch"
+ permission="zope.Public"
+ methods="getLiveSearchResult"
+ />
+
+ <jsonrpc:view
+ for="z3c.website.interfaces.IContent"
+ class=".json.JSONWebSiteLiveSearch"
+ permission="zope.Public"
+ methods="getWebSiteLiveSearchResult"
+ />
+
+ <!-- page template for WebSite Live Search result -->
+ <z3c:template
+ template="website_json.pt"
+ for=".json.JSONWebSiteLiveSearch"
+ />
+
+</configure>
Added: jquery.demo/trunk/src/jquery/demo/livesearch/website_json.pt
===================================================================
--- jquery.demo/trunk/src/jquery/demo/livesearch/website_json.pt (rev 0)
+++ jquery.demo/trunk/src/jquery/demo/livesearch/website_json.pt 2007-05-25 06:16:28 UTC (rev 75954)
@@ -0,0 +1,21 @@
+<div id="webSiteLiveSearchResult">
+ <div class="hideLiveSearchResult">
+ <a href="javascript:closeLiveSearchResult('webSiteLiveSearchResultContainer');">x</a>
+ </div>
+ <tal:block repeat="info view/results">
+ <div tal:define="oddrow repeat/info/odd;
+ url info/url"
+ tal:attributes="class python:oddrow and 'even' or 'odd'" >
+ <div class="right">
+ <a href=""
+ tal:attributes="href info/url"
+ tal:content="info/score" />
+ </div>
+ <div class="left">
+ <a href=""
+ tal:attributes="href string:${info/url}/@@SelectedManagementView.html"
+ tal:content="info/text" />
+ </div>
+ </div>
+ </tal:block>
+</div>
More information about the Checkins
mailing list