1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Smiley-switch works now.

This commit is contained in:
max-m 2011-12-20 21:20:32 +01:00
parent a850f5235b
commit 602f824e85
5 changed files with 19 additions and 3 deletions

5
.gitignore vendored
View File

@ -47,4 +47,7 @@ nbactions.xml
# Community Framework # Community Framework
# Ignore packages build directly in the workspace. They can however be added manually via git add, if wanted. # Ignore packages build directly in the workspace. They can however be added manually via git add, if wanted.
*.tar *.tar
*.tar.gz *.tar.gz
# Javascript - CoffeeScript is used instead ;)
*.js

View File

@ -178,7 +178,8 @@ TimWolla.WCF ?= {}
$.ajax $('#chatForm').attr('action'), $.ajax $('#chatForm').attr('action'),
data: data:
text: $('#chatInput').val() text: $('#chatInput').val(),
smilies: $('#chatSmilies').data('status')
type: 'POST', type: 'POST',
beforeSend: (jqXHR) -> beforeSend: (jqXHR) ->
$('#chatInput').addClass 'ajaxLoad' $('#chatInput').addClass 'ajaxLoad'

View File

@ -59,7 +59,7 @@ public function getFormattedMessage() {
break; break;
case self::TYPE_NORMAL: case self::TYPE_NORMAL:
if (!$this->enableHTML) { if (!$this->enableHTML) {
$message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, $this->enableSmilies); $message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies);
} }
} }
return $message; return $message;

View File

@ -19,6 +19,7 @@
*/ */
class ChatForm extends AbstractForm { class ChatForm extends AbstractForm {
public $message = ''; public $message = '';
public $enableSmilies = 1;
public $userData = array(); public $userData = array();
public $useTemplate = false; public $useTemplate = false;
@ -37,6 +38,7 @@ public function readFormParameters() {
parent::readFormParameters(); parent::readFormParameters();
if (isset($_REQUEST['text'])) $this->message = StringUtil::trim($_REQUEST['text']); if (isset($_REQUEST['text'])) $this->message = StringUtil::trim($_REQUEST['text']);
if (isset($_REQUEST['smilies'])) $this->enableSmilies = intval($_REQUEST['smilies']);
} }
/** /**
@ -96,6 +98,7 @@ public function save() {
'time' => TIME_NOW, 'time' => TIME_NOW,
'type' => chat\message\ChatMessage::TYPE_NORMAL, 'type' => chat\message\ChatMessage::TYPE_NORMAL,
'message' => $this->message, 'message' => $this->message,
'enableSmilies' => $this->enableSmilies,
'color1' => $this->userData['color'][1], 'color1' => $this->userData['color'][1],
'color2' => $this->userData['color'][2] 'color2' => $this->userData['color'][2]
) )

View File

@ -130,6 +130,10 @@
background-image: url({icon size='S'}toLeft1{/icon}); background-image: url({icon size='S'}toLeft1{/icon});
} }
.chatMessageContainer {
padding-left: 7px !important;
}
.ajaxLoad { .ajaxLoad {
background-position: right center; background-position: right center;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -301,6 +305,11 @@
<img alt="" src="{icon}disabled1{/icon}" /> <span>{lang}wcf.chat.notify{/lang}</span> <img alt="" src="{icon}disabled1{/icon}" /> <span>{lang}wcf.chat.notify{/lang}</span>
</a> </a>
</li> </li>
<li>
<a id="chatSmilies" href="javascript:;" class="chatToggle balloonTooltip" title="{lang}wcf.global.button.enable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="1">
<img alt="" src="{icon}enabled1{/icon}" /> <span>{lang}wcf.chat.smilies{/lang}</span>
</a>
</li>
<li> <li>
<a id="chatClear" href="javascript:;" class="balloonTooltip" title="Clear the chat"> <a id="chatClear" href="javascript:;" class="balloonTooltip" title="Clear the chat">
<img alt="" src="{icon}delete1{/icon}" /> <span>{lang}wcf.chat.clear{/lang}</span> <img alt="" src="{icon}delete1{/icon}" /> <span>{lang}wcf.chat.clear{/lang}</span>