From dc25058a05c2f7051a415fcf823bdd579c859f76 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 15 Feb 2013 09:59:14 +0000 Subject: [PATCH] Create chat layout in Chat JavaScript application --- src/messenger/webim/js/compiled/chat/app.js | 10 ++--- src/messenger/webim/js/compiled/chat/init.js | 2 +- .../webim/js/compiled/chat/layouts/chat.js | 8 ++++ .../js/compiled/chat/regions/messages.js | 2 +- src/messenger/webim/js/compiled/chat_app.js | 21 ++++++---- src/messenger/webim/js/source/chat/app.js | 29 +++++++------ src/messenger/webim/js/source/chat/init.js | 5 +++ .../webim/js/source/chat/layouts/chat.js | 41 +++++++++++++++++++ .../webim/js/source/chat/regions/messages.js | 6 --- .../chat_layout.handlebars | 29 +++++++++++++ .../dialogs/default/js/compiled/templates.js | 2 +- .../styles/dialogs/default/templates/chat.tpl | 39 ++++-------------- 12 files changed, 129 insertions(+), 65 deletions(-) create mode 100644 src/messenger/webim/js/compiled/chat/layouts/chat.js create mode 100644 src/messenger/webim/js/source/chat/layouts/chat.js create mode 100644 src/messenger/webim/styles/dialogs/default/handlebars_templates/chat_layout.handlebars diff --git a/src/messenger/webim/js/compiled/chat/app.js b/src/messenger/webim/js/compiled/chat/app.js index 9856e997..c0e1633e 100644 --- a/src/messenger/webim/js/compiled/chat/app.js +++ b/src/messenger/webim/js/compiled/chat/app.js @@ -5,9 +5,9 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,j){var f=a.Application;f.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});f.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(j.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user); -c.page=new a.Models.Page(d.page);var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160}); -e.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message, -h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound; +(function(a,k){var h=a.Application;h.addRegions({mainRegion:"#main-region"});h.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,j=a.Objects.Models.Status,f=new a.Layouts.Chat({model:new Backbone.Model(d.layoutsData.chat||{})});a.Objects.chatLayout=f;h.mainRegion.show(f);g.server=new a.Server(k.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user);c.page=new a.Models.Page(d.page); +var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160});e.add(b.sound); +b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));j.message=new a.Models.StatusMessage({hideTimeout:5E3});j.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([j.message, +j.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound; f.soundRegion.show(new a.Views.Sound({model:c.sound}));g.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(), -a.Objects.Models.user.set({canPost:b.canPost||!1}))})});f.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_); +a.Objects.Models.user.set({canPost:b.canPost||!1}))})});h.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_); diff --git a/src/messenger/webim/js/compiled/chat/init.js b/src/messenger/webim/js/compiled/chat/init.js index da0ee6d1..fec9bc44 100644 --- a/src/messenger/webim/js/compiled/chat/init.js +++ b/src/messenger/webim/js/compiled/chat/init.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew); +(function(a){a.Regions={};a.Layouts={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew); diff --git a/src/messenger/webim/js/compiled/chat/layouts/chat.js b/src/messenger/webim/js/compiled/chat/layouts/chat.js new file mode 100644 index 00000000..e9c04ae8 --- /dev/null +++ b/src/messenger/webim/js/compiled/chat/layouts/chat.js @@ -0,0 +1,8 @@ +/* + This file is part of Mibew Messenger project. + http://mibew.org + + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +(function(a,b){a.Layouts.Chat=b.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"}})})(Mibew,Backbone); diff --git a/src/messenger/webim/js/compiled/chat/regions/messages.js b/src/messenger/webim/js/compiled/chat/regions/messages.js index ca17f73f..d0e9b28a 100644 --- a/src/messenger/webim/js/compiled/chat/regions/messages.js +++ b/src/messenger/webim/js/compiled/chat/regions/messages.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,b){a.Regions.Messages=b.Marionette.Region.extend({el:"#messages-region",onShow:function(a){a.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})})(Mibew,Backbone); +(function(a,b){a.Regions.Messages=b.Marionette.Region.extend({onShow:function(a){a.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})})(Mibew,Backbone); diff --git a/src/messenger/webim/js/compiled/chat_app.js b/src/messenger/webim/js/compiled/chat_app.js index f11bb799..2eb4eb2d 100644 --- a/src/messenger/webim/js/compiled/chat_app.js +++ b/src/messenger/webim/js/compiled/chat_app.js @@ -4,7 +4,7 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a){a.Regions={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew); +(function(a){a.Regions={};a.Layouts={};a.Objects.Models.Controls={};a.Objects.Models.Status={};a.Application=new Backbone.Marionette.Application})(Mibew); /* This file is part of Mibew Messenger project. http://mibew.org @@ -242,16 +242,23 @@ c=""!=this.ui.message.val();c!=a.get("typing")&&a.set({typing:c})},setFocus:func Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,b){a.Regions.Messages=b.Marionette.Region.extend({el:"#messages-region",onShow:function(a){a.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})})(Mibew,Backbone); +(function(a,b){a.Regions.Messages=b.Marionette.Region.extend({onShow:function(a){a.on("after:item:added",this.scrollToBottom,this)},scrollToBottom:function(){this.$el.scrollTop(this.$el.prop("scrollHeight"))}})})(Mibew,Backbone); /* This file is part of Mibew Messenger project. http://mibew.org Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,j){var f=a.Application;f.addRegions({controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:a.Regions.Messages,statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"});f.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;g.server=new a.Server(j.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user); -c.page=new a.Models.Page(d.page);var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160}); -e.add(b.sound);b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));h.message=new a.Models.StatusMessage({hideTimeout:5E3});h.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([h.message, -h.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound; +(function(a,b){a.Layouts.Chat=b.Marionette.Layout.extend({template:Handlebars.templates.chat_layout,regions:{controlsRegion:"#controls-region",avatarRegion:"#avatar-region",messagesRegion:{selector:"#messages-region",regionType:a.Regions.Messages},statusRegion:"#status-region",messageFormRegion:"#message-form-region",soundRegion:"#sound-region"}})})(Mibew,Backbone); +/* + This file is part of Mibew Messenger project. + http://mibew.org + Copyright (c) 2005-2011 Mibew Messenger Community + License: http://mibew.org/license.php +*/ +(function(a,k){var h=a.Application;h.addRegions({mainRegion:"#main-region"});h.addInitializer(function(d){var g=a.Objects,c=a.Objects.Models,b=a.Objects.Models.Controls,j=a.Objects.Models.Status,f=new a.Layouts.Chat({model:new Backbone.Model(d.layoutsData.chat||{})});a.Objects.chatLayout=f;h.mainRegion.show(f);g.server=new a.Server(k.extend({interactionType:MibewAPIChatInteraction},d.server));c.thread=new a.Models.Thread(d.thread);c.user=new a.Models.ChatUser(d.user);c.page=new a.Models.Page(d.page); +var e=new a.Collections.Controls;c.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:d.links.mailLink}),e.add(b.sendMail));c.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:d.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:d.links.historyLink}),e.add(b.history));b.sound=new a.Models.SoundControl({weight:160});e.add(b.sound); +b.refresh=new a.Models.RefreshControl({weight:140});e.add(b.refresh);d.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:d.links.sslLink}),e.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});e.add(b.close);g.Collections.controls=e;f.controlsRegion.show(new a.Views.ControlsCollection({collection:e}));j.message=new a.Models.StatusMessage({hideTimeout:5E3});j.typing=new a.Models.StatusTyping({hideTimeout:5E3});g.Collections.status=new a.Collections.Status([j.message, +j.typing]);f.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));c.user.get("isAgent")||(c.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:c.avatar})));g.Collections.messages=new a.Collections.Messages;c.messageForm=new a.Models.MessageForm(d.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:c.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));c.sound=new a.Models.Sound; f.soundRegion.show(new a.Views.Sound({model:c.sound}));g.server.callFunctionsPeriodically(function(){var b=a.Objects.Models.thread,c=a.Objects.Models.user;return[{"function":"update",arguments:{"return":{typing:"typing",canPost:"canPost"},references:{},threadId:b.get("id"),token:b.get("token"),lastId:b.get("lastId"),typed:c.get("typing"),user:!c.get("isAgent")}}]},function(b){b.errorCode?a.Objects.Models.Status.message.setMessage(b.errorMessage||"refresh failed"):(b.typing&&a.Objects.Models.Status.typing.show(), -a.Objects.Models.user.set({canPost:b.canPost||!1}))})});f.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_); +a.Objects.Models.user.set({canPost:b.canPost||!1}))})});h.on("start",function(){a.Objects.server.runUpdater()})})(Mibew,_); diff --git a/src/messenger/webim/js/source/chat/app.js b/src/messenger/webim/js/source/chat/app.js index 9126e9f5..e05165ea 100644 --- a/src/messenger/webim/js/source/chat/app.js +++ b/src/messenger/webim/js/source/chat/app.js @@ -13,12 +13,7 @@ // Define regions App.addRegions({ - controlsRegion: '#controls-region', - avatarRegion: '#avatar-region', - messagesRegion: Mibew.Regions.Messages, - statusRegion: '#status-region', - messageFormRegion: '#message-form-region', - soundRegion: '#sound-region' + mainRegion: '#main-region' }); // Initialize application @@ -29,6 +24,15 @@ var controls = Mibew.Objects.Models.Controls; var status = Mibew.Objects.Models.Status; + // Create instance of the chat layout + // Use undocumented feature of layouts: passing model to layout + var layout = new Mibew.Layouts.Chat({ + model: new Backbone.Model(options.layoutsData.chat || {}) + }); + Mibew.Objects.chatLayout = layout; + + // Show layout at page + App.mainRegion.show(layout); // Initialize Server, Thread and User objs.server = new Mibew.Server(_.extend( @@ -109,7 +113,7 @@ objs.Collections.controls = ctrlsCollection; // Display controls - App.controlsRegion.show(new Mibew.Views.ControlsCollection({ + layout.controlsRegion.show(new Mibew.Views.ControlsCollection({ collection: ctrlsCollection })); @@ -128,7 +132,7 @@ ]); // Display status bar - App.statusRegion.show(new Mibew.Views.StatusCollection({ + layout.statusRegion.show(new Mibew.Views.StatusCollection({ collection: objs.Collections.status })); @@ -136,7 +140,7 @@ // Initialize avatar only for user if (! models.user.get('isAgent')) { models.avatar = new Mibew.Models.Avatar(); - App.avatarRegion.show(new Mibew.Views.Avatar({ + layout.avatarRegion.show(new Mibew.Views.Avatar({ model: models.avatar })); } @@ -152,23 +156,22 @@ ); // Display message processor - App.messageFormRegion.show(new Mibew.Views.MessageForm({ + layout.messageFormRegion.show(new Mibew.Views.MessageForm({ model: models.messageForm })); // Display messages - App.messagesRegion.show(new Mibew.Views.MessagesCollection({ + layout.messagesRegion.show(new Mibew.Views.MessagesCollection({ collection: objs.Collections.messages })); // Initialize sounds models.sound = new Mibew.Models.Sound(); - App.soundRegion.show(new Mibew.Views.Sound({ + layout.soundRegion.show(new Mibew.Views.Sound({ model: models.sound })); - // TODO: May be move it somewhere else // Periodically call update function at the server side objs.server.callFunctionsPeriodically( diff --git a/src/messenger/webim/js/source/chat/init.js b/src/messenger/webim/js/source/chat/init.js index 40036016..9f195d0d 100644 --- a/src/messenger/webim/js/source/chat/init.js +++ b/src/messenger/webim/js/source/chat/init.js @@ -13,6 +13,11 @@ */ Mibew.Regions = {}; + /** + * @namespace Holds application layouts constructors + */ + Mibew.Layouts = {}; + /** * @namespace Holds instances of control models */ diff --git a/src/messenger/webim/js/source/chat/layouts/chat.js b/src/messenger/webim/js/source/chat/layouts/chat.js new file mode 100644 index 00000000..72c93035 --- /dev/null +++ b/src/messenger/webim/js/source/chat/layouts/chat.js @@ -0,0 +1,41 @@ +/** + * @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 + */ + +(function(Mibew, Backbone){ + + /** + * Represents chat layout + */ + Mibew.Layouts.Chat = Backbone.Marionette.Layout.extend( + /** @lends Mibew.Layouts.Chat.prototype */ + { + /** + * Template function + * @type Function + */ + template: Handlebars.templates.chat_layout, + + /** + * Regions list + * @type Object + */ + regions: { + controlsRegion: '#controls-region', + avatarRegion: '#avatar-region', + messagesRegion: { + selector: '#messages-region', + regionType: Mibew.Regions.Messages + }, + statusRegion: '#status-region', + messageFormRegion: '#message-form-region', + soundRegion: '#sound-region' + } + } + ); + +})(Mibew, Backbone); \ No newline at end of file diff --git a/src/messenger/webim/js/source/chat/regions/messages.js b/src/messenger/webim/js/source/chat/regions/messages.js index 73f4fb6c..aea79098 100644 --- a/src/messenger/webim/js/source/chat/regions/messages.js +++ b/src/messenger/webim/js/source/chat/regions/messages.js @@ -14,12 +14,6 @@ Mibew.Regions.Messages = Backbone.Marionette.Region.extend( /** @lends Mibew.Regions.Message */ { - /** - * DOM element for the region - * @type String - */ - el: '#messages-region', - /** * Show view event handler. Register handler to view's * 'after:item:added' event. diff --git a/src/messenger/webim/styles/dialogs/default/handlebars_templates/chat_layout.handlebars b/src/messenger/webim/styles/dialogs/default/handlebars_templates/chat_layout.handlebars new file mode 100644 index 00000000..352e587e --- /dev/null +++ b/src/messenger/webim/styles/dialogs/default/handlebars_templates/chat_layout.handlebars @@ -0,0 +1,29 @@ +{{! Chat header}} +
+
+ {{! Chat controls region}} +
+
+
+ +{{! Chat region}} +
+
+ {{#if user}} +
+ {{/if}} + {{! Chat messages region}} +
+ {{! Chat status region}} +
+
+
+ +{{! Message form region}} +
+ +{{! Footer links}} + + +{{! Hidden region for some sound element}} +
\ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js b/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js index b3cd80dc..a1246b4b 100644 --- a/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js +++ b/src/messenger/webim/styles/dialogs/default/js/compiled/templates.js @@ -4,4 +4,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.sound_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n
\n',d}function k(a,b){var d="",e,f;return d+='\n
\n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.enabled,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.user_name_control=a(function(a,b,c,d,e){function k(a,b){var d="",e,f;d+='\n ',f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+"\n ",e=a.nameInput,e=c["if"].call(a,e,{hash:{},inverse:j.program(4,m,b),fn:j.program(2,l,b)});if(e||e===0)d+=e;return d+="\n",d}function l(a,b){var d="",e,f;return d+='\n
\n \n ',d}function m(a,b){var d="",e,f;return d+='\n ',e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+'\n \n ',d}function n(a,b){var d="",e,f;return d+="\n",f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+" ",e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+"\n",d}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=c.helperMissing,j=this;return f=b.user,f=f==null||f===!1?f:f.canChangeName,f=c["if"].call(b,f,{hash:{},inverse:j.program(6,n,e),fn:j.program(1,k,e)}),f||f===0?f:""}),b.status=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.title,g?f=g.call(b,{hash:{}}):(f=b.title,f=typeof f===h?f():f),i(f)}),b.status_typing=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h=c.helperMissing,i=this.escapeExpression;return g=c.L10n,f=g?g.call(b,"typing.remote",{hash:{}}):h.call(b,"L10n","typing.remote",{hash:{}}),i(f)}),b.status_message=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.message,g?f=g.call(b,{hash:{}}):(f=b.message,f=typeof f===h?f():f),i(f)}),b.close_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.avatar=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='',d}function k(a,b){return'
'}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=this;return f=b.imageLink,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.refresh_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.history_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.send_mail_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.secure_mode_control=a(function(a,b,c,d,e){return c=c||a.helpers,'
'}),b.redirect_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n
\n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.user,f=f==null||f===!1?f:f.canPost,f=c["if"].call(b,f,{hash:{},inverse:i.noop,fn:i.program(1,j,e)}),f||f===0?f:""}),b.message_form=a(function(a,b,c,d,e){function l(a,b){return'\n
\n \n
\n'}function m(a,b){var d="",e,f;d+='\n
\n
\n ',e=a.user,e=e==null||e===!1?e:e.isAgent,e=c["if"].call(a,e,{hash:{},inverse:k.noop,fn:k.program(4,n,b)});if(e||e===0)d+=e;return d+='\n
\n ',f=c.L10n,e=f?f.call(a,"chat.window.send_message_short_and_shortcut",{hash:{}}):j.call(a,"L10n","chat.window.send_message_short_and_shortcut",{hash:{}}),d+=i(e)+"\n
\n",d}function n(a,b){var d="",e,f;d+='\n \n ",d}function o(a,b){var c="",d;return c+="\n \n ",c}c=c||a.helpers;var f="",g,h="function",i=this.escapeExpression,j=c.helperMissing,k=this;f+='
\n',g=b.user,g=g==null||g===!1?g:g.canPost,g=c["if"].call(b,g,{hash:{},inverse:k.noop,fn:k.program(1,l,e)});if(g||g===0)f+=g;f+='\n
\n\n
\n',g=b.user,g=g==null||g===!1?g:g.canPost,g=c["if"].call(b,g,{hash:{},inverse:k.noop,fn:k.program(3,m,e)});if(g||g===0)f+=g;return f+='\n
\n
',f}),b.message=a(function(a,b,c,d,e){function m(a,b){var d="",e,f;return d+="",f=c.name,f?e=f.call(a,{hash:{}}):(e=a.name,e=typeof e===i?e():e),d+=j(e)+": ",d}function n(a,b){var d,e;return d=a.message,e=c.apply,d=e?e.call(a,d,"urlReplace, nl2br, allowTags",{hash:{}}):k.call(a,"apply",d,"urlReplace, nl2br, allowTags",{hash:{}}),j(d)}function o(a,b){var d,e;return d=a.message,e=c.apply,d=e?e.call(a,d,"urlReplace, nl2br",{hash:{}}):k.call(a,"apply",d,"urlReplace, nl2br",{hash:{}}),j(d)}c=c||a.helpers;var f="",g,h,i="function",j=this.escapeExpression,k=c.helperMissing,l=this;f+="",g=b.created,h=c.formatTime,g=h?h.call(b,g,{hash:{}}):k.call(b,"formatTime",g,{hash:{}}),f+=j(g)+" \n",g=b.name,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(1,m,e)});if(g||g===0)f+=g;f+="\n",g=b.allowFormatting,g=c["if"].call(b,g,{hash:{},inverse:l.program(5,o,e),fn:l.program(3,n,e)});if(g||g===0)f+=g;return f+="
",f})})() \ No newline at end of file +(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.user_name_control=a(function(a,b,c,d,e){function k(a,b){var d="",e,f;d+='\n ',f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+"\n ",e=a.nameInput,e=c["if"].call(a,e,{hash:{},inverse:j.program(4,m,b),fn:j.program(2,l,b)});if(e||e===0)d+=e;return d+="\n",d}function l(a,b){var d="",e,f;return d+='\n
\n \n ',d}function m(a,b){var d="",e,f;return d+='\n ',e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+'\n \n ',d}function n(a,b){var d="",e,f;return d+="\n",f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+" ",e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+"\n",d}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=c.helperMissing,j=this;return f=b.user,f=f==null||f===!1?f:f.canChangeName,f=c["if"].call(b,f,{hash:{},inverse:j.program(6,n,e),fn:j.program(1,k,e)}),f||f===0?f:""}),b.status_typing=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h=c.helperMissing,i=this.escapeExpression;return g=c.L10n,f=g?g.call(b,"typing.remote",{hash:{}}):h.call(b,"L10n","typing.remote",{hash:{}}),i(f)}),b.chat_layout=a(function(a,b,c,d,e){function l(a,b){return'\n
\n '}c=c||a.helpers;var f="",g,h,i=this,j=c.helperMissing,k=this.escapeExpression;f+='\n
\n
\n ',f+='\n
\n
\n
\n\n',f+='\n
\n
\n ',g=b.user,g=c["if"].call(b,g,{hash:{},inverse:i.noop,fn:i.program(1,l,e)});if(g||g===0)f+=g;return f+="\n ",f+='\n
\n ',f+='\n
\n
\n
\n\n',f+='\n
\n\n',f+='\n\n\n',f+='\n
',f}),b.avatar=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='',d}function k(a,b){return'
'}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=this;return f=b.imageLink,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.close_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.history_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.status_message=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.message,g?f=g.call(b,{hash:{}}):(f=b.message,f=typeof f===h?f():f),i(f)}),b.secure_mode_control=a(function(a,b,c,d,e){return c=c||a.helpers,'
'}),b.sound_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n
\n',d}function k(a,b){var d="",e,f;return d+='\n
\n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.enabled,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.message=a(function(a,b,c,d,e){function m(a,b){var d="",e,f;return d+="",f=c.name,f?e=f.call(a,{hash:{}}):(e=a.name,e=typeof e===i?e():e),d+=j(e)+": ",d}function n(a,b){var d,e;return d=a.message,e=c.apply,d=e?e.call(a,d,"urlReplace, nl2br, allowTags",{hash:{}}):k.call(a,"apply",d,"urlReplace, nl2br, allowTags",{hash:{}}),j(d)}function o(a,b){var d,e;return d=a.message,e=c.apply,d=e?e.call(a,d,"urlReplace, nl2br",{hash:{}}):k.call(a,"apply",d,"urlReplace, nl2br",{hash:{}}),j(d)}c=c||a.helpers;var f="",g,h,i="function",j=this.escapeExpression,k=c.helperMissing,l=this;f+="",g=b.created,h=c.formatTime,g=h?h.call(b,g,{hash:{}}):k.call(b,"formatTime",g,{hash:{}}),f+=j(g)+" \n",g=b.name,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(1,m,e)});if(g||g===0)f+=g;f+="\n",g=b.allowFormatting,g=c["if"].call(b,g,{hash:{},inverse:l.program(5,o,e),fn:l.program(3,n,e)});if(g||g===0)f+=g;return f+="
",f}),b.message_form=a(function(a,b,c,d,e){function l(a,b){return'\n
\n \n
\n'}function m(a,b){var d="",e,f;d+='\n
\n
\n ',e=a.user,e=e==null||e===!1?e:e.isAgent,e=c["if"].call(a,e,{hash:{},inverse:k.noop,fn:k.program(4,n,b)});if(e||e===0)d+=e;return d+='\n
\n ',f=c.L10n,e=f?f.call(a,"chat.window.send_message_short_and_shortcut",{hash:{}}):j.call(a,"L10n","chat.window.send_message_short_and_shortcut",{hash:{}}),d+=i(e)+"\n
\n",d}function n(a,b){var d="",e,f;d+='\n \n ",d}function o(a,b){var c="",d;return c+="\n \n ",c}c=c||a.helpers;var f="",g,h="function",i=this.escapeExpression,j=c.helperMissing,k=this;f+='
\n',g=b.user,g=g==null||g===!1?g:g.canPost,g=c["if"].call(b,g,{hash:{},inverse:k.noop,fn:k.program(1,l,e)});if(g||g===0)f+=g;f+='\n
\n\n
\n',g=b.user,g=g==null||g===!1?g:g.canPost,g=c["if"].call(b,g,{hash:{},inverse:k.noop,fn:k.program(3,m,e)});if(g||g===0)f+=g;return f+='\n
\n
',f}),b.send_mail_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.refresh_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='
',f}),b.redirect_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n
\n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.user,f=f==null||f===!1?f:f.canPost,f=c["if"].call(b,f,{hash:{},inverse:i.noop,fn:i.program(1,j,e)}),f||f===0?f:""}),b.status=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.title,g?f=g.call(b,{hash:{}}):(f=b.title,f=typeof f===h?f():f),i(f)})})() \ 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 a26d2a98..29e38641 100644 --- a/src/messenger/webim/styles/dialogs/default/templates/chat.tpl +++ b/src/messenger/webim/styles/dialogs/default/templates/chat.tpl @@ -45,7 +45,8 @@ 'chat.client.name': "${msg:chat.client.name}", 'chat.client.changename': "${msg:chat.client.changename}", 'chat.window.toolbar.turn_off_sound': "${msg:chat.window.toolbar.turn_off_sound}", - 'chat.window.toolbar.turn_on_sound': "${msg:chat.window.toolbar.turn_on_sound}" + 'chat.window.toolbar.turn_on_sound': "${msg:chat.window.toolbar.turn_on_sound}", + 'chat.window.poweredby': "${msg:chat.window.poweredby}" }); //--> @@ -90,6 +91,11 @@ mailWindowParams: "${page:chatStyles.mailWindowParams}", historyWindowParams: "${page:coreStyles.historyWindowParams}" }, + layoutsData: { + chat: { + user: ${if:user}true${else:user}false${endif:user} + } + }, plugins: ${page:js_plugin_options} }); }); @@ -124,35 +130,6 @@ - -
-
- -
-
-
- - -
-
- ${if:user} -
- ${endif:user} - -
- -
-
-
- - -
- - - - - -
- +
\ No newline at end of file