Changeset 14147 for main/waeup.uniben/trunk
- Timestamp:
- 1 Sep 2016, 15:33:23 (8 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r14141 r14147 31 31 ApplicationFeePaymentAddPage, 32 32 OnlinePaymentApprovePage, 33 ExportPDFPageApplicationSlip) 33 ExportPDFPageApplicationSlip, 34 ApplicantBaseDisplayFormPage) 35 from waeup.kofa.students.interfaces import IStudentsUtils 34 36 from waeup.kofa.applicants.interfaces import ( 35 37 ISpecialApplicant, IApplicantsUtils) … … 609 611 return '%s - %s %s' % (container_title, 610 612 ar_translation, self.context.application_number) 613 614 class ExportScreeningInvitationSlip(UtilityView, grok.View): 615 """Deliver a PDF slip of the context. 616 """ 617 grok.context(ICustomApplicant) 618 grok.name('screening_invitation_slip.pdf') 619 grok.require('waeup.viewApplication') 620 form_fields = None 621 label = u'Invitation Letter for Screening' 622 623 624 @property 625 def note(self): 626 if self.context.screening_date: 627 return """ 628 <br /><br /><br /><br /><font size='12'> 629 Dear %s, 630 <br /><br /><br /> 631 You are invited for your Uniben Admission Screening Exercise on: 632 <br /><br /> 633 <strong>%s</strong>. 634 <br /><br /> 635 Please bring along this letter of invitation to the University Main Auditorium 636 <br /><br /> 637 on your screening date. 638 <br /><br /><br /> 639 Signed, 640 <br /><br /> 641 The Registrar<br /> 642 </font> 643 644 """ % (self.context.display_fullname, self.context.screening_date) 645 return 646 647 def update(self): 648 if not self.context.screening_date: 649 self.flash(_('Forbidden'), type="warning") 650 self.redirect(self.url(self.context)) 651 652 def render(self): 653 applicantview = ApplicantBaseDisplayFormPage(self.context, self.request) 654 students_utils = getUtility(IStudentsUtils) 655 return students_utils.renderPDF(self,'screening_invitation_slip.pdf', 656 self.context, applicantview, note=self.note) -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py
r14064 r14147 168 168 return 169 169 170 def test_application_slip (self):170 def test_application_slips(self): 171 171 172 172 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 185 185 open(path, 'wb').write(self.browser.contents) 186 186 print "Sample application_slip.pdf written to %s" % path 187 # Screening invitation letter is not yet available 188 self.browser.open(self.view_path) 189 self.assertFalse('invitation slip' in self.browser.contents) 190 self.browser.open(self.view_path + '/screening_invitation_slip.pdf') 191 self.assertTrue('Forbidden' in self.browser.contents) 192 self.applicant.screening_date = u'any date' 193 # The invitation letter can be printed 194 self.browser.open(self.view_path) 195 self.browser.getLink("invitation").click() 196 self.assertEqual(self.browser.headers['Status'], '200 Ok') 197 self.assertEqual(self.browser.headers['Content-Type'], 198 'application/pdf') 199 path = os.path.join(samples_dir(), 'screening_invitation_slip.pdf') 200 open(path, 'wb').write(self.browser.contents) 201 print "Sample screening_invitation_slip.pdf written to %s" % path 187 202 188 203 def test_akoka_application_slip(self): -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/viewlets.py
r11784 r14147 17 17 ## 18 18 19 import grok 20 from waeup.kofa.browser.viewlets import ManageActionButton 19 21 from waeup.kofa.applicants.viewlets import PDFActionButton 22 from waeup.uniben.applicants.interfaces import ICustomApplicant 23 from waeup.uniben.interfaces import MessageFactory as _ 20 24 21 25 class CustomPDFActionButton(PDFActionButton): … … 32 36 return 33 37 return self.view.url(self.view.context, self.target) 38 39 class ScreeningInvitationSlipActionButton(ManageActionButton): 40 grok.order(4) 41 grok.context(ICustomApplicant) 42 grok.require('waeup.viewApplication') 43 icon = 'actionicon_pdf.png' 44 text = _('Download screening invitation slip') 45 target = 'screening_invitation_slip.pdf' 46 47 @property 48 def target_url(self): 49 if self.context.screening_date: 50 return self.view.url(self.view.context, self.target) 51 return False
Note: See TracChangeset for help on using the changeset viewer.