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

Last change on this file since 13606 was 13058, checked in by Henrik Bettermann, 9 years ago

Rename views according to changes in base package.

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