Changeset 6774


Ignore:
Timestamp:
14 Sep 2011, 21:14:05 (13 years ago)
Author:
Henrik Bettermann
Message:

Add StudentStudyLevel? container class. These containers will contain the course tickets. The study level containers correspond with the the 'course lists' which have to be registered at the beginning of each session.

  • work in progress -
Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6773 r6774  
    3434    IStudentsContainer, IStudent, IStudentClearance, IStudentPasswordSetting,
    3535    IStudentPersonal, IStudentBase, IStudentStudyCourse, IStudentPayments,
    36     IStudentAccommodation, IStudentClearanceEdit,
     36    IStudentAccommodation, IStudentClearanceEdit, IStudentStudyLevel,
    3737    )
    3838from waeup.sirp.students.catalog import search
    3939from waeup.sirp.students.workflow import CLEARANCE
     40from waeup.sirp.students.studylevel import StudentStudyLevel
    4041
    4142# Save function used for save methods in manager pages
     
    132133    grok.name('setpassword')
    133134    grok.require('waeup.Public')
     135    grok.template('setpassword')
    134136    title = ''
    135137    label = 'Set password for first-time login'
     
    475477        return
    476478
     479    @grok.action('Add level')
     480    def addStudyLevel(self, **data):
     481        studylevel = StudentStudyLevel()
     482        studylevel.level = str(self.context.current_level)
     483        self.context.addStudentStudyLevel(studylevel)
     484        return
     485
     486class StudyCourseAddActionButton(AddActionButton):
     487    grok.order(1)
     488    grok.context(IStudentStudyCourse)
     489    grok.view(StudyCourseManageFormPage)
     490    grok.require('waeup.manageStudents')
     491    text = 'Add study level'
     492    target = ''
     493
     494class StudyLevelDisplayFormPage(WAeUPDisplayFormPage):
     495    """ Page to display student study levels
     496    """
     497    grok.context(IStudentStudyLevel)
     498    grok.name('index')
     499    grok.require('waeup.viewStudent')
     500    form_fields = grok.AutoFields(IStudentStudyCourse)
     501    #grok.template('studylevelpage')
     502    title = 'Study Level'
     503    pnav = 4
     504
     505    @property
     506    def label(self):
     507        return '%s: Study Level' % self.context.__parent__.name
     508
    477509class PaymentsDisplayFormPage(WAeUPDisplayFormPage):
    478510    """ Page to display the student payments
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6771 r6774  
    202202        )
    203203
     204class IStudentStudyLevel(IWAeUPObject):
     205    """A container for course tickets.
     206
     207    """
     208    level = Attribute('The level code')
     209
    204210class IStudentAccommodation(IWAeUPObject):
    205211    """A container for student accommodation objects.
  • main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py

    r6642 r6774  
    2222from zope.component.interfaces import IFactory
    2323from waeup.sirp.students.interfaces import (
    24     IStudentStudyCourse, IStudentNavigation)
     24    IStudentStudyCourse, IStudentNavigation, IStudentStudyLevel)
    2525from waeup.sirp.utils.helpers import attrs_to_fields
    2626
     
    3838        return self.__parent__
    3939
     40    def addStudentStudyLevel(self, studylevel):
     41        """Add a study level object.
     42        """
     43        if not IStudentStudyLevel.providedBy(studylevel):
     44            raise TypeError(
     45                'StudentStudyCourses contain only IStudentStudyLevel instances')
     46        self[studylevel.level] = studylevel
     47        return
     48
    4049StudentStudyCourse = attrs_to_fields(StudentStudyCourse)
Note: See TracChangeset for help on using the changeset viewer.