source: main/waeup.sirp/branches/accesscodes-with-workflow/src/waeup/sirp/university/interfaces.py @ 6401

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

Fix useless python:hint condition in manage and add form templates which had been copied from megrok.layout.

Display description field attribute which should only be used in edit and add forms.

Adjust description of code fields.

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_categories,
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        default = u'NA',
23        required = True,
24        readonly = True,
25        )
26
27    title = schema.TextLine(
28        title = u'Name of faculty',
29        default = u'Unnamed',
30        required = True,
31        )
32
33    title_prefix = schema.Choice(
34        title = u'Name prefix',
35        default = u'faculty',
36        vocabulary = inst_types,
37        required = True,
38        )
39       
40    def longtitle():
41        """
42        Returns the long title of a faculty.
43        """       
44       
45class IFacultyAdd(IFaculty):
46    """Representation of a university faculty.
47    """
48    code = schema.TextLine(
49        title = u'Code',
50        description = u'This code will become part of the URL.',
51        default = u'NA',
52        required = True,
53        readonly = False,
54        )
55                 
56IFacultyAdd['code'].order =  IFaculty['code'].order           
57   
58class IFacultyContainer(IWAeUPContainer):
59    """A container for faculties.
60    """
61    def addFaculty(faculty):
62        """Add an IFactulty object.
63
64        Returns the key, under which the object was stored.
65        """
66class IDepartment(IWAeUPObject):
67    """Representation of a department.
68    """
69    code = schema.TextLine(
70        title = u'Code',
71        default = u'NA',
72        required = True,
73        readonly = True,
74        )
75
76    title = schema.TextLine(
77        title = u'Name of department',
78        default = u'Unnamed',
79        required = True,
80        )
81
82    title_prefix = schema.Choice(
83        title = u'Name prefix',
84        vocabulary = inst_types,
85        default = u'department',
86        required = True,
87        )
88
89    courses = Attribute("A container for courses.")
90    certificates = Attribute("A container for certificates.")
91   
92    def longtitle():
93        """
94        Returns the long title of a department.
95        """
96       
97class IDepartmentAdd(IDepartment):
98    """Representation of a university department.
99    """
100    code = schema.TextLine(
101        title = u'Code',
102        description = u'This code will become part of the URL.',
103        default = u'NA',
104        required = True,
105        readonly = False,
106        )
107                 
108IDepartmentAdd['code'].order =  IDepartment['code'].order         
109
110class ICourseContainer(IWAeUPContainer):
111    """A container for faculties.
112    """
113    def addCourse(faculty):
114        """Add an ICourse object.
115
116        Returns the key, under which the object was stored.
117        """
118
119class ICourse(IWAeUPObject):
120    """Representation of a course.
121    """
122    code = schema.TextLine(
123        title = u'Code',
124        default = u'NA',
125        required = True,
126        readonly = True,
127        )
128
129    title = schema.TextLine(
130        title = u'Title of course',
131        default = u'Unnamed',
132        required = True,
133        )
134
135    credits = schema.Int(
136        title = u'Credits',
137        default = 0,
138        required = False,
139        )
140   
141    passmark = schema.Int(
142        title = u'Passmark',
143        default = 40,
144        required = False,
145        )
146
147    semester = schema.Choice(
148        title = u'Semester/Term',
149        default = 0,
150        vocabulary = semester,
151        required = True,
152        )
153       
154    def longtitle():
155        """
156        Returns the long title of a course.
157        """       
158
159class ICourseAdd(ICourse):
160    """Representation of a course.
161    """
162    code = schema.TextLine(
163        title = u'Code',
164        description = u'Enter unique course code which will become part of the URL.',
165        default = u'NA',
166        required = True,
167        readonly = False,
168        )
169       
170ICourseAdd['code'].order =  ICourse['code'].order         
171
172class ICertificate(IWAeUPObject):
173    """Representation of a certificate.
174    """
175    code = schema.TextLine(
176        title = u'Code',
177        default = u'NA',
178        required = True,
179        readonly = True,
180        )
181
182    title = schema.TextLine(
183        title = u'Title',
184        default = u'Unnamed',
185        required = True,
186        )
187
188    study_mode = schema.Choice(
189        title = u'Study Mode',
190        vocabulary = study_mode,
191        default = u'ug_ft',
192        required = True,
193        )
194
195    start_level = schema.Choice(
196        title = u'Start Level',
197        #source = LevelSource(),
198        vocabulary = course_levels,
199        default = 100,
200        required = True,
201        )
202   
203    end_level = schema.Choice(
204        title = u'End Level',
205        #source = LevelSource(),
206        vocabulary = course_levels,
207        default = 500,
208        required = True,
209        )
210   
211    application_category = schema.Choice(
212        title = u'Application Category',
213        vocabulary = application_categories,
214        default = u'basic',
215        required = True,
216        )   
217
218    def longtitle():
219        """
220        Returns the long title of a certificate.
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'Enter unique certificate code which will become part of the URL.',
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    def longtitle():
276        """
277        Returns the long title of a certificatecourse.
278        """         
279       
280       
281class ICertificateCourseAdd(ICertificateCourse):
282    """A certificatecourse is referring a course and
283       provides some own attributes.
284    """
285    course = schema.Choice(
286        title = u'Course',
287        source = CourseSource(),
288        readonly = False,
289        )
290                 
291ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order                 
Note: See TracBrowser for help on using the repository browser.