Missing form checkbox to disable boxes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 19 Nov 2018 16:51:28 +0000 (17:51 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 19 Nov 2018 16:51:28 +0000 (17:51 +0100)
See #2613

wcfsetup/install/files/acp/templates/boxAdd.tpl
wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php
wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php

index 00eca56b4ca9885993534b84bfbe7650cee69513..92daa062b4c0b6ab9651174218894f604c720a2b 100644 (file)
                                                <label><input type="checkbox" id="showHeader" name="showHeader" value="1"{if $showHeader} checked{/if}> {lang}wcf.acp.box.showHeader{/lang}</label>
                                        </dd>
                                </dl>
+                               <dl>
+                                       <dt></dt>
+                                       <dd>
+                                               <label><input type="checkbox" id="isDisabled" name="isDisabled" value="1"{if $isDisabled} checked{/if}> {lang}wcf.acp.box.isDisabled{/lang}</label>
+                                       </dd>
+                               </dl>
                        </div>
                        
                        {if $boxType === 'system'}
index 960fee235723fa346ea85209a1af28c3143fde5f..79de4462e9108e43933031120538f0a73376ca7c 100644 (file)
@@ -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,
index 937e6c8fc11db319f535304ec360f4e7d0733dde..61766a95f0b92491b904ee69cd07d9e39e4129b8 100644 (file)
@@ -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();