1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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,8 +1,9 @@
{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() {
@ -11,6 +12,7 @@
}); });
//]]> //]]>
</script> </script>
{/if}
{/if} {/if}
@ -18,7 +20,8 @@
<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}
<form method="post" action="{link controller='MessageLog' application='chat'}{/link}">
<div class="container containerPadding marginTop"> <div class="container containerPadding marginTop">
<fieldset> <fieldset>
<legend>{lang}wcf.global.filter{/lang}</legend> <legend>{lang}wcf.global.filter{/lang}</legend>
@ -51,9 +54,9 @@
<div class="formSubmit"> <div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" /> <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
</div> </div>
</form> </form>
<div class="contentNavigation"> <div class="contentNavigation">
<nav> <nav>
<ul> <ul>
<li> <li>
@ -64,9 +67,9 @@
</li> </li>
</ul> </ul>
</nav> </nav>
</div> </div>
{if $errorField === ''} {if $errorField === ''}
<div id="messageLogContent" class="tabMenuContainer marginTop" data-active="timeTab-0" data-store="activeTabMenuItem" data-base-time="{$date}" data-room-id="{$room->roomID}"> <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"> <nav class="tabMenu">
<ul> <ul>
@ -94,15 +97,14 @@
{section name=subTabLoop loop=6} {section name=subTabLoop loop=6}
{assign var=subAnchor value='timeTab-'|concat:$contentLoop|concat:'-subTab-'|concat:$subTabLoop} {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}"> <div id="{$subAnchor}" class="hidden subTabMenuContent empty"></div>
{if $messages[$contentLoop * 2 + $subTabLoop]|isset} {/section}
{include application='chat' file='__messageLogTable' sandbox='true' messages=$messages[$contentLoop * 2 + $subTabLoop]} </div>
{/section}
</div>
{/if} {/if}
</div> {else}
{/section} <p class="error">{lang}chat.acp.log.error.disabled{/lang}</p>
</div>
{/section}
</div>
{/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>