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

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

Add more fields to IStudentStudyCourse and corresponding vocabs (work in progress) + some other minor changes.

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