[Zope3-checkins] CVS: zopeproducts/zwiki - index.py:1.1 TODO.txt:1.13 configure.zcml:1.17 wiki.py:1.2 wikipage.py:1.2

Stephan Richter srichter@cbu.edu
Thu, 10 Apr 2003 07:32:09 -0400


Update of /cvs-repository/zopeproducts/zwiki
In directory cvs.zope.org:/tmp/cvs-serv2884

Modified Files:
	TODO.txt configure.zcml wiki.py wikipage.py 
Added Files:
	index.py 
Log Message:
- Added Search Functionality using a custom TextIndex called WikiTextIndex.

- Added more complex Wiki Creator. It asks you whether you want to install
  the search capabilities automatically and whether you want a FrontPage
  to start with.

There is still an open issue that events do not seem to arrive, and 
therefore I have to refresh the index manually; this really sucks, since I
do not even have to start with the E-mail subscriptions then.


=== Added File zopeproducts/zwiki/index.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.
#
##############################################################################
"""A custom Text Index for Wikis

$Id: index.py,v 1.1 2003/04/10 11:31:38 srichter Exp $
"""
from zope.app.index.text.index import TextIndex
from zopeproducts.zwiki.interfaces import IWikiPage

class WikiTextIndex(TextIndex):

    def notify(wrapped_self, event):
        """An event occurred.  Index or unindex the object in response."""
        if IWikiPage.isImplementedBy(event.object):
            super(WikiTextIndex, wrapped_self).notify(event)
            


=== zopeproducts/zwiki/TODO.txt 1.12 => 1.13 ===
--- zopeproducts/zwiki/TODO.txt:1.12	Wed Apr  9 17:47:15 2003
+++ zopeproducts/zwiki/TODO.txt	Thu Apr 10 07:31:38 2003
@@ -12,8 +12,6 @@
 
   Rendering/Views
 
-    - Finish 'wiki' skin.
-
     - Create custom HTMLDocument class for rendering the STX and ReST in Wiki
       style.
 
@@ -24,20 +22,13 @@
     - Create a Management screen (advancedform) that is accessible for users
       without management rights.
 
-    - Improve 'Add Comment' screen to show existing Wiki content.
-
 
   Other Features
 
-    - When creating a Wiki, the FrontPage WikiPage should be created by
-      default.
-
     - Make use of Traverser features; i.e. create links that include
       parents...
 
     - Check in Traverser that found subobj has self.context as parent.
-
-    - Implement search.
 
     - Implement events, so that we can have E-mail subscriptions to Wiki
       changes.


=== zopeproducts/zwiki/configure.zcml 1.16 => 1.17 ===
--- zopeproducts/zwiki/configure.zcml:1.16	Thu Apr 10 02:28:14 2003
+++ zopeproducts/zwiki/configure.zcml	Thu Apr 10 07:31:38 2003
@@ -104,7 +104,6 @@
     <factory
         id="Wiki"
         permission="zope.ManageContent"
-        title="Wiki"
         description="Minimal Wiki Page Container implementation " />
 
     <allow
@@ -157,6 +156,12 @@
       for=".interfaces.IWikiPage" />
 
 
+  <adapter 
+      factory="zopeproducts.zwiki.wikipage.SearchableText"
+      provides="zope.app.interfaces.index.text.ISearchableText"
+      for="zopeproducts.zwiki.interfaces.IWikiPage" />
+
+
   <!-- WikiPage FTP configurations -->
   <adapter 
      for=".interfaces.IWikiPage"
@@ -182,6 +187,26 @@
       serviceType="WikiSourceTypeRegistry"
       permission="zopeproducts.zwiki.ViewWikiPage"
       component=".sourcetype.SourceTypes" />
+
+  <!-- Wiki Index registration -->
+
+  <content class=".index.WikiTextIndex">
+
+    <require
+        permission="zope.ManageServices"
+        interface="zope.app.interfaces.index.text.IUITextIndex"
+        attributes="query"
+        />
+
+    <factory
+        id="zopeproducts.zwiki.index.WikiTextIndex"
+        permission="zope.ManageServices"
+        />
+    <implements
+        interface="zope.app.interfaces.services.query.IQueryProcessable"
+        />
+
+  </content>
 
   <!-- Register the various renderers, like plain text, stx, and rest -->  
   <include package=".renderer" />


=== zopeproducts/zwiki/wiki.py 1.1 => 1.2 ===
--- zopeproducts/zwiki/wiki.py:1.1	Wed Apr  9 17:47:15 2003
+++ zopeproducts/zwiki/wiki.py	Thu Apr 10 07:31:38 2003
@@ -25,20 +25,3 @@
 
     __implements__ = (IWiki, Folder.__implements__)
 
-
-# XXX: Factory not yet in use!!!
-class WikiFactory:
-    #__implements__ = IFactory
-    
-    def __call__(self):
-        wiki = Wiki()
-        page = WikiPage()
-        page.type = u'Structured Text'
-        page.source = u'This is the FrontPage of the Wiki.'
-        wiki.setObject('FrontPage', page)
-        return wiki
-
-    def getInterfaces(self):
-        return Wiki.__implements__
-
-WikiFactory = WikiFactory()


=== zopeproducts/zwiki/wikipage.py 1.1 => 1.2 ===
--- zopeproducts/zwiki/wikipage.py:1.1	Wed Apr  9 17:47:15 2003
+++ zopeproducts/zwiki/wikipage.py	Thu Apr 10 07:31:38 2003
@@ -134,3 +134,18 @@
     def write(self, data):
         self.context.source = unicode(data)
 
+
+# Adapter for ISearchableText
+
+from zope.app.interfaces.index.text import ISearchableText
+
+class SearchableText:
+
+    __implements__ = ISearchableText
+    __used_for__ = IWikiPage
+
+    def __init__(self, page):
+        self.page = page
+
+    def getSearchableText(self):
+        return [unicode(self.page.source)]