Added organization entity sidebar entries.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/views/models/club.py Wed Feb 11 20:04:29 2009 +0000
+++ b/app/soc/views/models/club.py Wed Feb 11 20:05:33 2009 +0000
@@ -174,6 +174,11 @@
"Edit Club Profile", 'any_access')
submenus.append(submenu)
+ if roles.get('club_member') or roles.get('club_admin'):
+ submenu = (redirects.getCreateDocumentRedirect(group_entity, 'club'),
+ "Create a New Document", 'any_access')
+ submenus.append(submenu)
+
# add a link to resign as club admin
submenu = (redirects.getManageRedirect(roles['club_admin'],
{'url_name': 'club_admin'}),
@@ -187,11 +192,6 @@
"Resign as Club Member", 'any_access')
submenus.append(submenu)
- if roles.get('club_member') or roles.get('club_admin'):
- submenu = (redirects.getCreateDocumentRedirect(group_entity, 'club'),
- "Create a New Document", 'any_access')
- submenus.append(submenu)
-
return submenus
--- a/app/soc/views/models/organization.py Wed Feb 11 20:04:29 2009 +0000
+++ b/app/soc/views/models/organization.py Wed Feb 11 20:05:33 2009 +0000
@@ -106,8 +106,60 @@
params['applicant_create_form'] = applicant_create_form
- # TODO(ljvderijk) define several menu items for organizations
- #def _getExtraMenuItems(self, role_description, params=None):
+ def _getExtraMenuItems(self, role_description, params=None):
+ """Used to create the specific Organization menu entries.
+
+ For args see group.View._getExtraMenuItems().
+ """
+ submenus = []
+
+ group_entity = role_description['group']
+ roles = role_description['roles']
+
+ if roles.get('org_admin'):
+ # add a link to the management page
+ submenu = (redirects.getListRolesRedirect(group_entity, params),
+ "Manage Admins and Mentors", 'any_access')
+ submenus.append(submenu)
+
+ # add a link to invite an org admin
+ submenu = (redirects.getInviteRedirectForRole(group_entity, 'org_admin'),
+ "Invite an Org Admin", 'any_access')
+ submenus.append(submenu)
+
+ # add a link to invite a member
+ submenu = (redirects.getInviteRedirectForRole(group_entity, 'mentor'),
+ "Invite a Mentor", 'any_access')
+ submenus.append(submenu)
+
+ # add a link to the request page
+ submenu = (redirects.getListRequestsRedirect(group_entity, params),
+ "List Requests and Invites", 'any_access')
+ submenus.append(submenu)
+
+ # add a link to the edit page
+ submenu = (redirects.getEditRedirect(group_entity, params),
+ "Edit Organization Profile", 'any_access')
+ submenus.append(submenu)
+
+ if roles.get('org_admin') or roles.get('mentor'):
+ submenu = (redirects.getCreateDocumentRedirect(group_entity, 'org'),
+ "Create a New Document", 'any_access')
+ submenus.append(submenu)
+
+ if roles.get('org_admin'):
+ submenu = (redirects.getManageRedirect(roles['org_admin'],
+ {'url_name': 'org_admin'}),
+ "Resign as Org Admin", 'any_access')
+ submenus.append(submenu)
+
+ if roles.get('mentor'):
+ submenu = (redirects.getManageRedirect(roles['mentor'],
+ {'url_name' : 'mentor'}),
+ "Resign as Mentor", 'any_access')
+ submenus.append(submenu)
+
+ return submenus
view = View()
--- a/app/soc/views/sitemap/build.py Wed Feb 11 20:04:29 2009 +0000
+++ b/app/soc/views/sitemap/build.py Wed Feb 11 20:05:33 2009 +0000
@@ -63,6 +63,7 @@
sidebar.addMenu(program.view.getSidebarMenus)
sidebar.addMenu(program.view.getExtraMenus)
sidebar.addMenu(organization.view.getSidebarMenus)
+sidebar.addMenu(organization.view.getExtraMenus)
sidebar.addMenu(org_admin.view.getSidebarMenus)
sidebar.addMenu(mentor.view.getSidebarMenus)
sidebar.addMenu(org_app.view.getSidebarMenus)