work in progress: layout management
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2900 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
e3182407e4
commit
4a09b21e5f
8 changed files with 131 additions and 68 deletions
|
@ -565,35 +565,6 @@
|
||||||
|
|
||||||
</pages>
|
</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) -->
|
<!-- dialogs/forms (end-user views) -->
|
||||||
|
|
||||||
<page
|
<page
|
||||||
|
|
|
@ -184,20 +184,6 @@
|
||||||
interface="zope.app.container.interfaces.IReadContainer" />-->
|
interface="zope.app.container.interfaces.IReadContainer" />-->
|
||||||
</class>
|
</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 -->
|
<!-- record manager -->
|
||||||
|
|
||||||
<interface interface="loops.interfaces.IRecordManager"
|
<interface interface="loops.interfaces.IRecordManager"
|
||||||
|
|
|
@ -511,23 +511,6 @@ class INodeContained(Interface):
|
||||||
containers(INode, IViewManager)
|
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
|
# record manager interfaces
|
||||||
|
|
||||||
class IRecordManager(ILoopsObject):
|
class IRecordManager(ILoopsObject):
|
||||||
|
|
|
@ -17,14 +17,15 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Layout stuff
|
Layout node + instance implementations.
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
from loops.interfaces import ILayoutNode, ILayoutNodeContained
|
from cybertools.composer.layout.base import LayoutInstance
|
||||||
|
from loops.layout.interfaces import ILayoutNode, ILayoutNodeContained
|
||||||
from loops.view import Node
|
from loops.view import Node
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,3 +33,7 @@ class LayoutNode(Node):
|
||||||
|
|
||||||
implements(ILayoutNode, ILayoutNodeContained)
|
implements(ILayoutNode, ILayoutNodeContained)
|
||||||
|
|
||||||
|
|
||||||
|
class NodeLayoutInstance(LayoutInstance):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
34
layout/browser.py
Normal file
34
layout/browser.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 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
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
Layout node views.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
|
from cybertools.composer.layout.browser.view import Page
|
||||||
|
|
||||||
|
|
||||||
|
class LayoutNodeView(Page):
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def layoutName(self):
|
||||||
|
return self.context.viewName or 'page'
|
|
@ -5,4 +5,48 @@
|
||||||
xmlns:browser="http://namespaces.zope.org/browser"
|
xmlns:browser="http://namespaces.zope.org/browser"
|
||||||
i18n_domain="loops">
|
i18n_domain="loops">
|
||||||
|
|
||||||
|
<zope:class class="loops.layout.base.LayoutNode">
|
||||||
|
<implements interface="zope.annotation.interfaces.IAttributeAnnotatable" />
|
||||||
|
<factory id="loops.LayoutNode" description="Layout Node" />
|
||||||
|
<require
|
||||||
|
permission="zope.View"
|
||||||
|
interface="loops.layout.interfaces.ILayoutNode" />
|
||||||
|
<require
|
||||||
|
permission="zope.ManageContent"
|
||||||
|
set_schema="loops.layout.interfaces.ILayoutNode" />
|
||||||
|
</zope:class>
|
||||||
|
|
||||||
|
<zope:adapter
|
||||||
|
for="loops.layout.interfaces.ILayoutNode"
|
||||||
|
factory="loops.layout.base.NodeLayoutInstance" />
|
||||||
|
|
||||||
|
<!-- views -->
|
||||||
|
|
||||||
|
<browser:page
|
||||||
|
name="index.html"
|
||||||
|
for="loops.layout.interfaces.ILayoutNode"
|
||||||
|
class="loops.layout.browser.LayoutNodeView"
|
||||||
|
permission="zope.View"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<browser:addform
|
||||||
|
label="Add Layout Node"
|
||||||
|
name="AddLoopsLayoutNode.html"
|
||||||
|
content_factory="loops.layout.base.LayoutNode"
|
||||||
|
schema="loops.layout.interfaces.ILayoutNode"
|
||||||
|
fields="title description nodeType viewName body"
|
||||||
|
template="../browser/add.pt"
|
||||||
|
permission="zope.ManageContent">
|
||||||
|
<widget field="description" height="2" />
|
||||||
|
<widget field="body" height="8" />
|
||||||
|
</browser:addform>
|
||||||
|
|
||||||
|
<browser:addMenuItem
|
||||||
|
class="loops.layout.base.LayoutNode"
|
||||||
|
title="Layout Node"
|
||||||
|
description="A layout node controls the presentation of objects"
|
||||||
|
permission="zope.ManageContent"
|
||||||
|
view="AddLoopsLayoutNode.html"
|
||||||
|
/>
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
46
layout/interfaces.py
Normal file
46
layout/interfaces.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 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
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
interface definitions for the loops.layout stuff.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.app.container.constraints import contains, containers
|
||||||
|
from zope.interface import Interface
|
||||||
|
|
||||||
|
from loops.interfaces import INodeSchema, IBaseNode, IViewManager
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
6
view.py
6
view.py
|
@ -46,7 +46,6 @@ from loops.base import ParentInfo
|
||||||
from loops.common import AdapterBase
|
from loops.common import AdapterBase
|
||||||
from loops.interfaces import IView, INode, INodeSchema, INodeAdapter
|
from loops.interfaces import IView, INode, INodeSchema, INodeAdapter
|
||||||
from loops.interfaces import IViewManager, INodeContained
|
from loops.interfaces import IViewManager, INodeContained
|
||||||
from loops.interfaces import ILayoutNode, ILayoutNodeContained
|
|
||||||
from loops.interfaces import ILoopsContained
|
from loops.interfaces import ILoopsContained
|
||||||
from loops.interfaces import ITargetRelation
|
from loops.interfaces import ITargetRelation
|
||||||
from loops.interfaces import IConcept
|
from loops.interfaces import IConcept
|
||||||
|
@ -178,11 +177,6 @@ class Node(View, OrderedContainer):
|
||||||
return self.nodeType in ('page', 'menu')
|
return self.nodeType in ('page', 'menu')
|
||||||
|
|
||||||
|
|
||||||
class LayoutNode(Node, LayoutManager):
|
|
||||||
|
|
||||||
implements(ILayoutNode, ILayoutNodeContained)
|
|
||||||
|
|
||||||
|
|
||||||
class ViewManager(OrderedContainer):
|
class ViewManager(OrderedContainer):
|
||||||
|
|
||||||
implements(IViewManager, ILoopsContained)
|
implements(IViewManager, ILoopsContained)
|
||||||
|
|
Loading…
Add table
Reference in a new issue