[Zope3-checkins] CVS: Zope3/src/zope/app/browser/catalog - __init__.py:1.2 advanced.pt:1.2 catalog.py:1.2 catalog_icon.gif:1.2 configure.zcml:1.2
Anthony Baxter
anthony@interlink.com.au
Sat, 12 Jul 2003 23:36:22 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/catalog
In directory cvs.zope.org:/tmp/cvs-serv2618/app/browser/catalog
Added Files:
__init__.py advanced.pt catalog.py catalog_icon.gif
configure.zcml
Log Message:
Say hello to Mr. Catalog.
Merge of the melb-2003-content-catalog-branch.
Currently, only FieldIndexes are hooked up to catalogs. Will be
hooking up TextIndex next. Catalogs can be added as both Utilities
(see zope/app/catalog/catalog.txt for details on doing this) and in
Content space.
=== Zope3/src/zope/app/browser/catalog/__init__.py 1.1 => 1.2 ===
=== Zope3/src/zope/app/browser/catalog/advanced.pt 1.1 => 1.2 ===
--- /dev/null Sat Jul 12 23:36:20 2003
+++ Zope3/src/zope/app/browser/catalog/advanced.pt Sat Jul 12 23:35:45 2003
@@ -0,0 +1,41 @@
+<html metal:use-macro="context/@@standard_macros/page">
+<head>
+<title>Title Here</title>
+</head>
+<body>
+<div metal:fill-slot="body">
+ <table border="0">
+ <caption i18n:translate="">Advanced Catalog Thingies</caption>
+ <tbody>
+ <tr>
+ <span tal:condition="context/getSubscribed" tal:omit-tag="">
+ <td>Catalog is currently <strong>subscribed</strong> to the objectHub.</td>
+ <td><form method="post" action="unsubscribe.html">
+ <input type="submit" name="unsubscribe" value="Unsubscribe">
+ </form></td>
+ </span>
+ <span tal:condition="not:context/getSubscribed" tal:omit-tag="">
+ <td>Catalog is currently <strong>unsubscribed</strong> from the objectHub.</td>
+ <td><form method="post" action="subscribe.html">
+ <input type="submit" name="subscribe" value="Subscribe">
+ <input type="checkbox" value="true" name="update" CHECKED> (and reindex all objects, if checked)
+ </form></td>
+ </span>
+ </tr>
+ <tr>
+ <form method="POST" action="clear.html">
+ <td align="right">Clear all indexes<br><i>not hooked up yet</i></td>
+ <td><input type="submit" name="submit" value="Clear"></td>
+ </form>
+ </tr>
+ <tr>
+ <form method="POST" action="reindex.html">
+ <td align="right">Refresh all indexes<br><i>not hooked up yet</i></td>
+ <td><input type="submit" name="submit" value="Refresh"></td>
+ </form>
+ </tr>
+ </tbody>
+ </table>
+</div>
+</body>
+</html>
=== Zope3/src/zope/app/browser/catalog/catalog.py 1.1 => 1.2 ===
--- /dev/null Sat Jul 12 23:36:20 2003
+++ Zope3/src/zope/app/browser/catalog/catalog.py Sat Jul 12 23:35:45 2003
@@ -0,0 +1,48 @@
+from persistence import Persistent
+from zope.interface import implements
+from zope.component import getAdapter
+
+from zope.app.event import publish
+from zope.app.event.objectevent import ObjectCreatedEvent, ObjectModifiedEvent
+
+from zope.app.index.field.index import FieldIndex
+from zope.app.index.text.index import TextIndex
+
+from zope.app.interfaces.container import IAdding
+
+from zope.app.browser.container.adding import Adding
+
+from zope.app.catalog.catalog import Catalog
+
+import time
+
+from zope.app.interfaces.catalog.catalog import ICatalog, ICatalogView
+
+class CatalogEditView:
+ "Provides a user interface for configuring a catalog"
+
+ __used_for__ = ICatalog
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def subscribe(self, update=False):
+ self.context.subscribeEvents(update)
+ self.request.response.redirect(".")
+
+ def unsubscribe(self):
+ self.context.unsubscribeEvents()
+ self.request.response.redirect(".")
+
+ def clear(self):
+ self.context.clearIndexes()
+ self.request.response.redirect(".")
+
+ def reindex(self):
+ self.context.updateIndexes()
+ self.request.response.redirect(".")
+
+class IndexAdding(Adding):
+ menu_id = 'catalog_index_menu'
+
=== Zope3/src/zope/app/browser/catalog/catalog_icon.gif 1.1 => 1.2 ===
<Binary-ish file>
=== Zope3/src/zope/app/browser/catalog/configure.zcml 1.1 => 1.2 ===
--- /dev/null Sat Jul 12 23:36:21 2003
+++ Zope3/src/zope/app/browser/catalog/configure.zcml Sat Jul 12 23:35:45 2003
@@ -0,0 +1,90 @@
+<zopeConfigure xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:global_translation="http://namespaces.zope.org/gts"
+>
+
+<global_translation:registerTranslations directory="translation_files"/>
+
+<!-- Allow a catalog to be added to content space -->
+<browser:menuItem menu="add_content"
+ for="zope.app.interfaces.container.IAdding"
+ title="Catalog"
+ action="zope.app.catalog"
+ description="Catalog"
+/>
+
+<browser:icon name="zmi_icon"
+ for="zope.app.interfaces.catalog.catalog.ICatalog"
+ file="catalog_icon.gif"/>
+
+<browser:menuItem
+ menu="add_component"
+ action="zope.app.catalogutility"
+ title="Catalog"
+ for="zope.app.interfaces.container.IAdding"
+ permission="zope.ManageServices"
+ />
+
+<!-- Standard container 'contents' tab -->
+<browser:page
+ for="zope.app.interfaces.catalog.catalog.ICatalog"
+ name="contents.html"
+ menu="zmi_views"
+ title="Indexes"
+ attribute="contents"
+ class="zope.app.browser.container.contents.Contents"
+ permission="zope.ManageContent"
+/>
+
+<!-- This hooks up a custom add menu. This will be improved when
+ Jim finished refactoring Containers to suck less. -->
+<browser:view
+ for="zope.app.interfaces.catalog.catalog.ICatalog"
+ name="+"
+ menu="zmi_actions" title="Add"
+ class="zope.app.browser.catalog.catalog.IndexAdding"
+ permission="zope.ManageContent">
+ <browser:page name="index.html" attribute="index" />
+ <browser:page name="action.html" attribute="action" />
+</browser:view>
+
+<!-- the add menu is browser.IndexAdding -->
+<browser:menu id="catalog_index_menu" title="Add Index" />
+
+<!-- Add a couple of items to the add menu -->
+<!-- TextIndex -->
+<!-- Text index disabled for now, need to hook it's search index up better.
+<browser:menuItem
+ menu="catalog_index_menu"
+ for="zope.app.interfaces.container.IAdding"
+ action="zope.app.index.text.TextIndex"
+ title="Text Index"
+ description="An index to support full-text search"
+/>
+-->
+
+<!-- FieldIndex -->
+<browser:addform
+ name="AddFieldIndexToCatalog"
+ menu="catalog_index_menu" title="Field Index"
+ schema="zope.app.interfaces.index.field.IUIFieldCatalogIndex"
+ permission="zope.ManageServices"
+ content_factory="zope.app.index.field.index.FieldCatalogIndex"
+ arguments="field_name"
+ keyword_arguments="interface"
+/>
+
+<!-- the Advanced tab of the Catalog -->
+<browser:pages
+ for="zope.app.interfaces.catalog.catalog.ICatalog"
+ class="zope.app.browser.catalog.catalog.CatalogEditView"
+ permission="zope.ManageContent">
+ <browser:page name="index.html" template="advanced.pt"
+ menu="zmi_views" title="Advanced"/>
+ <browser:page name="subscribe.html" attribute="subscribe"/>
+ <browser:page name="unsubscribe.html" attribute="unsubscribe"/>
+ <browser:page name="clear.html" attribute="clear"/>
+ <browser:page name="reindex.html" attribute="reindex"/>
+</browser:pages>
+
+</zopeConfigure>