app/soc/views/models/program.py
changeset 1643 7b33b9442c81
parent 1584 d8ba8c917f37
child 1698 a8da5a620236
equal deleted inserted replaced
1642:a9308b2462fc 1643:7b33b9442c81
    62     """
    62     """
    63 
    63 
    64     rights = access.Checker(params)
    64     rights = access.Checker(params)
    65     rights['any_access'] = ['allow']
    65     rights['any_access'] = ['allow']
    66     rights['show'] = ['allow']
    66     rights['show'] = ['allow']
    67     rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope', host_logic.logic])]
    67     rights['create'] = [('checkSeeded', ['checkHasActiveRoleForScope', 
       
    68         host_logic.logic])]
    68     rights['edit'] = ['checkIsHostForProgram']
    69     rights['edit'] = ['checkIsHostForProgram']
    69     rights['delete'] = ['checkIsDeveloper']
    70     rights['delete'] = ['checkIsDeveloper']
    70 
    71 
    71     new_params = {}
    72     new_params = {}
    72     new_params['logic'] = soc.logic.models.program.logic
    73     new_params['logic'] = soc.logic.models.program.logic
   181     entities = logic.getForFields(fields)
   182     entities = logic.getForFields(fields)
   182 
   183 
   183     menus = []
   184     menus = []
   184 
   185 
   185     rights.setCurrentUser(id, user)
   186     rights.setCurrentUser(id, user)
   186     filter_args = {}
       
   187 
   187 
   188     for entity in entities:
   188     for entity in entities:
   189       items = []
   189       items = []
   190 
   190 
   191       if entity.status == 'visible':
   191       if entity.status == 'visible':
   234       menus.append(menu)
   234       menus.append(menu)
   235 
   235 
   236     return menus
   236     return menus
   237 
   237 
   238   def _getTimeDependentEntries(self, program_entity, params, id, user):
   238   def _getTimeDependentEntries(self, program_entity, params, id, user):
       
   239     """Returns a list with time dependent menu items.
       
   240     """
   239     items = []
   241     items = []
   240 
   242 
   241     #TODO(ljvderijk) Add more timeline dependent entries
   243     #TODO(ljvderijk) Add more timeline dependent entries
   242     timeline_entity = program_entity.timeline
   244     timeline_entity = program_entity.timeline
   243 
   245 
   282             "Register as a Student", 'any_access')]
   284             "Register as a Student", 'any_access')]
   283 
   285 
   284     if timeline_helper.isAfterEvent(timeline_entity,
   286     if timeline_helper.isAfterEvent(timeline_entity,
   285         'accepted_organization_announced_deadline'):
   287         'accepted_organization_announced_deadline'):
   286       # add a link to list all the organizations
   288       # add a link to list all the organizations
   287       items += [(redirects.getPublicListRedirect(program_entity, {'url_name': 'org'}),
   289       items += [(redirects.getPublicListRedirect(program_entity, 
       
   290           {'url_name': 'org'}),
   288           "List participating Organizations", 'any_access')]
   291           "List participating Organizations", 'any_access')]
   289 
   292 
   290       if not student_entity:
   293       if not student_entity:
   291         # add apply to become a mentor link
   294         # add apply to become a mentor link
   292         items += [('/org/apply_mentor/%s' % (program_entity.key().name()),
   295         items += [('/org/apply_mentor/%s' % (program_entity.key().name()),
   293          "Apply to become a Mentor", 'any_access')]
   296          "Apply to become a Mentor", 'any_access')]
   294 
   297 
   295     return items
   298     return items
   296 
   299 
   297   def _getStudentEntries(self, program_entity, student_entity, params, id, user):
   300   def _getStudentEntries(self, program_entity, student_entity, 
       
   301                          params, id, user):
   298     """Returns a list with menu items for students in a specific program.
   302     """Returns a list with menu items for students in a specific program.
   299     """
   303     """
   300 
   304 
   301     items = []
   305     items = []
   302 
   306 
   303     timeline_entity = program_entity.timeline
   307     timeline_entity = program_entity.timeline
   304 
   308 
   305     if timeline_helper.isActivePeriod(timeline_entity, 'student_signup'):
   309     if timeline_helper.isActivePeriod(timeline_entity, 'student_signup'):
   306       items += [('/student_proposal/list_orgs/%s' % (student_entity.key().name()),
   310       items += [('/student_proposal/list_orgs/%s' % (
       
   311           student_entity.key().name()),
   307           "Submit your Student Proposal", 'any_access')]
   312           "Submit your Student Proposal", 'any_access')]
   308       items += [(redirects.getListSelfRedirect(student_entity,
   313       items += [(redirects.getListSelfRedirect(student_entity,
   309              {'url_name':'student_proposal'}),
   314           {'url_name':'student_proposal'}),
   310          "List my Student Proposals", 'any_access')]
   315          "List my Student Proposals", 'any_access')]
   311 
   316 
   312     return items
   317     return items
   313 
   318 
   314   def _getOrganizationEntries(self, program_entity, org_admin_entity,
   319   def _getOrganizationEntries(self, program_entity, org_admin_entity,