/**
* Initializes the WCF.ACP.Style.List class.
- *
- * @param integer count
- * @param integer pageNo
*/
- init: function(count, pageNo) {
+ init: function() {
this._proxy = new WCF.Action.Proxy({
success: $.proxy(this._success, this)
});
var self = this;
$button.click(function() { self._click($languageItemID); });
}, this));
-
- count = ~~count;
- if (count > 100) {
- this._createPagination(count, pageNo);
- }
- },
-
- /**
- * Creates a pagination for current search result.
- *
- * @param integer count
- * @param integer pageNo
- */
- _createPagination: function(count, pageNo) {
- var navs = [];
-
- // pagination top
- var contentNavigation = $('<div class="paginationTop"><nav class="pagination" /></div>').insertBefore($('.section.sectionContainerList'));
- navs.push(contentNavigation[0].children[0]);
-
- // pagination bottom
- contentNavigation = $('<div class="paginationBottom"><nav class="pagination" /></div>').prependTo($('.contentFooter'));
- navs.push(contentNavigation[0].children[0]);
-
- navs.forEach(function(nav) {
- $(nav).wcfPages({
- activePage: parseInt(pageNo) || 1,
- maxPage: Math.ceil(count / 100)
- }).on('wcfpagesswitched', function(event, data) {
- var $form = $('#languageItemSearchForm');
- $('<input type="hidden" name="pageNo" value="' + data.activePage + '" />').appendTo($form);
- $form.submit();
- });
- });
},
/**
<script data-relocate="true">
//<![CDATA[
$(function() {
- new WCF.ACP.Language.ItemList({@$count}, {@$pageNo});
+ new WCF.ACP.Language.ItemList();
});
//]]>
</script>
<dl class="col-xs-12 col-md-4">
<dt></dt>
<dd>
- <select name="id" id="languageID">
+ <select name="languageID" id="languageID">
<option value="0">{lang}wcf.user.language{/lang}</option>
{foreach from=$availableLanguages item=availableLanguage}
<option value="{@$availableLanguage->languageID}"{if $availableLanguage->languageID == $languageID} selected{/if}>{$availableLanguage->languageName} ({$availableLanguage->languageCode})</option>
<dd>
<input type="text" id="languageItemValue" name="languageItemValue" value="{$languageItemValue}" placeholder="{lang}wcf.acp.language.item.value{/lang}" class="long">
<label><input type="checkbox" name="hasCustomValue" value="1"{if $hasCustomValue == 1} checked{/if}> {lang}wcf.acp.language.item.customValues{/lang}</label>
+ <label><input type="checkbox" name="hasDisabledCustomValue" value="1"{if $hasDisabledCustomValue == 1} checked{/if}> {lang}wcf.acp.language.item.disabledCustomValues{/lang}</label>
</dd>
</dl>
</section>
</form>
+{hascontent}
+ <div class="paginationTop">
+ {content}
+ {assign var='linkParameters' value=''}
+ {if $languageID}{capture append=linkParameters}&languageID={@$languageID}{/capture}{/if}
+ {if $languageCategoryID}{capture append=linkParameters}&languageCategoryID={@$languageCategoryID}{/capture}{/if}
+ {if $languageItem}{capture append=linkParameters}&languageItem={@$languageItem|rawurlencode}{/capture}{/if}
+ {if $languageItemValue}{capture append=linkParameters}&languageItemValue={@$languageItemValue|rawurlencode}{/capture}{/if}
+ {if $hasCustomValue}{capture append=linkParameters}&hasCustomValue=1{/capture}{/if}
+
+ {pages print=true assign=pagesLinks controller="LanguageItemList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
+ {/content}
+ </div>
+{/hascontent}
+
{if $objects|count}
- <div class="section sectionContainerList">
- <ol class="containerList">
- {foreach from=$objects item=item}
- <li>
- <div>
- <div class="details">
- <div class="containerHeadline">
- <h3><a class="jsLanguageItem" data-language-item-id="{@$item->languageItemID}">{$item->languageItem}</a>{if $item->languageCustomItemValue !== null} <span class="icon icon16 fa-bookmark jsTooltip" title="{lang}wcf.acp.language.item.hasCustomValue{/lang}"></span>{/if}</h3>
- </div>
-
- <p class="containerContent">{if $item->languageUseCustomValue}{$item->languageCustomItemValue|truncate:255}{else}{$item->languageItemValue|truncate:255}{/if}</p>
- </div>
- </div>
- </li>
- {/foreach}
- </ol>
+ <div class="section tabularBox">
+ <table class="table">
+ <thead>
+ <tr>
+ <th class="columnTitle columnLanguageItem{if $sortField == 'languageItem'} active {@$sortOrder}{/if}"><a href="{link controller='LanguageItemList'}pageNo={@$pageNo}&sortField=languageItem&sortOrder={if $sortField == 'languageItem' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.name{/lang}</a></th>
+ <th class="columnText columnLanguageItemValue">{lang}wcf.acp.language.item.value{/lang}</th>
+ <th class="columnText columnLanguageCustomItemValue">{lang}wcf.acp.language.item.customValue{/lang}</th>
+
+ {event name='columnHeads'}
+ </tr>
+ </thead>
+
+ <tbody>
+ {foreach from=$objects item=item}
+ <tr>
+ <td class="columnTitle columnLanguageItem"><a class="jsLanguageItem" data-language-item-id="{@$item->languageItemID}">{$item->languageItem}</a></td>
+ <td class="columnText columnLanguageItemValue">{$item->languageItemValue|truncate:255}</td>
+ <td class="columnText columnLanguageCustomItemValue">{if !$item->languageUseCustomValue}<s>{/if}{$item->languageCustomItemValue|truncate:255}{if !$item->languageUseCustomValue}</s>{/if}</td>
+
+ {event name='columns'}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
</div>
<footer class="contentFooter">
+ {hascontent}
+ <div class="paginationBottom">
+ {content}{@$pagesLinks}{/content}
+ </div>
+ {/hascontent}
+
{hascontent}
<nav class="contentFooterNavigation">
<ul>
{content}
-
-
- {event name='contentFooterNavigation'}
+ {event name='contentFooterNavigation'}
{/content}
</ul>
</nav>
<td class="columnID columnLanguageID">{@$language->languageID}</td>
<td class="columnTitle columnLanguageName"><a href="{link controller='LanguageEdit' id=$language->languageID}{/link}">{$language->languageName} ({@$language->languageCode})</a></td>
<td class="columnDigits columnUsers">{#$language->users}</td>
- <td class="columnDigits columnVariables"><a href="{link controller='LanguageItemList' id=$language->languageID}{/link}">{#$language->variables}</a></td>
- <td class="columnDigits columnCustomVariables">{if $language->customVariables > 0}<a href="{link controller='LanguageItemList' id=$language->languageID}hasCustomValue=1{/link}">{#$language->customVariables}</a>{else}{#$language->customVariables}{/if}</td>
+ <td class="columnDigits columnVariables"><a href="{link controller='LanguageItemList'}languageID={@$language->languageID}{/link}">{#$language->variables}</a></td>
+ <td class="columnDigits columnCustomVariables">{if $language->customVariables > 0}<a href="{link controller='LanguageItemList'}languageID={@$language->languageID}&hasCustomValue=1{/link}">{#$language->customVariables}</a>{else}{#$language->customVariables}{/if}</td>
{event name='columns'}
</tr>
{hascontent}
<div class="paginationTop">
{content}
- {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}
- {if $applicationPackageID}{capture append=linkParameters}&applicationPackageID={@$applicationPackageID}{/capture}{/if}
- {if $pageType}{capture append=linkParameters}&pageType={@$pageType|rawurlencode}{/capture}{/if}
-
- {pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
+ {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}
+ {if $applicationPackageID}{capture append=linkParameters}&applicationPackageID={@$applicationPackageID}{/capture}{/if}
+ {if $pageType}{capture append=linkParameters}&pageType={@$pageType|rawurlencode}{/capture}{/if}
+
+ {pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
{/content}
</div>
{/hascontent}
namespace wcf\acp\page;
use wcf\data\language\category\LanguageCategoryList;
use wcf\data\language\item\LanguageItemList;
-use wcf\page\AbstractPage;
+use wcf\page\SortablePage;
use wcf\system\language\LanguageFactory;
use wcf\system\WCF;
use wcf\util\StringUtil;
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Acp\Page
*/
-class LanguageItemListPage extends AbstractPage {
+class LanguageItemListPage extends SortablePage {
/**
* @inheritDoc
*/
public $activeMenuItem = 'wcf.acp.menu.link.language.item.list';
/**
- * number of matching phrases
- * @var integer
+ * @inheritDoc
*/
- public $count = 0;
+ public $neededPermissions = ['admin.language.canManageLanguage'];
/**
* @inheritDoc
*/
- public $neededPermissions = ['admin.language.canManageLanguage'];
+ public $itemsPerPage = 100;
+
+ /**
+ * @inheritDoc
+ */
+ public $validSortFields = ['languageItem'];
/**
- * language item list
- * @var \wcf\data\language\item\LanguageItemList
+ * @inheritDoc
*/
- public $languageItemList = null;
+ public $defaultSortField = 'languageItem';
/**
* language id
*/
public $hasCustomValue = 0;
+ /**
+ * search for disabled custom values
+ * @var boolean
+ */
+ public $hasDisabledCustomValue = 0;
+
/**
* available languages
* @var array
*/
public $availableLanguageCategories = [];
- /**
- * current page no
- * @var integer
- */
- public $pageNo = 1;
-
/**
* @inheritDoc
*/
public function readParameters() {
parent::readParameters();
- if (isset($_REQUEST['id'])) $this->languageID = intval($_REQUEST['id']);
+ if (isset($_REQUEST['languageID'])) $this->languageID = intval($_REQUEST['languageID']);
if (isset($_REQUEST['languageCategoryID'])) $this->languageCategoryID = intval($_REQUEST['languageCategoryID']);
if (isset($_REQUEST['languageItem'])) $this->languageItem = StringUtil::trim($_REQUEST['languageItem']);
if (isset($_REQUEST['languageItemValue'])) $this->languageItemValue = $_REQUEST['languageItemValue'];
if (!empty($_REQUEST['hasCustomValue'])) $this->hasCustomValue = 1;
- if (isset($_REQUEST['pageNo'])) $this->pageNo = intval($_REQUEST['pageNo']);
+ if (!empty($_REQUEST['hasDisabledCustomValue'])) $this->hasDisabledCustomValue = 1;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ protected function initObjectList() {
+ $this->objectList = new LanguageItemList();
+ $this->objectList->getConditionBuilder()->add('languageID = ?', [$this->languageID]);
+ if ($this->languageCategoryID) $this->objectList->getConditionBuilder()->add('languageCategoryID = ?', [$this->languageCategoryID]);
+ if ($this->languageItem) $this->objectList->getConditionBuilder()->add('languageItem LIKE ?', ['%'.$this->languageItem.'%']);
+ if ($this->languageItemValue) $this->objectList->getConditionBuilder()->add('((languageUseCustomValue = 0 AND languageItemValue LIKE ?) OR languageCustomItemValue LIKE ?)', ['%'.$this->languageItemValue.'%', '%'.$this->languageItemValue.'%']);
+ if ($this->hasCustomValue || $this->hasDisabledCustomValue) $this->objectList->getConditionBuilder()->add("languageCustomItemValue IS NOT NULL");
+ if ($this->hasDisabledCustomValue) $this->objectList->getConditionBuilder()->add("languageUseCustomValue = ?", [0]);
}
/**
* @inheritDoc
*/
public function readData() {
- parent::readData();
-
// get languages
$this->availableLanguages = LanguageFactory::getInstance()->getLanguages();
$this->languageCategoryID = 0;
}
- // get items
- $this->languageItemList = new LanguageItemList();
- $this->languageItemList->getConditionBuilder()->add('languageID = ?', [$this->languageID]);
- if ($this->languageCategoryID) $this->languageItemList->getConditionBuilder()->add('languageCategoryID = ?', [$this->languageCategoryID]);
- if ($this->languageItem) $this->languageItemList->getConditionBuilder()->add('languageItem LIKE ?', ['%'.$this->languageItem.'%']);
- if ($this->languageItemValue) $this->languageItemList->getConditionBuilder()->add('((languageUseCustomValue = 0 AND languageItemValue LIKE ?) OR languageCustomItemValue LIKE ?)', ['%'.$this->languageItemValue.'%', '%'.$this->languageItemValue.'%']);
- if ($this->hasCustomValue) $this->languageItemList->getConditionBuilder()->add("languageCustomItemValue IS NOT NULL");
- $this->languageItemList->sqlLimit = 100;
-
- if (!empty($_POST)) {
- $this->count = $this->languageItemList->countObjects();
- $maxPages = ceil($this->count / 100);
- $this->pageNo = max(min($this->pageNo, $maxPages), 1);
-
- if ($this->pageNo > 1) {
- $this->languageItemList->sqlOffset = ($this->pageNo - 1) * 100;
- }
- }
-
- $this->languageItemList->readObjects();
+ parent::readData();
}
/**
parent::assignVariables();
WCF::getTPL()->assign([
- 'objects' => $this->languageItemList,
- 'count' => $this->count,
- 'pageNo' => $this->pageNo,
'languageID' => $this->languageID,
'languageCategoryID' => $this->languageCategoryID,
'languageItem' => $this->languageItem,
'languageItemValue' => $this->languageItemValue,
'hasCustomValue' => $this->hasCustomValue,
+ 'hasDisabledCustomValue' => $this->hasDisabledCustomValue,
'availableLanguages' => $this->availableLanguages,
'availableLanguageCategories' => $this->availableLanguageCategories
]);
<item name="wcf.acp.language.item.value"><![CDATA[Inhalt]]></item>
<item name="wcf.acp.language.item.customValue"><![CDATA[Eigener Inhalt]]></item>
<item name="wcf.acp.language.item.useCustomValue"><![CDATA[Eigene Version verwenden]]></item>
- <item name="wcf.acp.language.item.hasCustomValue"><![CDATA[Inhalte mit eigener Version]]></item>
<item name="wcf.acp.language.item.customValues"><![CDATA[Veränderte Inhalte finden]]></item>
+ <item name="wcf.acp.language.item.disabledCustomValues"><![CDATA[Deaktivierte veränderte Inhalte finden]]></item>
<item name="wcf.acp.language.name.description"><![CDATA[Name der Sprache]]></item>
<item name="wcf.acp.language.add.source.description"><![CDATA[Die ausgewählte Sprache wird als Vorlage benutzt. Alle Sprachvariablen werden in die neue Sprache kopiert.]]></item>
</category>
<item name="wcf.acp.language.item.value"><![CDATA[Content]]></item>
<item name="wcf.acp.language.item.customValue"><![CDATA[Custom Value]]></item>
<item name="wcf.acp.language.item.useCustomValue"><![CDATA[Use custom value]]></item>
- <item name="wcf.acp.language.item.hasCustomValue"><![CDATA[Phrases with custom values]]></item>
<item name="wcf.acp.language.item.customValues"><![CDATA[Customized values]]></item>
+ <item name="wcf.acp.language.item.disabledCustomValues"><![CDATA[Disabled customized values]]></item>
<item name="wcf.acp.language.name.description"><![CDATA[Language Name]]></item>
<item name="wcf.acp.language.add.source.description"><![CDATA[The selected language will be used as origin, all phrases will be copied into the new language.]]></item>
</category>