[333] | 1 | ## Script (Python) "folder_delete"
|
---|
[337] | 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 | ##
|
---|
[486] | 10 | # $Id: folder_delete.py 2013 2007-07-12 16:12:23Z henrik $
|
---|
[337] | 11 | """
|
---|
| 12 | FIXME: add docstring.
|
---|
| 13 | """
|
---|
[333] | 14 |
|
---|
[2013] | 15 | import logging
|
---|
| 16 | logger = logging.getLogger('Skins.folder_delete')
|
---|
| 17 | member_id = str(context.portal_membership.getAuthenticatedMember())
|
---|
| 18 |
|
---|
[337] | 19 | from Products.CMFCore.utils import getToolByName
|
---|
[586] | 20 | here = context
|
---|
[333] | 21 |
|
---|
[2013] | 22 | #if context.portal_type == "University":
|
---|
| 23 | # here = context.academics
|
---|
| 24 |
|
---|
[586] | 25 | ti = getToolByName(here, 'portal_types').getTypeInfo(here.portal_type)
|
---|
[337] | 26 | meth_id = ti.queryMethodID('view', 'folder_contents')
|
---|
[586] | 27 | ret_url = here.absolute_url() + '/' + meth_id
|
---|
[337] | 28 |
|
---|
[586] | 29 |
|
---|
[2013] | 30 |
|
---|
[337] | 31 | if ids:
|
---|
| 32 | for id in ids:
|
---|
| 33 | # XXX has to be called from here since the workflow doesn't handle the
|
---|
| 34 | # deletion yet
|
---|
[1366] | 35 | if context.portal_type == "CoursesFolder":
|
---|
| 36 | context.courses_catalog.deleteRecord(id)
|
---|
[586] | 37 | ob = getattr(here, id)
|
---|
[337] | 38 | from Products.CPSCore.EventServiceTool import getPublicEventService
|
---|
[586] | 39 | evtool = getPublicEventService(here)
|
---|
[337] | 40 | evtool.notifyEvent('workflow_delete', ob, {})
|
---|
[586] | 41 | here.manage_delObjects(ids)
|
---|
[337] | 42 | message = 'portal_status_message=psm_item(s)_deleted'
|
---|
[333] | 43 | else:
|
---|
[337] | 44 | message = 'portal_status_message=psm_select_at_least_one_document'
|
---|
[333] | 45 |
|
---|
[337] | 46 | if REQUEST is not None:
|
---|
[2013] | 47 | return REQUEST.RESPONSE.redirect(ret_url + '?' + message) |
---|