Ignore:
Timestamp:
31 May 2013, 17:48:29 (11 years ago)
Author:
Henrik Bettermann
Message:

Define correct dictionaries. level_dict must include probation levels.

Add buttons for navigating to transcripts.

Add property attribute 'transcript_enabled' which eases defining conditions in custom packages.

File:
1 edited

Legend:

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

    r10262 r10266  
    166166    return True
    167167
     168def level_dict(studycourse):
     169    portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     170    level_dict = {}
     171    studylevelsource = StudyLevelSource().factory
     172    for code in studylevelsource.getValues(studycourse):
     173        title = translate(studylevelsource.getTitle(studycourse, code),
     174            'waeup.kofa', target_language=portal_language)
     175        level_dict[code] = title
     176    return level_dict
     177
    168178class StudentsBreadcrumb(Breadcrumb):
    169179    """A breadcrumb for the students container.
     
    9911001
    9921002    @property
    993     def level_dict(self):
     1003    def level_dicts(self):
    9941004        studylevelsource = StudyLevelSource().factory
    9951005        for code in studylevelsource.getValues(self.context):
     
    9981008
    9991009    @property
    1000     def session_dict(self):
     1010    def session_dicts(self):
    10011011        yield(dict(code='', title='--'))
    10021012        for item in academic_sessions():
     
    10581068
    10591069    def update(self):
     1070        if not self.context.student.transcript_enabled:
     1071            self.flash(_('You are not allowed to view the transcript.'))
     1072            self.redirect(self.url(self.context))
     1073            return
    10601074        super(StudyCourseTranscriptPage, self).update()
    10611075        self.semester_dict = getUtility(IKofaUtils).SEMESTER_DICT
     1076        self.level_dict = level_dict(self.context)
    10621077        self.session_dict = dict(
    10631078            [(item[1], item[0]) for item in academic_sessions()])
    1064         self.course_levels = course_levels
    10651079        self.studymode_dict = getUtility(IKofaUtils).STUDY_MODES_DICT
    10661080        return
     
    10871101
    10881102    def update(self):
     1103        if not self.context.student.transcript_enabled:
     1104            self.flash(_('You are not allowed to download the transcript.'))
     1105            self.redirect(self.url(self.context))
     1106            return
    10891107        super(ExportPDFTranscriptPage, self).update()
    10901108        self.semester_dict = getUtility(IKofaUtils).SEMESTER_DICT
     1109        self.level_dict = level_dict(self.context)
    10911110        self.session_dict = dict(
    10921111            [(item[1], item[0]) for item in academic_sessions()])
    1093         self.course_levels = course_levels
    10941112        self.studymode_dict = getUtility(IKofaUtils).STUDY_MODES_DICT
    10951113        return
Note: See TracChangeset for help on using the changeset viewer.