From 8bb93765fc15231218f994dd930b93bd99cb9adf Mon Sep 17 00:00:00 2001 From: helmutm Date: Thu, 18 Sep 2008 10:15:55 +0000 Subject: [PATCH] work in progress: use layout composer via LayoutNode git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2890 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/configure.zcml | 29 ++++++++++++++++++++++++ browser/layout/configure.zcml | 21 ----------------- configure.zcml | 16 ++++++++++++- interfaces.py | 17 ++++++++++++++ {browser/layout => layout}/__init__.py | 0 browser/layout/node.py => layout/base.py | 25 ++++---------------- layout/configure.zcml | 23 +++++++++++++++++++ tests/setup.py | 1 + view.py | 7 ++++++ 9 files changed, 97 insertions(+), 42 deletions(-) delete mode 100644 browser/layout/configure.zcml rename {browser/layout => layout}/__init__.py (100%) rename browser/layout/node.py => layout/base.py (62%) create mode 100644 layout/configure.zcml diff --git a/browser/configure.zcml b/browser/configure.zcml index 729893d..69aebe9 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -565,6 +565,35 @@ + + + + + + + + + + + - - - - - - - - - - diff --git a/configure.zcml b/configure.zcml index a778f5c..79ca278 100644 --- a/configure.zcml +++ b/configure.zcml @@ -184,6 +184,20 @@ interface="zope.app.container.interfaces.IReadContainer" />--> + + + + + + + + - @@ -435,6 +448,7 @@ + diff --git a/interfaces.py b/interfaces.py index 24eb26a..bfb67c4 100644 --- a/interfaces.py +++ b/interfaces.py @@ -511,6 +511,23 @@ class INodeContained(Interface): containers(INode, IViewManager) +# layout views/nodes + +class ILayoutView(INodeSchema): + """ Base interface for view nodes that use the cybertools.composer.layout + presentation mechanism. + """ + + +class ILayoutNode(ILayoutView, IBaseNode): + + contains(ILayoutView) + + +class ILayoutNodeContained(Interface): + containers(ILayoutNode, IViewManager) + + # record manager interfaces class IRecordManager(ILoopsObject): diff --git a/browser/layout/__init__.py b/layout/__init__.py similarity index 100% rename from browser/layout/__init__.py rename to layout/__init__.py diff --git a/browser/layout/node.py b/layout/base.py similarity index 62% rename from browser/layout/node.py rename to layout/base.py index a0e04bd..72ea308 100644 --- a/browser/layout/node.py +++ b/layout/base.py @@ -17,33 +17,18 @@ # """ -Layout management and controlling via view space nodes. +Layout stuff $Id$ """ -from zope.cachedescriptors.property import Lazy -from zope.component import adapts from zope.interface import implements -from cybertools.composer.layout.interfaces import ILayout -from loops.interfaces import INode -from loops.view import nodeTypes, NodeAdapter +from loops.interfaces import ILayoutNode, ILayoutNodeContained +from loops.view import Node -nodeTypes.append(('layout', 'Layout')) +class LayoutNode(Node): - -class NodeLayoutProvider(NodeAdapter): - - pass - - -class NodeLayout(object): - - implements(ILayout) - adapts(INode) - - def __init__(self, context): - self.context = context + implements(ILayoutNode, ILayoutNodeContained) diff --git a/layout/configure.zcml b/layout/configure.zcml new file mode 100644 index 0000000..458624a --- /dev/null +++ b/layout/configure.zcml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + diff --git a/tests/setup.py b/tests/setup.py index d056dcb..d119d48 100644 --- a/tests/setup.py +++ b/tests/setup.py @@ -52,6 +52,7 @@ from loops.concept import IndexAttributes as ConceptIndexAttributes from loops.config.base import GlobalOptions, LoopsOptions from loops.interfaces import ILoopsObject, IIndexAttributes from loops.interfaces import IDocument, IFile, ITextDocument +from loops.layout.base import LayoutNode from loops.organize.memberinfo import MemberInfoProvider from loops.organize.stateful.base import StatefulResourceIndexInfo, handleTransition from loops.predicate import Predicate #, MappingAttributeRelation diff --git a/view.py b/view.py index f0a9e36..8cd750e 100644 --- a/view.py +++ b/view.py @@ -37,6 +37,7 @@ from zope.security.proxy import removeSecurityProxy from zope.traversing.api import getName, getParent from persistent import Persistent +from cybertools.composer.layout.base import LayoutManager from cybertools.relation import DyadicRelation from cybertools.relation.registry import getRelations from cybertools.relation.interfaces import IRelationRegistry, IRelatable @@ -45,6 +46,7 @@ from loops.base import ParentInfo from loops.common import AdapterBase from loops.interfaces import IView, INode, INodeSchema, INodeAdapter from loops.interfaces import IViewManager, INodeContained +from loops.interfaces import ILayoutNode, ILayoutNodeContained from loops.interfaces import ILoopsContained from loops.interfaces import ITargetRelation from loops.interfaces import IConcept @@ -176,6 +178,11 @@ class Node(View, OrderedContainer): return self.nodeType in ('page', 'menu') +class LayoutNode(Node, LayoutManager): + + implements(ILayoutNode, ILayoutNodeContained) + + class ViewManager(OrderedContainer): implements(IViewManager, ILoopsContained)