Skip to content

Commit

Permalink
pkp/pkp-lib#9771 Move ORCID functionality into core application
Browse files Browse the repository at this point in the history
  • Loading branch information
ewhanson committed Jun 7, 2024
1 parent 33d8da1 commit be053c8
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 1 deletion.
20 changes: 20 additions & 0 deletions api/v1/orcid/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* @defgroup api_v1_orcid ORCID API requests
*/

/**
* @file api/v1/orcid/index.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1_orcid
*
* @brief Handle requests for ORCID API functions.
*
*/

return new \PKP\handler\APIHandler(new \PKP\API\v1\orcid\OrcidController());
57 changes: 57 additions & 0 deletions classes/orcid/OrcidWork.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/**
* @file classes/orcid/OrcidWork.php
*
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2000-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class OrcidWork
*
* @brief Builds ORCID work object for deposit
*/

namespace APP\orcid;

use APP\core\Application;
use APP\plugins\generic\citationStyleLanguage\CitationStyleLanguagePlugin;
use APP\submission\Submission;
use PKP\orcid\PKPOrcidWork;
use PKP\plugins\PluginRegistry;

class OrcidWork extends PKPOrcidWork
{
/**
* @inheritDoc
*/
protected function getOrcidPublicationType(): string
{
return 'preprint';
}

/**
* @inheritdoc
*/
protected function getBibtexCitation(Submission $submission): string
{
$request = Application::get()->getRequest();
try {
PluginRegistry::loadCategory('generic');
/** @var CitationStyleLanguagePlugin $citationPlugin */
$citationPlugin = PluginRegistry::getPlugin('generic', 'citationstylelanguageplugin');
return trim(
strip_tags(
$citationPlugin->getCitation(
$request,
$submission,
'bibtex',
publication: $this->publication
)
)
);
} catch (\Exception $exception) {
return '';
}
}
}
21 changes: 21 additions & 0 deletions classes/orcid/actions/SendReviewToOrcid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @file classes/orcid/actions/SendReviewToOrcid.php
*
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2000-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SendReviewToOrcid
*
* @brief Trigger review submission to ORCID if supported by the application (currently only OJS).
*/

namespace APP\orcid\actions;

use PKP\orcid\actions\PKPSendReviewToOrcid;

class SendReviewToOrcid extends PKPSendReviewToOrcid
{
}
38 changes: 38 additions & 0 deletions classes/orcid/actions/SendSubmissionToOrcid.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* @file classes/orcid/actions/SendSubmissionToOrcid.php
*
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2000-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SendSubmissionToOrcid
*
* @brief Compile and trigger deposits of submissions to ORCID.
*/

namespace APP\orcid\actions;

use APP\orcid\OrcidWork;
use PKP\orcid\actions\PKPSendSubmissionToOrcid;
use PKP\orcid\PKPOrcidWork;

class SendSubmissionToOrcid extends PKPSendSubmissionToOrcid
{
/**
* @inheritDoc
*/
protected function getOrcidWork(array $authors): ?PKPOrcidWork
{
return new OrcidWork($this->publication, $this->context, $authors);
}

/**
* @inheritDoc
*/
protected function canDepositSubmission(): bool
{
return true;
}
}
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<migration class="PKP\migration\upgrade\v3_5_0\I9809_ReviewCancelDate"/>
<migration class="PKP\migration\upgrade\v3_5_0\I9860_EditorialMastheadNavMenuItem"/>
<migration class="PKP\migration\upgrade\v3_5_0\I8826_AddMissingForeignKeys" />
<migration class="PKP\migration\upgrade\v3_5_0\I9771_OrcidMigration"/>
</upgrade>

<!-- update plugin configuration - should be done as the final upgrade task -->
Expand Down
2 changes: 2 additions & 0 deletions pages/preprint/PreprintHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use PKP\config\Config;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\orcid\OrcidManager;
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
use PKP\security\authorization\ContextRequiredPolicy;
Expand Down Expand Up @@ -194,6 +195,7 @@ public function view($args, $request)
'galley' => $this->galley,
'fileId' => $this->submissionFileId, // DEPRECATED in 3.4.0: https://github.com/pkp/pkp-lib/issues/6545
'submissionFileId' => $this->submissionFileId,
'orcidIcon' => OrcidManager::getIcon(),
]);
$this->setupTemplate($request);

