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])
|
||||
elif qualifier == 'resources':
|
||||
self.context.deassignResource(concept, [predicate])
|
||||
elif qualifier == 'concepts':
|
||||
self.context.deassignConcept(concept, [predicate])
|
||||
else:
|
||||
raise(BadRequest, 'Illegal qualifier: %s.' % qualifier)
|
||||
else:
|
||||
|
|
|
@ -177,8 +177,8 @@
|
|||
permission="zope.ManageContent">
|
||||
|
||||
<page
|
||||
name="concepts.html"
|
||||
template="resource_concepts.pt"
|
||||
name="configure.html"
|
||||
template="resource_configure.pt"
|
||||
menu="zmi_views" title="Concepts"
|
||||
/>
|
||||
|
||||
|
@ -373,14 +373,14 @@
|
|||
|
||||
<menuItem
|
||||
for="loops.interfaces.INode"
|
||||
action="configure.html"
|
||||
action="@@configure.html"
|
||||
permission="zope.ManageContent"
|
||||
menu="zmi_views" title="Configure"
|
||||
/>
|
||||
|
||||
<menuItem
|
||||
for="loops.interfaces.INode"
|
||||
action="contents.html"
|
||||
action="@@contents.html"
|
||||
permission="zope.ManageContent"
|
||||
menu="zmi_views" title="Contents"
|
||||
/>
|
||||
|
|
|
@ -49,6 +49,18 @@ class NodeView(object):
|
|||
self.context = context
|
||||
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):
|
||||
if text is None:
|
||||
text = self.context.body
|
||||
|
@ -111,10 +123,6 @@ class NodeView(object):
|
|||
return 'imagebody'
|
||||
return 'filebody'
|
||||
|
||||
@Lazy
|
||||
def url(self):
|
||||
return zapi.absoluteURL(self.context, self.request)
|
||||
|
||||
@Lazy
|
||||
def editable(self):
|
||||
return canWrite(self.context, 'body')
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<tal:target condition="target">
|
||||
<span i18n:translate="">Currently assigned target</span>:
|
||||
<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:target>
|
||||
</div>
|
||||
|
|
|
@ -33,6 +33,7 @@ from zope.security.proxy import removeSecurityProxy
|
|||
from loops.interfaces import IDocument, IMediaAsset
|
||||
from loops.browser.common import BaseView
|
||||
from loops.browser.concept import ConceptRelationView, ConceptConfigureView
|
||||
from loops.browser.node import NodeView
|
||||
|
||||
renderingFactories = {
|
||||
'text/plain': 'zope.source.plaintext',
|
||||
|
@ -49,6 +50,10 @@ class ResourceView(BaseView):
|
|||
for r in self.context.getConceptRelations():
|
||||
yield ConceptRelationView(r, self.request)
|
||||
|
||||
def clients(self):
|
||||
for node in self.context.getClients():
|
||||
yield NodeView(node, self.request)
|
||||
|
||||
|
||||
class ResourceConfigureView(ResourceView, ConceptConfigureView):
|
||||
|
||||
|
|
|
@ -9,15 +9,39 @@
|
|||
|
||||
<div tal:define="items view/concepts;
|
||||
action string:remove;
|
||||
qualifier string:parents;
|
||||
qualifier string:concepts;
|
||||
summary string:Currently assigned objects;
|
||||
legend string:Parent Concepts;
|
||||
legend string:Concepts;
|
||||
showPredicate string:yes;
|
||||
buttonText string:Remove Parents;"
|
||||
style="padding-right:20px">
|
||||
buttonText string:Remove Concepts;"
|
||||
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 tal:define="legend string:Create Concept;
|
||||
buttonText string:Create Concept"
|
||||
style="padding-right:20px; clear:left">
|
Loading…
Add table
Reference in a new issue