[Zope3-checkins] CVS: zopeproducts/zwiki - wiki.py:1.1 wikipage.py:1.1 TODO.txt:1.12 configure.zcml:1.15 add.pt:NONE browser.py:NONE comment_page.pt:NONE parents_page.pt:NONE view_page.pt:NONE wiki_icon.gif:NONE wiki_toc.pt:NONE wikipage_icon.gif:NONE zwiki.py:NONE
Stephan Richter
srichter@cbu.edu
Wed, 9 Apr 2003 17:47:46 -0400
Update of /cvs-repository/zopeproducts/zwiki
In directory cvs.zope.org:/tmp/cvs-serv14209
Modified Files:
TODO.txt configure.zcml
Added Files:
wiki.py wikipage.py
Removed Files:
add.pt browser.py comment_page.pt parents_page.pt view_page.pt
wiki_icon.gif wiki_toc.pt wikipage_icon.gif zwiki.py
Log Message:
Whee, this is a big structural change. I am making this the last location
chnage for Wiki and WikiPage, so that people can start using zwiki for
Zope 3 for their sites. Before the next structural change, I will provide
tools to import and export the data in XML without loss of information.
Here are the changes:
- Created browser directory and moved everything browser-related in there.
- Moved Wiki and WikiPage broswer code into separate files.
- Added 'wiki' skin.
- Moved Wiki and WikiPage content objects into their own files.
- Adjusted tests and configuration to reflect this change.
Okay, back to working on the stylesheet stuff. :))
=== Added File zopeproducts/zwiki/wiki.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.
#
##############################################################################
"""Wiki implementation
$Id: wiki.py,v 1.1 2003/04/09 21:47:15 srichter Exp $
"""
from zope.app.content.folder import Folder
from zopeproducts.zwiki.interfaces import IWiki
from zopeproducts.zwiki.wikipage import WikiPage
class Wiki(Folder):
__doc__ = IWiki.__doc__
__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()
=== Added File zopeproducts/zwiki/wikipage.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.
#
##############################################################################
"""Wiki implementation
$Id: wikipage.py,v 1.1 2003/04/09 21:47:15 srichter Exp $
"""
from persistence import Persistent
from zope.component import getAdapter
from zope.proxy.context import ContextWrapper
from zope.app.traversing import getParent, objectName
from zope.app.interfaces.annotation import IAnnotations
from zopeproducts.zwiki.interfaces import IWikiPage, IWikiPageHierarchy
__metaclass__ = type
HierarchyKey = 'http://www.zope.org/zwiki#1.0/PageHierarchy/parents'
class WikiPage(Persistent):
__doc__ = IWikiPage.__doc__
__implements__ = IWikiPage
# See zopeproducts.zwiki.interfaces.IWikiPage
source = u''
# See zopeproducts.zwiki.interfaces.IWikiPage
type = u'Plain Text'
def __init__(self):
self.__comments = 1
def append(self, source):
"See zopeproducts.zwiki.interfaces.IWikiPage"
self.source += source
def comment(self, comment):
"See zopeproducts.zwiki.interfaces.IWikiPage"
self.__comments += 1
self.append(comment)
def getCommentCounter(self):
"See zopeproducts.zwiki.interfaces.IWikiPage"
return self.__comments
class WikiPageHierarchyAdapter:
__doc__ = IWikiPageHierarchy.__doc__
__implements__ = IWikiPageHierarchy
__used_for__ = IWikiPage
def __init__(self, context):
self.context = context
self._annotations = getAdapter(context, IAnnotations)
if not self._annotations.get(HierarchyKey):
self._annotations[HierarchyKey] = ()
def reparent(self, parents):
"See zopeproducts.zwiki.interfaces.IWikiPageHierarchy"
self.setParents(parents)
def setParents(self, parents):
data = self._annotations.get(HierarchyKey)
self._annotations[HierarchyKey] = tuple(parents)
def getParents(self):
return self._annotations[HierarchyKey]
parents = property(getParents, setParents)
def path(self):
"See zopeproducts.zwiki.interfaces.IWikiPageHierarchy"
# XXX: Allow for multpile parents
if not self.getParents():
return [self.context]
wiki = getParent(self.context)
name = self.getParents()[0]
print wiki
wrapped = ContextWrapper(wiki[name], wiki, name=name)
hier = getAdapter(wrapped, IWikiPageHierarchy)
return hier.path() + [self.context]
def findChildren(self, recursive=True):
"See zopeproducts.zwiki.interfaces.IWikiPageHierarchy"
wiki = getParent(self.context)
contextName = objectName(self.context)
children = []
for pageName in wiki:
wrapped = ContextWrapper(wiki[pageName], wiki, name=pageName)
hier = getAdapter(wrapped, IWikiPageHierarchy)
if contextName in hier.getParents():
if recursive:
subs = hier.findChildren()
else:
subs = ()
children.append((wrapped, subs))
return children
# Adapters for file-system style access
class WikiPageReadFile:
def __init__(self, context):
self.context = context
def read(self):
return self.context.source
def size(self):
return len(self.context.source)
class WikiPageWriteFile:
def __init__(self, context):
self.context = context
def write(self, data):
self.context.source = unicode(data)
=== zopeproducts/zwiki/TODO.txt 1.11 => 1.12 ===
--- zopeproducts/zwiki/TODO.txt:1.11 Wed Apr 9 12:27:28 2003
+++ zopeproducts/zwiki/TODO.txt Wed Apr 9 17:47:15 2003
@@ -12,8 +12,7 @@
Rendering/Views
- - Create a custom skin, so that we are not relying on the standard Zope 3
- skin.
+ - Finish 'wiki' skin.
- Create custom HTMLDocument class for rendering the STX and ReST in Wiki
style.
=== zopeproducts/zwiki/configure.zcml 1.14 => 1.15 ===
--- zopeproducts/zwiki/configure.zcml:1.14 Wed Apr 9 12:27:28 2003
+++ zopeproducts/zwiki/configure.zcml Wed Apr 9 17:47:15 2003
@@ -1,99 +1,100 @@
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
- xmlns:browser="http://namespaces.zope.org/browser"
- xmlns:gts="http://namespaces.zope.org/gts"
- xmlns:wiki="http://namespaces.zope.org/wiki">
-
-<!-- Security definitions -->
-
-<role
- id="WikiUser"
- title="Wiki User"
- description="Someone who looks at the wiki, but can only comment on them."
- />
-
-<role
- id="WikiEditor"
- title="Wiki Editor"
- description="The Wiki Editor can create and edit wikis."
- />
-
-<role
- id="WikiAdmin"
- title="Wiki Administrator"
- description="The Wiki Admin can fully manage wiki pages."
- />
-
-<permission
- id="zopeproducts.zwiki.ViewWikiPage"
- title="View Wiki Page"
- description="View a Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.ViewWikiPage"
- role="WikiUser"
- />
-
-<permission
- id="zopeproducts.zwiki.CommentWikiPage"
- title="Comment on Wiki Page"
- description="Make a comment on Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.CommentWikiPage"
- role="WikiUser"
- />
-
-<permission
- id="zopeproducts.zwiki.AddWikiPage"
- title="Add Wiki Page"
- description="Add Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.AddWikiPage"
- role="WikiEditor"
- />
-
-<permission
- id="zopeproducts.zwiki.EditWikiPage"
- title="Edit Wiki Page"
- description="Edit Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.EditWikiPage"
- role="WikiEditor"
- />
-
-<permission
- id="zopeproducts.zwiki.DeleteWikiPage"
- title="Delete Wiki Page"
- description="Delete Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.DeleteWikiPage"
- role="WikiAdmin"
- />
-
-<permission
- id="zopeproducts.zwiki.ReparentWikiPage"
- title="Reparent Wiki Page"
- description="Reparent a Wiki Page."
- />
-
-<grant
- permission="zopeproducts.zwiki.ReparentWikiPage"
- role="WikiAdmin"
- />
+ xmlns:translate="http://namespaces.zope.org/gts">
+ <!-- Register wiki ZCML namespace directives -->
+ <include file="meta.zcml" />
-<!-- Content declarations -->
+ <!-- Security definitions -->
- <content class=".zwiki.Wiki">
+ <role
+ id="WikiUser"
+ title="Wiki User"
+ description="Wiki visitors, which can only view and comment on wikis."
+ />
+
+ <role
+ id="WikiEditor"
+ title="Wiki Editor"
+ description="The Wiki Editor can create and edit wikis."
+ />
+
+ <role
+ id="WikiAdmin"
+ title="Wiki Administrator"
+ description="The Wiki Admin can fully manage wiki pages."
+ />
+
+ <permission
+ id="zopeproducts.zwiki.ViewWikiPage"
+ title="View Wiki Page"
+ description="View a Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.ViewWikiPage"
+ role="WikiUser"
+ />
+
+ <permission
+ id="zopeproducts.zwiki.CommentWikiPage"
+ title="Comment on Wiki Page"
+ description="Make a comment on Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.CommentWikiPage"
+ role="WikiUser"
+ />
+
+ <permission
+ id="zopeproducts.zwiki.AddWikiPage"
+ title="Add Wiki Page"
+ description="Add Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.AddWikiPage"
+ role="WikiEditor"
+ />
+
+ <permission
+ id="zopeproducts.zwiki.EditWikiPage"
+ title="Edit Wiki Page"
+ description="Edit Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.EditWikiPage"
+ role="WikiEditor"
+ />
+
+ <permission
+ id="zopeproducts.zwiki.DeleteWikiPage"
+ title="Delete Wiki Page"
+ description="Delete Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.DeleteWikiPage"
+ role="WikiAdmin"
+ />
+
+ <permission
+ id="zopeproducts.zwiki.ReparentWikiPage"
+ title="Reparent Wiki Page"
+ description="Reparent a Wiki Page."
+ />
+
+ <grant
+ permission="zopeproducts.zwiki.ReparentWikiPage"
+ role="WikiAdmin"
+ />
+
+
+ <!-- Content declarations -->
+
+ <content class=".wiki.Wiki">
<implements interface="zope.app.interfaces.container.IContentContainer" />
@@ -126,7 +127,7 @@
</content>
- <content class=".zwiki.WikiPage">
+ <content class=".wikipage.WikiPage">
<factory
id="WikiPage"
@@ -146,157 +147,49 @@
</content>
<adapter
- factory=".zwiki.WikiPageHierarchyAdapter"
+ factory=".wikipage.WikiPageHierarchyAdapter"
provides=".interfaces.IWikiPageHierarchy"
for=".interfaces.IWikiPage" />
+ <adapter
+ factory=".traversal.WikiPageTraversable"
+ provides="zope.app.interfaces.traversing.ITraversable"
+ for=".interfaces.IWikiPage" />
- <!-- Browser-specific configuration -->
-
- <browser:menu
- id="add_wiki"
- title="Menu of objects to be added to wikis."/>
-
- <!-- Custom adding view. -->
- <browser:view
- for=".interfaces.IWiki"
- name="+"
- class=".browser.WikiAdding"
- permission="zope.ManageContent"
- allowed_attributes="addingInfo"
- menu="zmi_actions"
- title="Add"
- >
- <browser:page name="index.html" template="add.pt" />
- <browser:page name="action.html" attribute="action" />
- </browser:view>
-
- <browser:page
- name="toc.html"
- for=".interfaces.IWiki"
- class=".browser.TableOfContents"
- template="wiki_toc.pt"
- permission="zopeproducts.zwiki.ViewWikiPage"
- menu="zmi_views"
- title="TOC"/>
-
-
- <browser:menuItem menu="add_content"
- for="zope.app.interfaces.container.IAdding"
- title="Wiki"
- action="Wiki"
- description="A simple Wiki."/>
-
- <browser:icon
- name="zmi_icon"
- for=".interfaces.IWiki"
- file="wiki_icon.gif"
- />
- <!-- WikiPage browser configuration -->
+ <!-- WikiPage FTP configurations -->
+ <adapter
+ for=".interfaces.IWikiPage"
+ provides="zope.app.interfaces.file.IReadFile"
+ factory=".wikipage.WikiPageReadFile"
+ permission="zopeproducts.zwiki.ViewWikiPage"
+ />
+
+ <adapter
+ for=".interfaces.IWikiPage"
+ provides="zope.app.interfaces.file.IWriteFile"
+ factory=".wikipage.WikiPageWriteFile"
+ permission="zopeproducts.zwiki.EditWikiPage"
+ />
+
+ <!-- Wiki-specifc configuration -->
+
+ <serviceType
+ id="WikiSourceTypeRegistry"
+ interface=".interfaces.IWikiSourceTypeService" />
- <browser:addform
- label="Add Wiki Page"
- name="AddWikiPage"
- schema=".interfaces.IWikiPage"
- content_factory=".zwiki.WikiPage"
- permission="zopeproducts.zwiki.AddWikiPage"
- fields="source type"
- class=".browser.EditWikiPage"
- menu="add_wiki"
- title="Wiki Page"/>
-
- <browser:editform
- schema=".interfaces.IWikiPage"
- for=".interfaces.IWikiPage"
- label="Change Wiki Page"
- name="edit.html"
- permission="zopeproducts.zwiki.EditWikiPage"
- fields="source type"
- class=".browser.EditWikiPage"
- menu="zmi_views" title="Edit" />
-
- <browser:pages
- for=".interfaces.IWikiPage"
- class=".browser.ViewWikiPage"
- permission="zopeproducts.zwiki.ViewWikiPage">
- <browser:page name="view.html" template="view_page.pt"
- menu="zmi_views" title="View" />
- <browser:page name="jumpto.html" attribute="jumpTo" />
- </browser:pages>
-
- <browser:pages
- for=".interfaces.IWikiPage"
- class=".browser.EditWikiParents"
- permission="zopeproducts.zwiki.ReparentWikiPage">
- <browser:page name="parents.html" template="parents_page.pt"
- menu="zmi_views" title="Parents" />
- <browser:page name="setParents.html" attribute="setParents" />
- </browser:pages>
-
- <browser:pages
- for=".interfaces.IWikiPage"
- class=".browser.WikiPageComment"
- permission="zopeproducts.zwiki.CommentWikiPage">
- <browser:page name="commentForm.html" template="comment_page.pt"
- menu="zmi_views" title="Add Comment" />
- <browser:page name="addComment.html" attribute="comment" />
- </browser:pages>
-
- <browser:defaultView
- name="view.html"
- for=".interfaces.IWikiPage"/>
-
- <browser:icon
- name="zmi_icon"
- for=".interfaces.IWikiPage"
- file="wikipage_icon.gif"
- />
-
-<browser:page
- name="_traverse"
- for=".interfaces.IWikiPage"
- class=".traversal.WikiPageTraverser"
- permission="zope.Public" />
-
-<adapter
- factory=".traversal.WikiPageTraversable"
- provides="zope.app.interfaces.traversing.ITraversable"
- for=".interfaces.IWikiPage" />
-
-
-<!-- WikiPage FTP configurations -->
-<adapter
- for=".interfaces.IWikiPage"
- provides="zope.app.interfaces.file.IReadFile"
- factory=".zwiki.WikiPageReadFile"
- permission="zopeproducts.zwiki.ViewWikiPage"
- />
-
-<adapter
- for=".interfaces.IWikiPage"
- provides="zope.app.interfaces.file.IWriteFile"
- factory=".zwiki.WikiPageWriteFile"
- permission="zopeproducts.zwiki.EditWikiPage"
- />
-
-
-<!-- Wiki-specifc configuration -->
-
-<serviceType
- id="WikiSourceTypeRegistry"
- interface=".interfaces.IWikiSourceTypeService" />
-
-<service
- serviceType="WikiSourceTypeRegistry"
- permission="zopeproducts.zwiki.ViewWikiPage"
- component=".sourcetype.SourceTypes" />
+ <service
+ serviceType="WikiSourceTypeRegistry"
+ permission="zopeproducts.zwiki.ViewWikiPage"
+ component=".sourcetype.SourceTypes" />
-<include file="meta.zcml" />
-<include package=".renderer" />
+ <!-- Register the various renderers, like plain text, stx, and rest -->
+ <include package=".renderer" />
-<!-- Register translations -->
+ <!-- Register various browser related components, including all views -->
+ <include package=".browser" />
-<gts:registerTranslations directory="locales" />
+ <!-- Register translations -->
+ <translate:registerTranslations directory="locales" />
</zopeConfigure>
=== Removed File zopeproducts/zwiki/add.pt ===
=== Removed File zopeproducts/zwiki/browser.py ===
=== Removed File zopeproducts/zwiki/comment_page.pt ===
=== Removed File zopeproducts/zwiki/parents_page.pt ===
=== Removed File zopeproducts/zwiki/view_page.pt ===
=== Removed File zopeproducts/zwiki/wiki_icon.gif ===
=== Removed File zopeproducts/zwiki/wiki_toc.pt ===
=== Removed File zopeproducts/zwiki/wikipage_icon.gif ===
=== Removed File zopeproducts/zwiki/zwiki.py ===