Page controller is immutable
authorAlexander Ebert <ebert@woltlab.com>
Mon, 2 May 2016 15:41:40 +0000 (17:41 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 2 May 2016 15:41:40 +0000 (17:41 +0200)
wcfsetup/install/files/acp/templates/pageAdd.tpl
wcfsetup/install/files/lib/acp/form/PageAddForm.class.php
wcfsetup/install/files/lib/acp/form/PageEditForm.class.php

index a0cd7f35e2f4f9e9421fe231b480c8b814d813bd..e2b36d87aed0101107585303293692ad676659fc 100644 (file)
                        </dd>
                </dl>
                
-               <dl{if $errorField == 'controller'} class="formError"{/if}>
-                       <dt><label for="controller">{lang}wcf.acp.page.controller{/lang}</label></dt>
-                       <dd>
-                               <input type="text" id="controller" name="controller" value="{$controller}" class="long"{if $action == 'edit' && $page->originIsSystem} readonly="readonly"{/if} />
-                               {if $errorField == 'controller'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}
-                                                       {lang}wcf.global.form.error.empty{/lang}
-                                               {else}
-                                                       {lang}wcf.acp.page.controller.error.{@$errorType}{/lang}
-                                               {/if}
-                                       </small>
-                               {/if}
-                       </dd>
-               </dl>
-               
                {if !$isMultilingual}
                        <dl{if $errorField == 'customURL'} class="formError"{/if}>
                                <dt><label for="customURL">{lang}wcf.acp.page.customURL{/lang}</label></dt>
index 335258b476372215fe19aab9972763c37d01bb2a..4342fe47fd0ed67556d03a8f6cd0bf3cf21b1ea3 100644 (file)
@@ -102,12 +102,6 @@ class PageAddForm extends AbstractForm {
         */
        public $customURL = [];
        
-       /**
-        * page controller
-        * @var string
-        */
-       public $controller = '';
-       
        /**
         * page titles
         * @var string[]
@@ -192,7 +186,6 @@ class PageAddForm extends AbstractForm {
                if (isset($_POST['isDisabled'])) $this->isDisabled = 1;
                if (isset($_POST['isLandingPage'])) $this->isLandingPage = 1;
                if (isset($_POST['applicationPackageID'])) $this->applicationPackageID = intval($_POST['applicationPackageID']);
-               if (isset($_POST['controller'])) $this->controller = StringUtil::trim($_POST['controller']);
                
                if (isset($_POST['customURL']) && is_array($_POST['customURL'])) $this->customURL = ArrayUtil::trim($_POST['customURL']);
                if (isset($_POST['title']) && is_array($_POST['title'])) $this->title = ArrayUtil::trim($_POST['title']);
@@ -216,8 +209,6 @@ class PageAddForm extends AbstractForm {
                
                $this->validateApplicationPackageID();
                
-               $this->validateController();
-               
                $this->validateCustomUrl();
                
                $this->validateBoxIDs();
@@ -237,6 +228,8 @@ class PageAddForm extends AbstractForm {
        
        /**
         * Validates page type.
+        * 
+        * @throws      UserInputException
         */
        protected function validatePageType() {
                if (!in_array($this->pageType, Page::$availablePageTypes) || $this->pageType == 'system') {
@@ -250,6 +243,8 @@ class PageAddForm extends AbstractForm {
        
        /**
         * Validates parent page id.
+        * 
+        * @throws      UserInputException
         */
        protected function validateParentPageID() {
                if ($this->parentPageID) {
@@ -262,6 +257,8 @@ class PageAddForm extends AbstractForm {
        
        /**
         * Validates package id.
+        * 
+        * @throws      UserInputException
         */
        protected function validateApplicationPackageID() {
                if (!isset($this->availableApplications[$this->applicationPackageID])) {
@@ -269,23 +266,10 @@ class PageAddForm extends AbstractForm {
                }
        }
        
-       /**
-        * Validates controller.
-        */
-       protected function validateController() {
-               if ($this->pageType == 'system') {
-                       if (!$this->controller) {
-                               throw new UserInputException('controller');
-                       }
-                       
-                       if (!class_exists($this->controller)) {
-                               throw new UserInputException('controller', 'notFound');
-                       }
-               }
-       }
-       
        /**
         * Validates custom urls.
+        * 
+        * @throws      UserInputException
         */
        protected function validateCustomUrl() {
                foreach ($this->customURL as $type => $customURL) {
@@ -297,6 +281,8 @@ class PageAddForm extends AbstractForm {
        
        /**
         * Validates box ids.
+        * 
+        * @throws      UserInputException
         */
        protected function validateBoxIDs() {
                foreach ($this->boxIDs as $boxID) {
@@ -383,7 +369,6 @@ class PageAddForm extends AbstractForm {
                        'lastUpdateTime' => TIME_NOW,
                        'isMultilingual' => $this->isMultilingual,
                        'identifier' => '',
-                       'controller' => $this->controller,
                        'packageID' => 1
                ]), 'content' => $content, 'boxToPage' => $this->getBoxToPage()]);
                
@@ -437,7 +422,6 @@ class PageAddForm extends AbstractForm {
                        'isLandingPage' => $this->isLandingPage,
                        'isMultilingual' => $this->isMultilingual,
                        'applicationPackageID' => $this->applicationPackageID,
-                       'controller' => $this->controller,
                        'customURL' => $this->customURL,
                        'title' => $this->title,
                        'content' => $this->content,
index b0c1d27a8d661c47ea4d09a074e6ea7ba205db85..4b53f7cb67b70e64a65c589e1f093b438902cc3a 100644 (file)
@@ -11,7 +11,7 @@ use wcf\system\WCF;
  * Shows the page add form.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage acp.form
@@ -38,6 +38,8 @@ class PageEditForm extends PageAddForm {
        
        /**
         * @inheritDoc
+        * 
+        * @throws      IllegalLinkException
         */
        public function readParameters() {
                parent::readParameters();
@@ -67,7 +69,6 @@ class PageEditForm extends PageAddForm {
                if ($this->page->originIsSystem) {
                        $this->parentPageID = $this->page->parentPageID;
                        $this->applicationPackageID = $this->page->applicationPackageID;
-                       $this->controller = $this->page->controller;
                }
                
                if ($this->page->requireObjectID) {
@@ -79,17 +80,17 @@ class PageEditForm extends PageAddForm {
        /**
         * @inheritDoc
         */
-       protected function validatePageType() {
-               // type is immutable
+       protected function validateName() {
+               if (mb_strtolower($this->name) != mb_strtolower($this->page->name)) {
+                       parent::validateName();
+               }
        }
        
        /**
         * @inheritDoc
         */
-       protected function validateName() {
-               if (mb_strtolower($this->name) != mb_strtolower($this->page->name)) {
-                       parent::validateName();
-               }
+       protected function validatePageType() {
+               // type is immutable
        }
        
        /**
@@ -167,7 +168,6 @@ class PageEditForm extends PageAddForm {
                        $this->parentPageID = $this->page->parentPageID;
                        $this->pageType = $this->page->pageType;
                        $this->applicationPackageID = $this->page->applicationPackageID;
-                       $this->controller = $this->page->controller;
                        if ($this->page->controllerCustomURL) $this->customURL[0] = $this->page->controllerCustomURL;
                        if ($this->page->isLandingPage) $this->isLandingPage = 1;
                        if ($this->page->isDiabled) $this->isDisabled = 1;