# HG changeset patch # User Pawel Solyga # Date 1239012704 0 # Node ID dd3eb2770205916006f1e507b75923bded07bef4 # Parent a07ff1e1bd1f261b6e3e88cc495938232def2330 Make "Mark as Ineligible" reversable and make this feature available for mentors too. Now also with every click on "Mark as Ineligible" or "Mark as Eligible" button a private comment is posted with message "Marked Student Proposal as Ineligible/Eligible" which will help keep track of the changes made by mentors/org admins. Patch by: Pawel Solyga Reviewed by: to-be-reviewed diff -r a07ff1e1bd1f -r dd3eb2770205 app/soc/templates/soc/student_proposal/review.html --- a/app/soc/templates/soc/student_proposal/review.html Sun Apr 05 23:39:36 2009 +0000 +++ b/app/soc/templates/soc/student_proposal/review.html Mon Apr 06 10:11:44 2009 +0000 @@ -123,11 +123,18 @@ {% endif %} {% endif %} - {% if is_org_admin %} + {% if is_org_admin or is_mentor %} + {% ifequal entity.status "invalid" %} + + + + {% else %} + onclick="if (confirm('Are you sure you want to mark this proposal as ineligible?')) { location.href='?ineligible=1'; }"/> + {% endifequal %} {% endif %} diff -r a07ff1e1bd1f -r dd3eb2770205 app/soc/views/models/student_proposal.py --- a/app/soc/views/models/student_proposal.py Sun Apr 05 23:39:36 2009 +0000 +++ b/app/soc/views/models/student_proposal.py Mon Apr 06 10:11:44 2009 +0000 @@ -711,15 +711,35 @@ if mentor and choice: self._adjustPossibleMentors(entity, mentor, choice) - is_ineligible = get_dict.get('ineligible') - if org_admin and is_ineligible: - # mark the proposal invalid and return to the list - properties = {'status': 'invalid'} - self._logic.updateEntityProperties(entity, properties) + ineligible = get_dict.get('ineligible') + + if org_admin: + reviewer = org_admin + elif mentor: + reviewer = mentor + + if (org_admin or mentor) and ineligible != None: + ineligible = int(ineligible) + if ineligible == 1: + # mark the proposal invalid and return to the list + properties = {'status': 'invalid'} + self._logic.updateEntityProperties(entity, properties) - redirect = redirects.getListProposalsRedirect(entity.org, - {'url_name': 'org'}) - return http.HttpResponseRedirect(redirect) + redirect = redirects.getListProposalsRedirect(entity.org, + {'url_name': 'org'}) + comment = "Marked Student Proposal as Ineligible." + self._createReviewFor(entity, reviewer, comment, is_public=False) + return http.HttpResponseRedirect(redirect) + elif ineligible == 0: + # mark the proposal as new and return to the list + properties = {'status': 'new'} + self._logic.updateEntityProperties(entity, properties) + + redirect = redirects.getListProposalsRedirect(entity.org, + {'url_name': 'org'}) + comment = "Marked Student Proposal as Eligible." + self._createReviewFor(entity, reviewer, comment, is_public=False) + return http.HttpResponseRedirect(redirect) # check if we should change the subscription state for the current user public_subscription = None @@ -862,6 +882,7 @@ # which button should we show to the mentor? if mentor: + context['is_mentor'] = True if mentor.key() in possible_mentors: # show "No longer willing to mentor" context['remove_me_as_mentor'] = True