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

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

Implement AddStudyLevelFormPage? for students which add the current study level including course tickets. The page can only be called in state 'school fee paid'.

  • 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 = '0',
197        required = False,
198        )
199
200    previous_verdict = schema.Choice(
201        title = u'Previous Verdict',
202        source = verdicts,
203        default = '0',
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 = '0',
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
241    core_or_elective = schema.Bool(
242        title = u'Mandatory',
243        default = False,
244        required = False,
245        readonly = False,
246        )
247
248    score = schema.Int(
249        title = u'Score',
250        default = 0,
251        required = False,
252        readonly = False,
253        )
254
255    automatic = schema.Bool(
256        title = u'Automatical Creation',
257        default = False,
258        required = False,
259        readonly = True,
260        )
261
262class ICourseTicketAdd(ICourseTicket):
263    """An interface for adding course tickets
264
265    """
266    course = schema.Choice(
267        title = u'Course',
268        source = CourseSource(),
269        readonly = False,
270        )
271
272class IStudentAccommodation(IWAeUPObject):
273    """A container for student accommodation objects.
274
275    """
276
277class IStudentPayments(IWAeUPObject):
278    """A container for student payment objects.
279
280    """
281
282# Interfaces for students only
283
284class IStudentClearanceEdit(IStudentClearance):
285    """Interface needed for restricted editing of student clearance data.
286    """
287
288class IStudentPersonalEdit(IStudentPersonal):
289    """Interface needed for restricted editing of student personal data.
290    """
Note: See TracBrowser for help on using the repository browser.