From 80700cac326ecdfa613cc9ace40ba9b6853345f0 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Mon, 19 Oct 2020 13:44:07 +0200 Subject: [PATCH] add option: the menu is enabled by default for users --- lib/AppInfo/Application.php | 11 ++++++++++- lib/Settings/Admin.php | 1 + lib/Settings/Personal.php | 6 +++++- src/l10n/fixtures/de.yaml | 2 ++ src/l10n/fixtures/fr.yaml | 2 ++ templates/settings/admin-form.php | 18 ++++++++++++++++++ 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index a207681..aa89d0c 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -58,7 +58,16 @@ class Application extends App $isForced = (bool) $this->config->getAppValue(self::APP_ID, 'force', '0'); if (null !== $this->user && !$isForced) { - $enabled = (bool) $this->config->getUserValue($this->user->getUid(), self::APP_ID, 'enabled', '1'); + $enabled = (bool) $this->config->getUserValue( + $this->user->getUid(), + self::APP_ID, + 'enabled', + $this->config->getAppValue( + self::APP_ID, + 'default-enabled', + '1' + ) + ); } return $enabled; diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 75cf96e..b7a6769 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -89,6 +89,7 @@ class Admin implements ISettings 'force' => $this->config->getAppValue('force', '0'), 'target-blank-apps' => $this->config->getAppValueArray('target-blank-apps', '[]'), 'top-menu-apps' => $this->config->getAppValueArray('top-menu-apps', '[]'), + 'default-enabled' => $this->config->getAppValue('default-enabled', '1'), 'apps' => $this->appRepository->getVisibleApps(), ]; diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index ac8ac1a..2b34bb2 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -72,7 +72,11 @@ class Personal implements ISettings $parameters = [ 'force' => $this->config->getAppValueBool('force', '0'), - 'enabled' => $this->config->getUserValue($user, 'enabled', '1'), + 'enabled' => $this->config->getUserValue( + $user, + 'enabled', + $this->config->getAppValue('default-enabled', '1') + ), 'top-menu-apps' => $this->config->getUserValueArray($user, 'top-menu-apps', '[]'), 'target-blank-mode' => $this->config->getUserValue($user, 'target-blank-mode', '1'), 'target-blank-apps' => $this->config->getUserValueArray($user, 'target-blank-apps', '[]'), diff --git a/src/l10n/fixtures/de.yaml b/src/l10n/fixtures/de.yaml index 305598f..d16790c 100644 --- a/src/l10n/fixtures/de.yaml +++ b/src/l10n/fixtures/de.yaml @@ -62,3 +62,5 @@ "Export the configuration": "Exportieren Sie die Konfiguration" "Purge the cache": "Leeren Sie den Cache" "Show the link to settings": "Zeigen Sie den Link zu den Einstellungen an" +"The menu is enabled by default for users": "Das Menü ist standardmäßig für Benutzer aktiviert" +"Except when the configuration is forced.": "Außer wenn die Konfiguration erzwungen wird." diff --git a/src/l10n/fixtures/fr.yaml b/src/l10n/fixtures/fr.yaml index 646b8b2..1a026d9 100644 --- a/src/l10n/fixtures/fr.yaml +++ b/src/l10n/fixtures/fr.yaml @@ -62,3 +62,5 @@ "Export the configuration": "Exporter la configuration" "Purge the cache": "Purger le cache" "Show the link to settings": "Afficher le lien vers les paramètres" +"The menu is enabled by default for users": "Le menu est activé par défaut pour les utilisateurs" +"Except when the configuration is forced.": "Sauf lorsque la configuration est forcée." diff --git a/templates/settings/admin-form.php b/templates/settings/admin-form.php index c76be02..3f84084 100644 --- a/templates/settings/admin-form.php +++ b/templates/settings/admin-form.php @@ -496,11 +496,29 @@ $choicesSizes = [
+
+ + +

t('Except when the configuration is forced.')); ?>

+ + +
+
+
+