diff --git a/browser/configure.zcml b/browser/configure.zcml index e58a2ca..9fa353e 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -139,8 +139,8 @@ label="Add Document" name="AddLoopsDocument.html" schema="loops.interfaces.IDocument" - content_factory="loops.resource.Document" fields="title body format" + content_factory="loops.resource.Document" permission="zope.ManageContent" /> @@ -156,9 +156,69 @@ label="Edit Document" name="edit.html" schema="loops.interfaces.IDocument" + fields="title body format" for="loops.interfaces.IDocument" permission="zope.ManageContent" menu="zmi_views" title="Edit" /> + + + + + + + + + + + + + + + + + + diff --git a/configure.zcml b/configure.zcml index 0eca8e3..78d48dd 100644 --- a/configure.zcml +++ b/configure.zcml @@ -122,6 +122,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interfaces.py b/interfaces.py index 4056469..fd745f8 100644 --- a/interfaces.py +++ b/interfaces.py @@ -149,7 +149,7 @@ class IView(Interface): """ -class INode(IContainer): +class INode(IView): """ A node is a view that may contain other views, thus building a menu or folder hierarchy. """ diff --git a/tests.py b/tests.py index 02de377..3a02399 100755 --- a/tests.py +++ b/tests.py @@ -10,8 +10,11 @@ from zope.app.intid.interfaces import IIntIds from interfaces import ILoops from loops import Loops -from interfaces import IConcept, IConceptManager +from interfaces import IConcept, IConceptManager, IDocument, IResourceManager +from interfaces import INode, IViewManager from loops.concept import Concept, ConceptManager +from loops.resource import Document, ResourceManager +from loops.view import Node, ViewManager class Test(unittest.TestCase): "Basic tests for the loops package." @@ -23,6 +26,14 @@ class Test(unittest.TestCase): self.assert_(IConcept.providedBy(Concept())) verifyClass(IConceptManager, ConceptManager) self.assert_(IConceptManager.providedBy(ConceptManager())) + verifyClass(IDocument, Document) + self.assert_(IDocument.providedBy(Document())) + verifyClass(IResourceManager, ResourceManager) + self.assert_(IResourceManager.providedBy(ResourceManager())) + verifyClass(INode, Node) + self.assert_(INode.providedBy(Node())) + verifyClass(IViewManager, ViewManager) + self.assert_(IViewManager.providedBy(ViewManager())) def test_suite(): diff --git a/view.py b/view.py new file mode 100644 index 0000000..5806e7b --- /dev/null +++ b/view.py @@ -0,0 +1,68 @@ +# +# Copyright (c) 2005 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +Definition of the View and related classses. + +$Id$ +""" + +from zope.app import zapi +from zope.app.container.btree import BTreeContainer +from zope.app.container.contained import Contained +from zope.app.container.ordered import OrderedContainer +from zope.interface import implements +from persistent import Persistent + +from interfaces import IView, INode +from interfaces import IViewManager, IViewManagerContained +from interfaces import ILoopsContained + + +class View(object): + + implements(IView, IViewManagerContained) + + _title = u'' + def getTitle(self): return self._title + def setTitle(self, title): self._title = title + title = property(getTitle, setTitle) + + _description = u'' + def getDescription(self): return self._description + def setDescription(self, description): self._description = description + description = property(getDescription, setDescription) + + def __init__(self, name=None, title=u''): + self.title = title + self.description = description + + def getConcepts(self): + return [] + + +class Node(OrderedContainer, View): + + implements(INode) + + +class ViewManager(BTreeContainer): + + implements(IViewManager, ILoopsContained) + +