From 1f3e727c1772e66855a14295adb50c611fc842b5 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 23 Jan 2013 11:42:50 +0000 Subject: [PATCH] Create model for Thread --- src/messenger/webim/js/compiled/chat/app.js | 4 +- .../js/compiled/chat/collections/messages.js | 6 +-- .../js/compiled/chat/models/controls/close.js | 2 +- .../chat/models/controls/user_name.js | 2 +- .../chat/models/messages/message_form.js | 2 +- src/messenger/webim/js/compiled/chat_app.js | 16 +++---- .../compiled/default/{ => models}/thread.js | 2 +- .../webim/js/compiled/default_app.js | 4 +- src/messenger/webim/js/source/chat/app.js | 2 +- .../js/source/chat/collections/messages.js | 10 ++--- .../js/source/chat/models/controls/close.js | 8 ++-- .../source/chat/models/controls/user_name.js | 6 +-- .../chat/models/messages/message_form.js | 6 +-- .../webim/js/source/default/models/thread.js | 43 +++++++++++++++++++ .../webim/js/source/default/thread.js | 34 --------------- .../styles/dialogs/silver/templates/chat.tpl | 2 +- 16 files changed, 79 insertions(+), 70 deletions(-) rename src/messenger/webim/js/compiled/default/{ => models}/thread.js (57%) create mode 100644 src/messenger/webim/js/source/default/models/thread.js delete mode 100644 src/messenger/webim/js/source/default/thread.js diff --git a/src/messenger/webim/js/compiled/chat/app.js b/src/messenger/webim/js/compiled/chat/app.js index 9c0596c3..8fbf96cd 100644 --- a/src/messenger/webim/js/compiled/chat/app.js +++ b/src/messenger/webim/js/compiled/chat/app.js @@ -5,8 +5,8 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(a,j,k){var f=new j.Marionette.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(k.extend({interactionType:MibewAPIChatInteraction},d.server));g.thread=new a.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)); +(function(a,j,k){var f=new j.Marionette.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(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}));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;f.soundRegion.show(new a.Views.Sound({model:c.sound}));g.server.runUpdater()});a.Application=f})(Mibew,Backbone,_); diff --git a/src/messenger/webim/js/compiled/chat/collections/messages.js b/src/messenger/webim/js/compiled/chat/collections/messages.js index 9dc2a9ca..6dcbffd3 100644 --- a/src/messenger/webim/js/compiled/chat/collections/messages.js +++ b/src/messenger/webim/js/compiled/chat/collections/messages.js @@ -5,6 +5,6 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,d,c){b.Collections.Messages=d.Collection.extend({model:b.Models.Message,initialize:function(){b.Objects.server.callFunctionsPeriodically(c.bind(this.updateFunctionBuilder,this),c.bind(this.updateChatState,this));b.Objects.server.registerFunction("updateMessages",c.bind(this.apiUpdateMessages,this))},apiUpdateMessages:function(a){a.lastId&&(b.Objects.thread.lastId=a.lastId);for(var e=[],c=0,d=a.messages.length;c