Skip to content

Commit

Permalink
pkp/pkp-lib#10671 3.5 compatibility and formatting (pkp#63)
Browse files Browse the repository at this point in the history
* pkp/pkp-lib#10671 3.5 compatibility and formatting

* pkp/pkp-lib#10671 update contrib names and locale

* remove reference to OTS
  • Loading branch information
kaitlinnewson authored Feb 4, 2025
1 parent ea39a1d commit 9585658
Show file tree
Hide file tree
Showing 5 changed files with 813 additions and 701 deletions.
112 changes: 59 additions & 53 deletions OAIJatsSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,86 @@
/**
* @file OAIJatsSettingsForm.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2003-2022 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class OAIJatsSettingsForm
* @ingroup plugins_generic_webFeed
*
* @brief Form for managers to modify web feeds plugin settings
* @brief Form for managers to modify JATS Metadata Format plugin settings
*/

namespace APP\plugins\oaiMetadataFormats\oaiJats;

use APP\template\TemplateManager;
use PKP\form\Form;
use PKP\form\validation\FormValidatorPost;
use PKP\form\validation\FormValidatorCSRF;
use PKP\plugins\Plugin;

class OAIJatsSettingsForm extends \PKP\form\Form {
class OAIJatsSettingsForm extends Form
{
/** @var int|null Associated context ID */
private ?int $contextId;

/** @var int Associated context ID */
private $_contextId;
private Plugin $plugin;

/** @var WebFeedPlugin Web feed plugin */
private $_plugin;
/**
* Constructor
* @param Plugin $plugin
* @param int|null $contextId Context ID
*/
public function __construct($plugin, $contextId)
{
$this->contextId = $contextId;
$this->plugin = $plugin;

/**
* Constructor
* @param $plugin WebFeedPlugin Web feed plugin
* @param $contextId int Context ID
*/
function __construct($plugin, $contextId) {
$this->_contextId = $contextId;
$this->_plugin = $plugin;
parent::__construct($plugin->getTemplateResource('settingsForm.tpl'));
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}

parent::__construct($plugin->getTemplateResource('settingsForm.tpl'));
$this->addCheck(new FormValidatorPost($this));
$this->addCheck(new FormValidatorCSRF($this));
}
/**
* Initialize form data.
*/
public function initData()
{
$contextId = $this->contextId;
$plugin = $this->plugin;

/**
* Initialize form data.
*/
function initData() {
$contextId = $this->_contextId;
$plugin = $this->_plugin;
$this->setData('forceJatsTemplate', $plugin->getSetting($contextId, 'forceJatsTemplate'));
}

$this->setData('forceJatsTemplate', $plugin->getSetting($contextId, 'forceJatsTemplate'));
}
/**
* Assign form data to user-submitted data.
*/
public function readInputData()
{
$this->readUserVars(['forceJatsTemplate']);
}

/**
* Assign form data to user-submitted data.
*/
function readInputData() {
$this->readUserVars(['forceJatsTemplate']);
}
/**
* Fetch the form.
* @copydoc Form::fetch()
*/
public function fetch($request, $template = null, $display = false)
{
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('pluginName', $this->plugin->getName());
return parent::fetch($request, $template, $display);
}

/**
* Fetch the form.
* @copydoc Form::fetch()
*/
function fetch($request, $template = null, $display = false) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('pluginName', $this->_plugin->getName());
return parent::fetch($request, $template, $display);
}
/**
* @copydoc Form::execute()
*/
public function execute(...$functionArgs)
{
$plugin = $this->plugin;
$contextId = $this->contextId;

/**
* @copydoc Form::execute()
*/
function execute(...$functionArgs) {
$plugin = $this->_plugin;
$contextId = $this->_contextId;
$plugin->updateSetting($contextId, 'forceJatsTemplate', $this->getData('forceJatsTemplate'));

$plugin->updateSetting($contextId, 'forceJatsTemplate', $this->getData('forceJatsTemplate'));

parent::execute(...$functionArgs);
}
parent::execute(...$functionArgs);
}
}
Loading

0 comments on commit 9585658

Please sign in to comment.