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

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

Translate accesscode workflow.

  • Property svn:keywords set to Id
File size: 7.5 KB
Line 
1## $Id: interfaces.py 7689 2012-02-23 12:43:11Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Interfaces of academics specific objects.
19"""
20
21from zope import schema
22from zope.interface import Attribute
23import zope.i18nmessageid
24from waeup.sirp.interfaces import (ISIRPObject, ISIRPContainer)
25from waeup.sirp.interfaces import MessageFactory as _
26from waeup.sirp.university.vocabularies import (
27    course_levels,
28    CourseSource,
29    StudyModeSource,
30    AppCatSource,
31    InstTypeSource,
32    SemesterSource,
33    )
34
35class IFaculty(ISIRPContainer):
36    """Representation of a university faculty.
37    """
38    code = schema.TextLine(
39        title = u'Code',
40        default = u'NA',
41        required = True,
42        readonly = True,
43        )
44
45    title = schema.TextLine(
46        title = _(u'name_of_faculty', default=u'Name of faculty'),
47        default = u'Unnamed',
48        required = True,
49        )
50
51    title_prefix = schema.Choice(
52        title = u'Name prefix',
53        default = u'faculty',
54        source = InstTypeSource(),
55        required = True,
56        )
57
58    def longtitle():
59        """
60        Returns the long title of a faculty.
61        """
62
63class IFacultyAdd(IFaculty):
64    """Representation of a university faculty.
65    """
66    code = schema.TextLine(
67        title = u'Code',
68        description = u'This code will become part of the URL.',
69        default = u'NA',
70        required = True,
71        readonly = False,
72        )
73
74IFacultyAdd['code'].order =  IFaculty['code'].order
75
76class IFacultiesContainer(ISIRPContainer):
77    """A container for faculties.
78    """
79    def addFaculty(faculty):
80        """Add an IFactulty object.
81
82        """
83class IDepartment(ISIRPObject):
84    """Representation of a department.
85    """
86    code = schema.TextLine(
87        title = u'Code',
88        default = u'NA',
89        required = True,
90        readonly = True,
91        )
92
93    title = schema.TextLine(
94        title = u'Name of department',
95        default = u'Unnamed',
96        required = True,
97        )
98
99    title_prefix = schema.Choice(
100        title = u'Name prefix',
101        source = InstTypeSource(),
102        default = u'department',
103        required = True,
104        )
105
106    courses = Attribute("A container for courses.")
107    certificates = Attribute("A container for certificates.")
108
109    def longtitle():
110        """
111        Returns the long title of a department.
112        """
113
114class IDepartmentAdd(IDepartment):
115    """Representation of a university department.
116    """
117    code = schema.TextLine(
118        title = u'Code',
119        description = u'This code will become part of the URL.',
120        default = u'NA',
121        required = True,
122        readonly = False,
123        )
124
125IDepartmentAdd['code'].order =  IDepartment['code'].order
126
127class ICoursesContainer(ISIRPContainer):
128    """A container for faculties.
129    """
130    def addCourse(course):
131        """Add an ICourse object.
132
133        Returns the key, under which the object was stored.
134        """
135
136class ICourse(ISIRPObject):
137    """Representation of a course.
138    """
139    code = schema.TextLine(
140        title = u'Code',
141        default = u'NA',
142        required = True,
143        readonly = True,
144        )
145
146    title = schema.TextLine(
147        title = u'Title of course',
148        default = u'Unnamed',
149        required = True,
150        )
151
152    credits = schema.Int(
153        title = u'Credits',
154        default = 0,
155        required = False,
156        )
157
158    passmark = schema.Int(
159        title = u'Passmark',
160        default = 40,
161        required = False,
162        )
163
164    semester = schema.Choice(
165        title = u'Semester/Term',
166        default = 9,
167        source = SemesterSource(),
168        required = True,
169        )
170
171    def longtitle():
172        """
173        Returns the long title of a course.
174        """
175
176class ICourseAdd(ICourse):
177    """Representation of a course.
178    """
179    code = schema.TextLine(
180        title = u'Code',
181        description = u'Enter unique course code which will become part of the URL.',
182        default = u'NA',
183        required = True,
184        readonly = False,
185        )
186
187ICourseAdd['code'].order =  ICourse['code'].order
188
189class ICertificate(ISIRPObject):
190    """Representation of a certificate.
191    """
192    code = schema.TextLine(
193        title = u'Code',
194        default = u'NA',
195        required = True,
196        readonly = True,
197        )
198
199    title = schema.TextLine(
200        title = u'Title',
201        default = u'Unnamed',
202        required = True,
203        )
204
205    study_mode = schema.Choice(
206        title = u'Study Mode',
207        source = StudyModeSource(),
208        default = u'ug_ft',
209        required = True,
210        )
211
212    start_level = schema.Choice(
213        title = u'Start Level',
214        vocabulary = course_levels,
215        default = 100,
216        required = True,
217        )
218
219    end_level = schema.Choice(
220        title = u'End Level',
221        vocabulary = course_levels,
222        default = 500,
223        required = True,
224        )
225
226    application_category = schema.Choice(
227        title = u'Application Category',
228        source = AppCatSource(),
229        default = u'basic',
230        required = True,
231        )
232
233    def longtitle():
234        """
235        Returns the long title of a certificate.
236        """
237
238class ICertificateAdd(ICertificate):
239    """Representation of a certificate.
240    """
241    code = schema.TextLine(
242        title = u'Code',
243        default = u'NA',
244        description = u'Enter unique certificate code which will become part of the URL.',
245        required = True,
246        readonly = False,
247        )
248
249ICertificateAdd['code'].order =  ICertificate['code'].order
250
251class ICertificatesContainer(ISIRPContainer):
252    """A container for certificates.
253    """
254    def addCertificate(certificate):
255        """Add an ICertificate object.
256
257        Returns the key, under which the object was stored.
258        """
259
260class ICertificateCourse(ISIRPObject):
261    """A certificatecourse is referring a course and provides some own
262       attributes.
263    """
264    course = schema.Choice(
265        title = u'Course referrer',
266        source = CourseSource(),
267        readonly = True,
268        )
269
270    level = schema.Choice(
271        title = u'Level',
272        required = True,
273        vocabulary = course_levels,
274        readonly = False,
275        )
276
277    mandatory = schema.Bool(
278        title = u'Is mandatory course (not elective)',
279        required = True,
280        default = True,
281        )
282
283    def getCourseCode():
284        """Return the code of the course referred to.
285
286        This is needed for cataloging.
287        """
288
289    def longtitle():
290        """
291        Returns the long title of a certificatecourse.
292        """
293
294
295class ICertificateCourseAdd(ICertificateCourse):
296    """A certificatecourse is referring a course and
297       provides some own attributes.
298    """
299    course = schema.Choice(
300        title = u'Course',
301        source = CourseSource(),
302        readonly = False,
303        )
304
305ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order
Note: See TracBrowser for help on using the repository browser.