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

Last change on this file since 6006 was 5995, checked in by uli, 14 years ago

Prettify.

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