mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
Add network problems detection mechanism to operator/users.php
This commit is contained in:
parent
52e5075989
commit
d2018e1863
@ -5,6 +5,6 @@
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,g,h){var b=new g.Marionette.Application;b.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region",soundRegion:"#sound-region"});b.addInitializer(function(e){var f=a.Objects,c=a.Objects.Models,d=a.Objects.Collections;f.server=new a.Server(h.extend({interactionType:MibewAPIUsersInteraction},e.server));c.page=new a.Models.Page(e.page);c.agent=new a.Models.Agent(e.agent);d.threads=new a.Collections.Threads;
|
||||
b.threadsRegion.show(new a.Views.ThreadsCollection({collection:d.threads}));e.page.showOnlineOperators&&(d.visitors=new a.Collections.Visitors,b.visitorsRegion.show(new a.Views.VisitorsCollection({collection:d.visitors})));c.statusPanel=new a.Models.StatusPanel;b.statusPanelRegion.show(new a.Views.StatusPanel({model:c.statusPanel}));e.page.showOnlineOperators&&(d.agents=new a.Collections.Agents,b.agentsRegion.show(new a.Views.AgentsCollection({collection:d.agents})));c.sound=new a.Models.Sound;b.soundRegion.show(new a.Views.Sound({model:c.sound}));
|
||||
f.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:c.agent.id}}]},function(){})});b.on("start",function(){a.Objects.server.runUpdater()});a.Application=b})(Mibew,Backbone,_);
|
||||
(function(a,h,j){var d=0,g=function(){d++;10==d&&(alert(a.Localization.get("pending.errors.network")),d=0)},b=new h.Marionette.Application;b.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region",soundRegion:"#sound-region"});b.addInitializer(function(f){var d=a.Objects,c=a.Objects.Models,e=a.Objects.Collections;d.server=new a.Server(j.extend({interactionType:MibewAPIUsersInteraction,onTimeout:g,onTransportError:g},
|
||||
f.server));c.page=new a.Models.Page(f.page);c.agent=new a.Models.Agent(f.agent);e.threads=new a.Collections.Threads;b.threadsRegion.show(new a.Views.ThreadsCollection({collection:e.threads}));f.page.showOnlineOperators&&(e.visitors=new a.Collections.Visitors,b.visitorsRegion.show(new a.Views.VisitorsCollection({collection:e.visitors})));c.statusPanel=new a.Models.StatusPanel;b.statusPanelRegion.show(new a.Views.StatusPanel({model:c.statusPanel}));f.page.showOnlineOperators&&(e.agents=new a.Collections.Agents,
|
||||
b.agentsRegion.show(new a.Views.AgentsCollection({collection:e.agents})));c.sound=new a.Models.Sound;b.soundRegion.show(new a.Views.Sound({model:c.sound}));d.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:c.agent.id}}]},function(){})});b.on("start",function(){a.Objects.server.runUpdater()});a.Application=b})(Mibew,Backbone,_);
|
||||
|
@ -157,6 +157,6 @@ this.updateStyles,this)}})})(Mibew,Backbone,Handlebars,_);
|
||||
Copyright (c) 2005-2011 Mibew Messenger Community
|
||||
License: http://mibew.org/license.php
|
||||
*/
|
||||
(function(a,g,h){var b=new g.Marionette.Application;b.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region",soundRegion:"#sound-region"});b.addInitializer(function(e){var f=a.Objects,c=a.Objects.Models,d=a.Objects.Collections;f.server=new a.Server(h.extend({interactionType:MibewAPIUsersInteraction},e.server));c.page=new a.Models.Page(e.page);c.agent=new a.Models.Agent(e.agent);d.threads=new a.Collections.Threads;
|
||||
b.threadsRegion.show(new a.Views.ThreadsCollection({collection:d.threads}));e.page.showOnlineOperators&&(d.visitors=new a.Collections.Visitors,b.visitorsRegion.show(new a.Views.VisitorsCollection({collection:d.visitors})));c.statusPanel=new a.Models.StatusPanel;b.statusPanelRegion.show(new a.Views.StatusPanel({model:c.statusPanel}));e.page.showOnlineOperators&&(d.agents=new a.Collections.Agents,b.agentsRegion.show(new a.Views.AgentsCollection({collection:d.agents})));c.sound=new a.Models.Sound;b.soundRegion.show(new a.Views.Sound({model:c.sound}));
|
||||
f.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:c.agent.id}}]},function(){})});b.on("start",function(){a.Objects.server.runUpdater()});a.Application=b})(Mibew,Backbone,_);
|
||||
(function(a,h,j){var d=0,g=function(){d++;10==d&&(alert(a.Localization.get("pending.errors.network")),d=0)},b=new h.Marionette.Application;b.addRegions({agentsRegion:"#agents-region",statusPanelRegion:"#status-panel-region",threadsRegion:"#threads-region",visitorsRegion:"#visitors-region",soundRegion:"#sound-region"});b.addInitializer(function(f){var d=a.Objects,c=a.Objects.Models,e=a.Objects.Collections;d.server=new a.Server(j.extend({interactionType:MibewAPIUsersInteraction,onTimeout:g,onTransportError:g},
|
||||
f.server));c.page=new a.Models.Page(f.page);c.agent=new a.Models.Agent(f.agent);e.threads=new a.Collections.Threads;b.threadsRegion.show(new a.Views.ThreadsCollection({collection:e.threads}));f.page.showOnlineOperators&&(e.visitors=new a.Collections.Visitors,b.visitorsRegion.show(new a.Views.VisitorsCollection({collection:e.visitors})));c.statusPanel=new a.Models.StatusPanel;b.statusPanelRegion.show(new a.Views.StatusPanel({model:c.statusPanel}));f.page.showOnlineOperators&&(e.agents=new a.Collections.Agents,
|
||||
b.agentsRegion.show(new a.Views.AgentsCollection({collection:e.agents})));c.sound=new a.Models.Sound;b.soundRegion.show(new a.Views.Sound({model:c.sound}));d.server.callFunctionsPeriodically(function(){return[{"function":"update",arguments:{"return":{},references:{},agentId:c.agent.id}}]},function(){})});b.on("start",function(){a.Objects.server.runUpdater()});a.Application=b})(Mibew,Backbone,_);
|
||||
|
@ -8,6 +8,26 @@
|
||||
|
||||
(function(Mibew, Backbone, _){
|
||||
|
||||
/**
|
||||
* Represent count of bad AJAX request
|
||||
* @type Number
|
||||
*/
|
||||
var badRequestsCount = 0;
|
||||
|
||||
/**
|
||||
* Increase badRequestsCount and show reconnect message if need.
|
||||
* Calls on every bad request.
|
||||
*/
|
||||
var requestErrorHandler = function() {
|
||||
// Increase bad requests count
|
||||
badRequestsCount++;
|
||||
// Check if there is
|
||||
if (badRequestsCount == 10) {
|
||||
alert(Mibew.Localization.get('pending.errors.network'));
|
||||
badRequestsCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Create application instance
|
||||
var App = new Backbone.Marionette.Application();
|
||||
|
||||
@ -30,7 +50,11 @@
|
||||
|
||||
// Initialize Server, Thread and User
|
||||
objs.server = new Mibew.Server(_.extend(
|
||||
{'interactionType': MibewAPIUsersInteraction},
|
||||
{
|
||||
'interactionType': MibewAPIUsersInteraction,
|
||||
onTimeout: requestErrorHandler,
|
||||
onTransportError: requestErrorHandler
|
||||
},
|
||||
options.server
|
||||
));
|
||||
|
||||
|
@ -408,6 +408,7 @@ page_settings.tab.main=General
|
||||
page_settings.tab.performance=Performance
|
||||
page_settings.tab.themes=Chat themes preview
|
||||
page_settings.tab.invitationthemes=Invitation themes preview
|
||||
pending.errors.network=Network problems detected. Please refresh the page.
|
||||
pending.menu.hide=Hide menu >>
|
||||
pending.menu.show=Show menu >>
|
||||
pending.popup_notification=A new visitor is waiting for an answer.
|
||||
|
@ -408,6 +408,7 @@ page_settings.tab.main=
|
||||
page_settings.tab.performance=Производительность
|
||||
page_settings.tab.themes=Просмотр стилей диалогов
|
||||
page_settings.tab.invitationthemes=Просмотр стилей приглашений
|
||||
pending.errors.network=Обнаружены проблемы с сетью. Пожалуйста, перезагрузите страницу.
|
||||
pending.menu.hide=Спрятать меню >>
|
||||
pending.menu.show=Показать меню >>
|
||||
pending.popup_notification=Новый посетитель ожидает ответа.
|
||||
|
@ -83,7 +83,8 @@ function tpl_header() { global $page, $webimroot;
|
||||
'chat.thread.state_chatting_with_agent': "<?php echo getlocal('chat.thread.state_chatting_with_agent'); ?>",
|
||||
'chat.thread.state_closed': "<?php echo getlocal('chat.thread.state_closed'); ?>",
|
||||
'chat.thread.state_loading': "<?php echo getlocal('chat.thread.state_loading'); ?>",
|
||||
'chat.client.spam.prefix': "<?php echo getstring('chat.client.spam.prefix'); ?>"
|
||||
'chat.client.spam.prefix': "<?php echo getstring('chat.client.spam.prefix'); ?>",
|
||||
'pending.errors.network': "<?php echo getlocal('pending.errors.network'); ?>"
|
||||
});
|
||||
//--></script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user