[Mobile] Show warning about macros

This commit is contained in:
Julia Radzhabova 2020-06-01 17:55:54 +03:00
parent 5112041426
commit cf42d66e5b
3 changed files with 165 additions and 9 deletions

View file

@ -224,6 +224,14 @@ define([
if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo))
$('#editor-container').append('<div class="doc-placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div>'); $('#editor-container').append('<div class="doc-placeholder"><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"></div></div>');
var value = Common.localStorage.getItem("de-mobile-macros-mode");
if (value === null) {
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
} else
value = parseInt(value);
Common.Utils.InternalSettings.set("de-mobile-macros-mode", value);
// if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
// Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
}, },
@ -1376,8 +1384,48 @@ define([
}, },
onRunAutostartMacroses: function() { onRunAutostartMacroses: function() {
if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) var me = this,
if (this.api) this.api.asc_runAutostartMacroses(); enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
if (enable) {
var value = Common.Utils.InternalSettings.get("de-mobile-macros-mode");
if (value==1)
this.api.asc_runAutostartMacroses();
else if (value === 0) {
uiApp.modal({
title: this.notcriticalErrorTitle,
text: this.textHasMacros,
afterText: '<label class="label-checkbox item-content no-ripple">' +
'<input type="checkbox" name="checkbox-show-macros">' +
'<div class="item-media" style="margin-top: 10px; display: flex; align-items: center;">' +
'<i class="icon icon-form-checkbox"></i><span style="margin-left: 10px;">' + this.textRemember + '</span>' +
'</div>' +
'</label>',
buttons: [{
text: this.textYes,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("de-mobile-macros-mode", 1);
Common.localStorage.setItem("de-mobile-macros-mode", 1);
}
setTimeout(function() {
me.api.asc_runAutostartMacroses();
}, 1);
}
},
{
text: this.textNo,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("de-mobile-macros-mode", 2);
Common.localStorage.setItem("de-mobile-macros-mode", 2);
}
}
}]
});
}
}
}, },
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
@ -1507,7 +1555,11 @@ define([
waitText: 'Please, wait...', waitText: 'Please, wait...',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.',
textHasMacros: 'The file contains automatic macros.<br>Do you want to run macros?',
textRemember: 'Remember my choice',
textYes: 'Yes',
textNo: 'No'
} }
})(), DE.Controllers.Main || {})) })(), DE.Controllers.Main || {}))
}); });

View file

@ -227,6 +227,14 @@ define([
if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo))
$('#editor_sdk').append('<div class="doc-placeholder"><div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div></div>'); $('#editor_sdk').append('<div class="doc-placeholder"><div class="slide-h"><div class="slide-v"><div class="slide-container"><div class="line"></div><div class="line empty"></div><div class="line"></div></div></div></div></div>');
var value = Common.localStorage.getItem("pe-mobile-macros-mode");
if (value === null) {
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
} else
value = parseInt(value);
Common.Utils.InternalSettings.set("pe-mobile-macros-mode", value);
// if (this.appOptions.location == 'us' || this.appOptions.location == 'ca') // if (this.appOptions.location == 'us' || this.appOptions.location == 'ca')
// Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch); // Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch);
}, },
@ -1285,8 +1293,48 @@ define([
}, },
onRunAutostartMacroses: function() { onRunAutostartMacroses: function() {
if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) var me = this,
if (this.api) this.api.asc_runAutostartMacroses(); enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
if (enable) {
var value = Common.Utils.InternalSettings.get("pe-mobile-macros-mode");
if (value==1)
this.api.asc_runAutostartMacroses();
else if (value === 0) {
uiApp.modal({
title: this.notcriticalErrorTitle,
text: this.textHasMacros,
afterText: '<label class="label-checkbox item-content no-ripple">' +
'<input type="checkbox" name="checkbox-show-macros">' +
'<div class="item-media" style="margin-top: 10px; display: flex; align-items: center;">' +
'<i class="icon icon-form-checkbox"></i><span style="margin-left: 10px;">' + this.textRemember + '</span>' +
'</div>' +
'</label>',
buttons: [{
text: this.textYes,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("pe-mobile-macros-mode", 1);
Common.localStorage.setItem("pe-mobile-macros-mode", 1);
}
setTimeout(function() {
me.api.asc_runAutostartMacroses();
}, 1);
}
},
{
text: this.textNo,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("pe-mobile-macros-mode", 2);
Common.localStorage.setItem("pe-mobile-macros-mode", 2);
}
}
}]
});
}
}
}, },
// Translation // Translation
@ -1453,7 +1501,11 @@ define([
waitText: 'Please, wait...', waitText: 'Please, wait...',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.',
textHasMacros: 'The file contains automatic macros.<br>Do you want to run macros?',
textRemember: 'Remember my choice',
textYes: 'Yes',
textNo: 'No'
} }
})(), PE.Controllers.Main || {})) })(), PE.Controllers.Main || {}))
}); });

