diff --git a/src/messenger/webim/js/164/chatinit.js b/src/messenger/webim/js/164/chatinit.js
index 0fa325cc..94129389 100644
--- a/src/messenger/webim/js/164/chatinit.js
+++ b/src/messenger/webim/js/164/chatinit.js
@@ -5,8 +5,8 @@
Copyright (c) 2005-2011 Mibew Messenger Community
License: http://mibew.org/license.php
*/
-var chatController=null;
+var chatController={};
Behaviour.register({"#postmessage a":function(a){a.onclick=function(){var a=$("msgwnd");a&&chatController.postMessage(a.value)}},"select#predefined":function(a){a.onchange=function(){chatController.selectPredefinedAnswer(this)}},"div#changename2 a":function(a){a.onclick=function(){chatController.showNameField();return!1}},"div#changename1 a":function(a){a.onclick=function(){chatController.applyName();return!1}},"div#changename1 input#uname":function(a){a.onkeydown=function(a){13==(a||event).keyCode&&
chatController.applyName()}},"a#refresh":function(a){a.onclick=function(){chatController.refresh()}},"a#togglesound":function(a){a.onclick=function(){chatController.toggleSound()}},"a.closethread":function(a){a.onclick=function(){chatController.closeThread()}}});
-EventHelper.register(window,"onload",function(){$LAB.setOptions({BasePath:chatParams.jsBasePath}).script("json2.js").wait().script("mibewapi.js").wait().script("chatserver.js").script("thread.js").script("pluginmanager.js").script("brws.js").wait().script("chatcontroller.js").script("chatview.js").wait(function(){FrameUtils.options.cssfile=chatParams.cssfile;var a=new ChatServer(chatParams.serverParams),c=new Thread(chatParams.threadParams),b=new PluginManager;chatParams.initPlugins(b,c,a);b=new ChatView(chatParams.localizedStrings,
-chatParams.predefinedAnswers||[]);chatController=new ChatController(a,b,c,{ignorectrl:-1}.extend(chatParams.controllerParams||{}))})});
\ No newline at end of file
+EventHelper.register(window,"onload",function(){$LAB.setOptions({BasePath:chatParams.jsBasePath}).script("json2.js").wait().script("mibewapi.js").wait().script("chatserver.js").script("thread.js").script("messageview.js").script("pluginmanager.js").script("brws.js").wait().script("chatcontroller.js").script("chatview.js").wait(function(){FrameUtils.options.cssfile=chatParams.cssfile;var a=new ChatServer(chatParams.serverParams),c=new Thread(chatParams.threadParams),b=new PluginManager;chatParams.initPlugins(b,
+c,a);b=new ChatView(new MessageView,chatParams.localizedStrings||{},chatParams.predefinedAnswers||[]);chatController=new ChatController(a,b,c,{ignorectrl:-1}.extend(chatParams.controllerParams||{}))})});
\ No newline at end of file
diff --git a/src/messenger/webim/js/164/chatview.js b/src/messenger/webim/js/164/chatview.js
index c0965366..31fce56c 100644
--- a/src/messenger/webim/js/164/chatview.js
+++ b/src/messenger/webim/js/164/chatview.js
@@ -8,7 +8,7 @@
var FrameUtils={options:{},getDocument:function(a){return a.contentDocument?a.contentDocument:a.contentWindow?a.contentWindow.document:a.document?a.document:null},initFrame:function(a){var b=this.getDocument(a);b.open();b.write("
");this.options.cssfile&&b.write('');b.write("");b.write("");
b.write("");b.close();a.onload=function(){a.myHtml&&(FrameUtils.getDocument(a).getElementById("content").innerHTML+=a.myHtml,FrameUtils.scrollDown(a))}},insertIntoFrame:function(a,b){var c=this.getDocument(a).getElementById("content");null==c?(a.myHtml||(a.myHtml=""),a.myHtml+=b):c.innerHTML+=b},scrollDown:function(a){var b=this.getDocument(a).getElementById("bottom");if("opera"==myAgent)try{a.contentWindow.scrollTo(0,this.getDocument(a).getElementById("content").clientHeight)}catch(c){}b&&
b.scrollIntoView(!1)}};ChatView=Class.create();
-ChatView.prototype={statusTimeout:null,localizedStrings:{},predefinedAnswers:[],messageContainer:null,initialize:function(a,b){this.localizedStrings=a||{};this.predefinedAnswers=b||[];this.messageContainer="safari"==myRealAgent?self.frames[0]:$("chatwnd");FrameUtils.initFrame(this.messageContainer)},getLocaleString:function(a){return"undefined"==typeof this.localizedStrings[a]?!1:this.localizedStrings[a]},enableInput:function(a){var b=$("msgwnd");b&&(b.disabled=!a)},clearInput:function(){var a=$("msgwnd");
-a&&(a.value="",a.focus())},showStatusDiv:function(a){$("engineinfo")&&($("engineinfo").style.display="inline",$("engineinfo").innerHTML=a)},setStatus:function(a){this.statusTimeout&&clearTimeout(this.statusTimeout);this.showStatusDiv(a);this.statusTimeout=setTimeout(this.clearStatus.bind(this),4E3)},clearStatus:function(){$("engineinfo").style.display="none"},showTyping:function(a){$("typingdiv")&&($("typingdiv").style.display=a?"inline":"none")},updateAvatar:function(a,b){var c="";""!=b&&(c='');$("avatarwnd").innerHTML=c},displayMessages:function(a){for(var b=0;b');$("avatarwnd").innerHTML=c},displayMessages:function(a){for(var b=0;b":">","&":"&",'"':""","'":"'","`":"`"},c=/[&<>'"`]/g;this.kindToString=function(a){return a==this.KIND_USER?"user":a==this.KIND_AGENT?"agent":a==this.KIND_FOR_AGENT?"hidden":a==this.KIND_INFO?"inf":a==this.KIND_CONN?"conn":a==this.KIND_EVENTS?"event":""};this.escapeString=function(a){return a.replace(c,function(a){return b[a]||"&"})};this.themeMessage=function(a){if(!Handlebars.templates.message)throw Error("There is no template for message loaded!");
+if(a.kind==this.KIND_AVATAR)throw Error("KIND_AVATAR message kind is deprecated at window!");a.allowFormating=a.kind!=this.KIND_USER&&a.kind!=this.KIND_AGENT;a.kindName=this.kindToString(a.kind);a.message=this.escapeString(a.message);return Handlebars.templates.message(a)}};MessageView.prototype.KIND_USER=1;MessageView.prototype.KIND_AGENT=2;MessageView.prototype.KIND_FOR_AGENT=3;MessageView.prototype.KIND_INFO=4;MessageView.prototype.KIND_CONN=5;MessageView.prototype.KIND_EVENTS=6;
+MessageView.prototype.KIND_AVATAR=7;Handlebars.registerHelper("allowTags",function(b){b=b.replace(/<(span|strong)>(.*?)<\/\1>/g,"<$1>$2$1>");b=b.replace(/<span class="(.*?)">(.*?)<\/span>/g,'$2');return new Handlebars.SafeString(b)});
\ No newline at end of file
diff --git a/src/messenger/webim/js/164/thread.js b/src/messenger/webim/js/164/thread.js
index fdd8e170..82267cab 100644
--- a/src/messenger/webim/js/164/thread.js
+++ b/src/messenger/webim/js/164/thread.js
@@ -5,4 +5,4 @@
Copyright (c) 2005-2011 Mibew Messenger Community
License: http://mibew.org/license.php
*/
-var Thread=function(a){this.threadid=a.threadid||0;this.token=a.token||0;this.lastid=a.lastid||0;this.user=a.user||!1};Thread.prototype.KIND_USER=1;Thread.prototype.KIND_AGENT=2;Thread.prototype.KIND_FOR_AGENT=3;Thread.prototype.KIND_INFO=4;Thread.prototype.KIND_CONN=5;Thread.prototype.KIND_EVENTS=6;Thread.prototype.KIND_AVATAR=7;
\ No newline at end of file
+var Thread=function(a){this.threadid=a.threadid||0;this.token=a.token||0;this.lastid=a.lastid||0;this.user=a.user||!1};
\ No newline at end of file
diff --git a/src/messenger/webim/js/source/chatinit.js b/src/messenger/webim/js/source/chatinit.js
index aadea3e1..99acdbf4 100644
--- a/src/messenger/webim/js/source/chatinit.js
+++ b/src/messenger/webim/js/source/chatinit.js
@@ -6,7 +6,7 @@
* License: http://mibew.org/license.php
*/
-var chatController = null;
+var chatController = {};
Behaviour.register({
'#postmessage a' : function(el) {
@@ -73,6 +73,7 @@ EventHelper.register(window, 'onload', function(){
.script('mibewapi.js').wait()
.script('chatserver.js')
.script('thread.js')
+ .script('messageview.js')
.script('pluginmanager.js')
.script('brws.js').wait()
.script('chatcontroller.js')
@@ -84,7 +85,8 @@ EventHelper.register(window, 'onload', function(){
var pluginManager = new PluginManager();
chatParams.initPlugins(pluginManager, thread, chatServer);
var chatView = new ChatView(
- chatParams.localizedStrings,
+ new MessageView(),
+ chatParams.localizedStrings || {},
chatParams.predefinedAnswers || []
);
chatController = new ChatController(
diff --git a/src/messenger/webim/js/source/chatview.js b/src/messenger/webim/js/source/chatview.js
index 70cd4c11..917a7dbd 100644
--- a/src/messenger/webim/js/source/chatview.js
+++ b/src/messenger/webim/js/source/chatview.js
@@ -94,14 +94,19 @@ ChatView.prototype = {
*/
messageContainer: null,
+ messageView: null,
+
/**
* Create an instance of ChatView
+ * @todo Document it!
* @constructor
*/
- initialize: function(localizedStrings, predefinedAnswers) {
+ initialize: function(messageView, localizedStrings, predefinedAnswers) {
this.localizedStrings = localizedStrings || {};
this.predefinedAnswers = predefinedAnswers || [];
+ this.messageView = messageView;
+
this.messageContainer = (myRealAgent == 'safari')
? self.frames[0]
: $("chatwnd");
@@ -220,7 +225,8 @@ ChatView.prototype = {
* @private
*/
outputMessage: function(message) {
- FrameUtils.insertIntoFrame(this.messageContainer, message);
+ var themedMessage = this.messageView.themeMessage(message);
+ FrameUtils.insertIntoFrame(this.messageContainer, themedMessage);
},
/**
diff --git a/src/messenger/webim/js/source/messageview.js b/src/messenger/webim/js/source/messageview.js
new file mode 100644
index 00000000..a994ac98
--- /dev/null
+++ b/src/messenger/webim/js/source/messageview.js
@@ -0,0 +1,151 @@
+/**
+ * @preserve This file is part of Mibew Messenger project.
+ * http://mibew.org
+ *
+ * Copyright (c) 2005-2011 Mibew Messenger Community
+ * License: http://mibew.org/license.php
+ */
+
+var MessageView = function() {
+
+ /**
+ * List of replacements pairs
+ * @type Object
+ * @private
+ */
+ var badCharList = {
+ "<": "<",
+ ">": ">",
+ "&": "&",
+ '"': """,
+ "'": "'",
+ "`": "`"
+ }
+
+ /**
+ * Regular expression for characters that must be replaced by HTML entities
+ * @type RegExp
+ * @private
+ */
+ var badCharRegEx = /[&<>'"`]/g;
+
+ /**
+ * Retrun message kind shortening name corresponding to message kind code
+ *
+ * @param {Number} kind Message kind code
+ * @returns {String} Message kind shortening name
+ */
+ this.kindToString = function(kind) {
+ if (kind == this.KIND_USER) {
+ return "user";
+ }
+ if (kind == this.KIND_AGENT) {
+ return "agent";
+ }
+ if (kind == this.KIND_FOR_AGENT) {
+ return "hidden";
+ }
+ if (kind == this.KIND_INFO) {
+ return "inf";
+ }
+ if (kind == this.KIND_CONN) {
+ return "conn";
+ }
+ if (kind == this.KIND_EVENTS) {
+ return "event";
+ }
+ return "";
+ }
+
+ /**
+ * Replace HTML special characters('<', '>', '&', "'", '"', '`') by
+ * corresponding HTML entities.
+ *
+ * @param {String} str Unescaped string
+ * @returns {String} Escaped string
+ */
+ this.escapeString = function(str) {
+ return str.replace(
+ badCharRegEx,
+ function(chr) {
+ return badCharList[chr] || "&";
+ }
+ );
+ }
+
+ /**
+ * Prepare message and substitute it into message's template
+ *
+ * @param {Object} msg Message object
+ * @returns {String} Rendered message
+ */
+ this.themeMessage = function(msg) {
+ // Check template existance
+ if (! Handlebars.templates.message) {
+ throw new Error('There is no template for message loaded!');
+ }
+ // Check message kind
+ if (msg.kind == this.KIND_AVATAR) {
+ throw new Error('KIND_AVATAR message kind is deprecated at window!');
+ }
+ // Add message fields
+ msg.allowFormating = (msg.kind != this.KIND_USER && msg.kind != this.KIND_AGENT);
+ msg.kindName = this.kindToString(msg.kind);
+ msg.message = this.escapeString(msg.message);
+ // Theme message
+ return Handlebars.templates.message(msg);
+ }
+}
+
+/** Message kind constants */
+
+/**
+ * Message sent by user.
+ */
+MessageView.prototype.KIND_USER = 1;
+/**
+ * Message sent by operator
+ */
+MessageView.prototype.KIND_AGENT = 2;
+/**
+ * Hidden system message to operator
+ */
+MessageView.prototype.KIND_FOR_AGENT = 3;
+/**
+ * System messages for user and operator
+ */
+MessageView.prototype.KIND_INFO = 4;
+/**
+ * Message for user if operator have connection problems
+ */
+MessageView.prototype.KIND_CONN = 5;
+/**
+ * System message about some events (like rename).
+ */
+MessageView.prototype.KIND_EVENTS = 6;
+/**
+ * Message with operators avatar
+ *
+ * This kind of message leaved only for compatibility with core
+ */
+MessageView.prototype.KIND_AVATAR = 7;
+
+/** End of message kind constants */
+
+/**
+ * Register 'allowTags' Handlebars helper.
+ *
+ * This helper unescape HTML entities for allowed (span and strong) tags.
+ */
+Handlebars.registerHelper('allowTags', function(text) {
+ var result = text;
+ result = result.replace(
+ /<(span|strong)>(.*?)<\/\1>/g,
+ '<$1>$2$1>'
+ );
+ result = result.replace(
+ /<span class="(.*?)">(.*?)<\/span>/g,
+ '$2'
+ );
+ return new Handlebars.SafeString(result);
+});
\ No newline at end of file
diff --git a/src/messenger/webim/js/source/thread.js b/src/messenger/webim/js/source/thread.js
index 295a435d..8b81e872 100644
--- a/src/messenger/webim/js/source/thread.js
+++ b/src/messenger/webim/js/source/thread.js
@@ -37,39 +37,4 @@ var Thread = function(options) {
* @type Boolean
*/
this.user = options.user || false;
-}
-
-/** Message kinds section */
-
-/**
- * Message sent by user
- */
-Thread.prototype.KIND_USER = 1;
-/**
- * Message sent by operator
- */
-Thread.prototype.KIND_AGENT = 2;
-/**
- * Hidden system message to operator
- */
-Thread.prototype.KIND_FOR_AGENT = 3;
-/**
- * System messages for user and operator
- */
-Thread.prototype.KIND_INFO = 4;
-/**
- * Message for user if operator have connection problems
- */
-Thread.prototype.KIND_CONN = 5;
-/**
- * System message about some events (like rename).
- */
-Thread.prototype.KIND_EVENTS = 6;
-/**
- * Message with operators avatar
- *
- * This kind of message leaved only for compatibility with core
- */
-Thread.prototype.KIND_AVATAR = 7;
-
-/** End of Message kinds section */
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/src/messenger/webim/js/templates/compiled/message.tpl.js b/src/messenger/webim/js/templates/compiled/message.tpl.js
new file mode 100644
index 00000000..9c9a4b7e
--- /dev/null
+++ b/src/messenger/webim/js/templates/compiled/message.tpl.js
@@ -0,0 +1,55 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['message'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
+
+function program1(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + ": ";
+ return buffer;}
+
+function program3(depth0,data) {
+
+ var stack1, foundHelper;
+ stack1 = depth0.message;
+ foundHelper = helpers.apply;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, "urlReplace, nl2br, allowTags", {hash:{}}) : helperMissing.call(depth0, "apply", stack1, "urlReplace, nl2br, allowTags", {hash:{}});
+ return escapeExpression(stack1);}
+
+function program5(depth0,data) {
+
+ var stack1, foundHelper;
+ stack1 = depth0.message;
+ foundHelper = helpers.apply;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, "urlReplace, nl2br", {hash:{}}) : helperMissing.call(depth0, "apply", stack1, "urlReplace, nl2br", {hash:{}});
+ return escapeExpression(stack1);}
+
+ buffer += "";
+ stack1 = depth0.created;
+ foundHelper = helpers.formatTime;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, {hash:{}}) : helperMissing.call(depth0, "formatTime", stack1, {hash:{}});
+ buffer += escapeExpression(stack1) + " \r\n";
+ stack1 = depth0.name;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\r\n";
+ stack1 = depth0.allowFormating;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "
";
+ return buffer;});
+})();
\ No newline at end of file
diff --git a/src/messenger/webim/js/templates/source/.htaccess b/src/messenger/webim/js/templates/source/.htaccess
new file mode 100644
index 00000000..14249c50
--- /dev/null
+++ b/src/messenger/webim/js/templates/source/.htaccess
@@ -0,0 +1 @@
+Deny from all
\ No newline at end of file
diff --git a/src/messenger/webim/js/templates/source/message.handlebars b/src/messenger/webim/js/templates/source/message.handlebars
new file mode 100644
index 00000000..1cb729d2
--- /dev/null
+++ b/src/messenger/webim/js/templates/source/message.handlebars
@@ -0,0 +1,3 @@
+{{formatTime created}}
+{{#if name}}{{name}}: {{/if}}
+{{#if allowFormating}}{{apply message "urlReplace, nl2br, allowTags"}}{{else}}{{apply message "urlReplace, nl2br"}}{{/if}}
\ No newline at end of file
diff --git a/src/messenger/webim/libs/classes/thread.php b/src/messenger/webim/libs/classes/thread.php
index 8d659ac2..3e8cb01e 100644
--- a/src/messenger/webim/libs/classes/thread.php
+++ b/src/messenger/webim/libs/classes/thread.php
@@ -359,77 +359,6 @@ Class Thread {
return false;
}
- /**
- * Return message kind name corresponding to kind code
- *
- * @param int $message_kind Message kind. One of the Thread::KIND_* constants
- * @return string kind's full name or its shortening
- */
- public static function kindToString($message_kind) {
- $kind_names = array(
- Thread::KIND_USER => 'user',
- Thread::KIND_AGENT => 'agent',
- Thread::KIND_FOR_AGENT => 'hidden',
- Thread::KIND_INFO => 'inf',
- Thread::KIND_CONN => 'conn',
- Thread::KIND_EVENTS => 'event',
- Thread::KIND_AVATAR => 'avatar'
- );
- if (! array_key_exists($message_kind, $kind_names)) {
- return '';
- }
- return $kind_names[$message_kind];
- }
-
- /**
- * Theme message to display in chat window
- *
- * @param array $message Message array
- * @return string Ready to display themed message
- */
- public static function themeMessage($message) {
- global $webim_encoding;
-
- // No theming for avatars
- if ($message['kind'] == Thread::KIND_AVATAR) {
- return '';
- }
-
- // Prepare messages fields
- $creation_date = date("H:i:s", $message['created']);
- $kind_name = Thread::kindToString($message['kind']);
- $sender_name = $message['name']
- ? "" . htmlspecialchars($message['name']) . ": "
- : '';
-
- // Prepare message text
- // Escape special chars
- $text = htmlspecialchars($message['message']);
- // Replace URL's by tags
- $text = preg_replace('/(https?|ftp):\/\/\S*/', '$0', $text);
- // Add
tags instead of \n chars
- $text = str_replace("\n", "
", $text);
- // Span and storng tags available for system messages
- if ($message['kind'] != Thread::KIND_USER && $message['kind'] != Thread::KIND_AGENT) {
- $text = preg_replace('/<(span|strong)>(.*)<\/\1>/U', '<$1>$2$1>', $text);
- $text = preg_replace(
- '/<span class="(.*)">(.*)<\/span>/U',
- '$2',
- $text
- );
- }
-
- // Build result message
- $result = sprintf(
- "%s %s%s
",
- $creation_date,
- $sender_name,
- $kind_name,
- $text
- );
- return myiconv($webim_encoding, "utf-8", $result);
- }
-
/**
* Return next revision number (last revision number plus one)
*
@@ -664,12 +593,14 @@ Class Thread {
/**
* Load messages from database corresponding to the thread those ID's more than $lastid
*
+ * @global $webim_encoding
* @param boolean $is_user Boolean TRUE if messages loads for user and boolean FALSE if they loads for operator.
* @param int $lastid ID of the last loaded message.
* @return array Array of messages
* @see Thread::postMessage()
*/
public function getMessages($is_user, &$last_id) {
+ global $webim_encoding;
$db = Database::getInstance();
@@ -687,7 +618,10 @@ Class Thread {
array('return_rows' => Database::RETURN_ALL_ROWS)
);
- foreach ($messages as $msg) {
+ foreach ($messages as $key => $msg) {
+ // Change message fields encoding
+ $messages[$key]['name'] = myiconv($webim_encoding, "utf-8", $msg['name']);
+ $messages[$key]['message'] = myiconv($webim_encoding, "utf-8", $msg['message']);
// Get last message ID
if ($msg['id'] > $last_id) {
$last_id = $msg['id'];
diff --git a/src/messenger/webim/libs/classes/thread_processor.php b/src/messenger/webim/libs/classes/thread_processor.php
index fe8f20c1..e41a75f0 100644
--- a/src/messenger/webim/libs/classes/thread_processor.php
+++ b/src/messenger/webim/libs/classes/thread_processor.php
@@ -259,9 +259,6 @@ class ThreadProcessor extends RequestProcessor {
unset($messages[$key]);
continue;
}
-
- // Theme message
- $messages[$key] = Thread::themeMessage($msg);
}
// Send messages
$this->responses[] = array(
diff --git a/src/messenger/webim/operator/threadprocessor.php b/src/messenger/webim/operator/threadprocessor.php
index dd5f8ecb..748ef70a 100644
--- a/src/messenger/webim/operator/threadprocessor.php
+++ b/src/messenger/webim/operator/threadprocessor.php
@@ -53,12 +53,12 @@ if (isset($_GET['threadid'])) {
// Build messages list
$lastid = -1;
$messages = $thread_info['thread']->getMessages(false, $lastid);
- foreach ($messages as $msg) {
+ foreach ($messages as $key => $msg) {
if ($msg['kind'] == Thread::KIND_AVATAR) {
- continue;
+ unset($messages[$key]);
}
- $page['threadMessages'][] = Thread::themeMessage($msg);
}
+ $page['threadMessages'] = json_encode($messages);
}
prepare_menu($operator, false);
diff --git a/src/messenger/webim/styles/dialogs/default/js/compiled/message.tpl.js b/src/messenger/webim/styles/dialogs/default/js/compiled/message.tpl.js
new file mode 100644
index 00000000..9c9a4b7e
--- /dev/null
+++ b/src/messenger/webim/styles/dialogs/default/js/compiled/message.tpl.js
@@ -0,0 +1,55 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['message'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
+
+function program1(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + ": ";
+ return buffer;}
+
+function program3(depth0,data) {
+
+ var stack1, foundHelper;
+ stack1 = depth0.message;
+ foundHelper = helpers.apply;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, "urlReplace, nl2br, allowTags", {hash:{}}) : helperMissing.call(depth0, "apply", stack1, "urlReplace, nl2br, allowTags", {hash:{}});
+ return escapeExpression(stack1);}
+
+function program5(depth0,data) {
+
+ var stack1, foundHelper;
+ stack1 = depth0.message;
+ foundHelper = helpers.apply;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, "urlReplace, nl2br", {hash:{}}) : helperMissing.call(depth0, "apply", stack1, "urlReplace, nl2br", {hash:{}});
+ return escapeExpression(stack1);}
+
+ buffer += "";
+ stack1 = depth0.created;
+ foundHelper = helpers.formatTime;
+ stack1 = foundHelper ? foundHelper.call(depth0, stack1, {hash:{}}) : helperMissing.call(depth0, "formatTime", stack1, {hash:{}});
+ buffer += escapeExpression(stack1) + " \r\n";
+ stack1 = depth0.name;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\r\n";
+ stack1 = depth0.allowFormating;
+ stack1 = helpers['if'].call(depth0, stack1, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "
";
+ return buffer;});
+})();
\ No newline at end of file
diff --git a/src/messenger/webim/styles/dialogs/default/js/source/.htaccess b/src/messenger/webim/styles/dialogs/default/js/source/.htaccess
new file mode 100644
index 00000000..14249c50
--- /dev/null
+++ b/src/messenger/webim/styles/dialogs/default/js/source/.htaccess
@@ -0,0 +1 @@
+Deny from all
\ No newline at end of file
diff --git a/src/messenger/webim/styles/dialogs/default/js/source/message.handlebars b/src/messenger/webim/styles/dialogs/default/js/source/message.handlebars
new file mode 100644
index 00000000..1cb729d2
--- /dev/null
+++ b/src/messenger/webim/styles/dialogs/default/js/source/message.handlebars
@@ -0,0 +1,3 @@
+{{formatTime created}}
+{{#if name}}{{name}}: {{/if}}
+{{#if allowFormating}}{{apply message "urlReplace, nl2br, allowTags"}}{{else}}{{apply message "urlReplace, nl2br"}}{{/if}}
\ No newline at end of file
diff --git a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
index 9422697a..e6b3780d 100644
--- a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
+++ b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl
@@ -7,6 +7,9 @@
${page:additional_css}
+
+
+
${page:additional_js}
+
+
+
${page:additional_js}
+
+
+
${page:additional_js}
+
+
+
${page:additional_js}
+
+
+
+
+
+
-