Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2022-03-03 13:20:20 +0300
committerGitHub <noreply@github.com>2022-03-03 13:20:20 +0300
commit2c8be4f716f65a65527b1377a66bac83facd05b4 (patch)
tree07df92ab430ffd413c776c4396b380d52f6d3854
parent601eae53be15b223e8ecc2fd7a03e0c0ea82b1ed (diff)
parentd7829da6887d7e72f66f029581cc944331b9e07a (diff)
Merge pull request #595 from coffeemakr/masterfeature/disable-macros
Add option to disable macros
-rw-r--r--controller/editorapicontroller.php5
-rw-r--r--controller/settingscontroller.php4
-rw-r--r--js/settings.js2
-rw-r--r--lib/appconfig.php26
-rw-r--r--templates/settings.php6
5 files changed, 43 insertions, 0 deletions
diff --git a/controller/editorapicontroller.php b/controller/editorapicontroller.php
index 7ed5323..2f87b18 100644
--- a/controller/editorapicontroller.php
+++ b/controller/editorapicontroller.php
@@ -646,6 +646,11 @@ class EditorApiController extends OCSController {
$params["editorConfig"]["customization"]["toolbarNoTabs"] = true;
}
+ //default is true
+ if($this->config->GetCustomizationMacros() === false) {
+ $params["editorConfig"]["customization"]["macros"] = false;
+ }
+
/* from system config */
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php
index 6f82553..adc6fe8 100644
--- a/controller/settingscontroller.php
+++ b/controller/settingscontroller.php
@@ -126,6 +126,7 @@ class SettingsController extends Controller {
"toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(),
"successful" => $this->config->SettingsAreSuccessful(),
"watermark" => $this->config->GetWatermarkSettings(),
+ "macros" => $this->config->GetCustomizationMacros(),
"tagsEnabled" => App::isEnabled("systemtags"),
"reviewDisplay" => $this->config->GetCustomizationReviewDisplay(),
"templates" => $this->GetGlobalTemplates()
@@ -200,6 +201,7 @@ class SettingsController extends Controller {
* @param bool $forcesave - forcesave
* @param bool $help - display help
* @param bool $toolbarNoTabs - display toolbar tab
+ * @param bool $macros - run document macros
* @param string $reviewDisplay - review viewing mode
*
* @return array
@@ -216,6 +218,7 @@ class SettingsController extends Controller {
$forcesave,
$help,
$toolbarNoTabs,
+ $macros,
$reviewDisplay
) {
@@ -231,6 +234,7 @@ class SettingsController extends Controller {
$this->config->SetCustomizationForcesave($forcesave);
$this->config->SetCustomizationHelp($help);
$this->config->SetCustomizationToolbarNoTabs($toolbarNoTabs);
+ $this->config->SetCustomizationMacros($macros);
$this->config->SetCustomizationReviewDisplay($reviewDisplay);
return [
diff --git a/js/settings.js b/js/settings.js
index f8d3d42..c607d08 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -202,6 +202,7 @@
var forcesave = $("#onlyofficeForcesave").is(":checked");
var help = $("#onlyofficeHelp").is(":checked");
var toolbarNoTabs = $("#onlyofficeToolbarNoTabs").is(":checked");
+ var macros = $("#onlyofficeMacros").is(":checked");
var reviewDisplay = $("input[type='radio'][name='reviewDisplay']:checked").attr("id").replace("onlyofficeReviewDisplay_", "");
$.ajax({
@@ -220,6 +221,7 @@
forcesave: forcesave,
help: help,
toolbarNoTabs: toolbarNoTabs,
+ macros: macros,
reviewDisplay: reviewDisplay
},
success: function onSuccess(response) {
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 620c4ca..aeaf43e 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -278,6 +278,13 @@ class AppConfig {
public $_customization_goback = "customization_goback";
/**
+ * The config key for the macros
+ *
+ * @var string
+ */
+ public $_customizationMacros = "customization_macros";
+
+ /**
* @param string $AppName - application name
*/
public function __construct($AppName) {
@@ -1090,6 +1097,25 @@ class AppConfig {
return $result;
}
+ /**
+ * Save macros setting
+ *
+ * @param bool $value - enable macros
+ */
+ public function SetCustomizationMacros($value) {
+ $this->logger->info("Set macros enabled: " . json_encode($value), ["app" => $this->appName]);
+
+ $this->config->setAppValue($this->appName, $this->_customizationMacros, json_encode($value));
+ }
+
+ /**
+ * Get macros setting
+ *
+ * @return bool
+ */
+ public function GetCustomizationMacros() {
+ return $this->config->getAppValue($this->appName, $this->_customizationMacros, "true") === "true";
+ }
/**
* Additional data about formats
diff --git a/templates/settings.php b/templates/settings.php
index 2b9caae..86b0c7f 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -199,6 +199,12 @@
<label for="onlyofficeToolbarNoTabs"><?php p($l->t("Display monochrome toolbar header")) ?></label>
</p>
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeMacros"
+ <?php if ($_["macros"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeMacros"><?php p($l->t("Run document macros")) ?></label>
+ </p>
+
<p class="onlyoffice-header">
<?php p($l->t("Review mode for viewing")) ?>
</p>