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

Last change on this file since 6036 was 5988, checked in by Henrik Bettermann, 14 years ago

Implement title_prefix vocabulary. Remove redundant getName method and replace by the longtitle property.

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1"""Vocabularies and sources for the academics section.
2"""
3
4from waeup.sirp.interfaces import SimpleWAeUPVocabulary
5from zc.sourcefactory.basic import BasicSourceFactory
6try:
7    from zope.catalog.interfaces import ICatalog
8except ImportError:
9    # BBB
10    from zope.app.catalog.interfaces import ICatalog
11from zope.component import getUtility
12
13inst_types = SimpleWAeUPVocabulary(
14             ('Faculty of','faculty'),
15             ('Department of','department'),
16             ('School of','school_of'),
17             ('School for','school_for'),
18             ('Institute of','institute'),
19             ('Office for','office'),
20             ('Centre for','centre'),
21             ('College','college'),
22             )
23                                   
24course_levels = SimpleWAeUPVocabulary(
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_category = 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(catalog.searchResults(code=('', 'z*'))),key=lambda value: value.code)
69
70    def getToken(self, value):
71        return value.code
72       
73    def getTitle(self, value):
74        return "%s - %s" % (value.code, value.title[:64])
75       
76                                                             
Note: See TracBrowser for help on using the repository browser.