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