Assignment of resources to concepts and vice versa
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1111 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
0932cbb342
commit
73c33a108e
6 changed files with 52 additions and 13 deletions
|
@ -99,6 +99,8 @@ class ConceptConfigureView(ConceptView):
|
||||||
self.context.deassignChild(concept, [predicate])
|
self.context.deassignChild(concept, [predicate])
|
||||||
elif qualifier == 'resources':
|
elif qualifier == 'resources':
|
||||||
self.context.deassignResource(concept, [predicate])
|
self.context.deassignResource(concept, [predicate])
|
||||||
|
elif qualifier == 'concepts':
|
||||||
|
self.context.deassignConcept(concept, [predicate])
|
||||||
else:
|
else:
|
||||||
raise(BadRequest, 'Illegal qualifier: %s.' % qualifier)
|
raise(BadRequest, 'Illegal qualifier: %s.' % qualifier)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -177,8 +177,8 @@
|
||||||
permission="zope.ManageContent">
|
permission="zope.ManageContent">
|
||||||
|
|
||||||
<page
|
<page
|
||||||
name="concepts.html"
|
name="configure.html"
|
||||||
template="resource_concepts.pt"
|
template="resource_configure.pt"
|
||||||
menu="zmi_views" title="Concepts"
|
menu="zmi_views" title="Concepts"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -373,14 +373,14 @@
|
||||||
|
|
||||||
<menuItem
|
<menuItem
|
||||||
for="loops.interfaces.INode"
|
for="loops.interfaces.INode"
|
||||||
action="configure.html"
|
action="@@configure.html"
|
||||||
permission="zope.ManageContent"
|
permission="zope.ManageContent"
|
||||||
menu="zmi_views" title="Configure"
|
menu="zmi_views" title="Configure"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuItem
|
<menuItem
|
||||||
for="loops.interfaces.INode"
|
for="loops.interfaces.INode"
|
||||||
action="contents.html"
|
action="@@contents.html"
|
||||||
permission="zope.ManageContent"
|
permission="zope.ManageContent"
|
||||||
menu="zmi_views" title="Contents"
|
menu="zmi_views" title="Contents"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -49,6 +49,18 @@ class NodeView(object):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.request = request
|
self.request = request
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def title(self):
|
||||||
|
return self.context.title
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def nodeType(self):
|
||||||
|
return self.context.nodeType
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def url(self):
|
||||||
|
return zapi.absoluteURL(self.context, self.request)
|
||||||
|
|
||||||
def render(self, text=None):
|
def render(self, text=None):
|
||||||
if text is None:
|
if text is None:
|
||||||
text = self.context.body
|
text = self.context.body
|
||||||
|
@ -111,10 +123,6 @@ class NodeView(object):
|
||||||
return 'imagebody'
|
return 'imagebody'
|
||||||
return 'filebody'
|
return 'filebody'
|
||||||
|
|
||||||
@Lazy
|
|
||||||
def url(self):
|
|
||||||
return zapi.absoluteURL(self.context, self.request)
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def editable(self):
|
def editable(self):
|
||||||
return canWrite(self.context, 'body')
|
return canWrite(self.context, 'body')
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<tal:target condition="target">
|
<tal:target condition="target">
|
||||||
<span i18n:translate="">Currently assigned target</span>:
|
<span i18n:translate="">Currently assigned target</span>:
|
||||||
<a href="#"
|
<a href="#"
|
||||||
tal:attributes="href string:${target/url}/@@SelectedManagementView.html"
|
tal:attributes="href string:${target/url}/@@configure.html"
|
||||||
tal:content="target/title">Document xy</a>
|
tal:content="target/title">Document xy</a>
|
||||||
</tal:target>
|
</tal:target>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -33,6 +33,7 @@ from zope.security.proxy import removeSecurityProxy
|
||||||
from loops.interfaces import IDocument, IMediaAsset
|
from loops.interfaces import IDocument, IMediaAsset
|
||||||
from loops.browser.common import BaseView
|
from loops.browser.common import BaseView
|
||||||
from loops.browser.concept import ConceptRelationView, ConceptConfigureView
|
from loops.browser.concept import ConceptRelationView, ConceptConfigureView
|
||||||
|
from loops.browser.node import NodeView
|
||||||
|
|
||||||
renderingFactories = {
|
renderingFactories = {
|
||||||
'text/plain': 'zope.source.plaintext',
|
'text/plain': 'zope.source.plaintext',
|
||||||
|
@ -49,6 +50,10 @@ class ResourceView(BaseView):
|
||||||
for r in self.context.getConceptRelations():
|
for r in self.context.getConceptRelations():
|
||||||
yield ConceptRelationView(r, self.request)
|
yield ConceptRelationView(r, self.request)
|
||||||
|
|
||||||
|
def clients(self):
|
||||||
|
for node in self.context.getClients():
|
||||||
|
yield NodeView(node, self.request)
|
||||||
|
|
||||||
|
|
||||||
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,39 @@
|
||||||
|
|
||||||
<div tal:define="items view/concepts;
|
<div tal:define="items view/concepts;
|
||||||
action string:remove;
|
action string:remove;
|
||||||
qualifier string:parents;
|
qualifier string:concepts;
|
||||||
summary string:Currently assigned objects;
|
summary string:Currently assigned objects;
|
||||||
legend string:Parent Concepts;
|
legend string:Concepts;
|
||||||
showPredicate string:yes;
|
showPredicate string:yes;
|
||||||
buttonText string:Remove Parents;"
|
buttonText string:Remove Concepts;"
|
||||||
style="padding-right:20px">
|
style="float:left; padding-right:20px">
|
||||||
<metal:parents use-macro="views/relation_macros/listing" />
|
<metal:parents use-macro="views/relation_macros/listing" />
|
||||||
</div>
|
</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 tal:define="legend string:Create Concept;
|
<div tal:define="legend string:Create Concept;
|
||||||
buttonText string:Create Concept"
|
buttonText string:Create Concept"
|
||||||
style="padding-right:20px; clear:left">
|
style="padding-right:20px; clear:left">
|
Loading…
Add table
Reference in a new issue