From 583cbf290363ffcfdea9fa0ff76529f4acc278f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Sun, 4 Mar 2012 20:02:37 +0100 Subject: [PATCH 01/27] Instantly clear the input Avoids problems with rapid typing --- file/js/TimWolla.WCF.Chat.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index 7bd749c..97e79ce 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -428,17 +428,17 @@ consoleMock ?= # Finally free the fish @freeTheFish() if $('#timsChatInput').val().trim().toLowerCase() is '/free the fish' + text = $('#timsChatInput').val() + $('#timsChatInput').val('').focus().keyup() $.ajax $('#timsChatForm').attr('action'), data: - text: $('#timsChatInput').val(), + text: text smilies: $('#timsChatSmilies').data('status') type: 'POST', beforeSend: (jqXHR) -> $('#timsChatInput').addClass 'ajaxLoad' success: $.proxy((data, textStatus, jqXHR) -> @getMessages() - $('#timsChatInput').val('').focus() - $('#timsChatInput').keyup() , @) complete: () -> $('#timsChatInput').removeClass 'ajaxLoad' From 81462252dcc72dfec08ab35c97fa3ec0ed66f037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Mon, 5 Mar 2012 16:49:45 +0100 Subject: [PATCH 02/27] PackageDependencyHandler is now a Singleton Fixes Tims Chat in accordance to WoltLab/WCF@6eb121400f68e60cefb5a01f8e2d181c14bd4c7c --- file/lib/acp/form/ChatRoomAddForm.class.php | 4 ++-- file/lib/acp/form/ChatRoomEditForm.class.php | 18 +++++++++--------- file/lib/data/chat/room/ChatRoom.class.php | 4 ++-- .../data/chat/room/ChatRoomEditor.class.php | 2 +- .../ChatPermissionCacheBuilder.class.php | 2 +- .../permission/ChatPermissionHandler.class.php | 8 ++++---- file/lib/util/ChatUtil.class.php | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/file/lib/acp/form/ChatRoomAddForm.class.php b/file/lib/acp/form/ChatRoomAddForm.class.php index e5a95e1..3959c7b 100644 --- a/file/lib/acp/form/ChatRoomAddForm.class.php +++ b/file/lib/acp/form/ChatRoomAddForm.class.php @@ -99,7 +99,7 @@ public function save() { $roomID = $returnValues['returnValues']->roomID; 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', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); // update title $chatRoomEditor->update(array( @@ -108,7 +108,7 @@ public function save() { } 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', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); // update topic $chatRoomEditor->update(array( diff --git a/file/lib/acp/form/ChatRoomEditForm.class.php b/file/lib/acp/form/ChatRoomEditForm.class.php index a0298be..45afe02 100644 --- a/file/lib/acp/form/ChatRoomEditForm.class.php +++ b/file/lib/acp/form/ChatRoomEditForm.class.php @@ -1,8 +1,8 @@ <?php namespace wcf\acp\form; -use wcf\system\language\I18nHandler; -use wcf\system\package\PackageDependencyHandler; -use wcf\system\WCF; +use \wcf\system\language\I18nHandler; +use \wcf\system\package\PackageDependencyHandler; +use \wcf\system\WCF; /** * Shows the chatroom edit form. @@ -64,20 +64,20 @@ public function save() { $this->title = 'wcf.chat.room.title'.$this->roomObj->roomID; if (I18nHandler::getInstance()->isPlainValue('title')) { - I18nHandler::getInstance()->remove($this->title, PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->remove($this->title, PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); $this->title = I18nHandler::getInstance()->getValue('title'); } else { - I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); } $this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID; if (I18nHandler::getInstance()->isPlainValue('topic')) { - I18nHandler::getInstance()->remove($this->topic, PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->remove($this->topic, PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); $this->topic = I18nHandler::getInstance()->getValue('topic'); } else { - I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); } \wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID); @@ -105,8 +105,8 @@ public function readData() { parent::readData(); if (!count($_POST)) { - I18nHandler::getInstance()->setOptions('title', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'), $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('title', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'), $this->roomObj->title, 'wcf.chat.room.title\d+'); + I18nHandler::getInstance()->setOptions('topic', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'), $this->roomObj->topic, 'wcf.chat.room.topic\d+'); $this->title = $this->roomObj->title; $this->topic = $this->roomObj->topic; diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index bc29a31..686b1ec 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -43,7 +43,7 @@ public function __toString() { * @return integer */ public function countUsers() { - $packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); $sql = "SELECT count(*) as count @@ -100,7 +100,7 @@ public function getTitle() { * @return array<\wcf\data\user\User> */ public function getUsers() { - $packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); $sql = "SELECT userID diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 43216c4..24cc939 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -29,7 +29,7 @@ public static function resetCache() { */ public static function deleteAll(array $objectIDs = array()) { parent::deleteAll($objectIDs); - $packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { diff --git a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php index 947b05b..783138d 100644 --- a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php +++ b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php @@ -22,7 +22,7 @@ public function getData(array $cacheResource) { if (count($groupIDs)) { $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('option_to_group.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs)); diff --git a/file/lib/system/chat/permission/ChatPermissionHandler.class.php b/file/lib/system/chat/permission/ChatPermissionHandler.class.php index fc3e79e..d304954 100644 --- a/file/lib/system/chat/permission/ChatPermissionHandler.class.php +++ b/file/lib/system/chat/permission/ChatPermissionHandler.class.php @@ -27,13 +27,13 @@ class ChatPermissionHandler extends \wcf\system\SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); // get groups permissions $groups = 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); // get user permissions @@ -49,7 +49,7 @@ protected function init() { $userPermissions = array(); $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('option_to_user.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_user.userID = ?', array(WCF::getUser()->userID)); @@ -97,7 +97,7 @@ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { * Clears the cache. */ public static function clearCache() { - $packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush->resetAll('chatUserPermissions', $packageID); diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 1be6657..2130185 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -58,7 +58,7 @@ public static function gradient($string, $start, $end) { */ public static function readUserData($field) { $ush = UserStorageHandler::getInstance(); - $packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); // load storage $ush->loadStorage(array(WCF::getUser()->userID), $packageID); @@ -96,7 +96,7 @@ public static function /* int */ getRandomNumber() { */ public static function writeUserData(array $data) { $ush = UserStorageHandler::getInstance(); - $packageID = PackageDependencyHandler::getPackageID('timwolla.wcf.chat'); + $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); foreach($data as $key => $value) { $ush->update(WCF::getUser()->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID); From ec41d5be61790f55398d0400f4c9417780cd1090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Tue, 6 Mar 2012 15:26:21 +0100 Subject: [PATCH 03/27] Fixed sortables to comply with WoltLab/WCF@9dcf11e223c5f8bce0931f94a5648e0020543c48 --- acptemplate/chatRoomList.tpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index e42144a..759a2a6 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -33,7 +33,7 @@ <ol class="wcf-sortableList" data-object-id="0"> {content} {foreach from=$objects item=chatRoom} - <li class="wcf-sortableNode chatRoomRow" data-object-id="{@$chatRoom->roomID}"> + <li class="wcf-sortableNode wcf-sortableNoNestingchatRoomRow" data-object-id="{@$chatRoom->roomID}"> <span class="wcf-sortableNodeLabel"> <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> @@ -46,13 +46,19 @@ {/if} </span> </span> + <ol class="wcf-sortableList" data-object-id="{@$chatRoom->roomID}"></ol></li> </li> {/foreach} {/content} </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} <p class="wcf-warning">{lang}wcf.acp.chat.room.noneAvailable{/lang}</p> {/hascontent} </section> + {include file='footer'} \ No newline at end of file From 2f57151a735d118b500988402160f091ff9d11e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Tue, 6 Mar 2012 15:27:45 +0100 Subject: [PATCH 04/27] Fixed class --- acptemplate/chatRoomList.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 759a2a6..021ad21 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -33,7 +33,7 @@ <ol class="wcf-sortableList" data-object-id="0"> {content} {foreach from=$objects item=chatRoom} - <li class="wcf-sortableNode wcf-sortableNoNestingchatRoomRow" data-object-id="{@$chatRoom->roomID}"> + <li class="wcf-sortableNode wcf-sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}"> <span class="wcf-sortableNodeLabel"> <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> From 92e948d653db3e05782f5fbde9142ea89c6dc191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Tue, 6 Mar 2012 18:00:33 +0100 Subject: [PATCH 05/27] Fixing class to comply with WoltLab/WCF@503b17c915b2767c56378674463895fc0de758f2 --- acptemplate/chatRoomAdd.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acptemplate/chatRoomAdd.tpl b/acptemplate/chatRoomAdd.tpl index a3c0e81..2e86b46 100644 --- a/acptemplate/chatRoomAdd.tpl +++ b/acptemplate/chatRoomAdd.tpl @@ -43,7 +43,7 @@ </div> <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> <legend>{lang}wcf.acp.chat.room.data{/lang}</legend> From 02fbd9c938dec6fb412b099b65360da4e90de2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Wed, 7 Mar 2012 17:04:24 +0100 Subject: [PATCH 06/27] Change <plugin> to com.woltlab.wcf.message --- package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.xml b/package.xml index 8609d5e..a50cf49 100644 --- a/package.xml +++ b/package.xml @@ -7,7 +7,7 @@ <isunique>1</isunique> <version>3.0.0 Alpha 8</version> <date>2011-11-26</date> - <plugin>com.woltlab.wcf.bbcode</plugin> <!-- TODO: Correct me --> + <plugin>com.woltlab.wcf.message</plugin> <!-- TODO: Correct me --> </packageinformation> <authorinformation> From 85d39a8642c849f111ee69fc164161f6247fe755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Wed, 7 Mar 2012 17:49:52 +0100 Subject: [PATCH 07/27] Fixed Template --- acptemplate/chatRoomList.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 021ad21..6f44c35 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -28,7 +28,7 @@ {/if} </div> -<section id="chatRoomList" class="wcf-border wcf-sortableListContainer"> +<section id="chatRoomList" class="wcf-box wcf-marginTop wcf-boxPadding wcf-shadow1 wcf-sortableListContainer"> {hascontent} <ol class="wcf-sortableList" data-object-id="0"> {content} @@ -37,7 +37,7 @@ <span class="wcf-sortableNodeLabel"> <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> - <span class="wcf-sortableButtonContainer"> + <span class="wcf-statusDisplay wcf-sortableButtonContainer"> {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> {/if} From ab1618f9c51d1b0d8c92e562e488522dcdd0cf5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Wed, 7 Mar 2012 19:39:56 +0100 Subject: [PATCH 08/27] Fixing classes --- template/chat.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template/chat.tpl b/template/chat.tpl index b46b0a4..354a35f 100755 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -95,8 +95,8 @@ {include file='header' sandbox=false sidebarOrientation='right'} <div id="timsChatRoomContent"> - <div id="timsChatTopic" class="wcf-border"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div> - <div class="timsChatMessageContainer wcf-border wcf-content"> + <div id="timsChatTopic" class="wcf-box wcf-marginBottom"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div> + <div class="timsChatMessageContainer wcf-box wcf-shadow1 wcf-boxPadding"> <ul> <noscript><li class="wcf-error">{lang}wcf.chat.noJs{/lang}</li></noscript> </ul> @@ -106,7 +106,7 @@ <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}" /> </form> - <div id="timsChatControls" class="wcf-border"> + <div id="timsChatControls" class="wcf-box wcf-marginTop"> {if MODULE_SMILEY} <div id="smileyList"> <ul class="smilies"> From dfeef5e2d61c67df2a1323f7d5d9b3bbd318e712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Wed, 7 Mar 2012 23:04:19 +0100 Subject: [PATCH 09/27] Formatting of CoffeeScript --- file/js/TimWolla.WCF.Chat.coffee | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index 97e79ce..54e909b 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -63,7 +63,7 @@ consoleMock ?= # Search all matching users for user in $ '.timsChatUser' - username = $(user).data('username'); + username = $(user).data 'username' if username.indexOf(firstChars) is 0 users.push username @@ -198,7 +198,7 @@ consoleMock ?= $('#timsChatTopic').text data.topic $('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden') - $('.timsChatMessage').addClass('unloaded', 800); + $('.timsChatMessage').addClass 'unloaded', 800 @handleMessages data.messages document.title = @titleTemplate.fetch data , @) @@ -243,7 +243,7 @@ consoleMock ?= top: '+=' + top left: '+=' + left , 1e3 - , 1.5e3); + , 1.5e3) ### # Loads new messages. ### @@ -273,13 +273,13 @@ consoleMock ?= # Disable scrolling automagically when user manually scrolled unless @oldScrollTop is null if $('.timsChatMessageContainer').scrollTop() < @oldScrollTop - if $('#timsChatAutoscroll').data('status') is 1 + if $('#timsChatAutoscroll').data 'status' is 1 $('#timsChatAutoscroll').click() $('#timsChatAutoscroll').parent().addClass('default').fadeOut('slow').fadeIn('slow') # Insert the messages for message in messages - continue if $.wcfIsset 'timsChatMessage'+message.messageID # Prevent problems with race condition + continue if $.wcfIsset 'timsChatMessage' + message.messageID # Prevent problems with race condition @events.newMessage.fire message output = @messageTemplate.fetch message @@ -304,7 +304,7 @@ consoleMock ?= foundUsers = { } for user in users id = 'timsChatUser-'+user.userID - element = $('#'+id) + element = $ '#'+id # Move the user to the correct position if element[0] @@ -370,7 +370,7 @@ consoleMock ?= # @param object message ### notify: (message) -> - return if @isActive or $('#timsChatNotify').data('status') is 0 + return if @isActive or $('#timsChatNotify').data 'status' is 0 @newMessageCount++ document.title = '(' + @newMessageCount + ') ' + @titleTemplate.fetch @@ -379,8 +379,8 @@ consoleMock ?= # Desktop Notifications if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 - title = WCF.Language.get('wcf.chat.newMessages') - icon = WCF.Icon.get('timwolla.wcf.chat.chat') + title = WCF.Language.get 'wcf.chat.newMessages' + icon = WCF.Icon.get 'timwolla.wcf.chat.chat' content = message.username + message.separator + ' ' + message.message notification = window.webkitNotifications.createNotification icon, title, content notification.show() @@ -400,7 +400,7 @@ consoleMock ?= success: $.proxy((data, textStatus, jqXHR) -> $('#timsChatRoomList li').remove() $('#toggleRooms a').removeClass 'ajaxLoad' - $('#toggleRooms .wcf-badge').text(data.length); + $('#toggleRooms .wcf-badge').text data.length for room in data li = $ '<li></li>' @@ -433,7 +433,7 @@ consoleMock ?= $.ajax $('#timsChatForm').attr('action'), data: text: text - smilies: $('#timsChatSmilies').data('status') + smilies: $('#timsChatSmilies').data 'status' type: 'POST', beforeSend: (jqXHR) -> $('#timsChatInput').addClass 'ajaxLoad' @@ -450,13 +450,13 @@ consoleMock ?= toggleSidebarContents: (target) -> return if target.parents('li').hasClass 'active' - if target.parents('li').attr('id') is 'toggleUsers' + if target.parents('li').attr 'id' is 'toggleUsers' $('#toggleUsers').addClass 'active' $('#toggleRooms').removeClass 'active' $('#timsChatRoomList').hide() $('#timsChatUserList').show() - else if target.parents('li').attr('id') is 'toggleRooms' + else if target.parents('li').attr 'id' is 'toggleRooms' $('#toggleRooms').addClass 'active' $('#toggleUsers').removeClass 'active' From 92018b9a63a36fc5ebc7303c3e87ed83065cbdf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 8 Mar 2012 21:27:54 +0100 Subject: [PATCH 10/27] Optimizing reading of smilies. --- file/lib/page/ChatPage.class.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 0023607..37e7c48 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -87,18 +87,10 @@ public function readData() { $this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES); \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); - $this->readDefaultSmileys(); + $this->smilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies(); $this->readChatVersion(); } - /** - * Reads the smilies in the default category. - */ - public function readDefaultSmileys() { - $smilies = \wcf\data\smiley\SmileyCache::getInstance()->getSmilies(); - $this->smilies = $smilies[null]; - } - /** * @see \wcf\page\IPage::readParameters() */ From 382bbdba3ce6db31795b1f239df27f5aa8b722e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 8 Mar 2012 21:30:37 +0100 Subject: [PATCH 11/27] Avoid problem with disabled join messages and no last messages. --- file/lib/page/ChatPage.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 37e7c48..302ed4a 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -85,7 +85,12 @@ public function readData() { } $this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES); - \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); + try { + \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); + } + catch (SystemException $e) { + \wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0)); + } $this->smilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies(); $this->readChatVersion(); From 8b0dd6e3914efcda86bfebcc49c523bfd7166222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 8 Mar 2012 21:31:09 +0100 Subject: [PATCH 12/27] SystemException was not imported --- file/lib/page/ChatPage.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 302ed4a..24d56a0 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -88,7 +88,7 @@ public function readData() { try { \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); } - catch (SystemException $e) { + catch (\wcf\system\SystemException $e) { \wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0)); } From 6e89b04751b2df58b8251cb622b39c65c49ab055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 8 Mar 2012 22:07:46 +0100 Subject: [PATCH 13/27] Adding cleanup-cronjob (Currently missing the PIP) Moving getPackageID into the Util --- file/lib/acp/form/ChatRoomAddForm.class.php | 5 +- file/lib/acp/form/ChatRoomEditForm.class.php | 13 ++-- .../chat/message/ChatMessageEditor.class.php | 18 +++-- file/lib/data/chat/room/ChatRoom.class.php | 4 +- .../data/chat/room/ChatRoomEditor.class.php | 46 ++++++++++-- file/lib/page/ChatPage.class.php | 7 +- .../ChatPermissionCacheBuilder.class.php | 6 +- .../ChatPermissionHandler.class.php | 10 +-- .../cronjob/ChatCleanupCronjob.class.php | 21 ++++++ file/lib/util/ChatUtil.class.php | 75 ++++++++++++------- 10 files changed, 142 insertions(+), 63 deletions(-) create mode 100644 file/lib/system/cronjob/ChatCleanupCronjob.class.php diff --git a/file/lib/acp/form/ChatRoomAddForm.class.php b/file/lib/acp/form/ChatRoomAddForm.class.php index 3959c7b..6edee56 100644 --- a/file/lib/acp/form/ChatRoomAddForm.class.php +++ b/file/lib/acp/form/ChatRoomAddForm.class.php @@ -2,7 +2,6 @@ namespace wcf\acp\form; use \wcf\system\exception\UserInputException; use \wcf\system\language\I18nHandler; -use \wcf\system\package\PackageDependencyHandler; use \wcf\system\WCF; /** @@ -99,7 +98,7 @@ public function save() { $roomID = $returnValues['returnValues']->roomID; if (!I18nHandler::getInstance()->isPlainValue('title')) { - I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); // update title $chatRoomEditor->update(array( @@ -108,7 +107,7 @@ public function save() { } if (!I18nHandler::getInstance()->isPlainValue('topic')) { - I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); // update topic $chatRoomEditor->update(array( diff --git a/file/lib/acp/form/ChatRoomEditForm.class.php b/file/lib/acp/form/ChatRoomEditForm.class.php index 45afe02..0ab9b1f 100644 --- a/file/lib/acp/form/ChatRoomEditForm.class.php +++ b/file/lib/acp/form/ChatRoomEditForm.class.php @@ -1,7 +1,6 @@ <?php namespace wcf\acp\form; use \wcf\system\language\I18nHandler; -use \wcf\system\package\PackageDependencyHandler; use \wcf\system\WCF; /** @@ -64,20 +63,20 @@ public function save() { $this->title = 'wcf.chat.room.title'.$this->roomObj->roomID; if (I18nHandler::getInstance()->isPlainValue('title')) { - I18nHandler::getInstance()->remove($this->title, PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->remove($this->title, \wcf\util\ChatUtil::getPackageID()); $this->title = I18nHandler::getInstance()->getValue('title'); } else { - I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', PackageDependencyHandler::getInstance()->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; if (I18nHandler::getInstance()->isPlainValue('topic')) { - I18nHandler::getInstance()->remove($this->topic, PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat')); + I18nHandler::getInstance()->remove($this->topic, \wcf\util\ChatUtil::getPackageID()); $this->topic = I18nHandler::getInstance()->getValue('topic'); } else { - I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', PackageDependencyHandler::getInstance()->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); @@ -105,8 +104,8 @@ public function readData() { parent::readData(); if (!count($_POST)) { - I18nHandler::getInstance()->setOptions('title', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'), $this->roomObj->title, 'wcf.chat.room.title\d+'); - I18nHandler::getInstance()->setOptions('topic', PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'), $this->roomObj->topic, 'wcf.chat.room.topic\d+'); + I18nHandler::getInstance()->setOptions('title', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->title, 'wcf.chat.room.title\d+'); + I18nHandler::getInstance()->setOptions('topic', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'wcf.chat.room.topic\d+'); $this->title = $this->roomObj->title; $this->topic = $this->roomObj->topic; diff --git a/file/lib/data/chat/message/ChatMessageEditor.class.php b/file/lib/data/chat/message/ChatMessageEditor.class.php index ee54251..b7b09e8 100644 --- a/file/lib/data/chat/message/ChatMessageEditor.class.php +++ b/file/lib/data/chat/message/ChatMessageEditor.class.php @@ -23,17 +23,19 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor { * @param integer $lifetime Delete messages older that this time. * @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 - ".static::getDatabaseIndexName()." + ".$baseClass::getDatabaseTableIndexName()." FROM - ".static::getDatabaseTableName()." + ".$baseClass::getDatabaseTableName()." WHERE - time < ?"; - $statement = \wcf\system\WCF::getDB()->prepareStatement($sql); - $statement->execute(TIME_NOW - $lifetime); + time < ?"; + $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); + $stmt->execute(array(TIME_NOW - $lifetime)); $objectIDs = array(); - while ($objectIDs[] = $statement->fetchColumn()); - return static::deleteAll($objectIDs); + while ($objectIDs[] = $stmt->fetchColumn()); + + return self::deleteAll($objectIDs); } } diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index 686b1ec..2f5fce3 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -43,7 +43,7 @@ public function __toString() { * @return integer */ public function countUsers() { - $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\util\ChatUtil::getPackageID(); $sql = "SELECT count(*) as count @@ -100,7 +100,7 @@ public function getTitle() { * @return array<\wcf\data\user\User> */ public function getUsers() { - $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\util\ChatUtil::getPackageID(); $sql = "SELECT userID diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 24cc939..07b0fe6 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -17,19 +17,13 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data */ 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() */ public static function deleteAll(array $objectIDs = array()) { parent::deleteAll($objectIDs); - $packageID = \wcf\system\package\PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\util\ChatUtil::getPackageID(); WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { @@ -40,4 +34,40 @@ public static function deleteAll(array $objectIDs = array()) { return count($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'); + } } diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 24d56a0..ef9f547 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -88,7 +88,7 @@ public function readData() { try { \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); } - catch (\wcf\system\SystemException $e) { + catch (\wcf\system\exception\SystemException $e) { \wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0)); } @@ -161,12 +161,15 @@ public function show() { if (!WCF::getUser()->userID) { throw new \wcf\system\exception\PermissionDeniedException(); } + \wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat'); // remove index breadcrumb WCF::getBreadcrumbs()->remove(0); + parent::show(); - // break if not ajax + + // break if not using ajax if ($this->useTemplate) exit; @header('Content-type: application/json'); diff --git a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php index 783138d..da4d04e 100644 --- a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php +++ b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php @@ -31,9 +31,9 @@ public function getData(array $cacheResource) { FROM wcf".WCF_N."_acl_option acl_option, wcf".WCF_N."_acl_option_to_group option_to_group ".$conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditionBuilder->getParameters()); - while ($row = $statement->fetchArray()) { + $stmt = WCF::getDB()->prepareStatement($sql); + $stmt->execute($conditionBuilder->getParameters()); + while ($row = $stmt->fetchArray()) { 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']]; } diff --git a/file/lib/system/chat/permission/ChatPermissionHandler.class.php b/file/lib/system/chat/permission/ChatPermissionHandler.class.php index d304954..4726e65 100644 --- a/file/lib/system/chat/permission/ChatPermissionHandler.class.php +++ b/file/lib/system/chat/permission/ChatPermissionHandler.class.php @@ -27,7 +27,7 @@ class ChatPermissionHandler extends \wcf\system\SingletonFactory { * @see \wcf\system\SingletonFactory::init() */ protected function init() { - $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\util\ChatUtil::getPackageID(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); // get groups permissions @@ -58,9 +58,9 @@ protected function init() { FROM wcf".WCF_N."_acl_option acl_option, wcf".WCF_N."_acl_option_to_user option_to_user ".$conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditionBuilder->getParameters()); - while ($row = $statement->fetchArray()) { + $stmt = WCF::getDB()->prepareStatement($sql); + $stmt->execute($conditionBuilder->getParameters()); + while ($row = $stmt->fetchArray()) { $userPermissions[$row['roomID']][$row['permission']] = $row['optionValue']; } @@ -97,7 +97,7 @@ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { * Clears the cache. */ public static function clearCache() { - $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = \wcf\util\ChatUtil::getPackageID(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush->resetAll('chatUserPermissions', $packageID); diff --git a/file/lib/system/cronjob/ChatCleanupCronjob.class.php b/file/lib/system/cronjob/ChatCleanupCronjob.class.php new file mode 100644 index 0000000..63851ef --- /dev/null +++ b/file/lib/system/cronjob/ChatCleanupCronjob.class.php @@ -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 timwolla.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(); + } +} diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 2130185..d48c584 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -22,8 +22,43 @@ class ChatUtil { */ 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 = 'timwolla.wcf.chat'; + 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. * 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) { $ush = UserStorageHandler::getInstance(); - $packageID = PackageDependencyHandler::getInstance()->getPackageID('timwolla.wcf.chat'); + $packageID = self::getPackageID(); // load storage $ush->loadStorage(array(WCF::getUser()->userID), $packageID); @@ -79,30 +114,6 @@ public static function readUserData($field) { 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::getInstance()->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. * UTF-8 safe version of str_split(). @@ -175,4 +186,18 @@ public static function timeModifier($time) { 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); + } + } } From f26fa50bd62286e48ae63ca0d24ae345ec85ada1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Fri, 9 Mar 2012 21:23:17 +0100 Subject: [PATCH 14/27] Adding PHP Syntax Check to build.php --- build.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/build.php b/build.php index 5b96816..49536f0 100755 --- a/build.php +++ b/build.php @@ -43,12 +43,34 @@ } 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 ----------------- EOT; - chdir('file'); - passthru('tar cvf ../file.tar * --exclude=*.coffee --exclude=*.scss', $code); + passthru('tar cvf ../file.tar * --exclude=*.coffee --exclude=*.scss --exclude=.sass-cache', $code); if ($code != 0) exit($code); echo <<<EOT From 1664ae3e2ea063effcd2182bb7fcd2190fb776dd Mon Sep 17 00:00:00 2001 From: max-m <maximilian.mader@gmx.de> Date: Sun, 11 Mar 2012 15:07:28 +0100 Subject: [PATCH 15/27] Seperated counter from chat. --- file/js/jCounter.jQuery.coffee | 20 +++++++++++--- template/chat.tpl | 48 +--------------------------------- 2 files changed, 18 insertions(+), 50 deletions(-) diff --git a/file/js/jCounter.jQuery.coffee b/file/js/jCounter.jQuery.coffee index dd9b96d..5eee1cf 100644 --- a/file/js/jCounter.jQuery.coffee +++ b/file/js/jCounter.jQuery.coffee @@ -10,16 +10,23 @@ $.fn.jCounter = (container, options) -> options = $.extend max: 0 - counterClass: 'jsCounter' + counterClass: 'jCounter' countUp: false + cssFile: 'wcf/style/jCounter.css' + width: '100%' , options if this.attr('maxlength') max = this.attr('maxlength') else max = options.max + if $('#jCounterCSS').length == 0 + $('head').append('<link id="jCounterCSS" rel="stylesheet" type="text/css" href="' + options.cssFile + '" >') + 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) else if typeof container is 'object' @@ -33,7 +40,14 @@ else 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 else if length > max / 2 diff --git a/template/chat.tpl b/template/chat.tpl index 354a35f..cdb8263 100755 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -40,52 +40,6 @@ .ajaxLoad { 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> </head> @@ -103,7 +57,7 @@ </div> <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_LENGTH}" disabled="disabled" required="required" placeholder="{lang}wcf.chat.submit.default{/lang}" /> </form> <div id="timsChatControls" class="wcf-box wcf-marginTop"> From b7c868ea3274667558384b4afe406e1e600684e9 Mon Sep 17 00:00:00 2001 From: max-m <maximilian.mader@gmx.de> Date: Sun, 11 Mar 2012 15:12:42 +0100 Subject: [PATCH 16/27] Fixed wrong constant name and added forgotten counter CSS file --- file/style/jCounter.scss | 42 ++++++++++++++++++++++++++++++++++++++++ template/chat.tpl | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 file/style/jCounter.scss diff --git a/file/style/jCounter.scss b/file/style/jCounter.scss new file mode 100644 index 0000000..1acc5e9 --- /dev/null +++ b/file/style/jCounter.scss @@ -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; + } +} \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index cdb8263..4c49f24 100755 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -57,7 +57,7 @@ </div> <form id="timsChatForm" action="{link controller="Chat" action="Send"}{/link}" method="post"> - <input type="text" id="timsChatInput" class="inputText long" name="text" autocomplete="off" maxlength="{@CHAT_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> <div id="timsChatControls" class="wcf-box wcf-marginTop"> From d29a0498ba068f72dc4ac0907e8d54200ebfc0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Sun, 11 Mar 2012 18:19:11 +0100 Subject: [PATCH 17/27] Fixing one problem. --- file/js/TimWolla.WCF.Chat.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/TimWolla.WCF.Chat.coffee index 54e909b..3a3d42e 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/TimWolla.WCF.Chat.coffee @@ -450,13 +450,13 @@ consoleMock ?= toggleSidebarContents: (target) -> return if target.parents('li').hasClass 'active' - if target.parents('li').attr 'id' is 'toggleUsers' + if target.parents('li').attr('id') is 'toggleUsers' $('#toggleUsers').addClass 'active' $('#toggleRooms').removeClass 'active' $('#timsChatRoomList').hide() $('#timsChatUserList').show() - else if target.parents('li').attr 'id' is 'toggleRooms' + else if target.parents('li').attr('id') is 'toggleRooms' $('#toggleRooms').addClass 'active' $('#toggleUsers').removeClass 'active' From 24161a593967ebb20b2c54cfedbfd0175666f01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Mon, 12 Mar 2012 17:18:15 +0100 Subject: [PATCH 18/27] Changing Package Identifier to be.bastelstu.wcf.chat --- acloptions.xml | 12 +++---- build.php | 10 +++--- eventListener.xml | 4 +-- ...e.php => be.bastelstu.wcf.chat.update.php} | 4 +-- file/icon/chat.svg | 1 + file/icon/chat1.svg | 1 + ...at.coffee => be.bastelstu.WCF.Chat.coffee} | 36 ++++++++++--------- file/lib/acp/form/ChatRoomAddForm.class.php | 4 +-- file/lib/acp/form/ChatRoomEditForm.class.php | 2 +- file/lib/acp/page/ChatRoomListPage.class.php | 2 +- file/lib/action/ChatLeaveAction.class.php | 2 +- .../data/chat/message/ChatMessage.class.php | 2 +- .../chat/message/ChatMessageAction.class.php | 2 +- .../chat/message/ChatMessageEditor.class.php | 2 +- .../chat/message/ChatMessageList.class.php | 2 +- file/lib/data/chat/room/ChatRoom.class.php | 2 +- .../data/chat/room/ChatRoomAction.class.php | 2 +- .../data/chat/room/ChatRoomEditor.class.php | 2 +- .../lib/data/chat/room/ChatRoomList.class.php | 2 +- file/lib/form/ChatForm.class.php | 2 +- file/lib/page/ChatCopyrightPage.class.php | 2 +- file/lib/page/ChatMessagePage.class.php | 2 +- file/lib/page/ChatPage.class.php | 4 +-- .../page/ChatRefreshRoomListPage.class.php | 2 +- .../ChatPermissionCacheBuilder.class.php | 4 +-- .../builder/ChatRoomCacheBuilder.class.php | 2 +- .../commands/ChatCommandHandler.class.php | 2 +- .../ChatPermissionHandler.class.php | 4 +-- .../cronjob/ChatCleanupCronjob.class.php | 2 +- .../listener/ChatRouteListener.class.php | 2 +- .../page/ChatPageMenuItemProvider.class.php | 2 +- .../option/TimeIntervalOptionType.class.php | 2 +- file/lib/util/ChatUtil.class.php | 4 +-- ...f.chat.scss => be.bastelstu.wcf.chat.scss} | 4 +-- install.sql | 9 +++++ language/de.xml | 2 +- objectType.xml | 2 +- package.xml | 4 +-- pagemenu.xml | 2 +- template/chat.tpl | 14 ++++---- template/chatCopyright.tpl | 4 +-- template/chatJavascriptInclude.tpl | 2 +- 42 files changed, 93 insertions(+), 80 deletions(-) rename file/acp/{timwolla.wcf.chat.update.php => be.bastelstu.wcf.chat.update.php} (92%) rename file/js/{TimWolla.WCF.Chat.coffee => be.bastelstu.WCF.Chat.coffee} (92%) rename file/style/{timwolla.wcf.chat.scss => be.bastelstu.wcf.chat.scss} (98%) diff --git a/acloptions.xml b/acloptions.xml index 5df092e..61aea2b 100644 --- a/acloptions.xml +++ b/acloptions.xml @@ -3,30 +3,30 @@ <import> <categories> <category name="user"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> </category> <category name="mod"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> </category> </categories> <options> <option name="user.canEnter"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> <categoryname>user</categoryname> </option> <option name="user.canWrite"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> <categoryname>user</categoryname> </option> <option name="mod.canAlwaysEnter"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> <categoryname>mod</categoryname> </option> <option name="mod.canAlwaysWrite"> - <objecttype>timwolla.wcf.chat.room</objecttype> + <objecttype>be.bastelstu.wcf.chat.room</objecttype> <categoryname>mod</categoryname> </option> </options> diff --git a/build.php b/build.php index 49536f0..9f0c717 100755 --- a/build.php +++ b/build.php @@ -6,7 +6,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat */ echo <<<EOT Cleaning up @@ -18,7 +18,7 @@ if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile); 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 Building JavaScript @@ -92,12 +92,12 @@ if ($code != 0) exit($code); echo <<<EOT -Building timwolla.wcf.chat.tar ------------------------------- +Building be.bastelstu.wcf.chat.tar +---------------------------------- EOT; 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 (file_exists('file.tar')) unlink('file.tar'); diff --git a/eventListener.xml b/eventListener.xml index 612b7d8..42fa8b0 100644 --- a/eventListener.xml +++ b/eventListener.xml @@ -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"> <import> <eventlistener> - <eventclassname>wcf\system\request\RouteHandler</eventclassname> + <eventclassname>\wcf\system\request\RouteHandler</eventclassname> <eventname>didInit</eventname> <environment>user</environment> <inherit>0</inherit> - <listenerclassname>wcf\system\event\listener\ChatRouteListener</listenerclassname> + <listenerclassname>\wcf\system\event\listener\ChatRouteListener</listenerclassname> </eventlistener> </import> </data> \ No newline at end of file diff --git a/file/acp/timwolla.wcf.chat.update.php b/file/acp/be.bastelstu.wcf.chat.update.php similarity index 92% rename from file/acp/timwolla.wcf.chat.update.php rename to file/acp/be.bastelstu.wcf.chat.update.php index 7a9c967..ba1d721 100644 --- a/file/acp/timwolla.wcf.chat.update.php +++ b/file/acp/be.bastelstu.wcf.chat.update.php @@ -1,5 +1,5 @@ <?php -namespace timwolla\wcf\chat; +namespace be\bastelstu\wcf\chat; /** * Handles updates. @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat */ final class Update { private $rooms = null; diff --git a/file/icon/chat.svg b/file/icon/chat.svg index 19808ff..ceaa23b 100644 --- a/file/icon/chat.svg +++ b/file/icon/chat.svg @@ -4,6 +4,7 @@ @author Maximilian Mader @copyright 2011 Tim Düsterhus @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"> <title>Chat</title> diff --git a/file/icon/chat1.svg b/file/icon/chat1.svg index e8adc13..d9fd61b 100644 --- a/file/icon/chat1.svg +++ b/file/icon/chat1.svg @@ -4,6 +4,7 @@ @author Maximilian Mader @copyright 2011 Tim Düsterhus @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"> <title>Chat</title> diff --git a/file/js/TimWolla.WCF.Chat.coffee b/file/js/be.bastelstu.WCF.Chat.coffee similarity index 92% rename from file/js/TimWolla.WCF.Chat.coffee rename to file/js/be.bastelstu.WCF.Chat.coffee index 3a3d42e..8ca8ea8 100644 --- a/file/js/TimWolla.WCF.Chat.coffee +++ b/file/js/be.bastelstu.WCF.Chat.coffee @@ -1,14 +1,16 @@ ### -# TimWolla.WCF.Chat +# be.bastelstu.WCF.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 timwolla.wcf.chat +# @package be.bastelstu.wcf.chat ### -TimWolla ?= {} -TimWolla.WCF ?= {} +be ?= {} +be.bastelstu ?= {} +be.bastelstu.WCF ?= {} + consoleMock = console consoleMock ?= log: () ->, @@ -16,7 +18,7 @@ consoleMock ?= error: () -> (($, window, console) -> - TimWolla.WCF.Chat = + be.bastelstu.WCF.Chat = # Tims Chat stops loading when this reaches zero # TODO: We need an explosion animation shields: 3 @@ -45,7 +47,7 @@ consoleMock ?= refreshRoomList: null fish: null init: () -> - console.log '[TimWolla.WCF.Chat] Initializing' + console.log '[be.bastelstu.WCF.Chat Initializing' @bindEvents() @events.newMessage.add $.proxy @notify, @ @@ -54,7 +56,7 @@ consoleMock ?= @refreshRoomList() @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 ### @@ -120,7 +122,7 @@ consoleMock ?= 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 # Insert name and increment offset @@ -217,7 +219,7 @@ consoleMock ?= ### freeTheFish: () -> 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.css position: 'absolute' @@ -256,12 +258,12 @@ consoleMock ?= @handleUsers(data.users) , @) 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 @pe.refreshRoomList.stop() @pe.getMessages.stop() @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' , @) ### @@ -308,12 +310,12 @@ consoleMock ?= # Move the user to the correct position 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() $('#timsChatUserList').append element # Insert the user else - console.log '[TimWolla.WCF.Chat] Inserting User: "' + user.username + '"' + console.log '[be.bastelstu.WCF.Chat Inserting User: "' + user.username + '"' li = $ '<li></li>' li.attr 'id', id li.addClass 'timsChatUser' @@ -339,7 +341,7 @@ consoleMock ?= # Remove users that were not found $('.timsChatUser').each () -> 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(); @@ -380,7 +382,7 @@ consoleMock ?= if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 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 notification = window.webkitNotifications.createNotification icon, title, content notification.show() @@ -391,7 +393,7 @@ consoleMock ?= # Refreshes the room-list. ### refreshRoomList: () -> - console.log '[TimWolla.WCF.Chat] Refreshing the roomlist' + console.log '[be.bastelstu.WCF.Chat Refreshing the roomlist' $('#toggleRooms a').addClass 'ajaxLoad' $.ajax $('#toggleRooms a').data('refreshUrl'), @@ -414,7 +416,7 @@ consoleMock ?= @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. diff --git a/file/lib/acp/form/ChatRoomAddForm.class.php b/file/lib/acp/form/ChatRoomAddForm.class.php index 6edee56..90f32cb 100644 --- a/file/lib/acp/form/ChatRoomAddForm.class.php +++ b/file/lib/acp/form/ChatRoomAddForm.class.php @@ -10,7 +10,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage acp.form */ class ChatRoomAddForm extends ACPForm { @@ -42,7 +42,7 @@ class ChatRoomAddForm extends ACPForm { * @see \wcf\page\AbstractPage::__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(); } diff --git a/file/lib/acp/form/ChatRoomEditForm.class.php b/file/lib/acp/form/ChatRoomEditForm.class.php index 0ab9b1f..c56f7b6 100644 --- a/file/lib/acp/form/ChatRoomEditForm.class.php +++ b/file/lib/acp/form/ChatRoomEditForm.class.php @@ -9,7 +9,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage acp.form */ class ChatRoomEditForm extends ChatRoomAddForm { diff --git a/file/lib/acp/page/ChatRoomListPage.class.php b/file/lib/acp/page/ChatRoomListPage.class.php index ac1314a..665015b 100644 --- a/file/lib/acp/page/ChatRoomListPage.class.php +++ b/file/lib/acp/page/ChatRoomListPage.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage acp.page */ class ChatRoomListPage extends \wcf\page\MultipleLinkPage { diff --git a/file/lib/action/ChatLeaveAction.class.php b/file/lib/action/ChatLeaveAction.class.php index f2f3146..eb47bf6 100644 --- a/file/lib/action/ChatLeaveAction.class.php +++ b/file/lib/action/ChatLeaveAction.class.php @@ -9,7 +9,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage action */ class ChatLeaveAction extends AbstractAction { diff --git a/file/lib/data/chat/message/ChatMessage.class.php b/file/lib/data/chat/message/ChatMessage.class.php index 32f7ecc..b5d5e52 100755 --- a/file/lib/data/chat/message/ChatMessage.class.php +++ b/file/lib/data/chat/message/ChatMessage.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.message */ class ChatMessage extends \wcf\data\DatabaseObject { diff --git a/file/lib/data/chat/message/ChatMessageAction.class.php b/file/lib/data/chat/message/ChatMessageAction.class.php index fef87e4..f1c4872 100644 --- a/file/lib/data/chat/message/ChatMessageAction.class.php +++ b/file/lib/data/chat/message/ChatMessageAction.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.message */ class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction { diff --git a/file/lib/data/chat/message/ChatMessageEditor.class.php b/file/lib/data/chat/message/ChatMessageEditor.class.php index b7b09e8..052ee34 100644 --- a/file/lib/data/chat/message/ChatMessageEditor.class.php +++ b/file/lib/data/chat/message/ChatMessageEditor.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.message */ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor { diff --git a/file/lib/data/chat/message/ChatMessageList.class.php b/file/lib/data/chat/message/ChatMessageList.class.php index bb3853e..94c718b 100644 --- a/file/lib/data/chat/message/ChatMessageList.class.php +++ b/file/lib/data/chat/message/ChatMessageList.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatMessageList extends \wcf\data\DatabaseObjectList { diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index 2f5fce3..0ad0cbb 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -9,7 +9,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php index d83f994..b3e85d5 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction { diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 07b0fe6..0409b30 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { diff --git a/file/lib/data/chat/room/ChatRoomList.class.php b/file/lib/data/chat/room/ChatRoomList.class.php index 7e369be..161eed8 100644 --- a/file/lib/data/chat/room/ChatRoomList.class.php +++ b/file/lib/data/chat/room/ChatRoomList.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatRoomList extends \wcf\data\DatabaseObjectList { diff --git a/file/lib/form/ChatForm.class.php b/file/lib/form/ChatForm.class.php index 9699c8f..390ec15 100644 --- a/file/lib/form/ChatForm.class.php +++ b/file/lib/form/ChatForm.class.php @@ -11,7 +11,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage form */ class ChatForm extends AbstractForm { diff --git a/file/lib/page/ChatCopyrightPage.class.php b/file/lib/page/ChatCopyrightPage.class.php index cf4deea..2f84f9c 100644 --- a/file/lib/page/ChatCopyrightPage.class.php +++ b/file/lib/page/ChatCopyrightPage.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage page */ class ChatCopyrightPage extends AbstractPage { diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index 4b1a5d9..062f4f3 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -9,7 +9,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage page */ class ChatMessagePage extends AbstractPage { diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index ef9f547..ff6b1e5 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -10,7 +10,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage page */ class ChatPage extends AbstractPage { @@ -51,7 +51,7 @@ public function readChatVersion() { ); $packages = CacheHandler::getInstance()->get('packages'); foreach ($packages as $package) { - if ($package->package != 'timwolla.wcf.chat') continue; + if ($package->package != \wcf\util\ChatUtil::PACKAGE_IDENTIFIER) continue; $this->chatVersion = $package->packageVersion; return; } diff --git a/file/lib/page/ChatRefreshRoomListPage.class.php b/file/lib/page/ChatRefreshRoomListPage.class.php index 36f4156..4e72c7c 100644 --- a/file/lib/page/ChatRefreshRoomListPage.class.php +++ b/file/lib/page/ChatRefreshRoomListPage.class.php @@ -10,7 +10,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage page */ class ChatRefreshRoomListPage extends AbstractPage { diff --git a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php index da4d04e..8a7144d 100644 --- a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php +++ b/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php @@ -8,7 +8,7 @@ * @author Tim Düsterhus, Marcel Werk * @copyright 2010-2012 WoltLab GmbH * @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 */ class ChatPermissionCacheBuilder implements ICacheBuilder { @@ -23,7 +23,7 @@ public function getData(array $cacheResource) { if (count($groupIDs)) { $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); $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.groupID IN (?)', array($groupIDs)); $sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue, diff --git a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php b/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php index 985d823..ceda612 100644 --- a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php +++ b/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage system.cache.builder */ class ChatRoomCacheBuilder implements ICacheBuilder { diff --git a/file/lib/system/chat/commands/ChatCommandHandler.class.php b/file/lib/system/chat/commands/ChatCommandHandler.class.php index c5c93f3..0aaa74b 100644 --- a/file/lib/system/chat/commands/ChatCommandHandler.class.php +++ b/file/lib/system/chat/commands/ChatCommandHandler.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage system.chat.commands */ class ChatCommandHandler { diff --git a/file/lib/system/chat/permission/ChatPermissionHandler.class.php b/file/lib/system/chat/permission/ChatPermissionHandler.class.php index 4726e65..a020a0f 100644 --- a/file/lib/system/chat/permission/ChatPermissionHandler.class.php +++ b/file/lib/system/chat/permission/ChatPermissionHandler.class.php @@ -11,7 +11,7 @@ * @author Tim Düsterhus, Marcel Werk * @copyright 2010-2012 WoltLab GmbH * @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 */ class ChatPermissionHandler extends \wcf\system\SingletonFactory { @@ -50,7 +50,7 @@ protected function init() { $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); $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.userID = ?', array(WCF::getUser()->userID)); $sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue, diff --git a/file/lib/system/cronjob/ChatCleanupCronjob.class.php b/file/lib/system/cronjob/ChatCleanupCronjob.class.php index 63851ef..5acde97 100644 --- a/file/lib/system/cronjob/ChatCleanupCronjob.class.php +++ b/file/lib/system/cronjob/ChatCleanupCronjob.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage system.cronjob */ class ChatCleanupCronjob implements ICronjob { diff --git a/file/lib/system/event/listener/ChatRouteListener.class.php b/file/lib/system/event/listener/ChatRouteListener.class.php index 7b6ee57..4f5f30b 100644 --- a/file/lib/system/event/listener/ChatRouteListener.class.php +++ b/file/lib/system/event/listener/ChatRouteListener.class.php @@ -7,7 +7,7 @@ * @author Maximilian Mader * @copyright 2010-2012 Tim Düsterhus * @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 */ class ChatRouteListener implements \wcf\system\event\IEventListener { diff --git a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php index e38a136..692d39f 100644 --- a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php +++ b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage system.menu.page */ class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider { diff --git a/file/lib/system/option/TimeIntervalOptionType.class.php b/file/lib/system/option/TimeIntervalOptionType.class.php index 68421af..259287f 100644 --- a/file/lib/system/option/TimeIntervalOptionType.class.php +++ b/file/lib/system/option/TimeIntervalOptionType.class.php @@ -7,7 +7,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage system.option */ class TimeIntervalOptionType extends TextOptionType { diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index d48c584..b5dc5f5 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -10,7 +10,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage util */ class ChatUtil { @@ -27,7 +27,7 @@ class ChatUtil { * * @var string */ - const PACKAGE_IDENTIFIER = 'timwolla.wcf.chat'; + const PACKAGE_IDENTIFIER = 'be.bastelstu.wcf.chat'; public static $serialize = array('color' => true); diff --git a/file/style/timwolla.wcf.chat.scss b/file/style/be.bastelstu.wcf.chat.scss similarity index 98% rename from file/style/timwolla.wcf.chat.scss rename to file/style/be.bastelstu.wcf.chat.scss index 6445270..fbf8274 100644 --- a/file/style/timwolla.wcf.chat.scss +++ b/file/style/be.bastelstu.wcf.chat.scss @@ -1,10 +1,10 @@ /** - * Chat-Styles + * Styles for Tims Chat * * @author Tim Düsterhus, Maximilian Mader * @copyright 2010-2012 Tim Düsterhus * @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 { diff --git a/install.sql b/install.sql index 0a3219d..604efe1 100644 --- a/install.sql +++ b/install.sql @@ -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; CREATE TABLE wcf1_chat_message ( messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, diff --git a/language/de.xml b/language/de.xml index 768f216..a0a47bb 100644 --- a/language/de.xml +++ b/language/de.xml @@ -42,7 +42,7 @@ <item name="wcf.chat.protocol"><![CDATA[Protokoll]]></item> <item name="wcf.chat.rooms"><![CDATA[Räume]]></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.scroll"><![CDATA[Scrollen]]></item> diff --git a/objectType.xml b/objectType.xml index 7df3ce1..38677d4 100644 --- a/objectType.xml +++ b/objectType.xml @@ -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"> <import> <type> - <name>timwolla.wcf.chat.room</name> + <name>be.bastelstu.wcf.chat.room</name> <definitionname>com.woltlab.wcf.acl</definitionname> </type> </import> diff --git a/package.xml b/package.xml index a50cf49..b8d75f2 100644 --- a/package.xml +++ b/package.xml @@ -1,5 +1,5 @@ <?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> <packagename><![CDATA[Tims Chat]]></packagename> <packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription> @@ -49,6 +49,6 @@ <instruction type="aclOption">acloptions.xml</instruction> <instruction type="acpMenu">acpMenu.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> </package> diff --git a/pagemenu.xml b/pagemenu.xml index 6f55380..a9b0c76 100755 --- a/pagemenu.xml +++ b/pagemenu.xml @@ -4,7 +4,7 @@ <pagemenuitem name="wcf.header.menu.chat"> <link>index.php/Chat</link> <position>header</position> - <classname>wcf\system\menu\page\ChatPageMenuItemProvider</classname> + <classname>\wcf\system\menu\page\ChatPageMenuItemProvider</classname> </pagemenuitem> </import> </data> \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index 4c49f24..df83380 100755 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -5,7 +5,7 @@ {include file='headInclude' sandbox=false} <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 { background-image: url("{link controller='Chat' action='Copyright' sheep=1}{/link}"); background-position: right 45px; @@ -109,12 +109,12 @@ //<![CDATA[ (function ($, window) { // 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} - TimWolla.WCF.Chat.messageTemplate = (new WCF.Template('{@$chatMessageTemplate|encodeJS}')).compile(); + be.bastelstu.WCF.Chat.messageTemplate = (new WCF.Template('{@$chatMessageTemplate|encodeJS}')).compile(); // populate config - TimWolla.WCF.Chat.config = { + be.bastelstu.WCF.Chat.config = { reloadTime: {@CHAT_RELOADTIME}, unloadURL: '{link controller='Chat' action='Leave'}{/link}' } @@ -126,15 +126,15 @@ 'wcf.chat.newMessages': '{lang}wcf.chat.newMessages{/lang}' }); 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'} // Boot the chat - TimWolla.WCF.Chat.init(); + be.bastelstu.WCF.Chat.init(); {event name='didInit'} // show the last X messages - TimWolla.WCF.Chat.handleMessages([ + be.bastelstu.WCF.Chat.handleMessages([ {implode from=$newestMessages item='message'} {@$message->jsonify()} {/implode} diff --git a/template/chatCopyright.tpl b/template/chatCopyright.tpl index 2df384a..4049e79 100644 --- a/template/chatCopyright.tpl +++ b/template/chatCopyright.tpl @@ -1,7 +1,7 @@ {if $templateName == 'chat'}<address id="timsChatCopyright" class="copyright">{lang}wcf.chat.copyright{/lang}</address> {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>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>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://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>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> diff --git a/template/chatJavascriptInclude.tpl b/template/chatJavascriptInclude.tpl index 3f1198b..61b033b 100644 --- a/template/chatJavascriptInclude.tpl +++ b/template/chatJavascriptInclude.tpl @@ -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> \ No newline at end of file From a3b912c823c5d0d7fce064defda6f1305b7bcdff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Mon, 12 Mar 2012 22:51:29 +0100 Subject: [PATCH 19/27] Prevent constructing of Util. --- file/lib/util/ChatUtil.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index b5dc5f5..2e80b09 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -13,7 +13,7 @@ * @package be.bastelstu.wcf.chat * @subpackage util */ -class ChatUtil { +final class ChatUtil { /** * Matches a time-interval with modifiers. * Each part may be optionally separated by a comma @@ -200,4 +200,6 @@ public static function writeUserData(array $data) { $ush->update(WCF::getUser()->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID); } } + + private function __construct() { } } From d264a6be088a1d1507a5f94cde9810eaf787e72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 15 Mar 2012 17:35:22 +0100 Subject: [PATCH 20/27] Fixed Permission Check --- acptemplate/chatRoomList.tpl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 6f44c35..01f74d1 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -35,7 +35,11 @@ {foreach from=$objects item=chatRoom} <li class="wcf-sortableNode wcf-sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}"> <span class="wcf-sortableNodeLabel"> - <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> + {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} + <a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> + {else} + {$chatRoom->title|language} + {/if} <span class="wcf-statusDisplay wcf-sortableButtonContainer"> {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} From a1f939d763b0711ff3ac91c056faa5b5c2d7ac2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 15 Mar 2012 20:11:01 +0100 Subject: [PATCH 21/27] Fixed comment --- file/lib/data/chat/room/ChatRoomAction.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php index b3e85d5..4ebdacc 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -8,7 +8,7 @@ * @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 + * @package timwolla.wcf.chat * @subpackage data.chat.room */ class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction { @@ -28,7 +28,7 @@ class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction { protected $permissionsUpdate = array('admin.content.chat.canEditRoom'); /** - * Fixes create to append new boards. + * Fixes create to append new rooms. */ public function create() { $room = parent::create(); From 32b1a5badaf8169565077cd42995e08231829656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@googlemail.com> Date: Thu, 15 Mar 2012 20:16:24 +0100 Subject: [PATCH 22/27] Fixed bad fix + use fetchColumn --- file/lib/data/chat/room/ChatRoomAction.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php index 4ebdacc..dc24404 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -8,7 +8,7 @@ * @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 timwolla.wcf.chat + * @package be.bastelstu.wcf.chat * @subpackage data.chat.room */ class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction { @@ -39,10 +39,9 @@ public function create() { FOR UPDATE"; $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute(); - $row = $stmt->fetchArray(); $sql = "UPDATE wcf".WCF_N."_chat_room - SET position = ".($row['max'] + 1)." + SET position = ".($stmt->fetchColumn() + 1)." WHERE roomID = ?"; $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute(array($room->roomID)); From 03a84cdc4ffcc938289a69c946fa05e0b5dbc0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Fri, 16 Mar 2012 16:50:49 +0100 Subject: [PATCH 23/27] Fixed the delete.sure-message --- acptemplate/chatRoomList.tpl | 2 +- language/de.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 01f74d1..2a1582f 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -46,7 +46,7 @@ <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 $__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} </span> </span> diff --git a/language/de.xml b/language/de.xml index a0a47bb..aabea83 100644 --- a/language/de.xml +++ b/language/de.xml @@ -4,6 +4,8 @@ <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.edit"><![CDATA[Chatraum bearbeiten]]></item> + + <item name="wcf.acp.chat.delete.sure"><![CDATA[Möchten Sie den Raum „{$chatRoom->title|language}“ wirklich löschen?]]></item> </category> <category name="wcf.acp.menu"> From 907a348674e95f18210e01dcac648ead18ff79cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Fri, 16 Mar 2012 17:09:12 +0100 Subject: [PATCH 24/27] Use offset for sorting --- acptemplate/chatRoomList.tpl | 4 ++-- file/lib/data/chat/room/ChatRoomAction.class.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 2a1582f..7e4ca7e 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -4,7 +4,7 @@ //<![CDATA[ $(function() { 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> @@ -30,7 +30,7 @@ <section id="chatRoomList" class="wcf-box wcf-marginTop wcf-boxPadding wcf-shadow1 wcf-sortableListContainer"> {hascontent} - <ol class="wcf-sortableList" data-object-id="0"> + <ol class="wcf-sortableList" data-object-id="0" start="{$startIndex}"> {content} {foreach from=$objects item=chatRoom} <li class="wcf-sortableNode wcf-sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}"> diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php index 4ebdacc..c1b5b92 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -71,6 +71,8 @@ public function validateUpdatePosition() { if (!isset($this->parameters['data']['structure'])) { throw new ValidateActionException('Missing parameter structure'); } + + if (!isset($this->parameters['data']['offset'])) $this->parameters['data']['offset'] = 0; } /** @@ -82,7 +84,7 @@ public function updatePosition() { $roomList->sqlLimit = 0; $roomList->readObjects(); - $i = 0; + $i = $this->parameters['data']['offset']; WCF::getDB()->beginTransaction(); foreach ($this->parameters['data']['structure'][0] as $roomID) { $room = $roomList->search($roomID); From 3a22d897b4b23e2cdede7945b684dc9de9837438 Mon Sep 17 00:00:00 2001 From: max-m <maximilian.mader@gmx.de> Date: Sun, 18 Mar 2012 20:05:05 +0100 Subject: [PATCH 25/27] Closes #4 --- file/js/be.bastelstu.WCF.Chat.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file/js/be.bastelstu.WCF.Chat.coffee b/file/js/be.bastelstu.WCF.Chat.coffee index 8ca8ea8..059970e 100644 --- a/file/js/be.bastelstu.WCF.Chat.coffee +++ b/file/js/be.bastelstu.WCF.Chat.coffee @@ -275,7 +275,7 @@ consoleMock ?= # Disable scrolling automagically when user manually scrolled unless @oldScrollTop is null if $('.timsChatMessageContainer').scrollTop() < @oldScrollTop - if $('#timsChatAutoscroll').data 'status' is 1 + if $('#timsChatAutoscroll').data('status') is 1 $('#timsChatAutoscroll').click() $('#timsChatAutoscroll').parent().addClass('default').fadeOut('slow').fadeIn('slow') From c18b9e739ba4cf1299486a0b54f574e7ebe0a78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 22 Mar 2012 16:26:52 +0100 Subject: [PATCH 26/27] Transaction is only committed when the parent call succeeds as well --- file/lib/data/chat/room/ChatRoomEditor.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 0409b30..5cc9146 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -22,7 +22,6 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data * @see \wcf\data\DatabaseObjectEditor::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { - parent::deleteAll($objectIDs); $packageID = \wcf\util\ChatUtil::getPackageID(); WCF::getDB()->beginTransaction(); @@ -30,9 +29,10 @@ public static function deleteAll(array $objectIDs = array()) { \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::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); } /** From 499526000ac123e6c4862b1ed32fa31098b9b64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <timwolla@arcor.de> Date: Thu, 22 Mar 2012 16:38:08 +0100 Subject: [PATCH 27/27] SQL-Standard --- file/lib/data/chat/room/ChatRoomAction.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php index 44952f1..73b0aea 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -34,8 +34,8 @@ public function create() { $room = parent::create(); WCF::getDB()->beginTransaction(); - $sql = "SELECT max(position) as max - FROM wcf".WCF_N."_chat_room + $sql = "SELECT MAX(position) + FROM wcf".WCF_N."_chat_room FOR UPDATE"; $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute();