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