management interface: show clients also for concepts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1714 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
5369eb78ad
commit
b1f9088cae
6 changed files with 61 additions and 43 deletions
|
@ -158,6 +158,11 @@ class ConceptView(BaseView):
|
|||
#elif type provides view: use this
|
||||
return self
|
||||
|
||||
def clients(self):
|
||||
from loops.browser.node import NodeView # avoid circular import
|
||||
for node in self.context.getClients():
|
||||
yield NodeView(node, self.request)
|
||||
|
||||
|
||||
class ConceptConfigureView(ConceptView):
|
||||
|
||||
|
|
|
@ -2,20 +2,23 @@
|
|||
<html metal:use-macro="context/@@standard_macros/view"
|
||||
i18n:domain="loops">
|
||||
<body>
|
||||
|
||||
|
||||
<div metal:fill-slot="body">
|
||||
|
||||
<h1 tal:content="context/title">Concept Title</h1><br />
|
||||
|
||||
|
||||
<div tal:define="items view/parents;
|
||||
action string:remove;
|
||||
qualifier string:parents;
|
||||
summary string:Currently assigned objects;
|
||||
legend string:Parent Concepts;
|
||||
showPredicate string:yes;
|
||||
buttonText string:Remove Parents;">
|
||||
buttonText string:Remove Parents;"
|
||||
style="float:left; padding-right:20px">
|
||||
<metal:parents use-macro="views/relation_macros/listing" />
|
||||
</div>
|
||||
<div metal:use-macro="views/relation_macros/clients" />
|
||||
|
||||
<div tal:define="items view/children;
|
||||
action string:remove;
|
||||
qualifier string:children;
|
||||
|
@ -30,7 +33,7 @@
|
|||
buttonText string:Create Concept">
|
||||
<metal:create use-macro="views/relation_macros/create" />
|
||||
</div>
|
||||
|
||||
|
||||
<div tal:define="items view/search;
|
||||
action string:assign;
|
||||
qualifier nothing;
|
||||
|
@ -60,7 +63,7 @@
|
|||
</metal:special>
|
||||
</metal:assign>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -158,4 +158,31 @@
|
|||
</metal:search>
|
||||
|
||||
|
||||
<metal:clients define-macro="clients">
|
||||
<div tal:define="items view/clients">
|
||||
<fieldset>
|
||||
<legend i18n:translate=""
|
||||
style="padding: 0 4px 0 4px">Clients</legend>
|
||||
<table class="listing" summary="Clients" i18n:attributes="summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n:translate="label_title">Title</th>
|
||||
<th i18n:translate="label_type">Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr tal:repeat="item items">
|
||||
<td><a tal:content="item/title" href="#"
|
||||
tal:attributes="href
|
||||
string:${item/url}/@@configure.html">
|
||||
Title</a></td>
|
||||
<td tal:content="item/nodeType">Type</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</metal:clients>
|
||||
|
||||
|
||||
</html>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html metal:use-macro="context/@@standard_macros/view"
|
||||
i18n:domain="loops">
|
||||
<body>
|
||||
|
||||
|
||||
<div metal:fill-slot="body">
|
||||
|
||||
<h1>
|
||||
|
@ -11,7 +11,7 @@
|
|||
<metal:xedit use-macro="views/xedit_macros/editLink" />
|
||||
</tal:xedit>
|
||||
</h1><br />
|
||||
|
||||
|
||||
<div tal:define="items view/concepts;
|
||||
action string:remove;
|
||||
qualifier string:concepts;
|
||||
|
@ -22,34 +22,11 @@
|
|||
style="float:left; padding-right:20px">
|
||||
<metal:parents use-macro="views/relation_macros/listing" />
|
||||
</div>
|
||||
|
||||
<div tal:define="items view/clients"
|
||||
style="padding-right:20px">
|
||||
<fieldset>
|
||||
<legend i18n:translate="">Clients</legend>
|
||||
<table class="listing" summary="Clients" i18n:attributes="summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n:translate="label_title">Title</th>
|
||||
<th i18n:translate="label_type">Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr tal:repeat="item items">
|
||||
<td><a tal:content="item/title" href="#"
|
||||
tal:attributes="href
|
||||
string:${item/url}/@@configure.html">
|
||||
Title</a></td>
|
||||
<td tal:content="item/nodeType">Type</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div metal:use-macro="views/relation_macros/clients" />
|
||||
|
||||
<div tal:define="legend string:Create Concept;
|
||||
buttonText string:Create Concept"
|
||||
style="padding-right:20px; clear:left">
|
||||
style="clear:left">
|
||||
<metal:create use-macro="views/relation_macros/create">
|
||||
<metal:control fill-slot="control">
|
||||
<input class="context" type="submit" name="form.button.submit"
|
||||
|
@ -62,15 +39,14 @@
|
|||
</metal:control>
|
||||
</metal:create>
|
||||
</div>
|
||||
|
||||
|
||||
<div tal:define="items view/search;
|
||||
action string:assign;
|
||||
qualifier nothing;
|
||||
summary string:Assignment candidates;
|
||||
legend string:Search;
|
||||
showPredicate nothing;
|
||||
buttonText string:Assign;"
|
||||
style="padding-right:20px">
|
||||
buttonText string:Assign;">
|
||||
<metal:assign use-macro="views/relation_macros/listing">
|
||||
<metal:search fill-slot="topActions">
|
||||
<metal:block use-macro="views/relation_macros/search" />
|
||||
|
@ -88,7 +64,7 @@
|
|||
</metal:special>
|
||||
</metal:assign>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
15
concept.py
15
concept.py
|
@ -40,10 +40,11 @@ from cybertools.relation.registry import getRelationSingle, setRelationSingle
|
|||
from cybertools.relation.interfaces import IRelationRegistry, IRelatable
|
||||
from cybertools.typology.interfaces import IType, ITypeManager
|
||||
|
||||
from interfaces import IConcept, IConceptRelation, IConceptView
|
||||
from interfaces import IConceptManager, IConceptManagerContained
|
||||
from interfaces import ILoopsContained
|
||||
from interfaces import IIndexAttributes
|
||||
from loops.interfaces import IConcept, IConceptRelation, IConceptView
|
||||
from loops.interfaces import IConceptManager, IConceptManagerContained
|
||||
from loops.interfaces import ILoopsContained
|
||||
from loops.interfaces import IIndexAttributes
|
||||
from loops.view import TargetRelation
|
||||
|
||||
|
||||
# relation classes
|
||||
|
@ -133,6 +134,12 @@ class Concept(Contained, Persistent):
|
|||
|
||||
# concept relations
|
||||
|
||||
def getClients(self, relationships=None):
|
||||
if relationships is None:
|
||||
relationships = [TargetRelation]
|
||||
rels = getRelations(second=self, relationships=relationships)
|
||||
return [r.first for r in rels]
|
||||
|
||||
def getChildRelations(self, predicates=None, child=None):
|
||||
predicates = predicates is None and ['*'] or predicates
|
||||
relationships = [ConceptRelation(self, None, p) for p in predicates]
|
||||
|
|
|
@ -159,6 +159,9 @@ class Resource(Image, Contained):
|
|||
def getLoopsRoot(self):
|
||||
return zapi.getParent(self).getLoopsRoot()
|
||||
|
||||
# concept relations
|
||||
# note: we always use the master version for relations, see getMaster()
|
||||
|
||||
def getClients(self, relationships=None):
|
||||
if relationships is None:
|
||||
relationships = [TargetRelation]
|
||||
|
@ -166,9 +169,6 @@ class Resource(Image, Contained):
|
|||
rels = getRelations(second=obj, relationships=relationships)
|
||||
return [r.first for r in rels]
|
||||
|
||||
# concept relations
|
||||
# note: we always use the master version for relations, see getMaster()
|
||||
|
||||
def getConceptRelations (self, predicates=None, concept=None):
|
||||
predicates = predicates is None and ['*'] or predicates
|
||||
obj = getMaster(self)
|
||||
|
|
Loading…
Add table
Reference in a new issue