Update chat page JavaScript configs structure

This commit is contained in:
Dmitriy Simushev 2013-02-18 09:54:52 +00:00
parent f28e65f0cf
commit 1a79be3970
13 changed files with 83 additions and 69 deletions

View File

@ -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,_);

View File

@ -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(/\&amp\;/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(/\&amp\;/g,"&")+(c?"&style="+c:""),a=window.open(a,"ForwardMail",d);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_);

View File

@ -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,_);

View File

@ -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,_);

View File

@ -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<j.length;c++)a.Objects.server.stopCallFunctionsPeriodically(j[c]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;
delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(b){var e=b.chatModule,g=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status,f=new a.Layouts.Chat({model:new Backbone.Model(e.layoutData||{})});a.Objects.chatLayout=f;k.mainRegion.show(f);d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(b.page);b=new a.Collections.Controls;
d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),b.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),b.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),b.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),b.add(c.history));c.sound=new a.Models.SoundControl({weight:160});
b.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});b.add(c.refresh);e.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),b.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});b.add(c.close);g.Collections.controls=b;f.controlsRegion.show(new a.Views.ControlsCollection({collection:b}));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(e.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 b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;
delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);

View File

@ -46,7 +46,7 @@ MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,
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,_);
/*
This file is part of Mibew Messenger project.
http://mibew.org
@ -74,7 +74,7 @@ MibewAPIChatInteraction=function(){this.obligatoryArguments={"*":{threadId:null,
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,_);
/*
This file is part of Mibew Messenger project.
http://mibew.org
@ -153,7 +153,7 @@ a);this.trigger("multiple:add");return a}})})(Mibew,Backbone,_);
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("&amp;","&","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("&amp;","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_);
/*
This file is part of Mibew Messenger project.
http://mibew.org
@ -182,7 +182,7 @@ window.location.href=b.replace(/\&amp\;/g,"&")+(c?"&style="+c:"")}}})})(Mibew,Ha
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(/\&amp\;/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(/\&amp\;/g,"&")+(c?"&style="+c:""),a=window.open(a,"ForwardMail",d);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_);
/*
This file is part of Mibew Messenger project.
http://mibew.org
@ -257,13 +257,13 @@ 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){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<j.length;c++)a.Objects.server.stopCallFunctionsPeriodically(j[c]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;
delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
(function(a){a.Objects.Models.Controls={};a.Objects.Models.Status={};var j=[],k=a.Application,l=k.module("Chat",{startWithParent:!1});l.addInitializer(function(b){var e=b.chatModule,g=a.Objects,d=a.Objects.Models,c=a.Objects.Models.Controls,h=a.Objects.Models.Status,f=new a.Layouts.Chat({model:new Backbone.Model(e.layoutData||{})});a.Objects.chatLayout=f;k.mainRegion.show(f);d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(b.page);b=new a.Collections.Controls;
d.user.get("isAgent")||(c.userName=new a.Models.UserNameControl({weight:220}),b.add(c.userName),c.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),b.add(c.sendMail));d.user.get("isAgent")&&(c.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),b.add(c.redirect),c.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),b.add(c.history));c.sound=new a.Models.SoundControl({weight:160});
b.add(c.sound);c.refresh=new a.Models.RefreshControl({weight:140});b.add(c.refresh);e.links.ssl&&(c.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),b.add(c.secureMode));c.close=new a.Models.CloseControl({weight:100});b.add(c.close);g.Collections.controls=b;f.controlsRegion.show(new a.Views.ControlsCollection({collection:b}));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(e.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 b=0;b<j.length;b++)a.Objects.server.stopCallFunctionsPeriodically(j[b]);"undefined"!=typeof a.Objects.Models.avatar&&a.Objects.Models.avatar.finalize();a.Objects.Collections.messages.finalize();delete a.Objects.chatLayout;delete a.Objects.Models.thread;delete a.Objects.Models.user;delete a.Objects.Models.page;delete a.Objects.Models.avatar;delete a.Objects.Models.messageForm;delete a.Objects.Models.sound;
delete a.Objects.Models.Controls;delete a.Objects.Models.Status;delete a.Objects.Collections.messages;delete a.Objects.Collections.controls;delete a.Objects.Collections.status})})(Mibew);
/*
This file is part of Mibew Messenger project.
http://mibew.org

View File

@ -39,10 +39,9 @@
*/
showHistory: function() {
var user = Mibew.Objects.Models.user;
var page = Mibew.Objects.Models.page;
var link = this.model.get('link');
if (user.get('isAgent') && link) {
var winParams = page.get('historyWindowParams');
var winParams = this.model.get('windowParams');
// TODO: Kill &amp; at the server side
link = link.replace('&amp;', '&', 'g');

View File

@ -41,9 +41,9 @@
var link = this.model.get('link');
var page = Mibew.Objects.Models.page;
if (link) {
var winParams = page.get('mailWindowParams');
var winParams = this.model.get('windowParams');
var style = Mibew.Objects.Models.page.get('style');
var style = page.get('style');
// TODO: Kill &amp; at the server side
link = link.replace(/\&amp\;/g, '&')

View File

@ -29,7 +29,13 @@
* An URL of the History page or false by default.
* @type String|Boolean
*/
link: false
link: false,
/**
* Params string for history popup window
* @type String
*/
windowParams: ''
}
),

View File

@ -29,7 +29,13 @@
* An URL of the Mail page or false by default.
* @type String|Boolean
*/
link: false
link: false,
/**
* Params string for send mail popup window
* @type String
*/
windowParams: ''
}
),
/**

View File

@ -34,6 +34,7 @@
// Add module initializer
chat.addInitializer(function(options) {
// Create some shortcuts
var chatOptions = options.chatModule;
var objs = Mibew.Objects;
var models = Mibew.Objects.Models;
var controls = Mibew.Objects.Models.Controls;
@ -42,7 +43,7 @@
// 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 || {})
model: new Backbone.Model(chatOptions.layoutData || {})
});
Mibew.Objects.chatLayout = layout;
@ -51,8 +52,8 @@
// Initialize Thread and User
models.thread = new Mibew.Models.Thread(options.thread);
models.user = new Mibew.Models.ChatUser(options.user);
models.thread = new Mibew.Models.Thread(chatOptions.thread);
models.user = new Mibew.Models.ChatUser(chatOptions.user);
// Initialize Page
@ -74,7 +75,8 @@
// Create mail control
controls.sendMail = new Mibew.Models.SendMailControl({
weight: 200,
link: options.links.mailLink
link: chatOptions.links.mail,
windowParams: chatOptions.windowsParams.mail
});
ctrlsCollection.add(controls.sendMail);
}
@ -83,13 +85,14 @@
if (models.user.get('isAgent')) {
controls.redirect = new Mibew.Models.RedirectControl({
weight: 200,
link: options.links.redirectLink
link: chatOptions.links.redirect
});
ctrlsCollection.add(controls.redirect);
controls.history = new Mibew.Models.HistoryControl({
weight: 180,
link: options.links.historyLink
link: chatOptions.links.history,
windowParams: chatOptions.windowsParams.history
});
ctrlsCollection.add(controls.history);
}
@ -106,10 +109,10 @@
});
ctrlsCollection.add(controls.refresh);
if (options.links.sslLink) {
if (chatOptions.links.ssl) {
controls.secureMode = new Mibew.Models.SecureModeControl({
weight: 120,
link: options.links.sslLink
link: chatOptions.links.ssl
});
ctrlsCollection.add(controls.secureMode);
}
@ -162,7 +165,7 @@
// Create message processor model
models.messageForm = new Mibew.Models.MessageForm(
options.messageForm
chatOptions.messageForm
);
// Display message processor

View File

@ -306,7 +306,6 @@ function setup_chatview(Thread $thread) {
// Load dialogs style options
$style_config = get_dialogs_style_config(getchatstyle());
$data['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
$data['chatStyles.mailWindowParams'] = $style_config['mail']['window_params'];
// Load core style options

View File

@ -54,6 +54,16 @@
<script type="text/javascript"><!--
jQuery(document).ready(function(){
Mibew.Application.start({
server: {
url: "${webimroot}/thread.php",
requestsFrequency: ${page:frequency}
},
page: {
style: '${styleid}',
webimRoot: '${webimroot}',
tplRoot: '${tplroot}'
},
chatModule: {
user: {
${if:user}
name: "${page:ct.user.name}",
@ -63,10 +73,6 @@
canPost: ${if:canpost}true${else:canpost}false${endif:canpost},
isAgent: ${if:agent}true${else:agent}false${endif:agent}
},
server: {
url: "${webimroot}/thread.php",
requestsFrequency: ${page:frequency}
},
thread: {
id:${page:ct.chatThreadId},
token:${page:ct.token}
@ -78,21 +84,16 @@
ignoreCtrl:${if:ignorectrl}true${else:ignorectrl}false${endif:ignorectrl}
},
links: {
mailLink: "${page:mailLink}",
redirectLink: "${page:redirectLink}",
historyLink: "${page:historyParamsLink}",
sslLink: "${page:sslLink}"
mail: "${page:mailLink}",
redirect: "${page:redirectLink}",
history: "${page:historyParamsLink}",
ssl: "${page:sslLink}"
},
page: {
style: '${styleid}',
webimRoot: '${webimroot}',
tplRoot: '${tplroot}',
chatWindowParams: "${page:chatStyles.chatWindowParams}",
mailWindowParams: "${page:chatStyles.mailWindowParams}",
historyWindowParams: "${page:coreStyles.historyWindowParams}"
windowsParams: {
mail: "${page:chatStyles.mailWindowParams}",
history: "${page:coreStyles.historyWindowParams}"
},
layoutsData: {
chat: {
layoutData: {
user: ${if:user}true${else:user}false${endif:user}
}
},