diff --git a/physionet-django/notification/templates/notification/email/notify_submitting_author.html b/physionet-django/notification/templates/notification/email/notify_submitting_author.html
new file mode 100644
index 0000000000..25af6d4a77
--- /dev/null
+++ b/physionet-django/notification/templates/notification/email/notify_submitting_author.html
@@ -0,0 +1,11 @@
+{% load i18n %}{% autoescape off %}{% filter wordwrap:70 %}
+Dear {{ name }},
+
+You have been made submitting author of the project entitled "{{ project.title }}" on {{ SITE_NAME }}.
+
+You can view and edit the project on your project homepage: {{ url_prefix }}{% url "project_home" %}.
+
+{{ signature }}
+
+{{ footer }}
+{% endfilter %}{% endautoescape %}
diff --git a/physionet-django/notification/utility.py b/physionet-django/notification/utility.py
index ceb641237b..83697e2603 100644
--- a/physionet-django/notification/utility.py
+++ b/physionet-django/notification/utility.py
@@ -1039,3 +1039,22 @@ def notify_primary_email(associated_email):
}
body = loader.render_to_string('user/email/notify_primary_email.html', context)
send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [associated_email.email], fail_silently=False)
+
+
+def notify_submitting_author(request, project):
+ """
+ Notify a user that they have been made submitting author for a project.
+ """
+ author = project.authors.get(is_submitting=True)
+ subject = f"{settings.SITE_NAME}: You are now a submitting author"
+ context = {
+ 'name': author.get_full_name(),
+ 'project': project,
+ 'url_prefix': get_url_prefix(request),
+ 'SITE_NAME': settings.SITE_NAME,
+ 'signature': settings.EMAIL_SIGNATURE,
+ 'footer': email_footer()
+ }
+ body = loader.render_to_string('notification/email/notify_submitting_author.html', context)
+ # Not resend the email if there was an integrity error
+ send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [author.user.email], fail_silently=False)
diff --git a/physionet-django/project/forms.py b/physionet-django/project/forms.py
index 7ee1985572..22ee0839a1 100644
--- a/physionet-django/project/forms.py
+++ b/physionet-django/project/forms.py
@@ -73,6 +73,31 @@ def update_corresponder(self):
new_c.save()
+class TransferAuthorForm(forms.Form):
+ """
+ Transfer submitting author.
+ """
+ transfer_author = forms.ModelChoiceField(queryset=None, required=True,
+ widget=forms.Select(attrs={'onchange': 'set_transfer_author()',
+ 'id': 'transfer_author_id'}),
+ empty_label="Select an author")
+
+ def __init__(self, project, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.project = project
+ # Exclude the current submitting author from the queryset
+ authors = project.authors.exclude(is_submitting=True).order_by('display_order')
+ self.fields['transfer_author'].queryset = authors
+
+ def transfer(self):
+ new_author = self.cleaned_data['transfer_author']
+
+ # Assign the new submitting author
+ self.project.authors.update(is_submitting=False)
+ new_author.is_submitting = True
+ new_author.save()
+
+
class ActiveProjectFilesForm(forms.Form):
"""
Inherited form for manipulating project files/directories. Upload
diff --git a/physionet-django/project/static/project/js/transfer-author.js b/physionet-django/project/static/project/js/transfer-author.js
new file mode 100644
index 0000000000..5f72c8df18
--- /dev/null
+++ b/physionet-django/project/static/project/js/transfer-author.js
@@ -0,0 +1,22 @@
+$(document).ready(function() {
+ // Function to update the displayed author name when a new author is selected
+ function set_transfer_author() {
+ var selectedAuthorName = $("#transfer_author_id option:selected").text();
+ $('#project_author').text(selectedAuthorName);
+ }
+
+ // Attach the change event to the author select dropdown to update the name on change
+ $("#transfer_author_id").change(set_transfer_author);
+
+ // Prevent the default form submission and show the confirmation modal
+ $('#authorTransferForm').on('submit', function(e) {
+ e.preventDefault();
+ $('#transfer_author_modal').modal('show');
+ });
+
+ // When the confirmation button is clicked, submit the form
+ $('#confirmAuthorTransfer').on('click', function() {
+ $('#authorTransferForm').off('submit').submit();
+ });
+});
+
diff --git a/physionet-django/project/templates/project/project_authors.html b/physionet-django/project/templates/project/project_authors.html
index 08f368ba47..60ebdf8a80 100644
--- a/physionet-django/project/templates/project/project_authors.html
+++ b/physionet-django/project/templates/project/project_authors.html
@@ -170,6 +170,46 @@
Your Affiliations
+
+
+{# Transfer project to a new submitting author #}
+{% if is_submitting %}
+
Submitting Author
+
Only the submitting author of a project is able to edit content.
+ You may transfer the role of submitting author to a co-author.
+ Choose one of the co-authors below to make them the submitting author for this project.
+ Transferring authorship will remove your ability to edit content!
+
+
+
+{% endif %}
+
+
+
+
+
+
+
Transfer Authorship
+
+
+
+
Please confirm that you would like to assign '' as the new submitting author.