From 52029b5d199a163337109e359cc5a04e6ec5003b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 15 May 2018 14:27:41 +0300 Subject: [PATCH] Hide download, print, edit buttons in the header when server is disconnected --- apps/documenteditor/main/app/controller/Viewport.js | 13 +++++++++++++ .../main/app/controller/Viewport.js | 13 +++++++++++++ .../main/app/controller/Viewport.js | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 43b07abda..b9a8ef37d 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -107,6 +107,8 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onZoomChange', this.onApiZoomChange.bind(this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',this.onApiCoAuthoringDisconnect.bind(this)); + Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, @@ -364,6 +366,17 @@ define([ } }, + onApiCoAuthoringDisconnect: function() { + if (this.header) { + if (this.header.btnDownload) + this.header.btnDownload.hide(); + if (this.header.btnPrint) + this.header.btnPrint.hide(); + if (this.header.btnEdit) + this.header.btnEdit.hide(); + } + }, + textFitPage: 'Fit to Page', textFitWidth: 'Fit to Width' }, DE.Controllers.Viewport)); diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 87aee107b..ac65b35ea 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -114,6 +114,8 @@ define([ setApi: function(api) { this.api = api; this.api.asc_registerCallback('asc_onZoomChange', this.onApiZoomChange.bind(this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',this.onApiCoAuthoringDisconnect.bind(this)); + Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, @@ -402,6 +404,17 @@ define([ } }, + onApiCoAuthoringDisconnect: function() { + if (this.header) { + if (this.header.btnDownload) + this.header.btnDownload.hide(); + if (this.header.btnPrint) + this.header.btnPrint.hide(); + if (this.header.btnEdit) + this.header.btnEdit.hide(); + } + }, + textFitPage: 'Fit to Page', textFitWidth: 'Fit to Width' }, PE.Controllers.Viewport)); diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index aacac3680..13d390bcd 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -122,6 +122,8 @@ define([ this.api.asc_registerCallback('asc_onSheetsChanged', this.onApiSheetChanged.bind(this)); this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', this.onApiSheetChanged.bind(this)); this.api.asc_registerCallback('asc_onEditCell', this.onApiEditCell.bind(this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',this.onApiCoAuthoringDisconnect.bind(this)); + Common.NotificationCenter.on('api:disconnect', this.onApiCoAuthoringDisconnect.bind(this)); }, onAppShowed: function (config) { @@ -409,6 +411,17 @@ define([ } }, + onApiCoAuthoringDisconnect: function() { + if (this.header) { + if (this.header.btnDownload) + this.header.btnDownload.hide(); + if (this.header.btnPrint) + this.header.btnPrint.hide(); + if (this.header.btnEdit) + this.header.btnEdit.hide(); + } + }, + textHideFBar: 'Hide Formula Bar', textHideHeadings: 'Hide Headings', textHideGridlines: 'Hide Gridlines',