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:
helmutm 2011-02-18 07:58:44 +00:00
parent 06c10460ad
commit c13e6a6d00
5 changed files with 38 additions and 9 deletions

View file

@ -105,8 +105,10 @@
tal:condition="show_headline|python:True">Children</h2>
<form method="post"
tal:omit-tag="not:item/editable">
<table class="listing">
<table class="listing"
metal:define-macro="children">
<tr>
<th tal:condition="item/showCheckboxes|nothing">&nbsp;</th>
<th i18n:translate="">Title</th>
<th i18n:translate="">Type</th>
<th i18n:translate="">Modification Date</th>
@ -124,6 +126,11 @@
t for t in (description, predicate) if t)">
<tr tal:attributes="class string:$class dojoDndItem dojoDndHandle;
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">
<a tal:attributes="href python: view.getUrlForTarget(related);
title info">

View file

@ -30,7 +30,7 @@ from zope.traversing.api import getName, getParent
from cybertools.browser.form import FormController
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.common import adapted
from loops import util
@ -44,7 +44,8 @@ queryTemplate = ViewPageTemplateFile('query.pt')
class BaseQueryView(BaseView):
template = queryTemplate
childViewFactory = ResourceRelationView
childViewFactory = ConceptRelationView
resourceViewFactory = ResourceRelationView
showCheckboxes = True
form_action = 'execute_query_action'
@ -77,10 +78,15 @@ class BaseQueryView(BaseView):
return _(u'Selection using: $targets',
mapping=dict(targets=targetNames))
def results(self):
def resources(self):
for t in self.targets:
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):
@ -92,7 +98,7 @@ class ActionExecutor(FormController):
uids = form.get('selection', [])
action = actions[0]
if action == 'action.delete':
print '*** delete', uids
#print '*** delete', uids
for uid in uids:
obj = util.getObjectForUid(uid)
parent = getParent(obj)

View file

@ -1,18 +1,22 @@
<metal:query define-macro="query">
<div id="query"
tal:define="resources item/results"
tal:define="children item/children;
resources item/resources"
tal:attributes="class string:content-$level;">
<form method="post">
<input type="hidden" name="form.action"
tal:attributes="value item/form_action" />
<metal:infos use-macro="item/infos/concepttitle" />
<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 />
<div class="buttons">
<input type="submit" name="action.delete"
value="Delete objects" class="submit"
onClick="confirm('Do you really want to delete the selected objects?')"
i18n:attributes="value" />
i18n:attributes="value; onclick" />
</div>
</form>
</div>

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\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"
"Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n"
@ -14,6 +14,9 @@ msgstr ""
msgid "Concept"
msgstr "Begriff"
msgid "Concepts"
msgstr "Begriffe"
msgid "Resource"
msgstr "Ressource"
@ -554,6 +557,15 @@ msgstr "Kommentare"
msgid "Add Comment"
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
msgid "label_type"