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 May 22, 2024
1 parent 3af670c commit f769152
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 0 deletions.
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 '';
}
}
}
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 @@ -116,6 +116,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 @@ -31,4 +31,6 @@
<email key="VERSION_CREATED" name="mailable.versionCreated.name" subject="emails.versionCreated.subject" body="emails.versionCreated.body"/>
<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="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>

0 comments on commit f769152

Please sign in to comment.