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

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

Translate accesscode workflow.

  • Property svn:keywords set to Id
File size: 7.5 KB
RevLine 
[7195]1## $Id: interfaces.py 7689 2012-02-23 12:43:11Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
[5004]18"""Interfaces of academics specific objects.
19"""
[7670]20
[5004]21from zope import schema
22from zope.interface import Attribute
[7670]23import zope.i18nmessageid
[7321]24from waeup.sirp.interfaces import (ISIRPObject, ISIRPContainer)
[7670]25from waeup.sirp.interfaces import MessageFactory as _
[5995]26from waeup.sirp.university.vocabularies import (
27    course_levels,
28    CourseSource,
[7681]29    StudyModeSource,
30    AppCatSource,
31    InstTypeSource,
32    SemesterSource,
[5995]33    )
[5004]34
[7321]35class IFaculty(ISIRPContainer):
[5004]36    """Representation of a university faculty.
37    """
[5948]38    code = schema.TextLine(
39        title = u'Code',
40        default = u'NA',
41        required = True,
42        readonly = True,
43        )
44
[5004]45    title = schema.TextLine(
[7667]46        title = _(u'name_of_faculty', default=u'Name of faculty'),
[5004]47        default = u'Unnamed',
48        required = True,
49        )
50
[5988]51    title_prefix = schema.Choice(
[6025]52        title = u'Name prefix',
[5004]53        default = u'faculty',
[7681]54        source = InstTypeSource(),
[5004]55        required = True,
56        )
[6561]57
[5988]58    def longtitle():
59        """
60        Returns the long title of a faculty.
[6561]61        """
62
[5951]63class IFacultyAdd(IFaculty):
64    """Representation of a university faculty.
65    """
66    code = schema.TextLine(
67        title = u'Code',
[6345]68        description = u'This code will become part of the URL.',
[5951]69        default = u'NA',
70        required = True,
71        readonly = False,
72        )
[6561]73
74IFacultyAdd['code'].order =  IFaculty['code'].order
75
[7333]76class IFacultiesContainer(ISIRPContainer):
[5004]77    """A container for faculties.
78    """
79    def addFaculty(faculty):
80        """Add an IFactulty object.
81
82        """
[7321]83class IDepartment(ISIRPObject):
[5004]84    """Representation of a department.
85    """
[5948]86    code = schema.TextLine(
87        title = u'Code',
88        default = u'NA',
89        required = True,
90        readonly = True,
91        )
92
[5004]93    title = schema.TextLine(
[6025]94        title = u'Name of department',
[5004]95        default = u'Unnamed',
96        required = True,
97        )
98
[5988]99    title_prefix = schema.Choice(
[6025]100        title = u'Name prefix',
[7681]101        source = InstTypeSource(),
[5004]102        default = u'department',
103        required = True,
104        )
105
106    courses = Attribute("A container for courses.")
107    certificates = Attribute("A container for certificates.")
[6561]108
[5988]109    def longtitle():
110        """
111        Returns the long title of a department.
112        """
[6561]113
[5951]114class IDepartmentAdd(IDepartment):
115    """Representation of a university department.
116    """
117    code = schema.TextLine(
118        title = u'Code',
[6345]119        description = u'This code will become part of the URL.',
[5951]120        default = u'NA',
121        required = True,
122        readonly = False,
123        )
[5004]124
[6561]125IDepartmentAdd['code'].order =  IDepartment['code'].order
126
[7333]127class ICoursesContainer(ISIRPContainer):
[5004]128    """A container for faculties.
129    """
[6640]130    def addCourse(course):
[5004]131        """Add an ICourse object.
132
133        Returns the key, under which the object was stored.
134        """
135
[7321]136class ICourse(ISIRPObject):
[5004]137    """Representation of a course.
138    """
139    code = schema.TextLine(
140        title = u'Code',
141        default = u'NA',
142        required = True,
143        readonly = True,
144        )
145
146    title = schema.TextLine(
147        title = u'Title of course',
148        default = u'Unnamed',
149        required = True,
150        )
151
152    credits = schema.Int(
153        title = u'Credits',
154        default = 0,
155        required = False,
156        )
[6561]157
[5004]158    passmark = schema.Int(
159        title = u'Passmark',
160        default = 40,
161        required = False,
162        )
163
164    semester = schema.Choice(
165        title = u'Semester/Term',
[7601]166        default = 9,
[7681]167        source = SemesterSource(),
[5004]168        required = True,
169        )
[6561]170
[6008]171    def longtitle():
172        """
173        Returns the long title of a course.
[6561]174        """
[5004]175
[5951]176class ICourseAdd(ICourse):
177    """Representation of a course.
178    """
179    code = schema.TextLine(
180        title = u'Code',
[6345]181        description = u'Enter unique course code which will become part of the URL.',
[5951]182        default = u'NA',
183        required = True,
184        readonly = False,
185        )
[5004]186
[6561]187ICourseAdd['code'].order =  ICourse['code'].order
188
[7321]189class ICertificate(ISIRPObject):
[5004]190    """Representation of a certificate.
191    """
192    code = schema.TextLine(
193        title = u'Code',
194        default = u'NA',
195        required = True,
[5948]196        readonly = True,
[5004]197        )
198
199    title = schema.TextLine(
[5948]200        title = u'Title',
[5951]201        default = u'Unnamed',
[5004]202        required = True,
203        )
204
[5986]205    study_mode = schema.Choice(
[5948]206        title = u'Study Mode',
[7681]207        source = StudyModeSource(),
[5951]208        default = u'ug_ft',
[5004]209        required = True,
210        )
211
[5977]212    start_level = schema.Choice(
[5948]213        title = u'Start Level',
[5977]214        vocabulary = course_levels,
215        default = 100,
[5004]216        required = True,
217        )
[6561]218
[5977]219    end_level = schema.Choice(
[5948]220        title = u'End Level',
[5977]221        vocabulary = course_levels,
222        default = 500,
[5004]223        required = True,
224        )
[6561]225
[5986]226    application_category = schema.Choice(
[5949]227        title = u'Application Category',
[7681]228        source = AppCatSource(),
[5951]229        default = u'basic',
[5986]230        required = True,
[6561]231        )
[5004]232
[6008]233    def longtitle():
234        """
235        Returns the long title of a certificate.
[6561]236        """
[6008]237
[5951]238class ICertificateAdd(ICertificate):
239    """Representation of a certificate.
240    """
241    code = schema.TextLine(
242        title = u'Code',
243        default = u'NA',
[6345]244        description = u'Enter unique certificate code which will become part of the URL.',
[5951]245        required = True,
246        readonly = False,
247        )
[6561]248
249ICertificateAdd['code'].order =  ICertificate['code'].order
250
[7333]251class ICertificatesContainer(ISIRPContainer):
[5004]252    """A container for certificates.
253    """
[6640]254    def addCertificate(certificate):
[5004]255        """Add an ICertificate object.
256
257        Returns the key, under which the object was stored.
258        """
259
[7321]260class ICertificateCourse(ISIRPObject):
[6561]261    """A certificatecourse is referring a course and provides some own
262       attributes.
[5004]263    """
264    course = schema.Choice(
[5977]265        title = u'Course referrer',
[5004]266        source = CourseSource(),
[5950]267        readonly = True,
[5004]268        )
[6561]269
[5977]270    level = schema.Choice(
[5951]271        title = u'Level',
[5004]272        required = True,
[5977]273        vocabulary = course_levels,
[5950]274        readonly = False,
[5004]275        )
276
[7665]277    mandatory = schema.Bool(
[5004]278        title = u'Is mandatory course (not elective)',
279        required = True,
[5950]280        default = True,
[5004]281        )
282
283    def getCourseCode():
[5977]284        """Return the code of the course referred to.
[5004]285
286        This is needed for cataloging.
287        """
[6561]288
[6008]289    def longtitle():
290        """
291        Returns the long title of a certificatecourse.
[6561]292        """
293
294
[5951]295class ICertificateCourseAdd(ICertificateCourse):
[6561]296    """A certificatecourse is referring a course and
[5951]297       provides some own attributes.
298    """
299    course = schema.Choice(
[5977]300        title = u'Course',
[5951]301        source = CourseSource(),
302        readonly = False,
303        )
[6561]304
305ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order
Note: See TracBrowser for help on using the repository browser.