1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-02 23:20:08 +00:00

Improve message log

This commit is contained in:
Maximilian Mader 2013-09-05 21:59:03 +02:00
parent 74caf2c7ec
commit a2c4a217f1
2 changed files with 27 additions and 39 deletions

View File

@ -2,14 +2,16 @@
<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> <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>
<script data-relocate="true"> {if $errorField === ''}
//<![CDATA[ <script data-relocate="true">
$(function() { //<![CDATA[
be.bastelstu.Chat.ACP.Log.TabMenu.init(); $(function() {
WCF.TabMenu.init(); be.bastelstu.Chat.ACP.Log.TabMenu.init();
}); WCF.TabMenu.init();
//]]> });
</script> //]]>
</script>
{/if}
<header class="boxHeadline"> <header class="boxHeadline">
@ -51,11 +53,7 @@
</div> </div>
</form> </form>
{if $messages|count == 0} {if $errorField === ''}
{if $errorField === ""}
<p class="info">{lang}wcf.global.noItems{/lang}</p>
{/if}
{else}
<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>

View File

@ -15,26 +15,12 @@ This is the javascript file providing functions related to the message log for [
(($, window) -> (($, window) ->
"use strict"; "use strict";
###
# message log content
# @var jQuery
###
_messageLogContent = null _messageLogContent = null
###
# list of containers
# @var object
###
_hasContent = {} _hasContent = {}
###
# action proxy
# @var WCF.Action.Proxy
###
_proxy = null _proxy = null
init = -> init = ->
_messageLogContent = $('#messageLogContent') _messageLogContent = $ '#messageLogContent'
activeMenuItem = _messageLogContent.data 'active' activeMenuItem = _messageLogContent.data 'active'
enableProxy = false enableProxy = false
@ -42,28 +28,33 @@ This is the javascript file providing functions related to the message log for [
_messageLogContent.find('div.tabMenuContent > .subTabMenuContent').each (index, container) -> _messageLogContent.find('div.tabMenuContent > .subTabMenuContent').each (index, container) ->
containerID = $(container).wcfIdentify() containerID = $(container).wcfIdentify()
if (! $("##{containerID}").hasClass 'empty') unless $("##{containerID}").hasClass 'empty'
_hasContent[containerID] = true _hasContent[containerID] = true
else else
_hasContent[containerID] = false _hasContent[containerID] = false
enableProxy = true enableProxy = true
if (enableProxy) if enableProxy
_proxy = new WCF.Action.Proxy _proxy = new WCF.Action.Proxy
success: _success success: _success
_messageLogContent.bind 'wcftabsbeforeactivate', _messageLogContent.bind 'wcftabsbeforeactivate',
_loadContent _loadContent
if not _hasContent[activeMenuItem]
_loadContent {},
newPanel: $("##{activeMenuItem}")
newTab: $("##{activeMenuItem}").parent().find(".menu > ul > li").first()
_loadContent = (event, ui) -> _loadContent = (event, ui) ->
containerID = $(ui.newPanel).attr 'id' containerID = $(ui.newPanel).attr 'id'
if ($("##{$(ui.newPanel).attr('id')}").hasClass 'tabMenuContainer') if $("##{$(ui.newPanel).attr('id')}").hasClass 'tabMenuContainer'
containerID = $("##{containerID} > .subTabMenuContent").first().attr 'id' containerID = $("##{containerID} > .subTabMenuContent").first().attr 'id'
tab = $("##{containerID}").parent().find(".menu > ul > li").first() tab = $("##{containerID}").parent().find(".menu > ul > li").first()
else else
tab = $(ui.newTab) tab = $ ui.newTab
unless _hasContent[containerID] unless _hasContent[containerID]
start = _messageLogContent.data('baseTime') + (tab.data('hour') * 3600) + (tab.data('minutes') * 60) start = _messageLogContent.data('baseTime') + (tab.data('hour') * 3600) + (tab.data('minutes') * 60)
@ -74,21 +65,20 @@ This is the javascript file providing functions related to the message log for [
containerID: containerID containerID: containerID
start: start start: start
end: start + 1799 end: start + 1799
roomID: _messageLogContent.data('roomID') roomID: _messageLogContent.data 'roomID'
_proxy.sendRequest() do _proxy.sendRequest
_success = (data, textStatus, jqWHR) -> _success = (data, textStatus, jqWHR) ->
containerID = data.returnValues.containerID containerID = data.returnValues.containerID
_hasContent[containerID] = true _hasContent[containerID] = true
content = _messageLogContent.find "##{containerID}" content = _messageLogContent.find "##{containerID}"
if(data.returnValues.template != '') unless data.returnValues.template is ''
$("<div>#{data.returnValues.template}</div>").hide().appendTo content $("<div>#{data.returnValues.template}</div>").hide().appendTo content
if(!data.returnValues.noMessages) unless data.returnValues.noMessages
content.addClass 'tabularBox' content.addClass 'tabularBox'
content.children().first().show() do content.children().first().show
Log = Log =
TabMenu: TabMenu:
init: init init: init