1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Rework CoffeeScript

This commit is contained in:
Tim Düsterhus 2013-05-15 21:55:51 +02:00
parent 37d8542eff
commit abc6ba66f4
4 changed files with 580 additions and 658 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,12 +28,10 @@ public static function getNewestMessages(\chat\data\room\Room $room, $number = C
$messageList->sqlOrderBy = "message.messageID DESC"; $messageList->sqlOrderBy = "message.messageID DESC";
$messageList->sqlLimit = $number; $messageList->sqlLimit = $number;
$messageList->getConditionBuilder()->add(' $messageList->getConditionBuilder()->add('
(( (
message.receiver IS NULL message.receiver IS NULL
AND message.roomID = ? AND message.roomID = ?
) )', array($room->roomID));
OR message.receiver = ?
OR message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID));
$messageList->readObjects(); $messageList->readObjects();
return array_reverse($messageList->getObjects()); return array_reverse($messageList->getObjects());

View File

@ -26,12 +26,12 @@
{capture assign='messageTemplate'}{include application='chat' file='message'}{/capture} {capture assign='messageTemplate'}{include application='chat' file='message'}{/capture}
{capture assign='userTemplate'}{include application='chat' file='userListUser'}{/capture} {capture assign='userTemplate'}{include application='chat' file='userListUser'}{/capture}
window.chat = new be.bastelstu.Chat( be.bastelstu.Chat.init(
{ {
reloadTime: {@CHAT_RELOADTIME}, reloadTime: {@CHAT_RELOADTIME},
messageURL: '{link application="chat" controller="NewMessages"}{/link}' messageURL: '{link application="chat" controller="NewMessages"}{/link}'
}, },
new WCF.Template('{ldelim}$title} - {"chat.general.title"|language|encodeJS} - {PAGE_TITLE|language|encodeJS}'), new WCF.Template('{literal}{if $newMessageCount}({#$newMessageCount}) {/if}{$title} - {/literal}{"chat.general.title"|language|encodeJS} - {PAGE_TITLE|language|encodeJS}'),
new WCF.Template('{@$messageTemplate|encodeJS}'), new WCF.Template('{@$messageTemplate|encodeJS}'),
new WCF.Template('{@$userTemplate|encodeJS}') new WCF.Template('{@$userTemplate|encodeJS}')
); );
@ -39,7 +39,7 @@
{event name='afterInit'} {event name='afterInit'}
// show the last X messages // show the last X messages
window.chat.handleMessages([ be.bastelstu.Chat.handleMessages([
{implode from=$newestMessages item='message'}{@$message->jsonify()}{/implode} {implode from=$newestMessages item='message'}{@$message->jsonify()}{/implode}
]); ]);

View File

@ -1,3 +1,3 @@
<script type="text/javascript" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.js?version={PACKAGE_VERSION|rawurlencode}"></script> <script type="text/javascript" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.js?version={PACKAGE_VERSION|rawurlencode}"></script>
<script type="text/javascript" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log.js?version={PACKAGE_VERSION|rawurlencode}"></script> <!--script type="text/javascript" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log.js?version={PACKAGE_VERSION|rawurlencode}"></script-->
{event name='javascript'} {event name='javascript'}