From 10c757970f8d398c0055b90efee437111a519310 Mon Sep 17 00:00:00 2001 From: Blesilda Ramirez Date: Mon, 7 Oct 2024 23:26:53 +0800 Subject: [PATCH] pkp/pkp-lib#10444 Remove titleIcon and instead add modalStyle param the to Modal classes --- classes/form/FormBuilderVocabulary.php | 1 + classes/linkAction/request/AjaxModal.php | 6 +++--- classes/linkAction/request/ConfirmationModal.php | 7 +++---- .../request/JsEventConfirmationModal.php | 7 +++---- classes/linkAction/request/Modal.php | 16 ++++++++-------- .../request/RedirectConfirmationModal.php | 7 +++---- .../request/RemoteActionConfirmationModal.php | 6 +++--- 7 files changed, 24 insertions(+), 26 deletions(-) diff --git a/classes/form/FormBuilderVocabulary.php b/classes/form/FormBuilderVocabulary.php index e13b7420976..67c99a5811e 100644 --- a/classes/form/FormBuilderVocabulary.php +++ b/classes/form/FormBuilderVocabulary.php @@ -239,6 +239,7 @@ public function smartyFBVFormButtons($params, $smarty) 'FBV_cancelUrlTarget' => $params['cancelUrlTarget'] ?? '', 'FBV_translate' => $params['translate'] ?? true, 'FBV_saveText' => $params['saveText'] ?? null, + 'FBV_modalStyle' => $params['modalStyle'] ?? null, ]); return $smarty->fetch('form/formButtons.tpl'); } diff --git a/classes/linkAction/request/AjaxModal.php b/classes/linkAction/request/AjaxModal.php index 1b5779c8671..fc403890189 100644 --- a/classes/linkAction/request/AjaxModal.php +++ b/classes/linkAction/request/AjaxModal.php @@ -25,7 +25,7 @@ class AjaxModal extends Modal * * @param string $url The URL of the AJAX resource to load into the modal. * @param string $title (optional) The localized modal title. - * @param string $titleIcon (optional) The icon to be used in the modal title bar. + * @param string $modalStyle (optional) The modal state/style to be used. * @param bool $canClose (optional) Whether the modal will have a close button. * @param string $closeOnFormSuccessId (optional) Close the modal when the * form with this id fires a formSuccess event. @@ -35,12 +35,12 @@ class AjaxModal extends Modal public function __construct( $url, $title = null, - $titleIcon = null, + $modalStyle = 'default', $canClose = true, $closeOnFormSuccessId = null, $closeCleanVueInstances = [] ) { - parent::__construct($title, $titleIcon, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances); + parent::__construct($title, $modalStyle, $canClose, $closeOnFormSuccessId, $closeCleanVueInstances); $this->_url = $url; } diff --git a/classes/linkAction/request/ConfirmationModal.php b/classes/linkAction/request/ConfirmationModal.php index 056335431a6..e5da007b65a 100644 --- a/classes/linkAction/request/ConfirmationModal.php +++ b/classes/linkAction/request/ConfirmationModal.php @@ -41,8 +41,7 @@ class ConfirmationModal extends Modal * @param string $dialogText The localized text to appear * in the dialog modal. * @param string $title (optional) The localized modal title. - * @param string $titleIcon (optional) The icon to be used - * in the modal title bar. + * @param string $modalStyle (optional) The modal state/style to be used. * @param string $okButton (optional) The localized text to * appear on the confirmation button. * @param string $cancelButton (optional) The localized text to @@ -50,10 +49,10 @@ class ConfirmationModal extends Modal * @param bool $canClose (optional) Whether the modal will * have a close button. */ - public function __construct($dialogText, $title = null, $titleIcon = 'modal_confirm', $okButton = null, $cancelButton = null, $canClose = true) + public function __construct($dialogText, $title = null, $modalStyle = 'default', $okButton = null, $cancelButton = null, $canClose = true) { $title = (is_null($title) ? __('common.confirm') : $title); - parent::__construct($title, $titleIcon, $canClose); + parent::__construct($title, $modalStyle, $canClose); $this->_okButton = (is_null($okButton) ? __('common.ok') : $okButton); $this->_cancelButton = (is_null($cancelButton) ? __('common.cancel') : $cancelButton); diff --git a/classes/linkAction/request/JsEventConfirmationModal.php b/classes/linkAction/request/JsEventConfirmationModal.php index 6581268d0f4..2776be30d2e 100644 --- a/classes/linkAction/request/JsEventConfirmationModal.php +++ b/classes/linkAction/request/JsEventConfirmationModal.php @@ -33,8 +33,7 @@ class JsEventConfirmationModal extends ConfirmationModal * @param string $event the name of the JS event. * @param array $extraArguments (optional) extra information to be passed as JSON data with the event. * @param string $title (optional) The localized modal title. - * @param string $titleIcon (optional) The icon to be used - * in the modal title bar. + * @param string $modalStyle (optional) The modal state/style to be used. * @param string $okButton (optional) The localized text to * appear on the confirmation button. * @param string $cancelButton (optional) The localized text to @@ -42,9 +41,9 @@ class JsEventConfirmationModal extends ConfirmationModal * @param bool $canClose (optional) Whether the modal will * have a close button. */ - public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) + public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true) { - parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose); + parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose); $this->_event = $event; $this->_extraArguments = $extraArguments; diff --git a/classes/linkAction/request/Modal.php b/classes/linkAction/request/Modal.php index 7c1e98c7040..51566cfef56 100644 --- a/classes/linkAction/request/Modal.php +++ b/classes/linkAction/request/Modal.php @@ -25,7 +25,7 @@ class Modal extends LinkActionRequest public $_title; /** @var string The icon to be displayed in the title bar. */ - public $_titleIcon; + public $_modalStyle; /** @var bool Whether the modal has a close icon in the title bar. */ public $_canClose; @@ -43,7 +43,7 @@ class Modal extends LinkActionRequest * Constructor * * @param string $title (optional) The localized modal title. - * @param string $titleIcon (optional) The icon to be used in the modal title bar. + * @param string $modalStyle (optional) The modal state/style to be used. * @param bool $canClose (optional) Whether the modal will have a close button. * @param string $closeOnFormSuccessId (optional) Close the modal when the * form with this id fires a formSuccess event. @@ -52,14 +52,14 @@ class Modal extends LinkActionRequest */ public function __construct( $title = null, - $titleIcon = null, + $modalStyle = null, $canClose = true, $closeOnFormSuccessId = null, $closeCleanVueInstances = [] ) { parent::__construct(); $this->_title = $title; - $this->_titleIcon = $titleIcon; + $this->_modalStyle = $modalStyle; $this->_canClose = $canClose; $this->_closeOnFormSuccessId = $closeOnFormSuccessId; $this->_closeCleanVueInstances = $closeCleanVueInstances; @@ -82,13 +82,13 @@ public function getTitle() } /** - * Get the title bar icon. + * Get the modal style. * * @return string */ - public function getTitleIcon() + public function getModalStyle() { - return $this->_titleIcon; + return $this->_modalStyle; } /** @@ -128,7 +128,7 @@ public function getLocalizedOptions() { return [ 'title' => $this->getTitle(), - 'titleIcon' => $this->getTitleIcon(), + 'modalStyle' => $this->getModalStyle(), 'canClose' => ($this->getCanClose() ? '1' : '0'), 'closeOnFormSuccessId' => $this->_closeOnFormSuccessId, 'closeCleanVueInstances' => $this->_closeCleanVueInstances, diff --git a/classes/linkAction/request/RedirectConfirmationModal.php b/classes/linkAction/request/RedirectConfirmationModal.php index 601478c8aec..4fff6e71214 100644 --- a/classes/linkAction/request/RedirectConfirmationModal.php +++ b/classes/linkAction/request/RedirectConfirmationModal.php @@ -28,8 +28,7 @@ class RedirectConfirmationModal extends ConfirmationModal * @param string $title (optional) The localized modal title. * @param string $remoteUrl (optional) A URL to be * redirected to when the confirmation button is clicked. - * @param string $titleIcon (optional) The icon to be used - * in the modal title bar. + * @param string $modalStyle (optional) The modal state/style to be used. * @param string $okButton (optional) The localized text to * appear on the confirmation button. * @param string $cancelButton (optional) The localized text to @@ -37,9 +36,9 @@ class RedirectConfirmationModal extends ConfirmationModal * @param bool $canClose (optional) Whether the modal will * have a close button. */ - public function __construct($dialogText, $title = null, $remoteUrl = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) + public function __construct($dialogText, $title = null, $remoteUrl = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true) { - parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose); + parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose); $this->_remoteUrl = $remoteUrl; } diff --git a/classes/linkAction/request/RemoteActionConfirmationModal.php b/classes/linkAction/request/RemoteActionConfirmationModal.php index 2504cc42fa4..17038dc01a6 100644 --- a/classes/linkAction/request/RemoteActionConfirmationModal.php +++ b/classes/linkAction/request/RemoteActionConfirmationModal.php @@ -32,7 +32,7 @@ class RemoteActionConfirmationModal extends ConfirmationModal * @param string $title (optional) The localized modal title. * @param string $remoteAction (optional) A URL to be * called when the confirmation button is clicked. - * @param string $titleIcon (optional) The icon to be used + * @param string $modalStyle (optional) The modal state/style to be used. * in the modal title bar. * @param string $okButton (optional) The localized text to * appear on the confirmation button. @@ -41,9 +41,9 @@ class RemoteActionConfirmationModal extends ConfirmationModal * @param bool $canClose (optional) Whether the modal will * have a close button. */ - public function __construct($session, $dialogText, $title = null, $remoteAction = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) + public function __construct($session, $dialogText, $title = null, $remoteAction = null, $modalStyle = null, $okButton = null, $cancelButton = null, $canClose = true) { - parent::__construct($dialogText, $title, $titleIcon, $okButton, $cancelButton, $canClose); + parent::__construct($dialogText, $title, $modalStyle, $okButton, $cancelButton, $canClose); $this->_remoteAction = $remoteAction; $this->_csrfToken = $session->token();