app/soc/views/models/program.py
changeset 1144 f89bbc9b20a6
parent 1115 0a723ff3d27c
child 1162 1d9396d75c13
equal deleted inserted replaced
1143:b07b7d5b3e27 1144:f89bbc9b20a6
    77         'description': forms.fields.CharField(widget=helper.widgets.TinyMCE(
    77         'description': forms.fields.CharField(widget=helper.widgets.TinyMCE(
    78             attrs={'rows':10, 'cols':40})),
    78             attrs={'rows':10, 'cols':40})),
    79 
    79 
    80         'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
    80         'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
    81 
    81 
    82         'workflow' : forms.ChoiceField(choices=[('gsoc','Project-based'),
    82         'workflow': forms.ChoiceField(choices=[('gsoc','Project-based'),
    83             ('ghop','Task-based')], required=True),
    83             ('ghop','Task-based')], required=True),
    84         }
    84         }
    85 
    85 
    86     new_params['edit_extra_dynafields'] = {
    86     new_params['edit_extra_dynafields'] = {
    87         'workflow': forms.CharField(widget=widgets.ReadOnlyInput(),
    87         'workflow': forms.CharField(widget=widgets.ReadOnlyInput(),
   155         items += document_view.view.getMenusForScope(entity, params)
   155         items += document_view.view.getMenusForScope(entity, params)
   156 
   156 
   157       try:
   157       try:
   158         # check if the current user is a host for this program
   158         # check if the current user is a host for this program
   159         rights.doCachedCheck('checkIsHostForProgram', 
   159         rights.doCachedCheck('checkIsHostForProgram', 
   160             {'scope_path' : entity.scope_path,
   160             {'scope_path': entity.scope_path,
   161             'link_id' : entity.link_id,
   161             'link_id': entity.link_id,
   162             'workflow' : entity.workflow}, [])
   162             'workflow': entity.workflow}, [])
   163 
   163 
   164         if entity.status == 'invisible':
   164         if entity.status == 'invisible':
   165           # still add the document links so hosts can see how it looks like
   165           # still add the document links so hosts can see how it looks like
   166           items += document_view.view.getMenusForScope(entity, params)
   166           items += document_view.view.getMenusForScope(entity, params)
   167 
   167 
   171         # add link to edit Program Timeline
   171         # add link to edit Program Timeline
   172         items += [(redirects.getEditRedirect(entity, {'url_name': 'timeline'}),
   172         items += [(redirects.getEditRedirect(entity, {'url_name': 'timeline'}),
   173             "Edit Program Timeline", 'any_access')]
   173             "Edit Program Timeline", 'any_access')]
   174         # add link to create a new Program Document
   174         # add link to create a new Program Document
   175         items += [(redirects.getCreateDocumentRedirect(entity, 'program'),
   175         items += [(redirects.getCreateDocumentRedirect(entity, 'program'),
   176           "Create new document", 'any_access')]
   176             "Create a New Document", 'any_access')]
   177 
   177 
   178       except out_of_band.Error:
   178       except out_of_band.Error:
   179         pass
   179         pass
   180 
   180 
   181       menu = {}
   181       menu = {}