Some minor updates
authorAlexander Ebert <ebert@woltlab.com>
Sat, 28 Nov 2015 20:14:00 +0000 (21:14 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 28 Nov 2015 20:14:09 +0000 (21:14 +0100)
wcfsetup/install/files/acp/templates/pageList.tpl
wcfsetup/install/files/lib/acp/form/PageAddForm.class.php
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php
wcfsetup/setup/db/install.sql

index c07d846767d00d79bf2c5c74b48f9b71bc9a744e..4c8851ec5c7f8b03014ec3f7a45024bdc9ae7299 100644 (file)
                                        <tr class="jsPageRow">
                                                <td class="columnIcon">
                                                        {if $page->canDisable()}
-                                                               <span class="icon icon16 icon-check{if $page->isDisabled}-empty{/if} jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$page->pageID}"></span>
+                                                               <span class="icon icon16 fa-{if !$page->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$page->pageID}"></span>
                                                        {else}
-                                                               <span class="icon icon16 icon-check{if $page->isDisabled}-empty{/if} disabled" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}"></span>
+                                                               <span class="icon icon16 fa-{if !$page->isDisabled}check-{/if}square-o disabled" title="{lang}wcf.global.button.{if !$page->isDisabled}disable{else}enable{/if}{/lang}"></span>
                                                        {/if}
-                                                       <a href="{link controller='PageEdit' id=$page->pageID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 icon-pencil"></span></a>
+                                                       <a href="{link controller='PageEdit' id=$page->pageID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
                                                        {if $page->canDelete()}
-                                                               <span class="icon icon16 icon-remove jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$page->pageID}" data-confirm-message="{lang}wcf.acp.page.delete.confirmMessage{/lang}"></span>
+                                                               <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$page->pageID}" data-confirm-message="{lang}wcf.acp.page.delete.confirmMessage{/lang}"></span>
                                                        {else}
-                                                               <span class="icon icon16 icon-remove disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
+                                                               <span class="icon icon16 fa-times disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
                                                        {/if}
                                                        
                                                        {event name='rowButtons'}
                                                </td>
                                                <td class="columnID columnPageID">{@$page->pageID}</td>
                                                <td class="columnTitle columnName"><a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->displayName}</a></td>
-                                               <td class="columnText columnCustomURL">{$page->customURL}</td>
+                                               <td class="columnText columnCustomURL">{$page->controllerCustomURL}</td>
                                                <td class="columnDate columnLastUpdateTime">{@$page->lastUpdateTime|time}</td>
                                                
                                                {event name='columns'}
index e64c3f8c4880c18da1b38520b51bbd2ab299c5fc..c90d5d66a00ece8f557327a782223dd9c1a0e049 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\acp\form;
+use wcf\data\application\Application;
 use wcf\data\application\ApplicationList;
 use wcf\data\page\Page;
 use wcf\data\page\PageAction;
@@ -8,6 +9,7 @@ use wcf\data\page\PageNodeTree;
 use wcf\form\AbstractForm;
 use wcf\system\exception\UserInputException;
 use wcf\system\language\LanguageFactory;
