- Timestamp:
- 26 May 2011, 05:26:37 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py
r6187 r6196 28 28 from waeup.sirp.app import University 29 29 from waeup.sirp.applicants.interfaces import ( 30 IResultEntry, IApplicant, IApplicant PDEEditData,30 IResultEntry, IApplicant, IApplicantEdit, 31 31 DEFAULT_PASSPORT_IMAGE_MALE, 32 32 ) … … 41 41 42 42 class Applicant(grok.Model): 43 grok.implements(IApplicant, IApplicantPDEEditData)43 grok.implements(IApplicant,IApplicantEdit) 44 44 grok.provides(IApplicant) 45 45 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6189 r6196 54 54 from waeup.sirp.applicants import ResultEntry, Applicant, get_applicant_data 55 55 from waeup.sirp.applicants.interfaces import ( 56 IApplicant, IApplicantPrincipal, IApplicantPDEEditData,56 IApplicant, IApplicantPrincipal,IApplicantEdit, 57 57 IApplicantsRoot, IApplicantsContainer, IApplicantsContainerProvider, 58 58 IApplicantsContainerAdd, application_types_vocab … … 435 435 grok.require('waeup.viewApplication') 436 436 form_fields = grok.AutoFields(IApplicant).omit('locked') 437 form_fields['fst_sit_results'].custom_widget = list_results_display_widget437 #form_fields['fst_sit_results'].custom_widget = list_results_display_widget 438 438 form_fields['passport'].custom_widget = ThumbnailWidget 439 439 form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') 440 440 label = 'Applicant' 441 title = 'Applicant' 442 pnav = 3 443 444 class EditApplicantStudent(WAeUPEditFormPage): 441 pnav = 3 442 443 @property 444 def title(self): 445 return '%s' % self.context.access_code 446 447 @property 448 def label(self): 449 container_title = self.context.__parent__.title 450 return '%s Application Record' % container_title 451 452 class EditApplicantFull(WAeUPEditFormPage): 453 """A full edit view for applicant data. 454 """ 455 grok.context(IApplicant) 456 grok.name('edit_full') 457 grok.require('waeup.editFullApplication') 458 form_fields = grok.AutoFields(IApplicant) #.omit('locked') 459 form_fields['passport'].custom_widget = EncodingImageFileWidget 460 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 461 grok.template('form_edit') 462 pnav = 3 463 464 def update(self): 465 datepicker.need() # Enable jQuery datepicker in date fields. 466 super(EditApplicantFull, self).update() 467 return 468 469 @property 470 def title(self): 471 return self.context.access_code 472 473 @property 474 def label(self): 475 container_title = self.context.__parent__.title 476 return '%s Application Form' % container_title 477 478 @grok.action('Save') 479 def save(self, **data): 480 self.applyData(self.context, **data) 481 self.context._p_changed = True 482 self.flash('Form has been saved.') 483 return 484 485 class EditApplicantStudent(EditApplicantFull): 445 486 """An applicant-centered edit view for applicant data. 446 487 """ 447 grok.context(IApplicant )488 grok.context(IApplicantEdit) 448 489 grok.name('edit') 449 490 grok.require('waeup.editApplication') 450 form_fields = grok.AutoFields(IApplicant PDEEditData).omit('locked')491 form_fields = grok.AutoFields(IApplicantEdit).omit('locked') 451 492 form_fields['passport'].custom_widget = EncodingImageFileWidget 452 493 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 453 grok.template('form_edit _pde')494 grok.template('form_edit') 454 495 455 496 def emitLockMessage(self): … … 466 507 return 467 508 468 def filteredWidgets(self): 469 for widget in self.widgets: 470 if widget.name == 'form.confirm_passport': 471 continue 472 yield widget 473 474 @property 475 def label(self): 476 # XXX: Use current/upcoming session 477 return 'Apply for Post UDE Screening Test (2009/2010)' 478 title = 'Edit Application' 479 pnav = 3 509 def dataNotComplete(self): 510 if self.context.confirm_passport is not True: 511 return 'Passport confirmation box not ticked.' 512 if len(self.errors) > 0: 513 return 'Form has errors.' 514 return False 480 515 481 516 @grok.action('Save') … … 486 521 self.applyData(self.context, **data) 487 522 self.context._p_changed = True 523 self.flash('Form has been saved.') 488 524 return 489 525 … … 495 531 self.applyData(self.context, **data) 496 532 self.context._p_changed = True 497 if not self.dataComplete():498 self.flash( 'Data yet not complete.')533 if self.dataNotComplete(): 534 self.flash(self.dataNotComplete()) 499 535 return 500 536 self.context.locked = True 501 return 502 503 def dataComplete(self): 504 if self.context.confirm_passport is not True: 505 return False 506 if len(self.errors) > 0: 507 return False 508 return True 509 510 class EditApplicantFull(WAeUPEditFormPage): 511 """A full edit view for applicant data. 512 513 This one is meant to be used by officers only. 514 """ 515 grok.context(IApplicant) 516 grok.name('edit_full') 517 grok.require('waeup.editFullApplication') 518 form_fields = grok.AutoFields(IApplicantPDEEditData).omit('locked') 519 form_fields['passport'].custom_widget = EncodingImageFileWidget 520 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 521 grok.template('form_edit_full') 522 523 def update(self): 524 if self.context.locked: 525 self.emitLockMessage() 526 return 527 datepicker.need() # Enable jQuery datepicker in date fields. 528 super(EditApplicantFull, self).update() 529 return 530 531 def filteredWidgets(self): 532 for widget in self.widgets: 533 if widget.name == 'form.confirm_passport': 534 continue 535 yield widget 536 537 @property 538 def label(self): 539 return 'Application for %s' % self.context.access_code 540 title = 'Edit Application' 541 pnav = 3 542 543 @grok.action('Save') 544 def save(self, **data): 545 self.applyData(self.context, **data) 546 self.context._p_changed = True 547 return 537 self.flash('Form has been submitted.') 538 self.redirect(self.url(self.context)) 539 return 540 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/form_edit.pt
r6194 r6196 21 21 </div> 22 22 23 <div class="block">24 <h3>Instructions</h3>25 <ol class="list">26 <li>27 Fill the form and upload your Passport Photograph with red background28 in jpg format.29 </li>30 <li>31 Save and preview picture.32 </li>33 <li>34 Press the <em>Final Submit</em> button.35 </li>36 </ol>37 </div>38 39 23 <table class="form-fields zebra"> 40 24 <tbody> 41 <tal:block repeat="widget view/ filteredWidgets">25 <tal:block repeat="widget view/widgets"> 42 26 <tr> 43 27 <td class="label" tal:define="hint widget/hint"> 44 28 <label tal:condition="python:hint" 45 29 tal:attributes="for widget/name"> 46 <span class="required" tal:condition="widget/required" 47 >*</span><span i18n:translate=""30 <span class="required" tal:condition="widget/required">* 31 </span><span i18n:translate="" 48 32 tal:content="widget/label">label</span> 49 33 </label> 50 34 <label tal:condition="python:not hint" 51 35 tal:attributes="for widget/name"> 52 <span class="required" tal:condition="widget/required" 53 >*</span><span i18n:translate=""36 <span class="required" tal:condition="widget/required">* 37 </span><span i18n:translate="" 54 38 tal:content="widget/label">label</span> 55 39 </label> … … 65 49 </tr> 66 50 </tal:block> 67 <tr>68 <td colspan="2">69 <input class="hiddenType" id="form.confirm_passport.used"70 name="form.confirm_passport.used" type="hidden" value="" />71 <input type="checkbox" name="form.confirm_passport"72 tal:attributes="checked context/confirm_passport"73 />74 <label for="confirm"></label>75 <span>76 I confirm that the Passport Photograph uploaded on this form77 is a true picture of me.78 </span>79 </td>80 </tr>81 51 </tbody> 82 52 </table> … … 90 60 </div> 91 61 </form> 92 93 <br />94
Note: See TracChangeset for help on using the changeset viewer.