[8911] | 1 | ## $Id: browser.py 14164 2016-09-06 18:08:44Z 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 | from zope.i18n import translate |
---|
[10710] | 20 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
[13331] | 21 | from zope.component import getUtility, getMultiAdapter |
---|
| 22 | from zope.viewlet.interfaces import IViewletManager |
---|
[11906] | 23 | from waeup.kofa.interfaces import IKofaUtils |
---|
[10691] | 24 | from waeup.kofa.browser.layout import UtilityView |
---|
| 25 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
[8911] | 26 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
[10691] | 27 | from waeup.kofa.students.browser import ( |
---|
[13061] | 28 | StartClearancePage, BedTicketAddPage, ExportPDFAdmissionSlip, |
---|
[10692] | 29 | StudentBasePDFFormPage) |
---|
[10691] | 30 | from waeup.kwarapoly.students.interfaces import ( |
---|
[11864] | 31 | ICustomStudent, ICustomStudentBase, ICustomStudentStudyLevel, |
---|
| 32 | ICustomUGStudentClearance, ICustomPGStudentClearance) |
---|
[10691] | 33 | from waeup.kwarapoly.interfaces import MessageFactory as _ |
---|
| 34 | from waeup.kofa.students.workflow import ( |
---|
| 35 | ADMITTED, PAID, REQUESTED, RETURNING, CLEARED, REGISTERED, |
---|
| 36 | VALIDATED, GRADUATED, TRANSCRIPT, CREATED, CLEARANCE) |
---|
[8911] | 37 | from kofacustom.nigeria.students.browser import ( |
---|
| 38 | NigeriaOnlinePaymentDisplayFormPage, |
---|
| 39 | NigeriaOnlinePaymentAddFormPage, |
---|
[13061] | 40 | NigeriaExportPDFPaymentSlip, |
---|
[11864] | 41 | NigeriaStudentClearanceDisplayFormPage, |
---|
[13061] | 42 | NigeriaExportPDFClearanceSlip, |
---|
[9190] | 43 | NigeriaStudentClearanceEditFormPage, |
---|
[13061] | 44 | NigeriaExportPDFCourseRegistrationSlip, |
---|
[10710] | 45 | NigeriaStudentPersonalDisplayFormPage, |
---|
[11864] | 46 | NigeriaStudentClearanceManageFormPage, |
---|
[10710] | 47 | NigeriaStudentPersonalEditFormPage, |
---|
[10819] | 48 | NigeriaStudentPersonalManageFormPage, |
---|
[14164] | 49 | NigeriaStudentBaseEditFormPage, |
---|
| 50 | NigeriaExportPDFFinancialClearancePage |
---|
[9190] | 51 | ) |
---|
[13331] | 52 | from kofacustom.nigeria.students.viewlets import show_viewlet |
---|
[10710] | 53 | from waeup.kwarapoly.students.interfaces import ( |
---|
[12907] | 54 | ICustomStudent, |
---|
[10710] | 55 | ICustomStudentOnlinePayment, |
---|
| 56 | ICustomStudentPersonal, |
---|
| 57 | ICustomStudentPersonalEdit |
---|
| 58 | ) |
---|
[8911] | 59 | |
---|
[11887] | 60 | |
---|
[10819] | 61 | class CustomStudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
| 62 | """ View to edit student base data |
---|
| 63 | """ |
---|
| 64 | form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
| 65 | 'email', 'phone', 'sex') |
---|
| 66 | |
---|
[11887] | 67 | |
---|
| 68 | class CustomStudentPersonalDisplayFormPage( |
---|
| 69 | NigeriaStudentPersonalDisplayFormPage): |
---|
[10710] | 70 | """ Page to display student personal data |
---|
| 71 | """ |
---|
| 72 | form_fields = grok.AutoFields(ICustomStudentPersonal) |
---|
| 73 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
| 74 | form_fields['next_kin_address'].custom_widget = BytesDisplayWidget |
---|
| 75 | form_fields['corr_address'].custom_widget = BytesDisplayWidget |
---|
| 76 | form_fields['sponsor_address'].custom_widget = BytesDisplayWidget |
---|
| 77 | form_fields[ |
---|
| 78 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 79 | |
---|
[11887] | 80 | |
---|
[10710] | 81 | class CustomStudentPersonalEditFormPage(NigeriaStudentPersonalEditFormPage): |
---|
| 82 | """ Page to edit personal data |
---|
| 83 | """ |
---|
| 84 | form_fields = grok.AutoFields(ICustomStudentPersonalEdit).omit( |
---|
| 85 | 'personal_updated') |
---|
| 86 | |
---|
[11887] | 87 | |
---|
| 88 | class CustomStudentPersonalManageFormPage( |
---|
| 89 | NigeriaStudentPersonalManageFormPage): |
---|
[10710] | 90 | """ Page to edit personal data |
---|
| 91 | """ |
---|
| 92 | form_fields = grok.AutoFields(ICustomStudentPersonal) |
---|
| 93 | form_fields['personal_updated'].for_display = True |
---|
| 94 | form_fields[ |
---|
| 95 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 96 | |
---|
[11887] | 97 | |
---|
[8911] | 98 | class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): |
---|
| 99 | """ Page to view an online payment ticket |
---|
| 100 | """ |
---|
| 101 | grok.context(ICustomStudentOnlinePayment) |
---|
[9789] | 102 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
[9992] | 103 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[8911] | 104 | form_fields[ |
---|
| 105 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 106 | form_fields[ |
---|
| 107 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 108 | |
---|
[11887] | 109 | |
---|
[8911] | 110 | class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage): |
---|
| 111 | """ Page to add an online payment ticket |
---|
| 112 | """ |
---|
| 113 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select( |
---|
| 114 | 'p_category') |
---|
| 115 | |
---|
[11887] | 116 | |
---|
[13061] | 117 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
---|
[8911] | 118 | """Deliver a PDF slip of the context. |
---|
| 119 | """ |
---|
| 120 | grok.context(ICustomStudentOnlinePayment) |
---|
[9789] | 121 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
[9992] | 122 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[11887] | 123 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget( |
---|
| 124 | 'le') |
---|
| 125 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget( |
---|
| 126 | 'le') |
---|
[9156] | 127 | |
---|
[11887] | 128 | |
---|
[9156] | 129 | class CustomStartClearancePage(StartClearancePage): |
---|
| 130 | |
---|
[9955] | 131 | with_ac = False |
---|
[9156] | 132 | |
---|
[11864] | 133 | |
---|
[11887] | 134 | class CustomStudentClearanceDisplayFormPage( |
---|
| 135 | NigeriaStudentClearanceDisplayFormPage): |
---|
[11864] | 136 | """ Page to display student clearance data |
---|
| 137 | """ |
---|
| 138 | |
---|
| 139 | @property |
---|
| 140 | def form_fields(self): |
---|
| 141 | if self.context.is_postgrad: |
---|
| 142 | form_fields = grok.AutoFields( |
---|
| 143 | ICustomPGStudentClearance).omit('clearance_locked') |
---|
| 144 | else: |
---|
| 145 | form_fields = grok.AutoFields( |
---|
| 146 | ICustomUGStudentClearance).omit('clearance_locked') |
---|
| 147 | if not getattr(self.context, 'officer_comment'): |
---|
| 148 | form_fields = form_fields.omit('officer_comment') |
---|
| 149 | else: |
---|
| 150 | form_fields['officer_comment'].custom_widget = BytesDisplayWidget |
---|
| 151 | return form_fields |
---|
| 152 | |
---|
[11887] | 153 | |
---|
[13061] | 154 | class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip): |
---|
[11864] | 155 | """Deliver a PDF slip of the context. |
---|
| 156 | """ |
---|
| 157 | |
---|
| 158 | @property |
---|
| 159 | def form_fields(self): |
---|
| 160 | if self.context.is_postgrad: |
---|
| 161 | form_fields = grok.AutoFields( |
---|
| 162 | ICustomPGStudentClearance).omit('clearance_locked') |
---|
| 163 | else: |
---|
| 164 | form_fields = grok.AutoFields( |
---|
| 165 | ICustomUGStudentClearance).omit('clearance_locked') |
---|
| 166 | if not getattr(self.context, 'officer_comment'): |
---|
| 167 | form_fields = form_fields.omit('officer_comment') |
---|
| 168 | return form_fields |
---|
| 169 | |
---|
[11887] | 170 | |
---|
| 171 | class CustomStudentClearanceManageFormPage( |
---|
| 172 | NigeriaStudentClearanceManageFormPage): |
---|
[11864] | 173 | """ Page to edit student clearance data |
---|
| 174 | """ |
---|
| 175 | |
---|
| 176 | @property |
---|
| 177 | def form_fields(self): |
---|
| 178 | if self.context.is_postgrad: |
---|
| 179 | form_fields = grok.AutoFields( |
---|
| 180 | ICustomPGStudentClearance).omit('clr_code') |
---|
| 181 | else: |
---|
| 182 | form_fields = grok.AutoFields( |
---|
| 183 | ICustomUGStudentClearance).omit('clr_code') |
---|
| 184 | return form_fields |
---|
| 185 | |
---|
[11887] | 186 | |
---|
[9181] | 187 | class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage): |
---|
| 188 | """ View to edit student clearance data by student |
---|
| 189 | """ |
---|
| 190 | |
---|
[13392] | 191 | # deactivated on 5/11/15, see ticket 129 |
---|
| 192 | def xxx_dataNotComplete(self): |
---|
[13331] | 193 | mgr = getMultiAdapter( |
---|
| 194 | (self.context, self.request, self), IViewletManager,'files') |
---|
| 195 | mgr.update() |
---|
| 196 | missing_files = [] |
---|
[13341] | 197 | required = ( |
---|
| 198 | 'birthcertificateupload', |
---|
| 199 | 'acceptanceletterupload', |
---|
| 200 | 'lgaidentificationupload', |
---|
| 201 | 'firstsittingresultupload', |
---|
| 202 | 'resultstatementupload', |
---|
| 203 | 'refereeletterupload', |
---|
| 204 | 'statutorydeclarationupload', |
---|
| 205 | ) |
---|
| 206 | |
---|
[13331] | 207 | for viewlet in mgr.viewlets: |
---|
[13341] | 208 | if viewlet.__name__ not in required: |
---|
| 209 | continue |
---|
[13331] | 210 | if viewlet.show_viewlet and not viewlet.file_exists: |
---|
| 211 | missing_files += (viewlet.label, ) |
---|
| 212 | if missing_files: |
---|
| 213 | return "Missing: %s" % ', '.join(missing_files) |
---|
[9190] | 214 | return False |
---|
| 215 | |
---|
[11864] | 216 | @property |
---|
| 217 | def form_fields(self): |
---|
| 218 | if self.context.is_postgrad: |
---|
| 219 | form_fields = grok.AutoFields(ICustomPGStudentClearance).omit( |
---|
[12396] | 220 | 'clearance_locked', 'nysc_location', 'clr_code', 'officer_comment', |
---|
| 221 | 'physical_clearance_date') |
---|
[11864] | 222 | else: |
---|
| 223 | form_fields = grok.AutoFields(ICustomUGStudentClearance).omit( |
---|
[12396] | 224 | 'clearance_locked', 'clr_code', 'officer_comment', |
---|
| 225 | 'physical_clearance_date') |
---|
[11864] | 226 | return form_fields |
---|
| 227 | |
---|
[11887] | 228 | |
---|
[9190] | 229 | class BedTicketAddPage(BedTicketAddPage): |
---|
| 230 | """ Page to add an online payment ticket |
---|
| 231 | """ |
---|
| 232 | buttonname = _('Create bed ticket') |
---|
| 233 | notice = '' |
---|
[10691] | 234 | with_ac = False |
---|
| 235 | |
---|
[11887] | 236 | |
---|
[13061] | 237 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
[10691] | 238 | """Deliver a PDF Admission slip. |
---|
| 239 | """ |
---|
| 240 | grok.context(ICustomStudent) |
---|
| 241 | |
---|
[13714] | 242 | omit_fields = ('date_of_birth', 'current_level', 'flash_notice') |
---|
[10691] | 243 | |
---|
[11887] | 244 | form_fields = grok.AutoFields(ICustomStudent).select( |
---|
| 245 | 'student_id', 'reg_number') |
---|
[10691] | 246 | |
---|
[13307] | 247 | @property |
---|
| 248 | def label(self): |
---|
| 249 | line0 = 'Registration Bio Data - B' |
---|
| 250 | line1 = 'Admission Letter of %s' % self.context.display_fullname |
---|
| 251 | return '%s\n%s' % (line0, line1) |
---|
| 252 | |
---|
[10691] | 253 | def render(self): |
---|
| 254 | if self.context.state in (CREATED, ADMITTED, |
---|
| 255 | CLEARANCE, REQUESTED, CLEARED): |
---|
| 256 | self.flash('Not allowed.') |
---|
| 257 | self.redirect(self.url(self.context)) |
---|
| 258 | return |
---|
| 259 | students_utils = getUtility(IStudentsUtils) |
---|
| 260 | return students_utils.renderPDFAdmissionLetter(self, |
---|
| 261 | self.context.student, omit_fields=self.omit_fields) |
---|
| 262 | |
---|
[11887] | 263 | |
---|
[10691] | 264 | class ExportPDFAdmissionNotificationPage(UtilityView, grok.View): |
---|
[11873] | 265 | """Deliver a PDF Admission notification slip. |
---|
[10691] | 266 | """ |
---|
| 267 | grok.context(ICustomStudent) |
---|
| 268 | grok.name('admission_notification.pdf') |
---|
| 269 | grok.require('waeup.viewStudent') |
---|
| 270 | prefix = 'form' |
---|
[13307] | 271 | label = 'Registration Bio Data - A\nNotification of Provisional Admission' |
---|
[10691] | 272 | |
---|
[11539] | 273 | omit_fields = ('date_of_birth', 'current_level') |
---|
[10691] | 274 | |
---|
| 275 | form_fields = grok.AutoFields(ICustomStudent).select( |
---|
| 276 | 'student_id', 'reg_number', 'sex', 'lga') |
---|
| 277 | |
---|
| 278 | def render(self): |
---|
| 279 | if self.context.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED): |
---|
| 280 | self.flash('Not allowed.') |
---|
| 281 | self.redirect(self.url(self.context)) |
---|
| 282 | return |
---|
| 283 | students_utils = getUtility(IStudentsUtils) |
---|
| 284 | pre_text = '' |
---|
[10703] | 285 | post_text = post_text_freshers |
---|
[10691] | 286 | return students_utils.renderPDFAdmissionLetter(self, |
---|
| 287 | self.context.student, omit_fields=self.omit_fields, |
---|
| 288 | pre_text=pre_text, post_text=post_text) |
---|
[10692] | 289 | |
---|
[11887] | 290 | |
---|
[10692] | 291 | # copied from waeup.aaue |
---|
[13061] | 292 | class CustomExportPDFCourseRegistrationSlip( |
---|
| 293 | NigeriaExportPDFCourseRegistrationSlip): |
---|
[10692] | 294 | """Deliver a PDF slip of the context. |
---|
| 295 | """ |
---|
| 296 | grok.context(ICustomStudentStudyLevel) |
---|
| 297 | form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit( |
---|
| 298 | 'level_session', 'level_verdict', |
---|
[12877] | 299 | 'validated_by', 'validation_date', 'gpa', 'level') |
---|
[10692] | 300 | |
---|
| 301 | omit_fields = ('password', 'suspended', 'suspended_comment', |
---|
| 302 | 'phone', 'adm_code', 'sex', 'email', 'date_of_birth', |
---|
[11539] | 303 | 'department', 'current_mode', 'current_level') |
---|
[10692] | 304 | |
---|
| 305 | @property |
---|
| 306 | def title(self): |
---|
| 307 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 308 | return translate(_('Credits Registered'), 'waeup.kofa', |
---|
| 309 | target_language=portal_language) |
---|
| 310 | |
---|
| 311 | def _signatures(self): |
---|
[11901] | 312 | """Signatures as inserted at document bottom. |
---|
| 313 | |
---|
| 314 | As Kwarapoly requires a fancy 'certificate' there, the pre- |
---|
| 315 | and post-fields of signatures are quite large and unusual |
---|
| 316 | here. |
---|
| 317 | |
---|
| 318 | This is also a workaround, as we cannot easily insert text |
---|
| 319 | with signature fields in documents using reportlab platypus. |
---|
| 320 | |
---|
| 321 | The signature boxes we return here contain context infos |
---|
| 322 | (therefore this has to be a method) and return the following |
---|
| 323 | layout: |
---|
| 324 | |
---|
| 325 | +-----------------------------------------+ |
---|
| 326 | | (Empty pre text) | |
---|
| 327 | +-------------+---------------------------+ |
---|
| 328 | |Date | Students Signature | |
---|
| 329 | +-------------+---------------------------+ |
---|
| 330 | | (Empty post text) | |
---|
| 331 | +=========================================+ |
---|
| 332 | | Certification | |
---|
| 333 | +-------------+---------------------------+ |
---|
| 334 | |Date | Director Signature, etc. | |
---|
| 335 | +-------------+---------------------------+ |
---|
| 336 | |NOTE: This form is the ... | |
---|
| 337 | +-----------------------------------------+ |
---|
| 338 | |
---|
| 339 | |
---|
| 340 | """ |
---|
[10692] | 341 | return ( |
---|
[11901] | 342 | [ |
---|
| 343 | ('', _('Student\'s Signature'), ''), |
---|
| 344 | ], |
---|
| 345 | [(( |
---|
| 346 | "<br/>" |
---|
| 347 | + " " * 70 + |
---|
| 348 | "<u><b><font size='14'>Certification</font></b></u><br/>" |
---|
| 349 | "<br/><b><i>" |
---|
| 350 | "This is to certify that " |
---|
| 351 | "<font size='13'>" |
---|
| 352 | + self.context.student.display_fullname + |
---|
| 353 | "</font>" |
---|
| 354 | " has paid the full School Fees, duly registered and " |
---|
[11903] | 355 | "therefore, is cleared to sit for examination in the " |
---|
[11901] | 356 | "courses listed above." |
---|
| 357 | "</i></b><br/><br/>" |
---|
| 358 | ), |
---|
| 359 | "Institute Director\'s Signature and Official Stamp", |
---|
| 360 | ( |
---|
| 361 | "<b><u>NOTE:</u></b> This form is the property of " |
---|
| 362 | "Kwara State Polytechnic, it is not transferable " |
---|
| 363 | "and students must properly fill it, get it duly " |
---|
| 364 | "endorsed and present it before they can be admitted " |
---|
| 365 | "into Examination Venues." |
---|
[11905] | 366 | )), ] |
---|
[10692] | 367 | ) |
---|
| 368 | |
---|
| 369 | def render(self): |
---|
| 370 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 371 | Code = translate('Code', 'waeup.kofa', target_language=portal_language) |
---|
[11887] | 372 | Title = translate('Title', 'waeup.kofa', |
---|
| 373 | target_language=portal_language) |
---|
| 374 | Cred = translate( |
---|
| 375 | 'Cred.', 'waeup.kofa', target_language=portal_language) |
---|
| 376 | Score = translate('Score', 'waeup.kofa', |
---|
| 377 | target_language=portal_language) |
---|
| 378 | Grade = translate('Grade', 'waeup.kofa', |
---|
| 379 | target_language=portal_language) |
---|
[10692] | 380 | Signature = translate(_('HOD\'s Signature'), 'waeup.kwarapoly', |
---|
| 381 | target_language=portal_language) |
---|
| 382 | studentview = StudentBasePDFFormPage(self.context.student, |
---|
| 383 | self.request, self.omit_fields) |
---|
| 384 | students_utils = getUtility(IStudentsUtils) |
---|
| 385 | |
---|
| 386 | tabledata = [] |
---|
| 387 | tableheader = [] |
---|
[11887] | 388 | for i in range(1, 7): |
---|
[10692] | 389 | tabledata.append(sorted( |
---|
[11887] | 390 | [value for value in self.context.values() |
---|
| 391 | if value.semester == i], |
---|
[10692] | 392 | key=lambda value: str(value.semester) + value.code)) |
---|
[11887] | 393 | tableheader.append([(Code, 'code', 2.0), |
---|
| 394 | (Title, 'title', 7), |
---|
[10692] | 395 | (Cred, 'credits', 1.5), |
---|
| 396 | (Score, 'score', 1.4), |
---|
| 397 | (Grade, 'grade', 1.4), |
---|
| 398 | (Signature, 'dummy', 3), |
---|
| 399 | ]) |
---|
[11901] | 400 | topMargin = 1.5 + (self.label.count('\n') * 0.2) |
---|
[10692] | 401 | return students_utils.renderPDF( |
---|
| 402 | self, 'course_registration_slip.pdf', |
---|
| 403 | self.context.student, studentview, |
---|
| 404 | tableheader=tableheader, |
---|
| 405 | tabledata=tabledata, |
---|
| 406 | signatures=self._signatures(), |
---|
| 407 | topMargin=topMargin, |
---|
[11901] | 408 | omit_fields=self.omit_fields, |
---|
[10695] | 409 | ) |
---|
| 410 | |
---|
[11887] | 411 | |
---|
[13061] | 412 | class ExportPDFRegistrationSlip(grok.View): |
---|
[10695] | 413 | """Deliver a PDF slip of the context. |
---|
| 414 | """ |
---|
| 415 | grok.context(ICustomStudent) |
---|
[10705] | 416 | grok.name('registration_slip.pdf') |
---|
[10695] | 417 | grok.require('waeup.viewStudent') |
---|
| 418 | prefix = 'form' |
---|
| 419 | omit_fields = ( |
---|
| 420 | 'suspended', 'phone', |
---|
[10705] | 421 | 'adm_code', 'suspended_comment', 'email', |
---|
[11539] | 422 | 'current_mode', 'matric_number', 'date_of_birth', 'current_level') |
---|
[10705] | 423 | title = 'Clearance and Personal Data' |
---|
[13307] | 424 | label = 'Registration Bio Data - C\nProfile Data Slip' |
---|
[10695] | 425 | |
---|
| 426 | form_fields = grok.AutoFields(ICustomStudent).select( |
---|
[10705] | 427 | 'date_of_birth', 'lga', 'nationality', |
---|
| 428 | 'perm_address', 'corr_address', |
---|
| 429 | 'marit_stat', 'sponsor_name', 'sponsor_address', |
---|
| 430 | ) |
---|
[10695] | 431 | |
---|
| 432 | def render(self): |
---|
[11931] | 433 | if self.context.state in (CREATED, ADMITTED, |
---|
| 434 | CLEARANCE, REQUESTED, CLEARED): |
---|
| 435 | self.flash('Not allowed.') |
---|
| 436 | self.redirect(self.url(self.context)) |
---|
| 437 | return |
---|
[10695] | 438 | studentview = StudentBasePDFFormPage(self.context.student, |
---|
| 439 | self.request, self.omit_fields) |
---|
| 440 | students_utils = getUtility(IStudentsUtils) |
---|
| 441 | return students_utils.renderPDF( |
---|
[10705] | 442 | self, 'registration_slip.pdf', |
---|
[11873] | 443 | self.context.student, studentview, signatures=None, |
---|
[10703] | 444 | omit_fields=self.omit_fields, |
---|
| 445 | note=post_text_registration) |
---|
| 446 | |
---|
[11873] | 447 | post_text_registration = """<br /><br /> |
---|
| 448 | <strong>IMPORTANT NOTICE</strong> |
---|
[10703] | 449 | <br /><br /> |
---|
[12149] | 450 | This registration slip must be supplied before attendance of lectures. Note that: |
---|
[11887] | 451 | <br /><br /> |
---|
| 452 | 1. All fees due must be paid in full. |
---|
| 453 | <br /><br /> |
---|
| 454 | 2. All information required must be available on the Registration Form. |
---|
| 455 | <br /><br /> |
---|
| 456 | 3. The Signature of all appropriate Polytechnic Authority must be obtained. |
---|
| 457 | <br /><br /> |
---|
| 458 | 4. The endorsed Registration Form should be returned to the respective |
---|
| 459 | Institutes and Administrative Offices. |
---|
| 460 | <br /><br /> |
---|
| 461 | 5. No student may change his subject or course of study as shown in the |
---|
| 462 | signed Registration Form without clearance from the Admissions Office |
---|
| 463 | and the Director of the appropriate Institute. |
---|
| 464 | <br /><br /> |
---|
| 465 | 6. All candidates admitted into the HND I programmes should submit the |
---|
| 466 | photocopies of their original certificates of ND and SSCE with scratch |
---|
| 467 | card online for clearance latest a week after the admission is offered. |
---|
| 468 | Failure to comply with this directive may lead to the forfeiture of |
---|
| 469 | the admission. |
---|
| 470 | <br /><br /> |
---|
| 471 | <!-- image size: 229x100 pixels; ratio (2.29:1) must be kept --> |
---|
| 472 | <img src="${signature_img_path}" valign="-30" |
---|
| 473 | height="75" width="172" /> |
---|
| 474 | <br /> |
---|
[11873] | 475 | M.O. Adebayo<br /> |
---|
| 476 | Admission Officer<br /> |
---|
| 477 | For: Registrar |
---|
[10703] | 478 | """ |
---|
| 479 | |
---|
| 480 | post_text_freshers = """ |
---|
| 481 | <strong>INSTRUCTIONS TO FRESHERS</strong> |
---|
| 482 | <br /><br /> |
---|
[13307] | 483 | You are hereby offered a provisional admission for the current academic |
---|
| 484 | session subject to the conditions that: |
---|
[10703] | 485 | <br /><br /> |
---|
[11887] | 486 | 1. The information given in your Application Form is correct. |
---|
| 487 | <br /><br /> |
---|
| 488 | 2. The original of your Credentials are presented for scrutiny. |
---|
| 489 | <br /><br /> |
---|
| 490 | 3. If at any time the Credentials submitted are found to be false/fake |
---|
| 491 | or incorrect, your admission shall be withdrawn. |
---|
| 492 | <br /><br /> |
---|
| 493 | 4. The name by which you are admitted and registered shall remain same |
---|
| 494 | throughout the duration of your programme. |
---|
| 495 | <br /><br /> |
---|
| 496 | 5. You are to fill and submit the Undertaking Form at the point of |
---|
| 497 | registration failure which your admission will be forfeited. |
---|
| 498 | <br /><br /> |
---|
| 499 | 6. You will dress decently covering your nakedness at all times. |
---|
| 500 | <br /><br /> |
---|
| 501 | 7. Payment of school fees will be once and in full and should be by |
---|
| 502 | Interswitch to the designated Banks. Failure to pay fees by the |
---|
| 503 | mode mentioned above by the closing date means you have declined |
---|
| 504 | the offer and your place will be given to another eligible |
---|
| 505 | candidate immediately. |
---|
| 506 | <br /><br /> |
---|
| 507 | 8. You present a Certificate of medical fitness from the Polytechnic |
---|
| 508 | Clinic. |
---|
| 509 | <br /><br /> |
---|
| 510 | 9. All indigenes of Kwara State are required to present Certificate of |
---|
| 511 | Citizenship. |
---|
| 512 | <br /><br /> |
---|
| 513 | 10. The Polytechnic reserves the right to withdraw your admission at |
---|
| 514 | any stage, if you are found to be a cultist or an expelled |
---|
[13307] | 515 | individual from any tertiary institution. In addition, it should be |
---|
| 516 | noted that the Polytechnic will not entertain any change of name |
---|
| 517 | different from the one filled by the candidate on his/her Application |
---|
| 518 | Form. |
---|
[11887] | 519 | <br /><br /> |
---|
| 520 | 11. You are prepared to take up accommodation provided on the campuses |
---|
| 521 | by the authority. |
---|
| 522 | <br /><br /> |
---|
| 523 | 12. There will be no refund of school fees once paid. |
---|
| 524 | <br /><br /> |
---|
| 525 | 13. If you accept this offer with the above stated conditions, please |
---|
| 526 | make a photocopy of this document and return it to the Admission |
---|
| 527 | Office immediately. |
---|
| 528 | <br /><br /> |
---|
| 529 | 14. You possess the entry requirement for the programme you are admitted. |
---|
| 530 | <br /><br /> |
---|
[11873] | 531 | |
---|
[11887] | 532 | <!-- image size: 229x100 pixels; ratio (2.29:1) must be kept --> |
---|
| 533 | <img src="${signature_img_path}" valign="-30" |
---|
| 534 | height="75" width="172" /> |
---|
| 535 | <br /> |
---|
[11873] | 536 | M.O. Adebayo<br /> |
---|
| 537 | Admission Officer<br /> |
---|
| 538 | For: Registrar |
---|
[11887] | 539 | """ |
---|
| 540 | # XXX: a note for <img /> tag used here (from reportlab docs): |
---|
| 541 | # The valign attribute may be set to a css like value from "baseline", "sub", |
---|
| 542 | # "super", "top", "text-top", "middle", "bottom", "text-bottom"; |
---|
| 543 | # the value may also be a numeric percentage or an absolute value. |
---|
| 544 | # |
---|
| 545 | # Burn this remark after reading. |
---|
[12907] | 546 | |
---|
| 547 | |
---|
[13061] | 548 | class StudentGetMatricNumberView(UtilityView, grok.View): |
---|
[12907] | 549 | """ Construct and set the matriculation number. |
---|
| 550 | """ |
---|
| 551 | grok.context(ICustomStudent) |
---|
| 552 | grok.name('get_matric_number') |
---|
| 553 | grok.require('waeup.viewStudent') |
---|
| 554 | |
---|
| 555 | def update(self): |
---|
| 556 | students_utils = getUtility(IStudentsUtils) |
---|
| 557 | msg, mnumber = students_utils.setMatricNumber(self.context) |
---|
| 558 | if msg: |
---|
| 559 | self.flash(msg, type="danger") |
---|
| 560 | else: |
---|
| 561 | self.flash(_('Matriculation number %s assigned.' % mnumber)) |
---|
| 562 | self.context.writeLogMessage(self, '%s assigned' % mnumber) |
---|
| 563 | self.redirect(self.url(self.context)) |
---|
| 564 | return |
---|
| 565 | |
---|
| 566 | def render(self): |
---|
[14164] | 567 | return |
---|
| 568 | |
---|
| 569 | class CustomExportPDFFinancialClearancePage(NigeriaExportPDFFinancialClearancePage): |
---|
| 570 | """Deliver a PDF financial clearance slip. |
---|
| 571 | """ |
---|
| 572 | |
---|
| 573 | def _sigsInFooter(self): |
---|
| 574 | return (_('Date, Checking Officer Signature'), |
---|
| 575 | _('Date, Approving Officer Signature'), |
---|
| 576 | ) |
---|