first commit
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @file components/StatsIssuePage.php
|
||||
*
|
||||
* Copyright (c) 2022 Simon Fraser University
|
||||
* Copyright (c) 2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class StatsIssuePage
|
||||
*
|
||||
* @ingroup classes_controllers_stats
|
||||
*
|
||||
* @brief A class to prepare the data object for the issue statistics
|
||||
* UI component
|
||||
*/
|
||||
|
||||
namespace APP\components;
|
||||
|
||||
use PKP\components\PKPStatsComponent;
|
||||
use PKP\statistics\PKPStatisticsHelper;
|
||||
|
||||
class StatsIssuePage extends PKPStatsComponent
|
||||
{
|
||||
/** @var array A timeline of stats (eg - monthly) for a graph */
|
||||
public $timeline = [];
|
||||
|
||||
/** @var string Which time segment (eg - month) is displayed in the graph */
|
||||
public $timelineInterval = PKPStatisticsHelper::STATISTICS_DIMENSION_MONTH;
|
||||
|
||||
/** @var string Which views to show in the graph. Supports `abstract` or `galley`. */
|
||||
public $timelineType = '';
|
||||
|
||||
/** @var array List of items to display stats for */
|
||||
public $items = [];
|
||||
|
||||
/** @var int The maximum number of items that stats can be shown for */
|
||||
public $itemsMax = 0;
|
||||
|
||||
/** @var int How many items to show per page */
|
||||
public $count = 30;
|
||||
|
||||
/** @var string Order items by this property */
|
||||
public $orderBy = '';
|
||||
|
||||
/** @var string Order items in this direction: ASC or DESC*/
|
||||
public $orderDirection = 'DESC';
|
||||
|
||||
/** @var string A search phrase to filter the list of items */
|
||||
public $searchPhrase = null;
|
||||
|
||||
/**
|
||||
* Retrieve the configuration data to be used when initializing this
|
||||
* handler on the frontend
|
||||
*
|
||||
* @return array Configuration data
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$config = parent::getConfig();
|
||||
|
||||
$config = array_merge(
|
||||
$config,
|
||||
[
|
||||
'timeline' => $this->timeline,
|
||||
'timelineInterval' => $this->timelineInterval,
|
||||
'timelineType' => $this->timelineType,
|
||||
'items' => $this->items,
|
||||
'dateRangeLabel' => __('stats.dateRange'),
|
||||
'searchPhraseLabel' => __('common.searchPhrase'),
|
||||
'itemsOfTotalLabel' => __('stats.issues.countOfTotal'),
|
||||
'betweenDatesLabel' => __('stats.downloadReport.betweenDates'),
|
||||
'allDatesLabel' => __('stats.dateRange.allDates'),
|
||||
'timelineTypeLabel' => __('stats.timelineType'),
|
||||
'timelineIntervalLabel' => __('stats.timelineInterval'),
|
||||
'viewsLabel' => __('submission.views'),
|
||||
'downloadsLabel' => __('submission.downloads'),
|
||||
'dayLabel' => __('common.day'),
|
||||
'monthLabel' => __('common.month'),
|
||||
'timelineDescriptionLabel' => __('stats.timeline.downloadReport.description'),
|
||||
'itemsMax' => $this->itemsMax,
|
||||
'count' => $this->count,
|
||||
'offset' => 0,
|
||||
'searchPhrase' => null,
|
||||
'orderBy' => $this->orderBy,
|
||||
'orderDirection' => $this->orderDirection,
|
||||
'isLoadingTimeline' => false,
|
||||
]
|
||||
);
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/FieldArchivingPn.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 FieldArchivingPn
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief An extension of the FieldOptions for the configuration setting which
|
||||
* allows a user to enable/disable the PKP Preservation Network plugin, and
|
||||
* access the settings, from a form-like view in the distribution settings.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms;
|
||||
|
||||
use PKP\components\forms\FieldOptions;
|
||||
|
||||
class FieldArchivingPn extends FieldOptions
|
||||
{
|
||||
/** @copydoc Field::$component */
|
||||
public $component = 'field-archiving-pn';
|
||||
|
||||
/** @var string The message to show in a modal when the link is clicked. */
|
||||
public $terms = '';
|
||||
|
||||
/** @var string The message to show when the plugin is disabled. */
|
||||
public $disablePluginSuccess = '';
|
||||
|
||||
/** @var string The message to show when the plugin was enabled.. */
|
||||
public $enablePluginSuccess = '';
|
||||
|
||||
/** @var string The URL to enable the PLN plugin. */
|
||||
public $enablePluginUrl = '';
|
||||
|
||||
/** @var string The URL to disable the PLN plugin. */
|
||||
public $disablePluginUrl = '';
|
||||
|
||||
/** @var string The URL to load the PN plugin settings. */
|
||||
public $settingsUrl = '';
|
||||
|
||||
/**
|
||||
* @copydoc Field::getConfig()
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$config = parent::getConfig();
|
||||
$config['terms'] = $this->terms;
|
||||
$config['disablePluginSuccess'] = $this->disablePluginSuccess;
|
||||
$config['enablePluginSuccess'] = $this->enablePluginSuccess;
|
||||
$config['enablePluginUrl'] = $this->enablePluginUrl;
|
||||
$config['disablePluginUrl'] = $this->disablePluginUrl;
|
||||
$config['settingsUrl'] = $this->settingsUrl;
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/FieldSelectIssue.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 FieldSelectIssue
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief An extension of the FieldSelect for selecting an issue.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms;
|
||||
|
||||
use APP\core\Application;
|
||||
use PKP\components\forms\FieldSelect;
|
||||
|
||||
class FieldSelectIssue extends FieldSelect
|
||||
{
|
||||
/** @copydoc Field::$component */
|
||||
public $component = 'field-select-issue';
|
||||
|
||||
/** @var int One of the PKPSubmission::STATUS_ constants */
|
||||
public $publicationStatus;
|
||||
|
||||
/**
|
||||
* @copydoc Field::getConfig()
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$config = parent::getConfig();
|
||||
$config['publicationStatus'] = $this->publicationStatus;
|
||||
|
||||
$issueUrlPlaceholder = Application::get()->getRequest()->getDispatcher()->url(
|
||||
Application::get()->getRequest(),
|
||||
Application::ROUTE_PAGE,
|
||||
null,
|
||||
'issue',
|
||||
'view',
|
||||
'__issueId__'
|
||||
);
|
||||
|
||||
$config['assignLabel'] = __('publication.assignToissue');
|
||||
$config['assignedNoticeBase'] = __('publication.assignedToIssue', ['issueUrl' => $issueUrlPlaceholder]);
|
||||
$config['changeIssueLabel'] = __('publication.changeIssue');
|
||||
$config['publishedNoticeBase'] = __('publication.publishedIn', ['issueUrl' => $issueUrlPlaceholder]);
|
||||
$config['scheduledNoticeBase'] = __('publication.scheduledIn', ['issueUrl' => $issueUrlPlaceholder]);
|
||||
$config['unscheduledNotice'] = __('publication.unscheduledIn');
|
||||
$config['unscheduleLabel'] = __('publication.unschedule');
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/FieldSelectIssues.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 FieldSelectIssues
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A text field to search for and select issues.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms;
|
||||
|
||||
use PKP\components\forms\FieldBaseAutosuggest;
|
||||
|
||||
class FieldSelectIssues extends FieldBaseAutosuggest
|
||||
{
|
||||
/** @copydoc Field::$component */
|
||||
public $component = 'field-select-issues';
|
||||
}
|
||||
@@ -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']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/counter/CounterReportForm.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.
|
||||
*
|
||||
* @class CounterReportForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A form for setting a counter report
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\counter;
|
||||
|
||||
use APP\sushi\IR;
|
||||
use APP\sushi\IR_A1;
|
||||
use APP\sushi\PR;
|
||||
use APP\sushi\PR_P1;
|
||||
use APP\sushi\TR;
|
||||
use APP\sushi\TR_J3;
|
||||
use PKP\components\forms\counter\PKPCounterReportForm;
|
||||
|
||||
class CounterReportForm extends PKPCounterReportForm
|
||||
{
|
||||
public function setReportFields(): void
|
||||
{
|
||||
$formFieldsPR = PR::getReportSettingsFormFields();
|
||||
$this->reportFields['PR'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsPR);
|
||||
|
||||
$formFieldsPR_P1 = PR_P1::getReportSettingsFormFields();
|
||||
$this->reportFields['PR_P1'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsPR_P1);
|
||||
|
||||
$formFieldsTR = TR::getReportSettingsFormFields();
|
||||
$this->reportFields['TR'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsTR);
|
||||
|
||||
$formFieldsTR_J3 = TR_J3::getReportSettingsFormFields();
|
||||
$this->reportFields['TR_J3'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsTR_J3);
|
||||
|
||||
$formFieldsIR = IR::getReportSettingsFormFields();
|
||||
$this->reportFields['IR'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsIR);
|
||||
|
||||
$formFieldsIR_A1 = IR_A1::getReportSettingsFormFields();
|
||||
$this->reportFields['IR_A1'] = array_map(function ($field) {
|
||||
$field->groupId = 'default';
|
||||
return $field;
|
||||
}, $formFieldsIR_A1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/decision/RequestPaymentDecisionForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class RequestPaymentDecisionForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A form to request or waive an APC payment when making an editorial decision
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\decision;
|
||||
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FormComponent;
|
||||
use PKP\context\Context;
|
||||
|
||||
define('FORM_REQUEST_PAYMENT_DECISION', 'requestPaymentDecision');
|
||||
|
||||
class RequestPaymentDecisionForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_REQUEST_PAYMENT_DECISION;
|
||||
|
||||
/** @copydoc FormComponent::$action */
|
||||
public $action = FormComponent::ACTION_EMIT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct(Context $context)
|
||||
{
|
||||
$this->addField(new FieldOptions('requestPayment', [
|
||||
'label' => __('common.payment'),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
[
|
||||
'value' => true,
|
||||
'label' => __(
|
||||
'payment.requestPublicationFee',
|
||||
['feeAmount' => $context->getData('publicationFee') . ' ' . $context->getData('currency')]
|
||||
),
|
||||
],
|
||||
[
|
||||
'value' => false,
|
||||
'label' => __('payment.waive'),
|
||||
],
|
||||
],
|
||||
'value' => true,
|
||||
'groupId' => 'default',
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/publication/AssignToIssueForm.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 AssignToIssueForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for setting a publication's issue.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\publication;
|
||||
|
||||
use APP\facades\Repo;
|
||||
use PKP\components\forms\FieldSelect;
|
||||
use PKP\components\forms\FormComponent;
|
||||
|
||||
define('FORM_ASSIGN_TO_ISSUE', 'assignToIssue');
|
||||
|
||||
class AssignToIssueForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_ASSIGN_TO_ISSUE;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param \APP\publication\Publication $publication The publication to change settings for
|
||||
* @param \APP\journal\Journal $publicationContext The context of the publication
|
||||
*/
|
||||
public function __construct($action, $publication, $publicationContext)
|
||||
{
|
||||
$this->action = $action;
|
||||
|
||||
// Issue options
|
||||
$issueOptions = [['value' => '', 'label' => '']];
|
||||
|
||||
$unpublishedIssues = Repo::issue()->getCollector()
|
||||
->filterByContextIds([$publicationContext->getId()])
|
||||
->filterByPublished(false)
|
||||
->getMany();
|
||||
|
||||
if ($unpublishedIssues->count() > 0) {
|
||||
$issueOptions[] = ['value' => '', 'label' => '--- ' . __('editor.issues.futureIssues') . ' ---'];
|
||||
foreach ($unpublishedIssues as $issue) {
|
||||
$issueOptions[] = [
|
||||
'value' => (int) $issue->getId(),
|
||||
'label' => htmlspecialchars($issue->getIssueIdentification()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$publishedIssues = Repo::issue()->getCollector()
|
||||
->filterByContextIds([$publicationContext->getId()])
|
||||
->filterByPublished(true)
|
||||
->getMany();
|
||||
|
||||
if ($publishedIssues->count() > 0) {
|
||||
$issueOptions[] = ['value' => '', 'label' => '--- ' . __('editor.issues.backIssues') . ' ---'];
|
||||
foreach ($publishedIssues as $issue) {
|
||||
$issueOptions[] = [
|
||||
'value' => (int) $issue->getId(),
|
||||
'label' => htmlspecialchars($issue->getIssueIdentification()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->addField(new FieldSelect('issueId', [
|
||||
'label' => __('issue.issue'),
|
||||
'options' => $issueOptions,
|
||||
'value' => $publication->getData('issueId') ? $publication->getData('issueId') : 0,
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/publication/IssueEntryForm.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 IssueEntryForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for setting a publication's issue, section, categories,
|
||||
* pages, etc.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\publication;
|
||||
|
||||
use APP\components\forms\FieldSelectIssue;
|
||||
use APP\facades\Repo;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\FieldSelect;
|
||||
use PKP\components\forms\FieldText;
|
||||
use PKP\components\forms\FieldUploadImage;
|
||||
use PKP\components\forms\FormComponent;
|
||||
|
||||
define('FORM_ISSUE_ENTRY', 'issueEntry');
|
||||
|
||||
class IssueEntryForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_ISSUE_ENTRY;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param array $locales Supported locales
|
||||
* @param \APP\publication\Publication $publication The publication to change settings for
|
||||
* @param \APP\journal\Journal $publicationContext The context of the publication
|
||||
* @param string $baseUrl Site's base URL. Used for image previews.
|
||||
* @param string $temporaryFileApiUrl URL to upload files to
|
||||
*/
|
||||
public function __construct($action, $locales, $publication, $publicationContext, $baseUrl, $temporaryFileApiUrl)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->locales = $locales;
|
||||
|
||||
// Issue options
|
||||
$issueOptions = [['value' => '', 'label' => '']];
|
||||
|
||||
$unpublishedIssues = Repo::issue()->getCollector()
|
||||
->filterByContextIds([$publicationContext->getId()])
|
||||
->filterByPublished(false)
|
||||
->getMany()
|
||||
->toArray();
|
||||
|
||||
if (count($unpublishedIssues)) {
|
||||
$issueOptions[] = ['value' => '', 'label' => '--- ' . __('editor.issues.futureIssues') . ' ---'];
|
||||
foreach ($unpublishedIssues as $issue) {
|
||||
$issueOptions[] = [
|
||||
'value' => (int) $issue->getId(),
|
||||
'label' => htmlspecialchars($issue->getIssueIdentification()),
|
||||
];
|
||||
}
|
||||
}
|
||||
$publishedIssues = Repo::issue()->getCollector()
|
||||
->filterByContextIds([$publicationContext->getId()])
|
||||
->filterByPublished(true)
|
||||
->getMany()
|
||||
->toArray();
|
||||
|
||||
if (count($publishedIssues)) {
|
||||
$issueOptions[] = ['value' => '', 'label' => '--- ' . __('editor.issues.backIssues') . ' ---'];
|
||||
foreach ($publishedIssues as $issue) {
|
||||
$issueOptions[] = [
|
||||
'value' => (int) $issue->getId(),
|
||||
'label' => htmlspecialchars($issue->getIssueIdentification()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Section options
|
||||
$sections = Repo::section()->getSectionList($publicationContext->getId());
|
||||
$sectionOptions = [];
|
||||
foreach ($sections as $section) {
|
||||
$sectionOptions[] = [
|
||||
'label' => (($section['group']) ? __('publication.inactiveSection', ['section' => $section['title']]) : $section['title']),
|
||||
'value' => (int) $section['id'],
|
||||
];
|
||||
}
|
||||
|
||||
$this->addField(new FieldSelectIssue('issueId', [
|
||||
'label' => __('issue.issue'),
|
||||
'options' => $issueOptions,
|
||||
'publicationStatus' => $publication->getData('status'),
|
||||
'value' => $publication->getData('issueId') ? $publication->getData('issueId') : 0,
|
||||
]))
|
||||
->addField(new FieldSelect('sectionId', [
|
||||
'label' => __('section.section'),
|
||||
'options' => $sectionOptions,
|
||||
'value' => (int) $publication->getData('sectionId'),
|
||||
]));
|
||||
|
||||
// Categories
|
||||
$categoryOptions = [];
|
||||
$categories = Repo::category()->getCollector()
|
||||
->filterByContextIds([$publicationContext->getId()])
|
||||
->getMany()
|
||||
->toArray();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$label = $category->getLocalizedTitle();
|
||||
if ($category->getParentId()) {
|
||||
$label = $categories[$category->getParentId()]->getLocalizedTitle() . ' > ' . $label;
|
||||
}
|
||||
$categoryOptions[] = [
|
||||
'value' => (int) $category->getId(),
|
||||
'label' => $label,
|
||||
];
|
||||
}
|
||||
if (!empty($categoryOptions)) {
|
||||
$this->addField(new FieldOptions('categoryIds', [
|
||||
'label' => __('submission.submit.placement.categories'),
|
||||
'value' => $publication->getData('categoryIds'),
|
||||
'options' => $categoryOptions,
|
||||
]));
|
||||
}
|
||||
|
||||
$this->addField(new FieldUploadImage('coverImage', [
|
||||
'label' => __('editor.article.coverImage'),
|
||||
'value' => $publication->getData('coverImage'),
|
||||
'isMultilingual' => true,
|
||||
'baseUrl' => $baseUrl,
|
||||
'options' => [
|
||||
'url' => $temporaryFileApiUrl,
|
||||
],
|
||||
]))
|
||||
->addField(new FieldText('pages', [
|
||||
'label' => __('editor.issues.pages'),
|
||||
'value' => $publication->getData('pages'),
|
||||
]))
|
||||
->addField(new FieldText('urlPath', [
|
||||
'label' => __('publication.urlPath'),
|
||||
'description' => __('publication.urlPath.description'),
|
||||
'value' => $publication->getData('urlPath'),
|
||||
]))
|
||||
->addField(new FieldText('datePublished', [
|
||||
'label' => __('publication.datePublished'),
|
||||
'description' => __('publication.datePublished.description'),
|
||||
'value' => $publication->getData('datePublished'),
|
||||
'size' => 'small',
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/publication/PublishForm.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 PublishForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for confirming a publication's issue before publishing.
|
||||
* It may also be used for scheduling a publication in an issue for later
|
||||
* publication.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\publication;
|
||||
|
||||
use APP\facades\Repo;
|
||||
use PKP\components\forms\FieldHTML;
|
||||
use PKP\components\forms\FormComponent;
|
||||
use PKP\core\Core;
|
||||
use PKP\core\PKPString;
|
||||
|
||||
define('FORM_PUBLISH', 'publish');
|
||||
|
||||
class PublishForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_PUBLISH;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/** @var \APP\publication\Publication */
|
||||
public $publication;
|
||||
|
||||
/** @var \APP\journal\Journal */
|
||||
public $submissionContext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param \APP\publication\Publication $publication The publication to change settings for
|
||||
* @param \APP\journal\Journal $submissionContext journal or press
|
||||
* @param array $requirementErrors A list of pre-publication requirements that are not met.
|
||||
*/
|
||||
public function __construct($action, $publication, $submissionContext, $requirementErrors)
|
||||
{
|
||||
$this->action = $action;
|
||||
$this->errors = $requirementErrors;
|
||||
$this->publication = $publication;
|
||||
$this->submissionContext = $submissionContext;
|
||||
|
||||
// Set separate messages and buttons if publication requirements have passed
|
||||
if (empty($requirementErrors)) {
|
||||
$msg = __('publication.publish.confirmation');
|
||||
$submitLabel = __('publication.publish');
|
||||
if ($publication->getData('issueId')) {
|
||||
$issue = Repo::issue()->get($publication->getData('issueId'));
|
||||
if ($issue) {
|
||||
if ($issue->getData('published')) {
|
||||
$msg = __('publication.publish.confirmation.backIssue', ['issue' => htmlspecialchars($issue->getIssueIdentification())]);
|
||||
} else {
|
||||
$msg = __('publication.publish.confirmation.futureIssue', ['issue' => htmlspecialchars($issue->getIssueIdentification())]);
|
||||
$submitLabel = __('editor.submission.schedulePublication');
|
||||
}
|
||||
}
|
||||
}
|
||||
// If a publication date has already been set and the date has passed this will
|
||||
// be published immediately regardless of the issue assignment
|
||||
if ($publication->getData('datePublished') && $publication->getData('datePublished') <= Core::getCurrentDate()) {
|
||||
$timestamp = strtotime($publication->getData('datePublished'));
|
||||
$dateFormatLong = PKPString::convertStrftimeFormat($submissionContext->getLocalizedDateFormatLong());
|
||||
$msg = __(
|
||||
'publication.publish.confirmation.datePublishedInPast',
|
||||
[
|
||||
'datePublished' => date($dateFormatLong, $timestamp),
|
||||
]
|
||||
);
|
||||
$submitLabel = __('publication.publish');
|
||||
}
|
||||
$this->addPage([
|
||||
'id' => 'default',
|
||||
'submitButton' => [
|
||||
'label' => $submitLabel,
|
||||
],
|
||||
]);
|
||||
} else {
|
||||
$msg = '<p>' . __('publication.publish.requirements') . '</p>';
|
||||
$msg .= '<ul>';
|
||||
foreach ($requirementErrors as $error) {
|
||||
$msg .= '<li>' . $error . '</li>';
|
||||
}
|
||||
$msg .= '</ul>';
|
||||
$this->addPage([
|
||||
'id' => 'default',
|
||||
]);
|
||||
}
|
||||
|
||||
$this->addGroup([
|
||||
'id' => 'default',
|
||||
'pageId' => 'default',
|
||||
])
|
||||
->addField(new FieldHTML('validation', [
|
||||
'description' => $msg,
|
||||
'groupId' => 'default',
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/publication/SubmissionPaymentsForm.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 SubmissionPaymentsForm
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A form for managing submission fees.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\publication;
|
||||
|
||||
use APP\payment\ojs\OJSCompletedPaymentDAO;
|
||||
use APP\payment\ojs\OJSPaymentManager;
|
||||
use PKP\components\forms\FieldRadioInput;
|
||||
use PKP\components\forms\FormComponent;
|
||||
use PKP\db\DAORegistry;
|
||||
|
||||
define('FORM_SUBMISSION_PAYMENTS', 'submissionPayments');
|
||||
|
||||
class SubmissionPaymentsForm extends FormComponent
|
||||
{
|
||||
/** @copydoc FormComponent::$id */
|
||||
public $id = FORM_SUBMISSION_PAYMENTS;
|
||||
|
||||
/** @copydoc FormComponent::$method */
|
||||
public $method = 'PUT';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $action URL to submit the form to
|
||||
* @param \APP\submission\Submission $submission The submission to inspect payment status of
|
||||
* @param \APP\journal\Journal $submissionContext The context of the submission
|
||||
*/
|
||||
public function __construct($action, $submission, $submissionContext)
|
||||
{
|
||||
$this->action = $action;
|
||||
|
||||
$completedPaymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO'); /** @var OJSCompletedPaymentDAO $completedPaymentDao */
|
||||
$publicationFeePayment = $completedPaymentDao->getByAssoc(null, OJSPaymentManager::PAYMENT_TYPE_PUBLICATION, $submission->getId());
|
||||
|
||||
$this->addField(new FieldRadioInput('publicationFeeStatus', [
|
||||
'label' => __('payment.type.publication'),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['value' => 'waived', 'label' => __('payment.waived')],
|
||||
['value' => 'paid', 'label' => __('payment.paid')],
|
||||
['value' => 'unpaid', 'label' => __('payment.unpaid')],
|
||||
],
|
||||
'value' => $publicationFeePayment
|
||||
? ($publicationFeePayment->getAmount() ? 'paid' : 'waived')
|
||||
: 'unpaid'
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/submission/ReconfigureSubmission.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReconfigureSubmission
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief A preset form for configuring the submission wizard, such as the
|
||||
* submission's section or language, after the submission was started.
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\submission;
|
||||
|
||||
use APP\publication\Publication;
|
||||
use APP\section\Section;
|
||||
use APP\submission\Submission;
|
||||
use PKP\components\forms\FieldHTML;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\submission\ReconfigureSubmission as BaseReconfigureSubmission;
|
||||
use PKP\context\Context;
|
||||
use PKP\core\PKPString;
|
||||
|
||||
class ReconfigureSubmission extends BaseReconfigureSubmission
|
||||
{
|
||||
public array $sections;
|
||||
|
||||
/**
|
||||
* @param Section[] $sections
|
||||
*/
|
||||
public function __construct(string $action, Submission $submission, Publication $publication, Context $context, array $sections)
|
||||
{
|
||||
parent::__construct($action, $submission, $publication, $context);
|
||||
|
||||
$this->sections = $sections;
|
||||
|
||||
if (count($this->sections) > 1) {
|
||||
$this->addSectionsField();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addSectionsField(): void
|
||||
{
|
||||
$this->addField(new FieldOptions('sectionId', [
|
||||
'type' => 'radio',
|
||||
'label' => __('section.section'),
|
||||
'description' => __('author.submit.journalSectionDescription'),
|
||||
'options' => $this->getSectionOptions(),
|
||||
'isRequired' => true,
|
||||
'value' => $this->publication->getData('sectionId'),
|
||||
]));
|
||||
|
||||
foreach ($this->sections as $section) {
|
||||
if (!trim(PKPString::html2text($section->getLocalizedPolicy()))) {
|
||||
continue;
|
||||
}
|
||||
$this->addField(new FieldHTML('sectionDescription' . $section->getId(), [
|
||||
'label' => $section->getLocalizedTitle(),
|
||||
'description' => $section->getLocalizedPolicy(),
|
||||
'showWhen' => ['sectionId', $section->getId()],
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert sections to options prop for a FieldOption
|
||||
*/
|
||||
protected function getSectionOptions(): array
|
||||
{
|
||||
$options = [];
|
||||
foreach ($this->sections as $section) {
|
||||
$options[] = [
|
||||
'value' => $section->getId(),
|
||||
'label' => $section->getLocalizedTitle(),
|
||||
];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* @file classes/components/form/submission/StartSubmission.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class StartSubmission
|
||||
*
|
||||
* @ingroup classes_controllers_form
|
||||
*
|
||||
* @brief The form to begin the submission wizard
|
||||
*/
|
||||
|
||||
namespace APP\components\forms\submission;
|
||||
|
||||
use APP\section\Section;
|
||||
use Illuminate\Support\Enumerable;
|
||||
use PKP\components\forms\FieldHTML;
|
||||
use PKP\components\forms\FieldOptions;
|
||||
use PKP\components\forms\submission\StartSubmission as BaseStartSubmission;
|
||||
use PKP\context\Context;
|
||||
use PKP\core\PKPString;
|
||||
|
||||
class StartSubmission extends BaseStartSubmission
|
||||
{
|
||||
/**
|
||||
* @param Section[] $sections The sections that this user can submit to
|
||||
*/
|
||||
public function __construct(string $action, Context $context, Enumerable $userGroups, array $sections)
|
||||
{
|
||||
parent::__construct($action, $context, $userGroups);
|
||||
|
||||
if (count($sections) === 1) {
|
||||
$this->addHiddenField('sectionId', $sections[0]->getId());
|
||||
} else {
|
||||
$this->addField(new FieldOptions('sectionId', [
|
||||
'type' => 'radio',
|
||||
'label' => __('section.section'),
|
||||
'description' => __('author.submit.journalSectionDescription'),
|
||||
'options' => $this->getSectionOptions($sections),
|
||||
'value' => '',
|
||||
'isRequired' => true,
|
||||
]), [FIELD_POSITION_AFTER, 'title']);
|
||||
|
||||
foreach ($sections as $section) {
|
||||
if (!trim(PKPString::html2text($section->getLocalizedPolicy()))) {
|
||||
continue;
|
||||
}
|
||||
$this->addField(new FieldHTML('sectionDescription' . $section->getId(), [
|
||||
'label' => $section->getLocalizedTitle(),
|
||||
'description' => $section->getLocalizedPolicy(),
|
||||
'showWhen' => ['sectionId', $section->getId()],
|
||||
]), [FIELD_POSITION_AFTER, 'sectionId']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert sections to options prop for a FieldOption
|
||||
*
|
||||
* @param Section[] $sections
|
||||
*/
|
||||
protected function getSectionOptions(array $sections): array
|
||||
{
|
||||
$options = [];
|
||||
foreach ($sections as $section) {
|
||||
$options[] = [
|
||||
'value' => $section->getId(),
|
||||
'label' => $section->getLocalizedTitle(),
|
||||
];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/components/listPanels/DoiListPanel.php
|
||||
*
|
||||
* Copyright (c) 2014-2020 Simon Fraser University
|
||||
* Copyright (c) 2000-2020 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DoiListPanel
|
||||
*
|
||||
* @ingroup classes_components_list
|
||||
*
|
||||
* @brief A ListPanel component for viewing and editing DOIs
|
||||
*/
|
||||
|
||||
namespace APP\components\listPanels;
|
||||
|
||||
use APP\components\forms\FieldSelectIssues;
|
||||
use APP\core\Application;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\components\listPanels\PKPDoiListPanel;
|
||||
use PKP\core\PKPApplication;
|
||||
|
||||
class DoiListPanel extends PKPDoiListPanel
|
||||
{
|
||||
/** @var bool Whether objects being passed to DOI List Panel are submissions or not */
|
||||
public $isSubmission = true;
|
||||
|
||||
/** @var boolean Whether to show issue filters */
|
||||
public $includeIssuesFilter = false;
|
||||
|
||||
/**
|
||||
* Add any application-specific config to the list panel setup
|
||||
*/
|
||||
protected function setAppConfig(array &$config): void
|
||||
{
|
||||
if ($this->isSubmission) {
|
||||
$config['executeActionApiUrl'] = $this->doiApiUrl . '/submissions';
|
||||
} else {
|
||||
$config['executeActionApiUrl'] = $this->doiApiUrl . '/issues';
|
||||
// Overwrite default submission published statuses for issue-specific ones
|
||||
$config['publishedStatuses'] = [
|
||||
'name' => 'isPublished',
|
||||
'published' => 1,
|
||||
'unpublished' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
if ($this->includeIssuesFilter) {
|
||||
$request = Application::get()->getRequest();
|
||||
$issueAutosuggestField = new FieldSelectIssues('issueIds', [
|
||||
'label' => __('issue.issues'),
|
||||
'value' => [],
|
||||
'apiUrl' => $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $request->getContext()->getPath(), 'issues'),
|
||||
]);
|
||||
$config['filters'][] = [
|
||||
'filters' => [
|
||||
[
|
||||
'title' => __('issue.issues'),
|
||||
'param' => 'issueIds',
|
||||
'value' => [],
|
||||
'filterType' => 'pkp-filter-autosuggest',
|
||||
'component' => 'field-select-issues',
|
||||
'autosuggestProps' => $issueAutosuggestField->getConfig(),
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Provide required locale keys
|
||||
$request = Application::get()->getRequest();
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$templateMgr->setLocaleKeys([
|
||||
'article.article',
|
||||
'issue.issue'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* @file components/listPanels/SubmissionsListPanel.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 SubmissionsListPanel
|
||||
*
|
||||
* @ingroup classes_components_listPanels
|
||||
*
|
||||
* @brief Instantiates and manages a UI component to list submissions.
|
||||
*/
|
||||
|
||||
namespace APP\components\listPanels;
|
||||
|
||||
use APP\components\forms\FieldSelectIssues;
|
||||
use APP\core\Application;
|
||||
use APP\facades\Repo;
|
||||
use PKP\components\forms\FieldAutosuggestPreset;
|
||||
use PKP\components\listPanels\PKPSubmissionsListPanel;
|
||||
|
||||
class SubmissionsListPanel extends PKPSubmissionsListPanel
|
||||
{
|
||||
/** @var bool Whether to show inactive section filters */
|
||||
public $includeActiveSectionFiltersOnly = false;
|
||||
|
||||
/** @var bool Whether to show issue filters */
|
||||
public $includeIssuesFilter = false;
|
||||
|
||||
/**
|
||||
* @copydoc PKPSubmissionsListPanel::getConfig()
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
$config = parent::getConfig();
|
||||
|
||||
$request = Application::get()->getRequest();
|
||||
if ($request->getContext()) {
|
||||
$config['filters'][] = $this->getSectionFilters($this->includeActiveSectionFiltersOnly);
|
||||
}
|
||||
|
||||
if ($this->includeIssuesFilter) {
|
||||
$issueAutosuggestField = new FieldSelectIssues('issueIds', [
|
||||
'label' => __('issue.issues'),
|
||||
'value' => [],
|
||||
'apiUrl' => $request->getDispatcher()->url($request, Application::ROUTE_API, $request->getContext()->getPath(), 'issues'),
|
||||
]);
|
||||
$config['filters'][] = [
|
||||
'filters' => [
|
||||
[
|
||||
'title' => __('issue.issues'),
|
||||
'param' => 'issueIds',
|
||||
'value' => [],
|
||||
'filterType' => 'pkp-filter-autosuggest',
|
||||
'component' => 'field-select-issues',
|
||||
'autosuggestProps' => $issueAutosuggestField->getConfig(),
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of workflow stages supported by the current app
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getWorkflowStages()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'param' => 'stageIds',
|
||||
'value' => WORKFLOW_STAGE_ID_SUBMISSION,
|
||||
'title' => __('manager.publication.submissionStage'),
|
||||
],
|
||||
[
|
||||
'param' => 'stageIds',
|
||||
'value' => WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
|
||||
'title' => __('manager.publication.reviewStage'),
|
||||
],
|
||||
[
|
||||
'param' => 'stageIds',
|
||||
'value' => WORKFLOW_STAGE_ID_EDITING,
|
||||
'title' => __('submission.copyediting'),
|
||||
],
|
||||
[
|
||||
'param' => 'stageIds',
|
||||
'value' => WORKFLOW_STAGE_ID_PRODUCTION,
|
||||
'title' => __('manager.publication.productionStage'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the sections for passing as filters
|
||||
*
|
||||
* @param bool $excludeInactive show inactive section filters or not
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSectionFilters($excludeInactive = false)
|
||||
{
|
||||
$request = Application::get()->getRequest();
|
||||
$context = $request->getContext();
|
||||
|
||||
$sections = Repo::section()->getSectionList($context->getId(), $excludeInactive);
|
||||
|
||||
// Use an autosuggest field if the list of submissions is too long
|
||||
if (count($sections) > 5) {
|
||||
$autosuggestField = new FieldAutosuggestPreset('sectionIds', [
|
||||
'label' => __('section.sections'),
|
||||
'value' => [],
|
||||
'options' => array_values(array_map(function ($section) {
|
||||
return [
|
||||
'value' => (int) $section['id'],
|
||||
'label' => $section['title'],
|
||||
];
|
||||
}, $sections)),
|
||||
]);
|
||||
return [
|
||||
'filters' => [
|
||||
[
|
||||
'title' => __('section.sections'),
|
||||
'param' => 'sectionIds',
|
||||
'filterType' => 'pkp-filter-autosuggest',
|
||||
'component' => 'field-autosuggest-preset',
|
||||
'value' => [],
|
||||
'autosuggestProps' => $autosuggestField->getConfig(),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'heading' => __('section.sections'),
|
||||
'filters' => array_map(function ($section) {
|
||||
return [
|
||||
'param' => 'sectionIds',
|
||||
'value' => (int) $section['id'],
|
||||
'title' => $section['title'],
|
||||
];
|
||||
}, $sections),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user