[Zope] Delete multiple posts
Farrell, Troy
troy.farrell@wilcom.com
Mon, 2 Apr 2001 09:47:41 -0500
I use a python script to do this all day :)
Zope Coolness: You don't have to run through the array. Pass the array as a
parameter to manage_delObjects.
Remember to bind the namespace to _
The check boxes are listed as follows in a form that calls my script:
<dtml-in expr="objectValues()">
<li><input type="checkbox" name="ids:list" value="<dtml-var
name="id">"<dtml-if name="checkall"> checked="checked"</dtml-if> /> <a
href="&dtml-absolute_url;?ex=.log"><dtml-var name="title"></a></li>
</dtml-in>
The Script:
## Script (Python) "manageLogFiles"
##bind container=container
##bind context=context
##bind namespace=_
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
if context.REQUEST.has_key('ids') and context.REQUEST.has_key('doThis'):
if context.REQUEST.doThis == 'Delete these!':
# Delete all selected LogFiles
# note the .logs. in the command below
context.logs.manage_delObjects(context.REQUEST.ids)
context.REQUEST.RESPONSE.redirect(context.REQUEST.SourceURL)
else :
# I don't know what to do
raise KeyError
else:
# Do this if they didn't check any of the boxes
# I used to raise a KeyError, but that is stupid
# Nobody wants a computer to tell them that they pushed
# a button at the wrong time. Now, we essentially do
# nothing, but send them back to where they came from.
# raise KeyError
context.REQUEST.RESPONSE.redirect(context.REQUEST.SourceURL)
Troy
-----Original Message-----
From: Gitte Wange [mailto:gitte@babytux.dk]
Sent: Monday, April 02, 2001 6:05 AM
To: zope@zope.org
Subject: [Zope] Delete multiple posts
Hello,
I have a list of items where it should be possible to delete all the
items you wish.
Each item have a checkbox with the value equal to them itemid.
I have done this is PHP just by naming these checkboxes "deletearr[]" to
make an array, then run through the array an delete each item.
But how do I do the same thing in Zope ?
Or - a more specifik question - can I make an array the same way in Zope
that I did in PHP ?
Regards,
--
************************
Gitte Wange Jensen
System Squid Developer
MMManager Aps
+45 29 72 79 72
gitte@mmmanager.org
************************
_______________________________________________
Zope maillist - Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )