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,16 +1,18 @@
|
||||
{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 === ''}
|
||||
<script data-relocate="true">
|
||||
//<![CDATA[
|
||||
$(function() {
|
||||
be.bastelstu.Chat.ACP.Log.TabMenu.init();
|
||||
WCF.TabMenu.init();
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{if $errorField === ''}
|
||||
<script data-relocate="true">
|
||||
//<![CDATA[
|
||||
$(function() {
|
||||
be.bastelstu.Chat.ACP.Log.TabMenu.init();
|
||||
WCF.TabMenu.init();
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
@ -18,91 +20,91 @@
|
||||
<h1>{lang}{@$pageTitle}{/lang}</h1>
|
||||
</header>
|
||||
|
||||
<form method="post" action="{link controller='MessageLog' application='chat'}{/link}">
|
||||
<div class="container containerPadding marginTop">
|
||||
<fieldset>
|
||||
<legend>{lang}wcf.global.filter{/lang}</legend>
|
||||
|
||||
<dl>
|
||||
<dt><label for="id">{lang}chat.general.room{/lang}</label></dt>
|
||||
<dd>
|
||||
<select id="id" name="id">
|
||||
{foreach from=$rooms item='roomBit'}
|
||||
<option value="{$roomBit->roomID}"{if $roomBit->roomID == $room->roomID} selected="selected"{/if}>{$roomBit}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl{if $errorField == 'date'} class="formError"{/if}>
|
||||
<dt><label for="date">{lang}chat.general.time{/lang}</label></dt>
|
||||
<dd>
|
||||
<input id="date" type="date" name="date" value="{$date|date:'Y-m-d'}" />
|
||||
{if $errorField == 'date'}
|
||||
<small class="innerError">
|
||||
{lang}chat.acp.log.date.error.{$errorType}{/lang}
|
||||
</small>
|
||||
{/if}
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="formSubmit">
|
||||
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
|
||||
</div>
|
||||
</form>
|
||||
{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>
|
||||
|
||||
<dl>
|
||||
<dt><label for="id">{lang}chat.general.room{/lang}</label></dt>
|
||||
<dd>
|
||||
<select id="id" name="id">
|
||||
{foreach from=$rooms item='roomBit'}
|
||||
<option value="{$roomBit->roomID}"{if $roomBit->roomID == $room->roomID} selected="selected"{/if}>{$roomBit}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl{if $errorField == 'date'} class="formError"{/if}>
|
||||
<dt><label for="date">{lang}chat.general.time{/lang}</label></dt>
|
||||
<dd>
|
||||
<input id="date" type="date" name="date" value="{$date|date:'Y-m-d'}" />
|
||||
{if $errorField == 'date'}
|
||||
<small class="innerError">
|
||||
{lang}chat.acp.log.date.error.{$errorType}{/lang}
|
||||
</small>
|
||||
{/if}
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="formSubmit">
|
||||
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="contentNavigation">
|
||||
<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">
|
||||
<div class="contentNavigation">
|
||||
<nav>
|
||||
<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}
|
||||
<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>
|
||||
|
||||
{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>
|
||||
|
||||
{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}
|
||||
|
||||
{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