diff --git a/README.txt b/README.txt index 3420b81..1cd52c2 100755 --- a/README.txt +++ b/README.txt @@ -236,9 +236,10 @@ view class's target attribute: >>> m111.target is cc2 True -Node views +Node Views ---------- + >>> from loops.interfaces import INode >>> from loops.browser.node import NodeView >>> view = NodeView(m11, TestRequest()) @@ -254,7 +255,26 @@ Node views ... print item.url, view.selected(item) http://127.0.0.1/loops/views/m1/m11 True - +Node Schema Adapters +-------------------- + +When creating or editing (more precisely: configuring) a node you may +specify what you want to do with respect to the node's target: associate +an existing one or create a new one (with specifying the target's type), +and give an URI that will be used to identify the target. (Internally +the reference to the target will be stored as a relation so that the +target may be moved or renamed without any problems.) + + >>> from loops.interfaces import INodeConfigSchema + >>> from loops.view import NodeConfigAdapter + >>> ztapi.provideAdapter(INode, INodeConfigSchema, NodeConfigAdapter) + >>> nodeConfig = INodeConfigSchema(m111) + +It is also possible to edit a target's attributes directly in an +edit form provided by the node: + + >>> from loops.target import DocumentProxy, MediaAssetProxy + Ordering Nodes -------------- diff --git a/__init__.py b/__init__.py index 72219eb..6c9ffbb 100644 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,7 @@ # -*- coding: UTF-8 -*- # -*- Mode: Python; py-indent-offset: 4 -*- # -# Copyright (c) 2005 Helmut Merz helmutm@cy55.de +# Copyright (c) 2006 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 @@ -31,3 +31,6 @@ class Loops(Folder): implements(ILoops) + def getLoopsRoot(self): + return self + diff --git a/browser/configure.zcml b/browser/configure.zcml index 811184f..7b49850 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -218,6 +218,13 @@ permission="zope.ManageContent" menu="zmi_views" title="Edit" /> + + + diff --git a/browser/node.css b/browser/node.css index c664cb7..13793ab 100644 --- a/browser/node.css +++ b/browser/node.css @@ -46,3 +46,12 @@ font-size: 90% } +.flow-left { + float: left; +} + +div.image { + margin-top: 10px; + margin-right: 5px; +} + diff --git a/browser/node.py b/browser/node.py index 004e95f..4080d7b 100644 --- a/browser/node.py +++ b/browser/node.py @@ -30,7 +30,6 @@ from zope.proxy import removeAllProxies from zope.security import canAccess, canWrite from zope.security.proxy import removeSecurityProxy -from loops.interfaces import IConcept class NodeView(object): @@ -57,6 +56,10 @@ class NodeView(object): d = dc.modified or dc.created return d and d.strftime('%Y-%m-%d %H:%M') or '' + @Lazy + def target(self): + return self.context.target + @Lazy def page(self): page = self.context.getPage() diff --git a/concept.py b/concept.py index c7f65f0..a56f4b2 100644 --- a/concept.py +++ b/concept.py @@ -62,6 +62,9 @@ class Concept(Contained, Persistent): def __init__(self, title=u''): self.title = title + def getLoopsRoot(self): + return zapi.getParent(self).getLoopsRoot() + # concept relations def getSubConcepts(self, relationships=None): @@ -122,3 +125,6 @@ class ConceptManager(BTreeContainer): implements(IConceptManager, ILoopsContained) + def getLoopsRoot(self): + return zapi.getParent(self) + diff --git a/configure.zcml b/configure.zcml index 7403b9c..3f3b6fe 100644 --- a/configure.zcml +++ b/configure.zcml @@ -209,16 +209,17 @@ - + - - - - + + + + +