Add asc_onConfirmAction event

This commit is contained in:
Julia Radzhabova 2022-10-04 21:53:31 +03:00
parent 527633324b
commit c5ae22a932
6 changed files with 72 additions and 3 deletions

View file

@ -1219,6 +1219,7 @@ define([
me.api.asc_registerCallback('asc_onEndAction', _.bind(me.onLongActionEnd, me));
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_registerCallback('asc_onPrint', _.bind(me.onPrint, me));
me.api.asc_registerCallback('asc_onConfirmAction', _.bind(me.onConfirmAction, me));
appHeader.setDocumentCaption(me.api.asc_getDocumentName());
me.updateWindowTitle(true);
@ -2879,6 +2880,24 @@ define([
return true;
},
onConfirmAction: function(id, apiCallback, data) {
var me = this;
if (id == Asc.c_oAscConfirm.ConfirmMaxChangesSize) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: this.confirmMaxChangesSize,
buttons: [{value: 'ok', caption: this.textUndo, primary: true}, {value: 'cancel', caption: this.textContinue}],
maxwidth: 600,
callback: _.bind(function(btn) {
if (apiCallback) {
apiCallback(btn === 'ok');
}
me.onEditComplete();
}, this)
});
}
},
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@ -3257,7 +3276,10 @@ define([
errorNoTOC: 'There\'s no table of contents to update. You can insert one from the References tab.',
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?',
textRememberMacros: 'Remember my choice for all macros',
errorTextFormWrongFormat: 'The value entered does not match the format of the field.'
errorTextFormWrongFormat: 'The value entered does not match the format of the field.',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
}
})(), DE.Controllers.Main || {}))
});

View file

@ -935,6 +935,9 @@
"DE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"DE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"DE.Controllers.Main.textUndo": "Undo",
"DE.Controllers.Main.textContinue": "Continue",
"DE.Controllers.Navigation.txtBeginning": "Beginning of document",
"DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document",
"DE.Controllers.Search.notcriticalErrorTitle": "Warning",

View file

@ -844,6 +844,7 @@ define([
me.api.asc_registerCallback('asc_onEndAction', _.bind(me.onLongActionEnd, me));
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
me.api.asc_registerCallback('asc_onPrint', _.bind(me.onPrint, me));
me.api.asc_registerCallback('asc_onConfirmAction', _.bind(me.onConfirmAction, me));
appHeader.setDocumentCaption( me.api.asc_getDocumentName() );
me.updateWindowTitle(true);
@ -2610,6 +2611,24 @@ define([
})
},
onConfirmAction: function(id, apiCallback, data) {
var me = this;
if (id == Asc.c_oAscConfirm.ConfirmMaxChangesSize) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: this.confirmMaxChangesSize,
buttons: [{value: 'ok', caption: this.textUndo, primary: true}, {value: 'cancel', caption: this.textContinue}],
maxwidth: 600,
callback: _.bind(function(btn) {
if (apiCallback) {
apiCallback(btn === 'ok');
}
me.onEditComplete();
}, this)
});
}
},
// Translation
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
criticalErrorTitle: 'Error',
@ -2983,7 +3002,10 @@ define([
textLearnMore: 'Learn More',
textReconnect: 'Connection is restored',
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?',
textRememberMacros: 'Remember my choice for all macros'
textRememberMacros: 'Remember my choice for all macros',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
}
})(), PE.Controllers.Main || {}))
});

View file

@ -1007,6 +1007,9 @@
"PE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"PE.Controllers.Main.textUndo": "Undo",
"PE.Controllers.Main.textContinue": "Continue",
"PE.Controllers.Search.notcriticalErrorTitle": "Warning",
"PE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
"PE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",

View file

@ -2363,6 +2363,19 @@ define([
}
});
win.show();
} else if (id == Asc.c_oAscConfirm.ConfirmMaxChangesSize) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg: this.confirmMaxChangesSize,
buttons: [{value: 'ok', caption: this.textUndo, primary: true}, {value: 'cancel', caption: this.textContinue}],
maxwidth: 600,
callback: _.bind(function(btn) {
if (apiCallback) {
apiCallback(btn === 'ok');
}
me.onEditComplete(me.application.getController('DocumentHolder').getView('DocumentHolder'));
}, this)
});
}
},
@ -3637,7 +3650,10 @@ define([
textReconnect: 'Connection is restored',
errorCannotUseCommandProtectedSheet: 'You cannot use this command on a protected sheet. To use this command, unprotect the sheet.<br>You might be requested to enter a password.',
textRequestMacros: 'A macro makes a request to URL. Do you want to allow the request to the %1?',
textRememberMacros: 'Remember my choice for all macros'
textRememberMacros: 'Remember my choice for all macros',
confirmMaxChangesSize: 'The size of actions exceeds the limitation set for your server.<br>Press "Undo" to cancel your last action or press "Continue" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).',
textUndo: 'Undo',
textContinue: 'Continue'
}
})(), SSE.Controllers.Main || {}))
});

View file

@ -1120,6 +1120,9 @@
"SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.<br>Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.confirmMaxChangesSize": "The size of actions exceeds the limitation set for your server.<br>Press \"Undo\" to cancel your last action or press \"Continue\" to keep action locally (you need to download the file or copy its content to make sure nothing is lost).",
"SSE.Controllers.Main.textUndo": "Undo",
"SSE.Controllers.Main.textContinue": "Continue",
"SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row",