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

Merge branch 'master' of github.com:wbbaddons/Tims-Chat

This commit is contained in:
max-m 2011-12-09 19:52:46 +01:00
commit e537788732
5 changed files with 33 additions and 3 deletions

View File

@ -13,9 +13,16 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
(function ($, document) { (function ($, document) {
TimWolla.WCF.Chat = { TimWolla.WCF.Chat = {
init: function(roomID, messageID) { init: function(roomID, messageID) {
this.bindEvents();
},
bindEvents: function() {
$('.smiley').click(function(event) { $('.smiley').click(function(event) {
alert($(event.target).attr('alt')); alert($(event.target).attr('alt'));
}); });
$(window).bind('beforeunload', function() {
return false;
});
} }
}; };
})(jQuery, document); })(jQuery, document);

View File

@ -1,5 +1,6 @@
<?php <?php
namespace wcf\data\chat\message; namespace wcf\data\chat\message;
use \wcf\system\WCF;
/** /**
* Represents a chat message. * Represents a chat message.
@ -40,6 +41,22 @@ class ChatMessage extends \wcf\data\DatabaseObject {
* @return string * @return string
*/ */
public function __toString() { public function __toString() {
return $this->message; return $this->getFormattedMessage;
}
/**
* Returns the formatted message.
*
* @return string
*/
public function getFormattedMessage() {
$message = $this->message;
switch ($this->type) {
case self::TYPE_JOIN:
case self::TYPE_LEAVE:
case self::TYPE_BACK:
$message = WCF::getLanguage()->get('wcf.chat.message.'.$this->type);
}
return $message;
} }
} }

View File

@ -57,7 +57,7 @@ public static function clearCache() {
* @see \wcf\data\chat\room\ChatRoom::getTitle(); * @see \wcf\data\chat\room\ChatRoom::getTitle();
*/ */
public function __tostring() { public function __tostring() {
return $this->getTitle; return $this->getTitle();
} }
/** /**

View File

@ -7,4 +7,10 @@
<item name="wcf.chat.title"><![CDATA[Chat]]></item> <item name="wcf.chat.title"><![CDATA[Chat]]></item>
<item name="wcf.chat.copyright"><![CDATA[<a href="http://timwolla.wbbaddons.de">Chat entwickelt von TimWolla</a>]]></item> <item name="wcf.chat.copyright"><![CDATA[<a href="http://timwolla.wbbaddons.de">Chat entwickelt von TimWolla</a>]]></item>
</category> </category>
<category name="wcf.chat.message">
<!-- 1 = TYPE_JOIN -->
<item name="wcf.chat.message.1"><![CDATA[hat den Chat betreten.]]></item>
<!-- 2 = TYPE_LEAVE -->
<item name="wcf.chat.message.2"><![CDATA[hat den Chat verlassen.]]></item>
</category>
</language> </language>

View File

@ -1 +1 @@
{if $templateName == 'chat'}{lang}wcf.chat.copyright{/lang}{/if} {if $templateName == 'chat'}<address class="copyright">{lang}wcf.chat.copyright{/lang}</address>{/if}