'Crossref Plugin', 'description' => 'Registration agency plugin for Crossref', 'type' => 'object', 'required' => ['depositorName', 'depositorEmail'], 'properties' => (object) [ 'depositorName' => (object) [ 'type' => 'string', 'validation' => ['required', 'max:60'], ], 'depositorEmail' => (object) [ 'type' => 'string', 'validation' => ['required', 'email', 'max:90'], ], 'username' => (object) [ 'type' => 'string', 'validation' => ['nullable', 'max:120'], ], 'password' => (object) [ 'type' => 'string', 'validation' => ['nullable', 'max:50'], ], 'testMode' => (object) [ 'type' => 'boolean', ] ], ]; } /** @inheritDoc */ public function getFields(Context $context): array { return [ new FieldHTML('preamble', [ 'label' => __('plugins.importexport.crossref.settings'), 'description' => $this->_getPreambleText($context), ]), new FieldText('depositorName', [ 'label' => __('plugins.importexport.crossref.settings.form.depositorName'), 'description' => __('plugins.importexport.crossref.settings.form.depositorName.description'), 'isRequired' => true, 'value' => $this->agencyPlugin->getSetting($context->getId(), 'depositorName'), ]), new FieldText('depositorEmail', [ 'label' => __('plugins.importexport.crossref.settings.form.depositorEmail'), 'description' => __('plugins.importexport.crossref.settings.form.depositorEmail.description'), 'isRequired' => true, 'value' => $this->agencyPlugin->getSetting($context->getId(), 'depositorEmail'), ]), new FieldHTML('credentialsExplanation', [ 'description' => __('plugins.importexport.crossref.registrationIntro'), ]), new FieldText('username', [ 'label' => __('plugins.importexport.crossref.settings.form.username'), 'description' => __('plugins.importexport.crossref.settings.form.username.description'), 'value' => $this->agencyPlugin->getSetting($context->getId(), 'username'), 'inputType' => 'text', ]), new FieldText('password', [ 'label' => __('plugins.importexport.common.settings.form.password'), 'description' => __('plugins.importexport.common.settings.form.password.description'), 'value' => $this->agencyPlugin->getSetting($context->getId(), 'password'), 'inputType' => 'password', ]), new FieldOptions('testMode', [ 'label' => __('plugins.importexport.common.settings.form.testMode.label'), 'options' => [ ['value' => true, 'label' => __('plugins.importexport.crossref.settings.form.testMode.description')] ], 'value' => (bool) $this->agencyPlugin->getSetting($context->getId(), 'testMode'), ]) ]; } protected function _getPreambleText(Context $context): string { $text = ''; $journalSettingsUrl = Application::get()->getDispatcher()->url( Application::get()->getRequest(), PKPApplication::ROUTE_PAGE, $context->getPath(), 'management', 'settings', 'context' ); $notices = []; if (!$context->getData('publisherInstitution')) { $notices[] = __('plugins.importexport.crossref.error.publisherNotConfigured', ['journalSettingsUrl' => $journalSettingsUrl]); } if (!$context->getData('onlineIssn') && !$context->getData('printIssn')) { $notices[] = __('plugins.importexport.crossref.error.issnNotConfigured', ['journalSettingsUrl' => $journalSettingsUrl]); } if (!empty($notices)) { $text .= '
' . __('plugins.importexport.common.missingRequirements') . '
' . __('plugins.importexport.crossref.settings.depositorIntro') . '
'; return $text; } }