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

Last change on this file since 12406 was 10022, checked in by Henrik Bettermann, 12 years ago

show_viewlet must take the new SKIP_UPLOAD_VIEWLETS list into consideration.

  • Property svn:keywords set to Id
File size: 14.4 KB
RevLine 
[8862]1## $Id: viewlets.py 10022 2013-03-13 06:25:17Z 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
[8862]22from waeup.kofa.students.viewlets import (
23    FileDisplay, FileUpload, Image)
24from waeup.kofa.students.browser import ExportPDFClearanceSlipPage
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
39class AcceptanceLetterDisplay(FileDisplay):
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):
48    grok.view(ExportPDFClearanceSlipPage)
49
50class AcceptanceLetterUpload(FileUpload):
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
60class AcceptanceLetterImage(Image):
61    """Renders acceptance letter scan.
62    """
63    grok.name('acc_let')
64    download_name = u'acc_let'
65
[8862]66# LGA Identification
67
68class LGAIdentificationDisplay(FileDisplay):
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):
77    grok.view(ExportPDFClearanceSlipPage)
78
79class LGAIdentificationUpload(FileUpload):
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
88class LGAIdentificationImage(Image):
89    """Renders LGA Identification scan.
90    """
91    grok.name('lga_ident')
92    download_name = u'lga_ident'
93
94# First Sitting Result
95
96class FirstSittingResultDisplay(FileDisplay):
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):
105    grok.view(ExportPDFClearanceSlipPage)
106
107class FirstSittingResultUpload(FileUpload):
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
116class FirstSittingResultImage(Image):
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
124class SecondSittingResultDisplay(FileDisplay):
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):
133    grok.view(ExportPDFClearanceSlipPage)
134
135class SecondSittingResultUpload(FileUpload):
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
144class SecondSittingResultImage(Image):
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
152class HigherQualificationResultDisplay(FileDisplay):
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):
161    grok.view(ExportPDFClearanceSlipPage)
162
163class HigherQualificationResultUpload(FileUpload):
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
172class HigherQualificationResultImage(Image):
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
180class SecondHigherQualificationResultDisplay(FileDisplay):
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):
189    grok.view(ExportPDFClearanceSlipPage)
190
191class SecondHigherQualificationResultUpload(FileUpload):
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
204class SecondHigherQualificationResultImage(Image):
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
212class AdvancedLevelResultDisplay(FileDisplay):
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):
221    grok.view(ExportPDFClearanceSlipPage)
222
223class AdvancedLevelResultUpload(FileUpload):
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
232class AdvancedLevelResultImage(Image):
233    """Renders Advanced Level Result scan.
234    """
235    grok.name('alr_scan')
236    download_name = u'alr_scan'
237
[9381]238# Certificate
[8862]239
240class CertificateDisplay(FileDisplay):
[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):
249    grok.view(ExportPDFClearanceSlipPage)
250
251class CertificateUpload(FileUpload):
[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
260class CertificateImage(Image):
[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
268class SecondCertificateDisplay(FileDisplay):
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):
277    grok.view(ExportPDFClearanceSlipPage)
278
279class SecondCertificateUpload(FileUpload):
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
[9241]292class SecondCertificateImage(Image):
[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
300class ThirdCertificateDisplay(FileDisplay):
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):
309    grok.view(ExportPDFClearanceSlipPage)
310
311class ThirdCertificateUpload(FileUpload):
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
[9241]324class ThirdCertificateImage(Image):
[8862]325    """Renders Third Certificate scan.
326    """
[9236]327    grok.name('cert3')
328    download_name = u'cert3'
[8862]329
330# Evidence of Name
331
332class EvidenceNameDisplay(FileDisplay):
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):
341    grok.view(ExportPDFClearanceSlipPage)
342
343class EvidenceNameUpload(FileUpload):
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
352class EvidenceNameImage(Image):
353    """Renders Evidence of Name scan.
354    """
355    grok.name('evid')
356    download_name = u'evid'
357
358# Result Statement
359
360class ResultStatementDisplay(FileDisplay):
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):
369    grok.view(ExportPDFClearanceSlipPage)
370
371class ResultStatementUpload(FileUpload):
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
380class ResultStatementImage(Image):
381    """Renders Result Statement scan.
382    """
383    grok.name('res_stat')
384    download_name = u'res_stat'
385
386# Referee Letter
387
388class RefereeLetterDisplay(FileDisplay):
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):
397    grok.view(ExportPDFClearanceSlipPage)
398
399class RefereeLetterUpload(FileUpload):
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
408class RefereeLetterImage(Image):
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
416class SecondRefereeLetterDisplay(FileDisplay):
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):
425    grok.view(ExportPDFClearanceSlipPage)
426
427class SecondRefereeLetterUpload(FileUpload):
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
440class SecondRefereeLetterImage(Image):
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
448class ThirdRefereeLetterDisplay(FileDisplay):
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):
457    grok.view(ExportPDFClearanceSlipPage)
458
459class ThirdRefereeLetterUpload(FileUpload):
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
472class ThirdRefereeLetterImage(Image):
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
480class StatutoryDeclarationDisplay(FileDisplay):
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):
489    grok.view(ExportPDFClearanceSlipPage)
490
491class StatutoryDeclarationUpload(FileUpload):
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
500class StatutoryDeclarationImage(Image):
[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
508class LetterAdmissionDisplay(FileDisplay):
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):
517    grok.view(ExportPDFClearanceSlipPage)
518
519class LetterAdmissionUpload(FileUpload):
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
532class LetterAdmissionImage(Image):
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.