diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index e9bdf9c453..4c5328a83e 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -694,13 +694,15 @@ define([ SetDisabled: function(disable, options) { if (this.leftMenu._state.disabled !== disable) { this.leftMenu._state.disabled = disable; - if (disable) { - this.previsEdit = this.mode.isEdit; - this.prevcanEdit = this.mode.canEdit; - this.mode.isEdit = this.mode.canEdit = !disable; - } else { - this.mode.isEdit = this.previsEdit; - this.mode.canEdit = this.prevcanEdit; + if (this.mode) { + if (disable) { + this.previsEdit = this.mode.isEdit; + this.prevcanEdit = this.mode.canEdit; + this.mode.isEdit = this.mode.canEdit = !disable; + } else { + this.mode.isEdit = this.previsEdit; + this.mode.canEdit = this.prevcanEdit; + } } } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index a949c35b4b..590033b4b1 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1113,12 +1113,10 @@ define([ if ( id == Asc.c_oAscAsyncAction['Disconnect']) { this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, 'reconnect'); - // this.getApplication().getController('Statusbar').hideDisconnectTip(); Common.UI.TooltipManager.closeTip('disconnect'); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); } else if (id === Asc.c_oAscAsyncAction['RefreshFile']) { this.disableEditing(false, 'refresh-file'); - // this.getApplication().getController('Statusbar').hideDisconnectTip(); Common.UI.TooltipManager.closeTip('refreshFile'); this.getApplication().getController('Statusbar').setStatusCaption(''); } @@ -1229,7 +1227,6 @@ define([ statusCallback = function() { me._state.timerDisconnect = setTimeout(function(){ Common.UI.TooltipManager.showTip('disconnect'); - // me.getApplication().getController('Statusbar').showDisconnectTip(); }, me._state.unloadTimer || 0); }; break; @@ -1240,7 +1237,6 @@ define([ Common.UI.Menu.Manager.hideAll(); this.disableEditing(true, 'refresh-file'); Common.UI.TooltipManager.showTip('refreshFile'); - // this.getApplication().getController('Statusbar').showDisconnectTip(this.textUpdateVersion); break; case Asc.c_oAscAsyncAction['Submit']: @@ -2603,18 +2599,6 @@ define([ }}); this.disableEditing(true, 'not-loaded'); Common.NotificationCenter.trigger('api:disconnect'); - - // Common.UI.warning({ - // title: me.titleUpdateVersion, - // msg: this.errorUpdateVersion, - // callback: function() { - // _.defer(function() { - // Common.Gateway.updateVersion(); - // if (callback) callback.call(me); - // me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - // }) - // } - // }); }, onServerVersion: function(buildVersion) { diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index 70211eaca3..0a61aa597f 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -306,7 +306,7 @@ define([ if (!this._state.pluginIsRunning) this.$el.width(SCALE_MIN); /** coauthoring begin **/ - if (this.mode.canCoAuthoring) { + if (this.mode && this.mode.canCoAuthoring) { if (this.mode.canViewComments) { this.panelComments && this.panelComments['hide'](); if (this.btnComments.pressed) diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 3f6afbdd4f..594e6a3233 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1978,7 +1978,7 @@ define([ tab = $(e.currentTarget).find('> a[data-tab]').data('tab'), is_file_active = me.isTabActive('file'); - if (tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; + if (!me._isDocReady || tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments); @@ -2109,6 +2109,7 @@ define([ onAppReady: function (config) { var me = this; + me._isDocReady = true; if (me.cmbFontSize) { var lang = config.lang ? config.lang.toLowerCase() : 'en', langPrefix = lang.split(/[\-_]/)[0]; diff --git a/apps/pdfeditor/main/app/controller/LeftMenu.js b/apps/pdfeditor/main/app/controller/LeftMenu.js index cd05c18e6b..e1ac1a3d42 100644 --- a/apps/pdfeditor/main/app/controller/LeftMenu.js +++ b/apps/pdfeditor/main/app/controller/LeftMenu.js @@ -623,13 +623,15 @@ define([ SetDisabled: function(disable, options) { if (this.leftMenu._state.disabled !== disable) { this.leftMenu._state.disabled = disable; - if (disable) { - this.previsEdit = this.mode.isEdit; - this.prevcanEdit = this.mode.canEdit; - this.mode.isEdit = this.mode.canEdit = !disable; - } else { - this.mode.isEdit = this.previsEdit; - this.mode.canEdit = this.prevcanEdit; + if (this.mode) { + if (disable) { + this.previsEdit = this.mode.isEdit; + this.prevcanEdit = this.mode.canEdit; + this.mode.isEdit = this.mode.canEdit = !disable; + } else { + this.mode.isEdit = this.previsEdit; + this.mode.canEdit = this.prevcanEdit; + } } } diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 7694d79d75..b2e2719b9a 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -861,11 +861,11 @@ define([ if ( id == Asc.c_oAscAsyncAction['Disconnect']) { this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, 'reconnect'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('disconnect'); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); } else if (id === Asc.c_oAscAsyncAction['RefreshFile']) { this.disableEditing(false, 'refresh-file'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('refreshFile'); this.getApplication().getController('Statusbar').setStatusCaption(''); } @@ -958,7 +958,7 @@ define([ var me = this; statusCallback = function() { me._state.timerDisconnect = setTimeout(function(){ - me.getApplication().getController('Statusbar').showDisconnectTip(); + Common.UI.TooltipManager.showTip('disconnect'); }, me._state.unloadTimer || 0); }; break; @@ -968,7 +968,7 @@ define([ text = this.textUpdating; Common.UI.Menu.Manager.hideAll(); this.disableEditing(true, 'refresh-file'); - this.getApplication().getController('Statusbar').showDisconnectTip(this.textUpdateVersion); + Common.UI.TooltipManager.showTip('refreshFile'); break; default: @@ -1661,6 +1661,9 @@ define([ } else if (id == Asc.c_oAscError.ID.CanNotPasteImage) { this.showTips([this.errorCannotPasteImg], {timeout: 7000, hideCloseTip: true}); return; + } else if (id === Asc.c_oAscError.ID.UpdateVersion) { + Common.UI.TooltipManager.showTip('updateVersion'); + return; } this.hidePreloader(); @@ -1813,10 +1816,10 @@ define([ config.msg = this.errorFileSizeExceed; break; - case Asc.c_oAscError.ID.UpdateVersion: - config.msg = this.errorUpdateVersionOnDisconnect; - config.maxwidth = 600; - break; + // case Asc.c_oAscError.ID.UpdateVersion: + // config.msg = this.errorUpdateVersionOnDisconnect; + // config.maxwidth = 600; + // break; case Asc.c_oAscError.ID.ComboSeriesError: config.msg = this.errorComboSeries; @@ -2189,20 +2192,22 @@ define([ }, onUpdateVersion: function(callback) { + console.log("Obsolete: The 'onOutdatedVersion' event is deprecated. Please use 'onRequestRefreshFile' event and 'refreshFile' method instead."); + var me = this; me.needToUpdateVersion = true; me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - Common.UI.warning({ - title: me.titleUpdateVersion, - msg: this.errorUpdateVersion, + Common.UI.TooltipManager.showTip({ step: 'updateVersionReload', text: this.errorUpdateVersion, header: this.titleUpdateVersion, + target: '#toolbar', maxwidth: 'none', closable: false, automove: true, noHighlight: true, callback: function() { _.defer(function() { Common.Gateway.updateVersion(); if (callback) callback.call(me); me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); }) - } - }); + }}); + this.disableEditing(true, 'not-loaded'); + Common.NotificationCenter.trigger('api:disconnect'); }, onServerVersion: function(buildVersion) { diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index 168150c315..0f834d4df9 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -171,11 +171,15 @@ define([ }, setMode: function(mode) { + var _main = this.getApplication().getController('Main'); this.mode = mode; this.toolbar.applyLayout(mode); Common.UI.TooltipManager.addTips({ 'editPdf' : {name: 'pdfe-help-tip-edit-pdf', placement: 'bottom-right', text: this.helpEditPdf, header: this.helpEditPdfHeader, target: '#slot-btn-tb-edit-mode'}, - 'textComment' : {name: 'pdfe-help-tip-text-comment', placement: 'bottom-right', text: this.helpTextComment, header: this.helpTextCommentHeader, target: '#slot-btn-text-comment'} + 'textComment' : {name: 'pdfe-help-tip-text-comment', placement: 'bottom-right', text: this.helpTextComment, header: this.helpTextCommentHeader, target: '#slot-btn-text-comment'}, + 'refreshFile' : {text: _main.textUpdateVersion, header: _main.textUpdating, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'disconnect' : {text: _main.textConnectionLost, header: _main.textDisconnect, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'updateVersion' : {text: _main.errorUpdateVersionOnDisconnect, header: _main.titleUpdateVersion, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true} }); }, diff --git a/apps/pdfeditor/main/app/view/LeftMenu.js b/apps/pdfeditor/main/app/view/LeftMenu.js index 44d8a18a46..864d48c81b 100644 --- a/apps/pdfeditor/main/app/view/LeftMenu.js +++ b/apps/pdfeditor/main/app/view/LeftMenu.js @@ -299,7 +299,7 @@ define([ if (!this._state.pluginIsRunning) this.$el.width(SCALE_MIN); /** coauthoring begin **/ - if (this.mode.canCoAuthoring) { + if (this.mode && this.mode.canCoAuthoring) { if (this.mode.canViewComments) { this.panelComments && this.panelComments['hide'](); if (this.btnComments.pressed) diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index 190003de12..e8c3a62b40 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -1218,7 +1218,7 @@ define([ tab = $(e.currentTarget).find('> a[data-tab]').data('tab'), is_file_active = me.isTabActive('file'); - if (tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; + if (!me._isDocReady || tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments); @@ -1374,6 +1374,7 @@ define([ onAppReady: function (config) { var me = this; + me._isDocReady = true; (new Promise( function(resolve, reject) { resolve(); })).then(function () { diff --git a/apps/pdfeditor/main/locale/en.json b/apps/pdfeditor/main/locale/en.json index 248c0060c8..595ba8a2a5 100644 --- a/apps/pdfeditor/main/locale/en.json +++ b/apps/pdfeditor/main/locale/en.json @@ -1016,6 +1016,7 @@ "PDFE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PDFE.Controllers.Main.textUpdating": "Updating", "PDFE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.
Trying to update file, please wait...", + "PDFE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings.", "PDFE.Controllers.Navigation.txtBeginning": "Beginning of document", "PDFE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "PDFE.Controllers.Print.textMarginsLast": "Last custom", diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index d295692f4d..23926f41dc 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -817,13 +817,15 @@ define([ SetDisabled: function(disable, options) { if (this.leftMenu._state.disabled !== disable) { this.leftMenu._state.disabled = disable; - if (disable) { - this.previsEdit = this.mode.isEdit; - this.prevcanEdit = this.mode.canEdit; - this.mode.isEdit = this.mode.canEdit = !disable; - } else { - this.mode.isEdit = this.previsEdit; - this.mode.canEdit = this.prevcanEdit; + if (this.mode) { + if (disable) { + this.previsEdit = this.mode.isEdit; + this.prevcanEdit = this.mode.canEdit; + this.mode.isEdit = this.mode.canEdit = !disable; + } else { + this.mode.isEdit = this.previsEdit; + this.mode.canEdit = this.prevcanEdit; + } } } diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index b3ebc170c2..b892ebbcc3 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -742,11 +742,11 @@ define([ if ( id == Asc.c_oAscAsyncAction['Disconnect']) { this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, 'reconnect'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('disconnect'); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); } else if (id === Asc.c_oAscAsyncAction['RefreshFile']) { this.disableEditing(false, 'refresh-file'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('refreshFile'); this.getApplication().getController('Statusbar').setStatusCaption(''); } @@ -846,7 +846,7 @@ define([ var me = this; statusCallback = function() { me._state.timerDisconnect = setTimeout(function(){ - me.getApplication().getController('Statusbar').showDisconnectTip(); + Common.UI.TooltipManager.showTip('disconnect'); }, me._state.unloadTimer || 0); }; break; @@ -856,7 +856,7 @@ define([ text = this.textUpdating; Common.UI.Menu.Manager.hideAll(); this.disableEditing(true, 'refresh-file'); - this.getApplication().getController('Statusbar').showDisconnectTip(this.textUpdateVersion); + Common.UI.TooltipManager.showTip('refreshFile'); break; default: @@ -1638,6 +1638,9 @@ define([ } else if (id === Asc.c_oAscError.ID.DocumentAndChangeMismatch) { this.getApplication().getController('Common.Controllers.History').onHashError(); return; + } else if (id === Asc.c_oAscError.ID.UpdateVersion) { + Common.UI.TooltipManager.showTip('updateVersion'); + return; } this.hidePreloader(); @@ -1782,10 +1785,10 @@ define([ config.msg = this.errorFileSizeExceed; break; - case Asc.c_oAscError.ID.UpdateVersion: - config.msg = this.errorUpdateVersionOnDisconnect; - config.maxwidth = 600; - break; + // case Asc.c_oAscError.ID.UpdateVersion: + // config.msg = this.errorUpdateVersionOnDisconnect; + // config.maxwidth = 600; + // break; case Asc.c_oAscError.ID.ComboSeriesError: config.msg = this.errorComboSeries; @@ -2070,19 +2073,22 @@ define([ }, onUpdateVersion: function(callback) { + console.log("Obsolete: The 'onOutdatedVersion' event is deprecated. Please use 'onRequestRefreshFile' event and 'refreshFile' method instead."); + var me = this; me.needToUpdateVersion = true; me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - Common.UI.warning({ - msg: this.errorUpdateVersion, + Common.UI.TooltipManager.showTip({ step: 'updateVersionReload', text: this.errorUpdateVersion, header: this.titleUpdateVersion, + target: '#toolbar', maxwidth: 'none', closable: false, automove: true, noHighlight: true, callback: function() { _.defer(function() { Common.Gateway.updateVersion(); if (callback) callback.call(me); me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); }) - } - }); + }}); + this.disableEditing(true, 'not-loaded'); + Common.NotificationCenter.trigger('api:disconnect'); }, onServerVersion: function(buildVersion) { diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 1c933b3471..efe5920519 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -301,12 +301,16 @@ define([ }, setMode: function(mode) { + var _main = this.getApplication().getController('Main'); this.mode = mode; this.toolbar.applyLayout(mode); Common.UI.TooltipManager.addTips({ 'colorSchema' : {name: 'pe-help-tip-color-schema', placement: 'bottom-left', text: this.helpColorSchema, header: this.helpColorSchemaHeader, target: '#slot-btn-colorschemas', automove: true}, 'animPane' : {name: 'pe-help-tip-anim-pane', placement: 'bottom-left', text: this.helpAnimPane, header: this.helpAnimPaneHeader, target: '#animation-button-pane', automove: true}, - 'masterSlide' : {name: 'pe-help-tip-master-slide', placement: 'bottom-right', text: this.helpMasterSlide, header: this.helpMasterSlideHeader, target: '#slot-btn-slide-master'} + 'masterSlide' : {name: 'pe-help-tip-master-slide', placement: 'bottom-right', text: this.helpMasterSlide, header: this.helpMasterSlideHeader, target: '#slot-btn-slide-master'}, + 'refreshFile' : {text: _main.textUpdateVersion, header: _main.textUpdating, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'disconnect' : {text: _main.textConnectionLost, header: _main.textDisconnect, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'updateVersion' : {text: _main.errorUpdateVersionOnDisconnect, header: _main.titleUpdateVersion, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true} }); }, diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index 4d9c9e07ef..5f6d8bf91b 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -278,11 +278,11 @@ define([ close: function(menu) { this.btnAbout.toggle(false); - this.btnThumbs.toggle(false); + this.btnThumbs.toggle(false, !this.mode); if (!this._state.pluginIsRunning) this.$el.width(SCALE_MIN); /** coauthoring begin **/ - if (this.mode.canCoAuthoring) { + if (this.mode && this.mode.canCoAuthoring) { if (this.mode.canViewComments) { this.panelComments && this.panelComments['hide'](); if (this.btnComments.pressed) diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index b20f06eb34..4586169f4a 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1295,7 +1295,7 @@ define([ tab = $(e.currentTarget).find('> a[data-tab]').data('tab'), is_file_active = me.isTabActive('file'); - if (tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; + if (!me._isDocReady || tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments); @@ -1400,6 +1400,7 @@ define([ onAppReady: function (config) { var me = this; + me._isDocReady = true; if (!config.isEdit) return; if(me.btnPrint.menu) { diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index aca98ff218..1e50edb180 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1342,6 +1342,8 @@ "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "PE.Controllers.Main.textUpdating": "Updating", "PE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.
Trying to update file, please wait...", + "PE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings.", + "PE.Controllers.Main.titleUpdateVersion": "Version changed", "PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range", "PE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.", "PE.Controllers.Search.notcriticalErrorTitle": "Warning", diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 9ea135e09f..b9746280bc 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -203,13 +203,15 @@ define([ SetDisabled: function(disable, options) { if (this.leftMenu._state.disabled !== disable) { this.leftMenu._state.disabled = disable; - if (disable) { - this.previsEdit = this.mode.isEdit; - this.prevcanEdit = this.mode.canEdit; - this.mode.isEdit = this.mode.canEdit = !disable; - } else { - this.mode.isEdit = this.previsEdit; - this.mode.canEdit = this.prevcanEdit; + if (this.mode) { + if (disable) { + this.previsEdit = this.mode.isEdit; + this.prevcanEdit = this.mode.canEdit; + this.mode.isEdit = this.mode.canEdit = !disable; + } else { + this.mode.isEdit = this.previsEdit; + this.mode.canEdit = this.prevcanEdit; + } } } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index d3b522c142..0a475fd609 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -839,11 +839,11 @@ define([ if ( id == Asc.c_oAscAsyncAction['Disconnect']) { this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, 'reconnect'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('disconnect'); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); } else if (id === Asc.c_oAscAsyncAction['RefreshFile']) { this.disableEditing(false, 'refresh-file'); - this.getApplication().getController('Statusbar').hideDisconnectTip(); + Common.UI.TooltipManager.closeTip('refreshFile'); this.getApplication().getController('Statusbar').setStatusCaption(''); } }, @@ -930,7 +930,7 @@ define([ var me = this; statusCallback = function() { me._state.timerDisconnect = setTimeout(function(){ - me.getApplication().getController('Statusbar').showDisconnectTip(); + Common.UI.TooltipManager.showTip('disconnect'); }, me._state.unloadTimer || 0); }; break; @@ -940,7 +940,7 @@ define([ text = this.textUpdating; Common.UI.Menu.Manager.hideAll(); this.disableEditing(true, 'refresh-file'); - this.getApplication().getController('Statusbar').showDisconnectTip(this.textUpdateVersion); + Common.UI.TooltipManager.showTip('refreshFile'); break; default: @@ -1773,6 +1773,9 @@ define([ } else if (id === Asc.c_oAscError.ID.DocumentAndChangeMismatch) { this.getApplication().getController('Common.Controllers.History').onHashError(); return; + } else if (id === Asc.c_oAscError.ID.UpdateVersion) { + Common.UI.TooltipManager.showTip('updateVersion'); + return; } this.hidePreloader(); @@ -2081,10 +2084,10 @@ define([ config.msg = this.errorFileSizeExceed; break; - case Asc.c_oAscError.ID.UpdateVersion: - config.msg = this.errorUpdateVersionOnDisconnect; - config.maxwidth = 600; - break; + // case Asc.c_oAscError.ID.UpdateVersion: + // config.msg = this.errorUpdateVersionOnDisconnect; + // config.maxwidth = 600; + // break; case Asc.c_oAscError.ID.FTChangeTableRangeError: config.msg = this.errorFTChangeTableRangeError; @@ -2491,19 +2494,22 @@ define([ }, onUpdateVersion: function(callback) { + console.log("Obsolete: The 'onOutdatedVersion' event is deprecated. Please use 'onRequestRefreshFile' event and 'refreshFile' method instead."); + var me = this; me.needToUpdateVersion = true; me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); - Common.UI.warning({ - msg: this.errorUpdateVersion, + Common.UI.TooltipManager.showTip({ step: 'updateVersionReload', text: this.errorUpdateVersion, header: this.titleUpdateVersion, + target: '#toolbar', maxwidth: 'none', closable: false, automove: true, noHighlight: true, callback: function() { _.defer(function() { Common.Gateway.updateVersion(); if (callback) callback.call(me); me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); }) - } - }); + }}); + this.disableEditing(true, 'not-loaded'); + Common.NotificationCenter.trigger('api:disconnect'); }, onServerVersion: function(buildVersion) { diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index db4d4a6431..3e7f1d232f 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -267,10 +267,14 @@ define([ }, setMode: function(mode) { + var _main = this.getApplication().getController('Main'); this.mode = mode; this.toolbar.applyLayout(mode); Common.UI.TooltipManager.addTips({ - 'protectRange' : {name: 'sse-help-tip-protect-range', placement: 'bottom-left', text: this.helpProtectRange, header: this.helpProtectRangeHeader, target: '#slot-btn-protect-range', automove: true} + 'protectRange' : {name: 'sse-help-tip-protect-range', placement: 'bottom-left', text: this.helpProtectRange, header: this.helpProtectRangeHeader, target: '#slot-btn-protect-range', automove: true}, + 'refreshFile' : {text: _main.textUpdateVersion, header: _main.textUpdating, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'disconnect' : {text: _main.textConnectionLost, header: _main.textDisconnect, target: '#toolbar', maxwidth: 'none', showButton: false, automove: true, noHighlight: true, multiple: true}, + 'updateVersion' : {text: _main.errorUpdateVersionOnDisconnect, header: _main.titleUpdateVersion, target: '#toolbar', maxwidth: 600, showButton: false, automove: true, noHighlight: true, multiple: true} }); }, diff --git a/apps/spreadsheeteditor/main/app/view/LeftMenu.js b/apps/spreadsheeteditor/main/app/view/LeftMenu.js index 70db0cc771..91697d6b75 100644 --- a/apps/spreadsheeteditor/main/app/view/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/view/LeftMenu.js @@ -261,7 +261,7 @@ define([ if (!this._state.pluginIsRunning) this.$el.width(SCALE_MIN); /** coauthoring begin **/ - if (this.mode.canCoAuthoring) { + if (this.mode && this.mode.canCoAuthoring) { if (this.mode.canViewComments) { this.panelComments && this.panelComments['hide'](); if (this.btnComments.pressed) diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index f35e64157e..69c4d8dab6 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -2331,7 +2331,7 @@ define([ tab = $(e.currentTarget).find('> a[data-tab]').data('tab'), is_file_active = me.isTabActive('file'); - if (tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; + if (!me._isDocReady || tab === 'file' && !Common.Controllers.LaunchController.isScriptLoaded()) return; Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments); @@ -3285,7 +3285,7 @@ define([ if (!this.mode.isEdit || this.mode.isEditMailMerge || this.mode.isEditDiagram || this.mode.isEditOle) return; var me = this; - + me._isDocReady = true; if(me.btnPrint.menu) { me.btnPrint.setMenu( new Common.UI.Menu({ diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index cfd29d4117..432cf145f3 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1470,6 +1470,8 @@ "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.textUpdating": "Updating", "SSE.Controllers.Main.textUpdateVersion": "The document cannot be edited right now.
Trying to update file, please wait...", + "SSE.Controllers.Main.textConnectionLost": "Trying to connect. Please check connection settings.", + "SSE.Controllers.Main.titleUpdateVersion": "Version changed", "SSE.Controllers.PivotTable.strSheet": "Sheet", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column",