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

Merge branch 'master' into commands

Conflicts:
	file/lib/system/chat/commands/ChatCommandHandler.class.php
This commit is contained in:
Tim Düsterhus 2012-03-22 17:18:53 +01:00
commit 4a901569bd
45 changed files with 376 additions and 240 deletions

View File

@ -3,30 +3,30 @@
<import> <import>
<categories> <categories>
<category name="user"> <category name="user">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
</category> </category>
<category name="mod"> <category name="mod">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
</category> </category>
</categories> </categories>
<options> <options>
<option name="user.canEnter"> <option name="user.canEnter">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
<categoryname>user</categoryname> <categoryname>user</categoryname>
</option> </option>
<option name="user.canWrite"> <option name="user.canWrite">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
<categoryname>user</categoryname> <categoryname>user</categoryname>
</option> </option>
<option name="mod.canAlwaysEnter"> <option name="mod.canAlwaysEnter">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
<categoryname>mod</categoryname> <categoryname>mod</categoryname>
</option> </option>
<option name="mod.canAlwaysWrite"> <option name="mod.canAlwaysWrite">
<objecttype>timwolla.wcf.chat.room</objecttype> <objecttype>be.bastelstu.wcf.chat.room</objecttype>
<categoryname>mod</categoryname> <categoryname>mod</categoryname>
</option> </option>
</options> </options>

View File

@ -43,7 +43,7 @@
</div> </div>
<form method="post" action="{if $action == 'add'}{link controller='ChatRoomAdd'}{/link}{else}{link controller='ChatRoomEdit'}{/link}{/if}"> <form method="post" action="{if $action == 'add'}{link controller='ChatRoomAdd'}{/link}{else}{link controller='ChatRoomEdit'}{/link}{/if}">
<div class="wcf-border wcf-content"> <div class="wcf-box wcf-marginTop wcf-boxPadding wcf-shadow1">
<fieldset> <fieldset>
<legend>{lang}wcf.acp.chat.room.data{/lang}</legend> <legend>{lang}wcf.acp.chat.room.data{/lang}</legend>

View File

@ -4,7 +4,7 @@
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
new WCF.Action.Delete('\\wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow')); new WCF.Action.Delete('\\wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow'));
new WCF.Sortable.List('chatRoomList', '\\wcf\\data\\chat\\room\\ChatRoomAction'); new WCF.Sortable.List('chatRoomList', '\\wcf\\data\\chat\\room\\ChatRoomAction', {@$startIndex-1});
}); });
//]]> //]]>
</script> </script>
@ -28,31 +28,41 @@
{/if} {/if}
</div> </div>
<section id="chatRoomList" class="wcf-border wcf-sortableListContainer"> <section id="chatRoomList" class="wcf-box wcf-marginTop wcf-boxPadding wcf-shadow1 wcf-sortableListContainer">
{hascontent} {hascontent}
<ol class="wcf-sortableList" data-object-id="0"> <ol class="wcf-sortableList" data-object-id="0" start="{$startIndex}">
{content} {content}
{foreach from=$objects item=chatRoom} {foreach from=$objects item=chatRoom}
<li class="wcf-sortableNode chatRoomRow" data-object-id="{@$chatRoom->roomID}"> <li class="wcf-sortableNode wcf-sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}">
<span class="wcf-sortableNodeLabel"> <span class="wcf-sortableNodeLabel">
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}
<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a>
{else}
{$chatRoom->title|language}
{/if}
<span class="wcf-sortableButtonContainer"> <span class="wcf-statusDisplay wcf-sortableButtonContainer">
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}
<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}"><img src="{@$__wcf->getPath('wcf')}icon/edit1.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="balloonTooltip" /></a> <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}"><img src="{@$__wcf->getPath('wcf')}icon/edit1.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="balloonTooltip" /></a>
{/if} {/if}
{if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')} {if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')}
<img src="{@$__wcf->getPath('wcf')}icon/delete1.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}wcf.acp.bbcode.delete.sure{/lang}" /> <img src="{@$__wcf->getPath('wcf')}icon/delete1.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}wcf.acp.chat.delete.sure{/lang}" />
{/if} {/if}
</span> </span>
</span> </span>
<ol class="wcf-sortableList" data-object-id="{@$chatRoom->roomID}"></ol></li>
</li> </li>
{/foreach} {/foreach}
{/content} {/content}
</ol> </ol>
<div class="wcf-formSubmit">
<button class="wcf-button" data-type="reset">{lang}wcf.global.button.reset{/lang}</button>
<button class="wcf-button default" data-type="submit">{lang}wcf.global.button.submit{/lang}</button>
</div>
{hascontentelse} {hascontentelse}
<p class="wcf-warning">{lang}wcf.acp.chat.room.noneAvailable{/lang}</p> <p class="wcf-warning">{lang}wcf.acp.chat.room.noneAvailable{/lang}</p>
{/hascontent} {/hascontent}
</section> </section>
{include file='footer'} {include file='footer'}

View File

@ -6,7 +6,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
*/ */
echo <<<EOT echo <<<EOT
Cleaning up Cleaning up
@ -18,7 +18,7 @@
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile); foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile); foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
if (file_exists('timwolla.wcf.chat.tar')) unlink('timwolla.wcf.chat.tar'); if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar');
echo <<<EOT echo <<<EOT
Building JavaScript Building JavaScript
@ -43,12 +43,34 @@
} }
echo <<<EOT echo <<<EOT
Checking PHP for Syntax Errors
------------------------------
EOT;
chdir('file');
$check = null;
$check = function ($folder) use (&$check) {
if (is_file($folder)) {
if (substr($folder, -4) === '.php') {
passthru('php -l '.escapeshellarg($folder), $code);
if ($code != 0) exit($code);
}
return;
}
$files = glob($folder.'/*');
foreach ($files as $file) {
$check($file);
}
};
$check('.');
echo <<<EOT
Building file.tar Building file.tar
----------------- -----------------
EOT; EOT;
chdir('file'); passthru('tar cvf ../file.tar * --exclude=*.coffee --exclude=*.scss --exclude=.sass-cache', $code);
passthru('tar cvf ../file.tar * --exclude=*.coffee --exclude=*.scss', $code);
if ($code != 0) exit($code); if ($code != 0) exit($code);
echo <<<EOT echo <<<EOT
@ -70,12 +92,12 @@
if ($code != 0) exit($code); if ($code != 0) exit($code);
echo <<<EOT echo <<<EOT
Building timwolla.wcf.chat.tar Building be.bastelstu.wcf.chat.tar
------------------------------ ----------------------------------
EOT; EOT;
chdir('..'); chdir('..');
passthru('tar cvf timwolla.wcf.chat.tar * --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code); passthru('tar cvf be.bastelstu.wcf.chat.tar * --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code);
if ($code != 0) exit($code); if ($code != 0) exit($code);
if (file_exists('file.tar')) unlink('file.tar'); if (file_exists('file.tar')) unlink('file.tar');

View File

@ -2,11 +2,11 @@
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/eventListener.xsd"> <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/eventListener.xsd">
<import> <import>
<eventlistener> <eventlistener>
<eventclassname>wcf\system\request\RouteHandler</eventclassname> <eventclassname>\wcf\system\request\RouteHandler</eventclassname>
<eventname>didInit</eventname> <eventname>didInit</eventname>
<environment>user</environment> <environment>user</environment>
<inherit>0</inherit> <inherit>0</inherit>
<listenerclassname>wcf\system\event\listener\ChatRouteListener</listenerclassname> <listenerclassname>\wcf\system\event\listener\ChatRouteListener</listenerclassname>
</eventlistener> </eventlistener>
</import> </import>
</data> </data>

