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

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

many things fixed accorging to email of Nov 8

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
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
7##parameters=REQUEST,proceed=None, cpsdocument_edit_button=None, action=None
8##title=
9# $Id: application_edit.py 796 2006-11-08 23:01:05Z henrik $
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.)
27info = context.getStudentInfo()
28
29student = info['student']
30app = info['app']
31app_doc = info['app_doc']
32clear = info['clear']
33clear_doc = info['clear_doc']
34state = context.getStudentInfo()['review_state']
35is_valid, ds = app_doc.validate(request=REQUEST,
36                                schema_id = 'student_application',
37                                layout_id = 'student_application_fe',
38                                proxy=app,
39                                use_session=True)
40
41psm = ""
42args = {}
43action = "/application_edit_form"
44base_url = app.absolute_url()
45
46if app_doc.passport is not None:
47    args['proceed'] = 'Continue'
48
49if cpsdocument_edit_button:
50    if is_valid:
51        if app_doc.passport is not None:
52            args['portal_status_message'] = 'You successfully uploaded your passport picture.'
53        else:
54            args['portal_status_message'] = "You didn't upload a passport picture."
55elif proceed:
56    if is_valid:
57        action = "/request_clearance"
58        base_url = clear.absolute_url()
59    else:
60        args['portal_status_message'] = 'psm_content_error'
61if args:
62  url = base_url + action + '?' + urlencode(args)
63else:
64  url = base_url + action
65REQUEST.RESPONSE.redirect(url)
Note: See TracBrowser for help on using the repository browser.