allow also deletion of concepts via action query
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@4191 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
06c10460ad
commit
c13e6a6d00
5 changed files with 38 additions and 9 deletions
|
@ -105,8 +105,10 @@
|
||||||
tal:condition="show_headline|python:True">Children</h2>
|
tal:condition="show_headline|python:True">Children</h2>
|
||||||
<form method="post"
|
<form method="post"
|
||||||
tal:omit-tag="not:item/editable">
|
tal:omit-tag="not:item/editable">
|
||||||
<table class="listing">
|
<table class="listing"
|
||||||
|
metal:define-macro="children">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th tal:condition="item/showCheckboxes|nothing"> </th>
|
||||||
<th i18n:translate="">Title</th>
|
<th i18n:translate="">Title</th>
|
||||||
<th i18n:translate="">Type</th>
|
<th i18n:translate="">Type</th>
|
||||||
<th i18n:translate="">Modification Date</th>
|
<th i18n:translate="">Modification Date</th>
|
||||||
|
@ -124,6 +126,11 @@
|
||||||
t for t in (description, predicate) if t)">
|
t for t in (description, predicate) if t)">
|
||||||
<tr tal:attributes="class string:$class dojoDndItem dojoDndHandle;
|
<tr tal:attributes="class string:$class dojoDndItem dojoDndHandle;
|
||||||
id related/uniqueId">
|
id related/uniqueId">
|
||||||
|
<td tal:condition="item/showCheckboxes|nothing"
|
||||||
|
tal:define="uid related/uniqueId"
|
||||||
|
class="checkbox">
|
||||||
|
<input type="checkbox" name="selection:list" checked
|
||||||
|
tal:attributes="value uid;" /></td>
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
<a tal:attributes="href python: view.getUrlForTarget(related);
|
<a tal:attributes="href python: view.getUrlForTarget(related);
|
||||||
title info">
|
title info">
|
||||||
|
|
|
@ -30,7 +30,7 @@ from zope.traversing.api import getName, getParent
|
||||||
|
|
||||||
from cybertools.browser.form import FormController
|
from cybertools.browser.form import FormController
|
||||||
from loops.browser.common import BaseView, concept_macros
|
from loops.browser.common import BaseView, concept_macros
|
||||||
from loops.browser.concept import ConceptView
|
from loops.browser.concept import ConceptView, ConceptRelationView
|
||||||
from loops.browser.resource import ResourceView, ResourceRelationView
|
from loops.browser.resource import ResourceView, ResourceRelationView
|
||||||
from loops.common import adapted
|
from loops.common import adapted
|
||||||
from loops import util
|
from loops import util
|
||||||
|
@ -44,7 +44,8 @@ queryTemplate = ViewPageTemplateFile('query.pt')
|
||||||
class BaseQueryView(BaseView):
|
class BaseQueryView(BaseView):
|
||||||
|
|
||||||
template = queryTemplate
|
template = queryTemplate
|
||||||
childViewFactory = ResourceRelationView
|
childViewFactory = ConceptRelationView
|
||||||
|
resourceViewFactory = ResourceRelationView
|
||||||
showCheckboxes = True
|
showCheckboxes = True
|
||||||
form_action = 'execute_query_action'
|
form_action = 'execute_query_action'
|
||||||
|
|
||||||
|
@ -77,10 +78,15 @@ class BaseQueryView(BaseView):
|
||||||
return _(u'Selection using: $targets',
|
return _(u'Selection using: $targets',
|
||||||
mapping=dict(targets=targetNames))
|
mapping=dict(targets=targetNames))
|
||||||
|
|
||||||
def results(self):
|
def resources(self):
|
||||||
for t in self.targets:
|
for t in self.targets:
|
||||||
for r in t.getResourceRelations([self.defaultPredicate]):
|
for r in t.getResourceRelations([self.defaultPredicate]):
|
||||||
yield self.childViewFactory(r, self.request, contextIsSecond=True)
|
yield self.resourceViewFactory(r, self.request, contextIsSecond=True)
|
||||||
|
|
||||||
|
def children(self):
|
||||||
|
for t in self.targets:
|
||||||
|
for c in t.getChildRelations([self.defaultPredicate]):
|
||||||
|
yield self.childViewFactory(c, self.request, contextIsSecond=True)
|
||||||
|
|
||||||
|
|
||||||
class ActionExecutor(FormController):
|
class ActionExecutor(FormController):
|
||||||
|
@ -92,7 +98,7 @@ class ActionExecutor(FormController):
|
||||||
uids = form.get('selection', [])
|
uids = form.get('selection', [])
|
||||||
action = actions[0]
|
action = actions[0]
|
||||||
if action == 'action.delete':
|
if action == 'action.delete':
|
||||||
print '*** delete', uids
|
#print '*** delete', uids
|
||||||
for uid in uids:
|
for uid in uids:
|
||||||
obj = util.getObjectForUid(uid)
|
obj = util.getObjectForUid(uid)
|
||||||
parent = getParent(obj)
|
parent = getParent(obj)
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
<metal:query define-macro="query">
|
<metal:query define-macro="query">
|
||||||
<div id="query"
|
<div id="query"
|
||||||
tal:define="resources item/results"
|
tal:define="children item/children;
|
||||||
|
resources item/resources"
|
||||||
tal:attributes="class string:content-$level;">
|
tal:attributes="class string:content-$level;">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="form.action"
|
<input type="hidden" name="form.action"
|
||||||
tal:attributes="value item/form_action" />
|
tal:attributes="value item/form_action" />
|
||||||
<metal:infos use-macro="item/infos/concepttitle" />
|
<metal:infos use-macro="item/infos/concepttitle" />
|
||||||
<div tal:content="item/queryInfo" />
|
<div tal:content="item/queryInfo" />
|
||||||
|
<h2 i18n:translate="">Concepts</h2>
|
||||||
|
<metal:listing use-macro="item/listings/children" />
|
||||||
|
<h2 i18n:translate="">Resources</h2>
|
||||||
<metal:listing use-macro="item/listings/resources" /><br />
|
<metal:listing use-macro="item/listings/resources" /><br />
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<input type="submit" name="action.delete"
|
<input type="submit" name="action.delete"
|
||||||
value="Delete objects" class="submit"
|
value="Delete objects" class="submit"
|
||||||
onClick="confirm('Do you really want to delete the selected objects?')"
|
onClick="confirm('Do you really want to delete the selected objects?')"
|
||||||
i18n:attributes="value" />
|
i18n:attributes="value; onclick" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@ msgstr ""
|
||||||
|
|
||||||
"Project-Id-Version: $Id$\n"
|
"Project-Id-Version: $Id$\n"
|
||||||
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
|
||||||
"PO-Revision-Date: 2011-02-10 12:00 CET\n"
|
"PO-Revision-Date: 2011-02-18 12:00 CET\n"
|
||||||
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
|
||||||
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
"Language-Team: loops developers <helmutm@cy55.de>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
|
@ -14,6 +14,9 @@ msgstr ""
|
||||||
msgid "Concept"
|
msgid "Concept"
|
||||||
msgstr "Begriff"
|
msgstr "Begriff"
|
||||||
|
|
||||||
|
msgid "Concepts"
|
||||||
|
msgstr "Begriffe"
|
||||||
|
|
||||||
msgid "Resource"
|
msgid "Resource"
|
||||||
msgstr "Ressource"
|
msgstr "Ressource"
|
||||||
|
|
||||||
|
@ -554,6 +557,15 @@ msgstr "Kommentare"
|
||||||
msgid "Add Comment"
|
msgid "Add Comment"
|
||||||
msgstr "Kommentar hinzufügen"
|
msgstr "Kommentar hinzufügen"
|
||||||
|
|
||||||
|
msgid "Selection using: $targets"
|
||||||
|
msgstr "Auswahl über: $targets"
|
||||||
|
|
||||||
|
msgid "Delete objects"
|
||||||
|
msgstr "Objekte löschen"
|
||||||
|
|
||||||
|
msgid "confirm('Do you really want to delete the selected objects?')"
|
||||||
|
msgstr "confirm('Wollen Sie die ausgewählten Objekte wirklich löschen?')"
|
||||||
|
|
||||||
# management interface
|
# management interface
|
||||||
|
|
||||||
msgid "label_type"
|
msgid "label_type"
|
||||||
|
|
Loading…
Add table
Reference in a new issue