Changeset 15989 for main/waeup.fceokene/trunk/src/waeup/fceokene/students
- Timestamp:
- 5 Feb 2020, 22:34:10 (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
r15985 r15989 206 206 form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level') 207 207 208 class ExportPDFExaminationClearanceSlip(CustomExportPDFCourseRegistrationSlip): 209 """Deliver a PDF slip of the context. 210 """ 211 212 grok.name('examination_clearance_slip.pdf') 213 208 class ExportPDFExaminationClearanceSlip1(CustomExportPDFCourseRegistrationSlip): 209 """Deliver a PDF slip of the context. 210 """ 211 grok.name('examination_clearance_slip_1.pdf') 214 212 form_fields = None 215 216 213 omit_fields = ( 217 214 'password', 'suspended', 'phone', 'date_of_birth', … … 219 216 'adm_code', 'sex', 'suspended_comment', 220 217 'flash_notice') 221 222 @property 223 def label(self): 224 return '%s Examination Clearance' % self.context.level_session 218 semester = 1 219 tabletitle = ['', '', ''] 220 221 @property 222 def label(self): 223 return '%s First Semester Examination Clearance' % self.context.level_session 225 224 226 225 @property … … 234 233 self.redirect(self.url(self.context)) 235 234 236 @property237 def tabletitle(self):238 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE239 tabletitle = []240 tabletitle.append(translate(_('1st Semester Courses'), 'waeup.kofa',241 target_language=portal_language))242 tabletitle.append('_PB_' + translate(_('2nd Semester Courses'), 'waeup.kofa',243 target_language=portal_language))244 tabletitle.append(translate(_('Level Courses'), 'waeup.kofa',245 target_language=portal_language))246 return tabletitle247 248 235 def render(self): 249 236 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 250 237 Code = translate('Code', 'waeup.kofa', target_language=portal_language) 251 #Title = translate('Title', 'waeup.kofa', target_language=portal_language)252 #Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language)253 #Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language)254 #Cred = translate(_('Credits'), 'waeup.uniben', target_language=portal_language)255 #Grade = translate('Grade', 'waeup.kofa', target_language=portal_language)256 238 studentview = StudentBasePDFFormPage(self.context.student, 257 239 self.request, self.omit_fields) … … 262 244 for i in range(1,7): 263 245 tabledata.append(sorted( 264 [value for value in self.context.values() if value.semester == i],265 key=lambda value: str(value.semester) +value.code))246 [value for value in self.context.values() if i == self.semester == value.semester], 247 key=lambda value: value.code)) 266 248 tableheader.append([(Code,'code', 2.5), 267 #(Title,'title', 5), 268 #(Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 269 #(Cred, 'credits', 1.5), 270 ('Signature','sig', 10), 249 ('Invigilator\'s Name','inv', 8), 250 ('Signature','sig', 7), 271 251 ]) 272 252 return students_utils.renderPDF( 273 self, 'examination_clearance_slip .pdf',253 self, 'examination_clearance_slip_%s.pdf' % self.semester, 274 254 self.context.student, studentview, 275 255 tableheader=tableheader, 276 256 tabledata=tabledata, 277 257 omit_fields=self.omit_fields, 278 topMargin=1. 1258 topMargin=1.3 279 259 ) 280 260 261 class ExportPDFExaminationClearanceSlip2(ExportPDFExaminationClearanceSlip1): 262 """Deliver a PDF slip of the context. 263 """ 264 grok.name('examination_clearance_slip_2.pdf') 265 semester = 2 266 267 @property 268 def label(self): 269 return '%s Second Semester Examination Clearance' % self.context.level_session 281 270 282 271 class CustomPaymentsManageFormPage(PaymentsManageFormPage): -
main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py
r15977 r15989 455 455 IWorkflowState(self.student).setState('courses validated') 456 456 self.browser.open(self.student_path + '/studycourse/100') 457 self.browser.getLink("Download examination clearance slip").click()457 self.browser.getLink("Download 1st semester examination clearance slip").click() 458 458 self.assertEqual(self.browser.headers['Status'], '200 Ok') 459 459 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 460 path = os.path.join(samples_dir(), 'examination_clearance_slip .pdf')460 path = os.path.join(samples_dir(), 'examination_clearance_slip_1.pdf') 461 461 open(path, 'wb').write(self.browser.contents) 462 print "Sample PDF examination_clearance_slip.pdf written to %s" % path 462 print "Sample PDF examination_clearance_slip_1.pdf written to %s" % path 463 self.browser.open(self.student_path + '/studycourse/100') 464 self.browser.getLink("Download 2nd semester examination clearance slip").click() 465 self.assertEqual(self.browser.headers['Status'], '200 Ok') 466 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 467 path = os.path.join(samples_dir(), 'examination_clearance_slip_2.pdf') 468 open(path, 'wb').write(self.browser.contents) 469 print "Sample PDF examination_clearance_slip_2.pdf written to %s" % path -
main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py
r15981 r15989 51 51 grok.require('waeup.manageStudent') 52 52 53 class ExaminationClearanceSlipActionButton (ManageActionButton):53 class ExaminationClearanceSlipActionButton1(ManageActionButton): 54 54 grok.order(6) 55 55 grok.context(IStudentStudyLevel) … … 57 57 grok.require('waeup.viewStudent') 58 58 icon = 'actionicon_pdf.png' 59 text = 'Download examination clearance slip'60 target = 'examination_clearance_slip .pdf'59 text = 'Download 1st semester examination clearance slip' 60 target = 'examination_clearance_slip_1.pdf' 61 61 62 62 @property … … 69 69 return '' 70 70 return self.view.url(self.view.context, self.target) 71 72 class ExaminationClearanceSlipActionButton2(ExaminationClearanceSlipActionButton1): 73 grok.order(7) 74 text = 'Download 2nd semester examination clearance slip' 75 target = 'examination_clearance_slip_2.pdf'
Note: See TracChangeset for help on using the changeset viewer.