Changeset 1098 for WAeUP_SRP/trunk
- Timestamp:
- 20 Dec 2006, 01:40:01 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py
r1082 r1098 17 17 import logging 18 18 logger = logging.getLogger('Student.Clearance.Edit') 19 request = REQUEST 19 20 20 21 cpsdocument_edit_button = REQUEST.has_key('cpsdocument_edit_button') … … 22 23 clear_and_validate_button = REQUEST.has_key('clear_and_validate_button') 23 24 reject_clearance_button = REQUEST.has_key('reject_clearance_button') 25 result_edit_button = REQUEST.has_key('result_edit_button') 24 26 25 27 # Until ajax posts directly to its own script... … … 32 34 info = context.getClearanceInfo() 33 35 34 35 36 #'Sorry, you are not allowed to access this page!' 36 37 if info == None: 37 #return REQUEST.RESPONSE.redirect(context.portal_url())38 38 return REQUEST.RESPONSE.redirect(context.standard_error_message()) 39 40 41 39 student = info['student'] 42 app = info['app']43 app_doc = info['app_doc']40 #app = info['app'] 41 #app_doc = info['app_doc'] 44 42 clear = info['clear'] 45 43 clear_doc = info['clear_doc'] 46 44 student_id = info['id'] 47 45 member_id = str(context.portal_membership.getAuthenticatedMember()) 46 result_widgets = ('fst_sit_results', 47 'scd_sit_results', 48 'alr_results', 49 ) 50 required_scans = ('fst_sit_scan', 51 'jamb_slip', 52 'ref_letter', 53 'acc_let' 54 ) 55 form = request.form 56 psm = "" 57 args = {} 58 action = "/external_clearance_edit_form" 59 if context.isStudent(): 60 action = "/clearance_edit_form" 48 61 62 ##if result_edit_button: 63 ## dict = {} 64 ## for w in result_widgets: 65 ## if form.has_key("%s_s" % w): 66 ## v = getattr(clear_doc,w) 67 ## s = form.get("%s_s" % w) 68 ## g = form.get("%s_g" % w) 69 ## while 1: 70 ## if not s and g: 71 ## break 72 ## i = 0 73 ## done = False 74 ## for sv,gv in v: 75 ## if sv == s: 76 ## done = True 77 ## if not g: 78 ## v.pop(i) 79 ## break 80 ## v[i] = (s,g) 81 ## break 82 ## i += 1 83 ## if done: 84 ## break 85 ## if s and g: 86 ## v.append((s,g)) 87 ## break 88 ## dict[w] = v 89 ## #request.SESSION.set(w,v) 90 ## clear_doc.edit(mapping=dict) 91 ## args['portal_status_message'] = "Results updated" 92 ## url = clear.absolute_url() + action + '?' + urlencode(args) 93 ## REQUEST.RESPONSE.redirect(url) 49 94 is_valid, ds = clear_doc.validate(request=REQUEST, 50 95 schema_id = 'student_clearance', … … 53 98 use_session=True) 54 99 55 psm = ""56 args = {}57 action = "/external_clearance_edit_form"58 if context.isStudent():59 action = "/clearance_edit_form"60 100 61 101 if is_valid: 62 if cpsdocument_edit_button :102 if cpsdocument_edit_button or result_edit_button: 63 103 psm = "Content changed!" 64 104 logger.info('"%s","edited clearance of","%s"' % (member_id,student_id )) … … 74 114 elif cpsdocument_edit_and_view_button: 75 115 if acknowledge and info['review_state'] == "clearance_pin_entered": 76 logger.info('"%s","requested clearance"' % (student_id)) 77 info['clear_doc'].edit(mapping = {'request_date': current,}) 78 wftool.doActionFor(info['clear'],'close') 79 wftool.doActionFor(info['student'],'request_clearance',dest_container=1) 80 psm = "You successfully requested clearance!" 81 if context.isStudent(): 82 action = "/clearance_view" 116 missing = False 117 for scan in required_scans: 118 if not hasattr(clear_doc,scan): 119 missing = True 120 break 121 if not missing: 122 if not hasattr(clear_doc,"age_dec") and\ 123 not hasattr(clear_doc,"birth_certificate"): 124 missing = True 125 if missing: 126 logger.info('"%s","requested clearance with documents missing"' % (student_id)) 127 psm = "You have not uploaded all necessary documents to request clearance" 128 else: 129 logger.info('"%s","requested clearance"' % (student_id)) 130 info['clear_doc'].edit(mapping = {'request_date': current,}) 131 wftool.doActionFor(info['clear'],'close') 132 wftool.doActionFor(info['student'],'request_clearance',dest_container=1) 133 psm = "You successfully requested clearance!" 134 if context.isStudent(): 135 action = "/clearance_view" 83 136 elif acknowledge and info['review_state'] != "clearance_pin_entered": 84 137 logger.info('"%s","repeatedly requested clearance"' % (student_id))
Note: See TracChangeset for help on using the changeset viewer.