diff --git a/colleges/forms.py b/colleges/forms.py index 3c1c8f31148a8d5cc3efe8a798a7bdd5cc5bf83e..4968ae748ce693b1b9be65a9508c49474cac2b15 100644 --- a/colleges/forms.py +++ b/colleges/forms.py @@ -86,6 +86,30 @@ class FellowshipRemoveSubmissionForm(forms.ModelForm): return fellowship +class FellowVotingRemoveSubmissionForm(forms.ModelForm): + """ + Use this form in admin-accessible views only! It could possibly reveal the + identity of the Editor-in-charge! + """ + class Meta: + model = Fellowship + fields = [] + + def __init__(self, *args, **kwargs): + self.submission = kwargs.pop('submission') + super().__init__(*args, **kwargs) + + def clean(self): + if self.submission.editor_in_charge == self.instance.contributor: + self.add_error(None, ('Submission cannot be removed as the Fellow is' + ' Editor-in-charge of this Submission.')) + + def save(self): + fellowship = self.instance + fellowship.voting_pool.remove(self.submission) + return fellowship + + class FellowshipAddSubmissionForm(forms.ModelForm): submission = forms.ModelChoiceField(queryset=None, to_field_name='arxiv_identifier_w_vn_nr', empty_label="Please choose the Submission to add to the pool") @@ -126,6 +150,28 @@ class SubmissionAddFellowshipForm(forms.ModelForm): return submission +class SubmissionAddVotingFellowForm(forms.ModelForm): + fellowship = forms.ModelChoiceField( + queryset=None, to_field_name='id', + empty_label="Please choose the Fellow to add to the Submission's Voting Fellows") + + class Meta: + model = Submission + fields = [] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + pool = self.instance.voting_fellows.values_list('id', flat=True) + self.fields['fellowship'].queryset = Fellowship.objects.active().exclude(id__in=pool) + + def save(self): + fellowship = self.cleaned_data['fellowship'] + submission = self.instance + submission.fellows.add(fellowship) + submission.voting_fellows.add(fellowship) + return submission + + class FellowshipRemoveProceedingsForm(forms.ModelForm): """ Use this form in admin-accessible views only! It could possibly reveal the diff --git a/colleges/permissions.py b/colleges/permissions.py new file mode 100644 index 0000000000000000000000000000000000000000..cd67ccbd87274b017b8f19380120c66f07b75ca6 --- /dev/null +++ b/colleges/permissions.py @@ -0,0 +1,11 @@ +from django.contrib.auth.decorators import user_passes_test + + +def fellowship_required(): + """Require user to have any Fellowship.""" + def test(u): + if u.is_authenticated(): + if hasattr(u, 'contributor') and u.contributor.fellowships.exists(): + return True + return False + return user_passes_test(test) diff --git a/colleges/templates/colleges/fellowship_submission_remove_voting.html b/colleges/templates/colleges/fellowship_submission_remove_voting.html new file mode 100644 index 0000000000000000000000000000000000000000..837f1955a07c873134d63a767a177a1db28dea08 --- /dev/null +++ b/colleges/templates/colleges/fellowship_submission_remove_voting.html @@ -0,0 +1,28 @@ +{% extends 'submissions/admin/base.html' %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{ block.super }} + <a href="{% url 'colleges:submission_voting_fellows' submission.arxiv_identifier_w_vn_nr %}" class="breadcrumb-item">Submission's Voting Fellows</a> + <span class="breadcrumb-item">Remove Fellow</span> +{% endblock %} + +{% block pagetitle %}: Remove Fellow from Submission's Voting Fellows{% endblock pagetitle %} + +{% block content %} + <h1>Remove Fellow from Submission's Voting Fellows</h1> + <h2 class="text-primary">Fellowship {{ fellowship }}</h2> + + <h3>Submission details</h3> + {% include 'submissions/_submission_summary_short.html' with submission=submission %} + <br> + + <form method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-danger px-3" type="submit" value="Remove from Submission's Voting Fellows"> + </form> + + +{% endblock %} diff --git a/colleges/templates/colleges/submission_add_for_voting.html b/colleges/templates/colleges/submission_add_for_voting.html new file mode 100644 index 0000000000000000000000000000000000000000..35338669f512ce63787f41bef781d4a37b929e2e --- /dev/null +++ b/colleges/templates/colleges/submission_add_for_voting.html @@ -0,0 +1,30 @@ +{% extends 'submissions/admin/base.html' %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{ block.super }} + <a href="{% url 'colleges:submission_voting_fellows' submission.arxiv_identifier_w_vn_nr %}" class="breadcrumb-item">Submission's Voting Fellows</a> + <span class="breadcrumb-item">Add Fellowship for voting</span> +{% endblock %} + +{% block pagetitle %}: Add Fellowship for voting{% endblock pagetitle %} + +{% block content %} + <h1>Add Fellowship to Submission's Voting Fellows</h1> + <h2 class="text-primary">{{submission.title}}</h2> + <h3 class="mb-3">by {{submission.author_list}}</h3> + {% include 'submissions/_submission_summary.html' with submission=submission hide_title=1 %} + <br> + + <h3>Choose one of the following (active) Fellowships to add to the Submission's Voting Fellows:</h3> + {% include 'partials/colleges/conflicts_of_interests.html' with submission=submission %} + <br> + <form method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-primary" type="submit" value="Add Fellowship"> + </form> + + +{% endblock %} diff --git a/colleges/templates/colleges/submission_voting_fellows.html b/colleges/templates/colleges/submission_voting_fellows.html new file mode 100644 index 0000000000000000000000000000000000000000..bfd44e8702f682ec40da09c67c6048cbe8d8dc85 --- /dev/null +++ b/colleges/templates/colleges/submission_voting_fellows.html @@ -0,0 +1,48 @@ +{% extends 'submissions/admin/base.html' %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{ block.super }} + <span class="breadcrumb-item">Submission's Voting Fellows</span> +{% endblock %} + +{% block pagetitle %}: Submission's Voting Fellows{% endblock pagetitle %} + +{% block content %} + <h1>Submission's Voting Fellows</h1> + <h2 class="text-primary">{{submission.title}}</h2> + <h3 class="mb-3">by {{submission.author_list}}</h3> + {% include 'submissions/_submission_summary.html' with submission=submission hide_title=1 %} + <br> + + <h3>Voting Fellows</h3> + {% include 'partials/colleges/conflicts_of_interests.html' with submission=submission %} + <table class="table table-hover"> + <thead> + <tr> + <th>Fellowship ID</th> + <th>Fellow</th> + <th>Type</th> + <th colspan="2">Date range</th> + </tr> + </thead> + <tbody> + {% for fellowship in submission.voting_fellows.all %} + <tr> + <td>{{ fellowship.id }}</td> + <td>{{ fellowship.contributor }}</td> + <td>{{ fellowship.guest|yesno:"Guest fellowship,Regular fellowship"|safe }}</td> + <td> + <a class="text-danger" href="{% url 'colleges:fellowship_remove_submission_voting' fellowship.id submission.arxiv_identifier_w_vn_nr %}">Remove this Fellowship from Submission's Voting Fellows</a> + </td> + </tr> + {% endfor %} + <tr> + <td colspan="4" class="py-3 text-center"><a href="{% url 'colleges:submission_add_fellowship_voting' submission.arxiv_identifier_w_vn_nr %}">Add Fellowship to this Submission's Voting Fellows</a></td> + </tr> + </tbody> + </table> + + +{% endblock %} diff --git a/colleges/urls.py b/colleges/urls.py index e5ddb94593e636403f50668cb851337abfa3e211..5b9f0faaa9c5b31cf18a60b7475402ba7eb1947e 100644 --- a/colleges/urls.py +++ b/colleges/urls.py @@ -15,9 +15,19 @@ urlpatterns = [ url(r'^fellowships/submissions/{regex}/$'.format( regex=SUBMISSIONS_COMPLETE_REGEX), views.submission_pool, name='submission'), + url(r'^fellowships/submissions/{regex}/voting$'.format( + regex=SUBMISSIONS_COMPLETE_REGEX), views.submission_voting_fellows, + name='submission_voting_fellows'), url(r'^fellowships/submissions/{regex}/add$'.format( regex=SUBMISSIONS_COMPLETE_REGEX), views.submission_add_fellowship, name='submission_add_fellowship'), + url(r'^fellowships/submissions/{regex}/voting/add$'.format( + regex=SUBMISSIONS_COMPLETE_REGEX), views.submission_add_fellowship_voting, + name='submission_add_fellowship_voting'), + url(r'^fellowships/(?P<id>[0-9]+)/submissions/{regex}/remove$'.format( + regex=SUBMISSIONS_COMPLETE_REGEX), views.fellowship_remove_submission_voting, + name='fellowship_remove_submission_voting'), + url(r'^fellowships/(?P<id>[0-9]+)/submissions/{regex}/remove$'.format( regex=SUBMISSIONS_COMPLETE_REGEX), views.fellowship_remove_submission, name='fellowship_remove_submission'), diff --git a/colleges/views.py b/colleges/views.py index 81bc5f917f3c16d522aedcd778f2fedfd4bee4d2..56920ea4df84449dec4d4ac8f53a87292b877719 100644 --- a/colleges/views.py +++ b/colleges/views.py @@ -3,12 +3,13 @@ from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import get_object_or_404, render, redirect from django.core.urlresolvers import reverse -from proceedings.models import Proceedings +# from proceedings.models import Proceedings from submissions.models import Submission from .forms import FellowshipForm, FellowshipTerminateForm, FellowshipRemoveSubmissionForm,\ FellowshipAddSubmissionForm, AddFellowshipForm, SubmissionAddFellowshipForm,\ - FellowshipRemoveProceedingsForm, FellowshipAddProceedingsForm + FellowshipRemoveProceedingsForm, FellowshipAddProceedingsForm, SubmissionAddVotingFellowForm,\ + FellowVotingRemoveSubmissionForm from .models import Fellowship @@ -111,6 +112,71 @@ def submission_pool(request, arxiv_identifier_w_vn_nr): return render(request, 'colleges/submission_pool.html', context) +@login_required +@permission_required('scipost.can_manage_college_composition', raise_exception=True) +def submission_voting_fellows(request, arxiv_identifier_w_vn_nr): + """ + List all Fellowships selected for voting on the EIC related to Submission. + """ + submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + + context = { + 'submission': submission + } + return render(request, 'colleges/submission_voting_fellows.html', context) + + +@login_required +@permission_required('scipost.can_manage_college_composition', raise_exception=True) +def submission_add_fellowship_voting(request, arxiv_identifier_w_vn_nr): + """ + Add Fellowship to the Fellows voting on the EICRecommendation of a Submission. + """ + submission = get_object_or_404(Submission, arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + form = SubmissionAddVotingFellowForm(request.POST or None, instance=submission) + + if form.is_valid(): + form.save() + messages.success(request, 'Fellowship {fellowship} ({id}) added to voting Fellows.'.format( + fellowship=form.cleaned_data['fellowship'].contributor, + id=form.cleaned_data['fellowship'].id)) + return redirect(reverse('colleges:submission_voting_fellows', + args=(submission.arxiv_identifier_w_vn_nr,))) + + context = { + 'submission': submission, + 'form': form, + } + return render(request, 'colleges/submission_add_for_voting.html', context) + + +@login_required +@permission_required('scipost.can_manage_college_composition', raise_exception=True) +def fellowship_remove_submission_voting(request, id, arxiv_identifier_w_vn_nr): + """ + Remove Fellow from the EICRecommendation voting group for the Submission. + """ + fellowship = get_object_or_404(Fellowship, id=id) + submission = get_object_or_404(fellowship.voting_pool.all(), + arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + form = FellowVotingRemoveSubmissionForm(request.POST or None, + submission=submission, instance=fellowship) + + if form.is_valid() and request.POST: + form.save() + messages.success(request, 'Submission {sub} removed from Fellowship.'.format( + sub=arxiv_identifier_w_vn_nr)) + return redirect(reverse('colleges:submission_voting_fellows', + args=(submission.arxiv_identifier_w_vn_nr,))) + + context = { + 'fellowship': fellowship, + 'form': form, + 'submission': submission + } + return render(request, 'colleges/fellowship_submission_remove_voting.html', context) + + @login_required @permission_required('scipost.can_manage_college_composition', raise_exception=True) def submission_add_fellowship(request, arxiv_identifier_w_vn_nr): diff --git a/submissions/admin.py b/submissions/admin.py index 8a2f0f0e8b2c17c38316d4457694c62ba59aa519..0f52fe45e9c9a0c93e0579f4b2e6f1ce8ca05596 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -114,7 +114,8 @@ class SubmissionAdmin(GuardedModelAdmin): 'proceedings', 'pdf_refereeing_pack', 'plagiarism_report', - 'fellows'), + 'fellows', + 'voting_fellows'), }), ('Meta', { 'classes': ('collapse',), diff --git a/submissions/migrations/0081_submission_voting_fellows.py b/submissions/migrations/0081_submission_voting_fellows.py new file mode 100644 index 0000000000000000000000000000000000000000..32e51c4615181f9fe216109f1f48b74baf7e219e --- /dev/null +++ b/submissions/migrations/0081_submission_voting_fellows.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-11-05 13:21 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('colleges', '0002_auto_20171020_0931'), + ('submissions', '0080_auto_20171101_0944'), + ] + + operations = [ + migrations.AddField( + model_name='submission', + name='voting_fellows', + field=models.ManyToManyField(blank=True, related_name='voting_pool', to='colleges.Fellowship'), + ), + ] diff --git a/submissions/models.py b/submissions/models.py index fdacfc9f99876b495e2ec5835d4ffed5a0468c13..5a526bf214336075cb7e142fe344827efa6a0f59 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -67,6 +67,8 @@ class Submission(models.Model): blank=True, null=True, default=None) submitted_by = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE, related_name='submitted_submissions') + voting_fellows = models.ManyToManyField('colleges.Fellowship', blank=True, + related_name='voting_pool') # Replace this by foreignkey? submitted_to_journal = models.CharField(max_length=30, choices=SCIPOST_JOURNALS_SUBMIT, diff --git a/submissions/templates/partials/submissions/pool/submission_details.html b/submissions/templates/partials/submissions/pool/submission_details.html index 770936a3dfb2bd08e486a1633e606d8058c36120..7673c8703ef52d88590e9465e2278d26221de999 100644 --- a/submissions/templates/partials/submissions/pool/submission_details.html +++ b/submissions/templates/partials/submissions/pool/submission_details.html @@ -30,7 +30,7 @@ {% endfor %} </ul> - {% if is_editor_in_charge or is_editorial_admin %} + {% if is_editor_in_charge or is_editorial_admin or submission|is_voting_fellow:request.user %} <br> {% include 'submissions/_required_actions_block.html' with submission=submission %} <h4> @@ -41,6 +41,9 @@ {% if is_editorial_admin %} <h3>Editorial Administration</h3> <ul class="pl-4 mb-3"> + <li><a href="{% url 'colleges:submission' submission.arxiv_identifier_w_vn_nr %}">Manage Pool composition</a></li> + <li><a href="{% url 'colleges:submission_voting_fellows' submission.arxiv_identifier_w_vn_nr %}">Manage Voting Fellows</a></li> + {# EIC Assignments #} {% if perms.scipost.can_assign_submissions %} <li>EIC Assignment requests:</li> @@ -86,6 +89,7 @@ <li><a href="{% url 'submissions:treated_submission_pdf_compile' submission.arxiv_identifier_w_vn_nr %}">Update the Refereeing Package pdf</a></li> <li>After proofs have been accepted, you can <a href="{% url 'journals:initiate_publication' %}">initiate the publication process</a> (leads to the validation page)</li> {% endif %} + </ul> <h3>Events</h3> diff --git a/submissions/templates/partials/submissions/pool/submission_info_table.html b/submissions/templates/partials/submissions/pool/submission_info_table.html index 62ae68a23c23a9f5d0826dc998502880cbfa4c8d..49ec884f6b0d51add7cdc85e399e81cf4fc808b5 100644 --- a/submissions/templates/partials/submissions/pool/submission_info_table.html +++ b/submissions/templates/partials/submissions/pool/submission_info_table.html @@ -77,8 +77,13 @@ {% if perms.scipost.can_manage_college_composition %} <tr> <td>Pool composition</td> - <td><a href="{% url 'colleges:submission' submission.arxiv_identifier_w_vn_nr %}">{{ submission.fellows.count }} Fellowships</a></td> + <td><a href="{% url 'colleges:submission' submission.arxiv_identifier_w_vn_nr %}">{{ submission.fellows.count }} Fellowship{{ submission.fellows.count|pluralize }}</a></td> </tr> + <tr> + <td>Fellows voting</td> + <td><a href="{% url 'colleges:submission_voting_fellows' submission.arxiv_identifier_w_vn_nr %}">{{ submission.voting_fellows.count }} Fellowship{{ submission.voting_fellows.count|pluralize }}</a></td> + </tr> + {% endif %} </table> diff --git a/submissions/templates/submissions/editorial_page.html b/submissions/templates/submissions/editorial_page.html index 2d00f95cf92b39b07187ae85627be9a9046c7b2f..66b4ad1c6369970cd97ad11a33af114e55fb43e3 100644 --- a/submissions/templates/submissions/editorial_page.html +++ b/submissions/templates/submissions/editorial_page.html @@ -104,18 +104,28 @@ </div> </div><!-- End status --> -<div class="row"> - <div class="col-md-10 col-lg-8"> - {% include 'submissions/_required_actions_block.html' with submission=submission %} +{% if full_access %} + <div class="row"> + <div class="col-md-10 col-lg-8"> + {% include 'submissions/_required_actions_block.html' with submission=submission %} + </div> </div> -</div> +{% endif %} {% if submission.status == 'resubmitted_incoming' %} - <div class="row"> - <div class="col-12"> - {% include 'submissions/_form_submission_cycle_choice.html' with form=cycle_choice_form submission=submission %} + {% if full_access %} + <div class="row"> + <div class="col-12"> + {% include 'submissions/_form_submission_cycle_choice.html' with form=cycle_choice_form submission=submission %} + </div> </div> - </div> + {% else %} + <div class="row"> + <div class="col-12"> + <h3 class="text-center">The Editor-in-charge first has to decide which refereeing cycle to use. Please check this page again at a later moment.</h3> + </div> + </div> + {% endif %} {% else %} {% if submission.refereeing_cycle != 'direct_rec' %} <div class="row"> @@ -125,137 +135,144 @@ </div> </div> - <div class="row"> - <div class="col-12"> - <h3 class="mb-2">Detail of refereeing invitations:</h3> - {% include 'submissions/_submission_refereeing_invitations.html' with submission=submission invitations=submission.referee_invitations.all %} + {% if full_access %} + <div class="row"> + <div class="col-12"> + <h3 class="mb-2">Detail of refereeing invitations:</h3> + {% include 'submissions/_submission_refereeing_invitations.html' with submission=submission invitations=submission.referee_invitations.all %} + </div> </div> - </div> + {% endif %} {% endif %} - <hr> - {% if not submission.is_current %} - <div class="row"> - <div class="col-12"> - <div class="card mt-3 border-warning bg-light"> - <div class="card-body"> - <h3 class="mb-3"><strong>BEWARE: This is not the editorial page for the current version!</strong></h3> - <p class="mb-0"> - The tools here are thus available only for exceptional circumstances (e.g. vetting a late report on a deprecated version). - <br>Please go to the current version's page using the link at the top. - </p> + {% if full_access %} + <hr> + + {% if not submission.is_current %} + <div class="row"> + <div class="col-12"> + <div class="card mt-3 border-warning bg-light"> + <div class="card-body"> + <h3 class="mb-3"><strong>BEWARE: This is not the editorial page for the current version!</strong></h3> + <p class="mb-0"> + The tools here are thus available only for exceptional circumstances (e.g. vetting a late report on a deprecated version). + <br>Please go to the current version's page using the link at the top. + </p> + </div> + </div> </div> </div> - </div> - </div> - {% endif %} + {% endif %} - <div class="row"> - <div class="col-12"> - <h2 class="mt-3">Actions</h2> - <ul> - {% if submission.refereeing_cycle != 'direct_rec' %} - <li> - <a href="{% url 'submissions:select_referee' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Select an additional referee</a> (bear in mind flagged referees if any) - </li> - <li>Extend the refereeing deadline (currently {{ submission.reporting_deadline|date:'Y-m-d' }}) by - <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=2 %}">2 days</a>, - <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=7 %}">1 week</a> or - <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=14 %}">2 weeks</a> - {% if submission.reporting_deadline_has_passed %} - <span class="ml-1 label label-sm label-outline-danger">THE REPORTING DEADLINE HAS PASSED</span> - {% endif %} - </li> - <li> - Set refereeing deadline: - <form class="form-inline" action="{% url 'submissions:set_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}" method="post"> - {% csrf_token %} - {{ set_deadline_form|bootstrap_inline:'0,12' }} - <div class="ml-2 form-group row"> - <div class="col-12"> - <input class="btn btn-secondary" type="submit" value="Set deadline"/> + <div class="row"> + <div class="col-12"> + <h2 class="mt-3">Actions</h2> + <ul> + {% if submission.refereeing_cycle != 'direct_rec' %} + <li> + <a href="{% url 'submissions:select_referee' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Select an additional referee</a> (bear in mind flagged referees if any) + </li> + <li>Extend the refereeing deadline (currently {{ submission.reporting_deadline|date:'Y-m-d' }}) by + <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=2 %}">2 days</a>, + <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=7 %}">1 week</a> or + <a href="{% url 'submissions:extend_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr days=14 %}">2 weeks</a> + {% if submission.reporting_deadline_has_passed %} + <span class="ml-1 label label-sm label-outline-danger">THE REPORTING DEADLINE HAS PASSED</span> + {% endif %} + </li> + <li> + Set refereeing deadline: + <form class="form-inline" action="{% url 'submissions:set_refereeing_deadline' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}" method="post"> + {% csrf_token %} + {{ set_deadline_form|bootstrap_inline:'0,12' }} + <div class="ml-2 form-group row"> + <div class="col-12"> + <input class="btn btn-secondary" type="submit" value="Set deadline"/> + </div> </div> - </div> - </form> - </li> - {% with submission.reports.awaiting_vetting as reports %} - {% if reports %} - <li> - Vet submitted Report{{reports|pluralize}}: - <ul class="mb-1"> - {% for report in reports %} - <li><a href="{% url 'submissions:vet_submitted_report' report.id %}">{{report}}</a></li> - {% endfor %} - </ul> - </li> - {% else %} - <li>All Reports have been vetted.</li> - {% endif %} - {% endwith %} - - {% with submission.comments_set_complete.awaiting_vetting as comments %} - {% if comments %} - <li> - Vet submitted Comment{{comments|pluralize}}: - <ul class="mb-1"> - {% for comment in comments %} - <li><a href="{% url 'comments:vet_submitted_comment' comment.id %}">{{comment}}</a></li> - {% endfor %} - </ul> - </li> - {% else %} - <li>All Comments have been vetted.</li> + </form> + </li> + {% with submission.reports.awaiting_vetting as reports %} + {% if reports %} + <li> + Vet submitted Report{{reports|pluralize}}: + <ul class="mb-1"> + {% for report in reports %} + <li><a href="{% url 'submissions:vet_submitted_report' report.id %}">{{report}}</a></li> + {% endfor %} + </ul> + </li> + {% else %} + <li>All Reports have been vetted.</li> + {% endif %} + {% endwith %} + + {% with submission.comments_set_complete.awaiting_vetting as comments %} + {% if comments %} + <li> + Vet submitted Comment{{comments|pluralize}}: + <ul class="mb-1"> + {% for comment in comments %} + <li><a href="{% url 'comments:vet_submitted_comment' comment.id %}">{{comment}}</a></li> + {% endfor %} + </ul> + </li> + {% else %} + <li>All Comments have been vetted.</li> + {% endif %} + {% endwith %} + + {% if not submission.reporting_deadline_has_passed %} + <li><a href="{% url 'submissions:close_refereeing_round' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Close the refereeing round</a> (deactivates submission of new Reports and Comments)</li> {% endif %} - {% endwith %} - - {% if not submission.reporting_deadline_has_passed %} - <li><a href="{% url 'submissions:close_refereeing_round' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Close the refereeing round</a> (deactivates submission of new Reports and Comments)</li> {% endif %} - {% endif %} - {% if submission.eic_recommendation_required %} - <li> - <a href="{% url 'submissions:eic_recommendation' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Formulate an Editorial Recommendation</a> - <p> - If you recommend revisions, this will be communicated directly to the Authors, who will be asked to resubmit. - <br> - If you recommend acceptance or rejection, this will be put to the Editorial College for ratification. - </p> - </li> - {% endif %} - </ul> + {% if submission.eic_recommendation_required %} + <li> + <a href="{% url 'submissions:eic_recommendation' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Formulate an Editorial Recommendation</a> + <p> + If you recommend revisions, this will be communicated directly to the Authors, who will be asked to resubmit. + <br> + If you recommend acceptance or rejection, this will be put to the Editorial College for ratification. + </p> + </li> + {% endif %} + </ul> + </div> </div> - </div> + {% endif %} {% endif %} -<h2 class="mt-3">Communications</h2> -<ul> - {% if submission.editor_in_charge == request.user.contributor %} - <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='EtoA' %}">Draft and send a communication with the submitting Author</a></li> - <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='EtoS' %}">Draft and send a communication with SciPost Editorial Administration</a></li> - {% endif %} - {% if is_editorial_admin %} - <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='StoE' %}">Draft and send a communication as Editorial Administrator to the Editor-in-charge</a></li> - {% endif %} -</ul> +{% if full_access %} + <h2 class="mt-3">Communications</h2> + <ul> + {% if submission.editor_in_charge == request.user.contributor %} + <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='EtoA' %}">Draft and send a communication with the submitting Author</a></li> + <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='EtoS' %}">Draft and send a communication with SciPost Editorial Administration</a></li> + {% endif %} + {% if is_editorial_admin %} + <li><a href="{% url 'submissions:communication' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr comtype='StoE' %}">Draft and send a communication as Editorial Administrator to the Editor-in-charge</a></li> + {% endif %} + </ul> -<div class="row"> - <div class="col-12"> - <ul class="list-group list-group-flush"> - {% for comm in submission.editorial_communications.all %} - <li class="list-group-item"> - {% include 'submissions/_editorial_communication_content.html' with communication=comm %} - </li> - {% empty %} - <li class="list-group-item">There have been no communications for this Submission.</li> - {% endfor %} - </ul> + <div class="row"> + <div class="col-12"> + <ul class="list-group list-group-flush"> + {% for comm in submission.editorial_communications.all %} + <li class="list-group-item"> + {% include 'submissions/_editorial_communication_content.html' with communication=comm %} + </li> + {% empty %} + <li class="list-group-item">There have been no communications for this Submission.</li> + {% endfor %} + </ul> + </div> </div> -</div> -<h2 class="mt-3">Events</h2> -{% include 'submissions/submission_event_list.html' with events=submission.events.for_eic %} + <h2 class="mt-3">Events</h2> + {% include 'submissions/submission_event_list.html' with events=submission.events.for_eic %} +{% endif %} <div class="mb-5"></div> {% endblock content %} diff --git a/submissions/templatetags/submissions_extras.py b/submissions/templatetags/submissions_extras.py index d98be57a13f124f628b54f7e016404de300fd475..97943119c4c443baf69fdaf9b1a477d53a550475 100644 --- a/submissions/templatetags/submissions_extras.py +++ b/submissions/templatetags/submissions_extras.py @@ -25,3 +25,8 @@ def is_viewable_by_authors(recommendation): @register.filter def user_is_referee(submission, user): return submission.referee_invitations.filter(referee__user=user).exists() + + +@register.filter +def is_voting_fellow(submission, user): + return submission.voting_fellows.filter(contributor__user=user).exists() diff --git a/submissions/views.py b/submissions/views.py index 24564a1a2ace125c92c93abc6596a82ddb05e2e0..071c5d599592b03cdbb8915b403b27bfc014dfd0 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -33,6 +33,7 @@ from .forms import SubmissionIdentifierForm, RequestSubmissionForm, SubmissionSe iThenticateReportForm, SubmissionPoolFilterForm from .utils import SubmissionUtils +from colleges.permissions import fellowship_required from mails.views import MailEditingSubView from scipost.forms import ModifyPersonalMessageForm, RemarkForm from scipost.mixins import PaginationMixin @@ -331,7 +332,7 @@ def editorial_workflow(request): @login_required -@permission_required('scipost.can_view_pool', raise_exception=True) +@fellowship_required() def pool(request, arxiv_identifier_w_vn_nr=None): """ The Submissions pool contains all submissions which are undergoing @@ -392,7 +393,7 @@ def pool(request, arxiv_identifier_w_vn_nr=None): # Temporary test logic: only testers see the new Pool if context['submission'] and request.is_ajax(): template = 'partials/submissions/pool/submission_details.html' - elif is_tester(request.user) and not request.GET.get('test'): + elif is_tester(request.user) and not request.GET.get('test') or True: template = 'submissions/pool/pool.html' else: template = 'submissions/pool.html' @@ -679,13 +680,23 @@ def editorial_page(request, arxiv_identifier_w_vn_nr): Accessible for: Editor-in-charge and Editorial Administration """ - submission = get_object_or_404(Submission.objects.filter_for_eic(request.user), + submission = get_object_or_404(Submission.objects.pool_full(request.user), arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + full_access = True + if not request.user.has_perm('scipost.can_oversee_refereeing'): + # Administrators will be able to see all Submissions + if submission.editor_in_charge != request.user.contributor: + # The current user is not EIC of the Submission! + full_access = False + if not submission.voting_fellows.filter(contributor__user=request.user).exists(): + raise Http404 + context = { 'submission': submission, 'set_deadline_form': SetRefereeingDeadlineForm(), 'cycle_choice_form': SubmissionCycleChoiceForm(instance=submission), + 'full_access': full_access, } return render(request, 'submissions/editorial_page.html', context) @@ -714,7 +725,8 @@ def cycle_form_submit(request, arxiv_identifier_w_vn_nr): # Redirect to EIC Recommendation page immediately return redirect(reverse('submissions:eic_recommendation', args=[submission.arxiv_identifier_w_vn_nr])) - return redirect(reverse('submissions:editorial_page', args=[submission.arxiv_identifier_w_vn_nr])) + return redirect( + reverse('submissions:editorial_page', args=[submission.arxiv_identifier_w_vn_nr])) @login_required