| 1 | ## $Id: browser.py 18261 2026-04-29 08:50:36Z henrik $ |
|---|
| 2 | ## |
|---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
|---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
|---|
| 5 | ## it under the terms of the GNU General Public License as published by |
|---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | ## (at your option) any later version. |
|---|
| 8 | ## |
|---|
| 9 | ## This program is distributed in the hope that it will be useful, |
|---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | ## GNU General Public License for more details. |
|---|
| 13 | ## |
|---|
| 14 | ## You should have received a copy of the GNU General Public License |
|---|
| 15 | ## along with this program; if not, write to the Free Software |
|---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 17 | ## |
|---|
| 18 | import grok |
|---|
| 19 | import os |
|---|
| 20 | from zope.i18n import translate |
|---|
| 21 | from zope.component import getUtility |
|---|
| 22 | from zope.security import checkPermission |
|---|
| 23 | from hurry.workflow.interfaces import IWorkflowInfo |
|---|
| 24 | from waeup.kofa.interfaces import ADMITTED, VALIDATED, IKofaUtils |
|---|
| 25 | from waeup.kofa.interfaces import MessageFactory as _ |
|---|
| 26 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
|---|
| 27 | from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket |
|---|
| 28 | from waeup.kofa.students.browser import ( |
|---|
| 29 | StartClearancePage, |
|---|
| 30 | ExportPDFAdmissionSlip, |
|---|
| 31 | PaymentsManageFormPage, |
|---|
| 32 | OnlinePaymentApproveView, |
|---|
| 33 | CourseTicketDisplayFormPage, |
|---|
| 34 | CourseTicketManageFormPage, |
|---|
| 35 | StudentBasePDFFormPage, |
|---|
| 36 | StudyLevelDisplayFormPage, |
|---|
| 37 | StudyLevelManageFormPage, |
|---|
| 38 | StudyLevelEditFormPage) |
|---|
| 39 | from kofacustom.nigeria.students.browser import ( |
|---|
| 40 | NigeriaOnlinePaymentDisplayFormPage, |
|---|
| 41 | NigeriaOnlinePaymentAddFormPage, |
|---|
| 42 | NigeriaExportPDFPaymentSlip, |
|---|
| 43 | NigeriaStudentClearanceDisplayFormPage, |
|---|
| 44 | NigeriaStudentClearanceEditFormPage, |
|---|
| 45 | NigeriaStudentClearanceManageFormPage, |
|---|
| 46 | NigeriaExportPDFClearanceSlip, |
|---|
| 47 | NigeriaExportPDFCourseRegistrationSlip, |
|---|
| 48 | NigeriaBedTicketAddPage, |
|---|
| 49 | NigeriaAccommodationManageFormPage, |
|---|
| 50 | NigeriaAccommodationDisplayFormPage, |
|---|
| 51 | ) |
|---|
| 52 | |
|---|
| 53 | from waeup.fceokene.students.interfaces import ( |
|---|
| 54 | ICustomStudentOnlinePayment, |
|---|
| 55 | ICustomUGStudentClearance, |
|---|
| 56 | ICustomPGStudentClearance, |
|---|
| 57 | ICustomStudentStudyLevel) |
|---|
| 58 | |
|---|
| 59 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
|---|
| 60 | """Deliver a PDF Admission slip. |
|---|
| 61 | """ |
|---|
| 62 | |
|---|
| 63 | @property |
|---|
| 64 | def label(self): |
|---|
| 65 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 66 | line0 = '' |
|---|
| 67 | if self.context.student.current_mode.startswith('ug') and self.context.student.faccode != 'SUP': |
|---|
| 68 | line0 = 'IN AFFILIATION WITH UNIVERSITY OF IBADAN\n' |
|---|
| 69 | line1 = translate(_('Admission Letter of'), |
|---|
| 70 | 'waeup.kofa', target_language=portal_language) \ |
|---|
| 71 | + ' %s' % self.context.display_fullname |
|---|
| 72 | return '%s%s' % (line0, line1) |
|---|
| 73 | |
|---|
| 74 | @property |
|---|
| 75 | def _post_text(self): |
|---|
| 76 | return """You should note the following as conditions for admission: |
|---|
| 77 | |
|---|
| 78 | 1. At the point of registration, you will be required to present the originals of your |
|---|
| 79 | certificate(s), Jamb Original Result, a Birth Certificate or a Declaration of |
|---|
| 80 | Age Certificate and Evidence of Citizenship Certificate. |
|---|
| 81 | |
|---|
| 82 | 2. Please note that the name by which you are hereby admitted and by which you will |
|---|
| 83 | be registered is the one which will appear on any certificate that the |
|---|
| 84 | Federal College of Education, Okene may issue to you on successful completion of |
|---|
| 85 | your programme except there was a change of name by sworn affidavit or |
|---|
| 86 | marriage certificate in addition to newspaper publication. |
|---|
| 87 | |
|---|
| 88 | 3. You are hereby informed that all fees must be paid at the beginning of the |
|---|
| 89 | academic session. The current school fees can be obtained from the College website. |
|---|
| 90 | |
|---|
| 91 | 4. You will present at the time of registration the Medical Certificate of Fitness |
|---|
| 92 | from the Federal College of Education, Okene Medical Centre. |
|---|
| 93 | |
|---|
| 94 | 5. Students shall be given accommodations on first come, first serve basis. |
|---|
| 95 | |
|---|
| 96 | 6. The offer is not transferable to another session. |
|---|
| 97 | |
|---|
| 98 | 7. You will sign a declaration of good conduct except by deferment on your |
|---|
| 99 | arrival at the College. |
|---|
| 100 | |
|---|
| 101 | Accept my congratulations. Yours faithfully |
|---|
| 102 | |
|---|
| 103 | Ajoge E, A |
|---|
| 104 | Deputy Registrar (Admissions) |
|---|
| 105 | For: Registrar |
|---|
| 106 | """ |
|---|
| 107 | |
|---|
| 108 | def render(self): |
|---|
| 109 | students_utils = getUtility(IStudentsUtils) |
|---|
| 110 | letterhead_path = os.path.join( |
|---|
| 111 | os.path.dirname(__file__), 'static', 'letterhead_admission.jpg') |
|---|
| 112 | topMargin=1.8 |
|---|
| 113 | if self.context.student.current_mode.startswith('ug') and self.context.student.faccode != 'SUP': |
|---|
| 114 | letterhead_path = None |
|---|
| 115 | topMargin=1.3 |
|---|
| 116 | return students_utils.renderPDFAdmissionLetter(self, |
|---|
| 117 | self.context.student, omit_fields=self.omit_fields, |
|---|
| 118 | letterhead_path=letterhead_path, |
|---|
| 119 | topMargin=topMargin, |
|---|
| 120 | post_text=self._post_text) |
|---|
| 121 | |
|---|
| 122 | class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): |
|---|
| 123 | """ Page to view an online payment ticket |
|---|
| 124 | """ |
|---|
| 125 | grok.context(ICustomStudentOnlinePayment) |
|---|
| 126 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
|---|
| 127 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item', 'p_combi') |
|---|
| 128 | form_fields[ |
|---|
| 129 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 130 | form_fields[ |
|---|
| 131 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 132 | |
|---|
| 133 | class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage): |
|---|
| 134 | """ Page to add an online payment ticket |
|---|
| 135 | """ |
|---|
| 136 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select( |
|---|
| 137 | 'p_combi') |
|---|
| 138 | |
|---|
| 139 | class OnlinePaymentApproveView(OnlinePaymentApproveView): |
|---|
| 140 | grok.require('waeup.manageStudent') |
|---|
| 141 | |
|---|
| 142 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
|---|
| 143 | """Deliver a PDF slip of the context. |
|---|
| 144 | """ |
|---|
| 145 | grok.context(ICustomStudentOnlinePayment) |
|---|
| 146 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
|---|
| 147 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item', 'p_combi') |
|---|
| 148 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 149 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 150 | |
|---|
| 151 | class CustomStartClearancePage(StartClearancePage): |
|---|
| 152 | |
|---|
| 153 | @property |
|---|
| 154 | def with_ac(self): |
|---|
| 155 | mode = getattr(self.context, 'current_mode', None) |
|---|
| 156 | if mode and mode.startswith('ug'): |
|---|
| 157 | return True |
|---|
| 158 | return False |
|---|
| 159 | |
|---|
| 160 | class CustomStudentClearanceDisplayFormPage(NigeriaStudentClearanceDisplayFormPage): |
|---|
| 161 | """ Page to display student clearance data |
|---|
| 162 | """ |
|---|
| 163 | |
|---|
| 164 | @property |
|---|
| 165 | def form_fields(self): |
|---|
| 166 | if self.context.is_postgrad: |
|---|
| 167 | form_fields = grok.AutoFields( |
|---|
| 168 | ICustomPGStudentClearance).omit('clearance_locked') |
|---|
| 169 | else: |
|---|
| 170 | form_fields = grok.AutoFields( |
|---|
| 171 | ICustomUGStudentClearance).omit('clearance_locked') |
|---|
| 172 | if not getattr(self.context, 'officer_comment'): |
|---|
| 173 | form_fields = form_fields.omit('officer_comment') |
|---|
| 174 | else: |
|---|
| 175 | form_fields['officer_comment'].custom_widget = BytesDisplayWidget |
|---|
| 176 | return form_fields |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | class CustomStudentClearanceManageFormPage(NigeriaStudentClearanceManageFormPage): |
|---|
| 180 | """ Page to edit student clearance data |
|---|
| 181 | """ |
|---|
| 182 | |
|---|
| 183 | @property |
|---|
| 184 | def form_fields(self): |
|---|
| 185 | if self.context.is_postgrad: |
|---|
| 186 | form_fields = grok.AutoFields( |
|---|
| 187 | ICustomPGStudentClearance).omit('clr_code') |
|---|
| 188 | else: |
|---|
| 189 | form_fields = grok.AutoFields( |
|---|
| 190 | ICustomUGStudentClearance).omit('clr_code') |
|---|
| 191 | return form_fields |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip): |
|---|
| 195 | """Deliver a PDF slip of the context. |
|---|
| 196 | """ |
|---|
| 197 | |
|---|
| 198 | @property |
|---|
| 199 | def form_fields(self): |
|---|
| 200 | if self.context.is_postgrad: |
|---|
| 201 | form_fields = grok.AutoFields( |
|---|
| 202 | ICustomPGStudentClearance).omit('clearance_locked') |
|---|
| 203 | else: |
|---|
| 204 | form_fields = grok.AutoFields( |
|---|
| 205 | ICustomUGStudentClearance).omit('clearance_locked') |
|---|
| 206 | if not getattr(self.context, 'officer_comment'): |
|---|
| 207 | form_fields = form_fields.omit('officer_comment') |
|---|
| 208 | return form_fields |
|---|
| 209 | |
|---|
| 210 | @property |
|---|
| 211 | def label(self): |
|---|
| 212 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 213 | |
|---|
| 214 | line0 = '' |
|---|
| 215 | if self.context.student.current_mode.startswith('ug'): |
|---|
| 216 | line0 = 'Directorate of Undergraduate Programme\n' |
|---|
| 217 | line1 = translate(_('Clearance Slip of'), |
|---|
| 218 | 'waeup.kofa', target_language=portal_language) \ |
|---|
| 219 | + ' %s' % self.context.display_fullname |
|---|
| 220 | return '%s%s' % (line0, line1) |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage): |
|---|
| 224 | """ View to edit student clearance data by student |
|---|
| 225 | """ |
|---|
| 226 | |
|---|
| 227 | def dataNotComplete(self): |
|---|
| 228 | return False |
|---|
| 229 | |
|---|
| 230 | @property |
|---|
| 231 | def form_fields(self): |
|---|
| 232 | if self.context.is_postgrad: |
|---|
| 233 | form_fields = grok.AutoFields(ICustomPGStudentClearance).omit( |
|---|
| 234 | 'clearance_locked', 'nysc_location', 'clr_code', 'officer_comment', |
|---|
| 235 | 'physical_clearance_date') |
|---|
| 236 | else: |
|---|
| 237 | form_fields = grok.AutoFields(ICustomUGStudentClearance).omit( |
|---|
| 238 | 'clearance_locked', 'clr_code', 'officer_comment', |
|---|
| 239 | 'physical_clearance_date') |
|---|
| 240 | return form_fields |
|---|
| 241 | |
|---|
| 242 | class CustomBedTicketAddPage(NigeriaBedTicketAddPage): |
|---|
| 243 | """ Page to add an online payment ticket |
|---|
| 244 | """ |
|---|
| 245 | buttonname = _('Create bed ticket') |
|---|
| 246 | notice = '' |
|---|
| 247 | with_ac = False |
|---|
| 248 | with_bedselection = True |
|---|
| 249 | |
|---|
| 250 | class CustomExportPDFCourseRegistrationSlip( |
|---|
| 251 | NigeriaExportPDFCourseRegistrationSlip): |
|---|
| 252 | """Deliver a PDF slip of the context. |
|---|
| 253 | """ |
|---|
| 254 | grok.context(ICustomStudentStudyLevel) |
|---|
| 255 | form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit( |
|---|
| 256 | 'level', 'level_verdict', 'validated_by', 'transcript_remark', 'gpa') |
|---|
| 257 | form_fields[ |
|---|
| 258 | 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 259 | omit_fields = ('password', 'suspended', 'suspended_comment', |
|---|
| 260 | 'phone', 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level', |
|---|
| 261 | 'flash_notice', 'parents_email', 'entry_session', 'password_updated') |
|---|
| 262 | |
|---|
| 263 | def render(self): |
|---|
| 264 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 265 | Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) |
|---|
| 266 | Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) |
|---|
| 267 | Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 268 | Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language) |
|---|
| 269 | Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 270 | #Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 271 | Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) |
|---|
| 272 | Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) |
|---|
| 273 | CC = translate(_('Cat.'), target_language=portal_language) |
|---|
| 274 | studentview = StudentBasePDFFormPage(self.context.student, |
|---|
| 275 | self.request, self.omit_fields) |
|---|
| 276 | students_utils = getUtility(IStudentsUtils) |
|---|
| 277 | |
|---|
| 278 | tabledata = [] |
|---|
| 279 | tableheader = [] |
|---|
| 280 | for i in range(1,7): |
|---|
| 281 | tabledata.append(sorted( |
|---|
| 282 | [value for value in self.context.values() if value.semester == i], |
|---|
| 283 | key=lambda value: str(value.semester) + value.code)) |
|---|
| 284 | tableheader.append([(Code,'code', 2.5), |
|---|
| 285 | (Title,'title', 7), |
|---|
| 286 | (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), |
|---|
| 287 | (Cred, 'credits', 1.5), |
|---|
| 288 | (CC, 'course_category', 1.5), |
|---|
| 289 | #(Mand, 'mandatory', 1.5), |
|---|
| 290 | #(Score, 'score', 1.5), |
|---|
| 291 | #(Grade, 'grade', 1.5), |
|---|
| 292 | #('Auto', 'automatic', 1.5) |
|---|
| 293 | ]) |
|---|
| 294 | return students_utils.renderPDF( |
|---|
| 295 | self, 'course_registration_slip_%s.pdf' % self.context.student.student_id, |
|---|
| 296 | self.context.student, studentview, |
|---|
| 297 | tableheader=tableheader, |
|---|
| 298 | tabledata=tabledata, |
|---|
| 299 | omit_fields=self.omit_fields, |
|---|
| 300 | signatures=self._signatures(), |
|---|
| 301 | sigs_in_footer=self._sigsInFooter(), |
|---|
| 302 | ) |
|---|
| 303 | |
|---|
| 304 | class ExportPDFCourseResultSlip(CustomExportPDFCourseRegistrationSlip): |
|---|
| 305 | """Deliver a PDF slip of the context. |
|---|
| 306 | """ |
|---|
| 307 | |
|---|
| 308 | grok.name('course_result_slip.pdf') |
|---|
| 309 | |
|---|
| 310 | @property |
|---|
| 311 | def label(self): |
|---|
| 312 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 313 | lang = self.request.cookies.get('kofa.language', portal_language) |
|---|
| 314 | level_title = translate(self.context.level_title, 'waeup.kofa', |
|---|
| 315 | target_language=lang) |
|---|
| 316 | return translate(_('Course Result Slip'), |
|---|
| 317 | 'waeup.uniben', target_language=portal_language) \ |
|---|
| 318 | + ' %s' % level_title |
|---|
| 319 | |
|---|
| 320 | def render(self): |
|---|
| 321 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 322 | Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) |
|---|
| 323 | Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) |
|---|
| 324 | Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 325 | Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language) |
|---|
| 326 | Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 327 | #Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language) |
|---|
| 328 | Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) |
|---|
| 329 | Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) |
|---|
| 330 | CC = translate(_('Cat.'), target_language=portal_language) |
|---|
| 331 | studentview = StudentBasePDFFormPage(self.context.student, |
|---|
| 332 | self.request, self.omit_fields) |
|---|
| 333 | students_utils = getUtility(IStudentsUtils) |
|---|
| 334 | |
|---|
| 335 | tabledata = [] |
|---|
| 336 | tableheader = [] |
|---|
| 337 | for i in range(1,7): |
|---|
| 338 | tabledata.append(sorted( |
|---|
| 339 | [value for value in self.context.values() if value.semester == i], |
|---|
| 340 | key=lambda value: str(value.semester) + value.code)) |
|---|
| 341 | tableheader.append([(Code,'code', 2.5), |
|---|
| 342 | (Title,'title', 5), |
|---|
| 343 | (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), |
|---|
| 344 | (Cred, 'credits', 1.5), |
|---|
| 345 | (CC, 'course_category', 1.5), |
|---|
| 346 | #(Mand, 'mandatory', 1.5), |
|---|
| 347 | (Score, 'score', 1.5), |
|---|
| 348 | (Grade, 'grade', 1.5), |
|---|
| 349 | #('Auto', 'automatic', 1.5) |
|---|
| 350 | ]) |
|---|
| 351 | return students_utils.renderPDF( |
|---|
| 352 | self, 'course_result_slip_%s.pdf' % self.context.student.student_id, |
|---|
| 353 | self.context.student, studentview, |
|---|
| 354 | tableheader=tableheader, |
|---|
| 355 | tabledata=tabledata, |
|---|
| 356 | omit_fields=self.omit_fields, |
|---|
| 357 | signatures=self._signatures(), |
|---|
| 358 | sigs_in_footer=self._sigsInFooter(), |
|---|
| 359 | ) |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | class ExportPDFExaminationClearanceSlip1(CustomExportPDFCourseRegistrationSlip): |
|---|
| 363 | """Deliver a PDF slip of the context. |
|---|
| 364 | """ |
|---|
| 365 | grok.name('examination_clearance_slip_1.pdf') |
|---|
| 366 | form_fields = None |
|---|
| 367 | omit_fields = ( |
|---|
| 368 | 'password', 'suspended', 'phone', 'date_of_birth', |
|---|
| 369 | 'parents_email', 'current_mode', 'entry_session', |
|---|
| 370 | 'adm_code', 'sex', 'suspended_comment', |
|---|
| 371 | 'flash_notice', 'password_updated', 'current_level') |
|---|
| 372 | semester = 1 |
|---|
| 373 | tabletitle = ['', '', ''] |
|---|
| 374 | |
|---|
| 375 | @property |
|---|
| 376 | def label(self): |
|---|
| 377 | return '%s First Semester Examination Clearance' % self.context.level_session |
|---|
| 378 | |
|---|
| 379 | @property |
|---|
| 380 | def title(self): |
|---|
| 381 | return '' |
|---|
| 382 | |
|---|
| 383 | def update(self): |
|---|
| 384 | if self.context.student.state != VALIDATED \ |
|---|
| 385 | or self.context.student.current_level != self.context.level: |
|---|
| 386 | self.flash(_('Forbidden'), type="warning") |
|---|
| 387 | self.redirect(self.url(self.context)) |
|---|
| 388 | |
|---|
| 389 | def render(self): |
|---|
| 390 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
|---|
| 391 | Code = translate('Code', 'waeup.kofa', target_language=portal_language) |
|---|
| 392 | studentview = StudentBasePDFFormPage(self.context.student, |
|---|
| 393 | self.request, self.omit_fields) |
|---|
| 394 | students_utils = getUtility(IStudentsUtils) |
|---|
| 395 | |
|---|
| 396 | tabledata = [] |
|---|
| 397 | tableheader = [] |
|---|
| 398 | for i in range(1,7): |
|---|
| 399 | tabledata.append(sorted( |
|---|
| 400 | [value for value in self.context.values() if i == self.semester == value.semester], |
|---|
| 401 | key=lambda value: value.code)) |
|---|
| 402 | tableheader.append([(Code,'code', 2.5), |
|---|
| 403 | ('Invigilator\'s Name','inv', 8), |
|---|
| 404 | ('Signature and Date','sig', 7), |
|---|
| 405 | ]) |
|---|
| 406 | return students_utils.renderPDF( |
|---|
| 407 | self, 'examination_clearance_slip_%s.pdf' % self.semester, |
|---|
| 408 | self.context.student, studentview, |
|---|
| 409 | tableheader=tableheader, |
|---|
| 410 | tabledata=tabledata, |
|---|
| 411 | omit_fields=self.omit_fields, |
|---|
| 412 | topMargin=1.3 |
|---|
| 413 | ) |
|---|
| 414 | |
|---|
| 415 | class ExportPDFExaminationClearanceSlip2(ExportPDFExaminationClearanceSlip1): |
|---|
| 416 | """Deliver a PDF slip of the context. |
|---|
| 417 | """ |
|---|
| 418 | grok.name('examination_clearance_slip_2.pdf') |
|---|
| 419 | semester = 2 |
|---|
| 420 | |
|---|
| 421 | @property |
|---|
| 422 | def label(self): |
|---|
| 423 | return '%s Second Semester Examination Clearance' % self.context.level_session |
|---|
| 424 | |
|---|
| 425 | class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage): |
|---|
| 426 | """ Page to display student study levels |
|---|
| 427 | """ |
|---|
| 428 | grok.context(ICustomStudentStudyLevel) |
|---|
| 429 | form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit('level') |
|---|
| 430 | form_fields[ |
|---|
| 431 | 'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
|---|
| 432 | |
|---|
| 433 | class CustomStudyLevelManageFormPage(StudyLevelManageFormPage): |
|---|
| 434 | """ Page to edit the student study level data |
|---|
| 435 | """ |
|---|
| 436 | |
|---|
| 437 | class CustomStudyLevelEditFormPage(StudyLevelEditFormPage): |
|---|
| 438 | """ Page to edit the student study level data by students |
|---|
| 439 | """ |
|---|
| 440 | |
|---|
| 441 | class CustomCourseTicketDisplayFormPage(CourseTicketDisplayFormPage): |
|---|
| 442 | """ Page to display course tickets |
|---|
| 443 | """ |
|---|
| 444 | form_fields = grok.AutoFields(ICourseTicket).omit( |
|---|
| 445 | 'ticket_session') |
|---|
| 446 | |
|---|
| 447 | class CustomCourseTicketManageFormPage(CourseTicketManageFormPage): |
|---|
| 448 | """ Page to manage course tickets |
|---|
| 449 | """ |
|---|
| 450 | form_fields = grok.AutoFields(ICourseTicket) |
|---|
| 451 | form_fields['title'].for_display = True |
|---|
| 452 | form_fields['fcode'].for_display = True |
|---|
| 453 | form_fields['dcode'].for_display = True |
|---|
| 454 | form_fields['semester'].for_display = True |
|---|
| 455 | form_fields['passmark'].for_display = True |
|---|
| 456 | form_fields['credits'].for_display = True |
|---|
| 457 | form_fields['mandatory'].for_display = False |
|---|
| 458 | form_fields['automatic'].for_display = True |
|---|
| 459 | form_fields['carry_over'].for_display = True |
|---|
| 460 | form_fields['ticket_session'].for_display = True |
|---|
| 461 | |
|---|
| 462 | class CustomPaymentsManageFormPage(PaymentsManageFormPage): |
|---|
| 463 | """ Page to manage the student payments. This manage form page is for |
|---|
| 464 | both students and students officers. FCEOkene does not allow students |
|---|
| 465 | to remove any payment ticket. |
|---|
| 466 | """ |
|---|
| 467 | @property |
|---|
| 468 | def manage_payments_allowed(self): |
|---|
| 469 | return checkPermission('waeup.manageStudent', self.context) |
|---|
| 470 | |
|---|
| 471 | class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage): |
|---|
| 472 | """ Page to view bed tickets. |
|---|
| 473 | """ |
|---|
| 474 | with_hostel_selection = True |
|---|
| 475 | |
|---|
| 476 | class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage): |
|---|
| 477 | """ Page to manage bed tickets. |
|---|
| 478 | This manage form page is for both students and students officers. |
|---|
| 479 | """ |
|---|
| 480 | with_hostel_selection = True |
|---|