diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js
index 21fe1e65d..57fab51b9 100644
--- a/apps/api/documents/api.js
+++ b/apps/api/documents/api.js
@@ -137,7 +137,7 @@
mentionShare : true // customize tooltip for mention,
macros: true // can run macros in document
plugins: true // can run plugins in document
- showMacrosWarning: true // warn about automatic macros
+ macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn'
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 25ef20ec5..0ce06a80a 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -384,6 +384,14 @@ define([
$('#editor-container').append('
');
}
+ var value = Common.localStorage.getItem("de-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-macros-mode", value);
+
Common.Controllers.Desktop.init(this.appOptions);
},
@@ -2246,29 +2254,30 @@ define([
var me = this,
enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false);
if (enable) {
- if (!this.editorConfig.customization || (this.editorConfig.customization.showMacrosWarning!==false)) {
- var value = Common.localStorage.getItem("de-macros-start");
- if (value===null) {
- Common.UI.warning({
- msg: this.textHasMacros + '
',
- buttons: ['yes', 'no'],
- primary: 'yes',
- dontshow: true,
- textDontShow: this.textRemember,
- callback: function(btn, dontshow){
- if (dontshow)
- Common.localStorage.setItem("de-macros-start", (btn == 'yes') ? 1 : 0);
- if (btn == 'yes') {
- setTimeout(function() {
- me.api.asc_runAutostartMacroses();
- }, 1);
- }
- }
- });
- } else if (parseInt(value)==1)
- this.api.asc_runAutostartMacroses();
- } else
+ var value = Common.Utils.InternalSettings.get("de-macros-mode");
+ if (value==1)
this.api.asc_runAutostartMacroses();
+ else if (value === 0) {
+ Common.UI.warning({
+ msg: this.textHasMacros + '
',
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ dontshow: true,
+ textDontShow: this.textRemember,
+ callback: function(btn, dontshow){
+ if (dontshow) {
+ Common.Utils.InternalSettings.set("de-macros-mode", (btn == 'yes') ? 1 : 2);
+ Common.localStorage.setItem("de-macros-mode", (btn == 'yes') ? 1 : 2);
+ }
+ if (btn == 'yes') {
+ setTimeout(function() {
+ me.api.asc_runAutostartMacroses();
+ }, 1);
+ }
+ }
+ });
+
+ }
}
},
diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js
index dc049fcd0..116bbb5f2 100644
--- a/apps/documenteditor/main/app/view/FileMenuPanels.js
+++ b/apps/documenteditor/main/app/view/FileMenuPanels.js
@@ -234,6 +234,12 @@ define([
' | ',
' | ',
'','
',
+ '',
+ ' | ',
+ '',
+ '',
+ ' | ',
+ '
','
',
'',
' | ',
' | ',
@@ -388,6 +394,21 @@ define([
]
});
+ this.cmbMacros = new Common.UI.ComboBox({
+ el : $markup.findById('#fms-cmb-macros'),
+ style : 'width: 160px;',
+ editable : false,
+ cls : 'input-group-nr',
+ data : [
+ { value: 2, displayValue: this.txtStopMacros, descValue: this.txtStopMacrosDesc },
+ { value: 0, displayValue: this.txtWarnMacros, descValue: this.txtWarnMacrosDesc },
+ { value: 1, displayValue: this.txtRunMacros, descValue: this.txtRunMacrosDesc }
+ ]
+ }).on('selected', function(combo, record) {
+ me.lblMacrosDesc.text(record.descValue);
+ });
+ this.lblMacrosDesc = $markup.findById('#fms-lbl-macros');
+
this.btnApply = new Common.UI.Button({
el: $markup.findById('#fms-btn-apply')
});
@@ -425,6 +446,8 @@ define([
$('tr.coauth.changes', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring ? 'show' : 'hide']();
$('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide']();
/** coauthoring end **/
+
+ $('tr.macros', this.el)[(mode.customization && mode.customization.macros===false) ? 'hide' : 'show']();
},
updateSettings: function() {
@@ -475,6 +498,10 @@ define([
this.chSpell.setValue(Common.Utils.InternalSettings.get("de-settings-spellcheck"));
this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("de-settings-showsnaplines"));
this.chCompatible.setValue(Common.Utils.InternalSettings.get("de-settings-compatible"));
+
+ item = this.cmbMacros.store.findWhere({value: Common.Utils.InternalSettings.get("de-macros-mode")});
+ this.cmbMacros.setValue(item ? item.get('value') : 0);
+ this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc);
},
applySettings: function() {
@@ -501,6 +528,10 @@ define([
Common.localStorage.setItem("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-compatible", this.chCompatible.isChecked() ? 1 : 0);
Common.Utils.InternalSettings.set("de-settings-showsnaplines", this.chAlignGuides.isChecked());
+
+ Common.localStorage.setItem("de-macros-mode", this.cmbMacros.getValue());
+ Common.Utils.InternalSettings.set("de-macros-mode", Common.localStorage.getItem("de-macros-mode"));
+
Common.localStorage.save();
if (this.menu) {
@@ -575,7 +606,14 @@ define([
strResolvedComment: 'Turn on display of the resolved comments',
textCompatible: 'Compatibility',
textOldVersions: 'Make the files compatible with older MS Word versions when saved as DOCX',
- txtCacheMode: 'Default cache mode'
+ txtCacheMode: 'Default cache mode',
+ strMacrosSettings: 'Macros Settings',
+ txtWarnMacros: 'Show Notification',
+ txtRunMacros: 'Enable All',
+ txtStopMacros: 'Disable All',
+ txtWarnMacrosDesc: 'Disable all macros with notification',
+ txtRunMacrosDesc: 'Enable all macros without notification',
+ txtStopMacrosDesc: 'Disable all macros without notification'
}, DE.Views.FileMenuPanels.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({