source: main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py @ 6539

Last change on this file since 6539 was 6504, checked in by Henrik Bettermann, 13 years ago

Extend some vocabularies to be compatible with the SRP.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1"""Vocabularies and sources for the academics section.
2"""
3from zc.sourcefactory.basic import BasicSourceFactory
4try:
5    from zope.catalog.interfaces import ICatalog
6except ImportError:
7    # BBB
8    from zope.app.catalog.interfaces import ICatalog
9from zope.component import getUtility
10from waeup.sirp.interfaces import SimpleWAeUPVocabulary
11
12inst_types = SimpleWAeUPVocabulary(
13    ('Faculty of','faculty'),
14    ('Department of','department'),
15    ('School of','school'),
16    ('School for','school_for'),
17    ('Institute of','institute'),
18    ('Office for','office'),
19    ('Centre for','centre'),
20    ('College','college'),
21    )
22
23course_levels = SimpleWAeUPVocabulary(
24    ('Pre-Studies',0),
25    ('100 (Year 1)',100),
26    ('200 (Year 2)',200),
27    ('300 (Year 3)',300),
28    ('400 (Year 4)',400),
29    ('500 (Year 5)',500),
30    ('600 (Year 6)',600),
31    ('700 (Year 7)',700),
32    ('800 (Year 8)',800),
33    )
34
35semester = SimpleWAeUPVocabulary(
36    ('N/A', 0),
37    ('First Semester', 1),
38    ('Second Semester', 2),
39    ('Combined', 3)
40    )
41
42application_categories = SimpleWAeUPVocabulary(
43    ('--',''),
44    ('PUME, PDE, PCE, PRENCE','basic'),
45    ('Part-Time, Diploma, Certificate','cest'),
46    ('Sandwich','sandwich'),
47    ('Postgraduate','pg'),
48    )
49
50study_mode = SimpleWAeUPVocabulary(
51    ('UME Full Time','ume_ft'),
52    ('Direct Entry Full Time','de_ft'),
53    ('Diploma Full Time','dp_ft'),
54    ('Diploma Part Time','dp_pt'),
55    ('Undergraduate Full Time','ug_ft'),
56    ('Undergraduate Part Time','ug_pt'),
57    ('Postgraduate Full Time','pg_ft'),
58    ('Postgraduate Part Time','pg_pt'),
59    )
60
61
62class CourseSource(BasicSourceFactory):
63    """A course source delivers all courses inside the portal by looking
64       up a catalog.
65    """
66    def getValues(self):
67        catalog = getUtility(ICatalog, name='courses_catalog')
68        return sorted(list(
69                catalog.searchResults(
70                    code=('', 'z*'))),key=lambda value: value.code)
71
72    def getToken(self, value):
73        return value.code
74
75    def getTitle(self, value):
76        return "%s - %s" % (value.code, value.title[:64])
Note: See TracBrowser for help on using the repository browser.