Last change
on this file since 5980 was
5977,
checked in by Henrik Bettermann, 14 years ago
|
Implement a vocabulary module in university and move some vocabularies to it.
Rebuild the certificatepage page template.
Rename Course Reference to Course Referrer. It's very difficult to find a proper name for these 'certificatecourse' objects. But we have to clearly distinguish courses and referrers of courses as they are not the same.
|
-
Property svn:keywords set to
Id
|
File size:
1.4 KB
|
Line | |
---|
1 | from waeup.sirp.interfaces import SimpleWAeUPVocabulary
|
---|
2 | from zc.sourcefactory.basic import BasicSourceFactory
|
---|
3 | try:
|
---|
4 | from zope.catalog.interfaces import ICatalog
|
---|
5 | except ImportError:
|
---|
6 | # BBB
|
---|
7 | from zope.app.catalog.interfaces import ICatalog
|
---|
8 | from zope.component import getUtility
|
---|
9 |
|
---|
10 | course_levels = SimpleWAeUPVocabulary(
|
---|
11 | ('Year 1 (100)',100),
|
---|
12 | ('Year 2 (200)',200),
|
---|
13 | ('Year 3 (300)',300),
|
---|
14 | ('Year 4 (400)',400),
|
---|
15 | ('Year 5 (500)',500),
|
---|
16 | ('Year 6 (600)',600),
|
---|
17 | ('Year 7 (700)',700),
|
---|
18 | ('Year 8 (800)',800),
|
---|
19 | )
|
---|
20 |
|
---|
21 | semester = SimpleWAeUPVocabulary(
|
---|
22 | ('N/A', 0), ('First Semester', 1),
|
---|
23 | ('Second Semester', 2), ('Combined', 3))
|
---|
24 |
|
---|
25 | class CourseSource(BasicSourceFactory):
|
---|
26 | """A course source delivers all courses inside the portal by looking
|
---|
27 | up a catalog.
|
---|
28 | """
|
---|
29 | def getValues(self):
|
---|
30 | catalog = getUtility(ICatalog, name='courses_catalog')
|
---|
31 | return sorted(list(catalog.searchResults(code=('', 'z*'))),key=lambda value: value.code)
|
---|
32 |
|
---|
33 | def getToken(self, value):
|
---|
34 | return value.code
|
---|
35 |
|
---|
36 | def getTitle(self, value):
|
---|
37 | return "%s - %s" % (value.code, value.title[:64])
|
---|
38 |
|
---|
39 | |
---|
Note: See
TracBrowser for help on using the repository browser.