Skip to content

Commit

Permalink
pkp#229 OrcidProfilePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed Feb 12, 2023
1 parent e6fe39b commit f3042a8
Showing 1 changed file with 32 additions and 34 deletions.
66 changes: 32 additions & 34 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,25 @@ public function register($category, $path, $mainContextId = null)
// Send emails to authors without ORCID id upon submission
Hook::add('submissionsubmitstep3form::execute', [$this, 'handleSubmissionSubmitStep3FormExecute']);

// Add more ORCiD fields to user Schema
Hook::add('Schema::get::user', function ($hookName, $args) {

// Send emails to authors without authorised ORCID access on promoting a submission to copy editing. Not included in OPS.
if ($this->getSetting($contextId, 'sendMailToAuthorsOnPublication')) {
Hook::add('EditorAction::recordDecision', [$this, 'handleEditorAction']);
}

Hook::add('Publication::publish', [$this, 'handlePublicationStatusChange']);

Hook::add('ThankReviewerForm::thankReviewer', [$this, 'handleThankReviewer']);

// Add more ORCiD fields to author Schema
Hook::add('Schema::get::author', function ($hookName, $args) {
$schema = &$args[0];

$schema->properties->orcidSandbox = (object)[
'type' => 'string',
'apiSummary' => true,
'validation' => ['nullable']
];
$schema->properties->orcidAccessToken = (object)[
'type' => 'string',
'apiSummary' => true,
Expand All @@ -139,26 +154,22 @@ public function register($category, $path, $mainContextId = null)
'apiSummary' => true,
'validation' => ['nullable']
];
});

// Send emails to authors without authorised ORCID access on promoting a submission to copy editing. Not included in OPS.
if ($this->getSetting($contextId, 'sendMailToAuthorsOnPublication')) {
Hook::add('EditorAction::recordDecision', [$this, 'handleEditorAction']);
}

Hook::add('Publication::publish', [$this, 'handlePublicationStatusChange']);

Hook::add('ThankReviewerForm::thankReviewer', [$this, 'handleThankReviewer']);

// Add more ORCiD fields to author Schema
Hook::add('Schema::get::author', function ($hookName, $args) {
$schema = &$args[0];

$schema->properties->orcidSandbox = (object)[
$schema->properties->orcidEmailToken = (object)[
'type' => 'string',
'apiSummary' => true,
'validation' => ['nullable']
];
$schema->properties->orcidWorkPutCode = (object)[
'type' => 'string',
'apiSummary' => true,
'validation' => ['nullable']
];
});

// Add more ORCiD fields to user Schema
Hook::add('Schema::get::user', function ($hookName, $args) {
$schema = &$args[0];

$schema->properties->orcidAccessToken = (object)[
'type' => 'string',
'apiSummary' => true,
Expand All @@ -184,16 +195,6 @@ public function register($category, $path, $mainContextId = null)
'apiSummary' => true,
'validation' => ['nullable']
];
$schema->properties->orcidEmailToken = (object)[
'type' => 'string',
'apiSummary' => true,
'validation' => ['nullable']
];
$schema->properties->orcidWorkPutCode = (object)[
'type' => 'string',
'apiSummary' => true,
'validation' => ['nullable']
];
});

Hook::add('Mailer::Mailables', [$this, 'addMailable']);
Expand Down Expand Up @@ -225,8 +226,7 @@ function addOrcidFormFields($hookName, $form): bool
'label' => __('user.orcid'),
'optIntoEdit' => true,
'optIntoEditLabel' => __('common.override'),
'isLabelInline' => true,
'size' => 'normal',
'tooltip' => __('plugins.generic.orcidProfile.about.orcidExplanation'),

]), [FIELD_POSITION_AFTER, 'url']);

Expand All @@ -235,7 +235,6 @@ function addOrcidFormFields($hookName, $form): bool
'label' => __('plugins.generic.orcidProfile.verify.title'),
'options' => [
[
'value' => true,
'label' => __('plugins.generic.orcidProfile.author.requestAuthorization'),

]
Expand All @@ -246,9 +245,8 @@ function addOrcidFormFields($hookName, $form): bool
'label' => __('plugins.generic.orcidProfile.displayName'),
'options' => [
[
'value' => true,
'label' => __('plugins.generic.orcidProfile.author.deleteORCID'),
'showWhen' => 'orcid'
'showWhen' => 'orcid'
]
]
]));
Expand Down Expand Up @@ -350,7 +348,7 @@ function isGloballyConfigured()
*/
public function handleFormDisplay($hookName, $args)
{
//TODO orcid
//TODO
$request = Application::get()->getRequest();
$templateMgr = TemplateManager::getManager($request);
switch ($hookName) {
Expand Down

0 comments on commit f3042a8

Please sign in to comment.