source: WAeUP_SRP/base/skins/waeup_default/waeup_edit.py @ 3342

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

request.RESPONSE.redirect without return doesn't make sense

minor changes in workflow

File size: 1.6 KB
Line 
1##parameters=REQUEST, cluster=None, cpsdocument_edit_and_view_button=None, came_from=None
2# $Id: external_edit.py 805 2006-11-09 09:38:29Z joachim $
3"""
4"""
5
6from urllib import urlencode
7from Products.CPSDocument.utils import getFormUidUrlArg
8if 'ajax_edit' in REQUEST.form:
9    return context.waeup_edit_ajax(REQUEST, cluster=cluster)
10
11import logging
12logger = logging.getLogger('Skins.waeup_edit')
13
14mtool = context.portal_membership
15member = mtool.getAuthenticatedMember()
16doc = context.getContent()
17
18#if context.portal_type == "StudentStudyCourse":
19#    if len(context.objectIds()) > 0:
20#        psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!'
21#        args = getFormUidUrlArg(REQUEST)
22#        args['portal_status_message'] = psm
23#        url = context.absolute_url() + '?' + urlencode(args)
24#        return REQUEST.RESPONSE.redirect(url)
25
26is_valid, ds = doc.validate(request=REQUEST, proxy=context, cluster=cluster,
27                            use_session=True)
28
29student_id = context.getStudentId()
30
31action = "/" + came_from
32if is_valid:
33    comments = REQUEST.get('comments')
34    context.cpsdocument_notify_modification(comments=comments)
35
36
37
38    if cpsdocument_edit_and_view_button is not None:
39        action = ''
40    psm = 'psm_content_changed'
41    args = {}
42else:
43    psm = 'psm_content_error'
44    args = getFormUidUrlArg(REQUEST)
45
46logger.info('%s edited %s %s of %s' % (member,context.portal_type,context.id,student_id))
47args['portal_status_message'] = psm
48url = context.absolute_url() + action + '?' + urlencode(args)
49REQUEST.RESPONSE.redirect(url)
50
Note: See TracBrowser for help on using the repository browser.