source: WAeUP_SRP/trunk/skins/waeup_student/clearance_edit_manager.py @ 881

Last change on this file since 881 was 870, checked in by joachim, 18 years ago

added owner_guard and clearance_officer_guard
modified waeup_student_wf to use those.

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