Expand Down
2 changes: 2 additions & 0 deletions plugins/themes/default/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
@import "../../../../lib/pkp/styles/utils.less";
@import "../../../../lib/pkp/styles/helpers.less";
@import "../../../../lib/pkp/styles/controllers/extrasOnDemand.less";
// General ORCID styles
@import '../../../../lib/pkp/styles/orcid.less';

// Styles unique to this theme
@import "variables.less";
Expand Down
2 changes: 2 additions & 0 deletions registry/emailTemplates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@
<email key="SUBMISSION_SAVED_FOR_LATER" name="mailable.submissionSavedForLater.name" subject="emails.submissionSavedForLater.subject" body="emails.submissionSavedForLater.body"/>
<email key="SUBMISSION_NEEDS_EDITOR" name="mailable.submissionNeedsEditor.name" subject="emails.submissionNeedsEditor.subject" body="emails.submissionNeedsEditor.body"/>
<email key="CHANGE_EMAIL" name="mailable.changeProfileEmailInvitationNotify.name" subject="emails.changeProfileEmailInvitationNotify.subject" body="emails.changeProfileEmailInvitationNotify.body"/>
<email key="ORCID_COLLECT_AUTHOR_ID" name="orcidProfile.orcidCollectAuthorId.name" subject="emails.orcidCollectAuthorId.subject" body="emails.orcidCollectAuthorId.body"/>
<email key="ORCID_REQUEST_AUTHOR_AUTHORIZATION" name="orcidProfile.orcidRequestAuthorAuthorization.name" subject="emails.orcidRequestAuthorAuthorization.subject" body="emails.orcidRequestAuthorAuthorization.body"/>
</emails>
36 changes: 35 additions & 1 deletion registry/uiLocaleKeysBackend.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"manager.dois.registration.viewError",
"manager.dois.registration.viewError.title",
"manager.dois.registration.viewRecord",
"manager.dois.registration.viewRecord.title",
"manager.dois.status.error",
"manager.dois.status.error.description",
"manager.dois.status.error.filterTitle",
Expand All @@ -115,6 +116,13 @@
"manager.dois.update.partialFailure",
"manager.dois.update.success",
"navigation.backTo",
"orcid.field.authorEmailModal.message",
"orcid.field.authorEmailModal.title",
"orcid.field.deleteOrcidModal.message",
"orcid.field.deleteOrcidModal.title",
"orcid.field.unverified.shouldRequest",
"orcid.field.verification.request",
"orcid.field.verification.requested",
"publication.jats.autoCreatedMessage",
"publication.jats.confirmDeleteFileButton",
"publication.jats.confirmDeleteFileMessage",
Expand All @@ -123,6 +131,33 @@
"publication.status.published",
"publication.status.unpublished",
"publication.version",
"reviewer.article.recommendation",
"reviewer.submission.acceptedOn",
"reviewer.submission.responseDueDate",
"reviewer.submission.reviewDueDate",
"reviewer.submission.reviewRequestDate",
"reviewer.submission.reviewRound.attachments",
"reviewer.submission.reviewRound.attachments.description",
"reviewer.submission.reviewRound.comments",
"reviewer.submission.reviewRound.comments.authorAndEditor",
"reviewer.submission.reviewRound.comments.editorOnly",
"reviewer.submission.reviewRound.comments.prefix",
"reviewer.submission.reviewRound.emailLog",
"reviewer.submission.reviewRound.emailLog.defaultMessage",
"reviewer.submission.reviewRound.files",
"reviewer.submission.reviewRound.files.description",
"reviewer.submission.reviewRound.general",
"reviewer.submission.reviewRound.info",
"reviewer.submission.reviewRound.info.modal.title",
"reviewer.submission.reviewRound.info.read",
"reviewer.submission.reviewRound.info.submittedOn",
"reviewer.submission.reviewRound.metadata",
"reviewer.submission.reviewRound.metadata.abstract",
"reviewer.submission.reviewRound.metadata.keywords",
"reviewer.submission.reviewRound.metadata.type",
"reviewer.submission.reviewRound.reviewDeclineDate",
"reviewer.submission.reviewRound.reviewNotCompleted",
"reviewer.submission.submittedOn",
"stats.countWithYearlyAverage",
"stats.descriptionForStat",
"submission.list.assignEditor",
Expand All @@ -142,7 +177,6 @@
"submission.list.reviewsCompleted",
"submission.list.revisionsSubmitted",
"submission.publication",
"submission.round",
"submission.submit.newSubmissionSingle",
"submission.upload.percentComplete",
"submissions.incomplete",
Expand Down

0 comments on commit be053c8

Please sign in to comment.