Add a 'Create new document' link for clubs, sponsors and programs
Patch by: Sverre Rabbelier
--- a/app/soc/views/models/club.py Fri Jan 30 22:01:52 2009 +0000
+++ b/app/soc/views/models/club.py Fri Jan 30 22:02:20 2009 +0000
@@ -261,17 +261,17 @@
if roles.get('club_admin'):
# add a link to the management page
- submenu = (redirects.getListRolesRedirect(group_entity, params),
+ submenu = (redirects.getListRolesRedirect(group_entity, params),
"Manage Admins and Members", 'any_access')
submenus.append(submenu)
# add a link to invite an admin
- submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_admin'),
+ submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_admin'),
"Invite an Admin", 'any_access')
submenus.append(submenu)
# add a link to invite a member
- submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_member'),
+ submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_member'),
"Invite a Member", 'any_access')
submenus.append(submenu)
@@ -298,6 +298,11 @@
"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 new document", 'any_access')
+ submenus.append(submenu)
+
return submenus
--- a/app/soc/views/models/program.py Fri Jan 30 22:01:52 2009 +0000
+++ b/app/soc/views/models/program.py Fri Jan 30 22:02:20 2009 +0000
@@ -152,10 +152,18 @@
except out_of_band.Error:
continue
+ items = document_view.view.getMenusForScope(entity, params)
+
+ try:
+ rights.doCachedCheck('checkIsHost', {}, [])
+ items += [(redirects.getEditRedirect(entity, params),'Edit','any_access')]
+ items += [(redirects.getCreateDocumentRedirect(entity, 'program'),
+ "Create new document", 'any_access')]
+ except out_of_band.Error:
+ pass
+
menu = {}
menu['heading'] = entity.short_name
- items = document_view.view.getMenusForScope(entity, params)
- items += [(redirects.getEditRedirect(entity, params),'Edit','edit')]
menu['items'] = sidebar.getSidebarMenu(id, user, items, params=params)
menu['group'] = 'Programs'
menus.append(menu)
--- a/app/soc/views/models/sponsor.py Fri Jan 30 22:01:52 2009 +0000
+++ b/app/soc/views/models/sponsor.py Fri Jan 30 22:02:20 2009 +0000
@@ -106,6 +106,10 @@
"Resign as Host", 'any_access')
submenus.append(submenu)
+ submenu = (redirects.getCreateDocumentRedirect(group_entity, 'sponsor'),
+ "Create new document", 'any_access')
+ submenus.append(submenu)
+
return submenus