Assignment of resources to concepts and vice versa
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1110 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
d6b7f5bc1f
commit
0932cbb342
3 changed files with 19 additions and 1 deletions
|
@ -135,6 +135,8 @@ class ConceptConfigureView(ConceptView):
|
|||
self.context.assignParent(removeSecurityProxy(concept), predicate)
|
||||
elif assignAs == 'resource':
|
||||
self.context.assignResource(removeSecurityProxy(concept), predicate)
|
||||
elif assignAs == 'concept':
|
||||
self.context.assignConcept(removeSecurityProxy(concept), predicate)
|
||||
else:
|
||||
raise(BadRequest, 'Illegal assignAs parameter: %s.' % assignAs)
|
||||
|
||||
|
|
|
@ -18,6 +18,22 @@
|
|||
<metal:parents use-macro="views/relation_macros/listing" />
|
||||
</div>
|
||||
|
||||
<div tal:define="legend string:Create Concept;
|
||||
buttonText string:Create Concept"
|
||||
style="padding-right:20px; clear:left">
|
||||
<metal:create use-macro="views/relation_macros/create">
|
||||
<metal:control fill-slot="control">
|
||||
<input class="context" type="submit" name="form.button.submit"
|
||||
value="Create Object"
|
||||
i18n:attributes="value"
|
||||
tal:attributes="value buttonText" />
|
||||
<input type="hidden" name="assignAs" value="concept" />
|
||||
and assign using Predicate
|
||||
<select metal:use-macro="views/relation_macros/predicates" />
|
||||
</metal:control>
|
||||
</metal:create>
|
||||
</div>
|
||||
|
||||
<div tal:define="items view/search;
|
||||
action string:assign;
|
||||
qualifier nothing;
|
||||
|
|
|
@ -173,7 +173,7 @@ class Concept(Contained, Persistent):
|
|||
if predicate is None:
|
||||
predicate = self.getConceptManager().getDefaultPredicate()
|
||||
registry = zapi.getUtility(IRelationRegistry)
|
||||
registry.register(ResourceRelation(self, resource))
|
||||
registry.register(ResourceRelation(self, resource, predicate))
|
||||
# TODO (?): avoid duplicates
|
||||
|
||||
def deassignResource(self, resource, predicates=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue