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:
parent
1979a901a2
commit
fe11589151
@ -1,8 +1,9 @@
|
||||
{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">
|
||||
//<![CDATA[
|
||||
$(function() {
|
||||
@ -11,6 +12,7 @@
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
@ -18,7 +20,8 @@
|
||||
<h1>{lang}{@$pageTitle}{/lang}</h1>
|
||||
</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">
|
||||
<fieldset>
|
||||
<legend>{lang}wcf.global.filter{/lang}</legend>
|
||||
@ -51,9 +54,9 @@
|
||||
<div class="formSubmit">
|
||||
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<div class="contentNavigation">
|
||||
<div class="contentNavigation">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
@ -64,9 +67,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</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}">
|
||||
<nav class="tabMenu">
|
||||
<ul>
|
||||
@ -94,15 +97,14 @@
|
||||
|
||||
{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]}
|
||||
<div id="{$subAnchor}" class="hidden subTabMenuContent empty"></div>
|
||||
{/section}
|
||||
</div>
|
||||
{/section}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/section}
|
||||
</div>
|
||||
{/section}
|
||||
</div>
|
||||
{else}
|
||||
<p class="error">{lang}chat.acp.log.error.disabled{/lang}</p>
|
||||
{/if}
|
||||
|
||||
{include file='footer'}
|
||||
|
@ -73,7 +73,7 @@ public function readData() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -36,13 +36,6 @@ class MessageLogPage extends \wcf\page\AbstractPage {
|
||||
*/
|
||||
public $errorType = '';
|
||||
|
||||
/**
|
||||
* messages for the given day
|
||||
*
|
||||
* @var array<\chat\data\message\Message>
|
||||
*/
|
||||
public $messages = array();
|
||||
|
||||
/**
|
||||
* given roomID
|
||||
*
|
||||
@ -81,16 +74,8 @@ public function readData() {
|
||||
if ($this->date > TIME_NOW) {
|
||||
throw new \wcf\system\exception\UserInputException('date', 'inFuture');
|
||||
}
|
||||
}
|
||||
catch (\wcf\system\exception\UserInputException $e) {
|
||||
$this->errorField = $e->getField();
|
||||
$this->errorType = $e->getType();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
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\UserInputException('date', 'tooLongAgo');
|
||||
}
|
||||
}
|
||||
@ -100,19 +85,6 @@ public function readData() {
|
||||
|
||||
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();
|
||||
|
||||
WCF::getTPL()->assign(array(
|
||||
'messages' => $this->messages,
|
||||
'rooms' => $this->rooms,
|
||||
'room' => $this->room,
|
||||
'date' => $this->date,
|
||||
|
@ -25,6 +25,7 @@
|
||||
<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.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.tooLongAgo"><![CDATA[Das angegebene Datum befindet sich außerhalb der protokollierten Zeitspanne von {CHAT_LOG_ARCHIVETIME / 1440|ceil} Tagen.]]></item>
|
||||
</category>
|
||||
|
Loading…
Reference in New Issue
Block a user