Add a 'list documents' link everywhere
Also disable the Documents sidebar menu, since it does not provide
anything useful anymore.
Patch by: Sverre Rabbelier
--- a/app/soc/views/models/club.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/club.py Sat Feb 14 15:57:53 2009 +0000
@@ -180,6 +180,10 @@
"Create a New Document", 'any_access')
submenus.append(submenu)
+ submenu = (redirects.getListDocumentsRedirect(group_entity, 'club'),
+ "List Documents", 'any_access')
+ submenus.append(submenu)
+
if roles.get('club_admin'):
# add a link to resign as club admin
submenu = (redirects.getManageRedirect(roles['club_admin'],
--- a/app/soc/views/models/organization.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/organization.py Sat Feb 14 15:57:53 2009 +0000
@@ -154,6 +154,10 @@
"Create a New Document", 'any_access')
submenus.append(submenu)
+ submenu = (redirects.getListDocumentsRedirect(group_entity, 'org'),
+ "List Documents", 'any_access')
+ submenus.append(submenu)
+
if roles.get('org_admin'):
# add a link to the resign page
submenu = (redirects.getManageRedirect(roles['org_admin'],
--- a/app/soc/views/models/program.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/program.py Sat Feb 14 15:57:53 2009 +0000
@@ -189,7 +189,7 @@
if entity.status == 'visible':
# show the documents for this program, even for not logged in users
items += document_view.view.getMenusForScope(entity, params)
- items += self._getTimeDependentEntries(entity, params)
+ items += self._getTimeDependentEntries(entity, params, id, user)
try:
# check if the current user is a host for this program
@@ -214,6 +214,9 @@
# add link to create a new Program Document
items += [(redirects.getCreateDocumentRedirect(entity, 'program'),
"Create a New Document", 'any_access')]
+ # add link to list all Program Document
+ items += [(redirects.getListDocumentsRedirect(entity, 'program'),
+ "List Documents", 'any_access')]
except out_of_band.Error:
pass
@@ -230,18 +233,19 @@
return menus
- def _getTimeDependentEntries(self, program_entity, params):
+ def _getTimeDependentEntries(self, program_entity, params, id, user):
items = []
#TODO(ljvderijk) Add more timeline dependent entries
timeline_entity = program_entity.timeline
- if timeline_helper.isActivePeriod(timeline_entity, 'org_signup'):
+ if user and timeline_helper.isActivePeriod(timeline_entity, 'org_signup'):
# add the organization signup link
items += [
(redirects.getApplyRedirect(program_entity, {'url_name': 'org_app'}),
"Apply to become an Organization", 'any_access')]
+ # add the 'list my orgs' link
items += [
(redirects.getListSelfRedirect(program_entity, {'url_name' : 'org_app'}),
"List my Org Applications", 'any_access')]
--- a/app/soc/views/models/site.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/site.py Sat Feb 14 15:57:53 2009 +0000
@@ -120,6 +120,9 @@
submenus += [(redirects.getCreateDocumentRedirect(entity, 'site'),
"Create a New Document", 'any_access')]
+ submenus += [(redirects.getListDocumentsRedirect(entity, 'site'),
+ "List Documents", 'any_access')]
+
new_params = {}
new_params['sidebar_additional'] = submenus
--- a/app/soc/views/models/sponsor.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/sponsor.py Sat Feb 14 15:57:53 2009 +0000
@@ -114,10 +114,16 @@
"Resign as Host", 'any_access')
submenus.append(submenu)
+ # add a link to create a new document
submenu = (redirects.getCreateDocumentRedirect(group_entity, 'sponsor'),
"Create a New Document", 'any_access')
submenus.append(submenu)
+ # add a link to list all documents
+ submenu = (redirects.getListDocumentsRedirect(group_entity, 'sponsor'),
+ "List Documents", 'any_access')
+ submenus.append(submenu)
+
return submenus
--- a/app/soc/views/models/user_self.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/models/user_self.py Sat Feb 14 15:57:53 2009 +0000
@@ -237,6 +237,9 @@
items += [(redirects.getCreateDocumentRedirect(user, 'user'),
"Create a New Document", 'any_access')]
+ items += [(redirects.getListDocumentsRedirect(user, 'user'),
+ "List Documents", 'any_access')]
+
new_params = {}
new_params['sidebar_additional'] = items
--- a/app/soc/views/sitemap/build.py Sat Feb 14 15:57:14 2009 +0000
+++ b/app/soc/views/sitemap/build.py Sat Feb 14 15:57:53 2009 +0000
@@ -55,7 +55,7 @@
#sidebar.addMenu(club_app.view.getSidebarMenus)
sidebar.addMenu(site.view.getSidebarMenus)
sidebar.addMenu(user.view.getSidebarMenus)
-sidebar.addMenu(document.view.getSidebarMenus)
+#sidebar.addMenu(document.view.getSidebarMenus)
sidebar.addMenu(sponsor.view.getSidebarMenus)
sidebar.addMenu(sponsor.view.getExtraMenus)
sidebar.addMenu(host.view.getSidebarMenus)