diff --git a/commentaries/migrations/0018_auto_20170909_1649.py b/commentaries/migrations/0018_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..c77227daa943b872744dfc240927c9ab14ead270 --- /dev/null +++ b/commentaries/migrations/0018_auto_20170909_1649.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('commentaries', '0017_auto_20170728_1901'), + ] + + operations = [ + migrations.AlterField( + model_name='commentary', + name='subject_area', + field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], default='Phys:QP', max_length=10), + ), + ] diff --git a/comments/migrations/0019_auto_20170909_1649.py b/comments/migrations/0019_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..a5b1538b325773a8dc92f10e74c5d99afe7ccc78 --- /dev/null +++ b/comments/migrations/0019_auto_20170909_1649.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('comments', '0018_auto_20170729_1617'), + ] + + operations = [ + migrations.AddField( + model_name='comment', + name='doi_label', + field=models.CharField(blank=True, max_length=200), + ), + migrations.AddField( + model_name='comment', + name='needs_doi', + field=models.NullBooleanField(default=None), + ), + ] diff --git a/comments/models.py b/comments/models.py index b5d00c911998a27de84ae928a1ded10b955c6a77..06225901ff8030dadb2293710432eae288b6d146 100644 --- a/comments/models.py +++ b/comments/models.py @@ -38,6 +38,8 @@ class Comment(TimeStampedModel): content_object = GenericForeignKey() nested_comments = GenericRelation('comments.Comment', related_query_name='comments') + genericdoideposit = GenericRelation('journals.GenericDOIDeposit', + related_query_name='genericdoideposit') # -- U/S # These fields will be removed in the future. @@ -87,6 +89,8 @@ class Comment(TimeStampedModel): in_disagreement = models.ManyToManyField('scipost.Contributor', related_name='in_disagreement', blank=True) + needs_doi = models.NullBooleanField(default=None) + doi_label = models.CharField(max_length=200, blank=True) objects = CommentQuerySet.as_manager() class Meta: @@ -129,6 +133,17 @@ class Comment(TimeStampedModel): else: raise Exception + def create_doi_label(self): + self.doi_label = 'SciPost.Comment.' + str(self.id) + self.save() + + @property + def doi_string(self): + if self.doi_label: + return '10.21468/' + self.doi_label + else: + return None + def get_absolute_url(self): return self.content_object.get_absolute_url().split('#')[0] + '#comment_id' + str(self.id) diff --git a/comments/templates/comments/_comment_identifier.html b/comments/templates/comments/_comment_identifier.html index 5e668b933aefc737db21a22149daf829a8594fce..9c6b3127739c49b13fd1ca126d527188285b0c76 100644 --- a/comments/templates/comments/_comment_identifier.html +++ b/comments/templates/comments/_comment_identifier.html @@ -6,8 +6,10 @@ <a href="{{comment.author.get_absolute_url}}">{{comment.author.user.first_name}} {{comment.author.user.last_name}}</a> on {{comment.date_submitted|date:'Y-m-d'}} + {% if comment.doi_string %} <small>doi: {{ comment.doi_string }}</small>{% endif %} </h3> + {% if comment|is_reply_to_comment %} (in reply to <a href="{{comment.get_absolute_url}}">{{comment.content_object.author.user.first_name}} {{comment.content_object.author.user.last_name}}</a> on {{comment.content_object.date_submitted|date:'Y-m-d'}}) {% elif comment|is_reply_to_report %} diff --git a/journals/admin.py b/journals/admin.py index 0ed07f17e294622f403b9d3823ca201d673bb53e..2604c736d9db910ab2f5c6e3e02d7db920613359 100644 --- a/journals/admin.py +++ b/journals/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin, messages from django import forms from journals.models import UnregisteredAuthor, Journal, Volume, Issue, Publication, \ - Deposit, DOAJDeposit + Deposit, DOAJDeposit, GenericDOIDeposit from scipost.models import Contributor from submissions.models import Submission @@ -84,3 +84,6 @@ admin.site.register(Deposit, DepositAdmin) admin.site.register(DOAJDeposit) + + +admin.site.register(GenericDOIDeposit) diff --git a/journals/migrations/0043_auto_20170909_1649.py b/journals/migrations/0043_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..580eb5c994a92e8e3fb5dba72b47749703dd1cfe --- /dev/null +++ b/journals/migrations/0043_auto_20170909_1649.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import scipost.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('journals', '0042_doajdeposit_metadata_doaj_file'), + ] + + operations = [ + migrations.CreateModel( + name='GenericDOIDeposit', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.PositiveIntegerField()), + ('timestamp', models.CharField(default='', max_length=40)), + ('doi_batch_id', models.CharField(default='', max_length=40)), + ('metadata_xml', models.TextField(blank=True, null=True)), + ('deposition_date', models.DateTimeField(blank=True, null=True)), + ('response', models.TextField(blank=True, null=True)), + ('deposit_successful', models.NullBooleanField(default=None)), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')), + ], + options={ + 'ordering': ['-timestamp'], + }, + ), + migrations.AlterField( + model_name='publication', + name='secondary_areas', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], max_length=10), blank=True, null=True, size=None), + ), + migrations.AlterField( + model_name='publication', + name='subject_area', + field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], default='Phys:QP', max_length=10, verbose_name='Primary subject area'), + ), + ] diff --git a/journals/models.py b/journals/models.py index d9d71060450d31e0ccf2cfb617367abb29947426..0adcaf9eb6fa054bde303b5f11348c022551f8bf 100644 --- a/journals/models.py +++ b/journals/models.py @@ -1,3 +1,5 @@ +from django.contrib.contenttypes.fields import GenericForeignKey +from django.contrib.contenttypes.models import ContentType from django.contrib.postgres.fields import JSONField from django.db import models from django.template import Template, Context @@ -232,3 +234,25 @@ class DOAJDeposit(models.Model): def __str__(self): return ('DOAJ deposit for ' + self.publication.doi_label) + + +class GenericDOIDeposit(models.Model): + """ + Instances of this class represent Crossref deposits for non-publication + objects such as Reports, Comments etc. + """ + content_type = models.ForeignKey(ContentType) + object_id = models.PositiveIntegerField() + content_object = GenericForeignKey() + timestamp = models.CharField(max_length=40, default='') + doi_batch_id = models.CharField(max_length=40, default='') + metadata_xml = models.TextField(blank=True, null=True) + deposition_date = models.DateTimeField(blank=True, null=True) + response = models.TextField(blank=True, null=True) + deposit_successful = models.NullBooleanField(default=None) + + class Meta: + ordering = ['-timestamp'] + + def __str__(self): + return 'GenericDOIDeposit for %s %s' % (self.content_type, str(self.content_object)) diff --git a/journals/templates/journals/generic_metadata_xml_deposit.html b/journals/templates/journals/generic_metadata_xml_deposit.html new file mode 100644 index 0000000000000000000000000000000000000000..b9ff2af9c969f4f9439fe228407b3753a72b8979 --- /dev/null +++ b/journals/templates/journals/generic_metadata_xml_deposit.html @@ -0,0 +1,41 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block breadcrumb_items %} + {{block.super}} + <a href="{% url 'journals:manage_report_metadata' %}" class="breadcrumb-item">Manage metadata</a> + <span class="breadcrumb-item">Generic metadata XML deposit</span> +{% endblock %} + +{% block pagetitle %}: Generic metadata XML deposit{% endblock pagetitle %} + +{% block content %} + + +<div class="row"> + <div class="col-12"> + <h1 class="highlight">Generic metadata deposit</small></h1> + </div> +</div> + + +<div class="row"> + <div class="col-12"> + {% if errormessage %} + <h2 class="text-danger">{{ errormessage }}</h2> + {% endif %} + + <h3 class="my-1">Response headers:</h3> + <div> + <pre><code>{{ response_headers|linebreaks }}</code></pre> + </div> + + <h3 class="mt-3">Response text:</h3> + <p>{{ response_text|linebreaks }}</p> + + <h3>Return to the <a href="{% url 'journals:manage_report_metadata' %}">report</a> or to the <a href="{% url 'journals:manage_comment_metadata' %}">comment</a> metadata management page</h3> + + </div> +</div> + + +{% endblock %} diff --git a/journals/templates/journals/manage_comment_metadata.html b/journals/templates/journals/manage_comment_metadata.html new file mode 100644 index 0000000000000000000000000000000000000000..aebd9cbcd8a5f82a50d751837c9ed48511775c57 --- /dev/null +++ b/journals/templates/journals/manage_comment_metadata.html @@ -0,0 +1,88 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block pagetitle %}: Manage Comment metadata{% endblock pagetitle %} + +{% load bootstrap %} + +{% load journals_extras %} + +<script> +$(function() { +$( "#accordion" ).accordion({ +event: "focusin" +}); +}); +</script> + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Manage Comment metadata</span> +{% endblock %} + +{% block content %} + + +<table class="table table-hover mb-5"> + <thead class="thead-default"> + <tr> + <th>Comment</th> + <th>Needs doi</th> + <th>Latest successful Crossref deposit</th> + </tr> + </thead> + + <tbody id="accordion" role="tablist" aria-multiselectable="true"> + {% for comment in comments %} + <tr data-toggle="collapse" data-parent="#accordion" href="#collapse{{ comment.id }}" aria-expanded="true" aria-controls="collapse{{ comment.id }}" style="cursor: pointer;"> + <td>{{ comment }}</td> + <td>{{ comment.needs_doi }}</td> + <td>{{ comment|latest_successful_crossref_deposit_comment }}</td> + </tr> + <tr id="collapse{{ comment.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ comment.id }}" style="background-color: #fff;"> + <td colspan="5"> + <p><a href="{{ comment.get_absolute_url }}">{{ comment }}</a></p> + + <h2 class="ml-3">Actions</h2> + <ul> + <li>Mark DOI as <a href="{% url 'journals:mark_comment_doi_needed' comment_id=comment.id needed=1 %}">needed</a> / <a href="{% url 'journals:mark_comment_doi_needed' comment_id=comment.id needed=0 %}">not needed</a></li> + <li><a href="{% url 'journals:generic_metadata_xml_deposit' type_of_object='comment' object_id=comment.id %}">Create the metadata and deposit it to Crossref</a></li> + </ul> + + <h2 class="ml-3">Crossref Deposits</h2> + <table class="ml-5"> + <thead class="thead-default"> + <th>Timestamp</th> + <th>batch id</th> + <th>deposition date</th> + <th>Successful?</th> + <th>actions</th> + </thead> + <tbody> + {% for deposit in comment.genericdoideposit.all %} + <tr> + <td>{{ deposit.timestamp }}</td> + <td>{{ deposit.doi_batch_id }}</td> + <td>{% if deposit.deposition_date %}{{ deposit.deposition_date }}{% else %}Not deposited{% endif %}</td> + <td>{{ deposit.deposit_successful }}</td> + <td>Mark deposit as + <ul> + <li><a href="{% url 'journals:mark_generic_deposit_success' deposit_id=deposit.id success=1 %}">successful</a></li> + <li><a href="{% url 'journals:mark_generic_deposit_success' deposit_id=deposit.id success=0 %}">unsuccessful</a></li> + </ul> + </td> + </tr> + {% empty %} + <tr> + <td colspan="5">No Deposits found for this Comment</td> + </tr> + {% endfor %} + </tbody> + </table> + + </td> + </tr> + {% endfor %} + </tbody> +</table> + +{% endblock content %} diff --git a/journals/templates/journals/manage_report_metadata.html b/journals/templates/journals/manage_report_metadata.html new file mode 100644 index 0000000000000000000000000000000000000000..16fc0d726a9ca9e3a15bb4b682140828225ae015 --- /dev/null +++ b/journals/templates/journals/manage_report_metadata.html @@ -0,0 +1,90 @@ +{% extends 'scipost/_personal_page_base.html' %} + +{% block pagetitle %}: Manage Report metadata{% endblock pagetitle %} + +{% load bootstrap %} + +{% load journals_extras %} + +<script> +$(function() { +$( "#accordion" ).accordion({ +event: "focusin" +}); +}); +</script> + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Manage Report metadata</span> +{% endblock %} + +{% block content %} + + +<table class="table table-hover mb-5"> + <thead class="thead-default"> + <tr> + <th>Submission</th> + <th>Report nr</th> + <th>Needs doi</th> + <th>Latest successful Crossref deposit</th> + </tr> + </thead> + + <tbody id="accordion" role="tablist" aria-multiselectable="true"> + {% for report in reports %} + <tr data-toggle="collapse" data-parent="#accordion" href="#collapse{{ report.id }}" aria-expanded="true" aria-controls="collapse{{ report.id }}" style="cursor: pointer;"> + <td>{{ report.submission.arxiv_identifier_w_vn_nr }}</td> + <td>{{ report.report_nr }}</td> + <td>{{ report.needs_doi }}</td> + <td>{{ report|latest_successful_crossref_deposit_report }}</td> + </tr> + <tr id="collapse{{ report.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ report.id }}" style="background-color: #fff;"> + <td colspan="5"> + <p><a href="{{ report.submission.get_absolute_url }}">{{ report.submission.arxiv_identifier_w_vn_nr }}</a>, <a href="{{ report.get_absolute_url }}">{{ report.report_nr }}</a></p> + + <h2 class="ml-3">Actions</h2> + <ul> + <li>Mark DOI as <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=1 %}">needed</a> / <a href="{% url 'journals:mark_report_doi_needed' report_id=report.id needed=0 %}">not needed</a></li> + <li><a href="{% url 'journals:generic_metadata_xml_deposit' type_of_object='report' object_id=report.id %}">Create the metadata and deposit it to Crossref</a></li> + </ul> + + <h2 class="ml-3">Crossref Deposits</h2> + <table class="ml-5"> + <thead class="thead-default"> + <th>Timestamp</th> + <th>batch id</th> + <th>deposition date</th> + <th>Successful?</th> + <th>actions</th> + </thead> + <tbody> + {% for deposit in report.genericdoideposit.all %} + <tr> + <td>{{ deposit.timestamp }}</td> + <td>{{ deposit.doi_batch_id }}</td> + <td>{% if deposit.deposition_date %}{{ deposit.deposition_date }}{% else %}Not deposited{% endif %}</td> + <td>{{ deposit.deposit_successful }}</td> + <td>Mark deposit as + <ul> + <li><a href="{% url 'journals:mark_generic_deposit_success' deposit_id=deposit.id success=1 %}">successful</a></li> + <li><a href="{% url 'journals:mark_generic_deposit_success' deposit_id=deposit.id success=0 %}">unsuccessful</a></li> + </ul> + </td> + </tr> + {% empty %} + <tr> + <td colspan="5">No Deposits found for this Report</td> + </tr> + {% endfor %} + </tbody> + </table> + + </td> + </tr> + {% endfor %} + </tbody> +</table> + +{% endblock content %} diff --git a/journals/templatetags/journals_extras.py b/journals/templatetags/journals_extras.py index d995ca07c160a96cad93d8efab44c91e72bf4dc2..fa6370f73bf45bfcb683840a82f28d5767d9e93d 100644 --- a/journals/templatetags/journals_extras.py +++ b/journals/templatetags/journals_extras.py @@ -26,3 +26,21 @@ def latest_successful_DOAJ_deposit(publication): return latest.deposition_date.strftime('%Y-%m-%d') else: return "No successful deposit found" + +@register.filter(name='latest_successful_crossref_deposit_report') +def latest_successful_crossref_deposit(report): + latest = report.genericdoideposit.filter( + deposit_successful=True).order_by('-deposition_date').first() + if latest: + return latest.deposition_date.strftime('%Y-%m-%d') + else: + return "No successful deposit found" + +@register.filter(name='latest_successful_crossref_deposit_comment') +def latest_successful_crossref_deposit(comment): + latest = comment.genericdoideposit.filter( + deposit_successful=True).order_by('-deposition_date').first() + if latest: + return latest.deposition_date.strftime('%Y-%m-%d') + else: + return "No successful deposit found" diff --git a/journals/urls/general.py b/journals/urls/general.py index 478572c2a241c0572bffea2ac26ed3b8c91fae81..163b3735fef156fa6a8c08288c0441d43fc2c81b 100644 --- a/journals/urls/general.py +++ b/journals/urls/general.py @@ -86,4 +86,22 @@ urlpatterns = [ url(r'^harvest_citedby_links/(?P<doi_label>[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,})$', journals_views.harvest_citedby_links, name='harvest_citedby_links'), + url(r'^manage_report_metadata/$', + journals_views.manage_report_metadata, + name='manage_report_metadata'), + url(r'^manage_comment_metadata/$', + journals_views.manage_comment_metadata, + name='manage_comment_metadata'), + url(r'^mark_report_doi_needed/(?P<report_id>[0-9]+)/(?P<needed>[0-1])$', + journals_views.mark_report_doi_needed, + name='mark_report_doi_needed'), + url(r'^mark_comment_doi_needed/(?P<comment_id>[0-9]+)/(?P<needed>[0-1])$', + journals_views.mark_comment_doi_needed, + name='mark_comment_doi_needed'), + url(r'^generic_metadata_xml_deposit/(?P<type_of_object>[a-z]+)/(?P<object_id>[0-9]+)$', + journals_views.generic_metadata_xml_deposit, + name='generic_metadata_xml_deposit'), + url(r'^mark_generic_deposit_success/(?P<deposit_id>[0-9]+)/(?P<success>[0-1])$', + journals_views.mark_generic_deposit_success, + name='mark_generic_deposit_success'), ] diff --git a/journals/views.py b/journals/views.py index 763518a9a21b18aa79d9828f5c56d2bc6badc0a0..ebcd6d4f7eb69f31fde628ad0e8d2a2e71cc1bba 100644 --- a/journals/views.py +++ b/journals/views.py @@ -6,6 +6,7 @@ import requests import string import xml.etree.ElementTree as ET +from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.core.files.base import ContentFile from django.conf import settings @@ -18,13 +19,15 @@ from django.http import HttpResponse from .exceptions import PaperNumberingError from .helpers import paper_nr_string, issue_doi_label_from_doi_label -from .models import Journal, Issue, Publication, UnregisteredAuthor, Deposit, DOAJDeposit +from .models import Journal, Issue, Publication, UnregisteredAuthor, Deposit, DOAJDeposit,\ + GenericDOIDeposit from .forms import FundingInfoForm, InitiatePublicationForm, ValidatePublicationForm,\ UnregisteredAuthorForm, CreateMetadataXMLForm, CitationListBibitemsForm from .utils import JournalUtils +from comments.models import Comment from funders.models import Funder -from submissions.models import Submission +from submissions.models import Submission, Report from scipost.models import Contributor from funders.forms import FunderSelectForm, GrantSelectForm @@ -935,6 +938,144 @@ def harvest_citedby_links(request, doi_label): return render(request, 'journals/harvest_citedby_links.html', context) +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +def manage_report_metadata(request): + """ + This page offers Editorial Administrators tools for managing + the metadata of Reports. + """ + reports = Report.objects.all() + context = { + 'reports': reports, + } + return render(request, 'journals/manage_report_metadata.html', context) + + +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +def manage_comment_metadata(request): + """ + This page offers Editorial Administrators tools for managing + the metadata of Comments. + """ + comments = Comment.objects.all() + context = { + 'comments': comments, + } + return render(request, 'journals/manage_comment_metadata.html', context) + + +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +def mark_report_doi_needed(request, report_id, needed): + report = get_object_or_404(Report, pk=report_id) + if needed == '1': + report.needs_doi = True + elif needed == '0': + report.needs_doi = False + report.save() + return redirect(reverse('journals:manage_report_metadata')) + + +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +def mark_comment_doi_needed(request, comment_id, needed): + comment = get_object_or_404(Comment, pk=comment_id) + if needed == '1': + comment.needs_doi = True + elif needed == '0': + comment.needs_doi = False + comment.save() + return redirect(reverse('journals:manage_comment_metadata')) + + +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +@transaction.atomic +def generic_metadata_xml_deposit(request, **kwargs): + """ + This method creates the metadata for non-Publication objects + such as Reports and Comments, and deposits the metadata to + Crossref. + """ + type_of_object = kwargs['type_of_object'] + object_id = int(kwargs['object_id']) + if type_of_object == 'report': + _object = get_object_or_404(Report, id=object_id) + elif type_of_object == 'comment': + _object = get_object_or_404(Comment, id=object_id) + + if not _object.doi_label: + _object.create_doi_label() + + # create a doi_batch_id + salt = "" + for i in range(5): + salt = salt + random.choice(string.ascii_letters) + salt = salt.encode('utf8') + idsalt = str(_object)[:10] + idsalt = idsalt.encode('utf8') + timestamp=timezone.now().strftime('%Y%m%d%H%M%S') + doi_batch_id = hashlib.sha1(salt+idsalt).hexdigest() + metadata_xml = ( + '<?xml version="1.0" encoding="UTF-8"?>\n' + '<doi_batch version="4.4.0" xmlns="http://www.crossref.org/schema/4.4.0" ' + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'xmlns:fr="http://www.crossref.org/fundref.xsd" ' + 'xsi:schemaLocation="http://www.crossref.org/schema/4.4.0 ' + 'http://www.crossref.org/shema/deposit/crossref4.4.0.xsd" ' + 'xmlns:ai="http://www.crossref.org/AccessIndicators.xsd">\n' + '<head>\n' + '<doi_batch_id>' + str(doi_batch_id) + '</doi_batch_id>\n' + '<timestamp>' + timestamp + '</timestamp>\n' + '<depositor>\n' + '<depositor_name>scipost</depositor_name>\n' + '<email_address>admin@scipost.org</email_address>\n' + '</depositor>\n' + '<registrant>scipost</registrant>\n' + '</head>\n' + '<body>\n' + '<database><dataset>\n' + '<dataset_type>component<\dataset_type>\n' + '<doi_data><doi>' + _object.doi_string + '</doi>\n' + '<resource>' + _object.get_absolute_url() + '</resource>\n' + '</dataset></database>\n' + '</body></doi_batch>' + ) + url = 'http://doi.crossref.org/servlet/deposit' + params = { + 'operation': 'doMDUpload', + 'login_id': settings.CROSSREF_LOGIN_ID, + 'login_passwd': settings.CROSSREF_LOGIN_PASSWORD, + } + files = {'fname': ('metadata.xml', metadata_xml, 'multipart/form-data')} + r = requests.post(url, params=params, files=files) + deposit = GenericDOIDeposit(content_type=ContentType.objects.get_for_model(_object), + object_id=object_id, + content_object=_object, + timestamp=timestamp, + doi_batch_id=doi_batch_id, + metadata_xml=metadata_xml, + deposition_date=timezone.now(), + response=r.text) + deposit.save() + context = { + 'response_headers': r.headers, + 'response_text': r.text, + } + return render(request, 'journals/generic_metadata_xml_deposit.html', context) + + +@permission_required('scipost.can_publish_accepted_submission', return_403=True) +def mark_generic_deposit_success(request, deposit_id, success): + deposit = get_object_or_404(GenericDOIDeposit, pk=deposit_id) + if success == '1': + deposit.deposit_successful = True + elif success == '0': + deposit.deposit_successful = False + deposit.save() + if deposit.content_type.name == 'report': + return redirect(reverse('journals:manage_report_metadata')) + else: + return redirect(reverse('journals:manage_comment_metadata')) + + ########### # Viewing # ########### diff --git a/scipost/migrations/0064_auto_20170909_1649.py b/scipost/migrations/0064_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..85e010563fd0504477e00784cbb8fab083a757fc --- /dev/null +++ b/scipost/migrations/0064_auto_20170909_1649.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import scipost.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('scipost', '0063_auto_20170829_0727'), + ] + + operations = [ + migrations.AlterField( + model_name='contributor', + name='expertises', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], max_length=10), blank=True, null=True, size=None), + ), + ] diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index d0d661adc558ecc92fd0d076b9bb0bf54196cbcc..d8d69f94ae67efdf2fa37ea723c017914d997132 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -280,7 +280,9 @@ <li><a href="{% url 'submissions:admin' %}">Editorial Administration Page</a></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> <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:manage_metadata' %}">Manage Publication metadata</a></li> + <li><a href="{% url 'journals:manage_report_metadata' %}">Manage Report metadata</a></li> + <li><a href="{% url 'journals:manage_comment_metadata' %}">Manage Comment metadata</a></li> </ul> {% endif %} diff --git a/submissions/migrations/0068_auto_20170909_1649.py b/submissions/migrations/0068_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..5244c8c97e3400f040f39d5098ec3fca7dc48898 --- /dev/null +++ b/submissions/migrations/0068_auto_20170909_1649.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import scipost.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0067_auto_20170907_1209'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='needs_doi', + field=models.NullBooleanField(default=None), + ), + migrations.AlterField( + model_name='submission', + name='secondary_areas', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], max_length=10), blank=True, null=True, size=None), + ), + migrations.AlterField( + model_name='submission', + name='subject_area', + field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], default='Phys:QP', max_length=10, verbose_name='Primary subject area'), + ), + ] diff --git a/submissions/models.py b/submissions/models.py index fac326dd38cebf55267f3bb054d066f5931eb3c3..d5660b121db8bc165fb883d2ead4f648dee62649 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -384,6 +384,9 @@ class Report(SubmissionRelatedObjectMixin, models.Model): recommendation = models.SmallIntegerField(choices=REPORT_REC) remarks_for_editors = models.TextField(blank=True, verbose_name='optional remarks for the Editors only') + needs_doi = models.NullBooleanField(default=None) + genericdoideposit = GenericRelation('journals.GenericDOIDeposit', + related_query_name='genericdoideposit') 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) @@ -408,6 +411,10 @@ class Report(SubmissionRelatedObjectMixin, models.Model): self.report_nr = self.submission.reports.count() + 1 return super().save(*args, **kwargs) + def create_doi_label(self): + self.doi_label = 'SciPost.Report.' + str(self.id) + self.save() + def get_absolute_url(self): return self.submission.get_absolute_url() + '#report_' + str(self.report_nr) @@ -415,6 +422,8 @@ class Report(SubmissionRelatedObjectMixin, models.Model): def doi_string(self): if self.doi_label: return '10.21468/' + self.doi_label + else: + return None @cached_property def title(self): diff --git a/submissions/templates/submissions/_report_tex_template.html b/submissions/templates/submissions/_report_tex_template.html index edb59afc172ed68722591107bcd2b97c5a737a01..466bd507f04e4b765986ca5ca7ecc93e5acba4dd 100644 --- a/submissions/templates/submissions/_report_tex_template.html +++ b/submissions/templates/submissions/_report_tex_template.html @@ -63,7 +63,6 @@ Report by {% if report.anonymous %}anonymous{% else %}{{report.author.user.first %%%%%%%%%% 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. diff --git a/submissions/templates/submissions/_single_public_report_without_comments.html b/submissions/templates/submissions/_single_public_report_without_comments.html index 289f2169d1d34bc4bd64517f86e2dea2d29ff11e..9c322add27afc2ce4dc3e155922d7bca5c2824e9 100644 --- a/submissions/templates/submissions/_single_public_report_without_comments.html +++ b/submissions/templates/submissions/_single_public_report_without_comments.html @@ -8,15 +8,18 @@ <div class="reportid"> <h3>{% if report.anonymous %}(chose public anonymity) {% endif %}<a href="{{report.author.get_absolute_url}}">{{ report.author.user.first_name }} {{ report.author.user.last_name }}</a> - on {{ report.date_submitted|date:'Y-n-j' }}</h3> + on {{ report.date_submitted|date:'Y-n-j' }} </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> + <ul class="publicationClickables"> + {% if report.doi_string %}<li>doi: {{ report.doi_string }}</li>{% endif %} + {% if report.pdf_report %} + <li><a href="{% url 'submissions:report_detail_pdf' report.submission.arxiv_identifier_w_vn_nr report.report_nr %}" target="_blank">Download as PDF</a></li> {% endif %} {% if perms.scipost.can_manage_reports %} - {% if report.pdf_report %}· {% endif %}<a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a> - {% endif %} - </div> + <li><a href="{% url 'submissions:report_pdf_compile' report.id %}">Update/Compile the Report pdf</a></li> + {% endif %} + </ul> +</div> {% if report.flagged %} <h4 class="text-danger font-weight-bold">CAUTION: check if this referee has been flagged by the authors</h4> diff --git a/theses/migrations/0008_auto_20170909_1649.py b/theses/migrations/0008_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..931a7dee268afc6b6fdef12249a7eb062557891b --- /dev/null +++ b/theses/migrations/0008_auto_20170909_1649.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('theses', '0007_auto_20170829_0727'), + ] + + operations = [ + migrations.AlterField( + model_name='thesislink', + name='subject_area', + field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], default='Phys:QP', max_length=10), + ), + ] diff --git a/virtualmeetings/migrations/0003_auto_20170909_1649.py b/virtualmeetings/migrations/0003_auto_20170909_1649.py new file mode 100644 index 0000000000000000000000000000000000000000..2d34ddda0e32a71129ff853437bac0e5f58a2bf6 --- /dev/null +++ b/virtualmeetings/migrations/0003_auto_20170909_1649.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-09 14:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import scipost.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('virtualmeetings', '0002_auto_20170618_2024'), + ] + + operations = [ + migrations.AlterField( + model_name='nomination', + name='expertises', + field=scipost.fields.ChoiceArrayField(base_field=models.CharField(choices=[('Physics', (('Phys:AE', 'Atomic, Molecular and Optical Physics - Experiment'), ('Phys:AT', 'Atomic, Molecular and Optical Physics - Theory'), ('Phys:BI', 'Biophysics'), ('Phys:CE', 'Condensed Matter Physics - Experiment'), ('Phys:CT', 'Condensed Matter Physics - Theory'), ('Phys:FD', 'Fluid Dynamics'), ('Phys:GR', 'Gravitation, Cosmology and Astroparticle Physics'), ('Phys:HE', 'High-Energy Physics - Experiment'), ('Phys:HT', 'High-Energy Physics - Theory'), ('Phys:HP', 'High-Energy Physics - Phenomenology'), ('Phys:MP', 'Mathematical Physics'), ('Phys:NE', 'Nuclear Physics - Experiment'), ('Phys:NT', 'Nuclear Physics - Theory'), ('Phys:QP', 'Quantum Physics'), ('Phys:SM', 'Statistical and Soft Matter Physics'))), ('Astrophysics', (('Astro:GA', 'Astrophysics of Galaxies'), ('Astro:CO', 'Cosmology and Nongalactic Astrophysics'), ('Astro:EP', 'Earth and Planetary Astrophysics'), ('Astro:HE', 'High Energy Astrophysical Phenomena'), ('Astro:IM', 'Instrumentation and Methods for Astrophysics'), ('Astro:SR', 'Solar and Stellar Astrophysics'))), ('Mathematics', (('Math:AG', 'Algebraic Geometry'), ('Math:AT', 'Algebraic Topology'), ('Math:AP', 'Analysis of PDEs'), ('Math:CT', 'Category Theory'), ('Math:CA', 'Classical Analysis and ODEs'), ('Math:CO', 'Combinatorics'), ('Math:AC', 'Commutative Algebra'), ('Math:CV', 'Complex Variables'), ('Math:DG', 'Differential Geometry'), ('Math:DS', 'Dynamical Systems'), ('Math:FA', 'Functional Analysis'), ('Math:GM', 'General Mathematics'), ('Math:GN', 'General Topology'), ('Math:GT', 'Geometric Topology'), ('Math:GR', 'Group Theory'), ('Math:HO', 'History and Overview'), ('Math:IT', 'Information Theory'), ('Math:KT', 'K-Theory and Homology'), ('Math:LO', 'Logic'), ('Math:MP', 'Mathematical Physics'), ('Math:MG', 'Metric Geometry'), ('Math:NT', 'Number Theory'), ('Math:NA', 'Numerical Analysis'), ('Math:OA', 'Operator Algebras'), ('Math:OC', 'Optimization and Control'), ('Math:PR', 'Probability'), ('Math:QA', 'Quantum Algebra'), ('Math:RT', 'Representation Theory'), ('Math:RA', 'Rings and Algebras'), ('Math:SP', 'Spectral Theory'), ('Math:ST', 'Statistics Theory'), ('Math:SG', 'Symplectic Geometry'))), ('Computer Science', (('Comp:AI', 'Artificial Intelligence'), ('Comp:CC', 'Computational Complexity'), ('Comp:CE', 'Computational Engineering, Finance, and Science'), ('Comp:CG', 'Computational Geometry'), ('Comp:GT', 'Computer Science and Game Theory'), ('Comp:CV', 'Computer Vision and Pattern Recognition'), ('Comp:CY', 'Computers and Society'), ('Comp:CR', 'Cryptography and Security'), ('Comp:DS', 'Data Structures and Algorithms'), ('Comp:DB', 'Databases'), ('Comp:DL', 'Digital Libraries'), ('Comp:DM', 'Discrete Mathematics'), ('Comp:DC', 'Distributed, Parallel, and Cluster Computing'), ('Comp:ET', 'Emerging Technologies'), ('Comp:FL', 'Formal Languages and Automata Theory'), ('Comp:GL', 'General Literature'), ('Comp:GR', 'Graphics'), ('Comp:AR', 'Hardware Architecture'), ('Comp:HC', 'Human-Computer Interaction'), ('Comp:IR', 'Information Retrieval'), ('Comp:IT', 'Information Theory'), ('Comp:LG', 'Learning'), ('Comp:LO', 'Logic in Computer Science'), ('Comp:MS', 'Mathematical Software'), ('Comp:MA', 'Multiagent Systems'), ('Comp:MM', 'Multimedia'), ('Comp:NI', 'Networking and Internet Architecture'), ('Comp:NE', 'Neural and Evolutionary Computing'), ('Comp:NA', 'Numerical Analysis'), ('Comp:OS', 'Operating Systems'), ('Comp:OH', 'Other Computer Science'), ('Comp:PF', 'Performance'), ('Comp:PL', 'Programming Languages'), ('Comp:RO', 'Robotics'), ('Comp:SI', 'Social and Information Networks'), ('Comp:SE', 'Software Engineering'), ('Comp:SD', 'Sound'), ('Comp:SC', 'Symbolic Computation'), ('Comp:SY', 'Systems and Control')))], max_length=10), blank=True, null=True, size=None), + ), + ]