mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-22 13:30:29 +03:00
Remove layout initialization options in Chat JS app
This commit is contained in:
parent
372bae4203
commit
faac427cc7
@ -5,4 +5,4 @@
|
||||
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);
|
||||
(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"},serializeData:function(){return{user:a.Objects.Models.user.toJSON()}}})})(Mibew,Backbone);
|
||||
|
@ -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(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);
|
||||
(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 e=c.chatModule,g=a.Objects,d=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(c.page);c=new a.Layouts.Chat;a.Objects.chatLayout=c;k.mainRegion.show(c);var f=new a.Collections.Controls;d.user.get("isAgent")||(b.userName=
|
||||
new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),f.add(b.sendMail));d.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),f.add(b.history));b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=
|
||||
new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.ssl&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;c.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));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]);
|
||||
c.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,c.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(e.messageForm);c.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));c.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;c.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);
|
||||
|
@ -250,20 +250,20 @@ 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.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);
|
||||
(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"},serializeData:function(){return{user:a.Objects.Models.user.toJSON()}}})})(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){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);
|
||||
(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 e=c.chatModule,g=a.Objects,d=a.Objects.Models,b=a.Objects.Models.Controls,h=a.Objects.Models.Status;d.thread=new a.Models.Thread(e.thread);d.user=new a.Models.ChatUser(e.user);d.page=new a.Models.Page(c.page);c=new a.Layouts.Chat;a.Objects.chatLayout=c;k.mainRegion.show(c);var f=new a.Collections.Controls;d.user.get("isAgent")||(b.userName=
|
||||
new a.Models.UserNameControl({weight:220}),f.add(b.userName),b.sendMail=new a.Models.SendMailControl({weight:200,link:e.links.mail,windowParams:e.windowsParams.mail}),f.add(b.sendMail));d.user.get("isAgent")&&(b.redirect=new a.Models.RedirectControl({weight:200,link:e.links.redirect}),f.add(b.redirect),b.history=new a.Models.HistoryControl({weight:180,link:e.links.history,windowParams:e.windowsParams.history}),f.add(b.history));b.sound=new a.Models.SoundControl({weight:160});f.add(b.sound);b.refresh=
|
||||
new a.Models.RefreshControl({weight:140});f.add(b.refresh);e.links.ssl&&(b.secureMode=new a.Models.SecureModeControl({weight:120,link:e.links.ssl}),f.add(b.secureMode));b.close=new a.Models.CloseControl({weight:100});f.add(b.close);g.Collections.controls=f;c.controlsRegion.show(new a.Views.ControlsCollection({collection:f}));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]);
|
||||
c.statusRegion.show(new a.Views.StatusCollection({collection:g.Collections.status}));d.user.get("isAgent")||(d.avatar=new a.Models.Avatar,c.avatarRegion.show(new a.Views.Avatar({model:d.avatar})));g.Collections.messages=new a.Collections.Messages;d.messageForm=new a.Models.MessageForm(e.messageForm);c.messageFormRegion.show(new a.Views.MessageForm({model:d.messageForm}));c.messagesRegion.show(new a.Views.MessagesCollection({collection:g.Collections.messages}));d.sound=new a.Models.Sound;c.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);
|
||||
/*
|
||||
This file is part of Mibew Messenger project.
|
||||
http://mibew.org
|
||||
|
@ -34,6 +34,22 @@
|
||||
statusRegion: '#status-region',
|
||||
messageFormRegion: '#message-form-region',
|
||||
soundRegion: '#sound-region'
|
||||
},
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
*
|
||||
* Use undocumented feature of layouts: passing data to template via
|
||||
* serializeData method.
|
||||
*
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
var user = Mibew.Objects.Models.user.toJSON();
|
||||
return {
|
||||
user: user
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -40,25 +40,20 @@
|
||||
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(chatOptions.layoutData || {})
|
||||
});
|
||||
Mibew.Objects.chatLayout = layout;
|
||||
|
||||
// Show layout at page
|
||||
app.mainRegion.show(layout);
|
||||
|
||||
|
||||
// Initialize Thread and User
|
||||
models.thread = new Mibew.Models.Thread(chatOptions.thread);
|
||||
models.user = new Mibew.Models.ChatUser(chatOptions.user);
|
||||
|
||||
|
||||
// Initialize Page
|
||||
models.page = new Mibew.Models.Page(options.page);
|
||||
|
||||
// Create instance of the chat layout
|
||||
var layout = new Mibew.Layouts.Chat();
|
||||
Mibew.Objects.chatLayout = layout;
|
||||
|
||||
// Show layout at page
|
||||
app.mainRegion.show(layout);
|
||||
|
||||
|
||||
// Initialize controls
|
||||
// Create controls collection
|
||||
|
@ -297,8 +297,7 @@ function setup_chatview(Thread $thread) {
|
||||
$data['chat'] = array(
|
||||
'messageForm' => array(),
|
||||
'links' => array(),
|
||||
'windowsParams' => array(),
|
||||
'layoutData' => array()
|
||||
'windowsParams' => array()
|
||||
);
|
||||
|
||||
// Set thread params
|
||||
@ -367,7 +366,6 @@ function setup_chatview_for_user(Thread $thread, $level) {
|
||||
$data['level'] = $level;
|
||||
|
||||
// Set user info
|
||||
$data['chat']['layoutData']['user'] = true;
|
||||
$data['chat']['user'] = array(
|
||||
'name' => htmlspecialchars(topage($thread->userName)),
|
||||
'canChangeName' => (bool)(Settings::get('usercanchangename') == "1"),
|
||||
@ -411,7 +409,6 @@ function setup_chatview_for_operator(Thread $thread, $operator) {
|
||||
$data = setup_chatview($thread);
|
||||
|
||||
// Set operator info
|
||||
$data['chat']['layoutData']['user'] = false;
|
||||
$data['chat']['user'] = array(
|
||||
'name' => htmlspecialchars(
|
||||
topage(
|
||||
|
@ -9,9 +9,9 @@
|
||||
{{! Chat region}}
|
||||
<div id="chat">
|
||||
<div class="bgl"><div class="bgr"><div class="sdwbgc"><div class="sdwbgl"><div class="sdwbgr">
|
||||
{{#if user}}
|
||||
{{#unless user.isAgent}}
|
||||
<div id="avatar-region"></div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{! Chat messages region}}
|
||||
<div id="messages-region"></div>
|
||||
{{! Chat status region}}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user