app/soc/views/models/organization.py
changeset 1599 b56976cac36b
parent 1598 a55296590875
child 1600 0aa3de1b2acc
equal deleted inserted replaced
1598:a55296590875 1599:b56976cac36b
    16 
    16 
    17 """Views for Organizations.
    17 """Views for Organizations.
    18 """
    18 """
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
       
    21     '"Augie Fackler" <durin42@gmail.com>',
    21     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    22     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    22     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    23     '"Lennard de Rijk" <ljvderijk@gmail.com>',
    23   ]
    24   ]
    24 
    25 
    25 
    26 
   104     new_params['sans_link_id_public_list'] = True
   105     new_params['sans_link_id_public_list'] = True
   105 
   106 
   106     patterns = []
   107     patterns = []
   107 
   108 
   108     patterns += [(r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$',
   109     patterns += [(r'^%(url_name)s/(?P<access_type>apply_mentor)/%(scope)s$',
   109         'soc.views.models.%(module_name)s.apply_mentor', 
   110         'soc.views.models.%(module_name)s.apply_mentor',
   110         "List of all %(name_plural)s you can apply to"),
   111         "List of all %(name_plural)s you can apply to"),
   111         (r'^%(url_name)s/(?P<access_type>list_proposals)/%(key_fields)s$',
   112         (r'^%(url_name)s/(?P<access_type>list_proposals)/%(key_fields)s$',
   112         'soc.views.models.%(module_name)s.list_proposals', 
   113         'soc.views.models.%(module_name)s.list_proposals',
   113         "List of all Student Proposals for this %(name)s"),]
   114         "List of all Student Proposals for this %(name)s"),]
   114 
   115 
   115     new_params['extra_django_patterns'] = patterns
   116     new_params['extra_django_patterns'] = patterns
   116 
   117 
   117     new_params['create_extra_dynaproperties'] = {
   118     new_params['create_extra_dynaproperties'] = {
   148 
   149 
   149   @decorators.merge_params
   150   @decorators.merge_params
   150   @decorators.check_access
   151   @decorators.check_access
   151   def applyMentor(self, request, access_type,
   152   def applyMentor(self, request, access_type,
   152                   page_name=None, params=None, **kwargs):
   153                   page_name=None, params=None, **kwargs):
   153     """Shows a list of all organizations and you can choose one to 
   154     """Shows a list of all organizations and you can choose one to
   154        apply to become a mentor.
   155        apply to become a mentor.
   155 
   156 
   156     Args:
   157     Args:
   157       request: the standard Django HTTP request object
   158       request: the standard Django HTTP request object
   158       access_type : the name of the access type which should be checked
   159       access_type : the name of the access type which should be checked
   167         'you want to become a Mentor for.')
   168         'you want to become a Mentor for.')
   168 
   169 
   169     filter = {'scope_path': kwargs['scope_path'],
   170     filter = {'scope_path': kwargs['scope_path'],
   170               'status' : 'active'}
   171               'status' : 'active'}
   171 
   172 
   172     return self.list(request, access_type, 
   173     return self.list(request, access_type,
   173         page_name, params=list_params, filter=filter)
   174         page_name, params=list_params, filter=filter)
   174 
   175 
   175   @decorators.merge_params
   176   @decorators.merge_params
   176   @decorators.check_access
   177   @decorators.check_access
   177   def listProposals(self, request, access_type,
   178   def listProposals(self, request, access_type,
   264       submenu = (redirects.getInviteRedirectForRole(group_entity, 'mentor'),
   265       submenu = (redirects.getInviteRedirectForRole(group_entity, 'mentor'),
   265           "Invite a Mentor", 'any_access')
   266           "Invite a Mentor", 'any_access')
   266       submenus.append(submenu)
   267       submenus.append(submenu)
   267 
   268 
   268       # add a link to the request page
   269       # add a link to the request page
   269       submenu = (redirects.getListRequestsRedirect(group_entity, params), 
   270       submenu = (redirects.getListRequestsRedirect(group_entity, params),
   270           "List Requests and Invites", 'any_access')
   271           "List Requests and Invites", 'any_access')
   271       submenus.append(submenu)
   272       submenus.append(submenu)
   272 
   273 
   273       # add a link to the edit page
   274       # add a link to the edit page
   274       submenu = (redirects.getEditRedirect(group_entity, params), 
   275       submenu = (redirects.getEditRedirect(group_entity, params),
   275           "Edit Organization Profile", 'any_access')
   276           "Edit Organization Profile", 'any_access')
   276       submenus.append(submenu)
   277       submenus.append(submenu)
   277 
   278 
   278     if roles.get('org_admin') or roles.get('mentor'):
   279     if roles.get('org_admin') or roles.get('mentor'):
   279       submenu = (redirects.getCreateDocumentRedirect(group_entity, 'org'),
   280       submenu = (redirects.getCreateDocumentRedirect(group_entity, 'org'),
   285       submenus.append(submenu)
   286       submenus.append(submenu)
   286 
   287 
   287 
   288 
   288     if roles.get('org_admin'):
   289     if roles.get('org_admin'):
   289       # add a link to the resign page
   290       # add a link to the resign page
   290       submenu = (redirects.getManageRedirect(roles['org_admin'], 
   291       submenu = (redirects.getManageRedirect(roles['org_admin'],
   291           {'url_name': 'org_admin'}), 
   292           {'url_name': 'org_admin'}),
   292           "Resign as Admin", 'any_access')
   293           "Resign as Admin", 'any_access')
   293       submenus.append(submenu)
   294       submenus.append(submenu)
   294 
   295 
   295       # add a link to the edit page
   296       # add a link to the edit page
   296       submenu = (redirects.getEditRedirect(roles['org_admin'],
   297       submenu = (redirects.getEditRedirect(roles['org_admin'],
   299       submenus.append(submenu)
   300       submenus.append(submenu)
   300 
   301 
   301 
   302 
   302     if roles.get('mentor'):
   303     if roles.get('mentor'):
   303       # add a link to the resign page
   304       # add a link to the resign page
   304       submenu = (redirects.getManageRedirect(roles['mentor'], 
   305       submenu = (redirects.getManageRedirect(roles['mentor'],
   305           {'url_name' : 'mentor'}), 
   306           {'url_name' : 'mentor'}),
   306           "Resign as Mentor", 'any_access')
   307           "Resign as Mentor", 'any_access')
   307       submenus.append(submenu)
   308       submenus.append(submenu)
   308 
   309 
   309       # add a link to the edit page
   310       # add a link to the edit page
   310       submenu = (redirects.getEditRedirect(roles['mentor'],
   311       submenu = (redirects.getEditRedirect(roles['mentor'],