"""Interfaces of academics specific objects. """ from zope import schema from zope.interface import Attribute from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer) from waeup.sirp.university.vocabularies import ( course_levels, semester, application_categories, study_mode, inst_types, CourseSource, ) class IFaculty(IWAeUPContainer): """Representation of a university faculty. """ code = schema.TextLine( title = u'Code', description = u'Abbreviated code of the faculty', default = u'NA', required = True, readonly = True, ) title = schema.TextLine( title = u'Name of faculty', default = u'Unnamed', required = True, ) title_prefix = schema.Choice( title = u'Name prefix', default = u'faculty', vocabulary = inst_types, required = True, ) def longtitle(): """ Returns the long title of a faculty. """ class IFacultyAdd(IFaculty): """Representation of a university faculty. """ code = schema.TextLine( title = u'Code', description = u'Abbreviated code of the faculty', default = u'NA', required = True, readonly = False, ) IFacultyAdd['code'].order = IFaculty['code'].order class IFacultyContainer(IWAeUPContainer): """A container for faculties. """ def addFaculty(faculty): """Add an IFactulty object. Returns the key, under which the object was stored. """ class IDepartment(IWAeUPObject): """Representation of a department. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the department', required = True, readonly = True, ) title = schema.TextLine( title = u'Name of department', default = u'Unnamed', required = True, ) title_prefix = schema.Choice( title = u'Name prefix', vocabulary = inst_types, default = u'department', required = True, ) courses = Attribute("A container for courses.") certificates = Attribute("A container for certificates.") def longtitle(): """ Returns the long title of a department. """ class IDepartmentAdd(IDepartment): """Representation of a university department. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the department', required = True, readonly = False, ) IDepartmentAdd['code'].order = IDepartment['code'].order class ICourseContainer(IWAeUPContainer): """A container for faculties. """ def addCourse(faculty): """Add an ICourse object. Returns the key, under which the object was stored. """ class ICourse(IWAeUPObject): """Representation of a course. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the course', required = True, readonly = True, ) title = schema.TextLine( title = u'Title of course', default = u'Unnamed', required = True, ) credits = schema.Int( title = u'Credits', default = 0, required = False, ) passmark = schema.Int( title = u'Passmark', default = 40, required = False, ) semester = schema.Choice( title = u'Semester/Term', default = 0, vocabulary = semester, required = True, ) def longtitle(): """ Returns the long title of a course. """ class ICourseAdd(ICourse): """Representation of a course. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the course', required = True, readonly = False, ) ICourseAdd['code'].order = ICourse['code'].order class ICertificate(IWAeUPObject): """Representation of a certificate. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the certificate.', required = True, readonly = True, ) title = schema.TextLine( title = u'Title', default = u'Unnamed', required = True, ) study_mode = schema.Choice( title = u'Study Mode', vocabulary = study_mode, default = u'ug_ft', required = True, ) start_level = schema.Choice( title = u'Start Level', #source = LevelSource(), vocabulary = course_levels, default = 100, required = True, ) end_level = schema.Choice( title = u'End Level', #source = LevelSource(), vocabulary = course_levels, default = 500, required = True, ) application_category = schema.Choice( title = u'Application Category', vocabulary = application_categories, default = u'basic', required = True, ) def longtitle(): """ Returns the long title of a certificate. """ class ICertificateAdd(ICertificate): """Representation of a certificate. """ code = schema.TextLine( title = u'Code', default = u'NA', description = u'Abbreviated code of the certificate.', required = True, readonly = False, ) ICertificateAdd['code'].order = ICertificate['code'].order class ICertificateContainer(IWAeUPContainer): """A container for certificates. """ def addCertificate(faculty): """Add an ICertificate object. Returns the key, under which the object was stored. """ class ICertificateCourse(IWAeUPObject): """A certificatecourse is referring a course and provides some own attributes. """ course = schema.Choice( title = u'Course referrer', source = CourseSource(), readonly = True, ) level = schema.Choice( title = u'Level', required = True, #source = LevelSource(), vocabulary = course_levels, readonly = False, ) core_or_elective = schema.Bool( title = u'Is mandatory course (not elective)', required = True, default = True, ) def getCourseCode(): """Return the code of the course referred to. This is needed for cataloging. """ def longtitle(): """ Returns the long title of a certificatecourse. """ class ICertificateCourseAdd(ICertificateCourse): """A certificatecourse is referring a course and provides some own attributes. """ course = schema.Choice( title = u'Course', source = CourseSource(), readonly = False, ) ICertificateCourseAdd['course'].order = ICertificateCourse['course'].order