View File

@ -1,5 +1,5 @@
<?php <?php
namespace timwolla\wcf\chat; namespace be\bastelstu\wcf\chat;
/** /**
* Handles updates. * Handles updates.
@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
*/ */
final class Update { final class Update {
private $rooms = null; private $rooms = null;

View File

@ -4,6 +4,7 @@
@author Maximilian Mader @author Maximilian Mader
@copyright 2011 Tim Düsterhus @copyright 2011 Tim Düsterhus
@license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
@package be.bastelstu.wcf.chat
--> -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve">
<title>Chat</title> <title>Chat</title>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -4,6 +4,7 @@
@author Maximilian Mader @author Maximilian Mader
@copyright 2011 Tim Düsterhus @copyright 2011 Tim Düsterhus
@license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
@package be.bastelstu.wcf.chat
--> -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve">
<title>Chat</title> <title>Chat</title>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,14 +1,16 @@
### ###
# TimWolla.WCF.Chat # be.bastelstu.WCF.Chat
# #
# @author Tim Düsterhus # @author Tim Düsterhus
# @copyright 2010-2012 Tim Düsterhus # @copyright 2010-2012 Tim Düsterhus
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> # @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
# @package timwolla.wcf.chat # @package be.bastelstu.wcf.chat
### ###
TimWolla ?= {} be ?= {}
TimWolla.WCF ?= {} be.bastelstu ?= {}
be.bastelstu.WCF ?= {}
consoleMock = console consoleMock = console
consoleMock ?= consoleMock ?=
log: () ->, log: () ->,
@ -16,7 +18,7 @@ consoleMock ?=
error: () -> error: () ->
(($, window, console) -> (($, window, console) ->
TimWolla.WCF.Chat = be.bastelstu.WCF.Chat =
# Tims Chat stops loading when this reaches zero # Tims Chat stops loading when this reaches zero
# TODO: We need an explosion animation # TODO: We need an explosion animation
shields: 3 shields: 3
@ -45,7 +47,7 @@ consoleMock ?=
refreshRoomList: null refreshRoomList: null
fish: null fish: null
init: () -> init: () ->
console.log '[TimWolla.WCF.Chat] Initializing' console.log '[be.bastelstu.WCF.Chat Initializing'
@bindEvents() @bindEvents()
@events.newMessage.add $.proxy @notify, @ @events.newMessage.add $.proxy @notify, @
@ -54,7 +56,7 @@ consoleMock ?=
@refreshRoomList() @refreshRoomList()
@getMessages() @getMessages()
console.log '[TimWolla.WCF.Chat] Finished initializing - Shields at 104 percent' console.log '[be.bastelstu.WCF.Chat Finished initializing - Shields at 104 percent'
### ###
# Autocompletes a username # Autocompletes a username
### ###
@ -63,7 +65,7 @@ consoleMock ?=
# Search all matching users # Search all matching users
for user in $ '.timsChatUser' for user in $ '.timsChatUser'
username = $(user).data('username'); username = $(user).data 'username'
if username.indexOf(firstChars) is 0 if username.indexOf(firstChars) is 0
users.push username users.push username
@ -120,7 +122,7 @@ consoleMock ?=
firstChars = @autocompleteValue.substring(@autocompleteValue.lastIndexOf(' ')+1) firstChars = @autocompleteValue.substring(@autocompleteValue.lastIndexOf(' ')+1)
console.log '[TimWolla.WCF.Chat] Autocompleting "' + firstChars + '"' console.log '[be.bastelstu.WCF.Chat Autocompleting "' + firstChars + '"'
return if firstChars.length is 0 return if firstChars.length is 0
# Insert name and increment offset # Insert name and increment offset
@ -198,7 +200,7 @@ consoleMock ?=
$('#timsChatTopic').text data.topic $('#timsChatTopic').text data.topic
$('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden') $('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden')
$('.timsChatMessage').addClass('unloaded', 800); $('.timsChatMessage').addClass 'unloaded', 800
@handleMessages data.messages @handleMessages data.messages
document.title = @titleTemplate.fetch data document.title = @titleTemplate.fetch data
, @) , @)
@ -217,7 +219,7 @@ consoleMock ?=
### ###
freeTheFish: () -> freeTheFish: () ->
return if $.wcfIsset 'fish' return if $.wcfIsset 'fish'
console.warn '[TimWolla.WCF.Chat] Freeing the fish' console.warn '[be.bastelstu.WCF.Chat Freeing the fish'
fish = $ '<div id="fish">' + WCF.String.escapeHTML('><((((\u00B0>') + '</div>' fish = $ '<div id="fish">' + WCF.String.escapeHTML('><((((\u00B0>') + '</div>'
fish.css fish.css
position: 'absolute' position: 'absolute'
@ -243,7 +245,7 @@ consoleMock ?=
top: '+=' + top top: '+=' + top
left: '+=' + left left: '+=' + left
, 1e3 , 1e3
, 1.5e3); , 1.5e3)
### ###
# Loads new messages. # Loads new messages.
### ###
@ -256,12 +258,12 @@ consoleMock ?=
@handleUsers(data.users) @handleUsers(data.users)
, @) , @)
error: $.proxy((jqXHR, textStatus, errorThrown) -> error: $.proxy((jqXHR, textStatus, errorThrown) ->
console.error '[TimWolla.WCF.Chat] Battle Station hit - shields at ' + (--@shields / 3 * 104) + ' percent' console.error '[be.bastelstu.WCF.Chat Battle Station hit - shields at ' + (--@shields / 3 * 104) + ' percent'
if @shields is 0 if @shields is 0
@pe.refreshRoomList.stop() @pe.refreshRoomList.stop()
@pe.getMessages.stop() @pe.getMessages.stop()
@freeTheFish() @freeTheFish()
console.error '[TimWolla.WCF.Chat] We got destroyed, but could free our friend the fish before he was killed as well. Have a nice life in freedom!' console.error '[be.bastelstu.WCF.Chat We got destroyed, but could free our friend the fish before he was killed as well. Have a nice life in freedom!'
alert 'herp i cannot load messages' alert 'herp i cannot load messages'
, @) , @)
### ###
@ -304,16 +306,16 @@ consoleMock ?=
foundUsers = { } foundUsers = { }
for user in users for user in users
id = 'timsChatUser-'+user.userID id = 'timsChatUser-'+user.userID
element = $('#'+id) element = $ '#'+id
# Move the user to the correct position # Move the user to the correct position
if element[0] if element[0]
console.log '[TimWolla.WCF.Chat] Moving User: "' + user.username + '"' console.log '[be.bastelstu.WCF.Chat Moving User: "' + user.username + '"'
element = element.detach() element = element.detach()
$('#timsChatUserList').append element $('#timsChatUserList').append element
# Insert the user # Insert the user
else else
console.log '[TimWolla.WCF.Chat] Inserting User: "' + user.username + '"' console.log '[be.bastelstu.WCF.Chat Inserting User: "' + user.username + '"'
li = $ '<li></li>' li = $ '<li></li>'
li.attr 'id', id li.attr 'id', id
li.addClass 'timsChatUser' li.addClass 'timsChatUser'
@ -339,7 +341,7 @@ consoleMock ?=
# Remove users that were not found # Remove users that were not found
$('.timsChatUser').each () -> $('.timsChatUser').each () ->
if typeof foundUsers[$(@).attr('id')] is 'undefined' if typeof foundUsers[$(@).attr('id')] is 'undefined'
console.log '[TimWolla.WCF.Chat] Removing User: "' + $(@).data('username') + '"' console.log '[be.bastelstu.WCF.Chat Removing User: "' + $(@).data('username') + '"'
$(@).remove(); $(@).remove();
@ -370,7 +372,7 @@ consoleMock ?=
# @param object message # @param object message
### ###
notify: (message) -> notify: (message) ->
return if @isActive or $('#timsChatNotify').data('status') is 0 return if @isActive or $('#timsChatNotify').data 'status' is 0
@newMessageCount++ @newMessageCount++
document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch
@ -379,8 +381,8 @@ consoleMock ?=
# Desktop Notifications # Desktop Notifications
if typeof window.webkitNotifications isnt 'undefined' if typeof window.webkitNotifications isnt 'undefined'
if window.webkitNotifications.checkPermission() is 0 if window.webkitNotifications.checkPermission() is 0
title = WCF.Language.get('wcf.chat.newMessages') title = WCF.Language.get 'wcf.chat.newMessages'
icon = WCF.Icon.get('timwolla.wcf.chat.chat') icon = WCF.Icon.get 'be.bastelstu.wcf.chat.chat'
content = message.username + message.separator + ' ' + message.message content = message.username + message.separator + ' ' + message.message
notification = window.webkitNotifications.createNotification icon, title, content notification = window.webkitNotifications.createNotification icon, title, content
notification.show() notification.show()
@ -391,7 +393,7 @@ consoleMock ?=
# Refreshes the room-list. # Refreshes the room-list.
### ###
refreshRoomList: () -> refreshRoomList: () ->
console.log '[TimWolla.WCF.Chat] Refreshing the roomlist' console.log '[be.bastelstu.WCF.Chat Refreshing the roomlist'
$('#toggleRooms a').addClass 'ajaxLoad' $('#toggleRooms a').addClass 'ajaxLoad'
$.ajax $('#toggleRooms a').data('refreshUrl'), $.ajax $('#toggleRooms a').data('refreshUrl'),
@ -400,7 +402,7 @@ consoleMock ?=
success: $.proxy((data, textStatus, jqXHR) -> success: $.proxy((data, textStatus, jqXHR) ->
$('#timsChatRoomList li').remove() $('#timsChatRoomList li').remove()
$('#toggleRooms a').removeClass 'ajaxLoad' $('#toggleRooms a').removeClass 'ajaxLoad'
$('#toggleRooms .wcf-badge').text(data.length); $('#toggleRooms .wcf-badge').text data.length
for room in data for room in data
li = $ '<li></li>' li = $ '<li></li>'
@ -414,7 +416,7 @@ consoleMock ?=
@changeRoom $ event.target @changeRoom $ event.target
, @ , @
console.log '[TimWolla.WCF.Chat] Found ' + data.length + ' rooms' console.log '[be.bastelstu.WCF.Chat Found ' + data.length + ' rooms'
, @) , @)
### ###
# Handles submitting of messages. # Handles submitting of messages.
@ -428,17 +430,17 @@ consoleMock ?=
# Finally free the fish # Finally free the fish
@freeTheFish() if $('#timsChatInput').val().trim().toLowerCase() is '/free the fish' @freeTheFish() if $('#timsChatInput').val().trim().toLowerCase() is '/free the fish'
text = $('#timsChatInput').val()
$('#timsChatInput').val('').focus().keyup()
$.ajax $('#timsChatForm').attr('action'), $.ajax $('#timsChatForm').attr('action'),
data: data:
text: $('#timsChatInput').val(), text: text
smilies: $('#timsChatSmilies').data('status') smilies: $('#timsChatSmilies').data 'status'
type: 'POST', type: 'POST',
beforeSend: (jqXHR) -> beforeSend: (jqXHR) ->
$('#timsChatInput').addClass 'ajaxLoad' $('#timsChatInput').addClass 'ajaxLoad'
success: $.proxy((data, textStatus, jqXHR) -> success: $.proxy((data, textStatus, jqXHR) ->
@getMessages() @getMessages()
$('#timsChatInput').val('').focus()
$('#timsChatInput').keyup()
, @) , @)
complete: () -> complete: () ->
$('#timsChatInput').removeClass 'ajaxLoad' $('#timsChatInput').removeClass 'ajaxLoad'

