- Timestamp:
- 13 Mar 2019, 17:48:36 (6 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r15267 r15352 28 28 from waeup.kofa.browser.layout import action, KofaEditFormPage, UtilityView 29 29 from waeup.kofa.students.browser import ( 30 StudentBaseEditFormPage, 30 31 StudyLevelEditFormPage, StudyLevelDisplayFormPage, 31 32 StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, … … 56 57 from waeup.uniben.students.interfaces import ( 57 58 ICustomStudent, 59 ICustomStudentBase, 58 60 ICustomStudentOnlinePayment, 59 61 ICustomStudentStudyCourse, … … 282 284 self.context.student, studentview, 283 285 omit_fields=self.omit_fields, 286 note=self.note) 287 288 class ExportJHLIdCard(UtilityView, grok.View): 289 """Deliver a an id card for the John Harris Library. 290 """ 291 grok.context(ICustomStudent) 292 grok.name('jhl_idcard.pdf') 293 grok.require('waeup.viewStudent') 294 prefix = 'form' 295 296 label = u"John Harris Library Reader's Ticket" 297 298 omit_fields = ( 299 'suspended', 'email', 300 'adm_code', 'suspended_comment', 301 'date_of_birth','reg_number', 302 'current_mode', 'certificate', 303 'entry_session', 304 'flash_notice') 305 306 form_fields = [] 307 308 def _signatures(self): 309 return ([( 310 'Current HD<br /> D. R. (Exams & Records)<br /> ' 311 'For: Registrar')],) 312 313 def _sigsInFooter(self): 314 return (_("Date, Reader's Signature"), 315 _("Date, Circulation Librarian's Signature"), 316 ) 317 318 @property 319 def note(self): 320 return """ 321 <br /><br /><br /><br /><font size='12'> 322 This is to certify that the bearer whose photograph and other details appear 323 overleaf is a registered user of <b>John Harris Library, University of Benin</b>. 324 The card is not transferable. A replacement fee is charged for a loss, 325 mutilation or otherwise. If found, please, return to John Harris Library, 326 University of Benin, Benin City. 327 </font> 328 329 """ 330 return 331 332 def render(self): 333 studentview = StudentBasePDFFormPage(self.context.student, 334 self.request, self.omit_fields) 335 students_utils = getUtility(IStudentsUtils) 336 return students_utils.renderPDF( 337 self, 'jhl_idcard', 338 self.context.student, studentview, 339 omit_fields=self.omit_fields, 340 sigs_in_footer=self._sigsInFooter(), 284 341 note=self.note) 285 342 … … 595 652 """Deliver a PDF slip of the context. 596 653 """ 597 598 654 omit_fields = ('password', 'suspended', 'suspended_comment', 599 655 'phone', 'adm_code', 'email', 'date_of_birth', 'flash_notice') … … 613 669 """ 614 670 with_hostel_selection = True 671 672 class CustomStudentBaseEditFormPage(StudentBaseEditFormPage): 673 """ View to edit student base data 674 """ 675 form_fields = grok.AutoFields(ICustomStudentBase).select( 676 'email', 'phone') 677 form_fields['email'].field.required = True -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r15314 r15352 213 213 self.browser.open(self.student_path) 214 214 self.assertFalse('examination schedule slip' in self.browser.contents) 215 216 def test_jhl_idcard(self): 217 self.browser.open(self.login_path) 218 self.browser.getControl(name="form.login").value = self.student_id 219 self.browser.getControl(name="form.password").value = 'spwd' 220 self.browser.getControl("Login").click() 221 self.browser.getLink("Download JHL Id Card").click() 222 self.assertEqual(self.browser.headers['Status'], '200 Ok') 223 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 224 path = os.path.join(samples_dir(), 'jhl_idcard.pdf') 225 open(path, 'wb').write(self.browser.contents) 226 print "Sample PDF jhl_idcard.pdf written to %s" % path 215 227 216 228 def test_jupeb_result_slip(self): -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r14902 r15352 111 111 return False 112 112 113 class JHLIdCardActionButton(ManageActionButton): 114 grok.order(10) 115 grok.context(ICustomStudent) 116 grok.view(StudentBaseDisplayFormPage) 117 grok.require('waeup.viewStudent') 118 icon = 'actionicon_pdf.png' 119 text = _('Download JHL Id Card') 120 target = 'jhl_idcard.pdf' 121 122 @property 123 def target_url(self): 124 return self.view.url(self.view.context, self.target) 125 113 126 class JUPEBResultSlipActionButton(ManageActionButton): 114 127 grok.order(11)
Note: See TracChangeset for help on using the changeset viewer.