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