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

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

new logig for the Apply/Finally? in application_edit and clearance_edit
the field acknow can be removed from clearance schema and layouts (to be done)

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