Changeset 14105 for main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Timestamp:
- 22 Aug 2016, 09:09:31 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r14090 r14105 21 21 from time import time 22 22 from zope.component import getUtility, createObject 23 from zope.formlib.textwidgets import BytesDisplayWidget 23 24 from zope.security import checkPermission 24 25 from zope.i18n import translate … … 40 41 NigeriaPDFApplicationSlip) 41 42 from waeup.uniben.applicants.interfaces import ( 42 ICustomApplicant, IUnibenRegistration) 43 ICustomApplicant, 44 IUnibenRegistration, 45 ICustomUGApplicant, 46 ICustomPGApplicant, 47 ICustomPGApplicantEdit, 48 ICustomUGApplicantEdit, 49 IPUTMEApplicantEdit) 43 50 from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED 51 from kofacustom.nigeria.applicants.interfaces import ( 52 UG_OMIT_DISPLAY_FIELDS, 53 UG_OMIT_PDF_FIELDS, 54 UG_OMIT_MANAGE_FIELDS, 55 UG_OMIT_EDIT_FIELDS, 56 CBT_OMIT_DISPLAY_FIELDS, 57 CBT_OMIT_PDF_FIELDS, 58 CBT_OMIT_MANAGE_FIELDS, 59 CBT_OMIT_EDIT_FIELDS, 60 AFFIL_OMIT_DISPLAY_FIELDS, 61 AFFIL_OMIT_PDF_FIELDS, 62 AFFIL_OMIT_MANAGE_FIELDS, 63 AFFIL_OMIT_EDIT_FIELDS, 64 PG_OMIT_DISPLAY_FIELDS, 65 PG_OMIT_PDF_FIELDS, 66 PG_OMIT_MANAGE_FIELDS, 67 PG_OMIT_EDIT_FIELDS, 68 PUTME_OMIT_DISPLAY_FIELDS, 69 PUTME_OMIT_PDF_FIELDS, 70 PUTME_OMIT_MANAGE_FIELDS, 71 PUTME_OMIT_EDIT_FIELDS, 72 PUTME_OMIT_RESULT_SLIP_FIELDS, 73 PUDE_OMIT_DISPLAY_FIELDS, 74 PUDE_OMIT_PDF_FIELDS, 75 PUDE_OMIT_MANAGE_FIELDS, 76 PUDE_OMIT_EDIT_FIELDS, 77 PUDE_OMIT_RESULT_SLIP_FIELDS, 78 PRE_OMIT_DISPLAY_FIELDS, 79 PRE_OMIT_PDF_FIELDS, 80 PRE_OMIT_MANAGE_FIELDS, 81 PRE_OMIT_EDIT_FIELDS, 82 ) 44 83 45 84 from waeup.uniben.interfaces import MessageFactory as _ … … 165 204 form_fields = form_fields.omit(field) 166 205 return form_fields 167 form_fields = super(CustomApplicantDisplayFormPage, self).form_fields 206 elif self.target is not None and self.target.startswith('pg'): 207 form_fields = grok.AutoFields(ICustomPGApplicant) 208 for field in PG_OMIT_DISPLAY_FIELDS: 209 form_fields = form_fields.omit(field) 210 elif self.target is not None and self.target.startswith('pre'): 211 form_fields = grok.AutoFields(ICustomPGApplicant) 212 for field in PRE_OMIT_DISPLAY_FIELDS: 213 form_fields = form_fields.omit(field) 214 elif self.target is not None and self.target.startswith('cbt'): 215 form_fields = grok.AutoFields(ICustomUGApplicant) 216 for field in CBT_OMIT_DISPLAY_FIELDS: 217 form_fields = form_fields.omit(field) 218 elif self.target is not None and self.target.startswith('akj'): 219 form_fields = grok.AutoFields(ICustomPGApplicant) 220 for field in PRE_OMIT_DISPLAY_FIELDS: 221 form_fields = form_fields.omit(field) 222 elif self.target is not None and self.target.startswith('ak'): 223 form_fields = grok.AutoFields(ICustomUGApplicant) 224 for field in AFFIL_OMIT_DISPLAY_FIELDS: 225 form_fields = form_fields.omit(field) 226 elif self.target is not None and self.target.startswith('ase'): # was putme 227 form_fields = grok.AutoFields(ICustomUGApplicant) 228 for field in PUTME_OMIT_DISPLAY_FIELDS: 229 form_fields = form_fields.omit(field) 230 elif self.target is not None and self.target.startswith('pude'): 231 form_fields = grok.AutoFields(ICustomUGApplicant) 232 for field in PUDE_OMIT_DISPLAY_FIELDS: 233 form_fields = form_fields.omit(field) 234 else: 235 form_fields = grok.AutoFields(ICustomUGApplicant) 236 for field in UG_OMIT_DISPLAY_FIELDS: 237 form_fields = form_fields.omit(field) 238 #form_fields['perm_address'].custom_widget = BytesDisplayWidget 239 form_fields['notice'].custom_widget = BytesDisplayWidget 240 if not getattr(self.context, 'student_id'): 241 form_fields = form_fields.omit('student_id') 242 if not getattr(self.context, 'screening_score'): 243 form_fields = form_fields.omit('screening_score') 244 if not getattr(self.context, 'screening_venue') or self._not_paid(): 245 form_fields = form_fields.omit('screening_venue') 246 if not getattr(self.context, 'screening_date') or self._not_paid(): 247 form_fields = form_fields.omit('screening_date') 168 248 if not self.context.admchecking_fee_paid(): 169 249 form_fields = form_fields.omit( … … 296 376 form_fields['registration_cats'].for_display = True 297 377 return form_fields 298 form_fields = super(CustomApplicantManageFormPage, self).form_fields 378 if self.target is not None and self.target.startswith('pg'): 379 form_fields = grok.AutoFields(ICustomPGApplicant) 380 for field in PG_OMIT_MANAGE_FIELDS: 381 form_fields = form_fields.omit(field) 382 elif self.target is not None and self.target.startswith('pre'): 383 form_fields = grok.AutoFields(ICustomPGApplicant) 384 for field in PRE_OMIT_MANAGE_FIELDS: 385 form_fields = form_fields.omit(field) 386 elif self.target is not None and self.target.startswith('cbt'): 387 form_fields = grok.AutoFields(ICustomUGApplicant) 388 for field in CBT_OMIT_MANAGE_FIELDS: 389 form_fields = form_fields.omit(field) 390 elif self.target is not None and self.target.startswith('akj'): 391 form_fields = grok.AutoFields(ICustomPGApplicant) 392 for field in PRE_OMIT_MANAGE_FIELDS: 393 form_fields = form_fields.omit(field) 394 elif self.target is not None and self.target.startswith('ak'): 395 form_fields = grok.AutoFields(ICustomUGApplicant) 396 for field in AFFIL_OMIT_MANAGE_FIELDS: 397 form_fields = form_fields.omit(field) 398 elif self.target is not None and self.target.startswith('ase'): # was putme 399 form_fields = grok.AutoFields(ICustomUGApplicant) 400 for field in PUTME_OMIT_MANAGE_FIELDS: 401 form_fields = form_fields.omit(field) 402 elif self.target is not None and self.target.startswith('pude'): 403 form_fields = grok.AutoFields(ICustomUGApplicant) 404 for field in PUDE_OMIT_MANAGE_FIELDS: 405 form_fields = form_fields.omit(field) 406 else: 407 form_fields = grok.AutoFields(ICustomUGApplicant) 408 for field in UG_OMIT_MANAGE_FIELDS: 409 form_fields = form_fields.omit(field) 410 form_fields['student_id'].for_display = True 411 form_fields['applicant_id'].for_display = True 299 412 return form_fields 300 413 … … 320 433 form_fields['registration_cats'].for_display = True 321 434 return form_fields 322 form_fields = super(CustomApplicantEditFormPage, self).form_fields 435 if self.target is not None and self.target.startswith('pg'): 436 form_fields = grok.AutoFields(ICustomPGApplicantEdit) 437 for field in PG_OMIT_EDIT_FIELDS: 438 form_fields = form_fields.omit(field) 439 elif self.target is not None and self.target.startswith('pre'): 440 form_fields = grok.AutoFields(ICustomPGApplicantEdit) 441 for field in PRE_OMIT_EDIT_FIELDS: 442 form_fields = form_fields.omit(field) 443 elif self.target is not None and self.target.startswith('cbt'): 444 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 445 for field in CBT_OMIT_EDIT_FIELDS: 446 form_fields = form_fields.omit(field) 447 elif self.target is not None and self.target.startswith('akj'): 448 form_fields = grok.AutoFields(ICustomPGApplicant) 449 for field in PRE_OMIT_EDIT_FIELDS: 450 form_fields = form_fields.omit(field) 451 elif self.target is not None and self.target.startswith('ak'): 452 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 453 for field in AFFIL_OMIT_EDIT_FIELDS: 454 form_fields = form_fields.omit(field) 455 elif self.target is not None and self.target.startswith('ase'): # was putme 456 form_fields = grok.AutoFields(IPUTMEApplicantEdit) 457 for field in PUTME_OMIT_EDIT_FIELDS: 458 form_fields = form_fields.omit(field) 459 elif self.target is not None and self.target.startswith('pude'): 460 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 461 for field in PUDE_OMIT_EDIT_FIELDS: 462 form_fields = form_fields.omit(field) 463 else: 464 form_fields = grok.AutoFields(ICustomUGApplicantEdit) 465 for field in UG_OMIT_EDIT_FIELDS: 466 form_fields = form_fields.omit(field) 467 form_fields['applicant_id'].for_display = True 468 form_fields['reg_number'].for_display = True 323 469 return form_fields 324 470 … … 389 535 form_fields = form_fields.omit(field) 390 536 return form_fields 391 form_fields = super(CustomPDFApplicationSlip, self).form_fields 537 if self.target is not None and self.target.startswith('pg'): 538 form_fields = grok.AutoFields(ICustomPGApplicant) 539 for field in PG_OMIT_PDF_FIELDS: 540 form_fields = form_fields.omit(field) 541 elif self.target is not None and self.target.startswith('pre'): 542 form_fields = grok.AutoFields(ICustomPGApplicant) 543 for field in PRE_OMIT_PDF_FIELDS: 544 form_fields = form_fields.omit(field) 545 elif self.target is not None and self.target.startswith('cbt'): # uniben 546 form_fields = grok.AutoFields(ICustomUGApplicant) 547 for field in CBT_OMIT_PDF_FIELDS: 548 form_fields = form_fields.omit(field) 549 elif self.target is not None and self.target.startswith('akj'): # uniben 550 form_fields = grok.AutoFields(ICustomPGApplicant) 551 for field in PRE_OMIT_PDF_FIELDS: 552 form_fields = form_fields.omit(field) 553 elif self.target is not None and self.target.startswith('ak'): # uniben 554 form_fields = grok.AutoFields(ICustomUGApplicant) 555 for field in AFFIL_OMIT_PDF_FIELDS: 556 form_fields = form_fields.omit(field) 557 elif self.target is not None and self.target.startswith('ase'): # was putme 558 form_fields = grok.AutoFields(ICustomUGApplicant) 559 if self._reduced_slip(): 560 for field in PUTME_OMIT_RESULT_SLIP_FIELDS: 561 form_fields = form_fields.omit(field) 562 else: 563 for field in PUTME_OMIT_PDF_FIELDS: 564 form_fields = form_fields.omit(field) 565 elif self.target is not None and self.target.startswith('pude'): 566 form_fields = grok.AutoFields(ICustomUGApplicant) 567 if self._reduced_slip(): 568 for field in PUDE_OMIT_RESULT_SLIP_FIELDS: 569 form_fields = form_fields.omit(field) 570 else: 571 for field in PUDE_OMIT_PDF_FIELDS: 572 form_fields = form_fields.omit(field) 573 else: 574 form_fields = grok.AutoFields(ICustomUGApplicant) 575 for field in UG_OMIT_PDF_FIELDS: 576 form_fields = form_fields.omit(field) 577 if not getattr(self.context, 'student_id'): 578 form_fields = form_fields.omit('student_id') 579 if not getattr(self.context, 'screening_score'): 580 form_fields = form_fields.omit('screening_score') 581 if not getattr(self.context, 'screening_venue'): 582 form_fields = form_fields.omit('screening_venue') 583 if not getattr(self.context, 'screening_date'): 584 form_fields = form_fields.omit('screening_date') 392 585 return form_fields 393 586
Note: See TracChangeset for help on using the changeset viewer.