## Script (Python) "cpsdocument_edit" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST,proceed=None, cpsdocument_edit_button=None, final_submit=None, action=None ##title= # $Id: clearance_edit.py 832 2006-11-10 16:52:23Z joachim $ """ """ wftool = context.portal_workflow from urllib import urlencode from Products.CPSDocument.utils import getFormUidUrlArg import DateTime current = DateTime.DateTime() # Until ajax posts directly to its own script... ##if 'ajax_edit' in REQUEST.form: ## return context.cpsdocument_edit_ajax(REQUEST, cluster=cluster) # Check flexible controls #context.editLayouts(REQUEST=REQUEST) # Validate the document and write it if it's valid # (We don't call getEditableContent here, validate does it when needed.) wftool = context.portal_workflow info = context.getStudentInfo() student = info['student'] app = info['app'] app_doc = info['app_doc'] clear = info['clear'] clear_doc = info['clear_doc'] state = context.getStudentInfo()['review_state'] if final_submit: wftool.doActionFor(info['clear'],'close') wftool.doActionFor(info['student'],'request_clearance') return REQUEST.RESPONSE.redirect("%s/student_index" % info['url']) is_valid, ds = clear_doc.validate(request=REQUEST, schema_id = 'student_clearance', layout_id = 'student_clearance_fe', proxy=clear, use_session=True) psm = "" args = {} action = "/clearance_edit_form" if cpsdocument_edit_button: if is_valid: psm = 'Content changed.' if ds.get('acknow'): args['final_submit'] = "Finally Submit" else: args = getFormUidUrlArg(REQUEST) psm = "Please correct Your errors." args['portal_status_message'] = psm url = clear.absolute_url() + action + '?' + urlencode(args) REQUEST.RESPONSE.redirect(url)