Changeset 13908 for main/waeup.kofa/trunk/src/waeup/kofa/browser
- Timestamp:
- 10 Jun 2016, 08:15:54 (9 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/browser
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r13813 r13908 365 365 self.redirect(self.application_url() + rel_link) 366 366 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 367 372 if not self.camefrom: 368 373 self.redirect(self.application_url() + '/index') … … 978 983 return site_roles_userfriendly 979 984 985 class 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 980 1009 # 981 1010 # Search pages... -
main/waeup.kofa/trunk/src/waeup/kofa/browser/viewlets.py
r13898 r13908 300 300 url = self.view.url(grok.getSite(), self.link) 301 301 text = translate(self.text, context=self.request) 302 return u'<li><a href="%s">%s</a></li>' % ( 303 url, text) 302 return u'<li><a href="%s">%s</a></li>' % (url, text) 304 303 305 304 class ManagePortalConfiguration(ManageLink): … … 339 338 text = _(u'Reports') 340 339 340 class LecturerCourses(ManageLink): 341 """A link to courses of lecturers. 342 """ 343 grok.order(6) 344 grok.require('waeup.Authenticated') 345 346 link = u'my_courses' 347 text = _(u'My Courses') 348 349 def render(self): 350 user_account = get_user_account(self.request) 351 if user_account: 352 local_roles = user_account.getLocalRoles() 353 if local_roles.has_key('waeup.local.Lecturer'): 354 url = self.view.url(grok.getSite(), self.link) 355 text = translate(self.text, context=self.request) 356 return u'<li><a href="%s">%s</a></li>' % (url, text) 357 return '' 358 341 359 class MyPreferences(ManageLink): 342 360 """A link to personal preferences, placed in upper left box. 343 361 """ 344 grok.order( 6)362 grok.order(7) 345 363 grok.require('waeup.Public') 346 364 text = _(u'My Preferences') … … 351 369 url = self.view.url(account_object) 352 370 text = translate(self.text, context=self.request) 353 return u'<li><a href="%s">%s</a></li>' % ( 354 url, text) 371 return u'<li><a href="%s">%s</a></li>' % (url, text) 355 372 return '' 356 373 … … 358 375 """A link to display site and local roles. 359 376 """ 360 grok.order( 7)377 grok.order(8) 361 378 grok.require('waeup.Public') 362 379 text = _(u'My Roles') … … 367 384 url = self.view.url(account_object) + '/my_roles' 368 385 text = translate(self.text, context=self.request) 369 return u'<li><a href="%s">%s</a></li>' % ( 370 url, text) 386 return u'<li><a href="%s">%s</a></li>' % (url, text) 371 387 return '' 372 388
Note: See TracChangeset for help on using the changeset viewer.