From c891c75f7dc9a323f3aa011d17abb19496182bfb Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Tue, 31 May 2016 21:09:07 +0200
Subject: [PATCH] Bug fixes

---
 scipost/templates/scipost/about.html          |  2 +-
 .../submissions/submit_manuscript.html        |  3 +-
 submissions/utils.py                          | 92 +++++++++++--------
 submissions/views.py                          |  3 +-
 4 files changed, 61 insertions(+), 39 deletions(-)

diff --git a/scipost/templates/scipost/about.html b/scipost/templates/scipost/about.html
index a6c3c63d2..ec89a0c8e 100644
--- a/scipost/templates/scipost/about.html
+++ b/scipost/templates/scipost/about.html
@@ -166,7 +166,7 @@
     <div class="flex-whitebox">
       <ul>
 	<li>Prof. <a href="http://www.ens-lyon.fr/PHYSIQUE/presentation/annuaire/maillet-jean-michel">J.M. Maillet</a><br/>(ENS Lyon)</li>
-	<li>Prof. <a href="www.physics.miami.edu/~nepomechie/">R. Nepomechie</a><br/>(U. of Miami)</li>
+	<li>Prof. <a href="http://www.physics.miami.edu/~nepomechie/">R. Nepomechie</a><br/>(U. of Miami)</li>
 	<li>Prof. <a href="https://staff.fnwi.uva.nl/c.j.m.schoutens/">C.J.M. Schoutens</a><br/>(U. van Amsterdam)</li>
       </ul>
     </div>
diff --git a/submissions/templates/submissions/submit_manuscript.html b/submissions/templates/submissions/submit_manuscript.html
index 496984c93..56b40a08b 100644
--- a/submissions/templates/submissions/submit_manuscript.html
+++ b/submissions/templates/submissions/submit_manuscript.html
@@ -4,6 +4,7 @@
 
 {% block bodysup %}
 
+
 <section>
   <div class="flex-greybox">
     <h1>Submit a manuscript to SciPost</h1>
@@ -39,7 +40,7 @@
   <h3 style="color: red;">Error: {{ errormessage }}</h3>
   {% endif %}
   
-  <form action="{% url 'submissions:submit_manuscript' %}" method="post">
+  <form id="full_submission_form" action="{% url 'submissions:submit_manuscript' %}" method="post">
     {% csrf_token %}
     <table>
       <ul>
diff --git a/submissions/utils.py b/submissions/utils.py
index 12e14a62b..6dbd711c8 100644
--- a/submissions/utils.py
+++ b/submissions/utils.py
@@ -114,21 +114,32 @@ class SubmissionUtils(object):
 
     @classmethod
     def send_refereeing_invitation_email(cls):
