Changeset 2310
- Timestamp:
- 4 Oct 2007, 15:47:54 (17 years ago)
- Location:
- WAeUP_SRP/base/skins
- Files:
-
- 10 added
- 10 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_design/default.css.dtml
r2277 r2310 341 341 div.label { 342 342 font-weight: bold; 343 343 344 } 344 345 … … 787 788 } 788 789 789 div.label {790 font-weight: bold;791 display: inline;792 }793 790 794 791 .required { -
WAeUP_SRP/base/skins/waeup_student/apply_admission.py
r892 r2310 1 ## Script (Python) "apply_admission" 2 ##bind container=container 3 ##bind context=context 4 ##bind namespace= 5 ##bind script=script 6 ##bind subpath=traverse_subpath 1 7 ##parameters=REQUEST 8 ##title= 9 ## 2 10 # $Id$ 3 11 """ 4 12 process the Application Form 5 return html renderer + psm6 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 19 7 20 import DateTime 21 import logging 22 logger = logging.getLogger('Skins.apply_admission') 23 24 mtool = context.portal_membership 25 member = mtool.getAuthenticatedMember() 26 8 27 current = DateTime.DateTime() 9 28 pr = context.portal_registration 10 11 12 type_name = 'StudentApplication' 13 ti = context.portal_types[type_name] 14 REQUEST.set('type_name',type_name) 15 16 validate = REQUEST.has_key("cpsdocument_create_button") 17 29 request = REQUEST 30 31 #type_name = 'StudentApplication' 32 #ti = context.portal_types[type_name] 33 #REQUEST.set('type_name',type_name) 34 create = "create" in request.keys() 35 apply_admission = "apply" in request.keys() 36 edit = "edit" in request.keys() 37 slip = "slip" in request.keys() 38 manage = "manage" in request.keys() 39 submitted = False 40 mode = request.get('mode','') 41 if not mode: 42 if apply_admission or edit or manage: 43 mode = "edit" 44 else: 45 mode = "create" 46 validate = create or edit or apply_admission 47 48 if manage: 49 validate = False 50 #layout = "application_pume" 51 #application_type = "" 52 without_reg_no = False 53 if traverse_subpath and traverse_subpath[0] == "prence": 54 layout = "application_prence" 55 application_type = "prence" 56 without_reg_no = True 57 elif traverse_subpath and traverse_subpath[0] == "pume": 58 layout = "application_pume" 59 application_type = "pume" 60 elif traverse_subpath and traverse_subpath[0] == "pce": 61 layout = "application_pce" 62 application_type = "pce" 63 elif traverse_subpath and traverse_subpath[0] == "pde": 64 layout = "application_pde" 65 application_type = "pce" 66 elif traverse_subpath and traverse_subpath[0] == "cest": 67 layout = "application_cest" 68 application_type = "pce" 69 else: 70 return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 71 72 18 73 lt = context.portal_layouts 19 pr = context.portal_registration 20 21 res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe', 22 schema_id= 'student_application', 23 context=context, 24 mapping=validate and REQUEST, 25 ob={}, 26 layout_mode='create', 27 formaction = "apply_admission", 28 button = "Open JAMB Record", 29 ) 74 reg_no = request.get('widget__reg_no','').upper() 75 if not reg_no: 76 reg_no = request.form.get('reg_no','').upper() 77 pin = request.form.get('pin','') 78 object = {} 79 if reg_no: 80 brains = context.applicants_catalog(reg_no = reg_no) 81 if len(brains) == 1: 82 for field in context.applicants_catalog.schema(): 83 object[field] = getattr(brains[0],field,None) 84 if not object['passport']: 85 object['passport'] = '' 86 if object['status'] and 'submitted' in object['status']: 87 submitted = True 88 89 if not (create or slip) and (pin != object['pin'] and not context.isSectionOfficer()): 90 logger.info('%s/%s entered wrong pin %s' % (member,reg_no,pin)) 91 return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 92 93 94 # For the next application session it should be reverted to 95 # (see comment 09/06/07 16:40:52 in ticket #328): 96 97 #if not create and (pin != object['pin'] and not context.isSectionOfficer()): 98 #logger.info('%s/%s entered wrong pin %s' % (member,reg_no,pin)) 99 #return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 100 101 if slip: 102 mode = "view_slip" 103 logger.info('%s/%s views application slip' % (member,reg_no)) 104 105 res,psm,ds = lt.renderLayout(layout_id= layout, 106 schema_id= 'application', 107 layout_mode = mode, 108 context=context, 109 mapping=validate and REQUEST, 110 ob=object, 111 commit = False, 112 ) 113 114 if slip: 115 return context.apply_admission_slip(rendered = res, 116 psm = "", 117 #psm = "%s, %s" % (psm,ds), 118 mode = mode, 119 ds = ds, 120 application_type = application_type, 121 ) 122 30 123 if psm == 'invalid': 31 return context.application_pin_form(rendered = res, 32 psm = "Please correct your input!", 33 #psm = "%s, %s" % (psm,ds), 34 firstlayout = True, 35 lastlayout = True, 36 ds = ds, 37 ) 38 elif psm == '': 39 return context.application_pin_form(rendered = res, 40 psm = None, 41 firstlayout = True, 42 lastlayout = True, 43 ds = ds, 44 ) 45 elif psm == 'valid': 46 s_id = ds.get('s_id') 47 pin = str(ds.get('app_ac_pin')) 48 return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" 49 % (context.absolute_url(),s_id,pin.split('-')[2],pin)) 50 51 return 52 53 124 return context.apply_admission_form(rendered = res, 125 psm = "Please correct your input!", 126 #psm = "%s, %s" % (psm,ds), 127 mode = mode, 128 ds = ds, 129 application_type = application_type, 130 ) 131 elif psm == '' and not manage: 132 return context.apply_admission_form(rendered = res, 133 psm = psm, 134 ds = ds, 135 mode = mode, 136 application_type = application_type, 137 ) 138 elif psm == 'valid' or (psm == '' and manage): 139 pass 140 if without_reg_no: 141 reg_no = ds.get('reg_no') 142 data = {} 143 dm = ds.getDataModel() 144 for field in context.applicants_catalog.schema(): 145 if dm.has_key("%s" % field): 146 data[field] = dm.get(field) 147 data['reg_no'] = reg_no 148 149 if apply_admission: 150 if submitted: 151 mode = "view" 152 psm = "The form has already been submitted and you are not allowed to resubmit the data!" 153 logger.info('%s/%s tried to resubmit application record' % (member,reg_no)) 154 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 155 schema_id= 'application', 156 layout_mode = mode, 157 context=context, 158 mapping={}, 159 ob=object, 160 commit = False, 161 ) 162 elif not request.has_key('confirm'): 163 mode = "edit" 164 psm = "Please confirm Passport Photograph!" 165 logger.info('%s/%s tried to submit without ticking confirmation check box' % (member,reg_no)) 166 else: 167 mode = "view" 168 psm = "You successfully applied for admission!" 169 if object['status'] == 'edited': 170 data['status'] = "submitted" 171 data['application_date'] = current 172 logger.info('%s/%s modified and submitted application record' % (member,reg_no)) 173 elif object['status'] == 'reset': 174 data['status'] = 'resubmitted on %s' % DateTime.DateTime().strftime('%A, %B %d, %Y') 175 logger.info('%s/%s modified and resubmitted application record' % (member,reg_no)) 176 object['status'] = data['status'] 177 context.applicants_catalog.modifyRecord(**data) 178 179 res,psm_dummy,ds = lt.renderLayout(layout_id= layout, 180 schema_id= 'application', 181 layout_mode = mode, 182 context=context, 183 mapping=validate and REQUEST, 184 ob=object, 185 commit = False, 186 ) 187 elif create: 188 if submitted: 189 mode = "view" 190 logger.info('%s/%s views application record' % (member,reg_no)) 191 else: 192 mode = "edit" 193 logger.info('%s/%s edits application record' % (member,reg_no)) 194 psm = "" 195 #set_trace() 196 if without_reg_no: 197 object['reg_no'] = reg_no 198 object['pin'] = str(ds.get('pin')) 199 res,psm,ds_dummy = lt.renderLayout(layout_id= layout, 200 schema_id= 'application', 201 layout_mode = mode, 202 context=context, 203 mapping={}, 204 ob=object, 205 commit = False, 206 ) 207 elif edit: 208 if submitted: 209 mode = "view" 210 psm = "The form has already been submitted and you are not allowed to modify the data!" 211 logger.info('%s/%s tried to edit submitted application record' % (member,reg_no)) 212 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 213 schema_id= 'application', 214 layout_mode = mode, 215 context=context, 216 mapping={}, 217 ob=object, 218 commit = False, 219 ) 220 else: 221 mode = "edit" 222 psm = "Content changed!" 223 data['status'] = "edited" 224 context.applicants_catalog.modifyRecord(**data) 225 logger.info('%s/%s modified application record' % (member,reg_no)) 226 227 elif manage: 228 if submitted: 229 mode = "view" 230 psm = "You are now assuming the applicant's role!" 231 logger.info('%s/%s entered application record' % (member,reg_no)) 232 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 233 schema_id= 'application', 234 layout_mode = mode, 235 context=context, 236 mapping={}, 237 ob=object, 238 commit = False, 239 ) 240 else: 241 mode = "edit" 242 psm = "You are now assuming the applicant's role!" 243 logger.info('%s/%s entered application record' % (member,reg_no)) 244 245 246 try: 247 passport_uploaded = bool(data['passport']) 248 except: 249 passport_uploaded = False 250 251 return context.apply_admission_form(rendered = res, 252 psm = psm, 253 #psm = "%s, %s" % (psm,ds), 254 mode = mode, 255 show_submit = passport_uploaded, 256 ds = ds, 257 application_type = application_type, 258 ) 259 260 -
WAeUP_SRP/base/skins/waeup_student/search_students_form.pt
r2157 r2310 20 20 <nobr><a href="statistics_simple_view">Basic Student Statistics</a> 21 21 </nobr> 22 <nobr><a href="apply_ pume_manage">Application Process</a>22 <nobr><a href="apply_admission_manage">Application Process</a> 23 23 </nobr> 24 24 <span tal:condition="is_so">
Note: See TracChangeset for help on using the changeset viewer.