diff --git a/comments/migrations/0020_comment_doideposit_needs_updating.py b/comments/migrations/0020_comment_doideposit_needs_updating.py new file mode 100644 index 0000000000000000000000000000000000000000..1adcc31e75acd94e91bf853495e6df830f122894 --- /dev/null +++ b/comments/migrations/0020_comment_doideposit_needs_updating.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-10 12:17 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('comments', '0019_auto_20170909_1649'), + ] + + operations = [ + migrations.AddField( + model_name='comment', + name='doideposit_needs_updating', + field=models.BooleanField(default=False), + ), + ] diff --git a/comments/models.py b/comments/models.py index 06225901ff8030dadb2293710432eae288b6d146..5410c48ffe73fc3ae9b174b69216fc497bb964e3 100644 --- a/comments/models.py +++ b/comments/models.py @@ -38,8 +38,6 @@ 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. @@ -90,6 +88,9 @@ class Comment(TimeStampedModel): blank=True) needs_doi = models.NullBooleanField(default=None) + doideposit_needs_updating = models.BooleanField(default=False) + genericdoideposit = GenericRelation('journals.GenericDOIDeposit', + related_query_name='genericdoideposit') doi_label = models.CharField(max_length=200, blank=True) objects = CommentQuerySet.as_manager() diff --git a/journals/migrations/0044_publication_doideposit_needs_updating.py b/journals/migrations/0044_publication_doideposit_needs_updating.py new file mode 100644 index 0000000000000000000000000000000000000000..e602a8820bb05d3eec81c5264b1b3af105d7269e --- /dev/null +++ b/journals/migrations/0044_publication_doideposit_needs_updating.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-10 12:54 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0043_auto_20170909_1649'), + ] + + operations = [ + migrations.AddField( + model_name='publication', + name='doideposit_needs_updating', + field=models.BooleanField(default=False), + ), + ] diff --git a/journals/models.py b/journals/models.py index 0adcaf9eb6fa054bde303b5f11348c022551f8bf..4dc87d39843fc4957040606eb819aaf8259f3712 100644 --- a/journals/models.py +++ b/journals/models.py @@ -155,6 +155,7 @@ class Publication(models.Model): BiBTeX_entry = models.TextField(blank=True, null=True) doi_label = models.CharField(max_length=200, unique=True, db_index=True, validators=[doi_publication_validator]) + doideposit_needs_updating = models.BooleanField(default=False) submission_date = models.DateField(verbose_name='submission date') acceptance_date = models.DateField(verbose_name='acceptance date') publication_date = models.DateField(verbose_name='publication date') diff --git a/journals/templates/journals/manage_comment_metadata.html b/journals/templates/journals/manage_comment_metadata.html index aebd9cbcd8a5f82a50d751837c9ed48511775c57..efd231d30dac48b5caf5cf6addf0c04f7f0663c8 100644 --- a/journals/templates/journals/manage_comment_metadata.html +++ b/journals/templates/journals/manage_comment_metadata.html @@ -28,6 +28,7 @@ event: "focusin" <th>Comment</th> <th>Needs doi</th> <th>Latest successful Crossref deposit</th> + <th>Deposit needs updating?</th> </tr> </thead> @@ -37,6 +38,7 @@ event: "focusin" <td>{{ comment }}</td> <td>{{ comment.needs_doi }}</td> <td>{{ comment|latest_successful_crossref_deposit_comment }}</td> + <td>{{ comment.doideposit_needs_updating }}</td> </tr> <tr id="collapse{{ comment.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ comment.id }}" style="background-color: #fff;"> <td colspan="5"> diff --git a/journals/templates/journals/manage_metadata.html b/journals/templates/journals/manage_metadata.html index 7025abe2757158aeed4e78e5dce2144ecc013401..56f960111f3f71caae0111c8e6ca43e3a8150e75 100644 --- a/journals/templates/journals/manage_metadata.html +++ b/journals/templates/journals/manage_metadata.html @@ -46,6 +46,7 @@ event: "focusin" <th>Publication date</th> <th>Latest metadata update</th> <th>Latest successful Crossref deposit</th> + <th>Deposit needs updating?</th> <th>DOAJ</th> </tr> </thead> @@ -63,10 +64,11 @@ event: "focusin" <td>No info available</td> {% endif %} <td>{{ publication|latest_successful_crossref_deposit }}</td> + <td>{{ publication.doideposit_needs_updating }}</td> <td>{{ publication|latest_successful_DOAJ_deposit }}</td> </tr> <tr id="collapse{{ publication.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ publication.id }}" style="background-color: #fff;"> - <td colspan="5"> + <td colspan="6"> <h2 class="ml-3">Actions</h2> <div class="row"> @@ -174,7 +176,7 @@ event: "focusin" </tr> {% empty %} <tr> - <td colspan="5">No Deposits found for this publication</td> + <td colspan="6">No Deposits found for this publication</td> </tr> {% endfor %} </tbody> @@ -203,7 +205,7 @@ event: "focusin" </tr> {% empty %} <tr> - <td colspan="4">No Deposits found for this publication</td> + <td colspan="6">No Deposits found for this publication</td> </tr> {% endfor %} </tbody> @@ -213,7 +215,7 @@ event: "focusin" </tr> {% empty %} <tr> - <td colspan="4">No publications found.</td> + <td colspan="6">No publications found.</td> </tr> {% endfor %} </tbody> diff --git a/journals/templates/journals/manage_report_metadata.html b/journals/templates/journals/manage_report_metadata.html index 16fc0d726a9ca9e3a15bb4b682140828225ae015..cd2dce24d5ebcee24ff2c2c2860dec19c8319f3e 100644 --- a/journals/templates/journals/manage_report_metadata.html +++ b/journals/templates/journals/manage_report_metadata.html @@ -29,6 +29,7 @@ event: "focusin" <th>Report nr</th> <th>Needs doi</th> <th>Latest successful Crossref deposit</th> + <th>Deposit needs updating?</th> </tr> </thead> @@ -39,6 +40,7 @@ event: "focusin" <td>{{ report.report_nr }}</td> <td>{{ report.needs_doi }}</td> <td>{{ report|latest_successful_crossref_deposit_report }}</td> + <td>{{ report.doideposit_needs_updating }}</td> </tr> <tr id="collapse{{ report.id }}" class="collapse" role="tabpanel" aria-labelledby="heading{{ report.id }}" style="background-color: #fff;"> <td colspan="5"> diff --git a/journals/templates/journals/sign_existing_report.html b/journals/templates/journals/sign_existing_report.html new file mode 100644 index 0000000000000000000000000000000000000000..99b8db35f47f12abc642bc14ddad4f0b96eb5a78 --- /dev/null +++ b/journals/templates/journals/sign_existing_report.html @@ -0,0 +1,33 @@ +{% extends 'scipost/base.html' %} + +{% load bootstrap %} + +{% block pagetitle %}: sign existing Report{% endblock pagetitle %} + +{% block content %} + +<div class="row"> + <div class="col-12"> + <hr class="hr12"> + <div class="row"> + <div class="col-6"> + <h2>Confirmation page: do you wish to sign this Report?</h2> + <h3>(your Report is reproduced below for your convenience)</h3> + </div> + <div class="col-6"> + <form action="{% url 'journals:sign_existing_report' report_id=report.id %}" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input class="btn btn-secondary" type="submit" value="Submit" /> + </form> + </div> + </div> + + <h3>Report on Submission <a href="{{report.submission.get_absolute_url}}">{{report.submission.title}}</a></h3> + + {% include 'submissions/_single_public_report_without_comments.html' with report=report user=request.user perms=perms %} + + </div> +</div> + +{% endblock %} diff --git a/journals/urls/general.py b/journals/urls/general.py index 163b3735fef156fa6a8c08288c0441d43fc2c81b..5570b662718dd4458c5d43ddd33f02efb8df178d 100644 --- a/journals/urls/general.py +++ b/journals/urls/general.py @@ -86,6 +86,9 @@ 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'^sign_existing_report/(?P<report_id>[0-9]+)$', + journals_views.sign_existing_report, + name='sign_existing_report'), url(r'^manage_report_metadata/$', journals_views.manage_report_metadata, name='manage_report_metadata'), diff --git a/journals/views.py b/journals/views.py index 323702d0592277e74ecd59fc40f8c704d30612df..fb5245c315d70fd7a832e0720739ad1e19e835fc 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.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from django.core.files.base import ContentFile @@ -31,6 +32,7 @@ from submissions.models import Submission, Report from scipost.models import Contributor from funders.forms import FunderSelectForm, GrantSelectForm +from scipost.forms import ConfirmationForm from guardian.decorators import permission_required @@ -937,6 +939,30 @@ def harvest_citedby_links(request, doi_label): return render(request, 'journals/harvest_citedby_links.html', context) +@login_required +def sign_existing_report(request, report_id): + """ + Allows the author of a Report, originally submitted anonymously, + to sign the Report. + """ + report = get_object_or_404(Report, pk=report_id) + if report.author != request.user.contributor: + errormessage = 'Only the author of this Report can change its anonymity status' + return render(request, 'scipost/error.html', context={'errormessage': errormessage}) + form = ConfirmationForm(request.POST or None) + if form.is_valid(): + if form.cleaned_data['confirm'] == 'True': + report.anonymous = False + report.doideposit_needs_updating = True + report.save() + messages.success(request, 'Your Report is now publicly signed.') + else: + messages.error(request, 'Report signing operation cancelled.') + return redirect(reverse('scipost:personal_page')) + context = {'report': report, 'form': form} + return render(request, 'journals/sign_existing_report.html', context) + + @permission_required('scipost.can_publish_accepted_submission', return_403=True) def manage_report_metadata(request): """ @@ -1073,6 +1099,8 @@ 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 + deposit.content_object.doideposit_needs_updating = False + deposit.content_object.save() elif success == '0': deposit.deposit_successful = False deposit.save() diff --git a/scipost/forms.py b/scipost/forms.py index 4c6ce047b4f09de5e982a8ec2c4560dfc9528be7..c3a5ceea75ce50d9c58cb9ca80e8114363611c3f 100644 --- a/scipost/forms.py +++ b/scipost/forms.py @@ -25,7 +25,10 @@ from .models import Contributor, DraftInvitation, RegistrationInvitation,\ from common.forms import MonthYearWidget from partners.decorators import has_contact + +from comments.models import Comment from journals.models import Publication +from submissions.models import Report REGISTRATION_REFUSAL_CHOICES = ( @@ -287,6 +290,26 @@ class UpdatePersonalDataForm(forms.ModelForm): # for _list in original_lists: # _list.update_membership([contributor], status='unsubscribed') + def propagate_orcid(self): + """ + This method is called if a Contributor updates his/her personal data, + and changes the orcid_id. It marks all Publications, Reports and Comments + authors by this Contributor with a deposit_requires_update == True. + """ + publications = Publication.objects.filter(authors__in=self.instance) + for publication in publications: + publication.doideposit_needs_updating = True + publication.save() + reports = Report.objects.filter(author=self.instance, anonymous=False) + for report in reports: + report.doideposit_needs_updating = True + report.save() + comments = Comment.objects.filter(author=contributor, anonymous=False) + for comment in comments: + comment.doideposit_needs_updating = True + comment.save() + return + class VetRegistrationForm(forms.Form): decision = forms.ChoiceField(widget=forms.RadioSelect, @@ -500,3 +523,8 @@ class SendPrecookedEmailForm(forms.Form): required=False, initial=False, label='Include SciPost summary at end of message') from_address = forms.ChoiceField(choices=SCIPOST_FROM_ADDRESSES) + + +class ConfirmationForm(forms.Form): + confirm = forms.ChoiceField(widget=forms.RadioSelect, + choices=((True, 'Confirm'), (False, 'Abort'))) diff --git a/scipost/migrations/0065_authorshipclaim_publication.py b/scipost/migrations/0065_authorshipclaim_publication.py new file mode 100644 index 0000000000000000000000000000000000000000..086e6116addd08a9916f7e3dda269cd5866808c0 --- /dev/null +++ b/scipost/migrations/0065_authorshipclaim_publication.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-10 13:46 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0044_publication_doideposit_needs_updating'), + ('scipost', '0064_auto_20170909_1649'), + ] + + operations = [ + migrations.AddField( + model_name='authorshipclaim', + name='publication', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='journals.Publication'), + ), + ] diff --git a/scipost/models.py b/scipost/models.py index d6cac15fd9be45affe5c0bfbe9e9ba47ace74861..33a2f09ce159c8083696db223a940a721fd40cb3 100644 --- a/scipost/models.py +++ b/scipost/models.py @@ -245,9 +245,12 @@ class CitationNotification(models.Model): class AuthorshipClaim(models.Model): - claimant = models.ForeignKey(Contributor, + claimant = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE, related_name='claimant') + publication = models.ForeignKey('journals.Publication', + on_delete=models.CASCADE, + blank=True, null=True) submission = models.ForeignKey('submissions.Submission', on_delete=models.CASCADE, blank=True, null=True) @@ -257,7 +260,7 @@ class AuthorshipClaim(models.Model): thesislink = models.ForeignKey('theses.ThesisLink', on_delete=models.CASCADE, blank=True, null=True) - vetted_by = models.ForeignKey(Contributor, + vetted_by = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE, blank=True, null=True) status = models.SmallIntegerField(choices=AUTHORSHIP_CLAIM_STATUS, diff --git a/scipost/templates/scipost/claim_authorships.html b/scipost/templates/scipost/claim_authorships.html index 2630c6844582f8b7e476ad2063d3884044977a44..8a774d4378e36742c6786cc783f4678f543d93c6 100644 --- a/scipost/templates/scipost/claim_authorships.html +++ b/scipost/templates/scipost/claim_authorships.html @@ -1,4 +1,9 @@ -{% extends 'scipost/base.html' %} +{% extends 'scipost/_personal_page_base.html' %} + +{% block breadcrumb_items %} + {{block.super}} + <span class="breadcrumb-item">Authorship Claims</span> +{% endblock %} {% block pagetitle %}: authorship claims{% endblock pagetitle %} @@ -14,6 +19,34 @@ </div> </div> +{% if publication_authorships_to_claim %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight">SciPost Publications</h2> + <h3>Potential authorships to claim (auto-detected)</h3> + </div> + </div> + <div class="row"> + <div class="col-12"> + {% for pub in publication_authorships_to_claim %} + <div class="card card-grey card-publication" id="{{pub.doi_label}}"> + {% include 'journals/_publication_card_content.html' with publication=pub %} + <div class="card-footer"> + <form class="d-inline-block" action="{% url 'scipost:claim_pub_authorship' publication_id=pub.id claim=1 %}" method="post"> + {% csrf_token %} + <input class="btn btn-secondary" type="submit" value="I am an author" /> + </form> + <form class="d-inline-block ml-1" action="{% url 'scipost:claim_pub_authorship' publication_id=pub.id claim=0 %}" method="post"> + {% csrf_token %} + <input class="btn btn-danger" type="submit" value="I am not an author" /> + </form> + </div> + </div> + {% endfor %} + </div> + </div> +{% endif %} + {% if submission_authorships_to_claim %} <div class="row"> <div class="col-12"> @@ -42,6 +75,7 @@ </div> {% endif %} + {% if commentary_authorships_to_claim %} <div class="row"> <div class="col-12"> @@ -98,7 +132,7 @@ </div> {% endif %} -{% if not submission_authorships_to_claim and not commentary_authorships_to_claim and not thesis_authorships_to_claim %} +{% if not submission_authorships_to_claim and not commentary_authorships_to_claim and not thesis_authorships_to_claim and not publication_authorships_to_claim %} <div class="row"> <div class="col-12"> <h2>You have no authorships to claim</h2> diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html index d8d69f94ae67efdf2fa37ea723c017914d997132..6776d069fc8af926cd39d4b044e7a42123fd7834 100644 --- a/scipost/templates/scipost/personal_page.html +++ b/scipost/templates/scipost/personal_page.html @@ -48,6 +48,9 @@ <a class="nav-link" data-toggle="tab" href="#refereeing">Refereeing {% if refereeing_tab_total_count %}({{refereeing_tab_total_count}}){% endif %}</a> </li> {% endif %} + <li class="nav-item btn btn-secondary"> + <a class="nav-link" data-toggle="tab" href="#publications">Publications</a> + </li> <li class="nav-item btn btn-secondary"> <a class="nav-link" data-toggle="tab" href="#submissions">Submissions</a> </li> @@ -372,7 +375,49 @@ </div> {% endif %} - {% if perms.scipost.can_referee %} + <!-- Tab: Publications --> + <div class="tab-pane" id="publications" role="tabpanel"> + <div class="row"> + <div class="col-12"> + <div class="card card-grey"> + <div class="card-body"> + <h2 class="card-title">Publications</h2> + <ul class="mb-0"> + {% if nr_publication_authorships_to_claim > 0 %} + <li><a href="{% url 'scipost:claim_authorships' %}">Potential authorships to claim (auto-detected: {{ nr_publication_authorships_to_claim}})</a></li> + {% endif %} + </ul> + </div> + </div> + </div> + </div> + + {# {% if own_publications %}#} + <div class="row" id="mypublicationslist"> + <div class="col-12"> + <h3 class="mb-3">Publications for which you are identified as an author:</h3> + </div> + <div class="col-12"> + <ul class="list-unstyled"> + {% for pub in own_publications %} + <li> + <div class="card card-grey card-publication" id="{{pub.doi_label}}"> + {% include 'journals/_publication_card_content.html' with publication=pub current_user=request.user %} + </div> + </li> + {% empty %} + <li> + <em>No Publications found</em> + </li> + {% endfor %} + </ul> + </div> + </div> + {# {% endif %}#} + </div><!-- End tab --> + + + {% if perms.scipost.can_referee %} <!-- Tab: Refereeing --> <div class="tab-pane" id="refereeing" role="tabpanel"> <div class="row"> @@ -444,8 +489,12 @@ <tr> <th>Status:</th><td {% if report.status == 'vetted' %}class="text-success"{% elif report.status == 'unvetted' %}class="text-danger"{% endif %}>{{report.get_status_display}}</td> </tr> + {% if report.doi_label %} + <tr> + <th>DOI:</th><td>{{ report.doi_string }}</td></th> +{% endif %} <tr> - <th>Anonymous:</th><td>{{report.anonymous|yesno:'Yes,No'}}</td> + <th>Anonymous:</th><td>{{report.anonymous|yesno:'Yes,No'}}</td>{% if report.anonymous %}<td>You can <a href="{% url 'journals:sign_existing_report' report_id=report.id %}">click here to sign this Report</a> (leads to confirmation page){% endif %}</td> </tr> </table> </div> diff --git a/scipost/templates/scipost/vet_authorship_claims.html b/scipost/templates/scipost/vet_authorship_claims.html index b43041b92c80bee7be604c8ae23bed3128da8205..54711cdaa79a973b44afc7c8b825d5830167b1e0 100644 --- a/scipost/templates/scipost/vet_authorship_claims.html +++ b/scipost/templates/scipost/vet_authorship_claims.html @@ -1,5 +1,7 @@ {% extends 'scipost/_personal_page_base.html' %} +{% load bootstrap %} + {% block breadcrumb_items %} {{block.super}} <span class="breadcrumb-item">Vet authorship claims</span> @@ -32,9 +34,14 @@ <ul class="list-group list-group-flush"> {% for claim in claims_to_vet %} - <li class="list-group-item"> + <li class="list-unstyled"> <div class="card w-100"> - {% if claim.submission %} + {% if claim.publication %} + <div class="card-header"> + <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Publication:</h4> + </div> + {% include 'journals/_publication_card_content.html' with publication=claim.publication %} + {% elif claim.submission %} <div class="card-header"> <h4>Contributor {{ claim.claimant.user.first_name }} {{ claim.claimant.user.last_name }} claims to be an author of Submission:</h4> </div> diff --git a/scipost/urls.py b/scipost/urls.py index e67452102c333fe77542e5a64e4fc24cf28e22dd..f3af0c4a67bc30f8a0c836d7f4692467359db08a 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -145,6 +145,8 @@ urlpatterns = [ # Authorship claims url(r'^claim_authorships$', views.claim_authorships, name="claim_authorships"), + url(r'^claim_pub_authorship/(?P<publication_id>[0-9]+)/(?P<claim>[0-1])$', + views.claim_pub_authorship, name='claim_pub_authorship'), url(r'^claim_sub_authorship/(?P<submission_id>[0-9]+)/(?P<claim>[0-1])$', views.claim_sub_authorship, name='claim_sub_authorship'), url(r'^claim_com_authorship/(?P<commentary_id>[0-9]+)/(?P<claim>[0-1])$', diff --git a/scipost/views.py b/scipost/views.py index b2a04826966cf778595b70b0fb5fed260f9ead1b..5c09fe3e60b3b05544df1ba5244b9039ef2286a0 100644 --- a/scipost/views.py +++ b/scipost/views.py @@ -752,11 +752,20 @@ def personal_page(request): # Verify if there exist objects authored by this contributor, # whose authorship hasn't been claimed yet + own_publications = (Publication.objects + .filter(authors__in=[contributor]) + .order_by('-publication_date')) own_submissions = (Submission.objects .filter(authors__in=[contributor], is_current=True) .order_by('-submission_date')) own_commentaries = Commentary.objects.filter(authors=contributor).order_by('-latest_activity') own_thesislinks = ThesisLink.objects.filter(author_as_cont__in=[contributor]) + nr_publication_authorships_to_claim = (Publication.objects.filter( + author_list__contains=contributor.user.last_name) + .exclude(authors__in=[contributor]) + .exclude(authors_claims__in=[contributor]) + .exclude(authors_false_claims__in=[contributor]) + .count()) nr_submission_authorships_to_claim = (Submission.objects.filter( author_list__contains=contributor.user.last_name) .exclude(authors__in=[contributor]) @@ -799,12 +808,14 @@ def personal_page(request): 'nr_recommendations_to_prepare_for_voting': nr_recommendations_to_prepare_for_voting, 'nr_assignments_to_consider': nr_assignments_to_consider, 'active_assignments': active_assignments, + 'nr_publication_authorships_to_claim': nr_publication_authorships_to_claim, 'nr_submission_authorships_to_claim': nr_submission_authorships_to_claim, 'nr_commentary_authorships_to_claim': nr_commentary_authorships_to_claim, 'nr_thesis_authorships_to_claim': nr_thesis_authorships_to_claim, 'nr_ref_inv_to_consider': nr_ref_inv_to_consider, 'pending_ref_tasks': pending_ref_tasks, 'refereeing_tab_total_count': refereeing_tab_total_count, + 'own_publications': own_publications, 'own_submissions': own_submissions, 'own_commentaries': own_commentaries, 'own_thesislinks': own_thesislinks, @@ -871,6 +882,8 @@ def _update_personal_data_contributor(request): user_form.save() cont_form.save() cont_form.sync_lists() + if 'orcid_id' in cont_form.changed_data: + cont_form.propagate_orcid() messages.success(request, 'Your personal data has been updated.') return redirect(reverse('scipost:personal_page')) else: @@ -898,6 +911,12 @@ def claim_authorships(request): """ contributor = Contributor.objects.get(user=request.user) + publication_authorships_to_claim = (Publication.objects + .filter(author_list__contains=contributor.user.last_name) + .exclude(authors__in=[contributor]) + .exclude(authors_claims__in=[contributor]) + .exclude(authors_false_claims__in=[contributor])) + pub_auth_claim_form = AuthorshipClaimForm() submission_authorships_to_claim = (Submission.objects .filter(author_list__contains=contributor.user.last_name) .exclude(authors__in=[contributor]) @@ -917,16 +936,35 @@ def claim_authorships(request): .exclude(author_false_claims__in=[contributor])) thesis_auth_claim_form = AuthorshipClaimForm() - context = {'submission_authorships_to_claim': submission_authorships_to_claim, - 'sub_auth_claim_form': sub_auth_claim_form, - 'commentary_authorships_to_claim': commentary_authorships_to_claim, - 'com_auth_claim_form': com_auth_claim_form, - 'thesis_authorships_to_claim': thesis_authorships_to_claim, - 'thesis_auth_claim_form': thesis_auth_claim_form, - } + context = { + 'publication_authorships_to_claim': publication_authorships_to_claim, + 'pub_auth_claim_form': pub_auth_claim_form, + 'submission_authorships_to_claim': submission_authorships_to_claim, + 'sub_auth_claim_form': sub_auth_claim_form, + 'commentary_authorships_to_claim': commentary_authorships_to_claim, + 'com_auth_claim_form': com_auth_claim_form, + 'thesis_authorships_to_claim': thesis_authorships_to_claim, + 'thesis_auth_claim_form': thesis_auth_claim_form, + } return render(request, 'scipost/claim_authorships.html', context) +@login_required +@user_passes_test(has_contributor) +def claim_pub_authorship(request, publication_id, claim): + if request.method == 'POST': + contributor = Contributor.objects.get(user=request.user) + publication = get_object_or_404(Publication, pk=publication_id) + if claim == '1': + publication.authors_claims.add(contributor) + newclaim = AuthorshipClaim(claimant=contributor, publication=publication) + newclaim.save() + elif claim == '0': + publication.authors_false_claims.add(contributor) + publication.save() + return redirect('scipost:claim_authorships') + + @login_required @user_passes_test(has_contributor) def claim_sub_authorship(request, submission_id, claim): @@ -988,6 +1026,15 @@ def vet_authorship_claim(request, claim_id, claim): vetting_contributor = Contributor.objects.get(user=request.user) claim_to_vet = AuthorshipClaim.objects.get(pk=claim_id) + if claim_to_vet.publication is not None: + claim_to_vet.publication.authors_claims.remove(claim_to_vet.claimant) + if claim == '1': + claim_to_vet.publication.authors.add(claim_to_vet.claimant) + claim_to_vet.status = '1' + elif claim == '0': + claim_to_vet.publication.authors_false_claims.add(claim_to_vet.claimant) + claim_to_vet.status = '-1' + claim_to_vet.publication.save() if claim_to_vet.submission is not None: claim_to_vet.submission.authors_claims.remove(claim_to_vet.claimant) if claim == '1': @@ -996,7 +1043,7 @@ def vet_authorship_claim(request, claim_id, claim): elif claim == '0': claim_to_vet.submission.authors_false_claims.add(claim_to_vet.claimant) claim_to_vet.status = '-1' - claim_to_vet.submission.save() + claim_to_vet.submission.save() if claim_to_vet.commentary is not None: claim_to_vet.commentary.authors_claims.remove(claim_to_vet.claimant) if claim == '1': @@ -1005,7 +1052,7 @@ def vet_authorship_claim(request, claim_id, claim): elif claim == '0': claim_to_vet.commentary.authors_false_claims.add(claim_to_vet.claimant) claim_to_vet.status = '-1' - claim_to_vet.commentary.save() + claim_to_vet.commentary.save() if claim_to_vet.thesislink is not None: claim_to_vet.thesislink.author_claims.remove(claim_to_vet.claimant) if claim == '1': @@ -1014,7 +1061,7 @@ def vet_authorship_claim(request, claim_id, claim): elif claim == '0': claim_to_vet.thesislink.author_false_claims.add(claim_to_vet.claimant) claim_to_vet.status = '-1' - claim_to_vet.thesislink.save() + claim_to_vet.thesislink.save() claim_to_vet.vetted_by = vetting_contributor claim_to_vet.save() diff --git a/submissions/migrations/0069_report_doideposit_needs_updating.py b/submissions/migrations/0069_report_doideposit_needs_updating.py new file mode 100644 index 0000000000000000000000000000000000000000..9d6b987794cae2f9ab974268211092cbefe438b8 --- /dev/null +++ b/submissions/migrations/0069_report_doideposit_needs_updating.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.4 on 2017-09-10 12:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('submissions', '0068_auto_20170909_1649'), + ] + + operations = [ + migrations.AddField( + model_name='report', + name='doideposit_needs_updating', + field=models.BooleanField(default=False), + ), + ] diff --git a/submissions/models.py b/submissions/models.py index d5660b121db8bc165fb883d2ead4f648dee62649..65896271ea5b02c93bb43f65b0508f129c934139 100644 --- a/submissions/models.py +++ b/submissions/models.py @@ -385,6 +385,7 @@ class Report(SubmissionRelatedObjectMixin, models.Model): remarks_for_editors = models.TextField(blank=True, verbose_name='optional remarks for the Editors only') needs_doi = models.NullBooleanField(default=None) + doideposit_needs_updating = models.BooleanField(default=False) genericdoideposit = GenericRelation('journals.GenericDOIDeposit', related_query_name='genericdoideposit') doi_label = models.CharField(max_length=200, blank=True)