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

Last change on this file since 6388 was 6345, checked in by Henrik Bettermann, 14 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
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)
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        )
[5951]39       
[5988]40    def longtitle():
41        """
42        Returns the long title of a faculty.
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        )
55                 
56IFacultyAdd['code'].order =  IFaculty['code'].order           
[5004]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    """
[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.")
[5988]91   
92    def longtitle():
93        """
94        Returns the long title of a department.
95        """
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        )
107                 
108IDepartmentAdd['code'].order =  IDepartment['code'].order         
[5004]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,
[5977]150        vocabulary = semester,
[5004]151        required = True,
152        )
[6008]153       
154    def longtitle():
155        """
156        Returns the long title of a course.
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        )
169       
170ICourseAdd['code'].order =  ICourse['code'].order         
[5004]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,
[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        #source = LevelSource(),
198        vocabulary = course_levels,
199        default = 100,
[5004]200        required = True,
201        )
202   
[5977]203    end_level = schema.Choice(
[5948]204        title = u'End Level',
[5977]205        #source = LevelSource(),
206        vocabulary = course_levels,
207        default = 500,
[5004]208        required = True,
209        )
210   
[5986]211    application_category = schema.Choice(
[5949]212        title = u'Application Category',
[6189]213        vocabulary = application_categories,
[5951]214        default = u'basic',
[5986]215        required = True,
[5948]216        )   
[5004]217
[6008]218    def longtitle():
219        """
220        Returns the long title of a certificate.
221        """       
222
[5951]223class ICertificateAdd(ICertificate):
224    """Representation of a certificate.
225    """
226    code = schema.TextLine(
227        title = u'Code',
228        default = u'NA',
[6345]229        description = u'Enter unique certificate code which will become part of the URL.',
[5951]230        required = True,
231        readonly = False,
232        )
233       
234ICertificateAdd['code'].order =  ICertificate['code'].order         
[5004]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):
[5977]246    """A certificatecourse is referring a course and
[5004]247       provides some own attributes.
248    """
249    course = schema.Choice(
[5977]250        title = u'Course referrer',
[5004]251        source = CourseSource(),
[5950]252        readonly = True,
[5004]253        )
254   
[5977]255    level = schema.Choice(
[5951]256        title = u'Level',
[5004]257        required = True,
[5977]258        #source = LevelSource(),
259        vocabulary = course_levels,
[5950]260        readonly = False,
[5004]261        )
262
263    core_or_elective = schema.Bool(
264        title = u'Is mandatory course (not elective)',
265        required = True,
[5950]266        default = True,
[5004]267        )
268
269    def getCourseCode():
[5977]270        """Return the code of the course referred to.
[5004]271
272        This is needed for cataloging.
273        """
[5951]274       
[6008]275    def longtitle():
276        """
277        Returns the long title of a certificatecourse.
278        """         
[5951]279       
[6008]280       
[5951]281class ICertificateCourseAdd(ICertificateCourse):
[5977]282    """A certificatecourse is referring a course and
[5951]283       provides some own attributes.
284    """
285    course = schema.Choice(
[5977]286        title = u'Course',
[5951]287        source = CourseSource(),
288        readonly = False,
289        )
290                 
291ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order                 
Note: See TracBrowser for help on using the repository browser.