Work in progress: assignment of related concepts (children and parents) to concepts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1071 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
952cd7e9a8
commit
5679960544
8 changed files with 33 additions and 40 deletions
|
@ -78,6 +78,9 @@ Concept Views
|
||||||
>>> from loops.browser.concept import ConceptView
|
>>> from loops.browser.concept import ConceptView
|
||||||
>>> view = ConceptView(cc1, TestRequest())
|
>>> view = ConceptView(cc1, TestRequest())
|
||||||
|
|
||||||
|
>>> sorted([c.title for c in view.children()])
|
||||||
|
[u'Zope 3']
|
||||||
|
|
||||||
|
|
||||||
Resources and what they have to do with Concepts
|
Resources and what they have to do with Concepts
|
||||||
================================================
|
================================================
|
||||||
|
|
|
@ -26,28 +26,10 @@ from zope.app import zapi
|
||||||
from zope.app.dublincore.interfaces import ICMFDublinCore
|
from zope.app.dublincore.interfaces import ICMFDublinCore
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
from zope.security.proxy import removeSecurityProxy
|
from zope.security.proxy import removeSecurityProxy
|
||||||
|
from loops.browser.common import BaseView
|
||||||
|
|
||||||
class ConceptView(object):
|
|
||||||
|
|
||||||
def __init__(self, context, request):
|
class ConceptView(BaseView):
|
||||||
self.context = context
|
|
||||||
self.request = request
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
def modified(self):
|
|
||||||
""" get date/time of last modification
|
|
||||||
"""
|
|
||||||
dc = ICMFDublinCore(self.context)
|
|
||||||
d = dc.modified or dc.created
|
|
||||||
return d and d.strftime('%Y-%m-%d %H:%M') or ''
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
def url(self):
|
|
||||||
return zapi.absoluteURL(self.context, self.request)
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
def title(self):
|
|
||||||
return self.context.title
|
|
||||||
|
|
||||||
def children(self):
|
def children(self):
|
||||||
request = self.request
|
request = self.request
|
||||||
|
|
|
@ -1,25 +1,12 @@
|
||||||
<tal:tag condition="view/update" />
|
<tal:tag condition="view/update" />
|
||||||
<html metal:use-macro="context/@@standard_macros/view"
|
<html metal:use-macro="context/@@standard_macros/view"
|
||||||
i18n:domain="zope">
|
i18n:domain="loops">
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div metal:fill-slot="body">
|
<div metal:fill-slot="body">
|
||||||
|
|
||||||
<h1 tal:content="context/title">Concept Title</h1>
|
<h1 tal:content="context/title">Concept Title</h1>
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<span class="label">Sub-Concepts</span>:
|
|
||||||
<span class="field"
|
|
||||||
tal:repeat="concept view/children">
|
|
||||||
<span tal:condition="python: concept is None">**deleted**</span>
|
|
||||||
<a href="#"
|
|
||||||
tal:attributes="href string:${concept/url}/children.html">
|
|
||||||
<span tal:condition="python: concept is not None"
|
|
||||||
tal:replace="concept/title">child</span>
|
|
||||||
</a>
|
|
||||||
<span class="field" tal:condition="not:repeat/concept/end"> - </span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="label">Parent Concepts</span>:
|
<span class="label">Parent Concepts</span>:
|
||||||
<span class="field"
|
<span class="field"
|
||||||
|
@ -31,6 +18,11 @@
|
||||||
<span class="field" tal:condition="not:repeat/concept/end"> - </span>
|
<span class="field" tal:condition="not:repeat/concept/end"> - </span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row"
|
||||||
|
tal:define="items view/children">
|
||||||
|
<span class="label">Sub-Concepts</span>:
|
||||||
|
<metal:children use-macro="views/relation_macros/assignments" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<form action="." method="post"
|
<form action="." method="post"
|
||||||
tal:attributes="action request/URL">
|
tal:attributes="action request/URL">
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
permission="zope.View"
|
permission="zope.View"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<page
|
||||||
|
for="*"
|
||||||
|
name="relation_macros"
|
||||||
|
template="relation_macros.pt"
|
||||||
|
permission="zope.View"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- loops top-level container -->
|
<!-- loops top-level container -->
|
||||||
|
|
||||||
<addform
|
<addform
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
function openEditWindow(url) {
|
function openEditWindow(url) {
|
||||||
zmi=window.open(url, 'zmi');
|
zmi = window.open(url, 'zmi');
|
||||||
zmi.focus();
|
zmi.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,14 @@
|
||||||
permission="zope.ManageContent"
|
permission="zope.ManageContent"
|
||||||
interface="zope.app.container.interfaces.IWriteContainer" />
|
interface="zope.app.container.interfaces.IWriteContainer" />
|
||||||
|
|
||||||
|
<!--<require
|
||||||
|
permission="zope.View"
|
||||||
|
interface="loops.interfaces.ILoops" />-->
|
||||||
|
|
||||||
|
<require
|
||||||
|
permission="zope.View"
|
||||||
|
attributes="getLoopsUri" />
|
||||||
|
|
||||||
</content>
|
</content>
|
||||||
|
|
||||||
<!-- concept manager and concept -->
|
<!-- concept manager and concept -->
|
||||||
|
|
|
@ -379,7 +379,8 @@ class ITargetRelation(IRelation):
|
||||||
|
|
||||||
# the loops top-level container
|
# the loops top-level container
|
||||||
|
|
||||||
class ILoops(ILoopsObject, IFolder):
|
#class ILoops(ILoopsObject, IFolder):
|
||||||
|
class ILoops(ILoopsObject):
|
||||||
""" The top-level object of a loops site.
|
""" The top-level object of a loops site.
|
||||||
"""
|
"""
|
||||||
contains(IConceptManager, IResourceManager, IViewManager)
|
contains(IConceptManager, IResourceManager, IViewManager)
|
||||||
|
|
|
@ -52,11 +52,11 @@ class ConceptProxy(object):
|
||||||
def setTitle(self, title): self.target.title = title
|
def setTitle(self, title): self.target.title = title
|
||||||
title = property(getTitle, setTitle)
|
title = property(getTitle, setTitle)
|
||||||
|
|
||||||
def getSubConcepts(self, relationships=None):
|
def getChildren(self, relationships=None):
|
||||||
return self.target.getSubConcepts(relationships)
|
return self.target.getChildren(relationships)
|
||||||
|
|
||||||
def getParentConcepts(self, relationships=None):
|
def getParents(self, relationships=None):
|
||||||
return self.target.getParentConcepts(relationships)
|
return self.target.getParents(relationships)
|
||||||
|
|
||||||
|
|
||||||
class ResourceProxy(object):
|
class ResourceProxy(object):
|
||||||
|
|
Loading…
Add table
Reference in a new issue