From: Alexander Ebert Date: Thu, 19 Oct 2017 17:52:25 +0000 (+0200) Subject: Improved display of custom URLs X-Git-Tag: 3.1.0_Beta_2~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e40c37828a72252e4ac63a5df82d7799f3684a47;p=GitHub%2FWoltLab%2FWCF.git Improved display of custom URLs --- diff --git a/wcfsetup/install/files/acp/templates/pageList.tpl b/wcfsetup/install/files/acp/templates/pageList.tpl index e2407f095f..337abd66e1 100644 --- a/wcfsetup/install/files/acp/templates/pageList.tpl +++ b/wcfsetup/install/files/acp/templates/pageList.tpl @@ -76,6 +76,7 @@
+
@@ -99,6 +100,7 @@ {if $applicationPackageID}{capture append=linkParameters}&applicationPackageID={@$applicationPackageID}{/capture}{/if} {if $pageType}{capture append=linkParameters}&pageType={@$pageType|rawurlencode}{/capture}{/if} {if $originIsNotSystem}{capture append=linkParameters}&originIsNotSystem=1{/capture}{/if} + {if $controllerCustomURL}{capture append=linkParameters}&controllerCustomURL=1{/capture}{/if} {pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"} {/content} @@ -147,6 +149,9 @@ {if $page->isLandingPage} {/if}{$page->name} {$page->getDisplayLink()} + {if $page->controllerCustomURL} + + {/if} {lang}wcf.acp.page.type.{@$page->pageType}{/lang} {@$page->lastUpdateTime|time} diff --git a/wcfsetup/install/files/lib/acp/page/PageListPage.class.php b/wcfsetup/install/files/lib/acp/page/PageListPage.class.php index 676aadc887..2af4496862 100644 --- a/wcfsetup/install/files/lib/acp/page/PageListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PageListPage.class.php @@ -98,6 +98,12 @@ class PageListPage extends SortablePage { */ public $originIsNotSystem = 0; + /** + * filters the list of pages showing only pages with custom urls + * @var boolean + */ + public $controllerCustomURL = 0; + /** * @inheritDoc */ @@ -111,6 +117,7 @@ class PageListPage extends SortablePage { if (!empty($_REQUEST['pageType'])) $this->pageType = $_REQUEST['pageType']; if (!empty($_REQUEST['showPageAddDialog'])) $this->showPageAddDialog = 1; if (!empty($_REQUEST['originIsNotSystem'])) $this->originIsNotSystem = 1; + if (!empty($_REQUEST['controllerCustomURL'])) $this->controllerCustomURL = 1; // get available applications $applicationList = new ApplicationList(); @@ -142,6 +149,9 @@ class PageListPage extends SortablePage { if ($this->originIsNotSystem) { $this->objectList->getConditionBuilder()->add('page.originIsSystem = ?', [0]); } + if ($this->controllerCustomURL) { + $this->objectList->getConditionBuilder()->add("page.controllerCustomURL <> ''"); + } } /** @@ -159,7 +169,8 @@ class PageListPage extends SortablePage { 'availableApplications' => $this->availableApplications, 'availableLanguages' => LanguageFactory::getInstance()->getLanguages(), 'showPageAddDialog' => $this->showPageAddDialog, - 'originIsNotSystem' => $this->originIsNotSystem + 'originIsNotSystem' => $this->originIsNotSystem, + 'controllerCustomURL' => $this->controllerCustomURL ]); } } diff --git a/wcfsetup/install/files/lib/data/page/Page.class.php b/wcfsetup/install/files/lib/data/page/Page.class.php index 12286bb8cd..630a6b887c 100644 --- a/wcfsetup/install/files/lib/data/page/Page.class.php +++ b/wcfsetup/install/files/lib/data/page/Page.class.php @@ -179,7 +179,16 @@ class Page extends DatabaseObject implements ILinkableObject, ITitledObject { * @return string */ public function getDisplayLink() { - return preg_replace('~^https?://~', '', $this->getLink()); + $link = preg_replace('~^https?://~', '', $this->getLink()); + if ($this->controllerCustomURL) { + $link = preg_replace('~(index\.php\?)[^/]+/$~', "\$1{$this->controllerCustomURL}/", $link); + } + + if (URL_OMIT_INDEX_PHP) { + $link = str_replace('index.php?', '', $link); + } + + return $link; } /**