source: main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py @ 6803

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

We don't need to store the level of a course ticket but a boolean value if the ticket has been created automatically (due creation of the entire course list) or manually.

  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1##
2## interfaces.py
3from zope.interface import Attribute, invariant
4from zope.interface.exceptions import Invalid
5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
7from waeup.sirp.schema import TextLineChoice
8from waeup.sirp.university.vocabularies import CourseSource
9from waeup.sirp.students.vocabularies import (
10  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
11  contextual_reg_num_source, contextual_mat_num_source,
12  )
13
14class IStudentsContainer(IWAeUPObject):
15    """An students container contains university students.
16
17    """
18
19    def addStudent(student):
20        """Add an IStudent object and subcontainers.
21
22        """
23
24    def archive(id=None):
25        """Create on-dist archive of students.
26
27        If id is `None`, all students are archived.
28
29        If id contains a single id string, only the respective
30        students are archived.
31
32        If id contains a list of id strings all of the respective
33        students types are saved to disk.
34        """
35
36    def clear(id=None, archive=True):
37        """Remove students of type given by 'id'.
38
39        Optionally archive the students.
40
41        If id is `None`, all students are archived.
42
43        If id contains a single id string, only the respective
44        students are archived.
45
46        If id contains a list of id strings all of the respective
47        student types are saved to disk.
48
49        If `archive` is ``False`` none of the archive-handling is done
50        and respective students are simply removed from the
51        database.
52        """
53
54class IStudentNavigation(IWAeUPObject):
55    """Interface needed for student navigation.
56    """
57
58    def getStudent():
59        """Return student object.
60        """
61
62class IStudentPasswordSetting(IWAeUPObject):
63    """Data needed for password setting.
64    """
65    name = schema.TextLine(
66        title = u'Full Name',
67        default = u'Nobody',
68        required = True,
69        readonly = True
70        )
71
72    password = schema.Password(
73        title = u'New password',
74        required = False,
75        )
76
77    password_repeat = schema.Password(
78        title = u'Retype new password',
79        required = False,
80        )
81
82    @invariant
83    def passwords_match(obj):
84        if obj.password == obj.password_repeat:
85            return
86        raise Invalid('passwords do not match')
87
88class IStudentBase(IWAeUPObject):
89    """Representation of student base data.
90    """
91    history = Attribute('Object history, a list of messages.')
92    state = Attribute('Returns the registration state of a student')
93    password = Attribute('Encrypted password of a student')
94
95    def loggerInfo(ob_class, comment):
96        """Adds an INFO message to the log file
97        """
98
99    student_id = schema.TextLine(
100        title = u'Student ID',
101        required = True,
102        )
103
104    name = schema.TextLine(
105        title = u'Full Name',
106        default = u'Nobody',
107        required = True,
108        )
109
110    reg_number = TextLineChoice(
111        title = u'Registration Number',
112        #default = u'',
113        required = True,
114        readonly = False,
115        source = contextual_reg_num_source,
116        )
117
118    matric_number = TextLineChoice(
119        title = u'Matriculation Number',
120        #default = u'',
121        required = False,
122        readonly = False,
123        source = contextual_mat_num_source,
124        )
125
126    adm_code = schema.TextLine(
127        title = u'PWD Access Code',
128        default = u'',
129        required = False,
130        readonly = True,
131        )
132
133class IStudentClearance(IWAeUPObject):
134    """Representation of student clearance data.
135    """
136
137    date_of_birth = schema.Date(
138        title = u'Date of Birth',
139        required = True,
140        )
141
142    clearance_locked = schema.Bool(
143        title = u'Clearance form locked',
144        default = False,
145        )
146
147    clr_code = schema.TextLine(
148        title = u'CLR Access Code',
149        default = u'',
150        required = False,
151        readonly = True,
152        )
153
154class IStudentPersonal(IWAeUPObject):
155    """Representation of student personal data.
156    """
157
158    perm_address = schema.Text(
159        title = u'Permanent Address',
160        required = False,
161        )
162
163class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
164    """Representation of a student.
165    """
166
167class IStudentStudyCourse(IWAeUPObject):
168    """A container for student study levels.
169
170    """
171
172    certificate = schema.Choice(
173        title = u'Certificate',
174        source = CertificateSource(),
175        default = None,
176        required = True,
177        )
178
179    current_session = schema.Choice(
180        title = u'Current Session',
181        source = academic_sessions_vocab,
182        default = None,
183        required = True,
184        )
185
186    current_level = schema.Choice(
187        title = u'Current Level',
188        source = StudyLevelSource(),
189        default = None,
190        required = False,
191        )
192
193    current_verdict = schema.Choice(
194        title = u'Current Verdict',
195        source = verdicts,
196        default = None,
197        required = False,
198        )
199
200    previous_verdict = schema.Choice(
201        title = u'Previous Verdict',
202        source = verdicts,
203        default = None,
204        required = False,
205        )
206
207class IStudentStudyLevel(IWAeUPObject):
208    """A container for course tickets.
209
210    """
211    level = Attribute('The level code')
212    validation_date = Attribute('The date of validation')
213    validated_by = Attribute('User Id of course adviser')
214
215    level_session = schema.Choice(
216        title = u'Session',
217        source = academic_sessions_vocab,
218        default = None,
219        required = True,
220        )
221
222    level_verdict = schema.Choice(
223        title = u'Verdict',
224        source = verdicts,
225        default = None,
226        required = False,
227        )
228
229class ICourseTicket(IWAeUPObject):
230    """A course ticket.
231
232    """
233    code = Attribute('code of the original course')
234    title = Attribute('title of the original course')
235    credits = Attribute('credits of the original course')
236    passmark = Attribute('passmark of the original course')
237    semester = Attribute('semester of the original course')
238    faculty = Attribute('faculty of the original course')
239    department = Attribute('department of the original course')
240    automatic = Attribute('automatical creation of ticket')
241
242    core_or_elective = schema.Bool(
243        title = u'Mandatory',
244        default = False,
245        required = False,
246        readonly = False,
247        )
248
249    score = schema.Int(
250        title = u'Score',
251        default = 0,
252        required = False,
253        readonly = False,
254        )
255
256class ICourseTicketAdd(ICourseTicket):
257    """An interface for adding course tickets
258
259    """
260    course = schema.Choice(
261        title = u'Course',
262        source = CourseSource(),
263        readonly = False,
264        )
265
266class IStudentAccommodation(IWAeUPObject):
267    """A container for student accommodation objects.
268
269    """
270
271class IStudentPayments(IWAeUPObject):
272    """A container for student payment objects.
273
274    """
275
276# Interfaces for students only
277
278class IStudentClearanceEdit(IStudentClearance):
279    """Interface needed for restricted editing of student clearance data.
280    """
281
282class IStudentPersonalEdit(IStudentPersonal):
283    """Interface needed for restricted editing of student personal data.
284    """
Note: See TracBrowser for help on using the repository browser.