Skip to content

Commit

Permalink
Change messages on update version events (not-modal windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Oct 2, 2024
1 parent 6ca40ad commit fd3c1a7
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 94 deletions.
16 changes: 9 additions & 7 deletions apps/documenteditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
16 changes: 0 additions & 16 deletions apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}
Expand Down Expand Up @@ -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;
Expand All @@ -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']:
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/view/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion apps/documenteditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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];
Expand Down
16 changes: 9 additions & 7 deletions apps/pdfeditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
31 changes: 18 additions & 13 deletions apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}

Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion apps/pdfeditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
});
},

Expand Down
2 changes: 1 addition & 1 deletion apps/pdfeditor/main/app/view/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion apps/pdfeditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1374,6 +1374,7 @@ define([

onAppReady: function (config) {
var me = this;
me._isDocReady = true;
(new Promise( function(resolve, reject) {
resolve();
})).then(function () {
Expand Down
1 change: 1 addition & 0 deletions apps/pdfeditor/main/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>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",
Expand Down
16 changes: 9 additions & 7 deletions apps/presentationeditor/main/app/controller/LeftMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
30 changes: 18 additions & 12 deletions apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}

Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit fd3c1a7

Please sign in to comment.