- Timestamp:
- 22 Aug 2023, 13:47:07 (16 months ago)
- Location:
- main/kofacustom.unidel/trunk/src/kofacustom/unidel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/applicants/utils.py
r17506 r17554 41 41 'de': ['Direct Entry Programmes', 'DEP'], 42 42 'df': ['Digital Forensic for Professionals and Academia', 'DF'], 43 'law': ['Certificate in Law Programme', 'CL'], 43 44 } -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
r17325 r17554 26 26 from waeup.kofa.browser.layout import KofaEditFormPage 27 27 from waeup.kofa.browser.layout import action, jsaction 28 from waeup.kofa.students.workflow import (CREATED, ADMITTED, PAID, 29 CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED, 30 GRADUATED, TRANSREQ, TRANSVAL, TRANSREL, FORBIDDEN_POSTGRAD_TRANS) 28 31 from waeup.kofa.students.browser import ( 29 32 StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudyLevelManageFormPage, … … 31 34 CourseTicketDisplayFormPage, CourseTicketManageFormPage, 32 35 StudentTriggerTransitionFormPage, 36 ExportPDFAdmissionSlip, 33 37 PaymentsManageFormPage, msave, emit_lock_message) 34 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket 38 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket, IStudentBase 35 39 from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS 36 40 from kofacustom.nigeria.students.browser import ( … … 46 50 ) 47 51 from kofacustom.unidel.students.interfaces import ( 52 ICustomStudent, 48 53 ICustomStudentOnlinePayment, 49 54 ICustomStudentStudyCourse, … … 228 233 form_fields['carry_over'].for_display = True 229 234 form_fields['ticket_session'].for_display = True 235 236 237 class ExaminationClearanceSlip(NigeriaExportPDFClearanceSlip): 238 """Deliver a PDF slip of the context. 239 """ 240 241 grok.name('examclearance_slip.pdf') 242 omit_fields = ( 243 'suspended', 244 #'phone', 245 'email', 246 'adm_code', 'suspended_comment', 247 'date_of_birth', 248 #'current_level', 249 'current_mode', 250 'entry_session', 251 'flash_notice', 252 'parents_email', 253 'certificate', 254 'faculty', 255 'department', 256 'reg_number') 257 form_fields = None 258 259 note = ''' 260 You have been cleared to write second semester examination. 261 ''' 262 263 def update(self): 264 if not self.context.state in (VALIDATED, REGISTERED): 265 self.flash(_('Your course list has not yet been registered.'), 266 type="warning") 267 self.redirect(self.url(self.context)) 268 return 269 270 @property 271 def label(self): 272 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 273 return translate(_('Examination Clearance Slip of'), 274 'waeup.kofa', target_language=portal_language) \ 275 + ' %s' % self.context.display_fullname 276 277 def _sigsInFooter(self): 278 #isStudent = getattr( 279 # self.request.principal, 'user_type', None) == 'student' 280 #if not isStudent and self.context.state in (CLEARED, RETURNING): 281 282 return (_('Date, DICT Signature'), 283 _('Date, Dean\'s Signature'), 284 ) 285 def render(self): 286 studentview = StudentBasePDFFormPage(self.context.student, 287 self.request, self.omit_fields) 288 students_utils = getUtility(IStudentsUtils) 289 return students_utils.renderPDF( 290 self, 'examclearance_slip.pdf', 291 self.context.student, studentview, signatures=None, 292 sigs_in_footer=self._sigsInFooter(), show_scans=False, 293 omit_fields=self.omit_fields, 294 note=self.note) 295 -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py
r16721 r17554 33 33 from waeup.kofa.interfaces import ( 34 34 IExtFileStore, IFileStoreNameChooser) 35 from waeup.kofa.browser.tests.test_pdf import samples_dir 35 36 from waeup.kofa.students.interfaces import IStudentsUtils 36 37 from kofacustom.unidel.testing import FunctionalLayer … … 42 43 layer = FunctionalLayer 43 44 44 def test_dummytest(self): 45 return 45 def test_student_examclearance_slip(self): 46 self.certificate.study_mode = 'ug_ft' 47 # Student cant login if their password is not set 48 IWorkflowState(self.student).setState('courses registered') 49 self.browser.open(self.login_path) 50 self.browser.getControl(name="form.login").value = self.student_id 51 self.browser.getControl(name="form.password").value = 'spwd' 52 self.browser.getControl("Login").click() 53 self.assertMatches( 54 '...You logged in...', self.browser.contents) 55 self.browser.getLink("Base Data").click() 56 self.browser.getLink("Download examination clearance slip").click() 57 self.assertEqual(self.browser.headers['Status'], '200 Ok') 58 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 59 path = os.path.join(samples_dir(), 'examclearance_slip.pdf') 60 open(path, 'wb').write(self.browser.contents) 61 print "Sample exampclearance_slip.pdf written to %s" % path -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/viewlets.py
r16721 r17554 20 20 from waeup.kofa.interfaces import REQUESTED 21 21 from waeup.kofa.browser.viewlets import ManageActionButton 22 from kofacustom.unidel.students.interfaces import ( 22 from kofacustom.unidel.students.interfaces import (ICustomStudent, 23 23 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 24 24 from waeup.kofa.students.fileviewlets import ( 25 25 StudentFileDisplay, StudentFileUpload, StudentImage) 26 from waeup.kofa.students.browser import ( 26 from waeup.kofa.students.browser import (StudentBaseDisplayFormPage, 27 27 ExportPDFClearanceSlip, StudyCourseDisplayFormPage, 28 28 StudyLevelDisplayFormPage) 29 29 30 30 from kofacustom.nigeria.interfaces import MessageFactory as _ 31 32 class ExamClearanceSlipActionButton(ManageActionButton): 33 grok.order(10) 34 grok.context(ICustomStudent) 35 grok.view(StudentBaseDisplayFormPage) 36 grok.require('waeup.viewStudent') 37 text = _('Download examination clearance slip') 38 target = 'examclearance_slip.pdf' 39 icon = 'actionicon_pdf.png' 40 41 @property 42 def target_url(self): 43 #if not self.context.state in : 44 # return '' 45 return self.view.url(self.view.context, self.target) -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/utils/utils.py
r17506 r17554 81 81 'ug_pt': 'Undergraduate Part-Time Programmes', 82 82 'df': 'Digital Forensic for Professionals and Academia', 83 'law': 'Certificate in Law Programme', 83 84 } 84 85
Note: See TracChangeset for help on using the changeset viewer.