69 [['proposer'], ['active'], ['new', 'pending']])] |
69 [['proposer'], ['active'], ['new', 'pending']])] |
70 rights['delete'] = ['checkIsDeveloper'] |
70 rights['delete'] = ['checkIsDeveloper'] |
71 rights['show'] = [ |
71 rights['show'] = [ |
72 ('checkRoleAndStatusForStudentProposal', |
72 ('checkRoleAndStatusForStudentProposal', |
73 [['proposer', 'org_admin', 'mentor', 'host'], |
73 [['proposer', 'org_admin', 'mentor', 'host'], |
74 ['active', 'inactive'], ['new', 'pending', 'accepted', 'rejected']])] |
74 ['active', 'inactive'], |
|
75 ['new', 'pending', 'accepted', 'rejected']])] |
75 rights['list'] = ['checkIsDeveloper'] |
76 rights['list'] = ['checkIsDeveloper'] |
76 rights['list_orgs'] = [ |
77 rights['list_orgs'] = [ |
77 ('checkIsStudent', ['scope_path', ['active']]), |
78 ('checkIsStudent', ['scope_path', ['active']]), |
78 ('checkCanStudentPropose', 'scope_path')] |
79 ('checkCanStudentPropose', 'scope_path')] |
79 rights['list_self'] = [ |
80 rights['list_self'] = [ |
194 }, |
195 }, |
195 ] |
196 ] |
196 |
197 |
197 dynaproperties = params_helper.getDynaFields(dynafields) |
198 dynaproperties = params_helper.getDynaFields(dynafields) |
198 |
199 |
199 mentor_review_form = dynaform.newDynaForm(dynamodel=None, dynabase=helper.forms.BaseForm, |
200 mentor_review_form = dynaform.newDynaForm(dynamodel=None, |
200 dynainclude=None, dynaexclude=None, dynaproperties=dynaproperties) |
201 dynabase=helper.forms.BaseForm, dynainclude=None, |
|
202 dynaexclude=None, dynaproperties=dynaproperties) |
201 params['mentor_review_form'] = mentor_review_form |
203 params['mentor_review_form'] = mentor_review_form |
202 |
204 |
203 # TODO see if autocomplete can be used for this field |
205 # TODO see if autocomplete can be used for this field |
204 dynafields = [ |
206 dynafields = [ |
205 {'name': 'mentor', |
207 {'name': 'mentor', |
209 }, |
211 }, |
210 ] |
212 ] |
211 |
213 |
212 dynaproperties = params_helper.getDynaFields(dynafields) |
214 dynaproperties = params_helper.getDynaFields(dynafields) |
213 |
215 |
214 admin_review_form = dynaform.extendDynaForm(dynaform=mentor_review_form, dynaproperties=dynaproperties) |
216 admin_review_form = dynaform.extendDynaForm(dynaform=mentor_review_form, |
|
217 dynaproperties=dynaproperties) |
215 |
218 |
216 params['admin_review_form'] = admin_review_form |
219 params['admin_review_form'] = admin_review_form |
217 |
220 |
218 def _editGet(self, request, entity, form): |
221 def _editGet(self, request, entity, form): |
219 """See base.View._editGet(). |
222 """See base.View._editGet(). |
356 |
359 |
357 @decorators.merge_params |
360 @decorators.merge_params |
358 @decorators.check_access |
361 @decorators.check_access |
359 def listSelf(self, request, access_type, |
362 def listSelf(self, request, access_type, |
360 page_name=None, params=None, **kwargs): |
363 page_name=None, params=None, **kwargs): |
361 """Lists all proposals from the current logged-in user for the given student. |
364 """Lists all proposals from the current logged-in user |
|
365 for the given student. |
362 |
366 |
363 For params see base.View.public(). |
367 For params see base.View.public(). |
364 """ |
368 """ |
365 |
369 |
366 student_entity = student_logic.logic.getFromKeyName(kwargs['scope_path']) |
370 student_entity = student_logic.logic.getFromKeyName(kwargs['scope_path']) |
383 |
387 |
384 For Args see base.View.public(). |
388 For Args see base.View.public(). |
385 """ |
389 """ |
386 |
390 |
387 try: |
391 try: |
388 entity = self._logic.getFromKeyFieldsOr404(kwargs) |
392 entity = self._logic.getFromKeyFieldsOr404(kwargs) |
389 except out_of_band.Error, error: |
393 except out_of_band.Error, error: |
390 return helper.responses.errorResponse( |
394 return helper.responses.errorResponse( |
391 error, request, template=params['error_public']) |
395 error, request, template=params['error_public']) |
392 |
396 |
393 # get the context for this webpage |
397 # get the context for this webpage |
412 'status': 'active'} |
416 'status': 'active'} |
413 |
417 |
414 org_admin_entity = org_admin_logic.logic.getForFields(filter, unique=True) |
418 org_admin_entity = org_admin_logic.logic.getForFields(filter, unique=True) |
415 mentor_entity = mentor_logic.logic.getForFields(filter, unique=True) |
419 mentor_entity = mentor_logic.logic.getForFields(filter, unique=True) |
416 |
420 |
417 # check if the current user is a mentor and wants to change his role for this app |
421 # check if the current user is a mentor and wants |
|
422 # to change his role for this app |
418 choice = request.GET.get('mentor') |
423 choice = request.GET.get('mentor') |
419 if mentor_entity and choice: |
424 if mentor_entity and choice: |
420 self._adjustPossibleMentors(entity, mentor_entity, choice) |
425 self._adjustPossibleMentors(entity, mentor_entity, choice) |
421 |
426 |
422 # set the possible mentors in the context |
427 # set the possible mentors in the context |
485 name = org_admin.name() |
490 name = org_admin.name() |
486 elif mentor: |
491 elif mentor: |
487 name = mentor.name() |
492 name = mentor.name() |
488 |
493 |
489 # TODO(ljvderijk) hook up comments |
494 # TODO(ljvderijk) hook up comments |
490 comment = '%s has given %i points \n %s' %(name, given_score, comment) |
495 comment = '%s has given %i points \n %s' % (name, given_score, comment) |
491 |
496 |
492 properties = {'score': new_score} |
497 properties = {'score': new_score} |
493 |
498 |
494 # if the proposal is new we change it status to pending |
499 # if the proposal is new we change it status to pending |
495 if entity.status == 'new': |
500 if entity.status == 'new': |