Changeset 7179
- Timestamp:
- 23 Nov 2011, 15:14:34 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/browser
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r7178 r7179 43 43 from waeup.sirp.widgets.restwidget import ReSTDisplayWidget 44 44 from waeup.sirp.authentication import get_principal_role_manager 45 from waeup.sirp.utils.helpers import get_user_account 45 46 46 47 grok.context(IWAeUPObject) … … 360 361 grok.require('waeup.editUser') 361 362 form_fields = grok.AutoFields(IUserAccount).omit('name', 'roles') 362 363 def label(self): 364 return "My preferences (username = %s)" % self.context.__name__ 363 label = u"My Preferences" 364 365 def title(self): 366 return "%s (%s)" % (self.context.title, self.context.__name__) 367 368 class MyRolesPage(WAeUPPage): 369 """Display site roles and local roles assigned to officers. 370 """ 371 grok.name('my_roles') 372 grok.require('waeup.editUser') 373 grok.context(IUserAccount) 374 grok.template('myrolespage') 375 title = 'Portal Users' 376 label = u"My Roles" 377 378 def title(self): 379 return "%s (%s)" % (self.context.title, self.context.__name__) 380 381 @property 382 def getLocalRoles(self): 383 #import pdb; pdb.set_trace() 384 local_roles = get_user_account(self.request).getLocalRoles() 385 local_roles_userfriendly = {} 386 for local_role in local_roles: 387 role_title = dict(getAllRoles())[local_role].title 388 local_roles_userfriendly[role_title] = local_roles[local_role] 389 return local_roles_userfriendly 390 391 @property 392 def getSiteRoles(self): 393 site_roles = get_user_account(self.request).roles 394 site_roles_userfriendly = [] 395 for site_role in site_roles: 396 role_title = dict(getAllRoles())[site_role].title 397 site_roles_userfriendly.append(role_title) 398 return site_roles_userfriendly 399 400 class MyStudentsPage(WAeUPPage): 401 """Browse students dynamically assigned to officers. 402 """ 403 grok.name('my_students') 404 grok.require('waeup.editUser') 405 grok.context(IUserAccount) 406 grok.template('mystudentspage') 407 title = 'Portal Users' 408 label = u"My Students" 409 410 def title(self): 411 return "%s (%s)" % (self.context.title, self.context.__name__) 365 412 366 413 # -
main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
r7175 r7179 346 346 return 347 347 348 class MyRoles(LeftSidebarLink): 349 """A link to display site and local roles. 350 """ 351 grok.order(8) 352 grok.require('waeup.Public') 353 title = u'My Roles' 354 icon = '' 355 356 @property 357 def url(self): 358 account_object = get_user_account(self.request) 359 if account_object: 360 return self.view.url(account_object) + '/my_roles' 361 return 362 363 class MyStudents(LeftSidebarLink): 364 """A link to list students dynamically assigned to officers. 365 """ 366 grok.order(9) 367 grok.require('waeup.Public') 368 title = u'My Students' 369 icon = '' 370 371 @property 372 def url(self): 373 account_object = get_user_account(self.request) 374 if account_object: 375 return self.view.url(account_object) + '/my_students' 376 return 377 348 378 # 349 379 # Manage ("Edit settings") actions...
Note: See TracChangeset for help on using the changeset viewer.