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 | |
---|
19 | import grok |
---|
20 | from zope.component import getUtility |
---|
21 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
22 | from waeup.kofa.students.viewlets import ( |
---|
23 | FileDisplay, FileUpload, Image) |
---|
24 | from waeup.kofa.students.browser import ExportPDFClearanceSlipPage |
---|
25 | |
---|
26 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
27 | |
---|
28 | def 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 | |
---|
39 | class 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 | |
---|
47 | class AcceptanceLetterSlip(AcceptanceLetterDisplay): |
---|
48 | grok.view(ExportPDFClearanceSlipPage) |
---|
49 | |
---|
50 | class 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 | |
---|
60 | class AcceptanceLetterImage(Image): |
---|
61 | """Renders acceptance letter scan. |
---|
62 | """ |
---|
63 | grok.name('acc_let') |
---|
64 | download_name = u'acc_let' |
---|
65 | |
---|
66 | # LGA Identification |
---|
67 | |
---|
68 | class 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 | |
---|
76 | class LGAIdentificationSlip(LGAIdentificationDisplay): |
---|
77 | grok.view(ExportPDFClearanceSlipPage) |
---|
78 | |
---|
79 | class 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 | |
---|
88 | class 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 | |
---|
96 | class 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 | |
---|
104 | class FirstSittingResultSlip(FirstSittingResultDisplay): |
---|
105 | grok.view(ExportPDFClearanceSlipPage) |
---|
106 | |
---|
107 | class 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 | |
---|
116 | class 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 | |
---|
124 | class 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 | |
---|
132 | class SecondSittingResultSlip(SecondSittingResultDisplay): |
---|
133 | grok.view(ExportPDFClearanceSlipPage) |
---|
134 | |
---|
135 | class 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 | |
---|
144 | class 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 | |
---|
152 | class 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 | |
---|
160 | class HigherQualificationResultSlip(HigherQualificationResultDisplay): |
---|
161 | grok.view(ExportPDFClearanceSlipPage) |
---|
162 | |
---|
163 | class 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 | |
---|
172 | class 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 | |
---|
180 | class 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 | |
---|
188 | class SecondHigherQualificationResultSlip(SecondHigherQualificationResultDisplay): |
---|
189 | grok.view(ExportPDFClearanceSlipPage) |
---|
190 | |
---|
191 | class 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 | |
---|
204 | class 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 | |
---|
212 | class 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 | |
---|
220 | class AdvancedLevelResultSlip(AdvancedLevelResultDisplay): |
---|
221 | grok.view(ExportPDFClearanceSlipPage) |
---|
222 | |
---|
223 | class 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 | |
---|
232 | class AdvancedLevelResultImage(Image): |
---|
233 | """Renders Advanced Level Result scan. |
---|
234 | """ |
---|
235 | grok.name('alr_scan') |
---|
236 | download_name = u'alr_scan' |
---|
237 | |
---|
238 | # Certificate |
---|
239 | |
---|
240 | class 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 | |
---|
248 | class CertificateSlip(CertificateDisplay): |
---|
249 | grok.view(ExportPDFClearanceSlipPage) |
---|
250 | |
---|
251 | class 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 | |
---|
260 | class CertificateImage(Image): |
---|
261 | """Renders Certificate scan. |
---|
262 | """ |
---|
263 | grok.name('cert') |
---|
264 | download_name = u'cert' |
---|
265 | |
---|
266 | # Second Certificate (PG Students only) |
---|
267 | |
---|
268 | class 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 | |
---|
276 | class SecondCertificateSlip(SecondCertificateDisplay): |
---|
277 | grok.view(ExportPDFClearanceSlipPage) |
---|
278 | |
---|
279 | class 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 | |
---|
292 | class 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 | |
---|
300 | class 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 | |
---|
308 | class ThirdCertificateSlip(ThirdCertificateDisplay): |
---|
309 | grok.view(ExportPDFClearanceSlipPage) |
---|
310 | |
---|
311 | class 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 | |
---|
324 | class ThirdCertificateImage(Image): |
---|
325 | """Renders Third Certificate scan. |
---|
326 | """ |
---|
327 | grok.name('cert3') |
---|
328 | download_name = u'cert3' |
---|
329 | |
---|
330 | # Evidence of Name |
---|
331 | |
---|
332 | class 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 | |
---|
340 | class EvidenceNameSlip(EvidenceNameDisplay): |
---|
341 | grok.view(ExportPDFClearanceSlipPage) |
---|
342 | |
---|
343 | class 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 | |
---|
352 | class EvidenceNameImage(Image): |
---|
353 | """Renders Evidence of Name scan. |
---|
354 | """ |
---|
355 | grok.name('evid') |
---|
356 | download_name = u'evid' |
---|
357 | |
---|
358 | # Result Statement |
---|
359 | |
---|
360 | class 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 | |
---|
368 | class ResultStatementSlip(ResultStatementDisplay): |
---|
369 | grok.view(ExportPDFClearanceSlipPage) |
---|
370 | |
---|
371 | class 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 | |
---|
380 | class ResultStatementImage(Image): |
---|
381 | """Renders Result Statement scan. |
---|
382 | """ |
---|
383 | grok.name('res_stat') |
---|
384 | download_name = u'res_stat' |
---|
385 | |
---|
386 | # Referee Letter |
---|
387 | |
---|
388 | class 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 | |
---|
396 | class RefereeLetterSlip(RefereeLetterDisplay): |
---|
397 | grok.view(ExportPDFClearanceSlipPage) |
---|
398 | |
---|
399 | class 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 | |
---|
408 | class 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 | |
---|
416 | class 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 | |
---|
424 | class SecondRefereeLetterSlip(SecondRefereeLetterDisplay): |
---|
425 | grok.view(ExportPDFClearanceSlipPage) |
---|
426 | |
---|
427 | class 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 | |
---|
440 | class 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 | |
---|
448 | class 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 | |
---|
456 | class ThirdRefereeLetterSlip(ThirdRefereeLetterDisplay): |
---|
457 | grok.view(ExportPDFClearanceSlipPage) |
---|
458 | |
---|
459 | class 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 | |
---|
472 | class 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 | |
---|
480 | class 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 | |
---|
488 | class StatutoryDeclarationSlip(StatutoryDeclarationDisplay): |
---|
489 | grok.view(ExportPDFClearanceSlipPage) |
---|
490 | |
---|
491 | class 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 | |
---|
500 | class 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 | |
---|
508 | class 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 | |
---|
516 | class LetterAdmissionSlip(LetterAdmissionDisplay): |
---|
517 | grok.view(ExportPDFClearanceSlipPage) |
---|
518 | |
---|
519 | class 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 | |
---|
532 | class LetterAdmissionImage(Image): |
---|
533 | """Renders Letter of Admission scan. |
---|
534 | """ |
---|
535 | grok.name('admission_let') |
---|
536 | download_name = u'admission_let' |
---|