source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py @ 16076

Last change on this file since 16076 was 16070, checked in by Henrik Bettermann, 5 years ago

Certificate filter box (for demonstration purposes!!!)

  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1## $Id: utils.py 16070 2020-04-24 06:59:45Z 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"""General helper functions and utilities for the application section.
19"""
20
21from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils
22from waeup.kofa.applicants.workflow import (INITIALIZED,
23    STARTED, PAID, ADMITTED, NOT_ADMITTED, SUBMITTED, CREATED)
24from kofacustom.iuokada.interfaces import MessageFactory as _
25
26
27
28class ApplicantsUtils(NigeriaApplicantsUtils):
29    """A collection of parameters and methods subject to customization.
30    """
31
32    ADDITIONAL_FILES = (
33                 ('First Sitting Result','fst_sit_scan.pdf'),
34                 ('Second Sitting Result','scd_sit_scan.pdf'),
35                 ('Higher Qualification Result','hq_scan.pdf'),
36                 ('Advanced Level Result','alr_scan.pdf'),
37                 ('JAMB Result','jamb.pdf'),
38                 ('Statement of Result','res_stat.pdf'),
39                 ('NYSC Certificate','nysc.pdf'),
40                 )
41
42    APP_TYPES_DICT = {
43        'pude': ['Post-UDE Screening', 'PUDE'],
44        'sandwich': ['Part-Time Degree in Education', 'SAND'],
45        'pt': ['Part-Time Degree Programmes', 'PTP'],
46        'putme': ['Post-UTME Screening Exercise', 'PUTME'],
47        'app': ['General Studies', 'APP'],
48        'ct': ['Certificate Programmes', 'CTP'],
49        'dp': ['Diploma Programmes', 'DPP'],
50        'pgft': ['Postgraduate Full-Time Programmes', 'PG'],
51        'pgpt': ['Postgraduate Part-Time Programmes', 'PG'],
52        'pre': ['Pre-Degree Studies', 'PRE'],
53        'cbt': ['CBT Practice Test', 'CBT'],
54        'ase': ['Admission Screening Exercise', 'ASE'], # successor of putme
55        'pg': ['Postgraduate Programmes', 'PG'],
56        'ug': ['Undergraduate Programmes', 'UG'],
57        }
58
59    SEPARATORS_DICT = {
60        'form.applicant_id': _(u'Base Data'),
61        'form.course1': _(u'Programmes/Courses Desired'),
62        'form.hq_type': _(u'Highest Educational Record (Degrees, Diplomas etc.)'),
63        'form.presently': _(u'Course or Programme Presently Attending'),
64        'form.nysc_year': _(u'NYSC Information/Exemption Certificate'),
65        'form.employer': _(u'Employment History'),
66        'form.jamb_subjects': _(u'JAMB Data (All Applicants)'),
67        'form.jamb_subjects_list': _(u'JAMB Data (All Applicants)'),
68        'form.notice': _(u'Application Process Information'),
69        'form.pp_school': _(u'Post Primary School Qualification'),
70        'form.presently_inst': _(u'Presently attending a course or programme'),
71        'form.fst_sit_fname': _(u'First Sitting Record'),
72        'form.scd_sit_fname': _(u'Second Sitting Record'),
73        'form.referees': _(u'Referees (will be automatically invited by email after final submission)'),
74        'form.parents_name': _(u'Parents / Guardian'),
75        }
76
77    def sortCertificates(self, context, resultset):
78        """Sort already filtered certificates in `AppCatCertificateSource`.
79        """
80        resultlist = sorted(resultset, key=lambda
81            value: value.__parent__.__parent__.__parent__.code +
82            value.__parent__.__parent__.code +
83            value.code)
84        curr_course = context.course1
85        if curr_course is not None and curr_course not in resultlist:
86            resultlist = [curr_course,] + resultlist
87        return resultlist
88
89    def getCertTitle(self, context, value):
90        """Compose the titles in `AppCatCertificateSource`.
91        """
92        try: title = "%s / %s / %s (%s)" % (
93            value.__parent__.__parent__.__parent__.title,
94            value.__parent__.__parent__.title,
95            value.title, value.code)
96        except AttributeError:
97            title = "NA / %s (%s)" % (value.title, value.code)
98        return title
Note: See TracBrowser for help on using the repository browser.