1 | ## $Id: browser.py 16249 2020-09-28 17:37:18Z 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.schema.interfaces import ConstraintNotSatisfied |
---|
22 | from zope.component import getUtility |
---|
23 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
24 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
25 | from waeup.kofa.interfaces import (REQUESTED, IExtFileStore, IKofaUtils, |
---|
26 | academic_sessions_vocab) |
---|
27 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
28 | from waeup.kofa.browser.layout import ( |
---|
29 | action, jsaction, UtilityView, KofaEditFormPage) |
---|
30 | from waeup.kofa.students.browser import ( |
---|
31 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
32 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
33 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
34 | StartClearancePage, BalancePaymentAddFormPage, |
---|
35 | ExportPDFAdmissionSlip, |
---|
36 | msave, emit_lock_message) |
---|
37 | from waeup.kofa.students.interfaces import ( |
---|
38 | IStudentsUtils, ICourseTicket, IStudent) |
---|
39 | from waeup.kofa.students.vocabularies import StudyLevelSource |
---|
40 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
41 | from kofacustom.nigeria.students.browser import ( |
---|
42 | NigeriaOnlinePaymentDisplayFormPage, |
---|
43 | NigeriaStudentBaseDisplayFormPage, |
---|
44 | NigeriaStudentBaseManageFormPage, |
---|
45 | NigeriaStudentClearanceEditFormPage, |
---|
46 | NigeriaOnlinePaymentAddFormPage, |
---|
47 | NigeriaExportPDFPaymentSlip, |
---|
48 | NigeriaExportPDFClearanceSlip, |
---|
49 | NigeriaExportPDFCourseRegistrationSlip, |
---|
50 | NigeriaStudentBaseEditFormPage, |
---|
51 | NigeriaBedTicketAddPage, |
---|
52 | NigeriaAccommodationManageFormPage, |
---|
53 | NigeriaAccommodationDisplayFormPage, |
---|
54 | NigeriaStudentPersonalManageFormPage, |
---|
55 | NigeriaStudentPersonalEditFormPage, |
---|
56 | NigeriaStudentPersonalDisplayFormPage |
---|
57 | ) |
---|
58 | from kofacustom.iuokada.students.interfaces import ( |
---|
59 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
60 | ICustomStudentStudyLevel, ICustomStudentBase, ICustomStudent, |
---|
61 | ICustomStudentPersonal, ICustomStudentPersonalEdit) |
---|
62 | from kofacustom.iuokada.interfaces import MessageFactory as _ |
---|
63 | |
---|
64 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
65 | """ Page to display student base data |
---|
66 | """ |
---|
67 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
68 | 'password', 'suspended', 'suspended_comment', 'flash_notice') |
---|
69 | |
---|
70 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
71 | """ View to manage student base data |
---|
72 | """ |
---|
73 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
74 | 'student_id', 'adm_code', 'suspended', |
---|
75 | 'financially_cleared_by', 'financial_clearance_date') |
---|
76 | |
---|
77 | class StudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
78 | """ View to edit student base data |
---|
79 | """ |
---|
80 | form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
81 | 'email', 'email2', 'parents_email', 'phone',) |
---|
82 | |
---|
83 | class CustomExportPDFCourseRegistrationSlip( |
---|
84 | NigeriaExportPDFCourseRegistrationSlip): |
---|
85 | """Deliver a PDF slip of the context. |
---|
86 | """ |
---|
87 | |
---|
88 | def _signatures(self): |
---|
89 | return ( |
---|
90 | ['Student Signature'], |
---|
91 | ['HoD / Course Adviser Signature'], |
---|
92 | ['College Officer Signature'], |
---|
93 | ['Dean Signature'] |
---|
94 | ) |
---|
95 | |
---|
96 | #def _sigsInFooter(self): |
---|
97 | # return (_('Student'), |
---|
98 | # _('HoD / Course Adviser'), |
---|
99 | # _('College Officer'), |
---|
100 | # _('Dean'), |
---|
101 | # ) |
---|
102 | # return () |
---|
103 | |
---|
104 | class CustomStudentPersonalDisplayFormPage(NigeriaStudentPersonalDisplayFormPage): |
---|
105 | """ Page to display student personal data |
---|
106 | """ |
---|
107 | form_fields = grok.AutoFields(ICustomStudentPersonal) |
---|
108 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
109 | form_fields['postal_address'].custom_widget = BytesDisplayWidget |
---|
110 | form_fields['hostel_address'].custom_widget = BytesDisplayWidget |
---|
111 | form_fields['father_address'].custom_widget = BytesDisplayWidget |
---|
112 | form_fields['mother_address'].custom_widget = BytesDisplayWidget |
---|
113 | form_fields['guardian_address'].custom_widget = BytesDisplayWidget |
---|
114 | form_fields[ |
---|
115 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
116 | |
---|
117 | |
---|
118 | class CustomStudentPersonalEditFormPage(NigeriaStudentPersonalEditFormPage): |
---|
119 | """ Page to edit personal data |
---|
120 | """ |
---|
121 | form_fields = grok.AutoFields(ICustomStudentPersonalEdit).omit('personal_updated') |
---|
122 | |
---|
123 | class CustomStudentPersonalManageFormPage(NigeriaStudentPersonalManageFormPage): |
---|
124 | """ Page to edit personal data |
---|
125 | """ |
---|
126 | form_fields = grok.AutoFields(ICustomStudentPersonal) |
---|
127 | form_fields['personal_updated'].for_display = True |
---|
128 | form_fields[ |
---|
129 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
130 | |
---|
131 | class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage): |
---|
132 | """ Page to view bed tickets. |
---|
133 | """ |
---|
134 | with_hostel_selection = True |
---|
135 | |
---|
136 | class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage): |
---|
137 | """ Page to manage bed tickets. |
---|
138 | This manage form page is for both students and students officers. |
---|
139 | """ |
---|
140 | with_hostel_selection = True |
---|
141 | |
---|
142 | class CustomBedTicketAddPage(NigeriaBedTicketAddPage): |
---|
143 | """ Page to add a bed ticket |
---|
144 | """ |
---|
145 | with_ac = False |
---|
146 | with_bedselection = True |
---|
147 | |
---|
148 | class StudentGetMatricNumberPage(UtilityView, grok.View): |
---|
149 | """ Construct and set the matriculation number. |
---|
150 | """ |
---|
151 | grok.context(IStudent) |
---|
152 | grok.name('get_matric_number') |
---|
153 | grok.require('waeup.manageStudent') |
---|
154 | |
---|
155 | def update(self): |
---|
156 | students_utils = getUtility(IStudentsUtils) |
---|
157 | msg, mnumber = students_utils.setMatricNumber(self.context) |
---|
158 | if msg: |
---|
159 | self.flash(msg, type="danger") |
---|
160 | else: |
---|
161 | self.flash(_('Matriculation number %s assigned.' % mnumber)) |
---|
162 | self.context.writeLogMessage(self, '%s assigned' % mnumber) |
---|
163 | self.redirect(self.url(self.context)) |
---|
164 | return |
---|
165 | |
---|
166 | def render(self): |
---|
167 | return |
---|
168 | |
---|
169 | class SwitchLibraryAccessView(UtilityView, grok.View): |
---|
170 | """ Switch the library attribute |
---|
171 | """ |
---|
172 | grok.context(ICustomStudent) |
---|
173 | grok.name('switch_library_access') |
---|
174 | grok.require('waeup.switchLibraryAccess') |
---|
175 | |
---|
176 | def update(self): |
---|
177 | if self.context.library: |
---|
178 | self.context.library = False |
---|
179 | self.context.writeLogMessage(self, 'library access disabled') |
---|
180 | self.flash(_('Library access disabled')) |
---|
181 | else: |
---|
182 | self.context.library = True |
---|
183 | self.context.writeLogMessage(self, 'library access enabled') |
---|
184 | self.flash(_('Library access enabled')) |
---|
185 | self.redirect(self.url(self.context)) |
---|
186 | return |
---|
187 | |
---|
188 | def render(self): |
---|
189 | return |
---|
190 | |
---|
191 | class ExportLibIdCard(UtilityView, grok.View): |
---|
192 | """Deliver an id card for the library. |
---|
193 | """ |
---|
194 | grok.context(ICustomStudent) |
---|
195 | grok.name('lib_idcard.pdf') |
---|
196 | grok.require('waeup.viewStudent') |
---|
197 | prefix = 'form' |
---|
198 | |
---|
199 | label = u"Library Clearance" |
---|
200 | |
---|
201 | omit_fields = ( |
---|
202 | 'suspended', 'email', 'phone', |
---|
203 | 'adm_code', 'suspended_comment', |
---|
204 | 'date_of_birth', |
---|
205 | 'current_mode', 'certificate', |
---|
206 | 'entry_session', |
---|
207 | 'flash_notice') |
---|
208 | |
---|
209 | form_fields = [] |
---|
210 | |
---|
211 | def _sigsInFooter(self): |
---|
212 | isStudent = getattr( |
---|
213 | self.request.principal, 'user_type', None) == 'student' |
---|
214 | if isStudent: |
---|
215 | return '' |
---|
216 | return (_("Date, Reader's Signature"), |
---|
217 | _("Date, Circulation Librarian's Signature"), |
---|
218 | ) |
---|
219 | |
---|
220 | def update(self): |
---|
221 | if not self.context.library: |
---|
222 | self.flash(_('Forbidden!'), type="danger") |
---|
223 | self.redirect(self.url(self.context)) |
---|
224 | return |
---|
225 | |
---|
226 | @property |
---|
227 | def note(self): |
---|
228 | return """ |
---|
229 | <br /><br /><br /><br /><font size='12'> |
---|
230 | This is to certify that the bearer whose photograph and other details appear |
---|
231 | overleaf is a registered user of the <b>University Library</b>. |
---|
232 | The card is not transferable. A replacement fee is charged for a loss, |
---|
233 | mutilation or otherwise. If found, please, return to the University Library, |
---|
234 | Igbinedion University, Okada. |
---|
235 | </font> |
---|
236 | |
---|
237 | """ |
---|
238 | return |
---|
239 | |
---|
240 | def render(self): |
---|
241 | studentview = StudentBasePDFFormPage(self.context.student, |
---|
242 | self.request, self.omit_fields) |
---|
243 | students_utils = getUtility(IStudentsUtils) |
---|
244 | return students_utils.renderPDF( |
---|
245 | self, 'lib_idcard', |
---|
246 | self.context.student, studentview, |
---|
247 | omit_fields=self.omit_fields, |
---|
248 | sigs_in_footer=self._sigsInFooter(), |
---|
249 | note=self.note) |
---|
250 | |
---|
251 | class CustomStartClearancePage(StartClearancePage): |
---|
252 | with_ac = False |
---|
253 | |
---|
254 | class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage): |
---|
255 | grok.require('waeup.payStudent') |
---|
256 | |
---|
257 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
258 | """Deliver a PDF Admission slip. |
---|
259 | """ |
---|
260 | |
---|
261 | omit_fields = ('date_of_birth', |
---|
262 | #'current_level', |
---|
263 | 'current_mode', |
---|
264 | #'entry_session' |
---|
265 | ) |
---|
266 | |
---|
267 | @property |
---|
268 | def session(self): |
---|
269 | return academic_sessions_vocab.getTerm( |
---|
270 | self.context.entry_session).title |
---|
271 | |
---|
272 | @property |
---|
273 | def level(self): |
---|
274 | studylevelsource = StudyLevelSource() |
---|
275 | return studylevelsource.factory.getTitle( |
---|
276 | self.context['studycourse'].certificate, self.context.current_level) |
---|
277 | |
---|
278 | @property |
---|
279 | def label(self): |
---|
280 | return 'OFFER OF PROVISIONAL ADMISSION \nFOR %s SESSION' % self.session |
---|
281 | |
---|
282 | @property |
---|
283 | def pre_text_ug(self): |
---|
284 | return ( |
---|
285 | 'Following your performance in the screening exercise ' |
---|
286 | 'for the %s academic session, I am pleased to inform ' |
---|
287 | 'you that you have been offered provisional admission into the ' |
---|
288 | 'Igbinedion University, Okada as follows:' % self.session) |
---|
289 | |
---|
290 | @property |
---|
291 | def pre_text_pg(self): |
---|
292 | return ( |
---|
293 | 'I am pleased to inform you that your application for admission' |
---|
294 | ' into the Igbinedion University, Okada was successful. You have' |
---|
295 | ' been admitted as follows:') |
---|
296 | |
---|
297 | @property |
---|
298 | def post_text_ug(self): |
---|
299 | return """ |
---|
300 | Please note that at the point of registration for your programme of study (course), you will be required to present the following documents: Current UTME result slip, WAEC/NECO (0' Level) result, Birth certificate or sworn affidavit of age, and health certificate from a recognized Medical Centre. |
---|
301 | |
---|
302 | All credentials (original) will be checked during registration. This admission will be cancelled at any point in time it is found that your claims in the application form are false. |
---|
303 | |
---|
304 | You are required to show evidence of the result / credentials you presented on application for admission. |
---|
305 | |
---|
306 | Fees can be paid using any of the following options: |
---|
307 | |
---|
308 | Fees can be paid through your portal page. INSTRUCTIONS can be found below "FEES PAYMENT PROCEDURE" for the options you have to make your payment, as well as instructions on how to use your preferred payment option. If you choose to use the bank payment option, you can pay at any branch of the following banks through Etranzact platform only: Access Bank, First Bank, Zenith Bank |
---|
309 | |
---|
310 | Kindly note the following: |
---|
311 | |
---|
312 | Fees indicated on the Fee Structure page are valid for the current session only. |
---|
313 | Your Student Id (indicated above) Is your logln to the University portal. |
---|
314 | As an indication of your acceptance of this offer of admission, you should pay a non-refundable Acceptance deposit of 200,000. Further note that the 200,000 deposit is part of the tuition fee for the session. Failure to pay after the expiration of two weeks may lead to forfeiture of admission. |
---|
315 | All fees must be paid in full at the beginning of the session, as basis for accommodation, registration and attendance of lectures. This is the rule for all students at all levels. Install mental payments of not more than two installments, may be allowed under exceptional circumstances. |
---|
316 | Fees once paid are not refundable. |
---|
317 | It is advisable that you keep the original receipts of fees paid and present them on demand. |
---|
318 | |
---|
319 | Accommodation: Accommodation in University hostels is compulsory for every student. No student Is allowed to live outside the hostels. Any student who does so will be expelled from the University. |
---|
320 | |
---|
321 | Food: Food is available in cafeteria on "pay-as-you-eat" basis. |
---|
322 | |
---|
323 | Resumption Date: The University opens for fresh students with online registration starting from Monday 28th September, 2020. The date for physical resumption will be communicated soon. |
---|
324 | |
---|
325 | Registration/Orientation Programme: Orientation programme/registration for fresh students will start on Monday, 30th September 2020. Registration ends on 2020-10-30. A late registration fee of N50,000 will be charged after this date. All credentials, O'Level Results, Birth Certificate/Age Declaration, UTME Result Slip (Original) will be checked during registration. This admission will be cancelled at any point in time it is found that any of your claims in the application form is false. |
---|
326 | |
---|
327 | Transport Facility: The University provides a compulsory shuttle bus service to all students at a fee already included in the other charges. |
---|
328 | |
---|
329 | Kindly note that fresh students are not allowed the use of private vehicles. |
---|
330 | |
---|
331 | Conduct: All students are expected to conduct themselves properly and dress decently on campus, as well as obey all rules and regulations as failure to comply will attract appropriate sanctions. |
---|
332 | |
---|
333 | We wish you a successful academic career in Igbinedion University. |
---|
334 | |
---|
335 | Congratulations! |
---|
336 | |
---|
337 | Friday Benji Bakare Esq. |
---|
338 | Registrar |
---|
339 | registrar@iuokada.edu.ng |
---|
340 | 08035902949 |
---|
341 | """ |
---|
342 | |
---|
343 | @property |
---|
344 | def post_text_pg(self): |
---|
345 | return """ |
---|
346 | 1. Details of your programme will be made available to you by the Head of your Department on your arrival at the Igbinedion University. |
---|
347 | |
---|
348 | 2. This offer is conditional upon the confirmation of your qualifications as listed by you in your application form. You will be required to produce the ORIGINAL COPIES of all your certificates for verification during registration. If at any time after admission, it is discovered that you do not possess any of the qualifications upon which this offer of admission was made, you will be required to withdraw from the University. |
---|
349 | |
---|
350 | 3. If you accept this offer of admission upon the conditions above, you should please: |
---|
351 | |
---|
352 | (a) Complete the enclosed Acceptance Form of Provisional Offer of Admission in duplicate and send by registered mail or by hand to the |
---|
353 | |
---|
354 | Secretary |
---|
355 | School of Postgraduate Studies and Research |
---|
356 | Igbinedion University, |
---|
357 | P.M.B. 0006, |
---|
358 | Benin City, Edo State, |
---|
359 | Nigeria |
---|
360 | |
---|
361 | (b) Forward the following along with the Acceptance Form of Provisional Offer of Admission. |
---|
362 | |
---|
363 | (i) A non-refundable deposit of N100,000.00 (One Hundred Thousand Naira Only) which is part of the School fees: Payable Online. |
---|
364 | |
---|
365 | (ii) Four recent passport-size photograph of yourself with your full-names (surname first in BLOCK LETTERS) written on the reverse side of the photograph and pinned to the Acceptance Form. |
---|
366 | |
---|
367 | 4. The following will be required for Registration: |
---|
368 | |
---|
369 | (a) A medical examination to be conducted by an approved medical practitioner. On your arrival at the Igbinedion University, you should submit the enclosed Igbinedion University Medical Examination Form duly completed and signed by an approved medical practitioner together with your chest X-ray film to Director of Health Service at the Igbinedion University, Okada. |
---|
370 | |
---|
371 | (b) The original copies of all credentials listed in your application form (including NYSC discharge/exemption certificate) should be brought for sighting. |
---|
372 | |
---|
373 | 5. You are required to pay the necessary fees and register for your degree programme not later than three weeks from the beginning of the Academic Session. Late registration may be allowed during an additional period of five weeks on payment of a late registration fees. Please note that you will be allowed to register after two months have elapsed from the beginning of the sessions. |
---|
374 | |
---|
375 | 6. Please find attached: |
---|
376 | |
---|
377 | (a) A copy of School fees Regime |
---|
378 | (b) A copy of Acceptance Forms |
---|
379 | |
---|
380 | 7. Note: |
---|
381 | |
---|
382 | (a) All Tuition fees are to be paid online |
---|
383 | (b) Post-graduate dues and other charges are to be paid into ABC Microfinance Bank Okada, Account No: 30125 |
---|
384 | |
---|
385 | 8. CONGRATULATIONS!!! |
---|
386 | |
---|
387 | Yours faithfully, |
---|
388 | |
---|
389 | Mr. Olaoke, Olasoji Oluwole |
---|
390 | Secretary, School of Postgraduate Studies & Research |
---|
391 | """ |
---|
392 | |
---|
393 | def render(self): |
---|
394 | students_utils = getUtility(IStudentsUtils) |
---|
395 | watermark_path = os.path.join( |
---|
396 | os.path.dirname(__file__), 'static', 'watermark.pdf') |
---|
397 | watermark = open(watermark_path, 'rb') |
---|
398 | if self.context.is_postgrad: |
---|
399 | file_path = os.path.join( |
---|
400 | os.path.dirname(__file__), 'static', 'admission_letter_pg.pdf') |
---|
401 | file = open(file_path, 'rb') |
---|
402 | mergefiles = [file,] |
---|
403 | return students_utils.renderPDFAdmissionLetter(self, |
---|
404 | self.context.student, omit_fields=self.omit_fields, |
---|
405 | pre_text=self.pre_text_pg, post_text=self.post_text_pg, |
---|
406 | mergefiles=mergefiles, |
---|
407 | watermark=watermark) |
---|
408 | file_path = os.path.join( |
---|
409 | os.path.dirname(__file__), 'static', 'admission_letter_ug.pdf') |
---|
410 | file = open(file_path, 'rb') |
---|
411 | mergefiles = [file,] |
---|
412 | return students_utils.renderPDFAdmissionLetter(self, |
---|
413 | self.context.student, omit_fields=self.omit_fields, |
---|
414 | pre_text=self.pre_text_ug, post_text=self.post_text_ug, |
---|
415 | mergefiles=mergefiles, |
---|
416 | watermark=watermark) |
---|
417 | |
---|
418 | class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): |
---|
419 | """ Page to view an online payment ticket. We do not omit provider_amt. |
---|
420 | """ |
---|
421 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
422 | 'gateway_amt', 'thirdparty_amt', 'p_item','p_combi') |
---|
423 | form_fields[ |
---|
424 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
425 | form_fields[ |
---|
426 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
427 | |
---|
428 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
---|
429 | """Deliver a PDF slip of the context. We do not omit provider_amt. |
---|
430 | """ |
---|
431 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit( |
---|
432 | 'gateway_amt', 'thirdparty_amt', 'p_item', |
---|
433 | 'p_split_data','p_combi') |
---|
434 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
435 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|