[Zope3-checkins] CVS: Zope3/src/zope/app/catalog/browser - __init__.py:1.1 advanced.pt:1.1 catalog.py:1.1 catalog_icon.gif:1.1 configure.zcml:1.1

Philipp von Weitershausen philikon at philikon.de
Mon Mar 1 06:46:24 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/catalog/browser
In directory cvs.zope.org:/tmp/cvs-serv30793/catalog/browser

Added Files:
	__init__.py advanced.pt catalog.py catalog_icon.gif 
	configure.zcml 
Log Message:
Catalog, its interfaces and its browser views are now located in
zope.app.catalog.


=== Added File Zope3/src/zope/app/catalog/browser/__init__.py ===
# make this directory a package


=== Added File Zope3/src/zope/app/catalog/browser/advanced.pt ===
<html metal:use-macro="context/@@standard_macros/page">
<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 i18n:translate="">
            Catalog is currently <strong>subscribed</strong> to the 
            object hub.
          </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 
            object hub.
          </td>
          <td>
            <form method="post" action="subscribe.html">
              <input type="submit" name="subscribe" value="Subscribe"
                     i18n:attributes="value subscribe-button"/>
              <input type="checkbox" value="true" name="update" checked=""/> 
              <span tal:omit-tag="" i18n:translate="">
                (and reindex all objects, if checked)
              </span>
            </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"
                   i18n:attributes="value refresh-button"/>
          </td>
        </form>
      </tr>
    </tbody>
  </table>

</div>
</body>
</html>


=== Added File Zope3/src/zope/app/catalog/browser/catalog.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Catalog Views

$Id: catalog.py,v 1.1 2004/03/01 11:46:23 philikon Exp $
"""
from zope.app.browser.container.adding import Adding
from zope.app.catalog.interfaces.catalog import ICatalog

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'



=== Added File Zope3/src/zope/app/catalog/browser/catalog_icon.gif ===
  <Binary-ish file>

=== Added File Zope3/src/zope/app/catalog/browser/configure.zcml ===
<zope:configure 
   xmlns:zope="http://namespaces.zope.org/zope"
   xmlns="http://namespaces.zope.org/browser"
   i18n_domain="zope"
   >

  <!-- Allow a catalog to be added to content space -->
  <addMenuItem
      title="Catalog"
      description="A Catalog allows indexing and searching of objects"
      class="zope.app.catalog.catalog.Catalog"
      permission="zope.ManageContent"
      />

  <icon 
      name="zmi_icon" 
      for="zope.app.catalog.interfaces.catalog.ICatalog"
      file="catalog_icon.gif"
      />
  
  <addMenuItem
      title="Site Catalog"
      description="A Catalog allows indexing and searching of objects"
      class="zope.app.catalog.catalog.CatalogUtility"
      permission="zope.ManageServices"
     />

  <!-- Standard container 'contents' tab -->
  <page
      for="zope.app.catalog.interfaces.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.  -->
  <view
      for="zope.app.catalog.interfaces.catalog.ICatalog"
      name="+"
      menu="zmi_actions" title="Add"
      class="zope.app.catalog.browser.catalog.IndexAdding"
      permission="zope.ManageContent">
    <page name="index.html"  attribute="index" />
    <page name="action.html" attribute="action" />
  </view>
  
  <!-- the add menu is browser.IndexAdding -->
  <menu id="catalog_index_menu" title="Add Index" usage="addingdialog" />
  
  <!-- Add a couple of items to the add menu -->
  <!-- TextIndex -->
  <addform
      name="AddTextIndexToCatalog"
      menu="catalog_index_menu" title="Text Index"
      schema="zope.app.interfaces.index.text.IUITextCatalogIndex"
      permission="zope.ManageServices"
      content_factory="zope.app.index.text.index.TextCatalogIndex"
      arguments="field_name"
      keyword_arguments="interface"
      description="A full text index"
      />
  
  <!-- FieldIndex -->
  <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"
      description="An index of a specific field"
      />
  
  <!-- KeywordIndex -->
  <addform
      name="AddKeywordIndexToCatalog"
      menu="catalog_index_menu" title="Keyword Index"
      schema="zope.app.interfaces.index.keyword.IUIKeywordCatalogIndex"
      permission="zope.ManageServices"
      content_factory="zope.app.index.keyword.index.KeywordCatalogIndex"
      arguments="field_name"
      keyword_arguments="interface"
      description="A keyword index of a specific field"
      />
  
  <!-- the Advanced tab of the Catalog -->
  <pages
      for="zope.app.catalog.interfaces.catalog.ICatalog"
      class="zope.app.catalog.browser.catalog.CatalogEditView"
      permission="zope.ManageContent">
  
    <page name="index.html" template="advanced.pt"
          menu="zmi_views" title="Advanced"/>
    <page name="subscribe.html" attribute="subscribe"/>
    <page name="unsubscribe.html" attribute="unsubscribe"/>
    <page name="clear.html" attribute="clear"/>
    <page name="reindex.html" attribute="reindex"/>
  </pages>

</zope:configure>




More information about the Zope3-Checkins mailing list