View File

@ -10,16 +10,23 @@
$.fn.jCounter = (container, options) -> $.fn.jCounter = (container, options) ->
options = $.extend options = $.extend
max: 0 max: 0
counterClass: 'jsCounter' counterClass: 'jCounter'
countUp: false countUp: false
cssFile: 'wcf/style/jCounter.css'
width: '100%'
, options , options
if this.attr('maxlength') if this.attr('maxlength')
max = this.attr('maxlength') max = this.attr('maxlength')
else max = options.max else max = options.max
if $('#jCounterCSS').length == 0
$('head').append('<link id="jCounterCSS" rel="stylesheet" type="text/css" href="' + options.cssFile + '" >')
if !container if !container
this.wrap('<div class="jsCounterContainer"><div></div></div>').parent().append('<div class="' + options.counterClass + ' color-1">' + max + '</div>'); if !this.hasClass('jCounterInput')
this.addClass('jCounterInput')
this.wrap('<div class="jCounterContainer" style="width: ' + options.width + '"><div></div></div>').parent().append('<div class="' + options.counterClass + ' color-1">' + max + '</div>');
jCounterContainer = $(this).parent().children('.' + options.counterClass) jCounterContainer = $(this).parent().children('.' + options.counterClass)
else else
if typeof container is 'object' if typeof container is 'object'
@ -33,7 +40,14 @@
else else
length = max - this.val().length length = max - this.val().length
if options.countUp if options.countUp && max > 0
if length < max / 2
color = 1
else if length >= max / 2 and length <= max / 1.2
color = 2
else
color = 3
else if options.countUp
color = 1 color = 1
else else
if length > max / 2 if length > max / 2

View File

