diff --git a/comments/templates/comments/_comment_identifier.html b/comments/templates/comments/_comment_identifier.html index f30c460f3925344561cf1272f2c3c705523c92c9..3247be4b6f071feae71a2f1279ded6e0973f9f74 100644 --- a/comments/templates/comments/_comment_identifier.html +++ b/comments/templates/comments/_comment_identifier.html @@ -16,7 +16,7 @@ {% if comment.in_reply_to_comment %} (in reply to <a href="#comment_id{{comment.in_reply_to_comment.id}}">{{comment.in_reply_to_comment.comment.get_author_str}}</a> on {{comment.in_reply_to_comment.date_submitted|date:'Y-m-d'}}) {% elif comment.in_reply_to_report %} - (in reply to <a href="#report_id{{comment.in_reply_to_report.id}}"> + (in reply to <a href="#report_{{comment.in_reply_to_report.report_nr}}"> {% if not comment.in_reply_to_report.anonymous %} {{comment.in_reply_to_report.get_author_str}} diff --git a/comments/templates/comments/_comment_tex_template.html b/comments/templates/comments/_comment_tex_template.html new file mode 100644 index 0000000000000000000000000000000000000000..b6540e82c6d45520961cb04feacc921b65b4e5d0 --- /dev/null +++ b/comments/templates/comments/_comment_tex_template.html @@ -0,0 +1,11 @@ +{% spaceless %} +Received {{comment.date_submitted|date:'d-m-Y'}}\ \\ +{% if comment.file_attachment %}- \textit{This {% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} has an Attachment, please download it online.}\ \\{% endif %}\ \\{{comment.comment_text}} +{% endspaceless %} + +{% for subcomment in comment.nested_comments.vetted %} + \addcontentsline{toc}{subsection}{\protect\numberline{}{% if subcomment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.counter}} by {% if subcomment.anonymous %}anonymous{% else %}{{subcomment.author.user.first_name}} {{subcomment.author.user.last_name}}{% endif %} } + + \subsection*{ {% if subcomment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.parentloop.counter}}.{{forloop.counter}} by {% if subcomment.anonymous %}anonymous{% else %}{{subcomment.author.user.first_name}} {{subcomment.author.user.last_name}}{% endif %} } + {% include 'comments/_comment_tex_template.html' with comment=subcomment %} +{% endfor %} diff --git a/partners/migrations/0012_auto_20170625_1253.py b/partners/migrations/0012_auto_20170625_1253.py new file mode 100644 index 0000000000000000000000000000000000000000..30925ad9583c28dc83c6796e46480923b23d73f2 --- /dev/null +++ b/partners/migrations/0012_auto_20170625_1253.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-06-25 10:53 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('partners', '0011_auto_20170609_2234'), + ] + + operations = [ + migrations.AlterField( + model_name='prospectivepartnerevent', + name='event', + field=models.CharField(choices=[('requested', 'Requested (from online form)'), ('comment', 'Comment added'), ('email_sent', 'Email sent'), ('negotiating', 'Initiated negotiation'), ('marked_as_uninterested', 'Marked as uninterested'), ('promoted', 'Promoted to Partner')], max_length=64), + ), + ] diff --git a/partners/migrations/0027_merge_20170707_1857.py b/partners/migrations/0027_merge_20170707_1857.py new file mode 100644 index 0000000000000000000000000000000000000000..f7cc870609266767c610c3011cac24be5ecca2c0 --- /dev/null +++ b/partners/migrations/0027_merge_20170707_1857.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-07 16:57 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('partners', '0012_auto_20170625_1253'), + ('partners', '0026_auto_20170627_1809'), + ] + + operations = [ + ] diff --git a/scipost/management/commands/add_groups_and_permissions.py b/scipost/management/commands/add_groups_and_permissions.py index d3d038c9c4facfd50eb84c6d950e4be179c5613a..f0c48b82fcd072ae442c9d478b61f52408025418 100644 --- a/scipost/management/commands/add_groups_and_permissions.py +++ b/scipost/management/commands/add_groups_and_permissions.py @@ -174,6 +174,12 @@ class Command(BaseCommand): name='Can oversee refereeing', content_type=content_type) + # Reports + can_manage_reports, created = Permission.objects.get_or_create( + codename='can_manage_reports', + name='Can manage Reports', + content_type=content_type) + # Voting can_prepare_recommendations_for_voting, created = Permission.objects.get_or_create( codename='can_prepare_recommendations_for_voting', @@ -252,6 +258,7 @@ class Command(BaseCommand): can_view_timesheets, can_publish_accepted_submission, can_attend_VGMs, + can_manage_reports, ]) EditorialCollege.permissions.set([ diff --git a/scipost/static/scipost/assets/css/_code.scss b/scipost/static/scipost/assets/css/_code.scss index 6ef7af126c765ddc43e46b916902bc3ad54eea65..4a8d281e75da807866bdf5bc6a927612fb854f70 100644 --- a/scipost/static/scipost/assets/css/_code.scss +++ b/scipost/static/scipost/assets/css/_code.scss @@ -9,3 +9,7 @@ pre { margin: 0; } } + +.clickfocus { + cursor: pointer; +} diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index dd9465f3554d6a3e6cc85074b99656e92e9ec438..66207b001f604fe14d31e5234325c6fcb33daaf6 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -267,8 +267,12 @@ <h3>Editorial Admin actions</h3> <ul> {% if perms.scipost.can_publish_accepted_submission %} - <li><a href="{% url 'journals:manage_metadata' %}">Manage metadata</a></li> - <li><a href="{% url 'journals:harvest_citedby_list' %}">Harvest citedby data</a></li> + <li><a href="{% url 'journals:manage_metadata' %}">Manage metadata</a></li> + <li><a href="{% url 'journals:harvest_citedby_list' %}">Harvest citedby data</a></li> + {% endif %} + {% if perms.scipost.can_manage_reports %} + <li><a href="{% url 'submissions:reports_accepted_list' %}">Accepted Reports</a>{% if nr_reports_without_pdf %} ({{nr_reports_without_pdf}} unfinished){% endif %}</li> + <li><a href="{% url 'submissions:treated_submissions_list' %}">Fully treated Submissions</a>{% if nr_treated_submissions_without_pdf %} ({{nr_treated_submissions_without_pdf}} unfinished){% endif %}</li> {% endif %} </ul> {% endif %} diff --git a/scipost/templatetags/texfilters.py b/scipost/templatetags/texfilters.py new file mode 100644 index 0000000000000000000000000000000000000000..f8e3d05e6f587e54ef526741ccd29c4e0f7ebce7 --- /dev/null +++ b/scipost/templatetags/texfilters.py @@ -0,0 +1,26 @@ +from django import template +from django.utils.html import escape +from django.utils.text import normalize_newlines +from django.utils.safestring import SafeData, mark_safe + +register = template.Library() + + +@register.filter(is_safe=False, needs_autoescape=True) +def linebreaktex(value, autoescape=True): + """ + Convert all newlines in a piece of plain text to HTML line breaks + """ + autoescape = autoescape and not isinstance(value, SafeData) + value = normalize_newlines(value) + if autoescape: + value = escape(value) + return mark_safe(value.replace('\n', '\\ \n')) + + +@register.filter(is_safe=False, needs_autoescape=True) +def safe_tex_url(value, autoescape=True): + """ + Convert all newlines in a piece of plain text to HTML line breaks + """ + return mark_safe(value.replace('#', '\#')) diff --git a/scipost/views.py b/scipost/views.py index d947c8d23f8649f5319cb3200b98982c2bfc4dfb..cbaf80452b461c83839133e8c7707353f93fb18f 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -98,7 +98,7 @@ def documentsSearchResults(query): .filter(publication_query).order_by('-publication_date')) commentary_search_queryset = (Commentary.objects.vetted() .filter(commentary_query).order_by('-pub_date')) - submission_search_queryset = (Submission.objects.public() + submission_search_queryset = (Submission.objects.public_unlisted() .filter(submission_query).order_by('-submission_date')) thesislink_search_list = (ThesisLink.objects.vetted() .filter(thesislink_query).order_by('-defense_date')) @@ -175,9 +175,8 @@ def index(request): '''Main page.''' context = { 'latest_newsitems': NewsItem.objects.all().order_by('-date')[:1], - 'submissions': Submission.objects.public().order_by('-submission_date')[:3], - 'publications': Publication.objects.published().order_by('-publication_date', - '-paper_nr')[:3] + 'submissions': Submission.objects.public_unlisted().order_by('-submission_date')[:3], + 'publications': Publication.objects.published().order_by('-publication_date')[:3] } return render(request, 'scipost/index.html', context) @@ -796,8 +795,6 @@ def personal_page(request): nr_submissions_to_assign = 0 nr_recommendations_to_prepare_for_voting = 0 if contributor.is_SP_Admin(): - intwodays = now + timezone.timedelta(days=2) - # count the number of pending registration requests nr_reg_to_vet = Contributor.objects.filter(user__is_active=True, status=0).count() nr_reg_awaiting_validation = (Contributor.objects.awaiting_validation() @@ -806,6 +803,7 @@ def personal_page(request): nr_submissions_to_assign = Submission.objects.filter(status__in=['unassigned']).count() nr_recommendations_to_prepare_for_voting = EICRecommendation.objects.filter( submission__status__in=['voting_in_preparation']).count() + nr_assignments_to_consider = 0 active_assignments = None nr_reports_to_vet = 0 @@ -897,9 +895,17 @@ def personal_page(request): 'own_submissions': own_submissions, 'own_commentaries': own_commentaries, 'own_thesislinks': own_thesislinks, - 'own_comments': own_comments, 'own_authorreplies': own_authorreplies, + 'own_comments': own_comments, + 'own_authorreplies': own_authorreplies, } + # Only add variables if user has right permission + if request.user.has_perm('scipost.can_manage_reports'): + context['nr_reports_without_pdf'] = (Report.objects.accepted() + .filter(pdf_report='').count()) + context['nr_treated_submissions_without_pdf'] = (Submission.objects.treated() + .filter(pdf_refereeing_pack='').count()) + return render(request, 'scipost/personal_page.html', context) @@ -1110,7 +1116,7 @@ def contributor_info(request, contributor_id): """ contributor = get_object_or_404(Contributor, pk=contributor_id) contributor_publications = Publication.objects.published().filter(authors=contributor) - contributor_submissions = Submission.objects.public().filter(authors=contributor) + contributor_submissions = Submission.objects.public_unlisted().filter(authors=contributor) contributor_commentaries = Commentary.objects.filter(authors=contributor) contributor_theses = ThesisLink.objects.vetted().filter(author_as_cont=contributor) contributor_comments = (Comment.objects.vetted() diff --git a/submissions/admin.py b/submissions/admin.py index 0e394cedfb8da410dfbcda6c3c72047380a6b39e..1a836a83585f742aee25da59e46e4c0d1e535466 100644 --- a/submissions/admin.py +++ b/submissions/admin.py @@ -100,6 +100,7 @@ class ReportAdmin(admin.ModelAdmin): list_display_links = ('author',) date_hierarchy = 'date_submitted' list_filter = ('status',) + readonly_fields = ('report_nr',) form = ReportAdminForm diff --git a/submissions/constants.py b/submissions/constants.py index 9397b022313597a5b36e7a8ddc87e661b4be65d0..aac77500f373188103b1435b6b7d50599df0bc72 100644 --- a/submissions/constants.py +++ b/submissions/constants.py @@ -45,7 +45,7 @@ SUBMISSION_HTTP404_ON_EDITORIAL_PAGE = [ ] SUBMISSION_STATUS_OUT_OF_POOL = SUBMISSION_HTTP404_ON_EDITORIAL_PAGE + [ - 'resubmitted' + STATUS_RESUBMITTED ] SUBMISSION_EXCLUDE_FROM_REPORTING = SUBMISSION_HTTP404_ON_EDITORIAL_PAGE + [ @@ -69,24 +69,22 @@ SUBMISSION_STATUS_PUBLICLY_INVISIBLE = [ STATUS_UNASSIGNED, STATUS_RESUBMISSION_INCOMING, 'assignment_failed', - 'resubmitted_rejected', STATUS_RESUBMITTED_REJECTED, - 'rejected', + STATUS_REJECTED, 'withdrawn', ] # Submissions which should not appear in search lists SUBMISSION_STATUS_PUBLICLY_UNLISTED = SUBMISSION_STATUS_PUBLICLY_INVISIBLE + [ - 'resubmitted', - 'resubmitted_rejected_visible', + STATUS_RESUBMITTED, STATUS_RESUBMITTED_REJECTED_VISIBLE, - 'published' + STATUS_PUBLISHED ] # Submissions for which voting on a related recommendation is deprecated: SUBMISSION_STATUS_VOTING_DEPRECATED = [ - 'rejected', - 'published', + STATUS_REJECTED, + STATUS_PUBLISHED, 'withdrawn', ] diff --git a/submissions/forms.py b/submissions/forms.py index fc5bcf13b633138c0a05ca4c5b7a99b9cde5f0b9..950d8ad1bd0221e4b843d908eeb173d52e60d9b3 100644 --- a/submissions/forms.py +++ b/submissions/forms.py @@ -32,7 +32,7 @@ class SubmissionSearchForm(forms.Form): def search_results(self): """Return all Submission objects according to search""" - return Submission.objects.public_overcomplete().filter( + return Submission.objects.public_newest().filter( title__icontains=self.cleaned_data.get('title', ''), author_list__icontains=self.cleaned_data.get('author', ''), abstract__icontains=self.cleaned_data.get('abstract', ''), @@ -332,6 +332,12 @@ class RequestSubmissionForm(SubmissionChecks, forms.ModelForm): return submission +class SubmissionReportsForm(forms.ModelForm): + class Meta: + model = Submission + fields = ['pdf_refereeing_pack'] + + ###################### # Editorial workflow # ###################### @@ -412,6 +418,12 @@ class VotingEligibilityForm(forms.Form): # Reports: ############ +class ReportPDFForm(forms.ModelForm): + class Meta: + model = Report + fields = ['pdf_report'] + + class ReportForm(forms.ModelForm): class Meta: model = Report diff --git a/submissions/managers.py b/submissions/managers.py index 7bff9d5acbb9afe39db06392057f64d40d608475..ab65d7b64e37c138d997c835b5b18f2564714480 100644 --- a/submissions/managers.py +++ b/submissions/managers.py @@ -4,8 +4,9 @@ from django.db.models import Q from .constants import SUBMISSION_STATUS_OUT_OF_POOL, SUBMISSION_STATUS_PUBLICLY_UNLISTED,\ SUBMISSION_STATUS_PUBLICLY_INVISIBLE, STATUS_UNVETTED, STATUS_VETTED,\ STATUS_UNCLEAR, STATUS_INCORRECT, STATUS_NOT_USEFUL, STATUS_NOT_ACADEMIC,\ - SUBMISSION_HTTP404_ON_EDITORIAL_PAGE, SUBMISSION_EXCLUDE_FROM_REPORTING,\ - STATUS_DRAFT, EVENT_GENERAL, EVENT_FOR_AUTHOR, EVENT_FOR_EIC + SUBMISSION_HTTP404_ON_EDITORIAL_PAGE, STATUS_DRAFT, STATUS_PUBLISHED,\ + SUBMISSION_EXCLUDE_FROM_REPORTING, STATUS_REJECTED_VISIBLE,\ + STATUS_ACCEPTED, STATUS_RESUBMITTED, STATUS_RESUBMITTED_REJECTED_VISIBLE class SubmissionManager(models.Manager): @@ -57,6 +58,13 @@ class SubmissionManager(models.Manager): .order_by('-submission_date')) def public(self): + """ + This query contains set of public submissions, i.e. also containing + submissions with status "published" or "resubmitted". + """ + return self.exclude(status__in=SUBMISSION_STATUS_PUBLICLY_INVISIBLE) + + def public_unlisted(self): """ List only all public submissions. Should be used as a default filter! @@ -66,13 +74,12 @@ class SubmissionManager(models.Manager): """ return self.exclude(status__in=SUBMISSION_STATUS_PUBLICLY_UNLISTED) - def public_overcomplete(self): + def public_newest(self): """ - This query contains an overcomplete set of public submissions, i.e. also containing - submissions with status "published" or "resubmitted". + This query contains set of public() submissions, filtered to only the newest available + version. """ - queryset = self.exclude(status__in=SUBMISSION_STATUS_PUBLICLY_INVISIBLE) - return self._newest_version_only(queryset) + return self._newest_version_only(self.public()) def open_for_reporting(self): """ @@ -81,6 +88,13 @@ class SubmissionManager(models.Manager): """ return self.exclude(status__in=SUBMISSION_EXCLUDE_FROM_REPORTING) + def treated(self): + """ + This query returns all Submissions that are expected to be 'done'. + """ + return self.filter(status__in=[STATUS_ACCEPTED, STATUS_REJECTED_VISIBLE, STATUS_PUBLISHED, + STATUS_RESUBMITTED, STATUS_RESUBMITTED_REJECTED_VISIBLE]) + class SubmissionEventQuerySet(models.QuerySet): def for_author(self): diff --git a/submissions/migrations/0046_auto_20170625_1311.py b/submissions/migrations/0046_auto_20170625_1311.py new file mode 100644 index 0000000000000000000000000000000000000000..d33f029e92a097989c4398e3319df4cb57609b32 --- /dev/null +++ b/submissions/migrations/0046_auto_20170625_1311.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-06-25 11:11 +from __future__ import unicode_literals + +from django.db import migrations, models + + +def set_report_counters(apps, schema_editor): + Report = apps.get_model('submissions', 'Report') + for report in Report.objects.order_by('date_submitted'): + if not report.report_nr: + report.report_nr = report.submission.reports.filter(report_nr__gte=1).count() + 1 + report.save() + print('Updated all Report counters.') + + +def do_nothing(*args): + pass + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0045_auto_20170608_1710'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='report_nr', + field=models.PositiveSmallIntegerField(default=0), + ), + migrations.RunPython(set_report_counters, do_nothing) + ] diff --git a/submissions/migrations/0047_auto_20170625_1331.py b/submissions/migrations/0047_auto_20170625_1331.py new file mode 100644 index 0000000000000000000000000000000000000000..151166d05dd98ce29eef6b9b44b137516fe1b4bb --- /dev/null +++ b/submissions/migrations/0047_auto_20170625_1331.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-06-25 11:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0046_auto_20170625_1311'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='pdf_report', + field=models.FileField(blank=True, max_length=200, upload_to='UPLOADS/REPORTS/%Y/%m/'), + ), + migrations.AlterField( + model_name='report', + name='report_nr', + field=models.PositiveSmallIntegerField(default=0, help_text='This number is a unique number refeering to the Report nr. of the Submission'), + ), + migrations.AlterUniqueTogether( + name='report', + unique_together=set([('submission', 'report_nr')]), + ), + ] diff --git a/submissions/migrations/0048_auto_20170721_0931.py b/submissions/migrations/0048_auto_20170721_0931.py new file mode 100644 index 0000000000000000000000000000000000000000..3f0a084e264d15c611c97fe05ec58596f3769f18 --- /dev/null +++ b/submissions/migrations/0048_auto_20170721_0931.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-21 07:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0047_submission_acceptance_date'), + ] + + operations = [ + migrations.AlterField( + model_name='report', + name='requested_changes', + field=models.TextField(blank=True, verbose_name='requested changes'), + ), + migrations.AlterField( + model_name='report', + name='strengths', + field=models.TextField(blank=True), + ), + migrations.AlterField( + model_name='report', + name='weaknesses', + field=models.TextField(blank=True), + ), + ] diff --git a/submissions/migrations/0048_merge_20170707_1857.py b/submissions/migrations/0048_merge_20170707_1857.py new file mode 100644 index 0000000000000000000000000000000000000000..e0b38b3d8fe4c76efb193145855351d562885c9b --- /dev/null +++ b/submissions/migrations/0048_merge_20170707_1857.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-07 16:57 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0047_auto_20170625_1331'), + ('submissions', '0047_submission_acceptance_date'), + ] + + operations = [ + ] diff --git a/submissions/migrations/0049_submission_pdf_refereeing_pack.py b/submissions/migrations/0049_submission_pdf_refereeing_pack.py new file mode 100644 index 0000000000000000000000000000000000000000..32166d197857ea1466eae54f2008776c5d3499f3 --- /dev/null +++ b/submissions/migrations/0049_submission_pdf_refereeing_pack.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-07 16:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0048_merge_20170707_1857'), + ] + + operations = [ + migrations.AddField( + model_name='submission', + name='pdf_refereeing_pack', + field=models.FileField(blank=True, max_length=200, upload_to='UPLOADS/REFEREE/%Y/%m/'), + ), + ] diff --git a/submissions/migrations/0050_auto_20170707_2126.py b/submissions/migrations/0050_auto_20170707_2126.py new file mode 100644 index 0000000000000000000000000000000000000000..6a454b3e19e435c2e0ac9c57536c3faccc598db8 --- /dev/null +++ b/submissions/migrations/0050_auto_20170707_2126.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-07 19:26 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0049_submission_pdf_refereeing_pack'), + ] + + operations = [ + migrations.AlterModelOptions( + name='report', + options={'ordering': ['report_nr']}, + ), + migrations.AddField( + model_name='report', + name='doi_label', + field=models.CharField(blank=True, max_length=200), + ), + ] diff --git a/submissions/migrations/0051_merge_20170721_0934.py b/submissions/migrations/0051_merge_20170721_0934.py new file mode 100644 index 0000000000000000000000000000000000000000..2f8075edd4eaf34bd361875a9bf701fd761d7b83 --- /dev/null +++ b/submissions/migrations/0051_merge_20170721_0934.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-07-21 07:34 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0050_auto_20170707_2126'), + ('submissions', '0048_auto_20170721_0931'), + ] + + operations = [ + ] diff --git a/submissions/models.py b/submissions/models.py index 5ec885d4ef505ddfc4db09f1a032e05eb17ec467..5bfd8c1225c29fe4362db0c7d8cdd37e56d39e25 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -77,6 +77,9 @@ class Submission(models.Model): arxiv_vn_nr = models.PositiveSmallIntegerField(default=1) arxiv_link = models.URLField(verbose_name='arXiv link (including version nr)') + pdf_refereeing_pack = models.FileField(upload_to='UPLOADS/REFEREE/%Y/%m/', + max_length=200, blank=True) + # Metadata metadata = JSONField(default={}, blank=True, null=True) submission_date = models.DateField(verbose_name='submission date', default=datetime.date.today) @@ -290,7 +293,12 @@ class Report(models.Model): to explicitly implement the perticular differences in for example the form used. """ status = models.CharField(max_length=16, choices=REPORT_STATUSES, default=STATUS_UNVETTED) - submission = models.ForeignKey('submissions.Submission', on_delete=models.CASCADE) + submission = models.ForeignKey('submissions.Submission', related_name='reports', + on_delete=models.CASCADE) + report_nr = models.PositiveSmallIntegerField(default=0, + help_text='This number is a unique number ' + 'refeering to the Report nr. of ' + 'the Submission') vetted_by = models.ForeignKey('scipost.Contributor', related_name="report_vetted_by", blank=True, null=True, on_delete=models.CASCADE) @@ -328,11 +336,14 @@ class Report(models.Model): recommendation = models.SmallIntegerField(choices=REPORT_REC) remarks_for_editors = models.TextField(blank=True, verbose_name='optional remarks for the Editors only') + doi_label = models.CharField(max_length=200, blank=True) anonymous = models.BooleanField(default=True, verbose_name='Publish anonymously') + pdf_report = models.FileField(upload_to='UPLOADS/REPORTS/%Y/%m/', max_length=200, blank=True) objects = ReportManager() class Meta: + unique_together = ('submission', 'report_nr') default_related_name = 'reports' ordering = ['-date_submitted'] @@ -340,6 +351,20 @@ class Report(models.Model): return (self.author.user.first_name + ' ' + self.author.user.last_name + ' on ' + self.submission.title[:50] + ' by ' + self.submission.author_list[:50]) + def get_absolute_url(self): + return self.submission.get_absolute_url() + '#report_' + str(self.report_nr) + + @property + def doi_string(self): + if self.doi_label: + return '10.21468/' + self.doi_label + + def save(self, *args, **kwargs): + # Control Report count per Submission. + if not self.report_nr: + self.report_nr = self.submission.reports.count() + 1 + return super().save(*args, **kwargs) + @cached_property def is_followup_report(self): """ diff --git a/submissions/templates/submissions/_refereeing_pack_tex_template.html b/submissions/templates/submissions/_refereeing_pack_tex_template.html new file mode 100644 index 0000000000000000000000000000000000000000..536202975620088d90e191870ed6d99f45f55df6 --- /dev/null +++ b/submissions/templates/submissions/_refereeing_pack_tex_template.html @@ -0,0 +1,200 @@ +{% load texfilters %}\documentclass{SciPost} + +% Prevent all line breaks in inline equations. +\binoppenalty=10000 +\relpenalty=10000 + +\hypersetup{ + colorlinks, + linkcolor={red!50!black}, + citecolor={blue!50!black}, + urlcolor={blue!80!black} +} + +\usepackage[bitstream-charter]{mathdesign} +\urlstyle{sf} + +\fancypagestyle{SPstyle}{ +\fancyhf{} +\lhead{\raisebox{-1.5mm}[0pt][0pt]{\href{https://scipost.org}{\includegraphics[width=20mm]{logo_scipost_with_bgd.pdf}}}} + +{% if report.doi_string %} + \rhead{\small \href{https://scipost.org{{report.doi_string|safe_tex_url}} }{ {{report.doi_string|safe_tex_url}} ({{report.date_submitted|date:'Y'}})}} +{% endif %} + +\renewcommand{\headrulewidth}{1pt} +\fancyfoot[C]{\textbf{\thepage}} +} + +\begin{document} + +\pagestyle{SPstyle} + +\begin{center} +\Large\color{scipostdeepblue}{\textbf{ +%%%%%%%%%% TITLE + AUTHORS +Refereeing Package of\href{https://scipost.org{{submission.get_absolute_url|safe_tex_url}} }{\color{scipostdeepblue}{ {{submission.title}} }}by {{submission.author_list}} +}} +\end{center} + +\begin{center} +\Large\color{scipostdeepblue}{\textbf{ +%%%%%%%%%% ARXIV CODE +\href{https://scipost.org{{submission.get_absolute_url|safe_tex_url}} }{\color{scipostdeepblue}{ {{submission.arxiv_identifier_w_vn_nr}} }} +}} +\end{center} + +\vspace{10pt} + +%%%%%%%%%% DATES +\small{\ \\Received {{submission.submission_date|date:'d-m-Y'}}\newline +{% if submission.acceptance_date %}Accepted {{submission.acceptance_date|date:'d-m-Y'}} \newline{% endif %} +Submitted to {{submission.get_submitted_to_journal_display}} +} + + +%%%%% TABLE OF CONTENT +\vspace{10pt} +\noindent\rule{\textwidth}{1pt} +\tableofcontents +\noindent\rule{\textwidth}{1pt} +\vspace{10pt} + + +%%%%%%%%%% CONTENT + +{% for report in submission.reports.accepted %} + \newpage + \setcounter{section}{0} + + \addcontentsline{toc}{section}{\protect\numberline{}Report {{report.report_nr}}{% if report.doi_string %} $\cdot$ doi: {{report.doi_string|safe_tex_url}}{% endif %} } + + \fancypagestyle{SPstylereport{{report.id}} }{ + \fancyhf{} + \lhead{\raisebox{-1.5mm}[0pt][0pt]{\href{https://scipost.org}{\includegraphics[width=20mm]{logo_scipost_with_bgd.pdf}}}} + + {% if report.doi_string %} + \rhead{\small \href{https://scipost.org{{report.doi_string|safe_tex_url}} }{ {{report.doi_string|safe_tex_url}} ({{report.date_submitted|date:'Y'}})}} + {% endif %} + + \renewcommand{\headrulewidth}{1pt} + \fancyfoot[C]{\textbf{\thepage}} + } + \pagestyle{SPstylereport{{report.id}} } + + \begin{center} + \Large\color{scipostdeepblue}{\textbf{ + %%%%%%%%%% TITLE + Report {{report.report_nr}} on\href{https://scipost.org{{report.get_absolute_url|safe_tex_url}} }{\color{scipostdeepblue}{ {{report.submission.title}} }}by {{report.submission.author_list}} + }} + \end{center} + + {% if report.doi_string %} + \begin{center} + \Large\color{scipostdeepblue}{\textbf{ + %%%%%%%%%% TITLE + doi:\href{https://scipost.org{{report.get_absolute_url|safe_tex_url}} }{\color{scipostdeepblue}{ {{report.doi_string|safe_tex_url}} }} + }} + \end{center} + {% endif %} + + \begin{center} + \large\textbf{ + %%%%%%%%%% AUTHORS + Report by {% if report.anonymous %}anonymous{% else %}{{report.author.user.first_name}} {{report.author.user.last_name}}\textsuperscript{1}{% endif %} + } + \end{center} + + {% if not report.anonymous %} + \begin{center} + %%%%%%%%%% AFFILIATIONS + {\bf 1} {{report.author.affiliation}}\\ + \end{center} + {% endif %} + + + \vspace{10pt} + + + \begin{center} + \begin{tabular}{lr} + \begin{minipage}{0.5\textwidth} + \raisebox{-1mm}[0pt][0pt]{\includegraphics[width=12mm]{by.eps}} + + %%%%%%%%%% COPYRIGHT + + {\small Copyright {% if report.anonymous %}anonymous{% else %}{{report.author.user.first_name}} {{report.author.user.last_name}}{% endif %}. \newline + This work is licensed under the Creative Commons \newline + \href{http://creativecommons.org/licenses/by/4.0/}{Attribution 4.0 International License}. \newline + Published by the SciPost Foundation. + } + \end{minipage} + & + \begin{minipage}{0.5\textwidth} + %%%%%%%%%% DATES + {\small Received {{report.date_submitted|date:'d-m-Y'}} + {% if report.doi_string %} + doi:\href{//dx.doi.org{{report.doi_string|safe_tex_url}} }{ {{report.doi_string|safe_tex_url}} } + {% endif %} + } + \end{minipage} + \end{tabular} + \end{center} + + \vspace{10pt} + \noindent\rule{\textwidth}{1pt} + + %%%%%%%% CONTENTS + + \section*{Ratings} + \begin{center} + \begin{tabular}{r p{0.15\columnwidth} r l} + {\bf Validity} & {{report.get_validity_display}} & {\bf Clarity} & {{report.get_clarity_display}} \\ + {\bf Significance} & {{report.get_significance_display}} & {\bf Formatting} & {{report.get_formatting_display}} \\ + {\bf Originality} & {{report.get_originality_display}} & {\bf Grammar} & {{report.get_grammar_display}} + \end{tabular} + \end{center} + + \section*{Strengths} + {{report.strengths|linebreaktex}} + + \section*{Weaknesses} + {{report.weaknesses|linebreaktex}} + + \section*{Report} + {{report.report|linebreaktex}} + + + \section*{Requested changes} + {{report.requested_changes|linebreaktex}} + + + {% if report.comment_set.vetted %} + \newpage + \pagestyle{SPstyle} + \section*{Comments and Author Replies to this Report} + + {% for comment in report.comment_set.vetted %} + \addcontentsline{toc}{subsection}{\protect\numberline{}{% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.counter}} to Report by {% if comment.anonymous %}anonymous{% else %}{{comment.author.user.first_name}} {{comment.author.user.last_name}}{% endif %} } + + \subsection*{ {% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.counter}} to Report by {% if comment.anonymous %}anonymous{% else %}{{comment.author.user.first_name}} {{comment.author.user.last_name}}{% endif %} } + {% include 'comments/_comment_tex_template.html' with comment=comment %} + {% endfor %} + {% endif %} + +{% endfor %} + +{% if submission.comments.vetted %} + \newpage + \setcounter{section}{0} + \pagestyle{SPstyle} + + {% for comment in submission.comments.vetted %} + \addcontentsline{toc}{section}{\protect\numberline{}{% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.counter}} by {% if comment.anonymous %}anonymous{% else %}{{comment.author.user.first_name}} {{comment.author.user.last_name}}{% endif %} } + + \section*{ {% if comment.is_author_reply %}Author Reply{% else %}Comment{% endif %} {{forloop.counter}} by {% if comment.anonymous %}anonymous{% else %}{{comment.author.user.first_name}} {{comment.author.user.last_name}}{% endif %} } + {% include 'comments/_comment_tex_template.html' with comment=comment %} + {% endfor %} +{% endif %} + +\end{document} diff --git a/submissions/templates/submissions/_report_tex_template.html b/submissions/templates/submissions/_report_tex_template.html new file mode 100644 index 0000000000000000000000000000000000000000..edb59afc172ed68722591107bcd2b97c5a737a01 --- /dev/null +++ b/submissions/templates/submissions/_report_tex_template.html @@ -0,0 +1,112 @@ +{% load texfilters %}\documentclass{SciPost} + +% Prevent all line breaks in inline equations. +\binoppenalty=10000 +\relpenalty=10000 + +\hypersetup{ + colorlinks, + linkcolor={red!50!black}, + citecolor={blue!50!black}, + urlcolor={blue!80!black} +} + +\usepackage[bitstream-charter]{mathdesign} +\urlstyle{sf} + +\fancypagestyle{SPstyle}{ +\fancyhf{} +\lhead{\raisebox{-1.5mm}[0pt][0pt]{\href{https://scipost.org}{\includegraphics[width=20mm]{logo_scipost_with_bgd.pdf}}}} + +{% if report.doi_string %} + \rhead{\small \href{https://scipost.org{{report.doi_string|safe_tex_url}} }{ {{report.doi_string|safe_tex_url}} ({{report.date_submitted|date:'Y'}})}} +{% endif %} + +\renewcommand{\headrulewidth}{1pt} +\fancyfoot[C]{\textbf{\thepage}} +} + +\begin{document} + +\pagestyle{SPstyle} + +\begin{center} +\Large\color{scipostdeepblue}{\textbf{ +%%%%%%%%%% TITLE +Report {{report.report_nr}} on\href{https://scipost.org{{report.get_absolute_url|safe_tex_url}} }{\color{scipostdeepblue}{ {{report.submission.title}} }}by {{report.submission.author_list}} +}} +\end{center} + +\begin{center} +\large\textbf{ +%%%%%%%%%% AUTHORS +Report by {% if report.anonymous %}anonymous{% else %}{{report.author.user.first_name}} {{report.author.user.last_name}}\textsuperscript{1}{% endif %} +} +\end{center} + +{% if not report.anonymous %} + \begin{center} + %%%%%%%%%% AFFILIATIONS + {\bf 1} {{report.author.affiliation}}\\ + \end{center} +{% endif %} + + +\vspace{10pt} + + +\begin{center} +\begin{tabular}{lr} +\begin{minipage}{0.5\textwidth} +\raisebox{-1mm}[0pt][0pt]{\includegraphics[width=12mm]{by.eps}} + +%%%%%%%%%% COPYRIGHT + +{\small Copyright {% if report.anonymous %}anonymous{% else %}{{report.author.user.first_name}} {{report.author.user.last_name}}{% endif %}. \newline + +This work is licensed under the Creative Commons \newline +\href{http://creativecommons.org/licenses/by/4.0/}{Attribution 4.0 International License}. \newline +Published by the SciPost Foundation. +} +\end{minipage} +& +\begin{minipage}{0.5\textwidth} +%%%%%%%%%% DATES +{\small Received {{report.date_submitted|date:'d-m-Y'}} +{% if report.doi_string %} + doi:\href{//dx.doi.org{{report.doi_string|safe_tex_url}} }{ {{report.doi_string|safe_tex_url}} } +{% endif %} +} +\end{minipage} +\end{tabular} +\end{center} + +\vspace{10pt} +\noindent\rule{\textwidth}{1pt} + +%%%%%%%% CONTENTS + +\section*{Ratings} +\begin{center} +\begin{tabular}{r p{0.15\columnwidth} r l} + {\bf Validity} & {{report.get_validity_display}} & {\bf Clarity} & {{report.get_clarity_display}} \\ + {\bf Significance} & {{report.get_significance_display}} & {\bf Formatting} & {{report.get_formatting_display}} \\ + {\bf Originality} & {{report.get_originality_display}} & {\bf Grammar} & {{report.get_grammar_display}} +\end{tabular} +\end{center} + +\section{Strengths} +{{report.strengths|linebreaktex}} + +\section{Weaknesses} +{{report.weaknesses|linebreaktex}} + +\section{Report} +{{report.report|linebreaktex}} + + +\section{Requested changes} +{{report.requested_changes|linebreaktex}} + + +\end{document} diff --git a/submissions/templates/submissions/_single_public_report_without_comments.html b/submissions/templates/submissions/_single_public_report_without_comments.html index f39932745a139ece5d79a744868724e0bf1945f8..2c5c69adc82528e3cc09108b9c08eadff738020b 100644 --- a/submissions/templates/submissions/_single_public_report_without_comments.html +++ b/submissions/templates/submissions/_single_public_report_without_comments.html @@ -3,13 +3,19 @@ <div class="row"> <div class="col-12"> - <div class="report"> + <div class="report" id="report_{{report.report_nr}}"> {% if user.contributor == submission.editor_in_charge or user|is_in_group:'Editorial Administrators' and user|is_not_author_of_submission:submission.arxiv_identifier_w_vn_nr %} <div class="reportid"> <h3>{% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{% url 'scipost:contributor_info' report.author.id %}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a> on {{ report.date_submitted|date:'Y-n-j' }}</h3> </h3> + {% if report.pdf_report %} + <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a> + {% endif %} + {% if perms.scipost.can_manage_reports %} + {% if report.pdf_report %}· {% endif %}<a href="{% url 'submissions:report_pdf_compile' report.id %}"{% if not report.pdf_report %}class="btn btn-warning btn-sm"{% endif %}>Update/Compile the Report pdf</a> + {% endif %} </div> {% if report.flagged %} @@ -40,9 +46,15 @@ </div> {% else %} <div class="reportid"> - <h3 id="report_id{{report.id}}">{% if report.anonymous %}Anonymous Report {{report.id}}{% else %}<a href="{% url 'scipost:contributor_info' report.author.id %}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %} + <h3>{% if report.anonymous %}Anonymous Report {{report.report_nr}}{% else %}<a href="{% url 'scipost:contributor_info' report.author.id %}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %} on {{ report.date_submitted|date:'Y-n-j' }}</h3> </h3> + {% if report.pdf_report %} + <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a> + {% endif %} + {% if perms.scipost.can_manage_reports %} + {% if report.pdf_report %}· {% endif %}<a href="{% url 'submissions:report_pdf_compile' report.id %}"{% if not report.pdf_report %}class="btn btn-warning btn-sm"{% endif %}>Update/Compile the Report pdf</a> + {% endif %} </div> {% include 'submissions/_single_report_content.html' with report=report %} diff --git a/submissions/templates/submissions/_single_report_card_summary.html b/submissions/templates/submissions/_single_report_card_summary.html new file mode 100644 index 0000000000000000000000000000000000000000..e0f9fb2fe14cf4714659a4fde5045bc15771d5eb --- /dev/null +++ b/submissions/templates/submissions/_single_report_card_summary.html @@ -0,0 +1,5 @@ +<div class="card-block {% block cardblock_class_block %}{% endblock %}"> + <h3>{{report.get_status_display}} Report {{report.report_nr}} by {% if report.anonymous %}<em>anonymous</em>{% else %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a>{% endif %}</h3> + <h4>Received: {{ report.date_submitted|date:'Y-n-j' }}</h4> + On Submission: <a href="{{report.submission.get_absolute_url}}">{{report.submission}}</a> +</div> diff --git a/submissions/templates/submissions/_submission_summary.html b/submissions/templates/submissions/_submission_summary.html index 334f2d67912757293c26183e4412ee0e8f6d1601..613cc023ff67d310dc160c307b72ce562be694b6 100644 --- a/submissions/templates/submissions/_submission_summary.html +++ b/submissions/templates/submissions/_submission_summary.html @@ -1,6 +1,11 @@ {% extends 'submissions/_submission_summary_short.html' %} {% block submission_summary_footer %} + {% if submission.pdf_refereeing_pack %} + <p class="mt-3"> + <a href="{% url 'submissions:refereeing_package_pdf' submission.arxiv_identifier_w_vn_nr %}" target="_blank" class="btn btn-outline-primary">Download Refereeing Package</a> + </p> + {% endif %} <h3 class="mt-3">Abstract</h3> <p>{{submission.abstract}}</p> {% endblock %} diff --git a/submissions/templates/submissions/_submission_summary_short.html b/submissions/templates/submissions/_submission_summary_short.html index bf6915e89f54fe758948d39f7ae3d7c438025498..a5e999c09085d7ff121f00ad501ae30edc04af47 100644 --- a/submissions/templates/submissions/_submission_summary_short.html +++ b/submissions/templates/submissions/_submission_summary_short.html @@ -19,7 +19,7 @@ </tr> <tr> - <td>arxiv Link:</td> + <td>Arxiv Link:</td> <td> <a href="{{submission.arxiv_link}}" target="_blank">{{submission.arxiv_link}}</a> </td> diff --git a/submissions/templates/submissions/reports_accepted_list.html b/submissions/templates/submissions/reports_accepted_list.html new file mode 100644 index 0000000000000000000000000000000000000000..b4a2ff77d264bdbcf7531ec7d39e47e39e15573b --- /dev/null +++ b/submissions/templates/submissions/reports_accepted_list.html @@ -0,0 +1,54 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Accepted Reports</span> +{% endblock %} + +{% load bootstrap %} + +{% block pagetitle %}: Accepted Reports{% endblock pagetitle %} + +{% block content %} + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Accepted Reports</h1> + </div> +</div> + +<div class="row"> + <div class="col-12"> + <table class="table"> + <thead> + <tr> + <th>Report nr. of Submission</th> + <th>Submission</th> + <th>Report author</th> + <th>Has PDF</th> + <th>Action</th> + </tr> + </thead> + <tbody> + {% for report in reports %} + <tr{% if not report.pdf_report %} class="table-danger"{% endif %}> + <td>{{report.report_nr}}</td> + <td><a href="{{report.get_absolute_url}}">{{report.submission.arxiv_identifier_w_vn_nr}}</a></td> + <td>{% if report.anonymous %}<em>Anonymous</em>{% else %}{{report.author}}{% endif %}</td> + <td> + {{report.pdf_report|yesno:"Yes,No"}} + {% if report.pdf_report %} + · <a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download</a> + {% endif %} + </td> + <td> + <a href="{% url 'submissions:report_pdf_compile' report.id %}">Compile/upload report</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +</div> + +{% endblock %} diff --git a/submissions/templates/submissions/reports_pdf_compile.html b/submissions/templates/submissions/reports_pdf_compile.html new file mode 100644 index 0000000000000000000000000000000000000000..bf46e0b6860c836b3d5a3c7d843508ea94253412 --- /dev/null +++ b/submissions/templates/submissions/reports_pdf_compile.html @@ -0,0 +1,74 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block pagetitle %}: Upload Report PDF{% endblock pagetitle %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{block.super}} + <a href="{% url 'submissions:reports_accepted_list' %}" class="breadcrumb-item">Accepted Reports</a> + <span class="breadcrumb-item">Upload Report PDF</span> +{% endblock %} + +{% block content %} + + <div class="row"> + <div class="col-12"> + <h1 class="highlight">Upload Report PDF</h1> + <div class="card"> + {% include 'submissions/_single_report_card_summary.html' with submission=report %} + </div> + </div> + </div> + + <div class="row"> + <div class="col-12"> + <h3>Please process this code in your Tex Compiler:</h3> + <p>To compile, one needs the SciPost Latex Package. Please <a href="mailto: info@scipost.org">contact SciPost</a> if you did not receive it.</p> + <pre class="clickfocus" style="max-height: 200px;"><code>{% include 'submissions/_report_tex_template.html' with report=report %}</code></pre> + </div> + </div> + + + <div class="row"> + <div class="col-12"> + <form method="post" enctype="multipart/form-data"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Upload"/> + </form> + </div> + </div> + +<script> + jQuery.fn.selectText = function(){ + this.find('input').each(function() { + if($(this).prev().length == 0 || !$(this).prev().hasClass('p_copy')) { + $('<p class="p_copy" style="position: absolute; z-index: -1;"></p>').insertBefore($(this)); + } + $(this).prev().html($(this).val()); + }); + var doc = document; + var element = this[0]; + + if (doc.body.createTextRange) { + var range = document.body.createTextRange(); + range.moveToElementText(element); + range.select(); + } else if (window.getSelection) { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + } + }; + + $(function() { + $('.clickfocus').on('click', function() { + $(this).find('code').selectText(); + }); + }); +</script> + +{% endblock %} diff --git a/submissions/templates/submissions/submission_detail.html b/submissions/templates/submissions/submission_detail.html index 2bdfae71d3c3ba9b23a405ac462b0d136f7cdb5f..67da25acbaae0e0fe48f8c85b25b78000cbf4a13 100644 --- a/submissions/templates/submissions/submission_detail.html +++ b/submissions/templates/submissions/submission_detail.html @@ -139,6 +139,14 @@ <li>Commenting on this Submission is closed.</li> {% endif %} </ul> + {% if perms.scipost.can_manage_reports %} + <h3>Admin Actions</h3> + <ul> + <li> + <a href="{% url 'submissions:treated_submission_pdf_compile' submission.arxiv_identifier_w_vn_nr %}">Update the Refereeing Package pdf</a> + </li> + <ul> + {% endif %} </div> </div> {% endif %} diff --git a/submissions/templates/submissions/treated_submission_pdf_compile.html b/submissions/templates/submissions/treated_submission_pdf_compile.html new file mode 100644 index 0000000000000000000000000000000000000000..19e456fefbb06e35c872c25f1cc8c53e0020ea62 --- /dev/null +++ b/submissions/templates/submissions/treated_submission_pdf_compile.html @@ -0,0 +1,82 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block pagetitle %}: Upload Submission Refereeing PDF{% endblock pagetitle %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{block.super}} + <a href="{% url 'submissions:treated_submissions_list' %}" class="breadcrumb-item">Treated Submissions</a> + <span class="breadcrumb-item">Upload Submission Refereeing PDF</span> +{% endblock %} + +{% block content %} + + <div class="row"> + <div class="col-12"> + <h1 class="highlight">Upload Submission Refereeing PDF</h1> + {% include 'submissions/_submission_summary_short.html' with submission=submission %} + <p class="my-2"><a href="{{submission.get_absolute_url}}">Go to Submission page</a></p> + </div> + </div> + <hr> + + <div class="row"> + <div class="col-12"> + <h3>Please process this code in your Tex Compiler</h3> + <p> + You may need to compile twice because of the Table of Content.<br> + To compile, one needs the SciPost Latex Package. Please <a href="mailto: info@scipost.org">contact SciPost</a> if you did not receive it. + </p> + <h3>Content of the Refereeing Package</h3> + <p> + Number of Reports: {{submission.reports.accepted.count}}<br> + Number of Comments <small>(nested comments not counted)</small>: {{submission.comments.vetted.count}} + </p> + <pre class="clickfocus" style="max-height: 200px;"><code>{% include 'submissions/_refereeing_pack_tex_template.html' with submission=submission %}</code></pre> + </div> + </div> + + + <div class="row"> + <div class="col-12"> + <form method="post" enctype="multipart/form-data"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Upload"/> + </form> + </div> + </div> + +<script> + jQuery.fn.selectText = function(){ + this.find('input').each(function() { + if($(this).prev().length == 0 || !$(this).prev().hasClass('p_copy')) { + $('<p class="p_copy" style="position: absolute; z-index: -1;"></p>').insertBefore($(this)); + } + $(this).prev().html($(this).val()); + }); + var doc = document; + var element = this[0]; + + if (doc.body.createTextRange) { + var range = document.body.createTextRange(); + range.moveToElementText(element); + range.select(); + } else if (window.getSelection) { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + } + }; + + $(function() { + $('.clickfocus').on('click', function() { + $(this).find('code').selectText(); + }); + }); +</script> + +{% endblock %} diff --git a/submissions/templates/submissions/treated_submissions_list.html b/submissions/templates/submissions/treated_submissions_list.html new file mode 100644 index 0000000000000000000000000000000000000000..c9b167bd9832f074302c794376cfd497b0413f2c --- /dev/null +++ b/submissions/templates/submissions/treated_submissions_list.html @@ -0,0 +1,56 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Treated Submissions</span> +{% endblock %} + +{% load bootstrap %} + +{% block pagetitle %}: Treated Submissions{% endblock pagetitle %} + +{% block content %} + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Treated Submissions</h1> + </div> +</div> + +<div class="row"> + <div class="col-12"> + <table class="table"> + <thead> + <tr> + <th>Submission</th> + <th>Status</th> + <th>Accepted</th> + <th>Number of Reports</th> + <th>Has PDF</th> + <th>Action</th> + </tr> + </thead> + <tbody> + {% for submission in submissions %} + <tr{% if not submission.pdf_refereeing_pack %} class="table-danger"{% endif %}> + <td><a href="{{submission.get_absolute_url}}">{{submission.arxiv_identifier_w_vn_nr}}</a></td> + <td>{{submission.get_status_display}}</td> + <td>{{submission.acceptance_date|default_if_none:'Date unknown'}}</td> + <td>{{submission.reports.accepted.count}}</td> + <td> + {{submission.pdf_refereeing_pack|yesno:"Yes,No"}} + {% if submission.pdf_refereeing_pack %} + · <a href="{% url 'submissions:refereeing_package_pdf' submission.arxiv_identifier_w_vn_nr %}" target="_blank">Download</a> + {% endif %} + </td> + <td> + <a href="{% url 'submissions:treated_submission_pdf_compile' submission.arxiv_identifier_w_vn_nr %}">Compile/upload Refereeing Package</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +</div> + +{% endblock %} diff --git a/submissions/templatetags/lookup.py b/submissions/templatetags/lookup.py index 803edd8acbd338d2202c2c1666955ac082787673..c2f7e549124208067d554ffd7ce304d5f8758ae2 100644 --- a/submissions/templatetags/lookup.py +++ b/submissions/templatetags/lookup.py @@ -8,7 +8,7 @@ class SubmissionLookup(LookupChannel): def get_query(self, q, request): return (self.model.objects - .public() + .public_unlisted() .order_by('-submission_date') .filter(title__icontains=q) .prefetch_related('publication')[:10]) diff --git a/submissions/urls.py b/submissions/urls.py index 6e776fcf71b60a8500c7f7fc8657ac7eb0f9e8e2..c4d8d4fc656accf12e14509b8e9386d804caa865 100644 --- a/submissions/urls.py +++ b/submissions/urls.py @@ -18,6 +18,13 @@ urlpatterns = [ name='submission_wo_vn_nr'), url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/$', views.submission_detail, name='submission'), + url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/reports/(?P<report_nr>[0-9]+)/pdf$', + views.report_detail_pdf, name='report_detail_pdf'), + url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/reports/pdf$', + views.submission_refereeing_package_pdf, name='refereeing_package_pdf'), + url(r'^treated_submissions$', views.treated_submissions_list, name='treated_submissions_list'), + url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/reports/compile$', + views.treated_submission_pdf_compile, name='treated_submission_pdf_compile'), url(r'^submit_manuscript$', views.RequestSubmission.as_view(), name='submit_manuscript'), url(r'^submit_manuscript/prefill$', views.prefill_using_arxiv_identifier, name='prefill_using_identifier'), @@ -26,6 +33,7 @@ urlpatterns = [ views.submissions_by_status, name='submissions_by_status'), url(r'^add_remark/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})$', views.add_remark, name='add_remark'), + # Assignment of Editor-in-charge url(r'^assign_submission/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})$', views.assign_submission, name='assign_submission'), @@ -73,9 +81,13 @@ urlpatterns = [ url(r'^cycle/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/submit$', views.cycle_form_submit, name='cycle_confirmation'), # Reports - url(r'^submit_report/(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})$', + url(r'^(?P<arxiv_identifier_w_vn_nr>[0-9]{4,}.[0-9]{5,}v[0-9]{1,2})/reports/submit$', views.submit_report, name='submit_report'), - url(r'^vet_submitted_reports$', views.vet_submitted_reports, name='vet_submitted_reports'), + url(r'^reports/vet_submitted$', views.vet_submitted_reports, name='vet_submitted_reports'), + url(r'^reports/list$', views.reports_accepted_list, name='reports_accepted_list'), + url(r'^reports/(?P<report_id>[0-9]+)/compile$', + views.report_pdf_compile, name='report_pdf_compile'), + # Voting url(r'^prepare_for_voting/(?P<rec_id>[0-9]+)$', views.prepare_for_voting, name='prepare_for_voting'), url(r'^vote_on_rec/(?P<rec_id>[0-9]+)$', views.vote_on_rec, name='vote_on_rec'), diff --git a/submissions/views.py b/submissions/views.py index 7e1d6f9114c2e850d5d114f79ffc23eda8cca284..931a814d9d52e784f5be8e4dbc073d1860696494 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -6,11 +6,13 @@ from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.models import Group from django.core.urlresolvers import reverse, reverse_lazy from django.db import transaction -from django.http import Http404, HttpResponseRedirect +from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render, redirect from django.template import Template, Context from django.utils import timezone from django.utils.decorators import method_decorator +from django.views.generic.edit import CreateView +from django.views.generic.list import ListView from guardian.decorators import permission_required_or_403 from guardian.shortcuts import assign_perm @@ -25,7 +27,7 @@ from .forms import SubmissionIdentifierForm, RequestSubmissionForm, SubmissionSe SetRefereeingDeadlineForm, RefereeSelectForm, RefereeRecruitmentForm,\ ConsiderRefereeInvitationForm, EditorialCommunicationForm,\ EICRecommendationForm, ReportForm, VetReportForm, VotingEligibilityForm,\ - SubmissionCycleChoiceForm + SubmissionCycleChoiceForm, ReportPDFForm, SubmissionReportsForm from .utils import SubmissionUtils from scipost.forms import ModifyPersonalMessageForm, RemarkForm @@ -35,9 +37,6 @@ from scipost.utils import Utils from comments.forms import CommentForm from production.models import ProductionStream -from django.views.generic.edit import CreateView -from django.views.generic.list import ListView - import strings @@ -122,7 +121,7 @@ class SubmissionListView(ListView): paginate_by = 10 def get_queryset(self): - queryset = Submission.objects.public_overcomplete() + queryset = Submission.objects.public_newest() self.form = self.form(self.request.GET) if 'to_journal' in self.kwargs: queryset = queryset.filter( @@ -218,6 +217,91 @@ def submission_detail(request, arxiv_identifier_w_vn_nr): return render(request, 'submissions/submission_detail.html', context) +def report_detail_pdf(request, arxiv_identifier_w_vn_nr, report_nr): + """ + Download the PDF of a Report if available. + """ + report = get_object_or_404(Report.objects.accepted(), + submission__arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr, + pdf_report__isnull=False, report_nr=report_nr) + response = HttpResponse(report.pdf_report.read(), content_type='application/pdf') + filename = '%s_report-%i.pdf' % (report.submission.arxiv_identifier_w_vn_nr, report.report_nr) + response['Content-Disposition'] = ('filename=' + filename) + return response + + +def submission_refereeing_package_pdf(request, arxiv_identifier_w_vn_nr): + """ + This view let's the user download all Report PDF's in a single merged PDF. + The merging takes places every time its downloaded to make sure all available report PDF's + are included and the EdColAdmin doesn't have to compile the package every time again. + """ + submission = get_object_or_404(Submission.objects.public().exclude(pdf_refereeing_pack=''), + arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + response = HttpResponse(submission.pdf_refereeing_pack.read(), content_type='application/pdf') + filename = '%s-refereeing-package.pdf' % submission.arxiv_identifier_w_vn_nr + response['Content-Disposition'] = ('filename=' + filename) + return response + + +@permission_required('scipost.can_manage_reports', raise_exception=True) +def reports_accepted_list(request): + """ + This view lists all accepted Reports. This shows if Report needs a PDF update/compile + in a convenient way. + """ + reports = (Report.objects.accepted() + .order_by('pdf_report', 'submission').prefetch_related('submission')) + context = { + 'reports': reports + } + return render(request, 'submissions/reports_accepted_list.html', context) + + +@permission_required('scipost.can_manage_reports', raise_exception=True) +def report_pdf_compile(request, report_id): + report = get_object_or_404(Report.objects.accepted(), id=report_id) + form = ReportPDFForm(request.POST or None, request.FILES or None, instance=report) + if form.is_valid(): + report = form.save() + messages.success(request, 'Upload complete.') + return redirect(reverse('submissions:reports_accepted_list')) + context = { + 'report': report, + 'form': form + } + return render(request, 'submissions/reports_pdf_compile.html', context) + + +@permission_required('scipost.can_manage_reports', raise_exception=True) +def treated_submissions_list(request): + """ + This view lists all accepted Reports. This shows if Report needs a PDF update/compile + in a convenient way. + """ + submissions = Submission.objects.treated().order_by('pdf_refereeing_pack', '-acceptance_date') + context = { + 'submissions': submissions + } + return render(request, 'submissions/treated_submissions_list.html', context) + + +@permission_required('scipost.can_manage_reports', raise_exception=True) +def treated_submission_pdf_compile(request, arxiv_identifier_w_vn_nr): + submission = get_object_or_404(Submission.objects.treated(), + arxiv_identifier_w_vn_nr=arxiv_identifier_w_vn_nr) + form = SubmissionReportsForm(request.POST or None, request.FILES or None, instance=submission) + if form.is_valid(): + form.save() + messages.success(request, 'Upload complete.') + return redirect(reverse('submissions:treated_submissions_list')) + context = { + 'submission': submission, + 'form': form + } + return render(request, 'submissions/treated_submission_pdf_compile.html', context) + + ###################### # Editorial workflow # ###################### @@ -408,7 +492,7 @@ def accept_or_decline_assignment_ack(request, assignment_id): @login_required -@permission_required('scipost.can_take_charge_of_submissions', raise_exception=True) +@permission_required('sci.can_take_charge_of_submissions', raise_exception=True) @transaction.atomic def volunteer_as_EIC(request, arxiv_identifier_w_vn_nr): """