Changeset 15977 for main/waeup.fceokene/trunk/src
- Timestamp:
- 3 Feb 2020, 14:54:07 (5 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py
r15961 r15977 22 22 from zope.security import checkPermission 23 23 from hurry.workflow.interfaces import IWorkflowInfo 24 from waeup.kofa.interfaces import ADMITTED, IKofaUtils24 from waeup.kofa.interfaces import ADMITTED, VALIDATED, IKofaUtils 25 25 from waeup.kofa.interfaces import MessageFactory as _ 26 26 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget … … 30 30 ExportPDFAdmissionSlip, StudyLevelDisplayFormPage, 31 31 PaymentsManageFormPage, 32 OnlinePaymentApproveView) 32 OnlinePaymentApproveView, 33 StudentBasePDFFormPage) 33 34 from kofacustom.nigeria.students.browser import ( 34 35 NigeriaOnlinePaymentDisplayFormPage, … … 205 206 form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level') 206 207 208 class ExportPDFExaminationClearanceSlip(CustomExportPDFCourseRegistrationSlip): 209 """Deliver a PDF slip of the context. 210 """ 211 212 grok.name('examination_clearance_slip.pdf') 213 214 form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit( 215 'gpa', 'transcript_remark', 'total_credits', 'level_verdict') 216 217 @property 218 def label(self): 219 return 'Year %s Examination Clearance' % self.context.level_session 220 221 def update(self): 222 if self.context.student.state != VALIDATED \ 223 or self.context.student.current_level != self.context.level: 224 self.flash(_('Forbidden'), type="warning") 225 self.redirect(self.url(self.context)) 226 227 def render(self): 228 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 229 Code = translate('Code', 'waeup.kofa', target_language=portal_language) 230 Title = translate('Title', 'waeup.kofa', target_language=portal_language) 231 Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language) 232 Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language) 233 Cred = translate(_('Credits'), 'waeup.uniben', target_language=portal_language) 234 Grade = translate('Grade', 'waeup.kofa', target_language=portal_language) 235 studentview = StudentBasePDFFormPage(self.context.student, 236 self.request, self.omit_fields) 237 students_utils = getUtility(IStudentsUtils) 238 239 tabledata = [] 240 tableheader = [] 241 for i in range(1,7): 242 tabledata.append(sorted( 243 [value for value in self.context.values() if value.semester == i], 244 key=lambda value: str(value.semester) + value.code)) 245 tableheader.append([(Code,'code', 2.5), 246 (Title,'title', 5), 247 (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 248 (Cred, 'credits', 1.5), 249 ]) 250 return students_utils.renderPDF( 251 self, 'examination_clearance_slip.pdf', 252 self.context.student, studentview, 253 tableheader=tableheader, 254 tabledata=tabledata, 255 omit_fields=self.omit_fields 256 ) 257 258 207 259 class CustomPaymentsManageFormPage(PaymentsManageFormPage): 208 260 """ Page to manage the student payments. This manage form page is for -
main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py
r15887 r15977 442 442 self.browser.contents) 443 443 self.browser.getControl("Create course list now").click() 444 # Students can 'topen the customized pdf course registration slip444 # Students can open the customized pdf course registration slip 445 445 self.browser.open( 446 446 self.student_path + '/studycourse/100/course_registration_slip.pdf') … … 450 450 open(path, 'wb').write(self.browser.contents) 451 451 print "Sample PDF course_registration_slip.pdf written to %s" % path 452 453 # Students can open the examination clearance slip if they are 454 # in state courses validated 455 IWorkflowState(self.student).setState('courses validated') 456 self.browser.open(self.student_path + '/studycourse/100') 457 self.browser.getLink("Download examination clearance slip").click() 458 self.assertEqual(self.browser.headers['Status'], '200 Ok') 459 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 460 path = os.path.join(samples_dir(), 'examination_clearance_slip.pdf') 461 open(path, 'wb').write(self.browser.contents) 462 print "Sample PDF examination_clearance_slip.pdf written to %s" % path -
main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py
r15940 r15977 18 18 19 19 import grok 20 from waeup.kofa.browser.viewlets import ManageActionButton 20 21 from waeup.kofa.students.viewlets import ( 21 22 AdmissionSlipActionButton, 22 23 AddPreviousPaymentActionButton, AddBalancePaymentActionButton, 23 24 ApprovePaymentActionButton) 24 from waeup.kofa.students.workflow import ADMITTED 25 from waeup.kofa.students.interfaces import IStudentStudyLevel 26 from waeup.kofa.students.browser import StudyLevelDisplayFormPage 27 from waeup.kofa.students.workflow import ADMITTED, VALIDATED 25 28 26 29 class AdmissionSlipActionButton(AdmissionSlipActionButton): … … 47 50 48 51 grok.require('waeup.manageStudent') 52 53 class CourseRegistrationSlipActionButton(ManageActionButton): 54 grok.order(6) 55 grok.context(IStudentStudyLevel) 56 grok.view(StudyLevelDisplayFormPage) 57 grok.require('waeup.viewStudent') 58 icon = 'actionicon_pdf.png' 59 text = 'Download examination clearance slip' 60 target = 'examination_clearance_slip.pdf' 61 62 @property 63 def target_url(self): 64 is_current = self.context.__parent__.is_current 65 if not is_current: 66 return '' 67 if self.context.student.state != VALIDATED \ 68 or self.context.student.current_level != self.context.level: 69 return '' 70 return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.