59 to provide the user with list, public, create, edit and delete views. |
59 to provide the user with list, public, create, edit and delete views. |
60 |
60 |
61 Params: |
61 Params: |
62 original_params: a dict with params for this View |
62 original_params: a dict with params for this View |
63 """ |
63 """ |
64 |
64 |
65 from soc.views.models import program as program_view |
65 from soc.views.models import program as program_view |
66 |
66 |
67 rights = access.Checker(params) |
67 rights = access.Checker(params) |
68 rights['any_access'] = ['allow'] |
68 rights['any_access'] = ['allow'] |
69 rights['show'] = ['allow'] |
69 rights['show'] = ['allow'] |
70 rights['create'] = ['checkIsDeveloper'] |
70 rights['create'] = ['checkIsDeveloper'] |
71 rights['edit'] = [('checkHasActiveRoleForKeyFieldsAsScope', |
71 rights['edit'] = [('checkHasActiveRoleForKeyFieldsAsScope', |
273 |
273 |
274 # update the prop_list with the ranking and coloring information |
274 # update the prop_list with the ranking and coloring information |
275 prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking, |
275 prop_list['info'] = (list_info_helper.getStudentProposalInfo(ranking, |
276 assigned_proposals), None) |
276 assigned_proposals), None) |
277 |
277 |
|
278 # check if the current user is a mentor |
|
279 user_entity = user_logic.logic.getForCurrentAccount() |
|
280 |
|
281 fields = {'user': user_entity, |
|
282 'scope': org_entity,} |
|
283 mentor_entity = mentor_logic.logic.getForFields(fields, unique=True) |
|
284 |
|
285 if mentor_entity: |
|
286 mp_params = list_params.copy() # proposals mentored by current user |
|
287 |
|
288 description = ugettext('List of %s sent to %s you are mentoring') % ( |
|
289 mp_params['name_plural'], org_entity.name) |
|
290 mp_params['list_description'] = description |
|
291 mp_params['list_action'] = (redirects.getReviewRedirect, mp_params) |
|
292 |
|
293 filter = {'org': org_entity, |
|
294 'mentor': mentor_entity, |
|
295 'status': 'pending'} |
|
296 |
|
297 mp_list = lists.getListContent( |
|
298 request, mp_params, filter, idx=1, need_content=True) |
|
299 |
278 new_params = list_params.copy() # new proposals |
300 new_params = list_params.copy() # new proposals |
279 new_params['list_description'] = 'List of new %s sent to %s ' % ( |
301 new_params['list_description'] = 'List of new %s sent to %s ' % ( |
280 new_params['name_plural'], org_entity.name) |
302 new_params['name_plural'], org_entity.name) |
281 new_params['list_action'] = (redirects.getReviewRedirect, new_params) |
303 new_params['list_action'] = (redirects.getReviewRedirect, new_params) |
282 |
304 |
283 filter = {'org': org_entity, |
305 filter = {'org': org_entity, |
284 'status': 'new'} |
306 'status': 'new'} |
285 |
307 |
286 contents = [] |
308 contents = [] |
287 new_list = lists.getListContent( |
309 new_list = lists.getListContent( |
288 request, new_params, filter, idx=1, need_content=True) |
310 request, new_params, filter, idx=2, need_content=True) |
289 |
311 |
290 ip_params = list_params.copy() # ineligible proposals |
312 ip_params = list_params.copy() # ineligible proposals |
291 |
313 |
292 description = ugettext('List of ineligible %s sent to %s ') % ( |
314 description = ugettext('List of ineligible %s sent to %s ') % ( |
293 ip_params['name_plural'], org_entity.name) |
315 ip_params['name_plural'], org_entity.name) |
297 |
319 |
298 filter = {'org': org_entity, |
320 filter = {'org': org_entity, |
299 'status': 'invalid'} |
321 'status': 'invalid'} |
300 |
322 |
301 ip_list = lists.getListContent( |
323 ip_list = lists.getListContent( |
302 request, ip_params, filter, idx=1, need_content=True) |
324 request, ip_params, filter, idx=3, need_content=True) |
303 |
325 |
304 # fill contents with all the needed lists |
326 # fill contents with all the needed lists |
305 if new_list != None: |
327 if new_list != None: |
306 contents.append(new_list) |
328 contents.append(new_list) |
307 |
329 |
308 contents.append(prop_list) |
330 contents.append(prop_list) |
|
331 |
|
332 if mentor_entity and mp_list != None: |
|
333 contents.append(mp_list) |
309 |
334 |
310 if ip_list != None: |
335 if ip_list != None: |
311 contents.append(ip_list) |
336 contents.append(ip_list) |
312 |
337 |
313 # call the _list method from base to display the list |
338 # call the _list method from base to display the list |