Ignore:
Timestamp:
10 Jun 2016, 08:15:54 (8 years ago)
Author:
Henrik Bettermann
Message:

Add LecturerLandingPage and LecturerCourses ManageLink viewlet.

File:
1 edited

Legend:

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

    r13813 r13908  
    365365                    self.redirect(self.application_url() + rel_link)
    366366                    return
     367                # Redirect lecturer after login
     368                local_roles = get_user_account(self.request).getLocalRoles()
     369                if local_roles.has_key('waeup.local.Lecturer'):
     370                    self.redirect(self.application_url() + '/my_courses')
     371                    return
    367372                if not self.camefrom:
    368373                    self.redirect(self.application_url() + '/index')
     
    978983        return site_roles_userfriendly
    979984
     985class LecturerLandingPage(KofaPage):
     986    """Display courses when lecturer logs in.
     987    """
     988    grok.name('my_courses')
     989    grok.require('waeup.Authenticated')
     990    grok.context(IUniversity)
     991    grok.template('mycourses')
     992    label =_('My Courses')
     993
     994    @property
     995    def academic_session(self):
     996        current_academic_session = grok.getSite()[
     997            'configuration'].current_academic_session
     998        if current_academic_session:
     999            session = academic_sessions_vocab.getTerm(
     1000                current_academic_session).title
     1001            return session
     1002        return _('no academic session set')
     1003
     1004    @property
     1005    def getCourses(self):
     1006        local_roles = get_user_account(self.request).getLocalRoles()
     1007        return local_roles['waeup.local.Lecturer']
     1008
    9801009#
    9811010# Search pages...
Note: See TracChangeset for help on using the changeset viewer.