<h1 class="contentTitle">{lang}wcf.acp.page.list{/lang}</h1>
</header>
+<form method="post" action="{link controller='PageList'}{/link}">
+ <section class="section">
+ <h2 class="sectionTitle">{lang}wcf.global.filter{/lang}</h2>
+
+ <div class="row rowColGap">
+ <dl class="col-xs-12 col-md-4">
+ <dt><label for="name">{lang}wcf.global.name{/lang}</label></dt>
+ <dd>
+ <input type="text" id="name" name="name" value="{$name}" class="long" />
+ </dd>
+ </dl>
+
+ <dl class="col-xs-12 col-md-4">
+ <dt><label for="pageTitle">{lang}wcf.acp.page.title{/lang}</label></dt>
+ <dd>
+ <input type="text" id="pageTitle" name="title" value="{$title}" class="long" />
+ </dd>
+ </dl>
+
+ <dl class="col-xs-12 col-md-4">
+ <dt><label for="pageContent">{lang}wcf.acp.page.content{/lang}</label></dt>
+ <dd>
+ <input type="text" id="pageContent" name="content" value="{$content}" class="long" />
+ </dd>
+ </dl>
+
+ {event name='filterFields'}
+ </div>
+ </section>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ {@SECURITY_TOKEN_INPUT_TAG}
+ </div>
+</form>
+
<div class="contentNavigation">
- {pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+ {assign var='linkParameters' value=''}
+ {if $name}{capture append=linkParameters}&name={@$name|rawurlencode}{/capture}{/if}
+ {if $title}{capture append=linkParameters}&title={@$title|rawurlencode}{/capture}{/if}
+ {if $content}{capture append=linkParameters}&content={@$content|rawurlencode}{/capture}{/if}
+ {pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
<nav>
<ul>
<table class="table">
<thead>
<tr>
- <th class="columnPageID{if $sortField == 'pageID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=pageID&sortOrder={if $sortField == 'pageID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
- <th class="columnTitle columnName{if $sortField == 'name'} active {@$sortOrder}{/if}"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=name&sortOrder={if $sortField == 'name' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.name{/lang}</a></th>
+ <th class="columnPageID{if $sortField == 'pageID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=pageID&sortOrder={if $sortField == 'pageID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+ <th class="columnTitle columnName{if $sortField == 'name'} active {@$sortOrder}{/if}"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=name&sortOrder={if $sortField == 'name' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.name{/lang}</a></th>
<th class="columnText columnURL">{lang}wcf.acp.page.url{/lang}</th>
- <th class="columnDate columnLastUpdateTime{if $sortField == 'lastUpdateTime'} active {@$sortOrder}{/if}"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=lastUpdateTime&sortOrder={if $sortField == 'lastUpdateTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.page.lastUpdateTime{/lang}</a></th>
+ <th class="columnDate columnLastUpdateTime{if $sortField == 'lastUpdateTime'} active {@$sortOrder}{/if}"><a href="{link controller='PageList'}pageNo={@$pageNo}&sortField=lastUpdateTime&sortOrder={if $sortField == 'lastUpdateTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.acp.page.lastUpdateTime{/lang}</a></th>
{event name='columnHeads'}
</tr>
{else}
<span class="icon icon16 fa-times disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
{/if}
+ {if !$page->requireObjectID}
+ <a href="{$page->getLink()}" title="{lang}wcf.acp.page.button.viewPage{/lang}" class="jsTooltip"><span class="icon icon16 fa-search"></span></a>
+ {else}
+ <span class="icon icon16 fa-search disabled" title="{lang}wcf.acp.page.button.viewPage{/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->name}</a></td>
- <td class="columnText columnURL">{$page->getURL()}</td>
+ <td class="columnTitle columnName">{if $page->isLandingPage}<span class="icon icon16 fa-home jsTooltip" title="{lang}wcf.acp.page.isLandingPage{/lang}"></span> {/if}<a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->name}</a></td>
+ <td class="columnText columnURL">
+ <span class="badge label">{$page->getApplication()->getAbbreviation()}</span>
+ {$page->getDisplayLink()}
+ </td>
<td class="columnDate columnLastUpdateTime">{@$page->lastUpdateTime|time}</td>
{event name='columns'}
<?php
namespace wcf\acp\page;
use wcf\page\SortablePage;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
/**
* Shows a list of pages.
*/
class PageListPage extends SortablePage {
/**
- * @see \wcf\page\AbstractPage::$activeMenuItem
+ * @inheritdoc
*/
public $activeMenuItem = 'wcf.acp.menu.link.cms.page.list';
/**
- * @see \wcf\page\MultipleLinkPage::$objectListClassName
+ * @inheritdoc
*/
public $objectListClassName = 'wcf\data\page\PageList';
/**
- * @see \wcf\page\AbstractPage::$neededPermissions
+ * @inheritdoc
*/
public $neededPermissions = array('admin.content.cms.canManagePage');
/**
- * @see \wcf\page\SortablePage::$defaultSortField
+ * @inheritdoc
*/
public $defaultSortField = 'name';
/**
- * @see \wcf\page\SortablePage::$validSortFields
+ * @inheritdoc
*/
public $validSortFields = array('pageID', 'name', 'lastUpdateTime');
+
+ /**
+ * name
+ * @var string
+ */
+ public $name = '';
+
+ /**
+ * title
+ * @var string
+ */
+ public $title = '';
+
+ /**
+ * content
+ * @var string
+ */
+ public $content = '';
+
+ /**
+ * @inheritdoc
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (!empty($_REQUEST['name'])) $this->name = StringUtil::trim($_REQUEST['name']);
+ if (!empty($_REQUEST['title'])) $this->title = StringUtil::trim($_REQUEST['title']);
+ if (!empty($_REQUEST['content'])) $this->content = StringUtil::trim($_REQUEST['content']);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ protected function initObjectList() {
+ parent::initObjectList();
+
+ if (!empty($this->name)) {
+ $this->objectList->getConditionBuilder()->add('page.name LIKE ?', array('%'.$this->name.'%'));
+ }
+ if (!empty($this->title)) {
+ $this->objectList->getConditionBuilder()->add('page.pageID IN (SELECT pageID FROM wcf'.WCF_N.'_page_content WHERE title LIKE ?)', array('%'.$this->title.'%'));
+ }
+ if (!empty($this->content)) {
+ $this->objectList->getConditionBuilder()->add('page.pageID IN (SELECT pageID FROM wcf'.WCF_N.'_page_content WHERE content LIKE ?)', array('%'.$this->content.'%'));
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'name' => $this->name,
+ 'title' => $this->title,
+ 'content' => $this->content
+ ));
+ }
}
}
if ($this->pageID) {
- return $this->getPage()->getURL();
+ return $this->getPage()->getLink();
}
else {
return $this->externalURL;
<?php
namespace wcf\data\page;
+use wcf\data\application\Application;
use wcf\data\DatabaseObject;
+use wcf\system\application\ApplicationHandler;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
*
* @return string
*/
- public function getURL() {
+ public function getLink() {
if ($this->controller) {
// todo
$controllerParts = explode('\\', $this->controller);
$controllerName = preg_replace('/(page|action|form)$/i', '', $controllerName);
return LinkHandler::getInstance()->getLink($controllerName, [
- 'application' => $controllerParts[0]
+ 'application' => $controllerParts[0],
+ 'forceFrontend' => true
]);
}
else {
}
}
+ /**
+ * Returns shortened link for acp page list.
+ *
+ * @return string
+ */
+ public function getDisplayLink() {
+ return str_replace($this->getApplication()->getPageURL(), '', $this->getLink());
+ }
+
+ /**
+ * Returns the application of this page.
+ *
+ * @return \wcf\data\application\Application
+ */
+ public function getApplication() {
+ return ApplicationHandler::getInstance()->getApplicationByID($this->packageID);
+ }
+
/**
* Returns the associated page handler or null.
*
/**
* Returns the page's internal name.
- *
- * @return string
+ *
+ * @return string
*/
public function __toString() {
return $this->name;
}
return $this->getLink($data['controller'], [
- 'application' => $data['application']
+ 'application' => $data['application'],
+ 'forceFrontend' => true
]);
}
}