Changeset 13723 for main/waeup.uniben/trunk
- Timestamp:
- 23 Feb 2016, 17:36:46 (9 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
r13719 r13723 232 232 note=self.note) 233 233 234 class ExportExaminationScheduleSlip(UtilityView, grok.View): 235 """Deliver a examination schedule slip. 236 237 This form page is available only in Uniben. 238 """ 239 grok.context(ICustomStudent) 240 grok.name('examination_schedule_slip.pdf') 241 grok.require('waeup.viewStudent') 242 prefix = 'form' 243 244 label = u'Examination Schedule Slip' 245 246 omit_fields = ( 247 'suspended', 'phone', 'email', 248 'adm_code', 'suspended_comment', 249 'date_of_birth', 'current_level', 250 'current_mode', 251 'entry_session', 252 'flash_notice') 253 254 form_fields = [] 255 256 @property 257 def note(self): 258 return """ 259 <br /><br /><br /><br /><font size='12'> 260 Your examination date, time and venue is scheduled as follows: 261 <br /><br /> 262 <strong>%s</strong> 263 </font> 264 265 """ % self.context.flash_notice 266 return 267 268 269 def update(self): 270 if not self.context.flash_notice \ 271 or not 'exam' in self.context.flash_notice.lower(): 272 self.flash(_('Forbidden'), type="warning") 273 self.redirect(self.url(self.context)) 274 275 def render(self): 276 studentview = StudentBasePDFFormPage(self.context.student, 277 self.request, self.omit_fields) 278 students_utils = getUtility(IStudentsUtils) 279 return students_utils.renderPDF( 280 self, 'examination_schedule_slip', 281 self.context.student, studentview, 282 omit_fields=self.omit_fields, 283 note=self.note) 284 234 285 class CustomStudentPersonalDisplayFormPage( 235 286 NigeriaStudentPersonalDisplayFormPage): -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r13621 r13723 194 194 self.browser.open(self.student_path + '/edit_personal') 195 195 self.assertTrue('parent_email' in self.browser.contents) 196 197 def test_examination_schedule_slip(self): 198 self.student.flash_notice = u'My Examination Date' 199 self.browser.open(self.login_path) 200 self.browser.getControl(name="form.login").value = self.student_id 201 self.browser.getControl(name="form.password").value = 'spwd' 202 self.browser.getControl("Login").click() 203 self.browser.getLink("Download examination schedule slip").click() 204 self.assertEqual(self.browser.headers['Status'], '200 Ok') 205 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 206 path = os.path.join(samples_dir(), 'examination_schedule_slip.pdf') 207 open(path, 'wb').write(self.browser.contents) 208 print "Sample PDF examination_schedule_slip.pdf written to %s" % path 209 # If flash_notive does not contain exam' the button does not show up. 210 self.student.flash_notice = u'anything' 211 self.browser.open(self.student_path) 212 self.assertFalse('examination schedule slip' in self.browser.contents) 196 213 197 214 def test_manage_payments(self): … … 929 946 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] 930 947 self.browser.getControl("Create ticket").click() 931 ctrl = self.browser.getControl(name='val_id')932 value = ctrl.options[0]933 self.browser.getLink(value).click()934 948 p_ticket = self.student['payments'].values()[0] 935 949 p_ticket.approveStudentPayment() … … 1029 1043 self.assertMatches('...Payment ticket created...', 1030 1044 self.browser.contents) 1031 ctrl = self.browser.getControl(name='val_id')1032 value = ctrl.options[0]1033 1045 # Maintennace fee is taken from the hostel object. 1034 self.assertEqual(self.student['payments'] [value].amount_auth, 876.0)1046 self.assertEqual(self.student['payments'].values()[1].amount_auth, 876.0) 1035 1047 # If the hostel's maintenance fee isn't set, the fee is 1036 1048 # taken from the session configuration object. … … 1039 1051 self.browser.getControl(name="form.p_category").value = ['hostel_maintenance'] 1040 1052 self.browser.getControl("Create ticket").click() 1041 ctrl = self.browser.getControl(name='val_id') 1042 value = ctrl.options[1] 1043 self.assertEqual(self.student['payments'][value].amount_auth, 987.0) 1053 self.assertEqual(self.student['payments'].values()[2].amount_auth, 987.0) 1044 1054 return -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r13063 r13723 24 24 ICustomStudent, ) 25 25 from waeup.kofa.students.fileviewlets import ( 26 StudentFileDisplay, StudentFileUpload, StudentImage )26 StudentFileDisplay, StudentFileUpload, StudentImage,) 27 27 from waeup.kofa.students.browser import ( 28 28 ExportPDFClearanceSlip, StudyCourseDisplayFormPage, 29 StudyLevelDisplayFormPage, StudentClearanceDisplayFormPage) 29 StudyLevelDisplayFormPage, StudentClearanceDisplayFormPage, 30 StudentBaseDisplayFormPage) 30 31 31 32 from kofacustom.nigeria.interfaces import MessageFactory as _ … … 94 95 return False 95 96 97 class ExaminationScheduleSlipActionButton(ManageActionButton): 98 grok.order(10) 99 grok.context(ICustomStudent) 100 grok.view(StudentBaseDisplayFormPage) 101 grok.require('waeup.viewStudent') 102 icon = 'actionicon_pdf.png' 103 text = _('Download examination schedule slip') 104 target = 'examination_schedule_slip.pdf' 105 106 @property 107 def target_url(self): 108 if self.context.flash_notice \ 109 and 'exam' in self.context.flash_notice.lower(): 110 return self.view.url(self.view.context, self.target) 111 return False 96 112 97 113 # JAMB Letter
Note: See TracChangeset for help on using the changeset viewer.