source: main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py @ 5983

Last change on this file since 5983 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.

File size: 6.7 KB
RevLine 
[5004]1"""Interfaces of academics specific objects.
2"""
3from zope import schema
4from zope.interface import Attribute
[5977]5from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer)
6                                   
7from waeup.sirp.university.vocabularies import (course_levels,
8                                                semester, CourseSource)                                   
[5004]9
10class IFaculty(IWAeUPContainer):
11    """Representation of a university faculty.
12    """
[5948]13    code = schema.TextLine(
14        title = u'Code',
15        description = u'Abbreviated code of the faculty',
16        default = u'NA',
17        required = True,
18        readonly = True,
19        )
20
[5004]21    title = schema.TextLine(
22        title = u'Name of Faculty',
23        default = u'Unnamed',
24        required = True,
25        )
26
27    title_prefix = schema.TextLine(
28        title = u'Title prefix',
29        default = u'faculty',
30        required = True,
31        )
[5951]32       
33class IFacultyAdd(IFaculty):
34    """Representation of a university faculty.
35    """
36    code = schema.TextLine(
37        title = u'Code',
38        description = u'Abbreviated code of the faculty',
39        default = u'NA',
40        required = True,
41        readonly = False,
42        )
43                 
44IFacultyAdd['code'].order =  IFaculty['code'].order           
[5004]45   
46class IFacultyContainer(IWAeUPContainer):
47    """A container for faculties.
48    """
49    def addFaculty(faculty):
50        """Add an IFactulty object.
51
52        Returns the key, under which the object was stored.
53        """
54class IDepartment(IWAeUPObject):
55    """Representation of a department.
56    """
[5948]57    code = schema.TextLine(
58        title = u'Code',
59        default = u'NA',
60        description = u'Abbreviated code of the department',
61        required = True,
62        readonly = True,
63        )
64
[5004]65    title = schema.TextLine(
66        title = u'Name of Department',
67        default = u'Unnamed',
68        required = True,
69        )
70
71    title_prefix = schema.TextLine(
72        title = u'Title prefix',
73        default = u'department',
74        required = True,
75        )
76
77    courses = Attribute("A container for courses.")
78    certificates = Attribute("A container for certificates.")
79
[5951]80class IDepartmentAdd(IDepartment):
81    """Representation of a university department.
82    """
83    code = schema.TextLine(
84        title = u'Code',
85        default = u'NA',
86        description = u'Abbreviated code of the department',
87        required = True,
88        readonly = False,
89        )
90                 
91IDepartmentAdd['code'].order =  IDepartment['code'].order         
[5004]92
93class ICourseContainer(IWAeUPContainer):
94    """A container for faculties.
95    """
96    def addCourse(faculty):
97        """Add an ICourse object.
98
99        Returns the key, under which the object was stored.
100        """
101
102class ICourse(IWAeUPObject):
103    """Representation of a course.
104    """
105    code = schema.TextLine(
106        title = u'Code',
107        default = u'NA',
108        description = u'Abbreviated code of the course',
109        required = True,
110        readonly = True,
111        )
112
113    title = schema.TextLine(
114        title = u'Title of course',
115        default = u'Unnamed',
116        required = True,
117        )
118
119    credits = schema.Int(
120        title = u'Credits',
121        default = 0,
122        required = False,
123        )
124   
125    passmark = schema.Int(
126        title = u'Passmark',
127        default = 40,
128        required = False,
129        )
130
131    semester = schema.Choice(
132        title = u'Semester/Term',
133        default = 0,
[5977]134        vocabulary = semester,
[5004]135        required = True,
136        )
137
[5951]138class ICourseAdd(ICourse):
139    """Representation of a course.
140    """
141    code = schema.TextLine(
142        title = u'Code',
143        default = u'NA',
144        description = u'Abbreviated code of the course',
145        required = True,
146        readonly = False,
147        )
148       
149ICourseAdd['code'].order =  ICourse['code'].order         
[5004]150
151class ICertificate(IWAeUPObject):
152    """Representation of a certificate.
153    """
154    code = schema.TextLine(
155        title = u'Code',
156        default = u'NA',
157        description = u'Abbreviated code of the certificate.',
158        required = True,
[5948]159        readonly = True,
[5004]160        )
161
[5949]162    #review_state = schema.Choice(
163    #    title = u'Review State',
164    #    default = 'unchecked',
165    #    values = ['unchecked', 'checked']
166    #    )
[5004]167
168    title = schema.TextLine(
[5948]169        title = u'Title',
[5951]170        default = u'Unnamed',
[5004]171        required = True,
172        )
173
174    study_mode = schema.TextLine(
[5948]175        title = u'Study Mode',
[5951]176        default = u'ug_ft',
[5004]177        required = True,
178        )
179
[5977]180    start_level = schema.Choice(
[5948]181        title = u'Start Level',
[5977]182        #source = LevelSource(),
183        vocabulary = course_levels,
184        default = 100,
[5004]185        required = True,
186        )
187   
[5977]188    end_level = schema.Choice(
[5948]189        title = u'End Level',
[5977]190        #source = LevelSource(),
191        vocabulary = course_levels,
192        default = 500,
[5004]193        required = True,
194        )
195   
196    application_category = schema.TextLine(
[5949]197        title = u'Application Category',
[5951]198        default = u'basic',
[5004]199        required = False,
[5948]200        )   
[5004]201
[5951]202class ICertificateAdd(ICertificate):
203    """Representation of a certificate.
204    """
205    code = schema.TextLine(
206        title = u'Code',
207        default = u'NA',
208        description = u'Abbreviated code of the certificate.',
209        required = True,
210        readonly = False,
211        )
212       
213ICertificateAdd['code'].order =  ICertificate['code'].order         
[5004]214   
215class ICertificateContainer(IWAeUPContainer):
216    """A container for certificates.
217    """
218    def addCertificate(faculty):
219        """Add an ICertificate object.
220
221        Returns the key, under which the object was stored.
222        """
223
224class ICertificateCourse(IWAeUPObject):
[5977]225    """A certificatecourse is referring a course and
[5004]226       provides some own attributes.
227    """
228    course = schema.Choice(
[5977]229        title = u'Course referrer',
[5004]230        source = CourseSource(),
[5950]231        readonly = True,
[5004]232        )
233   
[5977]234    level = schema.Choice(
[5951]235        title = u'Level',
[5004]236        required = True,
[5977]237        #source = LevelSource(),
238        vocabulary = course_levels,
[5950]239        readonly = False,
[5004]240        )
241
242    core_or_elective = schema.Bool(
243        title = u'Is mandatory course (not elective)',
244        required = True,
[5950]245        default = True,
[5004]246        )
247
248    def getCourseCode():
[5977]249        """Return the code of the course referred to.
[5004]250
251        This is needed for cataloging.
252        """
[5951]253       
254       
255class ICertificateCourseAdd(ICertificateCourse):
[5977]256    """A certificatecourse is referring a course and
[5951]257       provides some own attributes.
258    """
259    course = schema.Choice(
[5977]260        title = u'Course',
[5951]261        source = CourseSource(),
262        readonly = False,
263        )
264                 
265ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order                 
Note: See TracBrowser for help on using the repository browser.