+use wcf\system\request\RouteHandler;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 use wcf\util\StringUtil;
@@ -31,7 +33,7 @@ class PageAddForm extends AbstractForm {
        /**
         * @see \wcf\page\AbstractPage::$neededPermissions
         */
-       public $neededPermissions = array('admin.content.cms.canManagePage');
+       public $neededPermissions = ['admin.content.cms.canManagePage'];
        
        /**
         * true if created page is multi-lingual
@@ -71,39 +73,39 @@ class PageAddForm extends AbstractForm {
        
        /**
         * list of available applications (standalone packages)
-        * @var array<\wcf\data\application\Application>
+        * @var Application[]
         */
-       public $availableApplications = array();
+       public $availableApplications = [];
        
        /**
         * page custom URL
         * @var array<string>
         */
-       public $customURL = array();
+       public $customURL = [];
        
        /**
         * page titles
         * @var array<string>
         */
-       public $title = array();
+       public $title = [];
        
        /**
         * page contents
         * @var array<string>
         */
-       public $content = array();
+       public $content = [];
        
        /**
         * page meta descriptions
         * @var array<string>
         */
-       public $metaDescription = array();
+       public $metaDescription = [];
        
        /**
         * page meta keywords
         * @var array<string>
         */
-       public $metaKeywords = array();
+       public $metaKeywords = [];
        
        /**
         * @see \wcf\page\IPage::readParameters()
@@ -149,6 +151,8 @@ class PageAddForm extends AbstractForm {
                $this->validateParentPageID();
                
                $this->validatePackageID();
+               
+               $this->validateCustomUrl();
        }
        
        protected function validateDisplayName() {
@@ -175,35 +179,43 @@ class PageAddForm extends AbstractForm {
                }
        }
        
+       protected function validateCustomUrl() {
+               foreach ($this->customURL as $type => $customURL) {
+                       if (!empty($customURL) && !RouteHandler::isValidCustomUrl($customURL)) {
+                               throw new UserInputException('customURL_' . $type, 'invalid');
+                       }
+               }
+       }
+       
        /**
         * @see \wcf\form\IForm::save()
         */
        public function save() {
                parent::save();
                
-               $content = array();
+               $content = [];
                if ($this->isMultilingual) {
                        foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
-                               $content[$language->languageID] = array(
+                               $content[$language->languageID] = [
                                        'customURL' => (!empty($_POST['customURL'][$language->languageID]) ? $_POST['customURL'][$language->languageID] : ''),
                                        'title' => (!empty($_POST['title'][$language->languageID]) ? $_POST['title'][$language->languageID] : ''),
                                        'content' => (!empty($_POST['content'][$language->languageID]) ? $_POST['content'][$language->languageID] : ''),
                                        'metaDescription' => (!empty($_POST['metaDescription'][$language->languageID]) ? $_POST['metaDescription'][$language->languageID] : ''),
                                        'metaKeywords' => (!empty($_POST['metaKeywords'][$language->languageID]) ? $_POST['metaKeywords'][$language->languageID] : '')
-                               );
+                               ];
                        }
                }
                else {
-                       $content[0] = array(
+                       $content[0] = [
                                'customURL' => (!empty($_POST['customURL'][0]) ? $_POST['customURL'][0] : ''),
                                'title' => (!empty($_POST['title'][0]) ? $_POST['title'][0] : ''),
                                'content' => (!empty($_POST['content'][0]) ? $_POST['content'][0] : ''),
                                'metaDescription' => (!empty($_POST['metaDescription'][0]) ? $_POST['metaDescription'][0] : ''),
                                'metaKeywords' => (!empty($_POST['metaKeywords'][0]) ? $_POST['metaKeywords'][0] : '')
-                       );
+                       ];
                }
                
-               $this->objectAction = new PageAction(array(), 'create', array('data' => array_merge($this->additionalFields, array(
+               $this->objectAction = new PageAction([], 'create', ['data' => array_merge($this->additionalFields, [
                        'parentPageID' => ($this->parentPageID ?: null),
                        'displayName' => $this->displayName,
                        'isDisabled' => ($this->isDisabled) ? 1 : 0,
@@ -212,13 +224,13 @@ class PageAddForm extends AbstractForm {
                        'lastUpdateTime' => TIME_NOW,
                        'isMultilingual' => $this->isMultilingual,
                        'name' => ''
-               )), 'content' => $content));
+               ]), 'content' => $content]);
                $returnValues = $this->objectAction->executeAction();
                // set generic page name
                $pageEditor = new PageEditor($returnValues['returnValues']);
-               $pageEditor->update(array(
+               $pageEditor->update([
                        'name' => 'com.woltlab.wcf.generic'.$pageEditor->pageID
-               ));
+               ]);
                
                // call saved event
                $this->saved();
@@ -230,7 +242,7 @@ class PageAddForm extends AbstractForm {
                $this->parentPageID = $this->isDisabled = $this->isLandingPage = 0;
                $this->packageID = 1;
                $this->displayName = '';
-               $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = array();
+               $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = [];
        }
        
        /**
@@ -241,7 +253,7 @@ class PageAddForm extends AbstractForm {
                
                $pageNodeList = new PageNodeTree();
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'action' => 'add',
                        'parentPageID' => $this->parentPageID,
                        'displayName' => $this->displayName,
@@ -257,6 +269,6 @@ class PageAddForm extends AbstractForm {
                        'availableApplications' => $this->availableApplications,
                        'availableLanguages' => LanguageFactory::getInstance()->getLanguages(),
                        'pageNodeList' => $pageNodeList->getNodeList()
-               ));
+               ]);
        }
 }
index 22c9c6b3c4974ba353d6fea1701d091f3e136f8d..3d856b0b16bd6af6b72951d2bd6accb406f3b899 100644 (file)
@@ -45,7 +45,7 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                WCF::getDB()->beginTransaction();
                foreach ($items as $item) {
                        $statement->execute([
-                               $item['attributes']['name'],
+                               $item['attributes']['identifier'],
                                $this->installation->getPackageID()
                        ]);
                }
@@ -93,7 +93,7 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        $content = [];
                        foreach ($data['elements']['content'] as $language => $contentData) {
                                if (!RouteHandler::isValidCustomUrl($contentData['customurl'])) {
-                                       throw new SystemException("Invalid custom url for page content '" . $language . "', page identifier '" . $data['attributes']['name'] . "'");
+                                       throw new SystemException("Invalid custom url for page content '" . $language . "', page identifier '" . $data['attributes']['identifier'] . "'");
                                }
                                
                                $content[$language] = [
@@ -132,7 +132,7 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        $statement->execute([$data['elements']['parent']]);
                        $row = $statement->fetchSingleRow();
                        if ($row === false) {
-                               throw new SystemException("Unknown parent page '" . $data['elements']['parent'] . "' for page identifier '" . $data['attributes']['name'] . "'");
+                               throw new SystemException("Unknown parent page '" . $data['elements']['parent'] . "' for page identifier '" . $data['attributes']['identifier'] . "'");
                        }
                        
                        $parentPageID = $row['pageID'];
@@ -140,7 +140,7 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                
                $customUrl = ($isStatic || empty($data['elements']['customurl'])) ? '' : $data['elements']['customurl'];
                if ($customUrl && !RouteHandler::isValidCustomUrl($customUrl)) {
-                       throw new SystemException("Invalid custom url for page identifier '" . $data['attributes']['name'] . "'");
+                       throw new SystemException("Invalid custom url for page identifier '" . $data['attributes']['identifier'] . "'");
                }
                
                return [
@@ -148,7 +148,10 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        'controller' => ($isStatic) ? '' : $data['elements']['controller'],
                        'controllerCustomURL' => $customUrl,
                        'displayName' => $displayName,
-                       'name' => $data['attributes']['name'],
+                       'identifier' => $data['attributes']['identifier'],
+                       'isMultilingual' => ($isStatic) ? 1 : 0,
+                       'lastUpdateTime' => TIME_NOW,
+                       'originIsSystem' => 1,
                        'parentPageID' => $parentPageID
                ];
        }
@@ -162,7 +165,7 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        WHERE   name = ?
                                AND packageID = ?";
                $parameters = array(
-                       $data['name'],
+                       $data['identifier'],
                        $this->installation->getPackageID()
                );
                
index 4a9f74b3b077fa9c3cc1ad646298daa20e081051..15fead56ee6ffaa0f274b5a2b1abf0b08b58563b 100644 (file)
@@ -823,7 +823,7 @@ DROP TABLE IF EXISTS wcf1_page;
 CREATE TABLE wcf1_page (
        pageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
        parentPageID INT(10),
-       name VARCHAR(255) NOT NULL,
+       identifier VARCHAR(255) NOT NULL,
        displayName VARCHAR(255) NOT NULL,
        isDisabled TINYINT(1) NOT NULL DEFAULT 0,
        isLandingPage TINYINT(1) NOT NULL DEFAULT 0,