From 697785ff231834bf0d4e74914074cd3f96e61fe4 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 9 Jan 2018 15:10:48 +0300 Subject: [PATCH] Added onWarning event to api. --- apps/api/documents/api.js | 3 ++- apps/common/Gateway.js | 10 ++++++++++ apps/documenteditor/embed/js/ApplicationController.js | 2 ++ apps/documenteditor/main/app/controller/Main.js | 2 ++ apps/documenteditor/mobile/app/controller/Main.js | 2 ++ .../embed/js/ApplicationController.js | 2 ++ apps/presentationeditor/main/app/controller/Main.js | 2 ++ apps/presentationeditor/mobile/app/controller/Main.js | 2 ++ .../embed/js/ApplicationController.js | 2 ++ apps/spreadsheeteditor/main/app/controller/Main.js | 2 ++ apps/spreadsheeteditor/mobile/app/controller/Main.js | 2 ++ 11 files changed, 30 insertions(+), 1 deletion(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 7e18427ef..ded11e2c8 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -170,7 +170,8 @@ 'onAppReady': , 'onBack': , 'onError': , - 'onDocumentReady': + 'onDocumentReady': , + 'onWarning': } } */ diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 1fe953700..9a2c6000c 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -189,6 +189,16 @@ if (Common === undefined) { }); }, + reportWarning: function(code, description) { + _postMessage({ + event: 'onWarning', + data: { + warningCode: code, + warningDescription: description + } + }); + }, + sendInfo: function(info) { _postMessage({ event: 'onInfo', diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 12dc6f7ea..22b0216a8 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -398,6 +398,8 @@ var ApplicationController = new(function(){ }); } else { + Common.Gateway.reportWarning(id, message); + $('#id-critical-error-title').text(me.notcriticalErrorTitle); $('#id-critical-error-message').text(message); $('#id-critical-error-close').off(); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e6ff4095c..33fccd7dc 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1340,6 +1340,8 @@ define([ } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; config.iconCls = 'warn'; config.buttons = ['ok']; diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 8076ecf8f..64b305202 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -866,6 +866,8 @@ define([ } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; config.callback = _.bind(function(btn){ if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && (this.appOptions.canDownload || this.appOptions.canDownloadOrigin)) { diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index bec396de7..d598967e4 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -497,6 +497,8 @@ var ApplicationController = new(function(){ }); } else { + Common.Gateway.reportWarning(id, message); + $('#id-critical-error-title').text(me.notcriticalErrorTitle); $('#id-critical-error-message').text(message); $('#id-critical-error-close').off(); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 7df2dbad6..bad011c7c 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1099,6 +1099,8 @@ define([ } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; config.iconCls = 'warn'; config.buttons = ['ok']; diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index af79c3c0b..69d23b5c1 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -821,6 +821,8 @@ define([ } } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; config.callback = _.bind(function(btn){ if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && (this.appOptions.canDownload || this.appOptions.canDownloadOrigin)) { diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 2fb85a683..f02790f27 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -405,6 +405,8 @@ var ApplicationController = new(function(){ }); } else { + Common.Gateway.reportWarning(id, message); + $('#id-critical-error-title').text(me.notcriticalErrorTitle); $('#id-critical-error-message').text(message); $('#id-critical-error-close').off(); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3c2c2ec8a..4b0005869 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1256,6 +1256,8 @@ define([ } } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; config.iconCls = 'warn'; config.buttons = ['ok']; diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index d750dae1d..5c2bb4b17 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -962,6 +962,8 @@ define([ } } else { + Common.Gateway.reportWarning(id, config.msg); + config.title = this.notcriticalErrorTitle; // config.iconCls = 'warn'; // config.buttons = ['ok'];