From 808efb518315a1cdd535ece097099bfe4ad9a89a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 19 Nov 2018 17:51:28 +0100 Subject: [PATCH] Missing form checkbox to disable boxes See #2613 --- wcfsetup/install/files/acp/templates/boxAdd.tpl | 6 ++++++ .../install/files/lib/acp/form/BoxAddForm.class.php | 11 ++++++++++- .../install/files/lib/acp/form/BoxEditForm.class.php | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/acp/templates/boxAdd.tpl b/wcfsetup/install/files/acp/templates/boxAdd.tpl index 00eca56b4c..92daa062b4 100644 --- a/wcfsetup/install/files/acp/templates/boxAdd.tpl +++ b/wcfsetup/install/files/acp/templates/boxAdd.tpl @@ -173,6 +173,12 @@ +
+
+
+ +
+
{if $boxType === 'system'} diff --git a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php index 960fee2357..79de4462e9 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php @@ -194,6 +194,12 @@ class BoxAddForm extends AbstractForm { */ public $availableBoxPositions = []; + /** + * @var bool + * @since 3.2 + */ + public $isDisabled = 0; + /** * @inheritDoc */ @@ -272,6 +278,7 @@ class BoxAddForm extends AbstractForm { if (isset($_POST['visibleEverywhere'])) $this->visibleEverywhere = intval($_POST['visibleEverywhere']); if (isset($_POST['cssClassName'])) $this->cssClassName = StringUtil::trim($_POST['cssClassName']); if (isset($_POST['showHeader'])) $this->showHeader = intval($_POST['showHeader']); + if (isset($_POST['isDisabled'])) $this->isDisabled = 1; if (isset($_POST['pageIDs']) && is_array($_POST['pageIDs'])) $this->pageIDs = ArrayUtil::toIntegerArray($_POST['pageIDs']); if (isset($_POST['linkType'])) $this->linkType = $_POST['linkType']; @@ -491,6 +498,7 @@ class BoxAddForm extends AbstractForm { 'lastUpdateTime' => TIME_NOW, 'cssClassName' => $this->cssClassName, 'showHeader' => $this->showHeader, + 'isDisabled' => $this->isDisabled ? 1 : 0, 'linkPageID' => $this->linkPageID, 'linkPageObjectID' => $this->linkPageObjectID ?: 0, 'externalURL' => $this->externalURL, @@ -532,7 +540,7 @@ class BoxAddForm extends AbstractForm { // reset variables $this->cssClassName = $this->name = ''; $this->position = 'contentTop'; - $this->showOrder = $this->boxControllerID = 0; + $this->showOrder = $this->boxControllerID = $this->isDisabled = 0; $this->visibleEverywhere = $this->showHeader = 1; $this->title = $this->content = $this->images = $this->imageID = $this->pageIDs = $this->aclValues = []; $this->boxController = null; @@ -554,6 +562,7 @@ class BoxAddForm extends AbstractForm { 'showOrder' => $this->showOrder, 'visibleEverywhere' => $this->visibleEverywhere, 'showHeader' => $this->showHeader, + 'isDisabled' => $this->isDisabled, 'title' => $this->title, 'content' => $this->content, 'imageID' => $this->imageID, diff --git a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php index 937e6c8fc1..61766a95f0 100644 --- a/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php @@ -109,6 +109,7 @@ class BoxEditForm extends BoxAddForm { 'lastUpdateTime' => TIME_NOW, 'cssClassName' => $this->cssClassName, 'showHeader' => $this->showHeader, + 'isDisabled' => $this->isDisabled ? 1 : 0, 'linkPageID' => $this->linkPageID, 'linkPageObjectID' => $this->linkPageObjectID ?: 0, 'externalURL' => $this->externalURL @@ -178,6 +179,8 @@ class BoxEditForm extends BoxAddForm { $this->boxControllerID = $this->box->objectTypeID; if ($this->box->showHeader) $this->showHeader = 1; else $this->showHeader = 0; + if ($this->box->isDisabled) $this->isDisabled = 1; + else $this->isDisabled = 0; if ($this->box->visibleEverywhere) $this->visibleEverywhere = 1; else $this->visibleEverywhere = 0; $this->pageIDs = $this->box->getPageIDs(); -- 2.20.1