first commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/tab/pubIds/form/PublicIdentifiersForm.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class PublicIdentifiersForm
|
||||
*
|
||||
* @ingroup controllers_tab_pubIds_form
|
||||
*
|
||||
* @brief Displays a pub ids form.
|
||||
*/
|
||||
|
||||
namespace APP\controllers\tab\pubIds\form;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\facades\Repo;
|
||||
use APP\issue\Issue;
|
||||
use APP\issue\IssueGalley;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\controllers\tab\pubIds\form\PKPPublicIdentifiersForm;
|
||||
use PKP\galley\Galley;
|
||||
use PKP\plugins\PluginRegistry;
|
||||
|
||||
class PublicIdentifiersForm extends PKPPublicIdentifiersForm
|
||||
{
|
||||
/**
|
||||
* @copydoc Form::fetch()
|
||||
*
|
||||
* @param null|mixed $template
|
||||
*/
|
||||
public function fetch($request, $template = null, $display = false)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$enablePublisherId = (array) $request->getContext()->getData('enablePublisherId');
|
||||
$templateMgr->assign([
|
||||
'enablePublisherId' => ($this->getPubObject() instanceof Galley && in_array('galley', $enablePublisherId)) ||
|
||||
($this->getPubObject() instanceof Issue && in_array('issue', $enablePublisherId)) ||
|
||||
($this->getPubObject() instanceof IssueGalley && in_array('issueGalley', $enablePublisherId)),
|
||||
]);
|
||||
|
||||
return parent::fetch($request, $template, $display);
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc Form::execute()
|
||||
*/
|
||||
public function execute(...$functionArgs)
|
||||
{
|
||||
parent::execute(...$functionArgs);
|
||||
$pubObject = $this->getPubObject();
|
||||
if ($pubObject instanceof Issue) {
|
||||
Repo::issue()->edit($pubObject, []);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear issue objects pub ids.
|
||||
*
|
||||
* @param string $pubIdPlugInClassName
|
||||
*/
|
||||
public function clearIssueObjectsPubIds($pubIdPlugInClassName)
|
||||
{
|
||||
$pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
|
||||
foreach ($pubIdPlugins as $pubIdPlugin) {
|
||||
$classNameParts = explode('\\', get_class($pubIdPlugin)); // Separate namespace info from class name
|
||||
if (end($classNameParts) == $pubIdPlugInClassName) {
|
||||
$pubIdPlugin->clearIssueObjectsPubIds($this->getPubObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc PKPPublicIdentifiersForm::getAssocType()
|
||||
*/
|
||||
public function getAssocType($pubObject)
|
||||
{
|
||||
if ($pubObject instanceof Issue) {
|
||||
return Application::ASSOC_TYPE_ISSUE;
|
||||
}
|
||||
return parent::getAssocType($pubObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/tab/workflow/ReviewRoundTabHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewRoundTabHandler
|
||||
*
|
||||
* @ingroup controllers_tab_workflow
|
||||
*
|
||||
* @brief Handle AJAX operations for review round tabs on review stages workflow pages.
|
||||
*/
|
||||
|
||||
namespace APP\controllers\tab\workflow;
|
||||
|
||||
use PKP\controllers\tab\workflow\PKPReviewRoundTabHandler;
|
||||
use PKP\security\authorization\WorkflowStageAccessPolicy;
|
||||
use PKP\security\Role;
|
||||
|
||||
class ReviewRoundTabHandler extends PKPReviewRoundTabHandler
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->addRoleAssignment(
|
||||
[Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_ASSISTANT],
|
||||
['externalReviewRound']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Extended methods from Handler
|
||||
//
|
||||
/**
|
||||
* @copydoc PKPHandler::authorize()
|
||||
*/
|
||||
public function authorize($request, &$args, $roleAssignments)
|
||||
{
|
||||
$stageId = (int) $request->getUserVar('stageId'); // This is validated in WorkflowStageAccessPolicy.
|
||||
|
||||
$this->addPolicy(new WorkflowStageAccessPolicy($request, $args, $roleAssignments, 'submissionId', $stageId));
|
||||
|
||||
return parent::authorize($request, $args, $roleAssignments);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file controllers/tab/workflow/WorkflowTabHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class WorkflowTabHandler
|
||||
*
|
||||
* @ingroup controllers_tab_workflow
|
||||
*
|
||||
* @brief Handle AJAX operations for workflow tabs.
|
||||
*/
|
||||
|
||||
namespace APP\controllers\tab\workflow;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\notification\Notification;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\controllers\tab\workflow\PKPWorkflowTabHandler;
|
||||
use PKP\core\PKPApplication;
|
||||
use PKP\decision\DecisionType;
|
||||
use PKP\decision\types\NewExternalReviewRound;
|
||||
use PKP\linkAction\LinkAction;
|
||||
use PKP\linkAction\request\AjaxModal;
|
||||
use PKP\notification\PKPNotification;
|
||||
|
||||
class WorkflowTabHandler extends PKPWorkflowTabHandler
|
||||
{
|
||||
/**
|
||||
* @copydoc PKPWorkflowTabHandler::fetchTab
|
||||
*/
|
||||
public function fetchTab($args, $request)
|
||||
{
|
||||
$this->setupTemplate($request);
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE);
|
||||
$submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION);
|
||||
switch ($stageId) {
|
||||
case WORKFLOW_STAGE_ID_PRODUCTION:
|
||||
$dispatcher = $request->getDispatcher();
|
||||
$schedulePublicationLinkAction = new LinkAction(
|
||||
'schedulePublication',
|
||||
new AjaxModal(
|
||||
$dispatcher->url(
|
||||
$request,
|
||||
PKPApplication::ROUTE_COMPONENT,
|
||||
null,
|
||||
'tab.issueEntry.IssueEntryTabHandler',
|
||||
'publicationMetadata',
|
||||
null,
|
||||
['submissionId' => $submission->getId(), 'stageId' => $stageId]
|
||||
),
|
||||
__('submission.publication')
|
||||
),
|
||||
__('editor.submission.schedulePublication')
|
||||
);
|
||||
$templateMgr->assign('schedulePublicationLinkAction', $schedulePublicationLinkAction);
|
||||
break;
|
||||
}
|
||||
return parent::fetchTab($args, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all production notification options to be used in the production stage tab.
|
||||
*
|
||||
* @param int $submissionId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getProductionNotificationOptions($submissionId)
|
||||
{
|
||||
return [
|
||||
Notification::NOTIFICATION_LEVEL_NORMAL => [
|
||||
PKPNotification::NOTIFICATION_TYPE_VISIT_CATALOG => [Application::ASSOC_TYPE_SUBMISSION, $submissionId],
|
||||
PKPNotification::NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER => [Application::ASSOC_TYPE_SUBMISSION, $submissionId],
|
||||
PKPNotification::NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS => [Application::ASSOC_TYPE_SUBMISSION, $submissionId],
|
||||
],
|
||||
Notification::NOTIFICATION_LEVEL_TRIVIAL => []
|
||||
];
|
||||
}
|
||||
|
||||
protected function getNewReviewRoundDecisionType(int $stageId): DecisionType
|
||||
{
|
||||
// OJS only supports the external review stage
|
||||
return new NewExternalReviewRound();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user