Ignore:
Timestamp:
16 May 2015, 09:21:45 (10 years ago)
Author:
Henrik Bettermann
Message:

Add more sources viewlets.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/browser
Files:
2 edited

Legend:

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

    r12932 r12955  
    7373from waeup.kofa.students.catalog import StudentQueryResultItem
    7474from waeup.kofa.students.interfaces import IStudentsUtils
    75 from waeup.kofa.students.vocabularies import StudyLevelSource
     75from waeup.kofa.students.vocabularies import StudyLevelSource, GenderSource
    7676
    7777FORBIDDEN_CHARACTERS = (160,)
     
    511511        return
    512512
    513     def _set_levels(self):
     513    def _set_course_levels(self):
     514        vocab_terms = course_levels.by_value.values()
     515        self.course_levels = sorted([(x.token, x.title,) for x in vocab_terms])
     516        return
     517
     518    def _set_study_levels(self):
    514519        studylevelsource = StudyLevelSource().factory
    515         self.levels = []
     520        self.study_levels = []
    516521        for code in studylevelsource.getValues(None):
    517522            title = studylevelsource.getTitle(None, code)
    518             self.levels.append((code, title))
     523            self.study_levels.append((code, title))
    519524        return
    520525
     
    553558        return
    554559
     560    def _set_sex(self):
     561        gendersource = GenderSource().factory
     562        self.sex = []
     563        for sex in gendersource.getValues():
     564            title = gendersource.getTitle(sex)
     565            self.sex.append((sex, title))
     566        return
     567
    555568    def update(self):
    556569        self._set_inst_types()
    557570        self._set_sessions()
    558         self._set_levels()
     571        self._set_course_levels()
     572        self._set_study_levels()
    559573        self._set_study_modes()
    560574        self._set_student_states()
     
    564578        self._set_app_cats()
    565579        self._set_payment_cats()
     580        self._set_sex()
    566581
    567582class AdministrationPage(KofaPage):
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/viewlets.py

    r12954 r12955  
    844844
    845845class InstTypesSource(grok.Viewlet):
    846     """Avalable institution types for the sources overview page.
     846    """Available institution types for the sources overview page.
    847847    """
    848848    grok.order(1)
     
    871871
    872872class SessionSource(InstTypesSource):
    873     """Avalable sessions for the sources overview page.
     873    """Available sessions for the sources overview page.
    874874    """
    875875    grok.order(2)
     
    878878    title = _('Academic Sessions')
    879879
     880class CourseLevelSource(InstTypesSource):
     881    """Available course levels for the sources overview page.
     882    """
     883    grok.order(3)
     884    name = 'CourseLevels'
     885    source_name = 'course_levels'
     886    title = _('Course Levels')
     887
    880888class StudyLevelSource(InstTypesSource):
    881     """Avalable study levels for the sources overview page.
    882     """
    883     grok.order(3)
    884     name = 'Levels'
    885     source_name = 'levels'
     889    """Available study levels for the sources overview page.
     890    """
     891    grok.order(4)
     892    name = 'StudyLevels'
     893    source_name = 'study_levels'
    886894    title = _('Study Levels')
    887895
    888896class StudyModeSource(InstTypesSource):
    889     """Avalable study modes for the sources overview page.
    890     """
    891     grok.order(4)
     897    """Available study modes for the sources overview page.
     898    """
     899    grok.order(5)
    892900    name = 'StudyModes'
    893901    source_name = 'study_modes'
     
    895903
    896904class AppCatsSource(InstTypesSource):
    897     """Avalable application categories for the sources overview page.
     905    """Available application categories for the sources overview page.
    898906    """
    899907    grok.order(5)
     
    902910    title = _('Application Categories')
    903911
     912class PaymentCatsSource(InstTypesSource):
     913    """Available payment categories for the sources overview page.
     914    """
     915    grok.order(6)
     916    name = 'PaymentCats'
     917    source_name = 'payment_cats'
     918    title = _('Payment Categories')
     919
    904920class StudentStatesSource(InstTypesSource):
    905     """Avalable student sates for the sources overview page.
     921    """Available student sates for the sources overview page.
    906922    """
    907923    grok.order(1)
     
    913929
    914930class VerdictsSource(InstTypesSource):
    915     """Avalable verdicts for the sources overview page.
     931    """Available verdicts for the sources overview page.
    916932    """
    917933    grok.order(2)
     
    922938    title = _('Verdicts')
    923939
    924 class PaymentCatsSource(InstTypesSource):
    925     """Avalable payment categories for the sources overview page.
    926     """
    927     grok.order(3)
    928     grok.viewletmanager(SourcesRight)
    929     column = 'right'
    930     name = 'PaymentCats'
    931     source_name = 'payment_cats'
    932     title = _('Payment Categories')
    933 
    934940class ExamSubjectsSource(InstTypesSource):
    935     """Avalable exam subjects for the sources overview page.
     941    """Available exam subjects for the sources overview page.
    936942    """
    937943    grok.order(4)
     
    943949
    944950class ExamGradesSource(InstTypesSource):
    945     """Avalable exam grades for the sources overview page.
     951    """Available exam grades for the sources overview page.
    946952    """
    947953    grok.order(5)
     
    952958    title = _('Exam Grades')
    953959
     960class SexSource(InstTypesSource):
     961    """Available sex values for the sources overview page.
     962    """
     963    grok.order(6)
     964    grok.viewletmanager(SourcesRight)
     965    column = 'right'
     966    name = 'Sex'
     967    source_name = 'sex'
     968    title = _('Sex')
     969
Note: See TracChangeset for help on using the changeset viewer.