View file

@ -243,6 +243,14 @@ define([
if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo)) if (!me.editorConfig.customization || !(me.editorConfig.customization.loaderName || me.editorConfig.customization.loaderLogo))
$('#editor_sdk').append('<div class="doc-placeholder">' + '<div class="columns"></div>'.repeat(2) + '</div>'); $('#editor_sdk').append('<div class="doc-placeholder">' + '<div class="columns"></div>'.repeat(2) + '</div>');
var value = Common.localStorage.getItem("sse-mobile-macros-mode");
if (value === null) {
value = this.editorConfig.customization ? this.editorConfig.customization.macrosMode : 'warn';
value = (value == 'enable') ? 1 : (value == 'disable' ? 2 : 0);
} else
value = parseInt(value);
Common.Utils.InternalSettings.set("sse-mobile-macros-mode", value);
}, },
loadDocument: function(data) { loadDocument: function(data) {
@ -1490,8 +1498,48 @@ define([
}, },
onRunAutostartMacroses: function() { onRunAutostartMacroses: function() {
if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) var me = this,
if (this.api) this.api.asc_runAutostartMacroses(); enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
if (enable) {
var value = Common.Utils.InternalSettings.get("sse-mobile-macros-mode");
if (value==1)
this.api.asc_runAutostartMacroses();
else if (value === 0) {
uiApp.modal({
title: this.notcriticalErrorTitle,
text: this.textHasMacros,
afterText: '<label class="label-checkbox item-content no-ripple">' +
'<input type="checkbox" name="checkbox-show-macros">' +
'<div class="item-media" style="margin-top: 10px; display: flex; align-items: center;">' +
'<i class="icon icon-form-checkbox"></i><span style="margin-left: 10px;">' + this.textRemember + '</span>' +
'</div>' +
'</label>',
buttons: [{
text: this.textYes,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("sse-mobile-macros-mode", 1);
Common.localStorage.setItem("sse-mobile-macros-mode", 1);
}
setTimeout(function() {
me.api.asc_runAutostartMacroses();
}, 1);
}
},
{
text: this.textNo,
onClick: function () {
var dontshow = $('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
Common.Utils.InternalSettings.set("sse-mobile-macros-mode", 2);
Common.localStorage.setItem("sse-mobile-macros-mode", 2);
}
}
}]
});
}
}
}, },
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.', leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
@ -1677,7 +1725,11 @@ define([
waitText: 'Please, wait...', waitText: 'Please, wait...',
errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.<br>Please contact your Document Server administrator for details.',
errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.', errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.<br>Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.',
errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.' errorOpensource: 'Files can be opened for viewing only. Mobile web editors are not available in the Open Source version.',
textHasMacros: 'The file contains automatic macros.<br>Do you want to run macros?',
textRemember: 'Remember my choice',
textYes: 'Yes',
textNo: 'No'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });