source: main/kofacustom.nigeria/branches/0.1/src/kofacustom/nigeria/students/viewlets.py @ 14086

Last change on this file since 14086 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
Line 
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
20from zope.component import getUtility
21from waeup.kofa.students.interfaces import IStudentsUtils
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
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
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
66# LGA Identification
67
68class LGAIdentificationDisplay(FileDisplay):
69    """LGA Identification display viewlet.
70    """
71    grok.order(3)
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    """
82    grok.order(3)
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    """
99    grok.order(4)
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    """
110    grok.order(4)
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    """
127    grok.order(5)
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    """
138    grok.order(5)
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    """
155    grok.order(6)
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    """
166    grok.order(6)
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    """
183    grok.order(7)
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    """
194    grok.order(7)
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):
202        return show_viewlet(self)
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    """
215    grok.order(8)
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    """
226    grok.order(8)
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
238# Certificate
239
240class CertificateDisplay(FileDisplay):
241    """Certificate display viewlet.
242    """
243    grok.order(9)
244    label = _(u'Certificate')
245    title = _(u'Certificate')
246    download_name = u'cert'
247
248class CertificateSlip(CertificateDisplay):
249    grok.view(ExportPDFClearanceSlipPage)
250
251class CertificateUpload(FileUpload):
252    """Certificate upload viewlet.
253    """
254    grok.order(9)
255    label = _(u'Certificate')
256    title = _(u'Certificate Scan')
257    mus = 1024 * 150
258    download_name = u'cert'
259
260class CertificateImage(Image):
261    """Renders Certificate scan.
262    """
263    grok.name('cert')
264    download_name = u'cert'
265
266# Second Certificate (PG Students only)
267
268class SecondCertificateDisplay(FileDisplay):
269    """ Second Certificate display viewlet.
270    """
271    grok.order(10)
272    label = _(u'Second Certificate')
273    title = _(u'Second Certificate')
274    download_name = u'cert2'
275
276class SecondCertificateSlip(SecondCertificateDisplay):
277    grok.view(ExportPDFClearanceSlipPage)
278
279class SecondCertificateUpload(FileUpload):
280    """Second Certificate upload viewlet.
281    """
282    grok.order(10)
283    label = _(u'Second Certificate')
284    title = _(u'Second Certificate Scan')
285    mus = 1024 * 150
286    download_name = u'cert2'
287
288    @property
289    def show_viewlet(self):
290        return show_viewlet(self)
291
292class SecondCertificateImage(Image):
293    """Renders Second Certificate scan.
294    """
295    grok.name('cert2')
296    download_name = u'cert2'
297
298# Third Certificate (PG Students only)
299
300class ThirdCertificateDisplay(FileDisplay):
301    """ Third Certificate display viewlet.
302    """
303    grok.order(11)
304    label = _(u'Third Certificate')
305    title = _(u'Third Certificate')
306    download_name = u'cert3'
307
308class ThirdCertificateSlip(ThirdCertificateDisplay):
309    grok.view(ExportPDFClearanceSlipPage)
310
311class ThirdCertificateUpload(FileUpload):
312    """Third Certificate upload viewlet.
313    """
314    grok.order(11)
315    label = _(u'Third Certificate')
316    title = _(u'Third Certificate Scan')
317    mus = 1024 * 150
318    download_name = u'cert3'
319
320    @property
321    def show_viewlet(self):
322        return show_viewlet(self)
323
324class ThirdCertificateImage(Image):
325    """Renders Third Certificate scan.
326    """
327    grok.name('cert3')
328    download_name = u'cert3'
329
330# Evidence of Name
331
332class EvidenceNameDisplay(FileDisplay):
333    """Evidence of Name display viewlet.
334    """
335    grok.order(12)
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    """
346    grok.order(12)
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    """
363    grok.order(13)
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    """
374    grok.order(13)
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    """
391    grok.order(14)
392    label = _(u'Guarantor/Referee Letter')
393    title = _(u'Guarantor/Referee Letter')
394    download_name = u'ref_let'
395
396class RefereeLetterSlip(RefereeLetterDisplay):
397    grok.view(ExportPDFClearanceSlipPage)
398
399class RefereeLetterUpload(FileUpload):
400    """Referee Letter upload viewlet.
401    """
402    grok.order(14)
403    label = _(u'Guarantor/Referee Letter')
404    title = _(u'Guarantor/Referee Letter Scan')
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    """
419    grok.order(15)
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    """
430    grok.order(15)
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):
438        return show_viewlet(self)
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    """
451    grok.order(16)
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    """
462    grok.order(16)
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):
470        return show_viewlet(self)
471
472class ThirdRefereeLetterImage(Image):
473    """Renders Referee Letter scan.
474    """
475    grok.name('ref_let3')
476    download_name = u'ref_let3'
477
478# Affidavit (former Statutory Declaration) of Good Conduct
479
480class StatutoryDeclarationDisplay(FileDisplay):
481    """Statutory Declaration of Good Conduct display viewlet.
482    """
483    grok.order(17)
484    label = _(u'Affidavit of Good Conduct')
485    title = _(u'Affidavit of Good Conduct')
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    """
494    grok.order(17)
495    label = _(u'Affidavit of Good Conduct')
496    title = _(u'Affidavit of Good Conduct Scan')
497    mus = 1024 * 150
498    download_name = u'stat_dec'
499
500class StatutoryDeclarationImage(Image):
501    """Renders Affidavit of Good Conduct scan.
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    """
511    grok.order(18)
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    """
522    grok.order(18)
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):
530        return show_viewlet(self)
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.