## $Id: viewlets.py 17866 2024-08-01 11:02:51Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import grok from zope.component import getUtility from waeup.kofa.interfaces import IExtFileStore from waeup.kofa.browser.viewlets import ManageActionButton from waeup.kofa.students.interfaces import IStudentsUtils from waeup.kofa.students.viewlets import ( PaymentReceiptActionButton,) from waeup.kofa.students.fileviewlets import ( StudentFileDisplay, StudentFileUpload, StudentImage) from waeup.kofa.students.browser import ExportPDFClearanceSlip from kofacustom.nigeria.students.interfaces import ( INigeriaStudent, INigeriaStudentOnlinePayment) from kofacustom.nigeria.students.browser import NigeriaStudentBaseDisplayFormPage from kofacustom.nigeria.interfaces import MessageFactory as _ def show_viewlet(viewlet): students_utils = getUtility(IStudentsUtils) if viewlet.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS: return False cm = getattr(viewlet.context,'current_mode', None) if cm is not None and cm.startswith('pg'): return True return False class PaymentReceiptActionButton(PaymentReceiptActionButton): grok.order(4) grok.context(INigeriaStudentOnlinePayment) @property def target_url(self): if not self.context.p_state in ('paid', 'waived', 'scholarship') \ and not self.context.r_company: return '' return self.view.url(self.view.context, self.target) # Financial Clearance Officer buttons class StudentFinanciallyClearActionButton(ManageActionButton): grok.order(10) grok.context(INigeriaStudent) grok.view(NigeriaStudentBaseDisplayFormPage) grok.require('waeup.clearStudentFinancially') text = _('Clear student financially') target = 'clear_financially' icon = 'actionicon_accept.png' @property def target_url(self): if self.context.financially_cleared_by: return '' return self.view.url(self.view.context, self.target) class StudentWithdrawFinancialClearanceActionButton(ManageActionButton): grok.order(11) grok.context(INigeriaStudent) grok.view(NigeriaStudentBaseDisplayFormPage) grok.require('waeup.clearStudentFinancially') text = _('Withdraw financial clearance') target = 'withdraw_financial_clearance' icon = 'actionicon_reject.png' @property def target_url(self): if not self.context.financially_cleared_by: return '' return self.view.url(self.view.context, self.target) class FinancialClearanceSlipActionButton(ManageActionButton): grok.order(12) grok.context(INigeriaStudent) grok.view(NigeriaStudentBaseDisplayFormPage) grok.require('waeup.viewStudent') text = _('Download fee payment history') target = 'fee_payment_history.pdf' icon = 'actionicon_pdf.png' # Final Clearance Officer buttons class StudentFinallyClearActionButton(ManageActionButton): grok.order(13) grok.context(INigeriaStudent) grok.view(NigeriaStudentBaseDisplayFormPage) grok.require('waeup.clearStudentFinally') text = _('Clear student finally') target = 'clear_finally' icon = 'actionicon_accept.png' @property def target_url(self): if self.context.finally_cleared_by: return '' return self.view.url(self.view.context, self.target) class StudentWithdrawFinalClearanceActionButton(ManageActionButton): grok.order(14) grok.context(INigeriaStudent) grok.view(NigeriaStudentBaseDisplayFormPage) grok.require('waeup.clearStudentFinally') text = _('Withdraw final clearance') target = 'withdraw_final_clearance' icon = 'actionicon_reject.png' @property def target_url(self): if not self.context.finally_cleared_by: return '' return self.view.url(self.view.context, self.target) # Acceptance Letter class AcceptanceLetterDisplay(StudentFileDisplay): """Acceptance Letter display viewlet. """ grok.order(2) label = _(u'Acceptance Letter') title = _(u'Acceptance Letter Scan') download_name = u'acc_let' class AcceptanceLetterSlip(AcceptanceLetterDisplay): grok.view(ExportPDFClearanceSlip) class AcceptanceLetterUpload(StudentFileUpload): """AcceptanceLetter upload viewlet. """ grok.order(2) label = _(u'Acceptance Letter') title = _(u'Acceptance Letter Scan') download_name = u'acc_let' tab_redirect = '?tab2' class AcceptanceLetterImage(StudentImage): """Renders acceptance letter scan. """ grok.name('acc_let') download_name = u'acc_let' # LGA Identification class LGAIdentificationDisplay(StudentFileDisplay): """LGA Identification display viewlet. """ grok.order(3) label = _(u'LGA Identification') title = _(u'LGA Identification Scan') download_name = u'lga_ident' class LGAIdentificationSlip(LGAIdentificationDisplay): grok.view(ExportPDFClearanceSlip) class LGAIdentificationUpload(StudentFileUpload): """LGA Identification upload viewlet. """ grok.order(3) label = _(u'LGA Identification') title = _(u'LGA Identification Scan') download_name = u'lga_ident' class LGAIdentificationImage(StudentImage): """Renders LGA Identification scan. """ grok.name('lga_ident') download_name = u'lga_ident' # First Sitting Result class FirstSittingResultDisplay(StudentFileDisplay): """First Sitting Result display viewlet. """ grok.order(4) label = _(u'First Sitting Result') title = _(u'First Sitting Result') download_name = u'fst_sit_scan' class FirstSittingResultSlip(FirstSittingResultDisplay): grok.view(ExportPDFClearanceSlip) class FirstSittingResultUpload(StudentFileUpload): """First Sitting Result upload viewlet. """ grok.order(4) label = _(u'First Sitting Result') title = _(u'First Sitting Result Scan') download_name = u'fst_sit_scan' class FirstSittingResultImage(StudentImage): """Renders First Sitting Result scan. """ grok.name('fst_sit_scan') download_name = u'fst_sit_scan' # Second Sitting Result class SecondSittingResultDisplay(StudentFileDisplay): """Second Sitting Result display viewlet. """ grok.order(5) label = _(u'Second Sitting Result') title = _(u'Second Sitting Result') download_name = u'scd_sit_scan' class SecondSittingResultSlip(SecondSittingResultDisplay): grok.view(ExportPDFClearanceSlip) class SecondSittingResultUpload(StudentFileUpload): """Second Sitting Result upload viewlet. """ grok.order(5) label = _(u'Second Sitting Result') title = _(u'Second Sitting Result Scan') download_name = u'scd_sit_scan' class SecondSittingResultImage(StudentImage): """Renders Second Sitting Result scan. """ grok.name('scd_sit_scan') download_name = u'scd_sit_scan' # Higher Qualification Result class HigherQualificationResultDisplay(StudentFileDisplay): """Higher Qualification Result display viewlet. """ grok.order(6) label = _(u'Higher Qualification Result') title = _(u'Higher Qualification Result') download_name = u'hq_scan' class HigherQualificationResultSlip(HigherQualificationResultDisplay): grok.view(ExportPDFClearanceSlip) class HigherQualificationResultUpload(StudentFileUpload): """Higher Qualification Result upload viewlet. """ grok.order(6) label = _(u'Higher Qualification Result') title = _(u'Higher Qualification Result Scan') download_name = u'hq_scan' class HigherQualificationResultImage(StudentImage): """Renders Higher Qualification Result scan. """ grok.name('hq_scan') download_name = u'hq_scan' # 2nd Higher Qualification Result (PG Students only) class SecondHigherQualificationResultDisplay(StudentFileDisplay): """Second Higher Qualification Result display viewlet. """ grok.order(7) label = _(u'Second Higher Qualification Result') title = _(u'Second Higher Qualification Result') download_name = u'hq_scan2' class SecondHigherQualificationResultSlip(SecondHigherQualificationResultDisplay): grok.view(ExportPDFClearanceSlip) class SecondHigherQualificationResultUpload(StudentFileUpload): """Second Higher Qualification Result upload viewlet. """ grok.order(7) label = _(u'Second Higher Qualification Result') title = _(u'Second Higher Qualification Result Scan') download_name = u'hq_scan2' @property def show_viewlet(self): return show_viewlet(self) class SecondHigherQualificationResultImage(StudentImage): """Renders Second Higher Qualification Result scan. """ grok.name('hq_scan2') download_name = u'hq_scan2' # Advanced Level Result class AdvancedLevelResultDisplay(StudentFileDisplay): """Advanced Level Result display viewlet. """ grok.order(8) label = _(u'Advanced Level Result') title = _(u'Advanced Level Result') download_name = u'alr_scan' class AdvancedLevelResultSlip(AdvancedLevelResultDisplay): grok.view(ExportPDFClearanceSlip) class AdvancedLevelResultUpload(StudentFileUpload): """Advanced Level Result upload viewlet. """ grok.order(8) label = _(u'Advanced Level Result') title = _(u'Advanced Level Result Scan') download_name = u'alr_scan' class AdvancedLevelResultImage(StudentImage): """Renders Advanced Level Result scan. """ grok.name('alr_scan') download_name = u'alr_scan' # Certificate class CertificateDisplay(StudentFileDisplay): """Certificate display viewlet. """ grok.order(9) label = _(u'Certificate') title = _(u'Certificate') download_name = u'cert' class CertificateSlip(CertificateDisplay): grok.view(ExportPDFClearanceSlip) class CertificateUpload(StudentFileUpload): """Certificate upload viewlet. """ grok.order(9) label = _(u'Certificate') title = _(u'Certificate Scan') download_name = u'cert' class CertificateImage(StudentImage): """Renders Certificate scan. """ grok.name('cert') download_name = u'cert' # Second Certificate (PG Students only) class SecondCertificateDisplay(StudentFileDisplay): """ Second Certificate display viewlet. """ grok.order(10) label = _(u'Second Certificate') title = _(u'Second Certificate') download_name = u'cert2' class SecondCertificateSlip(SecondCertificateDisplay): grok.view(ExportPDFClearanceSlip) class SecondCertificateUpload(StudentFileUpload): """Second Certificate upload viewlet. """ grok.order(10) label = _(u'Second Certificate') title = _(u'Second Certificate Scan') download_name = u'cert2' @property def show_viewlet(self): return show_viewlet(self) class SecondCertificateImage(StudentImage): """Renders Second Certificate scan. """ grok.name('cert2') download_name = u'cert2' # Third Certificate (PG Students only) class ThirdCertificateDisplay(StudentFileDisplay): """ Third Certificate display viewlet. """ grok.order(11) label = _(u'Third Certificate') title = _(u'Third Certificate') download_name = u'cert3' class ThirdCertificateSlip(ThirdCertificateDisplay): grok.view(ExportPDFClearanceSlip) class ThirdCertificateUpload(StudentFileUpload): """Third Certificate upload viewlet. """ grok.order(11) label = _(u'Third Certificate') title = _(u'Third Certificate Scan') download_name = u'cert3' @property def show_viewlet(self): return show_viewlet(self) class ThirdCertificateImage(StudentImage): """Renders Third Certificate scan. """ grok.name('cert3') download_name = u'cert3' # Evidence of Name class EvidenceNameDisplay(StudentFileDisplay): """Evidence of Name display viewlet. """ grok.order(12) label = _(u'Evidence of Name') title = _(u'Evidence of Name') download_name = u'evid' class EvidenceNameSlip(EvidenceNameDisplay): grok.view(ExportPDFClearanceSlip) class EvidenceNameUpload(StudentFileUpload): """Evidence of Name upload viewlet. """ grok.order(12) label = _(u'Evidence of Name') title = _(u'Evidence of Name Scan') download_name = u'evid' class EvidenceNameImage(StudentImage): """Renders Evidence of Name scan. """ grok.name('evid') download_name = u'evid' # Result Statement class ResultStatementDisplay(StudentFileDisplay): """Result Statement display viewlet. """ grok.order(13) label = _(u'Result Statement') title = _(u'Result Statement') download_name = u'res_stat' class ResultStatementSlip(ResultStatementDisplay): grok.view(ExportPDFClearanceSlip) class ResultStatementUpload(StudentFileUpload): """Result Statement upload viewlet. """ grok.order(13) label = _(u'Result Statement') title = _(u'Result Statement Scan') download_name = u'res_stat' class ResultStatementImage(StudentImage): """Renders Result Statement scan. """ grok.name('res_stat') download_name = u'res_stat' # Referee Letter class RefereeLetterDisplay(StudentFileDisplay): """Referee Letter display viewlet. """ grok.order(14) label = _(u'Guarantor/Referee Letter') title = _(u'Guarantor/Referee Letter') download_name = u'ref_let' class RefereeLetterSlip(RefereeLetterDisplay): grok.view(ExportPDFClearanceSlip) class RefereeLetterUpload(StudentFileUpload): """Referee Letter upload viewlet. """ grok.order(14) label = _(u'Guarantor/Referee Letter') title = _(u'Guarantor/Referee Letter Scan') download_name = u'ref_let' class RefereeLetterImage(StudentImage): """Renders Referee Letter scan. """ grok.name('ref_let') download_name = u'ref_let' # Second Referee Letter (PG Students only) class SecondRefereeLetterDisplay(StudentFileDisplay): """Second Referee Letter display viewlet. """ grok.order(15) label = _(u'Second Referee Letter') title = _(u'Second Referee Letter') download_name = u'ref_let2' class SecondRefereeLetterSlip(SecondRefereeLetterDisplay): grok.view(ExportPDFClearanceSlip) class SecondRefereeLetterUpload(StudentFileUpload): """Referee Letter upload viewlet. """ grok.order(15) label = _(u'Second Referee Letter') title = _(u'Second Referee Letter Scan') download_name = u'ref_let2' @property def show_viewlet(self): return show_viewlet(self) class SecondRefereeLetterImage(StudentImage): """Renders Referee Letter scan. """ grok.name('ref_let2') download_name = u'ref_let2' # Third Referee Letter (PG Students only) class ThirdRefereeLetterDisplay(StudentFileDisplay): """Third Referee Letter display viewlet. """ grok.order(16) label = _(u'Third Referee Letter') title = _(u'Third Referee Letter') download_name = u'ref_let3' class ThirdRefereeLetterSlip(ThirdRefereeLetterDisplay): grok.view(ExportPDFClearanceSlip) class ThirdRefereeLetterUpload(StudentFileUpload): """Referee Letter upload viewlet. """ grok.order(16) label = _(u'Third Referee Letter') title = _(u'Third Referee Letter Scan') download_name = u'ref_let3' @property def show_viewlet(self): return show_viewlet(self) class ThirdRefereeLetterImage(StudentImage): """Renders Referee Letter scan. """ grok.name('ref_let3') download_name = u'ref_let3' # Affidavit (former Statutory Declaration) of Good Conduct class StatutoryDeclarationDisplay(StudentFileDisplay): """Statutory Declaration of Good Conduct display viewlet. """ grok.order(17) label = _(u'Affidavit of Good Conduct') title = _(u'Affidavit of Good Conduct') download_name = u'stat_dec' class StatutoryDeclarationSlip(StatutoryDeclarationDisplay): grok.view(ExportPDFClearanceSlip) class StatutoryDeclarationUpload(StudentFileUpload): """Statutory Declaration of Good Conduct upload viewlet. """ grok.order(17) label = _(u'Affidavit of Good Conduct') title = _(u'Affidavit of Good Conduct Scan') download_name = u'stat_dec' class StatutoryDeclarationImage(StudentImage): """Renders Affidavit of Good Conduct scan. """ grok.name('stat_dec') download_name = u'stat_dec' # Letter of Admission (PG Students only) class LetterAdmissionDisplay(StudentFileDisplay): """Letter of Admission display viewlet. """ grok.order(18) label = _(u'Letter of Admission') title = _(u'Letter of Admission') download_name = u'admission_let' class LetterAdmissionSlip(LetterAdmissionDisplay): grok.view(ExportPDFClearanceSlip) class LetterAdmissionUpload(StudentFileUpload): """Letter of Admission upload viewlet. """ grok.order(18) label = _(u'Letter of Admission') title = _(u'Letter of Admission Scan') download_name = u'admission_let' @property def show_viewlet(self): return show_viewlet(self) class LetterAdmissionImage(StudentImage): """Renders Letter of Admission scan. """ grok.name('admission_let') download_name = u'admission_let'