first commit
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/AccessForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AccessForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for configuring the terms under which a journal will
|
||||
* allow access to its published content.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FieldSelect;
|
||||
use PKP\components\forms\FormComponent;
|
||||
|
||||
define('FORM_ACCESS', 'access');
|
||||
define('SUBSCRIPTION_OPEN_ACCESS_DELAY_MIN', '1');
|
||||
define('SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX', '60');
|
||||
|
||||
class AccessForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_ACCESS;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param array $locales Supported locales
|
||||
* @param Journal $context Journal to change settings for
|
||||
*/
|
||||
public function __construct($action, $locales, $context)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->locales = $locales;
|
||||
|
||||
$validDelayedOpenAccessDuration[] = ['value' => 0, 'label' => __('common.disabled')];
|
||||
for ($i = SUBSCRIPTION_OPEN_ACCESS_DELAY_MIN; $i <= SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX; $i++) {
|
||||
$validDelayedOpenAccessDuration[] = [
|
||||
'value' => $i,
|
||||
'label' => __('manager.subscriptionPolicies.xMonths', ['x' => $i]),
|
||||
];
|
||||
}
|
||||
|
||||
$this->addField(new FieldOptions('publishingMode', [
|
||||
'label' => __('manager.distribution.publishingMode'),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['value' => Journal::PUBLISHING_MODE_OPEN, 'label' => __('manager.distribution.publishingMode.openAccess')],
|
||||
['value' => Journal::PUBLISHING_MODE_SUBSCRIPTION, 'label' => __('manager.distribution.publishingMode.subscription')],
|
||||
['value' => Journal::PUBLISHING_MODE_NONE, 'label' => __('manager.distribution.publishingMode.none')],
|
||||
],
|
||||
'value' => $context->getData('publishingMode'),
|
||||
]))
|
||||
->addField(new FieldSelect('delayedOpenAccessDuration', [
|
||||
'label' => __('about.delayedOpenAccess'),
|
||||
'options' => $validDelayedOpenAccessDuration,
|
||||
'value' => $context->getData('delayedOpenAccessDuration'),
|
||||
'showWhen' => ['publishingMode', Journal::PUBLISHING_MODE_SUBSCRIPTION],
|
||||
]))
|
||||
->addField(new FieldOptions('enableOai', [
|
||||
'label' => __('manager.setup.enableOai'),
|
||||
'description' => __('manager.setup.enableOai.description'),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['value' => true, 'label' => __('common.enable')],
|
||||
['value' => false, 'label' => __('common.disable')],
|
||||
],
|
||||
'value' => $context->getData('enableOai'),
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/AppearanceAdvancedForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AppearanceAdvancedForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for general website appearance setup, such as uploading
|
||||
* a logo.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPAppearanceAdvancedForm;
|
||||
|
||||
class AppearanceAdvancedForm extends PKPAppearanceAdvancedForm
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/AppearanceSetupForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AppearanceSetupForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for general website appearance setup, such as uploading
|
||||
* a logo.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPAppearanceSetupForm;
|
||||
use PKP\components\forms\FieldUploadImage;
|
||||
|
||||
class AppearanceSetupForm extends PKPAppearanceSetupForm
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPAppearanceSetupForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $locales, $context, $baseUrl, $temporaryFileApiUrl, $uploadImageUrl)
|
||||
{
|
||||
parent::__construct($action, $locales, $context, $baseUrl, $temporaryFileApiUrl, $uploadImageUrl);
|
||||
|
||||
$this->addField(new FieldUploadImage('journalThumbnail', [
|
||||
'label' => __('manager.setup.journalThumbnail'),
|
||||
'tooltip' => __('manager.setup.journalThumbnail.description'),
|
||||
'isMultilingual' => true,
|
||||
'value' => $context->getData('journalThumbnail'),
|
||||
'baseUrl' => $baseUrl,
|
||||
'options' => [
|
||||
'url' => $temporaryFileApiUrl,
|
||||
],
|
||||
]), [FIELD_POSITION_AFTER, 'pageHeaderLogoImage']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/ArchivingLockssForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ArchivingLockssForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for configuring the LOCKSS and CLOCKSS settings.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use APP\journal\Journal;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FormComponent;
|
||||
|
||||
define('FORM_ARCHIVING_LOCKSS', 'archivingLockss');
|
||||
|
||||
class ArchivingLockssForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_ARCHIVING_LOCKSS;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param array $locales Supported locales
|
||||
* @param Journal $context Journal or Press to change settings for
|
||||
* @param string $lockssUrl URL to the publisher manifest page for LOCKSS
|
||||
* @param string $clockssUrl URL to the publisher manifest page for CLOCKSS
|
||||
*/
|
||||
public function __construct($action, $locales, $context, $lockssUrl, $clockssUrl)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->locales = $locales;
|
||||
|
||||
$this->addField(new FieldOptions('enableLockss', [
|
||||
'label' => __('manager.setup.lockssTitle'),
|
||||
'description' => __('manager.setup.lockssLicenseDescription'),
|
||||
'options' => [
|
||||
[
|
||||
'value' => true,
|
||||
'label' => __('manager.setup.lockssEnable', ['lockssUrl' => $lockssUrl]),
|
||||
],
|
||||
],
|
||||
'value' => (bool) $context->getData('enableLockss'),
|
||||
]))
|
||||
->addField(new FieldOptions('enableClockss', [
|
||||
'label' => __('manager.setup.clockssTitle'),
|
||||
'description' => __('manager.setup.clockssLicenseDescription'),
|
||||
'options' => [
|
||||
[
|
||||
'value' => true,
|
||||
'label' => __('manager.setup.clockssEnable', ['clockssUrl' => $clockssUrl]),
|
||||
],
|
||||
],
|
||||
'value' => (bool) $context->getData('enableClockss'),
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/ContextForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ContextForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief Add OJS-specific fields to the context add/edit form.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPContextForm;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FieldText;
|
||||
|
||||
class ContextForm extends PKPContextForm
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPContextForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $locales, $baseUrl, $context)
|
||||
{
|
||||
parent::__construct($action, $locales, $baseUrl, $context);
|
||||
|
||||
$this->addField(new FieldText('abbreviation', [
|
||||
'label' => __('manager.setup.journalAbbreviation'),
|
||||
'isMultilingual' => true,
|
||||
'value' => $context ? $context->getData('abbreviation') : null,
|
||||
]), [FIELD_POSITION_AFTER, 'acronym'])
|
||||
->addField(new FieldOptions('enabled', [
|
||||
'label' => __('common.enable'),
|
||||
'options' => [
|
||||
['value' => true, 'label' => __('admin.journals.enableJournalInstructions')],
|
||||
],
|
||||
'value' => $context ? (bool) $context->getData('enabled') : false,
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/DoiSetupSettingsForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DoiSetupSettingsForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for enabling and configuring DOI settings for a given context
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use APP\facades\Repo;
|
||||
use PKP\components\forms\context\PKPDoiSetupSettingsForm;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FieldText;
|
||||
use PKP\context\Context;
|
||||
use PKP\plugins\Hook;
|
||||
|
||||
class DoiSetupSettingsForm extends PKPDoiSetupSettingsForm
|
||||
{
|
||||
public function __construct(string $action, array $locales, Context $context)
|
||||
{
|
||||
parent::__construct($action, $locales, $context);
|
||||
|
||||
$this->objectTypeOptions = [
|
||||
[
|
||||
'value' => Repo::doi()::TYPE_PUBLICATION,
|
||||
'label' => __('article.articles'),
|
||||
'allowedBy' => [],
|
||||
],
|
||||
[
|
||||
'value' => Repo::doi()::TYPE_ISSUE,
|
||||
'label' => __('issue.issues'),
|
||||
'allowedBy' => [],
|
||||
],
|
||||
[
|
||||
'value' => Repo::doi()::TYPE_REPRESENTATION,
|
||||
'label' => __('doi.manager.settings.galleysWithDescription'),
|
||||
'allowedBy' => [],
|
||||
]
|
||||
];
|
||||
Hook::call('DoiSetupSettingsForm::getObjectTypes', [&$this->objectTypeOptions]);
|
||||
if ($this->enabledRegistrationAgency === null) {
|
||||
$filteredOptions = $this->objectTypeOptions;
|
||||
} else {
|
||||
$filteredOptions = array_filter($this->objectTypeOptions, function ($option) {
|
||||
return in_array($this->enabledRegistrationAgency, $option['allowedBy']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$this->addField(new FieldOptions(Context::SETTING_ENABLED_DOI_TYPES, [
|
||||
'label' => __('doi.manager.settings.doiObjects'),
|
||||
'description' => __('doi.manager.settings.doiObjectsRequired'),
|
||||
'groupId' => self::DOI_SETTINGS_GROUP,
|
||||
'options' => $filteredOptions,
|
||||
'value' => $context->getData(Context::SETTING_ENABLED_DOI_TYPES) ? $context->getData(Context::SETTING_ENABLED_DOI_TYPES) : [],
|
||||
]), [FIELD_POSITION_BEFORE, Context::SETTING_DOI_PREFIX])
|
||||
->addField(new FieldText(Repo::doi()::CUSTOM_ISSUE_PATTERN, [
|
||||
'label' => __('issue.issues'),
|
||||
'groupId' => self::DOI_CUSTOM_SUFFIX_GROUP,
|
||||
'value' => $context->getData(Repo::doi()::CUSTOM_ISSUE_PATTERN),
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/LicenseForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class LicenseForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief Add OJS-specific details to the license settings forms
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPLicenseForm;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
|
||||
class LicenseForm extends PKPLicenseForm
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_LICENSE;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* @copydoc PKPLicenseForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $locales, $context)
|
||||
{
|
||||
parent::__construct($action, $locales, $context);
|
||||
|
||||
$this->addField(new FieldOptions('copyrightYearBasis', [
|
||||
'label' => __('submission.copyrightYear'),
|
||||
'description' => __('manager.distribution.copyrightYearBasis.description'),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['value' => 'issue', 'label' => __('manager.distribution.copyrightYearBasis.issue')],
|
||||
['value' => 'submission', 'label' => __('manager.distribution.copyrightYearBasis.submission')],
|
||||
],
|
||||
'value' => $context->getData('copyrightYearBasis'),
|
||||
]), [FIELD_POSITION_AFTER, 'licenseUrl']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/MastheadForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class MastheadForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief Add OJS-specific fields to the masthead form.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPMastheadForm;
|
||||
use PKP\components\forms\FieldText;
|
||||
|
||||
class MastheadForm extends PKPMastheadForm
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPMastheadForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $locales, $context, $imageUploadUrl)
|
||||
{
|
||||
parent::__construct($action, $locales, $context, $imageUploadUrl);
|
||||
|
||||
$this->addField(new FieldText('abbreviation', [
|
||||
'label' => __('manager.setup.journalAbbreviation'),
|
||||
'isMultilingual' => true,
|
||||
'groupId' => 'identity',
|
||||
'value' => $context->getData('abbreviation'),
|
||||
]))
|
||||
->addField(new FieldText('publisherInstitution', [
|
||||
'label' => __('manager.setup.publisher'),
|
||||
'groupId' => 'publishing',
|
||||
'value' => $context->getData('publisherInstitution'),
|
||||
]))
|
||||
->addField(new FieldText('publisherUrl', [
|
||||
'label' => __('common.url'),
|
||||
'groupId' => 'publishing',
|
||||
'value' => $context->getData('publisherUrl'),
|
||||
]))
|
||||
->addField(new FieldText('onlineIssn', [
|
||||
'label' => __('manager.setup.onlineIssn'),
|
||||
'size' => 'small',
|
||||
'groupId' => 'publishing',
|
||||
'value' => $context->getData('onlineIssn'),
|
||||
]))
|
||||
->addField(new FieldText('printIssn', [
|
||||
'label' => __('manager.setup.printIssn'),
|
||||
'size' => 'small',
|
||||
'groupId' => 'publishing',
|
||||
'value' => $context->getData('printIssn'),
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/MetadataSettingsForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class MetadataSettingsForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief Add OJS-specific fields to the masthead form.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPMetadataSettingsForm;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
|
||||
class MetadataSettingsForm extends PKPMetadataSettingsForm
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPMetadataSettingsForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $context)
|
||||
{
|
||||
parent::__construct($action, $context);
|
||||
|
||||
$this->addField(new FieldOptions('enablePublisherId', [
|
||||
'label' => __('submission.publisherId'),
|
||||
'description' => __('submission.publisherId.description'),
|
||||
'options' => [
|
||||
[
|
||||
'value' => 'publication',
|
||||
'label' => __('submission.publisherId.enable', ['objects' => __('submission.publications')]),
|
||||
],
|
||||
[
|
||||
'value' => 'galley',
|
||||
'label' => __('submission.publisherId.enable', ['objects' => __('submission.layout.galleys')]),
|
||||
],
|
||||
[
|
||||
'value' => 'issue',
|
||||
'label' => __('submission.publisherId.enable', ['objects' => __('issue.issues')]),
|
||||
],
|
||||
[
|
||||
'value' => 'issueGalley',
|
||||
'label' => __('submission.publisherId.enable', ['objects' => __('editor.issues.galleys')]),
|
||||
],
|
||||
],
|
||||
'value' => $context->getData('enablePublisherId') ? $context->getData('enablePublisherId') : [],
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/ReviewGuidanceForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewGuidanceForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for configuring the guidance a reviewer should receive.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPReviewGuidanceForm;
|
||||
|
||||
class ReviewGuidanceForm extends PKPReviewGuidanceForm
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/context/UserAccessForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class UserAccessForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief Add OJS-specific fields to the users and roles access settings form.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\context;
|
||||
|
||||
use PKP\components\forms\context\PKPUserAccessForm;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
|
||||
class UserAccessForm extends PKPUserAccessForm
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPUserAccessForm::__construct()
|
||||
*/
|
||||
public function __construct($action, $context)
|
||||
{
|
||||
parent::__construct($action, $context);
|
||||
|
||||
$this->addField(new FieldOptions('restrictArticleAccess', [
|
||||
'label' => __('manager.setup.siteAccess.viewContent'),
|
||||
'value' => (bool) $context->getData('restrictArticleAccess'),
|
||||
'options' => [
|
||||
['value' => true, 'label' => __('manager.setup.restrictArticleAccess')],
|
||||
],
|
||||
]), [FIELD_POSITION_AFTER, 'restrictSiteAccess']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user