app/soc/views/models/program.py
changeset 2543 4c95d717a976
parent 2540 1e44d71c0e3e
child 2706 198926c38229
equal deleted inserted replaced
2542:a9dec4763c6b 2543:4c95d717a976
    50 from soc.views.helper import redirects
    50 from soc.views.helper import redirects
    51 from soc.views.helper import widgets
    51 from soc.views.helper import widgets
    52 from soc.views.models import presence
    52 from soc.views.models import presence
    53 from soc.views.models import document as document_view
    53 from soc.views.models import document as document_view
    54 from soc.views.models import sponsor as sponsor_view
    54 from soc.views.models import sponsor as sponsor_view
    55 from soc.views.models import survey as survey_view
       
    56 from soc.views.sitemap import sidebar
    55 from soc.views.sitemap import sidebar
    57 
    56 
    58 import soc.cache.logic
    57 import soc.cache.logic
    59 import soc.logic.models.program
    58 import soc.logic.models.program
    60 import soc.models.work
    59 import soc.models.work
   618 
   617 
   619     Args:
   618     Args:
   620       params: a dict with params for this View.
   619       params: a dict with params for this View.
   621     """
   620     """
   622 
   621 
       
   622     from soc.views.models import survey as survey_view
       
   623     from soc.views.models import project_survey as project_survey_view
       
   624     from soc.views.models import grading_project_survey as grading_survey_view
       
   625 
   623     logic = params['logic']
   626     logic = params['logic']
   624     rights = params['rights']
   627     rights = params['rights']
   625 
   628 
   626     # only get all invisible and visible programs
   629     # only get all invisible and visible programs
   627     fields = {'status': ['invisible', 'visible']}
   630     fields = {'status': ['invisible', 'visible']}
   635       items = []
   638       items = []
   636 
   639 
   637       if entity.status == 'visible':
   640       if entity.status == 'visible':
   638         # show the documents for this program, even for not logged in users
   641         # show the documents for this program, even for not logged in users
   639         items += document_view.view.getMenusForScope(entity, params)
   642         items += document_view.view.getMenusForScope(entity, params)
       
   643         items += survey_view.view.getMenusForScope(entity, params, id, user)
       
   644         items += project_survey_view.view.getMenusForScope(
       
   645             entity, params, id, user)
       
   646         items += grading_survey_view.view.getMenusForScope(
       
   647             entity, params, id, user)
   640         items += self._getTimeDependentEntries(entity, params, id, user)
   648         items += self._getTimeDependentEntries(entity, params, id, user)
   641 
       
   642       try:
   649       try:
   643         # check if the current user is a host for this program
   650         # check if the current user is a host for this program
   644         rights.doCachedCheck('checkIsHostForProgram',
   651         rights.doCachedCheck('checkIsHostForProgram',
   645                              {'scope_path': entity.scope_path,
   652                              {'scope_path': entity.scope_path,
   646                               'link_id': entity.link_id}, [])
   653                               'link_id': entity.link_id}, [])
   647 
   654 
   648         if entity.status == 'invisible':
   655         if entity.status == 'invisible':
   649           # still add the document links so hosts can see how it looks like
   656           # still add the document links so hosts can see how it looks like
   650           items += document_view.view.getMenusForScope(entity, params)
   657           items += document_view.view.getMenusForScope(entity, params)
       
   658           items += survey_view.view.getMenusForScope(entity, params, id, user)
       
   659           items += project_survey_view.view.getMenusForScope(
       
   660               entity, params, id, user)
       
   661           items += grading_survey_view.view.getMenusForScope(
       
   662               entity, params, id, user)
   651           items += self._getTimeDependentEntries(entity, params, id, user)
   663           items += self._getTimeDependentEntries(entity, params, id, user)
   652 
   664 
   653         items += [(redirects.getReviewOverviewRedirect(
   665         items += [(redirects.getReviewOverviewRedirect(
   654             entity, {'url_name': 'org_app'}),
   666             entity, {'url_name': 'org_app'}),
   655             "Review Organization Applications", 'any_access')]
   667             "Review Organization Applications", 'any_access')]