-        """ Requires loading 'invitation' attribute. """
+        """ 
+        This method is called by send_refereeing_invitation in submissions/views.
+        It is used when the referee is already a registered contributor.
+        If a referee is not yet registered, the method recruit_referee is used 
+        instead, which calls the send_registration_email method in scipost/utils.
+        Requires loading 'invitation' attribute. 
+        """
         email_text = ('Dear ' + title_dict[cls.invitation.referee.title] + ' ' +
                       cls.invitation.referee.user.last_name +
                       ', \n\nWe have received a Submission to SciPost '
-                      'which, in view of your expertise, we would like to invite you to referee:\n\n' +
-                      cls.invitation.submission.title + ' by ' + cls.invitation.submission.author_list +
-                      ' (see https://scipost.org/submission/' + str(cls.invitation.submission.id) + ').'
+                      'which, in view of your expertise and on behalf of the Editor-in-charge '
+                      + title_dict[cls.invitation.submission.editor_in_charge.title] + ' ' 
+                      + cls.invitation.submission.editor_in_charge.user.last_name
+                      + ', we would like to invite you to referee:\n\n'
+                      + cls.invitation.submission.title + ' by ' + cls.invitation.submission.author_list
+                      + ' (see https://scipost.org/submission/' + str(cls.invitation.submission.id) + ').'
                       '\n\nPlease visit https://scipost.org/submissions/accept_or_decline_ref_invitations '
                       '(login required) as soon as possible (ideally within the next 2 days) '
                       'in order to accept or decline this invitation.'
-                      '\n\nIf you accept, your report can be submitted by simply clicking on the "Contribute a Report" link at '
-                      'https://scipost.org/submission/' + str(cls.invitation.submission.id) + ' before the reporting deadline '
-                      '(currently set at ' + datetime.datetime.strftime(cls.invitation.submission.reporting_deadline, "%Y-%m-%d") +
-                      '; your report will be automatically recognized as an invited report). You might want to '
-                      'make sure you are familiar with our refereeing code of conduct '
+                      '\n\nIf you accept, your report can be submitted by simply '
+                      'clicking on the "Contribute a Report" link at '
+                      'https://scipost.org/submission/' + str(cls.invitation.submission.id) 
+                      + ' before the reporting deadline (currently set at ' 
+                      + datetime.datetime.strftime(cls.invitation.submission.reporting_deadline, "%Y-%m-%d") +
+                      '; your report will be automatically recognized as an invited report). '
+                      'You might want to make sure you are familiar with our refereeing code of conduct '
                       'https://scipost.org/journals/journals_terms_and_conditions and with the '
                       'refereeing procedure https://scipost.org/submissions/sub_and_ref_procedure.' 
                       '\n\nWe would be extremely grateful for your contribution, '
@@ -150,27 +161,32 @@ class SubmissionUtils(object):
         It is called from the ref_invitation_reminder method in submissions/views.py.
         """
         email_text = ('Dear ' + title_dict[cls.invitation.title] + ' ' + cls.invitation.last_name + ',\n\n' 
-                      'On behalf of the Editor-in-charge ' +
-                      title_dict[cls.invitation.submission.editor_in_charge.title] + ' ' +
-                      cls.invitation.submission.editor_in_charge.user.last_name +
-                      ', we would like to cordially remind you of our recent request to referee\n\n' +
-                      cls.invitation.submission.title + ' by ' + cls.invitation.submission.author_list + '.')
+                      'On behalf of the Editor-in-charge '
+                      + title_dict[cls.invitation.submission.editor_in_charge.title] + ' '
+                      + cls.invitation.submission.editor_in_charge.user.last_name
+                      + ', we would like to cordially remind you of our recent request to referee\n\n'
+                      + cls.invitation.submission.title + ' by ' 
+                      + cls.invitation.submission.author_list + '.')
         if cls.invitation.referee is None:
-            email_text += ('\n\nWe would also like to renew our invitation to become a Contributor on SciPost ' +
-                           '(our records show that you are not yet registered); ' +
-                           'your partially pre-filled registration form is still available at\n\n' +
-                           'https://scipost.org/invitation/' + cls.invitation.invitation_key + '\n\n' +
+            email_text += ('\n\nWe would also like to renew '
+                           'our invitation to become a Contributor on SciPost '
+                           '(our records show that you are not yet registered); '
+                           'your partially pre-filled registration form is still available at\n\n'
+                           'https://scipost.org/invitation/' + cls.invitation.invitation_key + '\n\n'
                            'after which your registration will be activated, giving you full access to '
                            'the portal\'s facilities (in particular allowing you to provide referee reports).')
         if cls.invitation.accepted is None:
-            email_text += ('\n\nPlease visit https://scipost.org/submissions/accept_or_decline_ref_invitations '
+            email_text += ('\n\nPlease visit '
+                           'https://scipost.org/submissions/accept_or_decline_ref_invitations '
                            '(login required) as soon as possible (ideally within the next 2 days) '
                            'in order to accept or decline this invitation.')
-        email_text += ('\n\nYour report can be submitted by simply clicking on the "Contribute a Report" link at '
-                       'https://scipost.org/submission/' + str(cls.invitation.submission.id) + ' before the reporting deadline '
-                       '(currently set at ' + datetime.datetime.strftime(cls.invitation.submission.reporting_deadline, "%Y-%m-%d") +
-                       '; your report will be automatically recognized as an invited report). You might want to '
-                       'make sure you are familiar with our refereeing code of conduct '
+        email_text += ('\n\nYour report can be submitted by simply clicking on '
+                       'the "Contribute a Report" link at '
+                       'https://scipost.org/submission/' + str(cls.invitation.submission.id) 
+                       + ' before the reporting deadline (currently set at ' 
+                       + datetime.datetime.strftime(cls.invitation.submission.reporting_deadline, "%Y-%m-%d")
+                       + '; your report will be automatically recognized as an invited report). '
+                       'You might want to make sure you are familiar with our refereeing code of conduct '
                        'https://scipost.org/journals/journals_terms_and_conditions and with the '
                        'refereeing procedure https://scipost.org/submissions/sub_and_ref_procedure.')
         email_text += ('\n\nWe very much hope we can count on your expertise,'
@@ -196,13 +212,16 @@ class SubmissionUtils(object):
             email_text += 'accepted '
             email_subject = 'SciPost: referee accepts to review'
         elif cls.invitation.accepted == False:
-            email_text += 'declined (due to reason: ' + assignment_refusal_reasons_dict[cls.invitation.refusal_reason] + ') '
-        email_text += ('to referee Submission\n\n' +
-                       cls.invitation.submission.title + ' by ' + cls.invitation.submission.author_list + '.')
+            email_text += ('declined (due to reason: ' 
+                           + assignment_refusal_reasons_dict[cls.invitation.refusal_reason] + ') ')
+        email_text += ('to referee Submission\n\n'
+                       + cls.invitation.submission.title + ' by ' 
+                       + cls.invitation.submission.author_list + '.')
         if cls.invitation.accepted == False:
-            email_text += ('\n\nPlease invite another referee from the Submission\'s editorial page at '
-                           'https://scipost.org/submissions/editorial_page/' + str(cls.invitation.submission.id) + '.')
-        email_text += ('\n\nMany thanks for your collaboration,' +
+            email_text += ('\n\nPlease invite another referee from the Submission\'s editorial page '
+                           'at https://scipost.org/submissions/editorial_page/' 
+                           + str(cls.invitation.submission.id) + '.')
+        email_text += ('\n\nMany thanks for your collaboration,'
                        '\n\nThe SciPost Team.')
         
         emailmessage = EmailMessage(
@@ -217,12 +236,13 @@ class SubmissionUtils(object):
     @classmethod
     def email_EIC_report_delivered(cls):
         """ Requires loading 'report' attribute. """
-        email_text = ('Dear ' + title_dict[cls.report.submission.editor_in_charge.title] + ' ' +
-                      cls.report.submission.editor_in_charge.user.last_name + ','
-                      '\n\nReferee ' + title_dict[cls.report.author.title] + ' ' +
-                      cls.report.author.user.last_name +
-                      ' has delivered a Report for Submission\n\n' +
-                       cls.report.submission.title + ' by ' + cls.report.submission.author_list + '.'
+        email_text = ('Dear ' + title_dict[cls.report.submission.editor_in_charge.title] + ' '
+                      + cls.report.submission.editor_in_charge.user.last_name + ','
+                      '\n\nReferee ' + title_dict[cls.report.author.title] + ' '
+                      + cls.report.author.user.last_name +
+                      ' has delivered a Report for Submission\n\n'
+                      + cls.report.submission.title + ' by ' 
+                      + cls.report.submission.author_list + '.'
                       '\n\nPlease vet this Report via your personal page at '
                       'https://scipost.org/personal_page/ under the Editorial Actions tab.')
         email_text += ('\n\nMany thanks for your collaboration,' +
diff --git a/submissions/views.py b/submissions/views.py
index 8d736492d..ac3b80db8 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -492,7 +492,8 @@ def select_referee(request, submission_id):
 @permission_required_or_403('can_take_editorial_actions', (Submission, 'id', 'submission_id'))
 def recruit_referee(request, submission_id):
     """
-    If the Editor-in-charge does not find the desired referee among Contributors,
+    If the Editor-in-charge does not find the desired referee among Contributors
+    (otherwise, the method send_refereeing_invitation below is used instead),
     he/she can invite somebody by providing name + contact details.
     This function emails a registration invitation to this person.
     The pending refereeing invitation is then recognized upon registration,
-- 
GitLab