[SSE] Check insert hyperlink on protected sheet

This commit is contained in:
Julia Radzhabova 2021-07-19 23:50:45 +03:00
parent 3c09b6d325
commit 992b831a79
3 changed files with 57 additions and 3 deletions

View file

@ -569,6 +569,10 @@ define([
},
onInsHyperlink: function(item) {
Common.NotificationCenter.trigger('protect:check', this.onInsHyperlinkCallback, this, [item]);
},
onInsHyperlinkCallback: function(item) {
var me = this;
var win,
props;

View file

@ -209,7 +209,8 @@ define([
Common.NotificationCenter.on('download:cancel', _.bind(this.onDownloadCancel, this));
Common.NotificationCenter.on('download:advanced', _.bind(this.onAdvancedOptions, this));
Common.NotificationCenter.on('showmessage', _.bind(this.onExternalMessage, this));
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this));
Common.NotificationCenter.on('protect:check', _.bind(this.checkProtectedRange, this));
this.stackLongActions = new Common.IrregularStack({
strongCompare : this._compareActionStrong,
@ -1701,7 +1702,6 @@ define([
break;
}
if (level == Asc.c_oAscError.Level.Critical) {
Common.Gateway.reportError(id, config.msg);
@ -2064,6 +2064,51 @@ define([
}
},
checkProtectedRange: function(callback, scope, args) {
var result = this.api.asc_checkActiveCellProtectedRange();
if (result===null) {
this.onError(Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical);
return;
}
if (result) {
var me = this;
var win = new Common.Views.OpenDialog({
title: this.txtUnlockRange,
closable: true,
type: Common.Utils.importTextType.DRM,
warning: true,
warningMsg: this.txtUnlockRangeWarning,
txtOpenFile: this.txtUnlockRangeDescription,
validatePwd: false,
handler: function (result, value) {
if (result == 'ok') {
if (me.api) {
if (me.api.asc_checkActiveCellPassword(value.drmOptions.asc_getPassword())) {
callback && setTimeout(function() {
callback.apply(scope, args);
}, 1);
} else {
Common.UI.warning({
msg: me.errorWrongPassword,
callback: function() {
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
}
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
win.show();
} else {
callback && setTimeout(function() {
callback.apply(scope, args);
}, 1);
}
},
initNames: function() {
this.shapeGroupNames = [
this.txtBasicShapes,
@ -2982,7 +3027,8 @@ define([
txtUnlockRange: 'Unlock Range',
txtUnlockRangeWarning: 'A range you are trying to change is password protected.',
txtUnlockRangeDescription: 'Enter the password to change this range:',
txtUnlock: 'Unlock'
txtUnlock: 'Unlock',
errorWrongPassword: 'The password you supplied is not correct.'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -927,6 +927,10 @@ define([
},
onHyperlink: function(btn) {
Common.NotificationCenter.trigger('protect:check', this.onHyperlinkCallback, this, [btn]);
},
onHyperlinkCallback: function(btn) {
var me = this;
var win,
props;