Changeset 9848 for main/waeup.uniben/trunk/src/waeup
- Timestamp:
- 9 Jan 2013, 09:33:01 (12 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
r9831 r9848 94 94 # return _('No second sitting result uploaded.') 95 95 if not store.getFileByContext(self.context, attr=u'secr_cults.jpg'): 96 return _('No affidavit of non-me nbership of secret cults uploaded.')96 return _('No affidavit of non-membership of secret cults uploaded.') 97 97 return False 98 98 … … 112 112 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 113 113 114 115 ## In case we need to deactivate clearance116 #class CustomStudentClearPage(StudentClearPage):117 # """ Clear student by clearance officer118 # """119 # def update(self):120 # self.flash('Clearance temporarily disabled!')121 # self.redirect(self.url(self.context,'view_clearance'))122 # return123 124 #class CustomStudentRejectClearancePage(StudentRejectClearancePage):125 # """ Reject clearance by clearance officers126 # """127 128 # def update(self):129 # self.flash('Clearance temporarily disabled!')130 # self.redirect(self.url(self.context,'view_clearance'))131 # return132 114 133 115 class CustomExportPDFClearanceSlipPage(NigeriaExportPDFClearanceSlipPage): … … 217 199 def render(self): 218 200 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 219 Sem = translate(_('Sem.'), 'waeup.kofa', target_language=portal_language) 220 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 221 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 222 Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language) 223 Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language) 224 Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language) 225 Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language) 226 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 201 Sem = translate('Sem.', 'waeup.kofa', target_language=portal_language) 202 Code = translate('Code', 'waeup.kofa', target_language=portal_language) 203 Title = translate('Title', 'waeup.kofa', target_language=portal_language) 204 Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language) 205 Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language) 206 Cred = translate('Cred.', 'waeup.kofa', target_language=portal_language) 207 Mand = translate('Requ.', 'waeup.kofa', target_language=portal_language) 208 studentview = StudentBasePDFFormPage(self.context.student, 209 self.request, self.omit_fields) 210 students_utils = getUtility(IStudentsUtils) 211 tabledata = sorted(self.context.values(), 212 key=lambda value: str(value.semester) + value.code) 213 return students_utils.renderPDF( 214 self, 'course_registration_slip.pdf', 215 self.context.student, studentview, 216 tableheader=[(Sem,'semester', 1.5),(Code,'code', 2.5), 217 (Title,'title', 5), 218 (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 219 (Cred, 'credits', 1.5), 220 (Mand, 'mandatory', 1.5), 221 ], 222 tabledata=tabledata) 223 224 class UnibenExportPDFCourseResultSlipPage(ExportPDFCourseRegistrationSlipPage): 225 """Deliver a PDF slip of the context. 226 """ 227 228 grok.name('course_result_slip.pdf') 229 230 @property 231 def label(self): 232 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 233 lang = self.request.cookies.get('kofa.language', portal_language) 234 level_title = translate(self.context.level_title, 'waeup.kofa', 235 target_language=lang) 236 return translate(_('Course Result Slip'), 237 'waeup.uniben', target_language=portal_language) \ 238 + ' %s' % level_title 239 240 def render(self): 241 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 242 Sem = translate('Sem.', 'waeup.kofa', target_language=portal_language) 243 Code = translate('Code', 'waeup.kofa', target_language=portal_language) 244 Title = translate('Title', 'waeup.kofa', target_language=portal_language) 245 Dept = translate('Dept.', 'waeup.kofa', target_language=portal_language) 246 Faculty = translate('Faculty', 'waeup.kofa', target_language=portal_language) 247 Cred = translate('Cred.', 'waeup.kofa', target_language=portal_language) 248 Mand = translate('Requ.', 'waeup.kofa', target_language=portal_language) 249 Grade = translate('Grade', 'waeup.kofa', target_language=portal_language) 227 250 studentview = StudentBasePDFFormPage(self.context.student, 228 251 self.request, self.omit_fields) -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r9831 r9848 191 191 #self.browser.getControl("Save and request clearance").click() 192 192 193 self.assertTrue('No affidavit of non-me nbership of secret cults uploaded'193 self.assertTrue('No affidavit of non-membership of secret cults uploaded' 194 194 in self.browser.contents) 195 195 secr_cults = 'My non-membership scan' … … 362 362 self.browser.open(self.student_path + '/studycourse/100') 363 363 self.browser.getLink("Download course registration slip").click() 364 self.assertEqual(self.browser.headers['Status'], '200 Ok') 365 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 366 # Students can open the special Uniben pdf course result slip 367 self.browser.open(self.student_path + '/studycourse/100') 368 self.browser.getLink("Download course result slip").click() 364 369 self.assertEqual(self.browser.headers['Status'], '200 Ok') 365 370 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r9439 r9848 20 20 from waeup.kofa.interfaces import REQUESTED 21 21 from waeup.kofa.browser.viewlets import ManageActionButton 22 from waeup.uniben.students.interfaces import ICustomStudentStudyCourse 22 from waeup.uniben.students.interfaces import ( 23 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 23 24 from waeup.kofa.students.viewlets import ( 24 25 FileDisplay, FileUpload, Image) 25 26 from waeup.kofa.students.browser import ( 26 ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage) 27 ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage, 28 StudyLevelDisplayFormPage) 27 29 28 30 from kofacustom.nigeria.interfaces import MessageFactory as _ … … 41 43 return self.view.url(self.view.context, self.target) 42 44 return False 45 46 class CourseResultSlipActionButton(ManageActionButton): 47 grok.order(6) 48 grok.context(ICustomStudentStudyLevel) 49 grok.view(StudyLevelDisplayFormPage) 50 grok.require('waeup.viewStudent') 51 icon = 'actionicon_pdf.png' 52 text = _('Download course result slip') 53 target = 'course_result_slip.pdf' 54 55 @property 56 def target_url(self): 57 is_current = self.context.__parent__.is_current 58 if not is_current: 59 return '' 60 return self.view.url(self.view.context, self.target) 43 61 44 62 # JAMB Letter
Note: See TracChangeset for help on using the changeset viewer.