diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee
index 6d654a2..7878a27 100644
--- a/file/js/be.bastelstu.Chat.litcoffee
+++ b/file/js/be.bastelstu.Chat.litcoffee
@@ -58,9 +58,10 @@ Attributes needed for notificationss
Attributes needed for autocompleter
- autocompleteOffset: 0
- autocompleteValue: null
- autocompleteCaret: 0
+ autocomplete:
+ offset: 0
+ value: null
+ caret: 0
Attributes needed for automated scrolling
@@ -117,7 +118,7 @@ Finished!
**autocomplete(firstChars, offset = @autocompleteOffset)**
Autocompletes a username based on the `firstChars` given and the given `offset`. `offset` allows to skip users.
- autocomplete: (firstChars, offset = @autocompleteOffset) ->
+ autocompleter: (firstChars, offset = @autocomplete.offset) ->
Create an array of active chatters with usernames beginning with `firstChars`
@@ -171,18 +172,19 @@ Calls the submit handler (`@submit`) when the `#timsChatForm` is `submit`ted.
Autocompletes a username when TAB is pressed.
$('#timsChatInput').keydown (event) =>
- if event.keyCode is 9
+ if event.keyCode is $.ui.keyCode.TAB
+ input = $(event.currentTarget)
event.preventDefault()
Calculate `firstChars` to autocomplete, based on the caret position.
- @autocompleteValue = $('#timsChatInput').val() if @autocompleteValue is null
- @autocompleteCaret = $('#timsChatInput').getCaret() if @autocompleteCaret is null
+ @autocomplete.value ?= input.val()
+ @autocomplete.caret ?= input.getCaret()
- beforeCaret = @autocompleteValue.substring 0, @autocompleteCaret
+ beforeCaret = @autocomplete.value.substring 0, @autocomplete.caret
lastSpace = beforeCaret.lastIndexOf ' '
- beforeComplete = @autocompleteValue.substring 0, lastSpace + 1
- toComplete = @autocompleteValue.substring lastSpace + 1
+ beforeComplete = @autocomplete.value.substring 0, lastSpace + 1
+ toComplete = @autocomplete.value.substring lastSpace + 1
nextSpace = toComplete.indexOf ' '
if nextSpace is -1
afterComplete = '';
@@ -195,25 +197,25 @@ Calculate `firstChars` to autocomplete, based on the caret position.
Insert completed value into `#timsChatInput`
- name = @autocomplete toComplete
+ name = @autocompleter toComplete
- $('#timsChatInput').val "#{beforeComplete}#{name} #{afterComplete}"
- $('#timsChatInput').setCaret (beforeComplete + name).length + 1
+ input.val "#{beforeComplete}#{name} #{afterComplete}"
+ input.setCaret (beforeComplete + name).length + 1
@autocompleteOffset++
Resets autocompleter to default status, when a key is pressed that is not TAB.
else
- @autocompleteOffset = 0
- @autocompleteValue = null
- @autocompleteCaret = null
+ @autocomplete.offset = 0
+ @autocomplete.value = null
+ @autocomplete.caret = null
Resets autocompleter to default status, when input is `click`ed, as the position of the caret may have changed.
$('#timsChatInput').click =>
- @autocompleteOffset = 0
- @autocompleteValue = null
- @autocompleteCaret = null
+ @autocomplete.offset = 0
+ @autocomplete.value = null
+ @autocomplete.caret = null
Refreshes the room list when the associated button is `click`ed.
@@ -526,7 +528,7 @@ Build HTML of new user and append it.
menu.append $ "
#{WCF.Language.get('chat.general.kick')}"
menu.append $ "#{WCF.Language.get('chat.general.ban')}"
# TODO: SID and co
- menu.append $ """#{WCF.Language.get('chat.general.profile')}"""
+ menu.append $ """#{WCF.Language.get('chat.general.profile')}"""
@events.userMenu.fire user, menu
li.append menu
diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php
index c085abb..87c4322 100644
--- a/file/lib/page/ChatPage.class.php
+++ b/file/lib/page/ChatPage.class.php
@@ -79,6 +79,11 @@ class ChatPage extends \wcf\page\AbstractPage {
*/
public $userData = array();
+ /**
+ * @see wcf\page\AbstractPage::$enableTracking
+ */
+ public $enableTracking = true;
+
/**
* @see \wcf\page\IPage::assignVariables()
*/
@@ -221,4 +226,18 @@ public function show() {
));
exit;
}
+
+ /**
+ * @see wcf\page\ITrackablePage::getObjectType()
+ */
+ public function getObjectType() {
+ return 'be.bastelstu.chat.room';
+ }
+
+ /**
+ * @see wcf\page\ITrackablePage::getObjectID()
+ */
+ public function getObjectID() {
+ return $this->room->roomID;
+ }
}
diff --git a/file/lib/page/NewMessagesPage.class.php b/file/lib/page/NewMessagesPage.class.php
index 34ffde5..7ee73c6 100644
--- a/file/lib/page/NewMessagesPage.class.php
+++ b/file/lib/page/NewMessagesPage.class.php
@@ -1,5 +1,7 @@
$user->getAvatar()->getImageTag(24),
32 => $user->getAvatar()->getImageTag(32),
48 => $user->getAvatar()->getImageTag(48)
- )
+ ),
+ 'link' => LinkHandler::getInstance()->getLink('User', array(
+ 'user' => $user->getDecoratedObject()
+ ))
);
}
diff --git a/file/lib/system/user/online/location/ChatLocation.class.php b/file/lib/system/user/online/location/ChatLocation.class.php
new file mode 100644
index 0000000..e5e0667
--- /dev/null
+++ b/file/lib/system/user/online/location/ChatLocation.class.php
@@ -0,0 +1,35 @@
+
+ * @package be.bastelstu.chat
+ * @subpackage page
+ */
+class ChatLocation implements \wcf\system\user\online\location\IUserOnlineLocation {
+ /**
+ * @see wcf\system\user\online\location\IUserOnlineLocation::cache()
+ */
+ public function cache(\wcf\data\user\online\UserOnline $user) {}
+
+ /**
+ * @see wcf\system\user\online\location\IUserOnlineLocation::get()
+ */
+ public function get(\wcf\data\user\online\UserOnline $user, $languageVariable = '') {
+ $cache = data\room\Room::getCache();
+ if (isset($cache[$user->objectID])) {
+ if ($cache[$user->objectID]->canEnter()) {
+ return \wcf\system\WCF::getLanguage()->getDynamicVariable($languageVariable, array(
+ 'room' => $cache[$user->objectID]
+ ));
+ }
+ }
+
+ return '';
+ }
+}
diff --git a/language/de.xml b/language/de.xml
index c4f7c42..885414c 100644
--- a/language/de.xml
+++ b/language/de.xml
@@ -51,7 +51,15 @@
-
+
+
+
+
+ - getUsername()}“ wurde nicht gefunden.]]>
+
+
+
+
@@ -85,12 +93,8 @@
-
-
-
- - getUsername()}“ wurde nicht gefunden.]]>
-
-
+
+
@@ -118,8 +122,8 @@
-
-
-
+
+
+ - Chatraum „{$room}“]]>
diff --git a/objectType.xml b/objectType.xml
index 455e677..4467a41 100644
--- a/objectType.xml
+++ b/objectType.xml
@@ -17,5 +17,12 @@
0
wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor
+
+ be.bastelstu.chat.ChatPage
+ com.woltlab.wcf.user.online.location
+ chat\page\ChatPage
+ chat\system\user\online\location\ChatLocation
+ chat.user.usersOnline.location.ChatPage
+
diff --git a/package.xml b/package.xml
index 4f31116..fd530ba 100644
--- a/package.xml
+++ b/package.xml
@@ -5,7 +5,7 @@
1
- 3.0.0 Alpha 21
+ 3.0.0 Alpha 22
2011-11-26
@@ -49,7 +49,7 @@
objectType.xml
option.xml
templateListener.xml
- pageMenu.xml
+
aclOption.xml
acpMenu.xml
userGroupOption.xml