Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#7191 Implement new submission wizard #1220

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
2 changes: 2 additions & 0 deletions api/v1/submissions/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* @defgroup api_v1_submissions Submission API requests
*/

use APP\core\Application;

/**
* @file api/v1/submissions/index.php
*
Expand Down
40 changes: 40 additions & 0 deletions classes/components/forms/publication/ContributorForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* @file classes/components/forms/publication/ContributorForm.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 ContributorForm
* @ingroup classes_components_forms_publication
*
* @brief A preset form for adding and editing a contributor for a publication.
*/

namespace APP\components\forms\publication;

use APP\submission\Submission;
use PKP\components\forms\FieldOptions;
use PKP\context\Context;

class ContributorForm extends \PKP\components\forms\publication\ContributorForm
{
public function __construct(string $action, array $locales, Submission $submission, Context $context)
{
parent::__construct($action, $locales, $submission, $context);

if ($submission->getData('workType') === Submission::WORK_TYPE_EDITED_VOLUME) {
$this->addField(new FieldOptions('isVolumeEditor', [
'label' => __('author.volumeEditor'),
'value' => false,
'options' => [
[
'value' => true,
'label' => __('author.isVolumeEditor'),
],
],
]));
}
}
}
20 changes: 20 additions & 0 deletions classes/components/forms/publication/TitleAbstractForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* @file classes/components/form/publication/TitleAbstractForm.inc.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 TitleAbstractForm
* @ingroup classes_controllers_form
*
* @brief A preset form for setting a publication's title and abstract
*/

namespace APP\components\forms\publication;

class TitleAbstractForm extends \PKP\components\forms\publication\TitleAbstractForm
{
//
}
55 changes: 55 additions & 0 deletions classes/components/forms/submission/ForTheEditors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* @file classes/components/form/publication/ForTheEditors.inc.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 ForTheEditors
* @ingroup classes_controllers_form
*
* @brief A form during the For the Editors step in the submission wizard
*/

namespace APP\components\forms\submission;

use APP\press\Series;
use APP\publication\Publication;
use APP\submission\Submission;
use PKP\components\forms\FieldOptions;
use PKP\context\Context;

class ForTheEditors extends \PKP\components\forms\submission\ForTheEditors
{
/**
* @param Series[] $series
*/
public function __construct(string $action, array $locales, Publication $publication, Submission $submission, Context $context, string $suggestionUrlBase, array $series)
{
parent::__construct($action, $locales, $publication, $submission, $context, $suggestionUrlBase);

$this->addSeriesField($series, $publication);
}

protected function addSeriesField(array $series, Publication $publication): void
{
if (empty($series)) {
return;
}
$seriesOptions = [];
/** @var Series $iSeries */
foreach ($series as $iSeries) {
$seriesOptions[] = [
'value' => $iSeries->getId(),
'label' => $iSeries->getLocalizedFullTitle(),
];
}
$this->addField(new FieldOptions('seriesId', [
'label' => __('series.series'),
'type' => 'radio',
'options' => $seriesOptions,
'value' => $publication->getData('seriesId') ?? '',
]));
}
}
47 changes: 47 additions & 0 deletions classes/components/forms/submission/ReconfigureSubmission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* @file classes/components/form/submission/Reconfi\PKP\components\forms\submission\ReconfigureSubmissionureSubmission.inc.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 series or language, after the submission was started.
*/

namespace APP\components\forms\submission;

use APP\publication\Publication;
use APP\submission\Submission;
use PKP\components\forms\FieldOptions;
use PKP\context\Context;

class ReconfigureSubmission extends \PKP\components\forms\submission\ReconfigureSubmission
{
public function __construct(string $action, Submission $submission, Publication $publication, Context $context)
{
parent::__construct($action, $submission, $publication, $context);

$this->addField(new FieldOptions('workType', [
'type' => 'radio',
'label' => __('submission.workflowType'),
'description' => __('submission.workflowType.description'),
'options' => [
[
'value' => Submission::WORK_TYPE_AUTHORED_WORK,
'label' => __('submission.workflowType.authoredWork'),
],
[
'value' => Submission::WORK_TYPE_EDITED_VOLUME,
'label' => __('submission.workflowType.editedVolume'),
],
],
'value' => $submission->getData('workType'),
'isRequired' => true,
]));
}
}
47 changes: 47 additions & 0 deletions classes/components/forms/submission/StartSubmission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* @file classes/components/form/submission/StartSubmission.inc.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\submission\Submission;
use Illuminate\Support\Enumerable;
use PKP\components\forms\FieldOptions;
use PKP\context\Context;

