- Timestamp:
- 3 Dec 2014, 05:14:41 (10 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
r11552 r12121 24 24 REQUESTED, IExtFileStore, IKofaUtils, IObjectHistory) 25 25 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 26 from waeup.kofa.browser.layout import action, KofaEditFormPage 26 from waeup.kofa.browser.layout import action, KofaEditFormPage, UtilityView 27 27 from waeup.kofa.students.browser import ( 28 28 StudyLevelEditFormPage, StudyLevelDisplayFormPage, … … 43 43 44 44 from waeup.uniben.students.interfaces import ( 45 ICustomStudent, 45 46 ICustomStudentOnlinePayment, ICustomStudentStudyCourse, 46 47 ICustomStudentStudyLevel, … … 125 126 sigs_in_footer=self._sigsInFooter(), show_scans=False, 126 127 omit_fields=self.omit_fields) 128 129 130 class ExportClearanceInvitationSlipPage(UtilityView, grok.View): 131 """Deliver an invitation letter to physical clearance. 132 133 This form page is available only in Uniben. 134 """ 135 grok.context(ICustomStudent) 136 grok.name('clearance_invitation_slip.pdf') 137 grok.require('waeup.viewStudent') 138 prefix = 'form' 139 140 label = u'Invitation Letter to Physical Clearance' 141 142 omit_fields = ( 143 'suspended', 'phone', 'email', 144 'adm_code', 'suspended_comment', 145 'date_of_birth', 'current_level', 146 'faculty', 'department', 'current_mode', 147 'entry_session', 'matric_number', 'sex') 148 149 form_fields = [] 150 151 @property 152 def note(self): 153 if self.context.physical_clearance_date: 154 return """ 155 <br /><br /><br /><br /><font size="12"> 156 You are kindly invited to physical clearance on %s 157 158 <br /><br /> 159 Clearance Officer<br /> 160 </font> 161 162 """ % self.context.physical_clearance_date 163 return 164 165 def render(self): 166 studentview = StudentBasePDFFormPage(self.context.student, 167 self.request, self.omit_fields) 168 students_utils = getUtility(IStudentsUtils) 169 return students_utils.renderPDF( 170 self, 'clearance_invitation_slip', 171 self.context.student, studentview, 172 omit_fields=self.omit_fields, 173 note=self.note) 127 174 128 175 class StudyCourseCOEditFormPage(KofaEditFormPage): -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r11773 r12121 31 31 from waeup.kofa.students.accommodation import BedTicket 32 32 from waeup.kofa.testing import FunctionalTestCase 33 from waeup.kofa.browser.tests.test_pdf import samples_dir 33 34 from waeup.kofa.interfaces import ( 34 35 IExtFileStore, IFileStoreNameChooser) … … 175 176 self.assertTrue('Clearance has been requested' 176 177 in self.browser.contents) 178 # Student can export physical_clearance.slip 179 self.app['configuration'].name = u'University of Benin' 180 self.student.physical_clearance_date = u'January 5th, 2015' 181 self.browser.getLink("Clearance Data").click() 182 self.browser.getLink("Download clearance invitation slip").click() 183 self.assertEqual(self.browser.headers['Status'], '200 Ok') 184 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 185 path = os.path.join(samples_dir(), 'clearance_invitation_slip.pdf') 186 open(path, 'wb').write(self.browser.contents) 187 print "Sample PDF clearance_invitation_slip.pdf written to %s" % path 177 188 178 189 def test_manage_payments(self): -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r11613 r12121 21 21 from waeup.kofa.browser.viewlets import ManageActionButton 22 22 from waeup.uniben.students.interfaces import ( 23 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 23 ICustomStudentStudyCourse, ICustomStudentStudyLevel, 24 ICustomStudent, ) 24 25 from waeup.kofa.students.viewlets import ( 25 26 FileDisplay, FileUpload, Image) 26 27 from waeup.kofa.students.browser import ( 27 28 ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage, 28 StudyLevelDisplayFormPage )29 StudyLevelDisplayFormPage, StudentClearanceDisplayFormPage) 29 30 30 31 from kofacustom.nigeria.interfaces import MessageFactory as _ … … 56 57 def target_url(self): 57 58 return self.view.url(self.view.context, self.target) 59 60 61 class ClearanceInvitationSlipActionButton(ManageActionButton): 62 grok.order(5) 63 grok.context(ICustomStudent) 64 grok.view(StudentClearanceDisplayFormPage) 65 grok.require('waeup.viewStudent') 66 icon = 'actionicon_pdf.png' 67 text = _('Download clearance invitation slip') 68 target = 'clearance_invitation_slip.pdf' 69 58 70 59 71 # JAMB Letter
Note: See TracChangeset for help on using the changeset viewer.