Allowing student project review page to be viewed in read-only mode after the deadline has passed.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student_proposal/review_after_deadline.html Mon Apr 20 20:56:56 2009 +0000
@@ -0,0 +1,58 @@
+{% extends "soc/base.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+{% load comments_helpers %}
+{% load forms_helpers %}
+
+{% block header_title %}
+{{ page_name }} (Score: {{ entity.score }})
+{% endblock %}
+
+{% block body %}
+<p>
+ <table>
+ {% readonly_field_as_table_row entity.fields.title.label entity.title %}
+ {% readonly_field_as_table_row "Student" student_name %}
+ {% readonly_field_as_table_row "Mentor" mentor_name %}
+ {% readonly_field_as_table_row "Possible Mentors" possible_mentors %}
+ {% readonly_field_as_table_row entity.fields.abstract.label entity.abstract %}
+ {% readonly_safe_field_as_table_row entity.fields.content.label entity.content %}
+ {% readonly_url_field_as_table_row entity.fields.additional_info.label entity.additional_info %}
+ {% readonly_field_as_table_row "Created on" entity.created_on %}
+ {% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %}
+ </table>
+</p>
+
+<hr />
+<b>Summary of Reviews</b>:
+{% for key, value in review_summary.items %}
+ <li>{{ value.name }} ({{ value.total_comments }} posts, {{ value.total_score }} points)</li>
+{% endfor %}
+
+<hr />
+
+
+<hr />
+<b>Public Reviews</b>
+{% for review in public_reviews %}
+ {% as_student_proposal_review review student %}
+{% endfor %}
+<hr />
+<b>Private Reviews</b>
+{% for review in private_reviews %}
+ {% as_student_proposal_review review student %}
+{% endfor %}
+<hr />
+
+{% endblock %}
--- a/app/soc/views/models/student_proposal.py Mon Apr 20 19:08:47 2009 +0000
+++ b/app/soc/views/models/student_proposal.py Mon Apr 20 20:56:56 2009 +0000
@@ -86,7 +86,8 @@
('checkCanStudentPropose', ['scope_path', True])]
rights['review'] = [('checkRoleAndStatusForStudentProposal',
[['org_admin', 'mentor', 'host'],
- ['active'], ['new', 'pending', 'invalid']])]
+ ['active'],
+ ['new', 'pending', 'accepted', 'rejected', 'invalid']])]
new_params = {}
new_params['logic'] = soc.logic.models.student_proposal.logic
@@ -146,6 +147,7 @@
new_params['edit_template'] = 'soc/student_proposal/edit.html'
new_params['review_template'] = 'soc/student_proposal/review.html'
+ new_params['review_after_deadline_template'] = 'soc/student_proposal/review_after_deadline.html'
params = dicts.merge(params, new_params)
@@ -615,6 +617,9 @@
For Args see base.View.public().
"""
+ from soc.logic.helper import timeline as timeline_helper
+
+
try:
entity = self._logic.getFromKeyFieldsOr404(kwargs)
except out_of_band.Error, error:
@@ -630,6 +635,12 @@
context['entity_type'] = params['name']
context['entity_type_url'] = params['url_name']
+ program_entity = entity.program
+
+ if timeline_helper.isAfterEvent(program_entity.timeline, 'accepted_students_announced_deadline'):
+ return self.reviewAfterDeadline(request, context, params, entity,
+ **kwargs)
+
# get the roles important for reviewing an application
filter = {'user': user_logic.logic.getForCurrentAccount(),
'scope': entity.org,
@@ -750,13 +761,14 @@
self._adjustPossibleMentors(entity, mentor, choice)
ineligible = get_dict.get('ineligible')
-
+
if org_admin:
reviewer = org_admin
elif mentor:
reviewer = mentor
-
- if (org_admin or mentor) and ineligible != None:
+
+ if (org_admin or mentor) and (ineligible != None) and (
+ entity.status not in ['accepted', 'rejected']):
ineligible = int(ineligible)
if ineligible == 1:
# mark the proposal invalid and return to the list
@@ -867,6 +879,19 @@
return responses.respond(request, template, context=context)
+ def reviewAfterDeadline(self,request, context, params, entity,**kwargs):
+ """View that shows the review view after the accepted students announced deadline.
+
+ For Args see base.View.public().
+ """
+
+ review_context = self._getDefaultReviewContext(entity, None, None)
+ context = dicts.merge(context, review_context)
+
+ template = params['review_after_deadline_template']
+
+ return responses.respond(request, template, context=context)
+
def _getDefaultReviewContext(self, entity, org_admin,
mentor):
"""Returns the default context for the review page.