From f10c01cfd22414bcea615ff69d84bf44e219a788 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 16 May 2017 10:46:04 +0300 Subject: [PATCH] [Common] Change api method showMessage (2 parameter will be deprecated). --- apps/api/documents/api.js | 16 +++------------- .../embed/js/ApplicationController.js | 8 ++++---- apps/documenteditor/main/app/controller/Main.js | 2 +- .../documenteditor/mobile/app/controller/Main.js | 2 +- .../embed/js/ApplicationController.js | 8 ++++---- .../main/app/controller/Main.js | 2 +- .../mobile/app/controller/Main.js | 2 +- .../embed/js/ApplicationController.js | 8 ++++---- .../main/app/controller/Main.js | 2 +- .../mobile/app/controller/Main.js | 2 +- 10 files changed, 21 insertions(+), 31 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 1d42db418..dd2ed0365 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -409,21 +409,12 @@ }); }; - var _showError = function(title, msg) { - _showMessage(title, msg, "error"); - }; - - // severity could be one of: "error", "info" or "warning" - var _showMessage = function(title, msg, severity) { - if (typeof severity !== 'string') { - severity = "info"; - } + var _showMessage = function(title, msg) { + msg = msg || title; _sendCommand({ command: 'showMessage', data: { - title: title, - msg: msg, - severity: severity + msg: msg } }); }; @@ -540,7 +531,6 @@ }; return { - showError : _showError, showMessage : _showMessage, processSaveResult : _processSaveResult, processRightsChange : _processRightsChange, diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 873fe70c8..c938f38a8 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -402,14 +402,14 @@ var ApplicationController = new(function(){ Common.Analytics.trackEvent('Internal Error', id.toString()); } - function onExternalError(error) { + function onExternalMessage(error) { if (error) { hidePreloader(); - $('#id-error-mask-title').text(error.title); + $('#id-error-mask-title').text('Error'); $('#id-error-mask-text').text(error.msg); $('#id-error-mask').css('display', 'block'); - Common.Analytics.trackEvent('External Error', error.title); + Common.Analytics.trackEvent('External Error'); } } @@ -497,7 +497,7 @@ var ApplicationController = new(function(){ // Initialize api gateway Common.Gateway.on('init', loadConfig); Common.Gateway.on('opendocument', loadDocument); - Common.Gateway.on('showerror', onExternalError); + Common.Gateway.on('showmessage', onExternalMessage); Common.Gateway.ready(); } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d60188454..dcecfb286 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1138,7 +1138,7 @@ define([ msg.msg = (msg.msg).toString(); this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } }, diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 03565ab84..d4d81dd2c 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -697,7 +697,7 @@ define([ message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)] }); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } }, diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index 6c0b73584..4cbe3951d 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -506,14 +506,14 @@ var ApplicationController = new(function(){ Common.Analytics.trackEvent('Internal Error', id.toString()); } - function onExternalError(error) { + function onExternalMessage(error) { if (error) { hidePreloader(); - $('#id-error-mask-title').text(error.title); + $('#id-error-mask-title').text('Error'); $('#id-error-mask-text').text(error.msg); $('#id-error-mask').css('display', 'block'); - Common.Analytics.trackEvent('External Error', error.title); + Common.Analytics.trackEvent('External Error'); } } @@ -573,7 +573,7 @@ var ApplicationController = new(function(){ // Initialize api gateway Common.Gateway.on('init', loadConfig); Common.Gateway.on('opendocument', loadDocument); - Common.Gateway.on('showerror', onExternalError); + Common.Gateway.on('showmessage', onExternalMessage); Common.Gateway.ready(); } diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 44ec1fc87..802c7974b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -897,7 +897,7 @@ define([ msg.msg = (msg.msg).toString(); this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } }, diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 4de110d82..90c46b3f0 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -658,7 +658,7 @@ define([ message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)] }); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } }, diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 268488467..7f6873718 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -414,14 +414,14 @@ var ApplicationController = new(function(){ Common.Analytics.trackEvent('Internal Error', id.toString()); } - function onExternalError(error) { + function onExternalMessage(error) { if (error) { hidePreloader(); - $('#id-error-mask-title').text(error.title); + $('#id-error-mask-title').text('Error'); $('#id-error-mask-text').text(error.msg); $('#id-error-mask').css('display', 'block'); - Common.Analytics.trackEvent('External Error', error.title); + Common.Analytics.trackEvent('External Error'); } } @@ -519,7 +519,7 @@ var ApplicationController = new(function(){ // Initialize api gateway Common.Gateway.on('init', loadConfig); Common.Gateway.on('opendocument', loadDocument); - Common.Gateway.on('showerror', onExternalError); + Common.Gateway.on('showmessage', onExternalMessage); Common.Gateway.ready(); } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3d47f9703..7871c34de 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -954,7 +954,7 @@ define([ msg.msg = (msg.msg).toString(); this.showTips([msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)]); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } }, diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index eb04ec058..8ff651fba 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -676,7 +676,7 @@ define([ message: [msg.msg.charAt(0).toUpperCase() + msg.msg.substring(1)] }); - Common.component.Analytics.trackEvent('External Error', msg.title); + Common.component.Analytics.trackEvent('External Error'); } },