source: WAeUP_SRP/trunk/skins/waeup_custom/folder_delete.py @ 2141

Last change on this file since 2141 was 2013, checked in by Henrik Bettermann, 17 years ago

see ticket #102

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1## Script (Python) "folder_delete"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=ids=[], REQUEST=None
8##title=
9##
10# $Id: folder_delete.py 2013 2007-07-12 16:12:23Z henrik $
11"""
12FIXME: add docstring.
13"""
14
15import logging
16logger = logging.getLogger('Skins.folder_delete')
17member_id = str(context.portal_membership.getAuthenticatedMember())
18
19from Products.CMFCore.utils import getToolByName
20here = context
21
22#if context.portal_type == "University":
23#    here = context.academics
24
25ti = getToolByName(here, 'portal_types').getTypeInfo(here.portal_type)
26meth_id = ti.queryMethodID('view', 'folder_contents')
27ret_url = here.absolute_url() + '/' + meth_id
28
29
30
31if ids:
32    for id in ids:
33        # XXX has to be called from here since the workflow doesn't handle the
34        # deletion yet
35        if context.portal_type == "CoursesFolder":
36            context.courses_catalog.deleteRecord(id)
37        ob = getattr(here, id)
38        from Products.CPSCore.EventServiceTool import getPublicEventService
39        evtool = getPublicEventService(here)
40        evtool.notifyEvent('workflow_delete', ob, {})
41    here.manage_delObjects(ids)
42    message = 'portal_status_message=psm_item(s)_deleted'
43else:
44    message = 'portal_status_message=psm_select_at_least_one_document'
45
46if REQUEST is not None:
47    return REQUEST.RESPONSE.redirect(ret_url + '?' + message)
Note: See TracBrowser for help on using the repository browser.