# HG changeset patch # User Sverre Rabbelier # Date 1234714259 0 # Node ID b3bbc6fa18efde6540a1f56f0f927f8411e8fd8b # Parent 1c5c6271f02ea0ddd5902912e9105c19f742e3a4 Keep a global list of all known Roles This is to facilitate a view with a list of a user's roles. Patch by: Sverre Rabbelier diff -r 1c5c6271f02e -r b3bbc6fa18ef app/soc/views/models/role.py --- a/app/soc/views/models/role.py Sun Feb 15 15:53:38 2009 +0000 +++ b/app/soc/views/models/role.py Sun Feb 15 16:10:59 2009 +0000 @@ -45,6 +45,19 @@ import soc.views.helper.widgets +ROLE_VIEWS = {} + + +def addRole(view): + """Adds the specified view to the known role views. + """ + + global ROLE_VIEWS + params = view.getParams() + name = params['url_name'] + ROLE_VIEWS[name] = view + + class View(base.View): """Views for all entities that inherit from Role. diff -r 1c5c6271f02e -r b3bbc6fa18ef app/soc/views/sitemap/build.py --- a/app/soc/views/sitemap/build.py Sun Feb 15 15:53:38 2009 +0000 +++ b/app/soc/views/sitemap/build.py Sun Feb 15 16:10:59 2009 +0000 @@ -43,10 +43,15 @@ from soc.views.models import user from soc.views.models import user_self +from soc.views.models import role + from soc.views.sitemap import sidebar from soc.views.sitemap import sitemap +# TODO: instead of commenting out club stuff, make it depend on a setting + + sidebar.addMenu(user_self.view.getSidebarMenus) #sidebar.addMenu(club.view.getSidebarMenus) #sidebar.addMenu(club.view.getExtraMenus) @@ -87,6 +92,12 @@ sitemap.addPages(user_self.view.getDjangoURLPatterns()) sitemap.addPages(user.view.getDjangoURLPatterns()) +#role.addRole(club_admin.view) +#role.addRole(club_member.view) +role.addRole(host.view) +role.addRole(org_admin.view) +role.addRole(mentor.view) + def getPatterns(): return defaults.patterns(None, *sitemap.SITEMAP)