Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions core/components/com_publications/admin/controllers/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,21 @@ public function editauthorTask()
if (!empty($this->view->author->user_id))
{
$user = \Components\Members\Models\Member::oneOrNew($this->view->author->user_id);
$this->view->author->orcid = $user->get('orcid');
$this->view->author->organization = $user->get('organization');

if (empty($this->view->author->organization) && !empty($user->get('organization')))
{
$this->view->author->organization = $user->get('organization');
}

if (empty($this->view->author->orgid) && !empty($user->get('orgid')))
{
$this->view->author->orgid = $user->get('orgid');
}

if (empty($this->view->author->orcid) && !empty($user->get('orcid')))
{
$this->view->author->orcid = $user->get('orcid');
}
}

// Version ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ COM_PUBLICATIONS_EDIT_AUTHOR_INFO="Edit Author Info"
COM_PUBLICATIONS_FIELD_AUTHOR_NAME="Author Name"
COM_PUBLICATIONS_FIELD_AUTHOR_NAME_FIRST_AND_MIDDLE="First Name (and Middle Initial)"
COM_PUBLICATIONS_FIELD_AUTHOR_NAME_LAST="Last Name"
COM_PUBLICATIONS_FIELD_AUTHOR_DEPARTMENT="School or department"
COM_PUBLICATIONS_FIELD_AUTHOR_ORGANIZATION="Organization"
COM_PUBLICATIONS_FIELD_AUTHOR_ORCID="ORCID"
COM_PUBLICATIONS_FIELD_AUTHOR_ORCID_ID_DESC="*ORCID ID is 16-digit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
<input type="text" name="lastName" value="<?php echo $lastname; ?>" size="25" />
</td>
</tr>
<tr>
<td class="key"><label><?php echo Lang::txt('COM_PUBLICATIONS_FIELD_AUTHOR_DEPARTMENT'); ?>:</label></td>
<td>
<input type="text" name="department" value="<?php echo $this->escape($this->author->department); ?>" size="25" />
</td>
</tr>
<tr>
<td class="key"><label><?php echo Lang::txt('COM_PUBLICATIONS_FIELD_AUTHOR_ORGANIZATION'); ?>:</label></td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ public function addItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0)
$config = Component::params('com_publications');

$emailConfig = $config->get('email');
$email = Request::getString('email', '', 'post');
$email = trim(Request::getString('email', '', 'post'));
$firstName = trim(Request::getString('firstName', '', 'post'));
$lastName = trim(Request::getString('lastName', '', 'post'));
$dept = trim(Request::getString('department', '', 'post'));
$org = trim(Request::getString('organization', '', 'post'));
$orcid = trim(Request::getString('orcid', '', 'post'));
$credit = trim(Request::getString('credit', '', 'post'));
Expand Down Expand Up @@ -465,6 +466,7 @@ public function addItem($manifest, $blockId, $pub, $actor = 0, $elementId = 0)
$pAuthor->name = $name;
$pAuthor->firstName = $firstName;
$pAuthor->lastName = $lastName;
$pAuthor->department = $dept;
$pAuthor->organization = $org;
$pAuthor->orcid = $orcid;

