1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Add language variables and add username to filter form if userID/issuerUserID is supplied.

This commit is contained in:
Maximilian Mader 2013-06-15 21:02:10 +02:00
parent 2ec2b17a7f
commit 3f26f6a263
3 changed files with 30 additions and 12 deletions

View File

@ -21,21 +21,21 @@
<dl> <dl>
<dt><label for="username">{lang}wcf.user.username{/lang}</label></dt> <dt><label for="username">{lang}wcf.user.username{/lang}</label></dt>
<dd> <dd>
<input type="text" id="username" name="username" class="long" value="{$filterUsername}" /> <input type="text" id="username" name="username" class="medium" value="{$filterUsername}" />
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt><label for="issuerUsername">{lang}wcf.acp.chat.issuer{/lang}</label></dt> <dt><label for="issuerUsername">{lang}chat.acp.suspension.issuer{/lang}</label></dt>
<dd> <dd>
<input type="text" id="issuerUsername" name="issuerUsername" class="long" value="{$filterIssuerUsername}" /> <input type="text" id="issuerUsername" name="issuerUsername" class="medium" value="{$filterIssuerUsername}" />
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt><label for="roomID">{lang}chat.general.room{/lang}</label></dt> <dt><label for="roomID">{lang}chat.general.room{/lang}</label></dt>
<dd> <dd>
<select name="roomID"> <select name="roomID" class="medium">
<option value="-1" {if $filterRoomID == -1}selected="selected"{/if}></option> <option value="-1" {if $filterRoomID == -1}selected="selected"{/if}></option>
<option value="0" {if $filterRoomID == 0}selected="selected"{/if}>{lang}chat.room.global{/lang}</option> <option value="0" {if $filterRoomID == 0}selected="selected"{/if}>{lang}chat.room.global{/lang}</option>
<option value="" disabled="disabled">&mdash;&mdash;&mdash;&mdash;</option> <option value="" disabled="disabled">&mdash;&mdash;&mdash;&mdash;</option>
@ -47,9 +47,9 @@
</dl> </dl>
<dl> <dl>
<dt><label for="searchTypeMute">{lang}wcf.acp.chat.suspensionType{/lang}</label></dt> <dt><label for="searchTypeMute">{lang}chat.acp.suspension.type{/lang}</label></dt>
<dd> <dd>
<select name="suspensionType" id="suspensionType"> <select name="suspensionType" id="suspensionType" class="medium">
<option value=""{if $filterSuspensionType == null}selected="selected"{/if}></option> <option value=""{if $filterSuspensionType == null}selected="selected"{/if}></option>
<option value="{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}"{if $filterSuspensionType == '\chat\data\suspension\Suspension::TYPE_MUTE'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}{/lang}</option> <option value="{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}"{if $filterSuspensionType == '\chat\data\suspension\Suspension::TYPE_MUTE'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}{/lang}</option>
<option value="{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}"{if $filterSuspensionType == '\chat\data\suspension\Suspension::TYPE_BAN'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}{/lang}</option> <option value="{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}"{if $filterSuspensionType == '\chat\data\suspension\Suspension::TYPE_BAN'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}{/lang}</option>
@ -67,7 +67,7 @@
{if $objects|count} {if $objects|count}
<div class="tabularBox tabularBoxTitle marginTop"> <div class="tabularBox tabularBoxTitle marginTop">
<header> <header>
<h2>{lang}wcf.acp.suspension.list{/lang} <span class="badge badgeInverse">{#$items}</span></h2> <h2>{lang}chat.acp.suspension.list{/lang} <span class="badge badgeInverse">{#$items}</span></h2>
</header> </header>
<table class="table"> <table class="table">
@ -76,10 +76,10 @@
<th class="columnID{if $sortField == 'suspensionID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=suspensionID&sortOrder={if $sortField == 'suspensionID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th> <th class="columnID{if $sortField == 'suspensionID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=suspensionID&sortOrder={if $sortField == 'suspensionID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
<th class="columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th> <th class="columnUsername{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th>
<th class="columnRoomID{if $sortField == 'roomID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=roomID&sortOrder={if $sortField == 'roomID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.general.room{/lang}</a></th> <th class="columnRoomID{if $sortField == 'roomID'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=roomID&sortOrder={if $sortField == 'roomID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.general.room{/lang}</a></th>
<th class="columnSuspensionType{if $sortField == 'suspensionType'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=suspensionType&sortOrder={if $sortField == 'suspensionType' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.suspensionType{/lang}</a></th> <th class="columnSuspensionType{if $sortField == 'suspensionType'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=suspensionType&sortOrder={if $sortField == 'suspensionType' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.acp.suspension.type{/lang}</a></th>
<th class="columnTime{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.time{/lang}</a></th> <th class="columnTime{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.general.time{/lang}</a></th>
<th class="columnExpires{if $sortField == 'expires'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=expires&sortOrder={if $sortField == 'expires' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.expires{/lang}</a></th> <th class="columnExpires{if $sortField == 'expires'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=expires&sortOrder={if $sortField == 'expires' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.general.expires{/lang}</a></th>
<th class="columnIssuer{if $sortField == 'issuer'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=issuer&sortOrder={if $sortField == 'issuer' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.chat.issuer{/lang}</a></th> <th class="columnIssuer{if $sortField == 'issuer'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=issuer&sortOrder={if $sortField == 'issuer' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.acp.suspension.issuer{/lang}</a></th>
</tr> </tr>
</thead> </thead>

View File

@ -91,15 +91,23 @@ class ChatSuspensionListPage extends \wcf\page\SortablePage {
public function readParameters() { public function readParameters() {
parent::readParameters(); parent::readParameters();
// get usernames
if (isset($_REQUEST['username']) && !empty($_REQUEST['username'])) $this->filterUsername = \wcf\util\StringUtil::trim($_REQUEST['username']); if (isset($_REQUEST['username']) && !empty($_REQUEST['username'])) $this->filterUsername = \wcf\util\StringUtil::trim($_REQUEST['username']);
if (isset($_REQUEST['issuerUsername']) && !empty($_REQUEST['issuerUsername'])) $this->filterIssuerUsername = \wcf\util\StringUtil::trim($_REQUEST['issuerUsername']); if (isset($_REQUEST['issuerUsername']) && !empty($_REQUEST['issuerUsername'])) $this->filterIssuerUsername = \wcf\util\StringUtil::trim($_REQUEST['issuerUsername']);
// get user IDs by username
if ($this->filterUsername != null) $this->filterUserID = \wcf\data\user\UserProfile::getUserProfileByUsername($this->filterUsername)->userID; if ($this->filterUsername != null) $this->filterUserID = \wcf\data\user\UserProfile::getUserProfileByUsername($this->filterUsername)->userID;
if ($this->filterIssuerUsername != null) $this->filterIssuerUserID = \wcf\data\user\UserProfile::getUserProfileByUsername($this->filterIssuerUsername)->userID; if ($this->filterIssuerUsername != null) $this->filterIssuerUserID = \wcf\data\user\UserProfile::getUserProfileByUsername($this->filterIssuerUsername)->userID;
if ($this->filterUserID === null && isset($_REQUEST['userID']) && !empty($_REQUEST['userID'])) $this->filterUserID = intval($_REQUEST['userID']); // get user IDs by request if no username was sent
if ($this->filterUserID === null && isset($_REQUEST['userID']) && !empty($_REQUEST['userID'])) $this->filterUserID = intval($_REQUEST['userID']);
if ($this->filterIssuerUserID === null && isset($_REQUEST['issuerUserID']) && !empty($_REQUEST['issuerUserID'])) $this->filterIssuerUserID = intval($_REQUEST['issuerUserID']); if ($this->filterIssuerUserID === null && isset($_REQUEST['issuerUserID']) && !empty($_REQUEST['issuerUserID'])) $this->filterIssuerUserID = intval($_REQUEST['issuerUserID']);
// get usernames by ID if no usernames were sent
if ($this->filterUsername === null) $this->filterUsername = \wcf\data\user\UserProfile::getUserProfile($this->filterUserID);
if ($this->filterIssuerUsername === null) $this->filterIssuerUsername = \wcf\data\user\UserProfile::getUserProfile($this->filterIssuerUserID);
// get room IDs by request
if (isset($_REQUEST['roomID']) && $_REQUEST['roomID'] != -1) $this->filterRoomID = intval($_REQUEST['roomID']); if (isset($_REQUEST['roomID']) && $_REQUEST['roomID'] != -1) $this->filterRoomID = intval($_REQUEST['roomID']);
if (isset($_REQUEST['suspensionType']) && !empty($_REQUEST['suspensionType'])) $this->filterSuspensionType = intval($_REQUEST['suspensionType']); if (isset($_REQUEST['suspensionType']) && !empty($_REQUEST['suspensionType'])) $this->filterSuspensionType = intval($_REQUEST['suspensionType']);
} }

View File

@ -11,10 +11,17 @@
<item name="chat.acp.room.delete.sure"><![CDATA[Wollen Sie den Raum „{$chatRoom}“ wirklich löschen?]]></item> <item name="chat.acp.room.delete.sure"><![CDATA[Wollen Sie den Raum „{$chatRoom}“ wirklich löschen?]]></item>
</category> </category>
<category name="chat.acp.suspension">
<item name="chat.acp.suspension.list"><![CDATA[Sanktionen]]></item>
<item name="chat.acp.suspension.type"><![CDATA[Art der Sanktion]]></item>
<item name="chat.acp.suspension.issuer"><![CDATA[Aussteller]]></item>
</category>
<category name="chat.acp.menu"> <category name="chat.acp.menu">
<item name="chat.acp.menu.link"><![CDATA[Chat]]></item> <item name="chat.acp.menu.link"><![CDATA[Chat]]></item>
<item name="chat.acp.menu.link.room.list"><![CDATA[Chaträume auflisten]]></item> <item name="chat.acp.menu.link.room.list"><![CDATA[Chaträume auflisten]]></item>
<item name="chat.acp.menu.link.room.add"><![CDATA[Chatraum hinzufügen]]></item> <item name="chat.acp.menu.link.room.add"><![CDATA[Chatraum hinzufügen]]></item>
<item name="chat.acp.menu.link.suspension.list"><![CDATA[Sperren auflisten]]></item>
</category> </category>
<category name="wcf.acp.group"> <category name="wcf.acp.group">
@ -68,6 +75,9 @@
</category> </category>
<category name="chat.general"> <category name="chat.general">
<item name="chat.general.expires"><![CDATA[Ablaufzeitpunkt]]></item>
<item name="chat.general.time"><![CDATA[Datum]]></item>
<item name="chat.general.title"><![CDATA[{lang}chat.header.menu.chat{/lang}]]></item> <item name="chat.general.title"><![CDATA[{lang}chat.header.menu.chat{/lang}]]></item>
<item name="chat.general.protocol"><![CDATA[Protokoll]]></item> <item name="chat.general.protocol"><![CDATA[Protokoll]]></item>