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
This commit is contained in:
parent
e432727f60
commit
8bb93765fc
9 changed files with 97 additions and 42 deletions
|
@ -565,6 +565,35 @@
|
|||
|
||||
</pages>
|
||||
|
||||
<!-- layout nodes -->
|
||||
|
||||
<page
|
||||
name="index.html"
|
||||
for="loops.interfaces.ILayoutNode"
|
||||
class="cybertools.composer.layout.browser.view.Page"
|
||||
permission="zope.View"
|
||||
/>
|
||||
|
||||
<addform
|
||||
label="Add Layout Node"
|
||||
name="AddLoopsLayoutNode.html"
|
||||
content_factory="loops.layout.base.LayoutNode"
|
||||
schema="loops.interfaces.ILayoutNode"
|
||||
fields="title description nodeType viewName body"
|
||||
template="add.pt"
|
||||
permission="zope.ManageContent">
|
||||
<widget field="description" height="2" />
|
||||
<widget field="body" height="8" />
|
||||
</addform>
|
||||
|
||||
<addMenuItem
|
||||
class="loops.layout.base.LayoutNode"
|
||||
title="Layout Node"
|
||||
description="A layout node controls the presentation of objects"
|
||||
permission="zope.ManageContent"
|
||||
view="AddLoopsLayoutNode.html"
|
||||
/>
|
||||
|
||||
<!-- dialogs/forms (end-user views) -->
|
||||
|
||||
<page
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<!-- $Id$ -->
|
||||
|
||||
<configure
|
||||
xmlns:zope="http://namespaces.zope.org/zope"
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
i18n_domain="loops">
|
||||
|
||||
<!-- views -->
|
||||
|
||||
<zope:adapter
|
||||
name="layout"
|
||||
factory="loops.browser.layout.node.NodeLayoutProvider"
|
||||
permission="zope.View"
|
||||
/>
|
||||
|
||||
<zope:adapter
|
||||
factory="loops.browser.layout.node.NodeLayout"
|
||||
permission="zope.View"
|
||||
/>
|
||||
|
||||
</configure>
|
|
@ -184,6 +184,20 @@
|
|||
interface="zope.app.container.interfaces.IReadContainer" />-->
|
||||
</class>
|
||||
|
||||
<class class=".layout.base.LayoutNode">
|
||||
<implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
|
||||
<factory id="loops.LayoutNode" description="Layout Node" />
|
||||
<require
|
||||
permission="zope.View"
|
||||
interface=".interfaces.ILayoutNode" />
|
||||
<require
|
||||
permission="zope.ManageContent"
|
||||
set_schema=".interfaces.ILayoutNode" />
|
||||
<!--<require
|
||||
permission="zope.View"
|
||||
interface="zope.app.container.interfaces.IReadContainer" />-->
|
||||
</class>
|
||||
|
||||
<!-- record manager -->
|
||||
|
||||
<interface interface="loops.interfaces.IRecordManager"
|
||||
|
@ -426,7 +440,6 @@
|
|||
|
||||
|
||||
<include package=".browser" />
|
||||
<include package=".browser.layout" />
|
||||
<include package=".classifier" />
|
||||
<include package=".compound.blog" />
|
||||
<include package=".config" />
|
||||
|
@ -435,6 +448,7 @@
|
|||
<include package=".i18n" />
|
||||
<include package=".integrator" />
|
||||
<include package=".knowledge" />
|
||||
<include package=".layout" />
|
||||
<include package=".organize" />
|
||||
<include package=".rest" />
|
||||
<include package=".search" />
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
23
layout/configure.zcml
Normal file
23
layout/configure.zcml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!-- $Id$ -->
|
||||
|
||||
<configure
|
||||
xmlns:zope="http://namespaces.zope.org/zope"
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
i18n_domain="zope">
|
||||
|
||||
<zope:utility
|
||||
factory="cybertools.composer.layout.base.LayoutManager" />
|
||||
|
||||
<!-- layouts -->
|
||||
|
||||
<zope:utility
|
||||
factory="cybertools.composer.layout.browser.liquid.default.BodyLayout"
|
||||
provides="cybertools.composer.layout.interfaces.ILayout"
|
||||
name="body.liquid" />
|
||||
|
||||
<zope:utility
|
||||
component="cybertools.composer.layout.browser.default.footer"
|
||||
provides="cybertools.composer.layout.interfaces.ILayout"
|
||||
name="footer.default" />
|
||||
|
||||
</configure>
|
|
@ -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
|
||||
|
|
7
view.py
7
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue