Changeset 9056 for main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Timestamp:
- 26 Jul 2012, 06:58:38 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r8960 r9056 21 21 from zope.component import getUtility 22 22 from zope.i18n import translate 23 from zope.formlib.textwidgets import BytesDisplayWidget 23 24 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 24 25 from waeup.kofa.students.interfaces import IStudentsUtils … … 38 39 ICustomPGApplicant, ICustomUGApplicant, ICustomPGApplicantEdit, ICustomUGApplicantEdit, 39 40 ICustomApplicantOnlinePayment, IPUTMEApplicantEdit, 40 UG_OMIT_DISPLAY_FIELDS, PG_OMIT_DISPLAY_FIELDS, 41 UG_OMIT_PDF_FIELDS, PG_OMIT_PDF_FIELDS, 42 UG_OMIT_MANAGE_FIELDS, PG_OMIT_MANAGE_FIELDS, 43 UG_OMIT_EDIT_FIELDS, PG_OMIT_EDIT_FIELDS, PUTME_OMIT_EDIT_FIELDS, 44 UG_OMIT_RESULT_SLIP_FIELDS) 41 UG_OMIT_DISPLAY_FIELDS, 42 UG_OMIT_PDF_FIELDS, 43 UG_OMIT_MANAGE_FIELDS, 44 UG_OMIT_EDIT_FIELDS, 45 PG_OMIT_DISPLAY_FIELDS, 46 PG_OMIT_PDF_FIELDS, 47 PG_OMIT_MANAGE_FIELDS, 48 PG_OMIT_EDIT_FIELDS, 49 PUTME_OMIT_DISPLAY_FIELDS, 50 PUTME_OMIT_PDF_FIELDS, 51 PUTME_OMIT_MANAGE_FIELDS, 52 PUTME_OMIT_EDIT_FIELDS, 53 PUTME_OMIT_RESULT_SLIP_FIELDS, 54 PUDE_OMIT_DISPLAY_FIELDS, 55 PUDE_OMIT_PDF_FIELDS, 56 PUDE_OMIT_MANAGE_FIELDS, 57 PUDE_OMIT_EDIT_FIELDS, 58 PUDE_OMIT_RESULT_SLIP_FIELDS, 59 ) 45 60 from waeup.uniben.interfaces import MessageFactory as _ 46 61 … … 62 77 return _('Download application slip') 63 78 79 80 class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage): 81 """A display view for applicant data. 82 """ 83 84 @property 85 def form_fields(self): 86 target = getattr(self.context.__parent__, 'prefix', None) 87 if target is not None and target.startswith('pg'): 88 form_fields = grok.AutoFields(ICustomPGApplicant) 89 for field in PG_OMIT_DISPLAY_FIELDS: 90 form_fields = form_fields.omit(field) 91 elif target is not None and target.startswith('putme'): 92 form_fields = grok.AutoFields(ICustomUGApplicant) 93 for field in PUTME_OMIT_DISPLAY_FIELDS: 94 form_fields = form_fields.omit(field) 95 elif target is not None and target.startswith('pude'): 96 form_fields = grok.AutoFields(ICustomUGApplicant) 97 for field in PUDE_OMIT_DISPLAY_FIELDS: 98 form_fields = form_fields.omit(field) 99 else: 100 form_fields = grok.AutoFields(ICustomUGApplicant) 101 for field in UG_OMIT_DISPLAY_FIELDS: 102 form_fields = form_fields.omit(field) 103 form_fields['perm_address'].custom_widget = BytesDisplayWidget 104 form_fields['notice'].custom_widget = BytesDisplayWidget 105 return form_fields 64 106 65 107 class CustomPDFApplicationSlip(PDFApplicationSlip): … … 84 126 for field in PG_OMIT_PDF_FIELDS: 85 127 form_fields = form_fields.omit(field) 86 el se:128 elif target is not None and target.startswith('putme'): 87 129 form_fields = grok.AutoFields(ICustomUGApplicant) 88 130 if self._reduced_slip(): 89 for field in UG_OMIT_RESULT_SLIP_FIELDS:131 for field in PUTME_OMIT_RESULT_SLIP_FIELDS: 90 132 form_fields = form_fields.omit(field) 91 133 else: 92 for field in UG_OMIT_PDF_FIELDS: 93 form_fields = form_fields.omit(field) 134 for field in PUTME_OMIT_PDF_FIELDS: 135 form_fields = form_fields.omit(field) 136 elif target is not None and target.startswith('pude'): 137 form_fields = grok.AutoFields(ICustomUGApplicant) 138 if self._reduced_slip(): 139 for field in PUDE_OMIT_RESULT_SLIP_FIELDS: 140 form_fields = form_fields.omit(field) 141 else: 142 for field in PUDE_OMIT_PDF_FIELDS: 143 form_fields = form_fields.omit(field) 144 else: 145 form_fields = grok.AutoFields(ICustomUGApplicant) 146 for field in UG_OMIT_PDF_FIELDS: 147 form_fields = form_fields.omit(field) 94 148 if not getattr(self.context, 'student_id'): 95 149 form_fields = form_fields.omit('student_id') 96 150 return form_fields 97 151 98 class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):99 """A display view for applicant data.100 """101 102 @property103 def form_fields(self):104 target = getattr(self.context.__parent__, 'prefix', None)105 if target is not None and target.startswith('pg'):106 form_fields = grok.AutoFields(ICustomPGApplicant)107 for field in PG_OMIT_DISPLAY_FIELDS:108 form_fields = form_fields.omit(field)109 else:110 form_fields = grok.AutoFields(ICustomUGApplicant)111 for field in UG_OMIT_DISPLAY_FIELDS:112 form_fields = form_fields.omit(field)113 return form_fields114 115 152 class CustomApplicantManageFormPage(ApplicantManageFormPage): 116 153 """A full edit view for applicant data. … … 124 161 for field in PG_OMIT_MANAGE_FIELDS: 125 162 form_fields = form_fields.omit(field) 163 elif target is not None and target.startswith('putme'): 164 form_fields = grok.AutoFields(ICustomUGApplicant) 165 for field in PUTME_OMIT_MANAGE_FIELDS: 166 form_fields = form_fields.omit(field) 167 elif target is not None and target.startswith('pude'): 168 form_fields = grok.AutoFields(ICustomUGApplicant) 169 for field in PUDE_OMIT_MANAGE_FIELDS: 170 form_fields = form_fields.omit(field) 126 171 else: 127 172 form_fields = grok.AutoFields(ICustomUGApplicant) … … 146 191 form_fields = grok.AutoFields(IPUTMEApplicantEdit) 147 192 for field in PUTME_OMIT_EDIT_FIELDS: 193 form_fields = form_fields.omit(field) 194 elif target is not None and target.startswith('pude'): 195 form_fields = grok.AutoFields(ICustomUGApplicant) 196 for field in PUDE_OMIT_EDIT_FIELDS: 148 197 form_fields = form_fields.omit(field) 149 198 else: -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py
r9006 r9056 40 40 UG_OMIT_MANAGE_FIELDS, 41 41 UG_OMIT_EDIT_FIELDS, 42 PUTME_OMIT_EDIT_FIELDS,43 UG_OMIT_RESULT_SLIP_FIELDS,44 42 PG_OMIT_DISPLAY_FIELDS, 45 43 PG_OMIT_PDF_FIELDS, 46 44 PG_OMIT_MANAGE_FIELDS, 47 45 PG_OMIT_EDIT_FIELDS, 46 PUTME_OMIT_DISPLAY_FIELDS, 47 PUTME_OMIT_PDF_FIELDS, 48 PUTME_OMIT_MANAGE_FIELDS, 49 PUTME_OMIT_EDIT_FIELDS, 50 PUTME_OMIT_RESULT_SLIP_FIELDS, 51 PUDE_OMIT_DISPLAY_FIELDS, 52 PUDE_OMIT_PDF_FIELDS, 53 PUDE_OMIT_MANAGE_FIELDS, 54 PUDE_OMIT_EDIT_FIELDS, 55 PUDE_OMIT_RESULT_SLIP_FIELDS, 48 56 ) 49 57 from waeup.uniben.interfaces import MessageFactory as _ 50 58 from waeup.uniben.payments.interfaces import ICustomOnlinePayment 51 52 ############################################################53 # Use former lgas for Uniben. Must be removed after application.54 from waeup.uniben.applicants.lgas import LGAS55 class LGASource(LGASource):56 """A source for school subjects used in exam documentation.57 """58 lga_dict = dict(LGAS)59 ############################################################60 59 61 60 class ICustomUGApplicant(INigeriaUGApplicant): … … 67 66 """ 68 67 69 nationality = schema.Choice(70 source = nats_vocab,71 title = _(u'Nationality'),72 required = False,73 )74 lga = schema.Choice(75 source = LGASource(),76 title = _(u'State/LGA (Nigerians only)'),77 required = False,78 )79 perm_address = schema.Text(80 title = _(u'Permanent Address'),81 required = False,82 )83 course1 = schema.Choice(84 title = _(u'1st Choice Course of Study'),85 source = AppCatCertificateSource(),86 required = True,87 )88 course2 = schema.Choice(89 title = _(u'2nd Choice Course of Study'),90 source = AppCatCertificateSource(),91 required = False,92 )93 jamb_subjects = schema.Text(94 title = _(u'Subjects and Scores'),95 required = False,96 )97 jamb_score = schema.Int(98 title = _(u'Total Score'),99 required = False,100 )101 notice = schema.Text(102 title = _(u'Notice'),103 required = False,104 )105 screening_venue = schema.TextLine(106 title = _(u'Screening Venue'),107 required = False,108 )109 screening_date = schema.TextLine(110 title = _(u'Screening Date'),111 required = False,112 )113 screening_score = schema.Int(114 title = _(u'Screening Score (%)'),115 required = False,116 )117 aggregate = schema.Int(118 title = _(u'Aggregate Score (%)'),119 description = _(u'(average of relative JAMB and PUTME scores)'),120 required = False,121 )122 result_uploaded = schema.Bool(123 title = _(u'Result uploaded'),124 default = False,125 )126 student_id = schema.TextLine(127 title = _(u'Student Id'),128 required = False,129 readonly = False,130 )131 course_admitted = schema.Choice(132 title = _(u'Admitted Course of Study'),133 source = CertificateSource(),134 required = False,135 )136 locked = schema.Bool(137 title = _(u'Form locked'),138 default = False,139 )140 141 68 class ICustomPGApplicant(INigeriaPGApplicant): 142 69 """A postgraduate applicant. … … 147 74 """ 148 75 149 nationality = schema.Choice(150 source = nats_vocab,151 title = _(u'Nationality'),152 required = False,153 )154 lga = schema.Choice(155 source = LGASource(),156 title = _(u'State/LGA (Nigerians only)'),157 required = False,158 )159 perm_address = schema.Text(160 title = _(u'Permanent Address'),161 required = False,162 )163 course1 = schema.Choice(164 title = _(u'1st Choice Course of Study'),165 source = AppCatCertificateSource(),166 required = True,167 )168 course2 = schema.Choice(169 title = _(u'2nd Choice Course of Study'),170 source = AppCatCertificateSource(),171 required = False,172 )173 hq_type = schema.Choice(174 title = _(u'Qualification Obtained'),175 required = False,176 readonly = False,177 vocabulary = high_qual,178 )179 hq_matric_no = schema.TextLine(180 title = _(u'Former Matric Number'),181 required = False,182 readonly = False,183 )184 hq_degree = schema.Choice(185 title = _(u'Class of Degree'),186 required = False,187 readonly = False,188 vocabulary = high_grade,189 )190 hq_school = schema.TextLine(191 title = _(u'Institution Attended'),192 required = False,193 readonly = False,194 )195 hq_session = schema.TextLine(196 title = _(u'Years Attended'),197 required = False,198 readonly = False,199 )200 hq_disc = schema.TextLine(201 title = _(u'Discipline'),202 required = False,203 readonly = False,204 )205 pp_school = schema.Choice(206 title = _(u'Qualification Obtained'),207 required = False,208 readonly = False,209 vocabulary = exam_types,210 )211 #presently = schema.Bool(212 # title = _(u'Attending'),213 # required = False,214 # readonly = False,215 # )216 presently_inst = schema.TextLine(217 title = _(u'If yes, name of institution'),218 required = False,219 readonly = False,220 )221 nysc_year = schema.Int(222 title = _(u'Nysc Year'),223 required = False,224 readonly = False,225 )226 nysc_lga = schema.Choice(227 source = LGASource(),228 title = _(u'Nysc Location'),229 required = False,230 )231 employer = schema.TextLine(232 title = _(u'Employer'),233 required = False,234 readonly = False,235 )236 emp_position = schema.TextLine(237 title = _(u'Employer Position'),238 required = False,239 readonly = False,240 )241 emp_start = FormattedDate(242 title = _(u'Start Date'),243 required = False,244 readonly = False,245 show_year = True,246 )247 emp_end = FormattedDate(248 title = _(u'End Date'),249 required = False,250 readonly = False,251 show_year = True,252 )253 emp_reason = schema.TextLine(254 title = _(u'Reason for Leaving'),255 required = False,256 readonly = False,257 )258 employer2 = schema.TextLine(259 title = _(u'2nd Employer'),260 required = False,261 readonly = False,262 )263 emp2_position = schema.TextLine(264 title = _(u'2nd Employer Position'),265 required = False,266 readonly = False,267 )268 emp2_start = FormattedDate(269 title = _(u'Start Date'),270 required = False,271 readonly = False,272 show_year = True,273 )274 emp2_end = FormattedDate(275 title = _(u'End Date'),276 required = False,277 readonly = False,278 show_year = True,279 )280 emp2_reason = schema.TextLine(281 title = _(u'Reason for Leaving'),282 required = False,283 readonly = False,284 )285 notice = schema.Text(286 title = _(u'Notice'),287 required = False,288 readonly = False,289 )290 student_id = schema.TextLine(291 title = _(u'Student Id'),292 required = False,293 readonly = False,294 )295 course_admitted = schema.Choice(296 title = _(u'Admitted Course of Study'),297 source = CertificateSource(),298 required = False,299 readonly = False,300 )301 locked = schema.Bool(302 title = _(u'Form locked'),303 default = False,304 )305 76 306 77 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): … … 323 94 """ 324 95 325 class ICustomUGApplicantEdit(I CustomUGApplicant):96 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit): 326 97 """An undergraduate applicant interface for edit forms. 327 98 … … 335 106 """ 336 107 337 email = schema.ASCIILine( 338 title = _(u'Email Address'), 339 required = True, 340 constraint=validate_email, 341 ) 342 date_of_birth = FormattedDate( 343 title = _(u'Date of Birth'), 344 required = True, 345 show_year = True, 346 ) 347 348 ICustomUGApplicantEdit[ 349 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order 350 ICustomUGApplicantEdit[ 351 'email'].order = ICustomUGApplicant['email'].order 352 353 class ICustomPGApplicantEdit(ICustomPGApplicant): 108 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): 354 109 """A postgraduate applicant interface for editing. 355 110 … … 363 118 """ 364 119 365 email = schema.ASCIILine(366 title = _(u'Email Address'),367 required = True,368 constraint=validate_email,369 )370 date_of_birth = FormattedDate(371 title = _(u'Date of Birth'),372 required = True,373 show_year = True,374 )375 376 ICustomPGApplicantEdit[377 'date_of_birth'].order = ICustomPGApplicant['date_of_birth'].order378 ICustomPGApplicantEdit[379 'email'].order = ICustomPGApplicant['email'].order380 381 120 class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): 382 121 """An applicant payment via payment gateways. … … 384 123 """ 385 124 386 class IPUTMEApplicantEdit(I CustomUGApplicant):125 class IPUTMEApplicantEdit(IPUTMEApplicantEdit): 387 126 """An undergraduate applicant interface for editing. 388 127 … … 395 134 respective form page. 396 135 """ 397 email = schema.ASCIILine(398 title = _(u'Email Address'),399 required = True,400 constraint=validate_email,401 )402 date_of_birth = FormattedDate(403 title = _(u'Date of Birth'),404 required = True,405 show_year = True,406 )407 136 408 IPUTMEApplicantEdit[ 409 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order 410 IPUTMEApplicantEdit[ 411 'email'].order = ICustomUGApplicant['email'].order 412 413 class ICustomApplicantUpdateByRegNo(ICustomApplicant): 137 class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): 414 138 """Representation of an applicant. 415 139 … … 417 141 the applicant object. 418 142 """ 419 reg_number = schema.TextLine(420 title = u'Registration Number',421 required = False,422 )
Note: See TracChangeset for help on using the changeset viewer.