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
--- 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.
--- 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)