@ -2,7 +2,6 @@
namespace wcf\acp\form; namespace wcf\acp\form;
use \wcf\system\exception\UserInputException; use \wcf\system\exception\UserInputException;
use \wcf\system\language\I18nHandler; use \wcf\system\language\I18nHandler;
use \wcf\system\package\PackageDependencyHandler;
use \wcf\system\WCF; use \wcf\system\WCF;
/** /**
@ -11,7 +10,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage acp.form * @subpackage acp.form
*/ */
class ChatRoomAddForm extends ACPForm { class ChatRoomAddForm extends ACPForm {
@ -43,7 +42,7 @@ class ChatRoomAddForm extends ACPForm {
* @see \wcf\page\AbstractPage::__construct() * @see \wcf\page\AbstractPage::__construct()
*/ */
public function __construct() { public function __construct() {
$this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('timwolla.wcf.chat.room'); $this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room');
parent::__construct(); parent::__construct();
} }
@ -99,7 +98,7 @@ public function save() {
$roomID = $returnValues['returnValues']->roomID; $roomID = $returnValues['returnValues']->roomID;
if (!I18nHandler::getInstance()->isPlainValue('title')) { if (!I18nHandler::getInstance()->isPlainValue('title')) {
I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
// update title // update title
$chatRoomEditor->update(array( $chatRoomEditor->update(array(
@ -108,7 +107,7 @@ public function save() {
} }
if (!I18nHandler::getInstance()->isPlainValue('topic')) { if (!I18nHandler::getInstance()->isPlainValue('topic')) {
I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
// update topic // update topic
$chatRoomEditor->update(array( $chatRoomEditor->update(array(

View File

@ -1,8 +1,7 @@
<?php <?php
namespace wcf\acp\form; namespace wcf\acp\form;
use wcf\system\language\I18nHandler; use \wcf\system\language\I18nHandler;
use wcf\system\package\PackageDependencyHandler; use \wcf\system\WCF;
use wcf\system\WCF;
/** /**
* Shows the chatroom edit form. * Shows the chatroom edit form.
@ -10,7 +9,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage acp.form * @subpackage acp.form
*/ */
class ChatRoomEditForm extends ChatRoomAddForm { class ChatRoomEditForm extends ChatRoomAddForm {
@ -64,20 +63,20 @@ public function save() {
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID; $this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
if (I18nHandler::getInstance()->isPlainValue('title')) { if (I18nHandler::getInstance()->isPlainValue('title')) {
I18nHandler::getInstance()->remove($this->title, PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->remove($this->title, \wcf\util\ChatUtil::getPackageID());
$this->title = I18nHandler::getInstance()->getValue('title'); $this->title = I18nHandler::getInstance()->getValue('title');
} }
else { else {
I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
} }
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID; $this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
if (I18nHandler::getInstance()->isPlainValue('topic')) { if (I18nHandler::getInstance()->isPlainValue('topic')) {
I18nHandler::getInstance()->remove($this->topic, PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->remove($this->topic, \wcf\util\ChatUtil::getPackageID());
$this->topic = I18nHandler::getInstance()->getValue('topic'); $this->topic = I18nHandler::getInstance()->getValue('topic');
} }
else { else {
I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
} }
\wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID); \wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID);
@ -105,8 +104,8 @@ public function readData() {
parent::readData(); parent::readData();
if (!count($_POST)) { if (!count($_POST)) {
I18nHandler::getInstance()->setOptions('title', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'), $this->roomObj->title, 'wcf.chat.room.title\d+'); I18nHandler::getInstance()->setOptions('title', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->title, 'wcf.chat.room.title\d+');
I18nHandler::getInstance()->setOptions('topic', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'), $this->roomObj->topic, 'wcf.chat.room.topic\d+'); I18nHandler::getInstance()->setOptions('topic', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'wcf.chat.room.topic\d+');
$this->title = $this->roomObj->title; $this->title = $this->roomObj->title;
$this->topic = $this->roomObj->topic; $this->topic = $this->roomObj->topic;

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage acp.page * @subpackage acp.page
*/ */
class ChatRoomListPage extends \wcf\page\MultipleLinkPage { class ChatRoomListPage extends \wcf\page\MultipleLinkPage {

View File

@ -9,7 +9,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage action * @subpackage action
*/ */
class ChatLeaveAction extends AbstractAction { class ChatLeaveAction extends AbstractAction {

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.message * @subpackage data.chat.message
*/ */
class ChatMessage extends \wcf\data\DatabaseObject { class ChatMessage extends \wcf\data\DatabaseObject {

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.message * @subpackage data.chat.message
*/ */
class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction { class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction {

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.message * @subpackage data.chat.message
*/ */
class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor { class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
@ -23,17 +23,19 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
* @param integer $lifetime Delete messages older that this time. * @param integer $lifetime Delete messages older that this time.
* @return integer Number of deleted messages. * @return integer Number of deleted messages.
*/ */
public static function cleanup($lifetime = CHAT_ARCHIVETIME) { public static function prune($lifetime = CHAT_ARCHIVETIME) {
$baseClass = self::$baseClass;
$sql = "SELECT $sql = "SELECT
".static::getDatabaseIndexName()." ".$baseClass::getDatabaseTableIndexName()."
FROM FROM
".static::getDatabaseTableName()." ".$baseClass::getDatabaseTableName()."
WHERE WHERE
time < ?"; time < ?";
$statement = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
$statement->execute(TIME_NOW - $lifetime); $stmt->execute(array(TIME_NOW - $lifetime));
$objectIDs = array(); $objectIDs = array();
while ($objectIDs[] = $statement->fetchColumn()); while ($objectIDs[] = $stmt->fetchColumn());
return static::deleteAll($objectIDs);
return self::deleteAll($objectIDs);
} }
} }

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.room * @subpackage data.chat.room
*/ */
class ChatMessageList extends \wcf\data\DatabaseObjectList { class ChatMessageList extends \wcf\data\DatabaseObjectList {

View File

@ -9,7 +9,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.room * @subpackage data.chat.room
*/ */
class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController {
@ -43,7 +43,7 @@ public function __toString() {
* @return integer * @return integer
*/ */
public function countUsers() { public function countUsers() {
$packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = \wcf\util\ChatUtil::getPackageID();
$sql = "SELECT $sql = "SELECT
count(*) as count count(*) as count
@ -100,7 +100,7 @@ public function getTitle() {
* @return array<\wcf\data\user\User> * @return array<\wcf\data\user\User>
*/ */
public function getUsers() { public function getUsers() {
$packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = \wcf\util\ChatUtil::getPackageID();
$sql = "SELECT $sql = "SELECT
userID userID

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.room * @subpackage data.chat.room
*/ */
class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction { class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction {
@ -28,21 +28,20 @@ class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction {
protected $permissionsUpdate = array('admin.content.chat.canEditRoom'); protected $permissionsUpdate = array('admin.content.chat.canEditRoom');
/** /**
* Fixes create to append new boards. * Fixes create to append new rooms.
*/ */
public function create() { public function create() {
$room = parent::create(); $room = parent::create();
WCF::getDB()->beginTransaction(); WCF::getDB()->beginTransaction();
$sql = "SELECT max(position) as max $sql = "SELECT MAX(position)
FROM wcf".WCF_N."_chat_room FROM wcf".WCF_N."_chat_room
FOR UPDATE"; FOR UPDATE";
$stmt = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute(); $stmt->execute();
$row = $stmt->fetchArray();
$sql = "UPDATE wcf".WCF_N."_chat_room $sql = "UPDATE wcf".WCF_N."_chat_room
SET position = ".($row['max'] + 1)." SET position = ".($stmt->fetchColumn() + 1)."
WHERE roomID = ?"; WHERE roomID = ?";
$stmt = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute(array($room->roomID)); $stmt->execute(array($room->roomID));
@ -71,6 +70,8 @@ public function validateUpdatePosition() {
if (!isset($this->parameters['data']['structure'])) { if (!isset($this->parameters['data']['structure'])) {
throw new ValidateActionException('Missing parameter structure'); throw new ValidateActionException('Missing parameter structure');
} }
if (!isset($this->parameters['data']['offset'])) $this->parameters['data']['offset'] = 0;
} }
/** /**
@ -82,7 +83,7 @@ public function updatePosition() {
$roomList->sqlLimit = 0; $roomList->sqlLimit = 0;
$roomList->readObjects(); $roomList->readObjects();
$i = 0; $i = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction(); WCF::getDB()->beginTransaction();
foreach ($this->parameters['data']['structure'][0] as $roomID) { foreach ($this->parameters['data']['structure'][0] as $roomID) {
$room = $roomList->search($roomID); $room = $roomList->search($roomID);

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.room * @subpackage data.chat.room
*/ */
class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
@ -17,27 +17,57 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
*/ */
protected static $baseClass = '\wcf\data\chat\room\ChatRoom'; protected static $baseClass = '\wcf\data\chat\room\ChatRoom';
/**
* Clears the room cache.
*/
public static function resetCache() {
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatrooms.php');
}
/** /**
* @see \wcf\data\DatabaseObjectEditor::deleteAll() * @see \wcf\data\DatabaseObjectEditor::deleteAll()
*/ */
public static function deleteAll(array $objectIDs = array()) { public static function deleteAll(array $objectIDs = array()) {
parent::deleteAll($objectIDs); $packageID = \wcf\util\ChatUtil::getPackageID();
$packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat');
WCF::getDB()->beginTransaction(); WCF::getDB()->beginTransaction();
foreach ($objectIDs as $objectID) { foreach ($objectIDs as $objectID) {
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID, $packageID); \wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID, $packageID);
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID); \wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID);
} }
WCF::getDB()->commitTransaction();
return count($objectIDs); // The transaction is being committed in parent::deleteAll()
// The beginTransaction() call in there is simply ignored.
return parent::deleteAll($objectIDs);
}
/**
* Deletes temporary rooms that are unused.
*
* @return integer Number of deleted rooms
*/
public static function prune() {
$baseClass = self::$baseClass;
$sql = "SELECT
".$baseClass::getDatabaseTableIndexName()."
FROM
".$baseClass::getDatabaseTableName()."
WHERE
permanent = ?
AND roomID NOT IN(
SELECT
fieldValue AS roomID
FROM
wcf".WCF_N."_user_storage
WHERE
packageID = ?
AND field = ?)";
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
$stmt->execute(array(0, \wcf\util\ChatUtil::getPackageID(), 'roomID'));
$objectIDs = array();
while ($objectIDs[] = $stmt->fetchColumn());
return self::deleteAll($objectIDs);
}
/**
* Clears the room cache.
*/
public static function resetCache() {
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatrooms.php');
} }
} }

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage data.chat.room * @subpackage data.chat.room
*/ */
class ChatRoomList extends \wcf\data\DatabaseObjectList { class ChatRoomList extends \wcf\data\DatabaseObjectList {

View File

@ -11,7 +11,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage form * @subpackage form
*/ */
class ChatForm extends AbstractForm { class ChatForm extends AbstractForm {

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage page * @subpackage page
*/ */
class ChatCopyrightPage extends AbstractPage { class ChatCopyrightPage extends AbstractPage {

View File

@ -9,7 +9,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage page * @subpackage page
*/ */
class ChatMessagePage extends AbstractPage { class ChatMessagePage extends AbstractPage {

View File

@ -10,7 +10,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage page * @subpackage page
*/ */
class ChatPage extends AbstractPage { class ChatPage extends AbstractPage {
@ -51,7 +51,7 @@ public function readChatVersion() {
); );
$packages = CacheHandler::getInstance()->get('packages'); $packages = CacheHandler::getInstance()->get('packages');
foreach ($packages as $package) { foreach ($packages as $package) {
if ($package->package != 'timwolla.wcf.chat') continue; if ($package->package != \wcf\util\ChatUtil::PACKAGE_IDENTIFIER) continue;
$this->chatVersion = $package->packageVersion; $this->chatVersion = $package->packageVersion;
return; return;
} }
@ -85,18 +85,15 @@ public function readData() {
} }
$this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES); $this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES);
try {
\wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID));
}
$this->readDefaultSmileys(); catch (\wcf\system\exception\SystemException $e) {
$this->readChatVersion(); \wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0));
} }
/** $this->smilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies();
* Reads the smilies in the default category. $this->readChatVersion();
*/
public function readDefaultSmileys() {
$smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies();
$this->smilies = $smilies[null];
} }
/** /**
@ -164,12 +161,15 @@ public function show() {
if (!WCF::getUser()->userID) { if (!WCF::getUser()->userID) {
throw new \wcf\system\exception\PermissionDeniedException(); throw new \wcf\system\exception\PermissionDeniedException();
} }
\wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat'); \wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat');
// remove index breadcrumb // remove index breadcrumb
WCF::getBreadcrumbs()->remove(0); WCF::getBreadcrumbs()->remove(0);
parent::show(); parent::show();
// break if not ajax
// break if not using ajax
if ($this->useTemplate) exit; if ($this->useTemplate) exit;
@header('Content-type: application/json'); @header('Content-type: application/json');

View File

@ -10,7 +10,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage page * @subpackage page
*/ */
class ChatRefreshRoomListPage extends AbstractPage { class ChatRefreshRoomListPage extends AbstractPage {

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus, Marcel Werk * @author Tim Düsterhus, Marcel Werk
* @copyright 2010-2012 WoltLab GmbH * @copyright 2010-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.cache.builder * @subpackage system.cache.builder
*/ */
class ChatPermissionCacheBuilder implements ICacheBuilder { class ChatPermissionCacheBuilder implements ICacheBuilder {
@ -22,8 +22,8 @@ public function getData(array $cacheResource) {
if (count($groupIDs)) { if (count($groupIDs)) {
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
$conditionBuilder->add('acl_option.packageID IN (?)', array(\wcf\system\package\PackageDependencyHandler::getDependencies())); $conditionBuilder->add('acl_option.packageID IN (?)', array(\wcf\system\package\PackageDependencyHandler::getInstance()->getDependencies()));
$conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('timwolla.wcf.chat.room'))); $conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room')));
$conditionBuilder->add('option_to_group.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_group.optionID = acl_option.optionID');
$conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs)); $conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs));
$sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue, $sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue,
@ -31,9 +31,9 @@ public function getData(array $cacheResource) {
FROM wcf".WCF_N."_acl_option acl_option, FROM wcf".WCF_N."_acl_option acl_option,
wcf".WCF_N."_acl_option_to_group option_to_group wcf".WCF_N."_acl_option_to_group option_to_group
".$conditionBuilder; ".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters()); $stmt->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) { while ($row = $stmt->fetchArray()) {
if (!isset($data[$row['roomID']][$row['permission']])) $data[$row['roomID']][$row['permission']] = $row['optionValue']; if (!isset($data[$row['roomID']][$row['permission']])) $data[$row['roomID']][$row['permission']] = $row['optionValue'];
else $data[$row['roomID']][$row['permission']] = $row['optionValue'] || $data[$row['roomID']][$row['permission']]; else $data[$row['roomID']][$row['permission']] = $row['optionValue'] || $data[$row['roomID']][$row['permission']];
} }

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.cache.builder * @subpackage system.cache.builder
*/ */
class ChatRoomCacheBuilder implements ICacheBuilder { class ChatRoomCacheBuilder implements ICacheBuilder {

View File

@ -11,7 +11,7 @@
* @author Tim Düsterhus, Marcel Werk * @author Tim Düsterhus, Marcel Werk
* @copyright 2010-2012 WoltLab GmbH * @copyright 2010-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.chat.permissions * @subpackage system.chat.permissions
*/ */
class ChatPermissionHandler extends \wcf\system\SingletonFactory { class ChatPermissionHandler extends \wcf\system\SingletonFactory {
@ -27,13 +27,13 @@ class ChatPermissionHandler extends \wcf\system\SingletonFactory {
* @see \wcf\system\SingletonFactory::init() * @see \wcf\system\SingletonFactory::init()
*/ */
protected function init() { protected function init() {
$packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = \wcf\util\ChatUtil::getPackageID();
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
// get groups permissions // get groups permissions
$groups = implode(',', WCF::getUser()->getGroupIDs()); $groups = implode(',', WCF::getUser()->getGroupIDs());
$groupsFileName = \wcf\util\StringUtil::getHash(implode('-', WCF::getUser()->getGroupIDs())); $groupsFileName = \wcf\util\StringUtil::getHash(implode('-', WCF::getUser()->getGroupIDs()));
CacheHandler::getInstance()->addResource('chatPermission-'.$groups, WCF_DIR.'cache/cache.chatPermission-'.$groupsFileName.'.php', 'wcf\system\cache\builder\ChatPermissionCacheBuilder'); CacheHandler::getInstance()->addResource('chatPermission-'.$groups, WCF_DIR.'cache/cache.chatPermission-'.$groupsFileName.'.php', '\wcf\system\cache\builder\ChatPermissionCacheBuilder');
$this->chatPermissions = CacheHandler::getInstance()->get('chatPermission-'.$groups); $this->chatPermissions = CacheHandler::getInstance()->get('chatPermission-'.$groups);
// get user permissions // get user permissions
@ -49,8 +49,8 @@ protected function init() {
$userPermissions = array(); $userPermissions = array();
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
$conditionBuilder->add('acl_option.packageID IN (?)', array(PackageDependencyHandler::getDependencies())); $conditionBuilder->add('acl_option.packageID IN (?)', array(PackageDependencyHandler::getInstance()->getDependencies()));
$conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('timwolla.wcf.chat.room'))); $conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room')));
$conditionBuilder->add('option_to_user.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_user.optionID = acl_option.optionID');
$conditionBuilder->add('option_to_user.userID = ?', array(WCF::getUser()->userID)); $conditionBuilder->add('option_to_user.userID = ?', array(WCF::getUser()->userID));
$sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue, $sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue,
@ -58,9 +58,9 @@ protected function init() {
FROM wcf".WCF_N."_acl_option acl_option, FROM wcf".WCF_N."_acl_option acl_option,
wcf".WCF_N."_acl_option_to_user option_to_user wcf".WCF_N."_acl_option_to_user option_to_user
".$conditionBuilder; ".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql); $stmt = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters()); $stmt->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) { while ($row = $stmt->fetchArray()) {
$userPermissions[$row['roomID']][$row['permission']] = $row['optionValue']; $userPermissions[$row['roomID']][$row['permission']] = $row['optionValue'];
} }
@ -97,7 +97,7 @@ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) {
* Clears the cache. * Clears the cache.
*/ */
public static function clearCache() { public static function clearCache() {
$packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = \wcf\util\ChatUtil::getPackageID();
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
$ush->resetAll('chatUserPermissions', $packageID); $ush->resetAll('chatUserPermissions', $packageID);

View File

@ -0,0 +1,21 @@
<?php
namespace wcf\system\cronjob;
/**
* Vaporizes unneeded data.
*
* @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.wcf.chat
* @subpackage system.cronjob
*/
class ChatCleanupCronjob implements ICronjob {
/**
* @see wcf\system\ICronjob::execute()
*/
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
\wcf\data\chat\message\ChatMessageEditor::prune();
\wcf\data\chat\room\ChatRoomEditor::prune();
}
}

View File

@ -7,7 +7,7 @@
* @author Maximilian Mader * @author Maximilian Mader
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.event.listener * @subpackage system.event.listener
*/ */
class ChatRouteListener implements \wcf\system\event\IEventListener { class ChatRouteListener implements \wcf\system\event\IEventListener {

View File

@ -8,7 +8,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.menu.page * @subpackage system.menu.page
*/ */
class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider { class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider {

View File

@ -7,7 +7,7 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage system.option * @subpackage system.option
*/ */
class TimeIntervalOptionType extends TextOptionType { class TimeIntervalOptionType extends TextOptionType {

View File

@ -10,10 +10,10 @@
* @author Tim Düsterhus * @author Tim Düsterhus
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
* @subpackage util * @subpackage util
*/ */
class ChatUtil { final class ChatUtil {
/** /**
* Matches a time-interval with modifiers. * Matches a time-interval with modifiers.
* Each part may be optionally separated by a comma * Each part may be optionally separated by a comma
@ -22,8 +22,43 @@ class ChatUtil {
*/ */
const TIME_MODIFIER_REGEX = '((?:[0-9]+[s|h|d|w|m|y|S|H|D|W|M|Y]?,?)+)'; const TIME_MODIFIER_REGEX = '((?:[0-9]+[s|h|d|w|m|y|S|H|D|W|M|Y]?,?)+)';
/**
* Package identifier of Tims Chat.
*
* @var string
*/
const PACKAGE_IDENTIFIER = 'be.bastelstu.wcf.chat';
public static $serialize = array('color' => true); public static $serialize = array('color' => true);
/**
* Cached packageID of Tims Chat.
*
* @var integer
*/
private static $packageID = null;
/**
* Returns the packageID of Tims Chat.
*/
public static function getPackageID() {
if (self::$packageID === null) {
self::$packageID = PackageDependencyHandler::getInstance()->getPackageID(self::PACKAGE_IDENTIFIER);
}
return self::$packageID;
}
/**
* Returns a random number.
*
* @return integer
*/
public static function /* int */ getRandomNumber() {
return 4; // chosen by a fair dice roll
// guaranteed to be random
}
/** /**
* Creates a gradient out of two colors represented by an integer. * Creates a gradient out of two colors represented by an integer.
* The first byte is red, the second byte is green, the third one is blue. * The first byte is red, the second byte is green, the third one is blue.
@ -58,7 +93,7 @@ public static function gradient($string, $start, $end) {
*/ */
public static function readUserData($field) { public static function readUserData($field) {
$ush = UserStorageHandler::getInstance(); $ush = UserStorageHandler::getInstance();
$packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); $packageID = self::getPackageID();
// load storage // load storage
$ush->loadStorage(array(WCF::getUser()->userID), $packageID); $ush->loadStorage(array(WCF::getUser()->userID), $packageID);
@ -79,30 +114,6 @@ public static function readUserData($field) {
else return $data[WCF::getUser()->userID]; else return $data[WCF::getUser()->userID];
} }
/**
* Returns a random number.
*
* @return integer
*/
public static function /* int */ getRandomNumber() {
return 4; // chosen by a fair dice roll
// guaranteed to be random
}
/**
* Writes user data
*
* @param array $data
*/
public static function writeUserData(array $data) {
$ush = UserStorageHandler::getInstance();
$packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat');
foreach($data as $key => $value) {
$ush->update(WCF::getUser()->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID);
}
}
/** /**
* Splits a string into smaller chunks. * Splits a string into smaller chunks.
* UTF-8 safe version of str_split(). * UTF-8 safe version of str_split().
@ -175,4 +186,20 @@ public static function timeModifier($time) {
return (int) round($result, 0); return (int) round($result, 0);
} }
/**
* Writes user data
*
* @param array $data
*/
public static function writeUserData(array $data) {
$ush = UserStorageHandler::getInstance();
$packageID = self::getPackageID();
foreach($data as $key => $value) {
$ush->update(WCF::getUser()->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID);
}
}
private function __construct() { }
} }

View File

@ -1,10 +1,10 @@
/** /**
* Chat-Styles * Styles for Tims Chat
* *
* @author Tim Düsterhus, Maximilian Mader * @author Tim Düsterhus, Maximilian Mader
* @copyright 2010-2012 Tim Düsterhus * @copyright 2010-2012 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package be.bastelstu.wcf.chat
*/ */
#timsChatRoomContent { #timsChatRoomContent {

42
file/style/jCounter.scss Normal file
View File

@ -0,0 +1,42 @@
.jCounterContainer {
display: table;
> div {
display: table-row;
}
}
.jCounterInput {
height: 16px;
width: 100%;
position: relative;
z-index: 9999;
box-sizing: content-box !important;
}
.jCounterInput, .jCounter {
display: table-cell;
}
.jCounter {
text-align: center;
background-color: rgba(0, 0, 0, 0.7);
padding: 0 5px 0 10px;
position: relative;
z-index: 0 !important;
border-radius: 0px 5px 5px 0px;
border: 1px solid rgba(255, 255, 255, 0.3);
width: 30px;
&.color-1 {
color: #FFFFFF;
}
&.color-2 {
color: rgba(255,255,255,0.5);
}
&.color-3 {
color: #D40D12;
}
}

View File

@ -1,3 +1,12 @@
----
-- Database Structure for Tims Chat
--
-- @author Tim Düsterhus
-- @copyright 2010-2012 Tim Düsterhus
-- @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
-- @package be.bastelstu.wcf.chat
----
DROP TABLE IF EXISTS wcf1_chat_message; DROP TABLE IF EXISTS wcf1_chat_message;
CREATE TABLE wcf1_chat_message ( CREATE TABLE wcf1_chat_message (
messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,

View File

@ -4,6 +4,8 @@
<item name="wcf.acp.chat.room.list"><![CDATA[Chaträume]]></item> <item name="wcf.acp.chat.room.list"><![CDATA[Chaträume]]></item>
<item name="wcf.acp.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item> <item name="wcf.acp.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item>
<item name="wcf.acp.chat.room.edit"><![CDATA[Chatraum bearbeiten]]></item> <item name="wcf.acp.chat.room.edit"><![CDATA[Chatraum bearbeiten]]></item>
<item name="wcf.acp.chat.delete.sure"><![CDATA[Möchten Sie den Raum &bdquo;{$chatRoom->title|language}&ldquo; wirklich löschen?]]></item>
</category> </category>
<category name="wcf.acp.menu"> <category name="wcf.acp.menu">
@ -42,7 +44,7 @@
<item name="wcf.chat.protocol"><![CDATA[Protokoll]]></item> <item name="wcf.chat.protocol"><![CDATA[Protokoll]]></item>
<item name="wcf.chat.rooms"><![CDATA[Räume]]></item> <item name="wcf.chat.rooms"><![CDATA[Räume]]></item>
<item name="wcf.chat.users"><![CDATA[Nutzer]]></item> <item name="wcf.chat.users"><![CDATA[Nutzer]]></item>
<item name="wcf.chat.copyright"><![CDATA[<a href="http://timwolla.wbbaddons.de">Chat: <strong>Tims Chat</strong>{if CHAT_SHOW_VERSION} {$chatVersion}{/if}, entwickelt von <strong>TimWolla</strong></a>]]></item> <item name="wcf.chat.copyright"><![CDATA[<a href="http://tims.bastelstu.be">Chat: <strong>Tims Chat</strong>{if CHAT_SHOW_VERSION} {$chatVersion}{/if}, entwickelt von <strong>TimWolla</strong></a>]]></item>
<item name="wcf.chat.submit.default"><![CDATA[Zum Senden Enter drücken]]></item> <item name="wcf.chat.submit.default"><![CDATA[Zum Senden Enter drücken]]></item>
<item name="wcf.chat.scroll"><![CDATA[Scrollen]]></item> <item name="wcf.chat.scroll"><![CDATA[Scrollen]]></item>

View File

@ -2,7 +2,7 @@
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/object-type.xsd"> <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/object-type.xsd">
<import> <import>
<type> <type>
<name>timwolla.wcf.chat.room</name> <name>be.bastelstu.wcf.chat.room</name>
<definitionname>com.woltlab.wcf.acl</definitionname> <definitionname>com.woltlab.wcf.acl</definitionname>
</type> </type>
</import> </import>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<package name="timwolla.wcf.chat" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/package.xsd"> <package name="be.bastelstu.wcf.chat" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/package.xsd">
<packageinformation> <packageinformation>
<packagename><![CDATA[Tims Chat]]></packagename> <packagename><![CDATA[Tims Chat]]></packagename>
<packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription> <packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription>
@ -7,7 +7,7 @@
<isunique>1</isunique> <isunique>1</isunique>
<version>3.0.0 Alpha 8</version> <version>3.0.0 Alpha 8</version>
<date>2011-11-26</date> <date>2011-11-26</date>
<plugin>com.woltlab.wcf.bbcode</plugin> <!-- TODO: Correct me --> <plugin>com.woltlab.wcf.message</plugin> <!-- TODO: Correct me -->
</packageinformation> </packageinformation>
<authorinformation> <authorinformation>
@ -49,6 +49,6 @@
<instruction type="aclOption">acloptions.xml</instruction> <instruction type="aclOption">acloptions.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction> <instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction> <instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="script">acp/timwolla.wcf.chat.update.php</instruction> <instruction type="script">acp/be.bastelstu.wcf.chat.update.php</instruction>
</instructions> </instructions>
</package> </package>

View File

@ -4,7 +4,7 @@
<pagemenuitem name="wcf.header.menu.chat"> <pagemenuitem name="wcf.header.menu.chat">
<link>index.php/Chat</link> <link>index.php/Chat</link>
<position>header</position> <position>header</position>
<classname>wcf\system\menu\page\ChatPageMenuItemProvider</classname> <classname>\wcf\system\menu\page\ChatPageMenuItemProvider</classname>
</pagemenuitem> </pagemenuitem>
</import> </import>
</data> </data>

View File

@ -5,7 +5,7 @@
{include file='headInclude' sandbox=false} {include file='headInclude' sandbox=false}
<style type="text/css"> <style type="text/css">
@import url("{@$__wcf->getPath('wcf')}style/timwolla.wcf.chat.css"); @import url("{@$__wcf->getPath('wcf')}style/be.bastelstu.chat.css");
#timsChatCopyrightDialog { #timsChatCopyrightDialog {
background-image: url("{link controller='Chat' action='Copyright' sheep=1}{/link}"); background-image: url("{link controller='Chat' action='Copyright' sheep=1}{/link}");
background-position: right 45px; background-position: right 45px;
@ -40,52 +40,6 @@
.ajaxLoad { .ajaxLoad {
background-image: url({icon size='S'}spinner1{/icon}); background-image: url({icon size='S'}spinner1{/icon});
} }
/*
* jCounter CSS
*
* TODO: Seperate jCounter completely from Tims-Chat
*/
.jsCounterContainer {
display: table;
}
.jsCounterContainer > div {
display: table-row;
}
.jsCounterInput {
height: 16px;
box-sizing: content-box !important;
}
.jsCounterInput, .jsCounter {
display: table-cell;
}
.jsCounterInput, .jsCounterContainer {
width: 100%;
}
.jsCounter {
background-color: rgba(0, 0, 0, 0.7);
padding: 0 5px 0 10px;
position: relative;
z-index: 0 !important;
border-radius: 0px 5px 5px 0px;
border: 1px solid rgba(255, 255, 255, 0.3);
width: 30px;
}
.jsCounter.color-1 {
color: #FFFFFF;
}
.jsCounter.color-2 {
color: rgba(255,255,255,0.5);
}
.jsCounter.color-3 {
color: #D40D12;
}
</style> </style>
</head> </head>
@ -95,18 +49,18 @@
{include file='header' sandbox=false sidebarOrientation='right'} {include file='header' sandbox=false sidebarOrientation='right'}
<div id="timsChatRoomContent"> <div id="timsChatRoomContent">
<div id="timsChatTopic" class="wcf-border"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div> <div id="timsChatTopic" class="wcf-box wcf-marginBottom"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div>
<div class="timsChatMessageContainer wcf-border wcf-content"> <div class="timsChatMessageContainer wcf-box wcf-shadow1 wcf-boxPadding">
<ul> <ul>
<noscript><li class="wcf-error">{lang}wcf.chat.noJs{/lang}</li></noscript> <noscript><li class="wcf-error">{lang}wcf.chat.noJs{/lang}</li></noscript>
</ul> </ul>
</div> </div>
<form id="timsChatForm" action="{link controller="Chat" action="Send"}{/link}" method="post"> <form id="timsChatForm" action="{link controller="Chat" action="Send"}{/link}" method="post">
<input type="text" id="timsChatInput" class="inputText long jsCounterInput" name="text" autocomplete="off" maxlength="{@CHAT_MAX_LENGTH}" disabled="disabled" required="required" placeholder="{lang}wcf.chat.submit.default{/lang}" /> <input type="text" id="timsChatInput" class="inputText long" name="text" autocomplete="off" maxlength="{@CHAT_MAX_LENGTH}" disabled="disabled" required="required" placeholder="{lang}wcf.chat.submit.default{/lang}" />
</form> </form>
<div id="timsChatControls" class="wcf-border"> <div id="timsChatControls" class="wcf-box wcf-marginTop">
{if MODULE_SMILEY} {if MODULE_SMILEY}
<div id="smileyList"> <div id="smileyList">
<ul class="smilies"> <ul class="smilies">
@ -155,12 +109,12 @@
//<![CDATA[ //<![CDATA[
(function ($, window) { (function ($, window) {
// populate templates // populate templates
TimWolla.WCF.Chat.titleTemplate = (new WCF.Template('{ldelim}$title} - {'wcf.chat.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile(); be.bastelstu.WCF.Chat.titleTemplate = (new WCF.Template('{ldelim}$title} - {'wcf.chat.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile();
{capture assign='chatMessageTemplate'}{include file='chatMessage'}{/capture} {capture assign='chatMessageTemplate'}{include file='chatMessage'}{/capture}
TimWolla.WCF.Chat.messageTemplate = (new WCF.Template('{@$chatMessageTemplate|encodeJS}')).compile(); be.bastelstu.WCF.Chat.messageTemplate = (new WCF.Template('{@$chatMessageTemplate|encodeJS}')).compile();
// populate config // populate config
TimWolla.WCF.Chat.config = { be.bastelstu.WCF.Chat.config = {
reloadTime: {@CHAT_RELOADTIME}, reloadTime: {@CHAT_RELOADTIME},
unloadURL: '{link controller='Chat' action='Leave'}{/link}' unloadURL: '{link controller='Chat' action='Leave'}{/link}'
} }
@ -172,15 +126,15 @@
'wcf.chat.newMessages': '{lang}wcf.chat.newMessages{/lang}' 'wcf.chat.newMessages': '{lang}wcf.chat.newMessages{/lang}'
}); });
WCF.Icon.addObject({ WCF.Icon.addObject({
'timwolla.wcf.chat.chat': '{icon size='L'}chat1{/icon}' 'be.bastelstu.wcf.chat.chat': '{icon size='L'}chat1{/icon}'
}); });
{event name='shouldInit'} {event name='shouldInit'}
// Boot the chat // Boot the chat
TimWolla.WCF.Chat.init(); be.bastelstu.WCF.Chat.init();
{event name='didInit'} {event name='didInit'}
// show the last X messages // show the last X messages
TimWolla.WCF.Chat.handleMessages([ be.bastelstu.WCF.Chat.handleMessages([
{implode from=$newestMessages item='message'} {implode from=$newestMessages item='message'}
{@$message->jsonify()} {@$message->jsonify()}
{/implode} {/implode}

View File

@ -1,7 +1,7 @@
{if $templateName == 'chat'}<address id="timsChatCopyright" class="copyright">{lang}wcf.chat.copyright{/lang}</address> {if $templateName == 'chat'}<address id="timsChatCopyright" class="copyright">{lang}wcf.chat.copyright{/lang}</address>
{elseif $templateName == 'chatCopyright'} {elseif $templateName == 'chatCopyright'}
<dl><dt>Project-Leader</dt><dd><ul><li><a href="http://timwolla.wbbaddons.de/">Tim Düsterhus</a></li></ul></dd></dl> <dl><dt>Project-Leader</dt><dd><ul><li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li></ul></dd></dl>
<dl><dt>Developer</dt><dd><ul><li><a href="http://timwolla.wbbaddons.de/">Tim Düsterhus</a></li><li><a href="https://github.com/max-m">Maximilian Mader</a></li></ul></dd></dl> <dl><dt>Developer</dt><dd><ul><li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li><li><a href="https://github.com/max-m">Maximilian Mader</a></li></ul></dd></dl>
<dl><dt>Graphics</dt><dd><ul><li><a href="http://www.cls-design.com/">Tom</a></li></ul></dd></dl> <dl><dt>Graphics</dt><dd><ul><li><a href="http://www.cls-design.com/">Tom</a></li></ul></dd></dl>
<dl><dt>Translation</dt><dd><ul><li>Riccardo Vianello (it)</li></ul></dd></dl> <dl><dt>Translation</dt><dd><ul><li>Riccardo Vianello (it)</li></ul></dd></dl>
<dl><dt>Thanks</dt><dd><ul><li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li><li><a href="https://github.com/dtdesign">Alexander Ebert</a></li><li>Gabi</li><li><a href="https://github.com/Leon-">Stefan Hahn</a></li><li><a href="http://packageforge.de">Oliver Kliebisch</a></li><li>Christian Kubandt</li><li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li></ul></dd></dl> <dl><dt>Thanks</dt><dd><ul><li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li><li><a href="https://github.com/dtdesign">Alexander Ebert</a></li><li>Gabi</li><li><a href="https://github.com/Leon-">Stefan Hahn</a></li><li><a href="http://packageforge.de">Oliver Kliebisch</a></li><li>Christian Kubandt</li><li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li></ul></dd></dl>

View File

@ -1,2 +1,2 @@
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/TimWolla.WCF.Chat.js{if $chatVersion|isset}?version={$chatVersion|urlencode}{/if}"></script> <script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/be.bastelstu.WCF.Chat.js{if $chatVersion|isset}?version={$chatVersion|urlencode}{/if}"></script>
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/jCounter.jQuery.js"></script> <script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/jCounter.jQuery.js"></script>