class StartSubmission extends \PKP\components\forms\submission\StartSubmission
{
public function __construct(string $action, Context $context, Enumerable $userGroups)
{
parent::__construct($action, $context, $userGroups);

$this->addField(new FieldOptions('workType', [
'type' => 'radio',
'label' => __('submission.workflowType'),
'description' => __('submission.workflowType.description'),
'options' => [
[
'value' => Submission::WORK_TYPE_AUTHORED_WORK,
'label' => __('submission.workflowType.authoredWork'),
],
[
'value' => Submission::WORK_TYPE_EDITED_VOLUME,
'label' => __('submission.workflowType.editedVolume'),
],
],
'value' => Submission::WORK_TYPE_AUTHORED_WORK,
'isRequired' => true,

]), [FIELD_POSITION_AFTER, 'title']);
}
}
30 changes: 30 additions & 0 deletions classes/components/listPanels/ContributorsListPanel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* @file classes/components/listPanels/ContributorsListPanel.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 ContributorsListPanel
* @ingroup classes_components_list
*
* @brief A ListPanel component for viewing and editing contributors
*/

namespace APP\components\listPanels;

use APP\components\forms\publication\ContributorForm;

class ContributorsListPanel extends \PKP\components\listPanels\ContributorsListPanel
{
protected function getForm(string $url): ContributorForm
{
return new ContributorForm(
$url,
$this->locales,
$this->submission,
$this->context
);
}
}
5 changes: 5 additions & 0 deletions classes/core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,9 @@ public static function getPaymentManager($context)
{
return new \APP\payment\omp\OMPPaymentManager($context);
}

public static function getSectionIdPropName(): string
{
return 'seriesId';
}
}
34 changes: 34 additions & 0 deletions classes/mail/variables/SubmissionEmailVariable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* @file classes/mail/variables/SubmissionEmailVariable.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 SubmissionEmailVariable
* @ingroup mail_variables
*
* @brief Represents variables associated with a submission that can be assigned to a template
*/

namespace APP\mail\variables;

use APP\core\Application;
use PKP\context\Context;

class SubmissionEmailVariable extends \PKP\mail\variables\SubmissionEmailVariable
{
protected function getSubmissionPublishedUrl(Context $context): string
{
return Application::get()->getDispatcher()->url(
Application::get()->getRequest(),
Application::ROUTE_PAGE,
$context->getPath(),
'catalog',
'book',
$this->submission->getBestId()
);
}
}
21 changes: 21 additions & 0 deletions classes/migration/upgrade/v3_4_0/I7191_EditorAssignments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I7191_EditorAssignments.inc.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 I7191_EditorAssignments
* @brief Update the subeditor_submission_group table to accomodate new editor assignment settings
*/

namespace APP\migration\upgrade\v3_4_0;

class I7191_EditorAssignments extends \PKP\migration\upgrade\v3_4_0\I7191_EditorAssignments
{
protected string $sectionDb = 'series';
protected string $sectionIdColumn = 'series_id';
protected string $contextColumn = 'press_id';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I7191_InstallSubmissionHelpDefaults.inc.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 I7191_InstallSubmissionHelpDefaults
* @brief Migrate the submissionChecklist setting from an array to a HTML string
*/

namespace APP\migration\upgrade\v3_4_0;

class I7191_InstallSubmissionHelpDefaults extends \PKP\migration\upgrade\v3_4_0\I7191_InstallSubmissionHelpDefaults
{
protected string $CONTEXT_TABLE = 'presses';
protected string $CONTEXT_SETTINGS_TABLE = 'press_settings';
protected string $CONTEXT_COLUMN = 'press_id';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I7191_SubmissionChecklistMigration.inc.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 I7191_SubmissionChecklistMigration
* @brief Migrate the submissionChecklist setting from an array to a HTML string
*/

namespace APP\migration\upgrade\v3_4_0;

class I7191_SubmissionChecklistMigration extends \PKP\migration\upgrade\v3_4_0\I7191_SubmissionChecklistMigration
{
protected string $CONTEXT_SETTINGS_TABLE = 'press_settings';
protected string $CONTEXT_COLUMN = 'press_id';
}
5 changes: 5 additions & 0 deletions classes/migration/upgrade/v3_4_0/PreflightCheckMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ protected function getContextKeyField(): string
{
return 'press_id';
}

protected function getContextSettingsTable(): string
{
return 'press_settings';
}
}
Loading