Expand Down
26 changes: 19 additions & 7 deletions core/components/com_publications/tables/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function getAuthors($vid = null, $get_uids = 0, $active = 1, $return_uid_
$res->surname = $user->get('surname');
$res->p_email = $user->get('email');

if (!empty($user->get('orcid')))
if (empty($res->orcid) && !empty($user->get('orcid')))
{
$res->orcid = $user->get('orcid');
}
Expand Down Expand Up @@ -688,16 +688,28 @@ public function getAuthorByOwnerId($vid = null, $owner_id = 0)
if (!empty($result->user_id))
{
$user = \Components\Members\Models\Member::oneOrNew($result->user_id);
$result->p_name = $user->get('name');
$result->username = $user->get('username');
$result->p_organization = $user->get('organization');
$result->picture = $user->picture(0, false);
$result->p_name = $user->get('name');
$result->givenName = $user->get('givenName');
$result->surname = $user->get('surname');
$result->orcid = $user->get('orcid');
$result->p_email = $user->get('email');
$result->organization = $user->get('organization');
$result->orgid = $user->get('orgid');
$result->p_organization = $user->get('organization');
$result->picture = $user->picture(0, false);

if (empty($result->orcid) && !empty($user->get('orcid')))
{
$result->orcid = $user->get('orcid');
}

if (empty($result->organization) && !empty($user->get('organization')))
{
$result->organization = $user->get('organization');
}

if (empty($result->orgid) && !empty($user->get('orgid')))
{
$result->orgid = $user->get('orgid');
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ PLG_PROJECTS_PUBLICATIONS_AUTHOR_REMOVED="Author has been removed."
PLG_PROJECTS_PUBLICATIONS_AUTHORS_SELECT_AUTHORS="Select authors from your project team:"
PLG_PROJECTS_PUBLICATIONS_AUTHORS_NONE_SELECTED="No authors selected. Click on names on the left to add."
PLG_PROJECTS_PUBLICATIONS_PUBLICATION_AUTHORS="Publication Authors"
PLG_PROJECTS_PUBLICATIONS_PUBLICATION_AUTHORS_AS_CONTACT="Edit the author to set the department, organization and email if the author is going to be selected as the contact in the review stage"
PLG_PROJECTS_PUBLICATIONS_AUTHORS_MISSING="member not active"
PLG_PROJECTS_PUBLICATIONS_PUB_INFO_AUTHORS_MISSING="One or several listed authors appear to have been removed from your project team. While it is OK to proceed with publication when its authors aren't your active team members, these authors will not be able to edit or may not have access to the publication."
PLG_PROJECTS_PUBLICATIONS_AUTHORS_EDIT="Edit"
Expand Down
4 changes: 2 additions & 2 deletions core/plugins/projects/publications/publications.php
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@ public function publishDraft()
continue;
}

// Prompt error message if an invited author is chosen as contact but the email address is empty
// Prompt error message if an invited author is chosen as contact but the department, organization, or email address is empty
$owner = $author->getAuthorByOwnerId($pub->version->id, $author->project_owner_id);

if ((empty($owner->user_id) && empty($owner->invited_email)) || empty($owner->department) || empty($owner->organization))
Expand Down Expand Up @@ -2122,7 +2122,7 @@ public function publishDraft()
}
elseif (!(empty($owner->user_id) && empty($owner->invited_email)) && !empty($owner->department) && empty($owner->organization))
{
Notify::error(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_ERROR_CONTACT_ORGANIZATION_MISSING'), 'projects');
Notify::error(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_ERROR_CONTACT_INSTITUTION_MISSING'), 'projects');
}

App::redirect(Route::url($pub->link('editversion') . '&action=' . $this->_task));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
<span><a href="<?php echo $selectUrl; ?>" class="item-add showinbox"><?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_CHOOSE_AUTHORS'); ?></a></span>
</div>
</div>

<?php if (count($this->pub->authors()) > 0) { ?>
<p class="hint">*<?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_AUTHORS_AS_CONTACT'); ?></p>
<?php } ?>

<?php if (count($this->pub->authors()) > 1) { ?>
<p class="hint">*<?php echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_AUTHORS_HINT_DRAG'); ?></p>
Expand Down
58 changes: 41 additions & 17 deletions core/plugins/projects/team/assets/js/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,22 +335,46 @@ $(function(){
appendTo: '#autocomplete-organization',
});
}
});

$('[name = "orcid"]').on('input', function(){
var regex = /^[0-9]{4}-([0-9]{4}-){2}[0-9X]{4}/;
var orcidInput = $('[name = "orcid"]').val();

if (!regex.test(orcidInput))
{
$('#orcid-message').addClass("prompt");
$('#orcid-message').text('*Invalid ORCID ID. Please enter the 16-digit ORCID ID');
$('#orcid-message').show();
}
else
{
$('#orcid-message').removeClass("prompt");
$('#orcid-message').text('*You have successfully entered a valid 16-digit ORCID ID');
$('#orcid-message').show();
$('[name = "orcid"]').on('input', function(){
var regex = /^[0-9]{4}-([0-9]{4}-){2}[0-9X]{4}/;
var orcidInput = $('[name = "orcid"]').val();

if (!regex.test(orcidInput))
{
$('#orcid-message').addClass("prompt");
$('#orcid-message').text('*Invalid ORCID ID. Please enter the 16-digit ORCID ID');
$('#orcid-message').show();
}
else
{
$('#orcid-message').removeClass("prompt");
$('#orcid-message').text('*You have successfully entered a valid 16-digit ORCID ID');
$('#orcid-message').show();
}
})

if ($(".departmentAvailable")[0]){
$('[name="department"]').autocomplete({
source: function(req, resp){
var deptURL = "index.php?option=com_publications&controller=curation&task=getDepartment&term=" + $('[name="department"]').val();

$.ajax({
url:deptURL,
data: null,
dataType: "json",
success:function(result){
resp(result);
},
error:function(jqXHR, textStatus, errorThrown){
console.log(textStatus);
console.log(errorThrown);
console.log(jqXHR.responseText);
}
});
},

appendTo: '#autocomplete-department'
});
}
})
});
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ PLG_PROJECTS_TEAM_OR="OR"
PLG_PROJECTS_TEAM_SELECTOR_FIRST_NAME="First name"
PLG_PROJECTS_TEAM_SELECTOR_LAST_NAME="Last name"
PLG_PROJECTS_TEAM_SELECTOR_EMAIL="Email"
PLG_PROJECTS_TEAM_SELECTOR_DEPARTMENT="School or Department"
PLG_PROJECTS_TEAM_SELECTOR_ORGANIZATION="Institution"
PLG_PROJECTS_TEAM_SELECTOR_ORCID="ORCID"
PLG_PROJECTS_TEAM_SELECTOR_ORCID_DESC="*Please enter the 16-digit ORCID ID"
PLG_PROJECTS_TEAM_SELECTOR_ORCID_DESC="*Please enter the 16-digit ORCID ID only"
PLG_PROJECTS_TEAM_SELECTOR_SAVE_NEW="add author"
PLG_PROJECTS_TEAM_AUTHORS_EDIT_UNCONFIRMED_TIPS="Name and institution fields are required. You may also provide an email address for the person to send out an invitation to join the publication team."
PLG_PROJECTS_TEAM_SELECTOR_AUTHOR_UNCONFIRMED="unconfirmed"
PLG_PROJECTS_TEAM_SELECTOR_LOOK_UP_BY_ID="Look up author by name (optional)"
PLG_PROJECTS_TEAM_SELECTOR_HINT="*Name and organization fields are required"
PLG_PROJECTS_TEAM_SELECTOR_FIRST_NAME_REQUIRED="*First name is required"
PLG_PROJECTS_TEAM_SELECTOR_LAST_NAME_REQUIRED="*Last name is required"

