source: WAeUP_SRP/trunk/skins/waeup_student/application_edit.py @ 832

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

3rd batch of repairs

  • Property svn:keywords set to Id
File size: 2.0 KB
RevLine 
[478]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
[788]7##parameters=REQUEST,proceed=None, cpsdocument_edit_button=None, action=None
[478]8##title=
[486]9# $Id: application_edit.py 799 2006-11-09 07:37:02Z henrik $
[478]10"""
11"""
[539]12wftool = context.portal_workflow
[478]13from urllib import urlencode
14from Products.CPSDocument.utils import getFormUidUrlArg
[766]15import DateTime
16current = DateTime.DateTime()
[478]17
18# Until ajax posts directly to its own script...
[788]19##if 'ajax_edit' in REQUEST.form:
20##    return context.cpsdocument_edit_ajax(REQUEST, cluster=cluster)
[478]21
22# Check flexible controls
[486]23#context.editLayouts(REQUEST=REQUEST)
[478]24
25# Validate the document and write it if it's valid
26# (We don't call getEditableContent here, validate does it when needed.)
[535]27info = context.getStudentInfo()
[478]28
[535]29student = info['student']
30app = info['app']
31app_doc = info['app_doc']
32state = context.getStudentInfo()['review_state']
[796]33is_valid, ds = app_doc.validate(request=REQUEST,
[788]34                                schema_id = 'student_application',
35                                layout_id = 'student_application_fe',
36                                proxy=app,
[479]37                                use_session=True)
[483]38
[788]39psm = ""
40args = {}
[794]41action = "/application_edit_form"
42base_url = app.absolute_url()
[796]43
44if app_doc.passport is not None:
45    args['proceed'] = 'Continue'
46
[788]47if cpsdocument_edit_button:
[479]48    if is_valid:
[788]49        if app_doc.passport is not None:
[796]50            args['portal_status_message'] = 'You successfully uploaded your passport picture.'
[788]51        else:
[796]52            args['portal_status_message'] = "You didn't upload a passport picture."
[788]53elif proceed:
54    if is_valid:
[798]55        action = "/start_clearance"
[799]56        base_url = student.absolute_url()
57        url = base_url + action
58        return REQUEST.RESPONSE.redirect(url)
[479]59    else:
[796]60        args['portal_status_message'] = 'psm_content_error'
61if args:
62  url = base_url + action + '?' + urlencode(args)
63else:
64  url = base_url + action
[478]65REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.