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

Fix log archive time of -1 and add an info box if protocol is disabled.

This commit is contained in:
Maximilian Mader 2013-09-08 22:40:09 +02:00
parent 1979a901a2
commit fe11589151
4 changed files with 95 additions and 121 deletions

View File

@ -1,16 +1,18 @@
{include file='header' pageTitle='chat.acp.log.title'} {include file='header' pageTitle='chat.acp.log.title'}
<script data-relocate="true" src="{$__wcf->getPath('chat')}acp/js/be.bastelstu.Chat.ACP.Log.js?version={PACKAGE_VERSION|rawurlencode}"></script> {if CHAT_LOG_ARCHIVETIME !== 0}
<script data-relocate="true" src="{$__wcf->getPath('chat')}acp/js/be.bastelstu.Chat.ACP.Log{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script>
{if $errorField === ''} {if $errorField === ''}
<script data-relocate="true"> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
be.bastelstu.Chat.ACP.Log.TabMenu.init(); be.bastelstu.Chat.ACP.Log.TabMenu.init();
WCF.TabMenu.init(); WCF.TabMenu.init();
}); });
//]]> //]]>
</script> </script>
{/if}
{/if} {/if}
@ -18,91 +20,91 @@
<h1>{lang}{@$pageTitle}{/lang}</h1> <h1>{lang}{@$pageTitle}{/lang}</h1>
</header> </header>
<form method="post" action="{link controller='MessageLog' application='chat'}{/link}"> {if CHAT_LOG_ARCHIVETIME !== 0}
<div class="container containerPadding marginTop"> <form method="post" action="{link controller='MessageLog' application='chat'}{/link}">
<fieldset> <div class="container containerPadding marginTop">
<legend>{lang}wcf.global.filter{/lang}</legend> <fieldset>
<legend>{lang}wcf.global.filter{/lang}</legend>
<dl>
<dt><label for="id">{lang}chat.general.room{/lang}</label></dt> <dl>
<dd> <dt><label for="id">{lang}chat.general.room{/lang}</label></dt>
<select id="id" name="id"> <dd>
{foreach from=$rooms item='roomBit'} <select id="id" name="id">
<option value="{$roomBit->roomID}"{if $roomBit->roomID == $room->roomID} selected="selected"{/if}>{$roomBit}</option> {foreach from=$rooms item='roomBit'}
{/foreach} <option value="{$roomBit->roomID}"{if $roomBit->roomID == $room->roomID} selected="selected"{/if}>{$roomBit}</option>
</select> {/foreach}
</dd> </select>
</dl> </dd>
</dl>
<dl{if $errorField == 'date'} class="formError"{/if}>
<dt><label for="date">{lang}chat.general.time{/lang}</label></dt> <dl{if $errorField == 'date'} class="formError"{/if}>
<dd> <dt><label for="date">{lang}chat.general.time{/lang}</label></dt>
<input id="date" type="date" name="date" value="{$date|date:'Y-m-d'}" /> <dd>
{if $errorField == 'date'} <input id="date" type="date" name="date" value="{$date|date:'Y-m-d'}" />
<small class="innerError"> {if $errorField == 'date'}
{lang}chat.acp.log.date.error.{$errorType}{/lang} <small class="innerError">
</small> {lang}chat.acp.log.date.error.{$errorType}{/lang}
{/if} </small>
</dd> {/if}
</dl> </dd>
</fieldset> </dl>
</div> </fieldset>
</div>
<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" /> <div class="formSubmit">
</div> <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
</form> </div>
</form>
<div class="contentNavigation"> <div class="contentNavigation">
<nav> <nav>
<ul>
<li>
<a class="button" href="{link controller='MessageLogDownload' application='chat' object=$room date=$date|date:'Y-m-d'}{/link}">
<span class="icon icon16 icon-download-alt"></span>
<span>{lang}chat.acp.log.download{/lang}</span>
</a>
</li>
</ul>
</nav>
</div>
{if $errorField === ''}
<div id="messageLogContent" class="tabMenuContainer marginTop" data-active="timeTab-0" data-store="activeTabMenuItem" data-base-time="{$date}" data-room-id="{$room->roomID}">
<nav class="tabMenu">
<ul> <ul>
{section name=tabLoop loop=24 step=3} <li>
<li> <a class="button" href="{link controller='MessageLogDownload' application='chat' object=$room date=$date|date:'Y-m-d'}{/link}">
{assign var=anchor value='timeTab-'|concat:$tabLoop} <span class="icon icon16 icon-download-alt"></span>
<a href="{@$__wcf->getAnchor($anchor)}">{if $tabLoop < 10}0{/if}{$tabLoop}:00 - {if $tabLoop + 2 < 10}0{/if}{$tabLoop + 2}:59</a> <span>{lang}chat.acp.log.download{/lang}</span>
</li> </a>
{/section} </li>
</ul> </ul>
</nav> </nav>
{section name=contentLoop loop=24 step=3}
<div id="timeTab-{$contentLoop}" class="container containerPadding tabMenuContainer tabMenuContent" data-menu-item="timeTab-{$contentLoop}">
<nav class="menu">
<ul>
{section name=subTabLoop loop=6}
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
<li data-hour="{$contentLoop + $subTabLoop / 2|floor}" data-minutes="{($subTabLoop % 2) * 30}">
<a href="{@$__wcf->getAnchor($subAnchor)}">{if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{if $subTabLoop % 2 == 0}0{/if}{($subTabLoop % 2) * 30} - {if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{($subTabLoop % 2) * 30 + 29}</a>
</li>
{/section}
</ul>
</nav>
{section name=subTabLoop loop=6}
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
<div id="{$subAnchor}" class="hidden subTabMenuContent{if !$messages[$contentLoop * 2 + $subTabLoop]|isset} empty{else} tabularBox{/if}">
{if $messages[$contentLoop * 2 + $subTabLoop]|isset}
{include application='chat' file='__messageLogTable' sandbox='true' messages=$messages[$contentLoop * 2 + $subTabLoop]}
{/if}
</div>
{/section}
</div>
{/section}
</div> </div>
{if $errorField === ''}
<div id="messageLogContent" class="tabMenuContainer marginTop" data-active="timeTab-0" data-store="activeTabMenuItem" data-base-time="{$date}" data-room-id="{$room->roomID}">
<nav class="tabMenu">
<ul>
{section name=tabLoop loop=24 step=3}
<li>
{assign var=anchor value='timeTab-'|concat:$tabLoop}
<a href="{@$__wcf->getAnchor($anchor)}">{if $tabLoop < 10}0{/if}{$tabLoop}:00 - {if $tabLoop + 2 < 10}0{/if}{$tabLoop + 2}:59</a>
</li>
{/section}
</ul>
</nav>
{section name=contentLoop loop=24 step=3}
<div id="timeTab-{$contentLoop}" class="container containerPadding tabMenuContainer tabMenuContent" data-menu-item="timeTab-{$contentLoop}">
<nav class="menu">
<ul>
{section name=subTabLoop loop=6}
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
<li data-hour="{$contentLoop + $subTabLoop / 2|floor}" data-minutes="{($subTabLoop % 2) * 30}">
<a href="{@$__wcf->getAnchor($subAnchor)}">{if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{if $subTabLoop % 2 == 0}0{/if}{($subTabLoop % 2) * 30} - {if $contentLoop + $subTabLoop / 2 < 10}0{/if}{$contentLoop + $subTabLoop / 2|floor}:{($subTabLoop % 2) * 30 + 29}</a>
</li>
{/section}
</ul>
</nav>
{section name=subTabLoop loop=6}
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop}
<div id="{$subAnchor}" class="hidden subTabMenuContent empty"></div>
{/section}
</div>
{/section}
</div>
{/if}
{else}
<p class="error">{lang}chat.acp.log.error.disabled{/lang}</p>
{/if} {/if}
{include file='footer'} {include file='footer'}

View File

@ -73,7 +73,7 @@ public function readData() {
throw new \wcf\system\exception\IllegalLinkException(); throw new \wcf\system\exception\IllegalLinkException();
} }
if ($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) { if (CHAT_LOG_ARCHIVETIME !== -1 && $this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
throw new \wcf\system\exception\IllegalLinkException(); throw new \wcf\system\exception\IllegalLinkException();
} }

View File

@ -36,13 +36,6 @@ class MessageLogPage extends \wcf\page\AbstractPage {
*/ */
public $errorType = ''; public $errorType = '';
/**
* messages for the given day
*
* @var array<\chat\data\message\Message>
*/
public $messages = array();
/** /**
* given roomID * given roomID
* *
@ -81,16 +74,8 @@ public function readData() {
if ($this->date > TIME_NOW) { if ($this->date > TIME_NOW) {
throw new \wcf\system\exception\UserInputException('date', 'inFuture'); throw new \wcf\system\exception\UserInputException('date', 'inFuture');
} }
}
catch (\wcf\system\exception\UserInputException $e) {
$this->errorField = $e->getField();
$this->errorType = $e->getType();
return; if (CHAT_LOG_ARCHIVETIME !== -1 && $this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
}
try {
if ($this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
throw new \wcf\system\exception\UserInputException('date', 'tooLongAgo'); throw new \wcf\system\exception\UserInputException('date', 'tooLongAgo');
} }
} }
@ -100,19 +85,6 @@ public function readData() {
return; return;
} }
$messages = \chat\data\message\ViewableMessageList::getMessagesBetween($this->room, $this->date, $this->date + 1799);
foreach ($messages as $message) {
$hour = ((int) date('H', $message->time)) * 2;
$minutes = (int) date('i', $message->time);
if ($minutes >= 30) {
$hour += 1;
}
$this->messages[$hour][] = $message;
}
} }
/** /**
@ -148,7 +120,6 @@ public function assignVariables() {
parent::assignVariables(); parent::assignVariables();
WCF::getTPL()->assign(array( WCF::getTPL()->assign(array(
'messages' => $this->messages,
'rooms' => $this->rooms, 'rooms' => $this->rooms,
'room' => $this->room, 'room' => $this->room,
'date' => $this->date, 'date' => $this->date,

View File

@ -25,6 +25,7 @@
<item name="chat.acp.log.title"><![CDATA[Nachrichten-Protokoll]]></item> <item name="chat.acp.log.title"><![CDATA[Nachrichten-Protokoll]]></item>
<item name="chat.acp.log.download"><![CDATA[Tages-Protokoll herunterladen]]></item> <item name="chat.acp.log.download"><![CDATA[Tages-Protokoll herunterladen]]></item>
<item name="chat.acp.log.message"><![CDATA[Nachricht]]></item> <item name="chat.acp.log.message"><![CDATA[Nachricht]]></item>
<item name="chat.acp.log.error.disabled"><![CDATA[Das Nachrichten-Protokoll ist deaktiviert. Sie können das Protokoll in den Einstellungen („System » Optionen » Chat » Protokoll“) aktivieren.]]></item>
<item name="chat.acp.log.date.error.inFuture"><![CDATA[Das angegebene Datum befindet sich in der Zukunft.]]></item> <item name="chat.acp.log.date.error.inFuture"><![CDATA[Das angegebene Datum befindet sich in der Zukunft.]]></item>
<item name="chat.acp.log.date.error.tooLongAgo"><![CDATA[Das angegebene Datum befindet sich außerhalb der protokollierten Zeitspanne von {CHAT_LOG_ARCHIVETIME / 1440|ceil} Tagen.]]></item> <item name="chat.acp.log.date.error.tooLongAgo"><![CDATA[Das angegebene Datum befindet sich außerhalb der protokollierten Zeitspanne von {CHAT_LOG_ARCHIVETIME / 1440|ceil} Tagen.]]></item>
</category> </category>