diff --git a/browser/concept.py b/browser/concept.py index c17feaa..87c4cb6 100644 --- a/browser/concept.py +++ b/browser/concept.py @@ -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): diff --git a/browser/concept_related.pt b/browser/concept_related.pt index 699bb50..f9e0494 100644 --- a/browser/concept_related.pt +++ b/browser/concept_related.pt @@ -2,20 +2,23 @@ - +

Concept Title


- +
+ buttonText string:Remove Parents;" + style="float:left; padding-right:20px">
+
+
- +
+
+
+ Clients + + + + + + + + + + + + + +
TitleType
+ TitleType
+
+
+ + + diff --git a/browser/resource_configure.pt b/browser/resource_configure.pt index 83fded2..03d5ab1 100644 --- a/browser/resource_configure.pt +++ b/browser/resource_configure.pt @@ -2,7 +2,7 @@ - +

@@ -11,7 +11,7 @@


- +
- -
-
- Clients - - - - - - - - - - - - - -
TitleType
- TitleType
-
-
+
+ style="clear:left">
- +
+ buttonText string:Assign;"> @@ -88,7 +64,7 @@
- +
diff --git a/concept.py b/concept.py index 335161c..b214940 100644 --- a/concept.py +++ b/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] diff --git a/resource.py b/resource.py index ead05d9..3c9853d 100644 --- a/resource.py +++ b/resource.py @@ -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)