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

Last change on this file since 834 was 832, checked in by joachim, 18 years ago

add select boxes to clearance results
display final_submit button, if aknow checked
set clearance object to closed and
student to clearance_requested when final submit button is clicked

  • Property svn:keywords set to Id
File size: 1.9 KB
RevLine 
[788]1## Script (Python) "cpsdocument_edit"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
[832]7##parameters=REQUEST,proceed=None, cpsdocument_edit_button=None, final_submit=None, action=None
[788]8##title=
[805]9# $Id: clearance_edit.py 832 2006-11-10 16:52:23Z joachim $
[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]36if final_submit:
37    wftool.doActionFor(info['clear'],'close')
38    wftool.doActionFor(info['student'],'request_clearance')
39    return REQUEST.RESPONSE.redirect("%s/student_index" % info['url'])
40
[801]41is_valid, ds = clear_doc.validate(request=REQUEST,
[788]42                                schema_id = 'student_clearance',
43                                layout_id = 'student_clearance_fe',
44                                proxy=clear,
45                                use_session=True)
46
47psm = ""
48args = {}
[789]49action = "/clearance_edit_form"
[788]50if cpsdocument_edit_button:
51    if is_valid:
52        psm = 'Content changed.'
[832]53        if ds.get('acknow'):
54            args['final_submit'] = "Finally Submit"
[788]55    else:
56        args = getFormUidUrlArg(REQUEST)
57        psm = "Please correct Your errors."
58args['portal_status_message'] = psm
59url = clear.absolute_url() + action + '?' + urlencode(args)
60REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.