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

Improve suspension list

This commit is contained in:
Maximilian Mader 2013-06-22 16:31:08 +02:00
parent c6e146a038
commit bc56eac2e2
3 changed files with 64 additions and 20 deletions

View File

@ -19,6 +19,12 @@
<fieldset> <fieldset>
<legend>{lang}wcf.global.filter{/lang}</legend> <legend>{lang}wcf.global.filter{/lang}</legend>
<dl>
<dd>
<label><input type="checkbox" id="displayRevoked" name="displayRevoked" value="1"{if $displayRevoked} checked="checked"{/if} /> {lang}chat.acp.suspension.displayRevoked{/lang}</label>
</dd>
</dl>
<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>
@ -39,7 +45,7 @@
<select id="roomID" name="roomID"> <select id="roomID" name="roomID">
<option value="-1"{if $roomID == -1} selected="selected"{/if}></option> <option value="-1"{if $roomID == -1} selected="selected"{/if}></option>
<option value="0"{if $roomID == 0} selected="selected"{/if}>{lang}chat.room.global{/lang}</option> <option value="0"{if $roomID == 0} selected="selected"{/if}>{lang}chat.room.global{/lang}</option>
<option value="" disabled="disabled">&mdash;&mdash;&mdash;&mdash;</option> <option value="" disabled="disabled">-------------</option>
{foreach from=$availableRooms key=id item=room} {foreach from=$availableRooms key=id item=room}
<option value="{$id}" {if $roomID == $id}selected="selected"{/if}>{$room}</option> <option value="{$id}" {if $roomID == $id}selected="selected"{/if}>{$room}</option>
{/foreach} {/foreach}
@ -65,8 +71,16 @@
</div> </div>
</form> </form>
{capture assign=additionalParameters}{*
*}{if $userID}&userID={$userID}{/if}{*
*}{if $issuerUserID}&issuerUserID={$issuerUserID}{/if}{*
*}{if $roomID}&roomID={$roomID}{/if}{*
*}{if $suspensionType}&suspensionType={$suspensionType}{/if}{*
*}{if $displayRevoked}&displayRevoked={$displayRevoked}{/if}{*
*}{/capture}
<div class="contentNavigation"> <div class="contentNavigation">
{pages print=true assign=pagesLinks application="chat" controller="ChatSuspensionList" link="pageNo=%d&userID=$userID&issuerUserID=$issuerUserID&roomID=$roomID&suspensionType=$suspensionType"} {pages print=true assign=pagesLinks application="chat" controller="ChatSuspensionList" link="pageNo=%d$additionalParameters"}
</div> </div>
<div class="tabularBox tabularBoxTitle marginTop"> <div class="tabularBox tabularBoxTitle marginTop">
@ -77,28 +91,38 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<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}" colspan="2"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=suspensionID&sortOrder={if $sortField == 'suspensionID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$additionalParameters}{/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}{@$additionalParameters}{/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}{@$additionalParameters}{/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}chat.acp.suspension.type{/lang}</a></th> <th class="columnSuspensionType{if $sortField == 'type'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=type&sortOrder={if $sortField == 'type' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$additionalParameters}{/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}chat.general.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}{@$additionalParameters}{/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}chat.general.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}{@$additionalParameters}{/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}chat.acp.suspension.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}{@$additionalParameters}{/link}">{lang}chat.acp.suspension.issuer{/lang}</a></th>
<th class="columnMessage{if $sortField == 'reason'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=reason&sortOrder={if $sortField == 'reason' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}chat.acp.suspension.reason{/lang}</a></th> <th class="columnMessage{if $sortField == 'reason'} active {@$sortOrder}{/if}"><a href="{link application='chat' controller='ChatSuspensionList'}pageNo={@$pageNo}&sortField=reason&sortOrder={if $sortField == 'reason' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$additionalParameters}{/link}">{lang}chat.acp.suspension.reason{/lang}</a></th>
{event name='columnHeads'}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach from=$objects item=$suspension} {foreach from=$objects item=$suspension}
<tr> <tr class="jsSuspensionRow" data-object-id="{$suspension->suspensionID}">
<td class="columnIcon">
<span class="icon icon16 icon-undo{if $suspension->expires <= TIME_NOW} disabled{/if}" title="{lang}chat.acp.suspension.revoked{/lang}"></span>
{event name='rowButtons'}
</td>
<td id="columnID">{#$suspension->suspensionID}</td> <td id="columnID">{#$suspension->suspensionID}</td>
<td id="columnUsername"><a href="{link application='chat' controller='ChatSuspensionList'}userID={$suspension->userID}{/link}">{$suspension->username}</a></td> <td id="columnUsername"><a href="{link application='chat' controller='ChatSuspensionList'}userID={$suspension->userID}{/link}">{$suspension->username}</a></td>
<td id="columnRoomID"><a href="{link application='chat' controller='ChatSuspensionList'}roomID={if $suspension->roomID}{$suspension->roomID}{else}0{/if}{/link}">{if $suspension->roomID}{$suspension->roomTitle|language}{else}{lang}chat.room.global{/lang}{/if}</a></td> <td id="columnRoomID"><a href="{link application='chat' controller='ChatSuspensionList'}roomID={if $suspension->roomID}{$suspension->roomID}{else}0{/if}{/link}">{if $suspension->roomID}{$suspension->roomTitle|language}{else}{lang}chat.room.global{/lang}{/if}</a></td>
<td id="columnSuspensionType"><a href="{link application='chat' controller='ChatSuspensionList'}suspensionType={$suspension->type}{/link}">{lang}chat.suspension.{@$suspension->type}{/lang}</a></td> <td id="columnSuspensionType"><a href="{link application='chat' controller='ChatSuspensionList'}suspensionType={$suspension->type}{/link}">{lang}chat.suspension.{@$suspension->type}{/lang}</a></td>
<td id="columnTime">{$suspension->time|plainTime}</td> <td id="columnTime">{$suspension->time|plainTime}</td>
<td id="columnExpires">{$suspension->expires|plainTime} ({$suspension->expires|dateDiff})</td> <td id="columnExpires">
<p>{$suspension->expires|plainTime}{if $suspension->expires > TIME_NOW} ({$suspension->expires|dateDiff}){/if}</p>
{if $suspension->revoker}<p><small>{lang}chat.acp.suspension.revokedBy{/lang}</small></p>{/if}
</td>
<td id="columnIssuer"><a href="{link application='chat' controller='ChatSuspensionList'}issuerUserID={$suspension->issuer}{/link}">{$suspension->issuerUsername}</a></td> <td id="columnIssuer"><a href="{link application='chat' controller='ChatSuspensionList'}issuerUserID={$suspension->issuer}{/link}">{$suspension->issuerUsername}</a></td>
<td id="columnMessage"{if $suspension->reason != $suspension->reason|truncate:30} class="jsTooltip" title="{$suspension->reason}"{/if}>{$suspension->reason|truncate:30}</a></td> <td id="columnMessage"{if $suspension->reason != $suspension->reason|truncate:30} class="jsTooltip" title="{$suspension->reason}"{/if}>{$suspension->reason|truncate:30}</a></td>
{event name='columns'}
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>

View File

@ -80,6 +80,13 @@ class ChatSuspensionListPage extends \wcf\page\SortablePage {
*/ */
public $filterRoomID = null; public $filterRoomID = null;
/**
* display revoked suspensions
*
* @var integer
*/
public $displayRevoked = 0;
/** /**
* @see \wcf\page\IPage::readParameters() * @see \wcf\page\IPage::readParameters()
*/ */
@ -105,6 +112,9 @@ public function readParameters() {
// get room IDs by request // 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']);
// display revoked
if (isset($_REQUEST['displayRevoked'])) $this->displayRevoked = intval($_REQUEST['displayRevoked']);
} }
/** /**
@ -120,7 +130,8 @@ public function assignVariables() {
'issuerUsername' => $this->filterIssuerUsername, 'issuerUsername' => $this->filterIssuerUsername,
'suspensionType' => $this->filterSuspensionType, 'suspensionType' => $this->filterSuspensionType,
'userID' => $this->filterUserID, 'userID' => $this->filterUserID,
'issuerUserID' => $this->filterIssuerUserID 'issuerUserID' => $this->filterIssuerUserID,
'displayRevoked' => $this->displayRevoked
)); ));
} }
@ -130,18 +141,23 @@ public function assignVariables() {
protected function initObjectList() { protected function initObjectList() {
parent::initObjectList(); parent::initObjectList();
$this->objectList->sqlSelects .= "user_table.username, user_table2.username as issuerUsername, room_table.title AS roomTitle"; $this->objectList->sqlSelects .= "user_table.username, user_table2.username AS issuerUsername, user_table3.username AS revokerUsername, room_table.title AS roomTitle";
$this->objectList->sqlJoins .= " $this->objectList->sqlJoins .= "
LEFT JOIN wcf".WCF_N."_user user_table LEFT JOIN wcf".WCF_N."_user user_table
ON suspension.userID = user_table.userID ON suspension.userID = user_table.userID
LEFT JOIN wcf".WCF_N."_user user_table2 LEFT JOIN wcf".WCF_N."_user user_table2
ON suspension.issuer = user_table2.userID"; ON suspension.issuer = user_table2.userID
LEFT JOIN wcf".WCF_N."_user user_table3
ON suspension.issuer = user_table3.userID";
$conditionJoins = " LEFT JOIN chat".WCF_N."_room room_table $conditionJoins = " LEFT JOIN chat".WCF_N."_room room_table
ON suspension.roomID = room_table.roomID"; ON suspension.roomID = room_table.roomID";
$this->objectList->sqlConditionJoins .= $conditionJoins; $this->objectList->sqlConditionJoins .= $conditionJoins;
$this->objectList->sqlJoins .= $conditionJoins; $this->objectList->sqlJoins .= $conditionJoins;
if (!$this->displayRevoked) {
$this->objectList->getConditionBuilder()->add('expires >= ?', array(TIME_NOW)); $this->objectList->getConditionBuilder()->add('expires >= ?', array(TIME_NOW));
$this->objectList->getConditionBuilder()->add('revoked = ?', array(0));
}
$this->objectList->getConditionBuilder()->add('(room_table.permanent = ? OR suspension.roomID IS NULL)', array(1)); $this->objectList->getConditionBuilder()->add('(room_table.permanent = ? OR suspension.roomID IS NULL)', array(1));
if ($this->filterSuspensionType !== null) $this->objectList->getConditionBuilder()->add('suspension.type = ?', array($this->filterSuspensionType)); if ($this->filterSuspensionType !== null) $this->objectList->getConditionBuilder()->add('suspension.type = ?', array($this->filterSuspensionType));
if ($this->filterUserID !== null) $this->objectList->getConditionBuilder()->add('suspension.userID = ?', array($this->filterUserID)); if ($this->filterUserID !== null) $this->objectList->getConditionBuilder()->add('suspension.userID = ?', array($this->filterUserID));

View File

@ -15,13 +15,17 @@
<item name="chat.acp.suspension.list"><![CDATA[Sanktionen]]></item> <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.type"><![CDATA[Art der Sanktion]]></item>
<item name="chat.acp.suspension.issuer"><![CDATA[Aussteller]]></item> <item name="chat.acp.suspension.issuer"><![CDATA[Aussteller]]></item>
<item name="chat.acp.suspension.displayRevoked"><![CDATA[Abgelaufene Sanktionen anzeigen]]></item>
<item name="chat.acp.suspension.reason"><![CDATA[Grund]]></item>
<item name="chat.acp.suspension.revoked"><![CDATA[Zurückziehen]]></item>
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von {$suspension->revokerUsername}]]></item>
</category> </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> <item name="chat.acp.menu.link.suspension.list"><![CDATA[Sanktionen auflisten]]></item>
</category> </category>
<category name="wcf.acp.group"> <category name="wcf.acp.group">