PLG_PROJECTS_TEAM_SELECTOR_USERID="User ID"
PLG_PROJECTS_TEAM_SELECTOR_AUTHOR_NOT_PART_OF_TEAM="Author not part of project team yet?"
Expand Down
18 changes: 16 additions & 2 deletions core/plugins/projects/team/views/selector/tmpl/newauthor.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,41 @@
<label for="firstName">
<span class="formlabel"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_FIRST_NAME')); ?>*:</span>
<input type="text" name="firstName" id="firstName" class="long" value="" maxlength="255" />
<p class="hint"><?php echo Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_FIRST_NAME_REQUIRED'); ?></p>
</label>
</div>
<div class="block-liner">
<label for="lastName">
<span class="formlabel"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_LAST_NAME')); ?>*:</span>
<input type="text" name="lastName" id="lastName" class="long" value="" maxlength="255" />
<p class="hint"><?php echo Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_LAST_NAME_REQUIRED'); ?></p>
</label>
</div>
</div>
<div class="block">
<div class="block-liner">
<label for="department">
<span class="formlabel"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_DEPARTMENT')); ?>:</span>
<input type="text" class="long" name="department" id="department" value="" maxlength="255" />
<?php
if (\Component::params('com_publications')->get('department')) {
echo "<div id='autocomplete-department' class='departmentAvailable'></div>";
}
?>
</label>
</div>
</div>
<div class="block">
<div class="block-liner">
<label for="organization">
<span class="formlabel"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_ORGANIZATION')); ?>*:</span>
<span class="formlabel"><?php echo ucfirst(Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_ORGANIZATION')); ?>:</span>
<input type="text" class="long" name="organization" id="organization" value="" maxlength="255" />
<?php
// Add in class for JS selector to conditionally retrieve data from RoR Api
if (\Component::params('com_members')->get('rorApi')) {
echo "<div id='autocomplete-organization' class='rorApiAvailable'></div>";
}
?>
<p class="hint"><?php echo Lang::txt('PLG_PROJECTS_TEAM_SELECTOR_HINT'); ?></p>
</label>
</div>
</div>
Expand Down