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

Last change on this file since 6577 was 6561, checked in by uli, 13 years ago

Clean up.

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)
[6561]6
[5995]7from waeup.sirp.university.vocabularies import (
8    course_levels,
9    semester,
[6189]10    application_categories,
[5995]11    study_mode,
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        Returns the key, under which the object was stored.
65        """
66class IDepartment(IWAeUPObject):
67    """Representation of a department.
68    """
[5948]69    code = schema.TextLine(
70        title = u'Code',
71        default = u'NA',
72        required = True,
73        readonly = True,
74        )
75
[5004]76    title = schema.TextLine(
[6025]77        title = u'Name of department',
[5004]78        default = u'Unnamed',
79        required = True,
80        )
81
[5988]82    title_prefix = schema.Choice(
[6025]83        title = u'Name prefix',
[5988]84        vocabulary = inst_types,
[5004]85        default = u'department',
86        required = True,
87        )
88
89    courses = Attribute("A container for courses.")
90    certificates = Attribute("A container for certificates.")
[6561]91
[5988]92    def longtitle():
93        """
94        Returns the long title of a department.
95        """
[6561]96
[5951]97class IDepartmentAdd(IDepartment):
98    """Representation of a university department.
99    """
100    code = schema.TextLine(
101        title = u'Code',
[6345]102        description = u'This code will become part of the URL.',
[5951]103        default = u'NA',
104        required = True,
105        readonly = False,
106        )
[5004]107
[6561]108IDepartmentAdd['code'].order =  IDepartment['code'].order
109
[5004]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        )
[6561]140
[5004]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,
[5977]150        vocabulary = semester,
[5004]151        required = True,
152        )
[6561]153
[6008]154    def longtitle():
155        """
156        Returns the long title of a course.
[6561]157        """
[5004]158
[5951]159class ICourseAdd(ICourse):
160    """Representation of a course.
161    """
162    code = schema.TextLine(
163        title = u'Code',
[6345]164        description = u'Enter unique course code which will become part of the URL.',
[5951]165        default = u'NA',
166        required = True,
167        readonly = False,
168        )
[5004]169
[6561]170ICourseAdd['code'].order =  ICourse['code'].order
171
[5004]172class ICertificate(IWAeUPObject):
173    """Representation of a certificate.
174    """
175    code = schema.TextLine(
176        title = u'Code',
177        default = u'NA',
178        required = True,
[5948]179        readonly = True,
[5004]180        )
181
182    title = schema.TextLine(
[5948]183        title = u'Title',
[5951]184        default = u'Unnamed',
[5004]185        required = True,
186        )
187
[5986]188    study_mode = schema.Choice(
[5948]189        title = u'Study Mode',
[5986]190        vocabulary = study_mode,
[5951]191        default = u'ug_ft',
[5004]192        required = True,
193        )
194
[5977]195    start_level = schema.Choice(
[5948]196        title = u'Start Level',
[5977]197        vocabulary = course_levels,
198        default = 100,
[5004]199        required = True,
200        )
[6561]201
[5977]202    end_level = schema.Choice(
[5948]203        title = u'End Level',
[5977]204        vocabulary = course_levels,
205        default = 500,
[5004]206        required = True,
207        )
[6561]208
[5986]209    application_category = schema.Choice(
[5949]210        title = u'Application Category',
[6189]211        vocabulary = application_categories,
[5951]212        default = u'basic',
[5986]213        required = True,
[6561]214        )
[5004]215
[6008]216    def longtitle():
217        """
218        Returns the long title of a certificate.
[6561]219        """
[6008]220
[5951]221class ICertificateAdd(ICertificate):
222    """Representation of a certificate.
223    """
224    code = schema.TextLine(
225        title = u'Code',
226        default = u'NA',
[6345]227        description = u'Enter unique certificate code which will become part of the URL.',
[5951]228        required = True,
229        readonly = False,
230        )
[6561]231
232ICertificateAdd['code'].order =  ICertificate['code'].order
233
[5004]234class ICertificateContainer(IWAeUPContainer):
235    """A container for certificates.
236    """
237    def addCertificate(faculty):
238        """Add an ICertificate object.
239
240        Returns the key, under which the object was stored.
241        """
242
243class ICertificateCourse(IWAeUPObject):
[6561]244    """A certificatecourse is referring a course and provides some own
245       attributes.
[5004]246    """
247    course = schema.Choice(
[5977]248        title = u'Course referrer',
[5004]249        source = CourseSource(),
[5950]250        readonly = True,
[5004]251        )
[6561]252
[5977]253    level = schema.Choice(
[5951]254        title = u'Level',
[5004]255        required = True,
[5977]256        vocabulary = course_levels,
[5950]257        readonly = False,
[5004]258        )
259
260    core_or_elective = schema.Bool(
261        title = u'Is mandatory course (not elective)',
262        required = True,
[5950]263        default = True,
[5004]264        )
265
266    def getCourseCode():
[5977]267        """Return the code of the course referred to.
[5004]268
269        This is needed for cataloging.
270        """
[6561]271
[6008]272    def longtitle():
273        """
274        Returns the long title of a certificatecourse.
[6561]275        """
276
277
[5951]278class ICertificateCourseAdd(ICertificateCourse):
[6561]279    """A certificatecourse is referring a course and
[5951]280       provides some own attributes.
281    """
282    course = schema.Choice(
[5977]283        title = u'Course',
[5951]284        source = CourseSource(),
285        readonly = False,
286        )
[6561]287
288ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order
Note: See TracBrowser for help on using the repository browser.