From f3042a874d1b8440212641aeb9a0457711345e26 Mon Sep 17 00:00:00 2001 From: withanage Date: Sun, 12 Feb 2023 21:18:24 +0100 Subject: [PATCH] https://github.com/pkp/orcidProfile/issues/229 OrcidProfilePlugin --- OrcidProfilePlugin.php | 66 ++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/OrcidProfilePlugin.php b/OrcidProfilePlugin.php index 9c11da7a..797131df 100755 --- a/OrcidProfilePlugin.php +++ b/OrcidProfilePlugin.php @@ -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, @@ -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, @@ -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']); @@ -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']); @@ -235,7 +235,6 @@ function addOrcidFormFields($hookName, $form): bool 'label' => __('plugins.generic.orcidProfile.verify.title'), 'options' => [ [ - 'value' => true, 'label' => __('plugins.generic.orcidProfile.author.requestAuthorization'), ] @@ -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' ] ] ])); @@ -350,7 +348,7 @@ function isGloballyConfigured() */ public function handleFormDisplay($hookName, $args) { - //TODO orcid + //TODO $request = Application::get()->getRequest(); $templateMgr = TemplateManager::getManager($request); switch ($hookName) {