From 1a79be3970fd2d688c1420454ac70807a23c5b54 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 18 Feb 2013 09:54:52 +0000 Subject: [PATCH] Update chat page JavaScript configs structure --- .../chat/model_views/controls/history.js | 2 +- .../chat/model_views/controls/send_mail.js | 2 +- .../compiled/chat/models/controls/history.js | 2 +- .../chat/models/controls/send_mail.js | 2 +- .../webim/js/compiled/chat/modules/chat.js | 14 ++--- src/messenger/webim/js/compiled/chat_app.js | 22 +++---- .../chat/model_views/controls/history.js | 3 +- .../chat/model_views/controls/send_mail.js | 4 +- .../js/source/chat/models/controls/history.js | 8 ++- .../source/chat/models/controls/send_mail.js | 8 ++- .../webim/js/source/chat/modules/chat.js | 21 ++++--- src/messenger/webim/libs/chat.php | 1 - .../styles/dialogs/default/templates/chat.tpl | 63 ++++++++++--------- 13 files changed, 83 insertions(+), 69 deletions(-) diff --git a/src/messenger/webim/js/compiled/chat/model_views/controls/history.js b/src/messenger/webim/js/compiled/chat/model_views/controls/history.js index 1e64696e..4cd989f8 100644 --- a/src/messenger/webim/js/compiled/chat/model_views/controls/history.js +++ b/src/messenger/webim/js/compiled/chat/model_views/controls/history.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,c,e){b.Views.HistoryControl=b.Views.Control.extend({template:c.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var d=b.Objects.Models.user,c=b.Objects.Models.page,a=this.model.get("link");d.get("isAgent")&&a&&(d=c.get("historyWindowParams"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",d),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); +(function(b,d,e){b.Views.HistoryControl=b.Views.Control.extend({template:d.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var c=b.Objects.Models.user,a=this.model.get("link");c.get("isAgent")&&a&&(c=this.model.get("windowParams"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); diff --git a/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js b/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js index 8019db8f..efafae8e 100644 --- a/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js +++ b/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,e,f){b.Views.SendMailControl=b.Views.Control.extend({template:e.templates.send_mail_control,events:f.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var c=c.get("mailWindowParams"),d=b.Objects.Models.page.get("style"),a=a.replace(/\&\;/g,"&")+(d?"&style="+d:""),a=window.open(a,"ForwardMail",c);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); +(function(b,d,e){b.Views.SendMailControl=b.Views.Control.extend({template:d.templates.send_mail_control,events:e.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var d=this.model.get("windowParams"),c=c.get("style"),a=a.replace(/\&\;/g,"&")+(c?"&style="+c:""),a=window.open(a,"ForwardMail",d);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); diff --git a/src/messenger/webim/js/compiled/chat/models/controls/history.js b/src/messenger/webim/js/compiled/chat/models/controls/history.js index 8752d723..5b1a2f93 100644 --- a/src/messenger/webim/js/compiled/chat/models/controls/history.js +++ b/src/messenger/webim/js/compiled/chat/models/controls/history.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,b){a.Models.HistoryControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"HistoryControl"}})})(Mibew,_); +(function(a,b){a.Models.HistoryControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"HistoryControl"}})})(Mibew,_); diff --git a/src/messenger/webim/js/compiled/chat/models/controls/send_mail.js b/src/messenger/webim/js/compiled/chat/models/controls/send_mail.js index 9721dbcb..6f0397f4 100644 --- a/src/messenger/webim/js/compiled/chat/models/controls/send_mail.js +++ b/src/messenger/webim/js/compiled/chat/models/controls/send_mail.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,b){a.Models.SendMailControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1}),getModelType:function(){return"SendMailControl"}})})(Mibew,_); +(function(a,b){a.Models.SendMailControl=a.Models.Control.extend({defaults:b.extend({},a.Models.Control.prototype.defaults,{link:!1,windowParams:""}),getModelType:function(){return"SendMailControl"}})})(Mibew,_); diff --git a/src/messenger/webim/js/compiled/chat/modules/chat.js b/src/messenger/webim/js/compiled/chat/modules/chat.js index 3e8318bb..df562e32 100644 --- a/src/messenger/webim/js/compiled/chat/modules/chat.js +++ b/src/messenger/webim/js/compiled/chat/modules/chat.js @@ -5,10 +5,10 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(c){var g=a.Objects,d=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status,f=new a.Layouts.Chat({model:new Backbone.Model(c.layoutsData.chat||{})});a.Objects.chatLayout=f;k.mainRegion.show(f);d.thread=new a.Models.Thread(c.thread);d.user=new a.Models.ChatUser(c.user);d.page=new a.Models.Page(c.page);var e=new a.Collections.Controls; -d.user.get("isAgent")||(b.userName=new a.Models.UserNameControl({weight:220}),e.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:c.links.mailLink}),e.add(b.sendMail));d.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:c.links.redirectLink}),e.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:c.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);c.links.sslLink&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:c.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})); -d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,f.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(c.messageForm);f.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));f.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;f.soundRegion.show(new a.Views.Sound({model:d.sound}));j.push(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}))}))});l.addFinalizer(function(){a.Objects.chatLayout.close(); -for(var c=0;c