[16639] | 1 | ## $Id: browser.py 17153 2022-10-31 18:09:26Z henrik $ |
---|
[15614] | 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 |
---|
[16695] | 19 | import os |
---|
[15614] | 20 | from zope.i18n import translate |
---|
| 21 | from zope.schema.interfaces import ConstraintNotSatisfied |
---|
| 22 | from zope.component import getUtility |
---|
[16715] | 23 | from zope.security import checkPermission |
---|
[15614] | 24 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
| 25 | from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils |
---|
| 26 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
| 27 | from waeup.kofa.browser.layout import KofaEditFormPage |
---|
| 28 | from waeup.kofa.browser.layout import action, jsaction |
---|
| 29 | from waeup.kofa.students.browser import ( |
---|
| 30 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
| 31 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
| 32 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
[16715] | 33 | ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage, |
---|
[16796] | 34 | BalancePaymentAddFormPage, msave, emit_lock_message) |
---|
[15614] | 35 | from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket |
---|
| 36 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
| 37 | from kofacustom.nigeria.students.browser import ( |
---|
| 38 | NigeriaOnlinePaymentDisplayFormPage, |
---|
| 39 | NigeriaStudentBaseManageFormPage, |
---|
| 40 | NigeriaStudentClearanceEditFormPage, |
---|
| 41 | NigeriaOnlinePaymentAddFormPage, |
---|
| 42 | NigeriaExportPDFPaymentSlip, |
---|
| 43 | NigeriaExportPDFClearanceSlip, |
---|
[16712] | 44 | NigeriaExportPDFPaymentSlip, |
---|
[16846] | 45 | NigeriaBedTicketAddPage, |
---|
[15614] | 46 | ) |
---|
| 47 | |
---|
[16615] | 48 | from kofacustom.edocons.students.interfaces import ( |
---|
[15614] | 49 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
| 50 | ICustomStudentStudyLevel) |
---|
[16615] | 51 | from kofacustom.edocons.interfaces import MessageFactory as _ |
---|
[15614] | 52 | |
---|
[16699] | 53 | class CustomStartClearancePage(StartClearancePage): |
---|
| 54 | with_ac = False |
---|
| 55 | |
---|
[16695] | 56 | class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): |
---|
| 57 | """Deliver a PDF Admission slip. |
---|
| 58 | """ |
---|
| 59 | |
---|
| 60 | omit_fields = ('date_of_birth', 'current_level', 'current_mode', |
---|
| 61 | 'certificate', 'faculty') |
---|
| 62 | #form_fields = grok.AutoFields(IStudentBase).select('student_id', 'reg_number') |
---|
| 63 | |
---|
| 64 | post_text = ''' |
---|
[16791] | 65 | This admission will be confirmed upon payment of school fees. |
---|
[16695] | 66 | |
---|
[17138] | 67 | Note: All admitted students are to pay their school fees on or before 18th of October 2022. |
---|
[16791] | 68 | |
---|
[17028] | 69 | Also, hostel accommodation is available on first come first serve basis. |
---|
[16791] | 70 | |
---|
[16697] | 71 | Please visit the College Registry (Student Affairs Division) at: |
---|
[16695] | 72 | |
---|
[16696] | 73 | Edo State College of Nursing Sciences |
---|
[16697] | 74 | Godwin Abbey Way (Formerly Limit Road) off Sapele Road, Benin City |
---|
[16696] | 75 | or call 08104797237 for enquiries. |
---|
[16695] | 76 | |
---|
| 77 | Congratulations! |
---|
| 78 | ''' |
---|
| 79 | |
---|
| 80 | @property |
---|
| 81 | def label(self): |
---|
| 82 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 83 | return translate(_('Admission Letter of'), |
---|
| 84 | 'waeup.kofa', target_language=portal_language) \ |
---|
| 85 | + ' %s' % self.context.display_fullname |
---|
| 86 | |
---|
| 87 | def render(self): |
---|
| 88 | students_utils = getUtility(IStudentsUtils) |
---|
| 89 | letterhead_path = os.path.join( |
---|
| 90 | os.path.dirname(__file__), 'static', 'letterhead_admission.jpg') |
---|
| 91 | if not os.path.exists(letterhead_path): |
---|
| 92 | letterhead_path = None |
---|
| 93 | return students_utils.renderPDFAdmissionLetter(self, |
---|
| 94 | self.context.student, omit_fields=self.omit_fields, |
---|
| 95 | letterhead_path=letterhead_path, post_text=self.post_text) |
---|
| 96 | |
---|
[16712] | 97 | |
---|
| 98 | class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip): |
---|
| 99 | """Deliver a PDF slip of the context. |
---|
| 100 | """ |
---|
| 101 | omit_fields = ('password', 'suspended', 'suspended_comment', 'phone', |
---|
| 102 | 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level', |
---|
| 103 | 'flash_notice', 'certificate', 'faculty', 'parents_email') |
---|
| 104 | |
---|
[16715] | 105 | class CustomPaymentsManageFormPage(PaymentsManageFormPage): |
---|
| 106 | """ Page to manage the student payments. This manage form page is for |
---|
| 107 | both students and students officers. EDOCONS does not allow students |
---|
| 108 | to remove any payment ticket. |
---|
| 109 | """ |
---|
| 110 | @property |
---|
| 111 | def manage_payments_allowed(self): |
---|
| 112 | return checkPermission('waeup.manageStudent', self.context) |
---|
| 113 | |
---|
[17153] | 114 | #class CustomBalancePaymentAddFormPage(BalancePaymentAddFormPage): |
---|
| 115 | # grok.require('waeup.payStudent') |
---|
[16796] | 116 | |
---|
[16846] | 117 | |
---|
| 118 | class CustomBedTicketAddPage(NigeriaBedTicketAddPage): |
---|
| 119 | with_ac = False |
---|