source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/viewlets.py @ 17839

Last change on this file since 17839 was 17813, checked in by Henrik Bettermann, 8 months ago

Remove unused import.

  • Property svn:keywords set to Id
File size: 16.4 KB
RevLine 
[8862]1## $Id: viewlets.py 17813 2024-06-06 11:28:19Z henrik $
2##
3## Copyright (C) 2011 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
19import grok
[10022]20from zope.component import getUtility
[15826]21from waeup.kofa.interfaces import IExtFileStore
[13620]22from waeup.kofa.browser.viewlets import ManageActionButton
[10022]23from waeup.kofa.students.interfaces import IStudentsUtils
[15826]24from waeup.kofa.students.viewlets import (
[17813]25    PaymentReceiptActionButton,)
[12422]26from waeup.kofa.students.fileviewlets import (
[12449]27    StudentFileDisplay, StudentFileUpload, StudentImage)
[13058]28from waeup.kofa.students.browser import ExportPDFClearanceSlip
[15826]29from kofacustom.nigeria.students.interfaces import (
30    INigeriaStudent, INigeriaStudentOnlinePayment)
[13620]31from kofacustom.nigeria.students.browser import NigeriaStudentBaseDisplayFormPage
[8862]32from kofacustom.nigeria.interfaces import MessageFactory as _
33
[10022]34def show_viewlet(viewlet):
35    students_utils = getUtility(IStudentsUtils)
36    if viewlet.__name__ in students_utils.SKIP_UPLOAD_VIEWLETS:
37        return False
38    cm = getattr(viewlet.context,'current_mode', None)
39    if cm is not None and cm.startswith('pg'):
40        return True
41    return False
42
[15826]43class PaymentReceiptActionButton(PaymentReceiptActionButton):
44    grok.order(4)
45    grok.context(INigeriaStudentOnlinePayment)
46
47    @property
48    def target_url(self):
[15846]49        if not self.context.p_state in ('paid', 'waived', 'scholarship') \
[15842]50            and not self.context.r_company:
[15826]51            return ''
52        return self.view.url(self.view.context, self.target)
53
[13856]54# Financial Clearance Officer buttons
[13620]55
[13856]56class StudentFinanciallyClearActionButton(ManageActionButton):
[13620]57    grok.order(10)
58    grok.context(INigeriaStudent)
59    grok.view(NigeriaStudentBaseDisplayFormPage)
60    grok.require('waeup.clearStudentFinancially')
61    text = _('Clear student financially')
62    target = 'clear_financially'
63    icon = 'actionicon_accept.png'
64
65    @property
66    def target_url(self):
67        if self.context.financially_cleared_by:
68            return ''
69        return self.view.url(self.view.context, self.target)
70
[13856]71class StudentWithdrawFinancialClearanceActionButton(ManageActionButton):
[13620]72    grok.order(11)
73    grok.context(INigeriaStudent)
74    grok.view(NigeriaStudentBaseDisplayFormPage)
75    grok.require('waeup.clearStudentFinancially')
76    text = _('Withdraw financial clearance')
77    target = 'withdraw_financial_clearance'
78    icon = 'actionicon_reject.png'
79
80    @property
81    def target_url(self):
82        if not self.context.financially_cleared_by:
83            return ''
84        return self.view.url(self.view.context, self.target)
85
[13634]86class FinancialClearanceSlipActionButton(ManageActionButton):
[13623]87    grok.order(12)
88    grok.context(INigeriaStudent)
89    grok.view(NigeriaStudentBaseDisplayFormPage)
90    grok.require('waeup.viewStudent')
[13781]91    text = _('Download fee payment history')
92    target = 'fee_payment_history.pdf'
[13623]93    icon = 'actionicon_pdf.png'
[13620]94
[9236]95# Acceptance Letter
96
[12449]97class AcceptanceLetterDisplay(StudentFileDisplay):
[9236]98    """Acceptance Letter display viewlet.
99    """
100    grok.order(2)
101    label = _(u'Acceptance Letter')
102    title = _(u'Acceptance Letter Scan')
103    download_name = u'acc_let'
104
105class AcceptanceLetterSlip(AcceptanceLetterDisplay):
[13058]106    grok.view(ExportPDFClearanceSlip)
[9236]107
[12449]108class AcceptanceLetterUpload(StudentFileUpload):
[9236]109    """AcceptanceLetter upload viewlet.
110    """
111    grok.order(2)
112    label = _(u'Acceptance Letter')
113    title = _(u'Acceptance Letter Scan')
114    download_name = u'acc_let'
115    tab_redirect = '?tab2'
116
[12449]117class AcceptanceLetterImage(StudentImage):
[9236]118    """Renders acceptance letter scan.
119    """
120    grok.name('acc_let')
121    download_name = u'acc_let'
122
[8862]123# LGA Identification
124
[12449]125class LGAIdentificationDisplay(StudentFileDisplay):
[8862]126    """LGA Identification display viewlet.
127    """
[9236]128    grok.order(3)
[8862]129    label = _(u'LGA Identification')
130    title = _(u'LGA Identification Scan')
131    download_name = u'lga_ident'
132
133class LGAIdentificationSlip(LGAIdentificationDisplay):
[13058]134    grok.view(ExportPDFClearanceSlip)
[8862]135
[12449]136class LGAIdentificationUpload(StudentFileUpload):
[8862]137    """LGA Identification upload viewlet.
138    """
[9236]139    grok.order(3)
[8862]140    label = _(u'LGA Identification')
141    title = _(u'LGA Identification Scan')
142    download_name = u'lga_ident'
143
[12449]144class LGAIdentificationImage(StudentImage):
[8862]145    """Renders LGA Identification scan.
146    """
147    grok.name('lga_ident')
148    download_name = u'lga_ident'
149
150# First Sitting Result
151
[12449]152class FirstSittingResultDisplay(StudentFileDisplay):
[8862]153    """First Sitting Result display viewlet.
154    """
[9236]155    grok.order(4)
[8862]156    label = _(u'First Sitting Result')
157    title = _(u'First Sitting Result')
158    download_name = u'fst_sit_scan'
159
160class FirstSittingResultSlip(FirstSittingResultDisplay):
[13058]161    grok.view(ExportPDFClearanceSlip)
[8862]162
[12449]163class FirstSittingResultUpload(StudentFileUpload):
[8862]164    """First Sitting Result upload viewlet.
165    """
[9236]166    grok.order(4)
[8862]167    label = _(u'First Sitting Result')
168    title = _(u'First Sitting Result Scan')
169    download_name = u'fst_sit_scan'
170
[12449]171class FirstSittingResultImage(StudentImage):
[8862]172    """Renders First Sitting Result scan.
173    """
174    grok.name('fst_sit_scan')
175    download_name = u'fst_sit_scan'
176
177# Second Sitting Result
178
[12449]179class SecondSittingResultDisplay(StudentFileDisplay):
[8862]180    """Second Sitting Result display viewlet.
181    """
[9236]182    grok.order(5)
[8862]183    label = _(u'Second Sitting Result')
184    title = _(u'Second Sitting Result')
185    download_name = u'scd_sit_scan'
186
187class SecondSittingResultSlip(SecondSittingResultDisplay):
[13058]188    grok.view(ExportPDFClearanceSlip)
[8862]189
[12449]190class SecondSittingResultUpload(StudentFileUpload):
[8862]191    """Second Sitting Result upload viewlet.
192    """
[9236]193    grok.order(5)
[8862]194    label = _(u'Second Sitting Result')
195    title = _(u'Second Sitting Result Scan')
196    download_name = u'scd_sit_scan'
197
[12449]198class SecondSittingResultImage(StudentImage):
[8862]199    """Renders Second Sitting Result scan.
200    """
201    grok.name('scd_sit_scan')
202    download_name = u'scd_sit_scan'
203
204# Higher Qualification Result
205
[12449]206class HigherQualificationResultDisplay(StudentFileDisplay):
[8862]207    """Higher Qualification Result display viewlet.
208    """
[9236]209    grok.order(6)
[8862]210    label = _(u'Higher Qualification Result')
211    title = _(u'Higher Qualification Result')
212    download_name = u'hq_scan'
213
214class HigherQualificationResultSlip(HigherQualificationResultDisplay):
[13058]215    grok.view(ExportPDFClearanceSlip)
[8862]216
[12449]217class HigherQualificationResultUpload(StudentFileUpload):
[8862]218    """Higher Qualification Result upload viewlet.
219    """
[9236]220    grok.order(6)
[8862]221    label = _(u'Higher Qualification Result')
222    title = _(u'Higher Qualification Result Scan')
223    download_name = u'hq_scan'
224
[12449]225class HigherQualificationResultImage(StudentImage):
[8862]226    """Renders Higher Qualification Result scan.
227    """
228    grok.name('hq_scan')
229    download_name = u'hq_scan'
230
231# 2nd Higher Qualification Result (PG Students only)
232
[12449]233class SecondHigherQualificationResultDisplay(StudentFileDisplay):
[8862]234    """Second Higher Qualification Result display viewlet.
235    """
[9236]236    grok.order(7)
[8862]237    label = _(u'Second Higher Qualification Result')
238    title = _(u'Second Higher Qualification Result')
239    download_name = u'hq_scan2'
240
241class SecondHigherQualificationResultSlip(SecondHigherQualificationResultDisplay):
[13058]242    grok.view(ExportPDFClearanceSlip)
[8862]243
[12449]244class SecondHigherQualificationResultUpload(StudentFileUpload):
[8862]245    """Second Higher Qualification Result upload viewlet.
246    """
[9236]247    grok.order(7)
[8862]248    label = _(u'Second Higher Qualification Result')
249    title = _(u'Second Higher Qualification Result Scan')
250    download_name = u'hq_scan2'
251
252    @property
253    def show_viewlet(self):
[10022]254        return show_viewlet(self)
[8862]255
[12449]256class SecondHigherQualificationResultImage(StudentImage):
[8862]257    """Renders Second Higher Qualification Result scan.
258    """
259    grok.name('hq_scan2')
260    download_name = u'hq_scan2'
261
262# Advanced Level Result
263
[12449]264class AdvancedLevelResultDisplay(StudentFileDisplay):
[8862]265    """Advanced Level Result display viewlet.
266    """
[9236]267    grok.order(8)
[8862]268    label = _(u'Advanced Level Result')
269    title = _(u'Advanced Level Result')
270    download_name = u'alr_scan'
271
272class AdvancedLevelResultSlip(AdvancedLevelResultDisplay):
[13058]273    grok.view(ExportPDFClearanceSlip)
[8862]274
[12449]275class AdvancedLevelResultUpload(StudentFileUpload):
[8862]276    """Advanced Level Result upload viewlet.
277    """
[9236]278    grok.order(8)
[8862]279    label = _(u'Advanced Level Result')
280    title = _(u'Advanced Level Result Scan')
281    download_name = u'alr_scan'
282
[12449]283class AdvancedLevelResultImage(StudentImage):
[8862]284    """Renders Advanced Level Result scan.
285    """
286    grok.name('alr_scan')
287    download_name = u'alr_scan'
288
[9381]289# Certificate
[8862]290
[12449]291class CertificateDisplay(StudentFileDisplay):
[9381]292    """Certificate display viewlet.
[8862]293    """
[9236]294    grok.order(9)
[9381]295    label = _(u'Certificate')
296    title = _(u'Certificate')
[9236]297    download_name = u'cert'
[8862]298
299class CertificateSlip(CertificateDisplay):
[13058]300    grok.view(ExportPDFClearanceSlip)
[8862]301
[12449]302class CertificateUpload(StudentFileUpload):
[9381]303    """Certificate upload viewlet.
[8862]304    """
[9236]305    grok.order(9)
[9381]306    label = _(u'Certificate')
307    title = _(u'Certificate Scan')
[9236]308    download_name = u'cert'
[8862]309
[12449]310class CertificateImage(StudentImage):
[9381]311    """Renders Certificate scan.
[8862]312    """
[9236]313    grok.name('cert')
314    download_name = u'cert'
[8862]315
316# Second Certificate (PG Students only)
317
[12449]318class SecondCertificateDisplay(StudentFileDisplay):
[8862]319    """ Second Certificate display viewlet.
320    """
[9236]321    grok.order(10)
[8862]322    label = _(u'Second Certificate')
323    title = _(u'Second Certificate')
[9236]324    download_name = u'cert2'
[8862]325
326class SecondCertificateSlip(SecondCertificateDisplay):
[13058]327    grok.view(ExportPDFClearanceSlip)
[8862]328
[12449]329class SecondCertificateUpload(StudentFileUpload):
[8862]330    """Second Certificate upload viewlet.
331    """
[9236]332    grok.order(10)
[8862]333    label = _(u'Second Certificate')
334    title = _(u'Second Certificate Scan')
[9236]335    download_name = u'cert2'
[8862]336
337    @property
338    def show_viewlet(self):
[10022]339        return show_viewlet(self)
[8862]340
[12449]341class SecondCertificateImage(StudentImage):
[8862]342    """Renders Second Certificate scan.
343    """
[9236]344    grok.name('cert2')
345    download_name = u'cert2'
[8862]346
347# Third Certificate (PG Students only)
348
[12449]349class ThirdCertificateDisplay(StudentFileDisplay):
[8862]350    """ Third Certificate display viewlet.
351    """
[9236]352    grok.order(11)
[8862]353    label = _(u'Third Certificate')
354    title = _(u'Third Certificate')
[9236]355    download_name = u'cert3'
[8862]356
357class ThirdCertificateSlip(ThirdCertificateDisplay):
[13058]358    grok.view(ExportPDFClearanceSlip)
[8862]359
[12449]360class ThirdCertificateUpload(StudentFileUpload):
[8862]361    """Third Certificate upload viewlet.
362    """
[9236]363    grok.order(11)
[8862]364    label = _(u'Third Certificate')
365    title = _(u'Third Certificate Scan')
[9236]366    download_name = u'cert3'
[8862]367
368    @property
369    def show_viewlet(self):
[10022]370        return show_viewlet(self)
[8862]371
[12449]372class ThirdCertificateImage(StudentImage):
[8862]373    """Renders Third Certificate scan.
374    """
[9236]375    grok.name('cert3')
376    download_name = u'cert3'
[8862]377
378# Evidence of Name
379
[12449]380class EvidenceNameDisplay(StudentFileDisplay):
[8862]381    """Evidence of Name display viewlet.
382    """
[9236]383    grok.order(12)
[8862]384    label = _(u'Evidence of Name')
385    title = _(u'Evidence of Name')
386    download_name = u'evid'
387
388class EvidenceNameSlip(EvidenceNameDisplay):
[13058]389    grok.view(ExportPDFClearanceSlip)
[8862]390
[12449]391class EvidenceNameUpload(StudentFileUpload):
[8862]392    """Evidence of Name upload viewlet.
393    """
[9236]394    grok.order(12)
[8862]395    label = _(u'Evidence of Name')
396    title = _(u'Evidence of Name Scan')
397    download_name = u'evid'
398
[12449]399class EvidenceNameImage(StudentImage):
[8862]400    """Renders Evidence of Name scan.
401    """
402    grok.name('evid')
403    download_name = u'evid'
404
405# Result Statement
406
[12449]407class ResultStatementDisplay(StudentFileDisplay):
[8862]408    """Result Statement display viewlet.
409    """
[9236]410    grok.order(13)
[8862]411    label = _(u'Result Statement')
412    title = _(u'Result Statement')
413    download_name = u'res_stat'
414
415class ResultStatementSlip(ResultStatementDisplay):
[13058]416    grok.view(ExportPDFClearanceSlip)
[8862]417
[12449]418class ResultStatementUpload(StudentFileUpload):
[8862]419    """Result Statement upload viewlet.
420    """
[9236]421    grok.order(13)
[8862]422    label = _(u'Result Statement')
423    title = _(u'Result Statement Scan')
424    download_name = u'res_stat'
425
[12449]426class ResultStatementImage(StudentImage):
[8862]427    """Renders Result Statement scan.
428    """
429    grok.name('res_stat')
430    download_name = u'res_stat'
431
432# Referee Letter
433
[12449]434class RefereeLetterDisplay(StudentFileDisplay):
[8862]435    """Referee Letter display viewlet.
436    """
[9236]437    grok.order(14)
[9377]438    label = _(u'Guarantor/Referee Letter')
439    title = _(u'Guarantor/Referee Letter')
[8862]440    download_name = u'ref_let'
441
442class RefereeLetterSlip(RefereeLetterDisplay):
[13058]443    grok.view(ExportPDFClearanceSlip)
[8862]444
[12449]445class RefereeLetterUpload(StudentFileUpload):
[8862]446    """Referee Letter upload viewlet.
447    """
[9236]448    grok.order(14)
[9377]449    label = _(u'Guarantor/Referee Letter')
450    title = _(u'Guarantor/Referee Letter Scan')
[8862]451    download_name = u'ref_let'
452
[12449]453class RefereeLetterImage(StudentImage):
[8862]454    """Renders Referee Letter scan.
455    """
456    grok.name('ref_let')
457    download_name = u'ref_let'
458
459# Second Referee Letter (PG Students only)
460
[12449]461class SecondRefereeLetterDisplay(StudentFileDisplay):
[8862]462    """Second Referee Letter display viewlet.
463    """
[9236]464    grok.order(15)
[8862]465    label = _(u'Second Referee Letter')
466    title = _(u'Second Referee Letter')
467    download_name = u'ref_let2'
468
469class SecondRefereeLetterSlip(SecondRefereeLetterDisplay):
[13058]470    grok.view(ExportPDFClearanceSlip)
[8862]471
[12449]472class SecondRefereeLetterUpload(StudentFileUpload):
[8862]473    """Referee Letter upload viewlet.
474    """
[9236]475    grok.order(15)
[8862]476    label = _(u'Second Referee Letter')
477    title = _(u'Second Referee Letter Scan')
478    download_name = u'ref_let2'
479
480    @property
481    def show_viewlet(self):
[10022]482        return show_viewlet(self)
[8862]483
[12449]484class SecondRefereeLetterImage(StudentImage):
[8862]485    """Renders Referee Letter scan.
486    """
487    grok.name('ref_let2')
488    download_name = u'ref_let2'
489
490# Third Referee Letter (PG Students only)
491
[12449]492class ThirdRefereeLetterDisplay(StudentFileDisplay):
[8862]493    """Third Referee Letter display viewlet.
494    """
[9236]495    grok.order(16)
[8862]496    label = _(u'Third Referee Letter')
497    title = _(u'Third Referee Letter')
498    download_name = u'ref_let3'
499
500class ThirdRefereeLetterSlip(ThirdRefereeLetterDisplay):
[13058]501    grok.view(ExportPDFClearanceSlip)
[8862]502
[12449]503class ThirdRefereeLetterUpload(StudentFileUpload):
[8862]504    """Referee Letter upload viewlet.
505    """
[9236]506    grok.order(16)
[8862]507    label = _(u'Third Referee Letter')
508    title = _(u'Third Referee Letter Scan')
509    download_name = u'ref_let3'
510
511    @property
512    def show_viewlet(self):
[10022]513        return show_viewlet(self)
[8862]514
[12449]515class ThirdRefereeLetterImage(StudentImage):
[8862]516    """Renders Referee Letter scan.
517    """
518    grok.name('ref_let3')
519    download_name = u'ref_let3'
520
[9377]521# Affidavit (former Statutory Declaration) of Good Conduct
[8862]522
[12449]523class StatutoryDeclarationDisplay(StudentFileDisplay):
[8862]524    """Statutory Declaration of Good Conduct display viewlet.
525    """
[9236]526    grok.order(17)
[9377]527    label = _(u'Affidavit of Good Conduct')
528    title = _(u'Affidavit of Good Conduct')
[8862]529    download_name = u'stat_dec'
530
531class StatutoryDeclarationSlip(StatutoryDeclarationDisplay):
[13058]532    grok.view(ExportPDFClearanceSlip)
[8862]533
[12449]534class StatutoryDeclarationUpload(StudentFileUpload):
[8862]535    """Statutory Declaration of Good Conduct upload viewlet.
536    """
[9236]537    grok.order(17)
[9377]538    label = _(u'Affidavit of Good Conduct')
539    title = _(u'Affidavit of Good Conduct Scan')
[8862]540    download_name = u'stat_dec'
541
[12449]542class StatutoryDeclarationImage(StudentImage):
[9377]543    """Renders Affidavit of Good Conduct scan.
[8862]544    """
545    grok.name('stat_dec')
546    download_name = u'stat_dec'
547
548# Letter of Admission (PG Students only)
549
[12449]550class LetterAdmissionDisplay(StudentFileDisplay):
[8862]551    """Letter of Admission display viewlet.
552    """
[9381]553    grok.order(18)
[8862]554    label = _(u'Letter of Admission')
555    title = _(u'Letter of Admission')
556    download_name = u'admission_let'
557
558class LetterAdmissionSlip(LetterAdmissionDisplay):
[13058]559    grok.view(ExportPDFClearanceSlip)
[8862]560
[12449]561class LetterAdmissionUpload(StudentFileUpload):
[8862]562    """Letter of Admission upload viewlet.
563    """
[9381]564    grok.order(18)
[8862]565    label = _(u'Letter of Admission')
566    title = _(u'Letter of Admission Scan')
567    download_name = u'admission_let'
568
569    @property
570    def show_viewlet(self):
[10022]571        return show_viewlet(self)
[8862]572
[12449]573class LetterAdmissionImage(StudentImage):
[8862]574    """Renders Letter of Admission scan.
575    """
576    grok.name('admission_let')
577    download_name = u'admission_let'
Note: See TracBrowser for help on using the repository browser.