source: WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py @ 856

Last change on this file since 856 was 852, checked in by Henrik Bettermann, 18 years ago

some modifications according to telephone conversation

  • Property svn:keywords set to Id
File size: 2.0 KB
RevLine 
[845]1## Script (Python) "clearance_edit"
[788]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[851]7##parameters=REQUEST, cpsdocument_edit_button=None, cpsdocument_edit_and_view_button=None, acknowledge=None
[788]8##title=
[805]9# $Id: clearance_edit.py 852 2006-11-12 21:21:07Z henrik $
[788]10"""
11"""
12wftool = context.portal_workflow
13from urllib import urlencode
14from Products.CPSDocument.utils import getFormUidUrlArg
15import DateTime
16current = DateTime.DateTime()
17
18# Until ajax posts directly to its own script...
19##if 'ajax_edit' in REQUEST.form:
20##    return context.cpsdocument_edit_ajax(REQUEST, cluster=cluster)
21
22# Check flexible controls
23#context.editLayouts(REQUEST=REQUEST)
24
25# Validate the document and write it if it's valid
26# (We don't call getEditableContent here, validate does it when needed.)
[832]27wftool = context.portal_workflow
[788]28info = context.getStudentInfo()
29
30student = info['student']
31app = info['app']
32app_doc = info['app_doc']
33clear = info['clear']
34clear_doc = info['clear_doc']
35state = context.getStudentInfo()['review_state']
[832]36
[801]37is_valid, ds = clear_doc.validate(request=REQUEST,
[788]38                                schema_id = 'student_clearance',
39                                layout_id = 'student_clearance_fe',
40                                proxy=clear,
41                                use_session=True)
42
43psm = ""
44args = {}
[789]45action = "/clearance_edit_form"
[851]46if is_valid:
47    if cpsdocument_edit_button:
[788]48        psm = 'Content changed.'
[851]49    elif cpsdocument_edit_and_view_button:
50        if acknowledge:
51            wftool.doActionFor(info['clear'],'close')
52            wftool.doActionFor(info['student'],'request_clearance')
[852]53            return REQUEST.RESPONSE.redirect("%s/clearance_view" % info['url'])
54        psm = "You must tick the Acknowledgement Check Box before submission!"
[851]55else:
56    psm = "Please correct your errors."
57args = getFormUidUrlArg(REQUEST)
58args['portal_status_message'] = psm
[844]59if args:
60  url = clear.absolute_url() + action + '?' + urlencode(args)
61else:
62  url = clear.absolute_url() + action
[845]63REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.