diff --git a/css/style.css b/css/style.css index 81c482639af760516455914969cde8b5de3d5fb0..1c8504213c6e7c1e0655bd90cd00b82d895789fa 100644 --- a/css/style.css +++ b/css/style.css @@ -1,7 +1,7 @@ .alert { position: relative; - padding: 0.75rem 1.25rem; margin-top: 1rem; + margin-bottom: 1rem; border: 1px solid transparent; border-radius: 0.25rem; width: fit-content; @@ -11,12 +11,14 @@ color: #155724; background-color: #d4edda; border-color: #c3e6cb; + padding: 0.75rem 1.25rem; } .alert-fail { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; + padding: 0.75rem 1.25rem; } #issue-submit-form #title, @@ -49,4 +51,18 @@ .color-red { color: red; -} \ No newline at end of file +} + +ul.beta-apps { + list-style: none; + margin-left: 0; + padding-left: 1em; +} + +ul.beta-apps > li:before { + display: inline-block; + content: '-'; + width: 1em; + margin-left: -1em; +} + diff --git a/l10n/de.js b/l10n/de.js index 42d4d0454e453c404c8ab85f2f1dc5a04b60da96..17cc4feb1003039ced73f9bac10fb575f1543900 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -32,6 +32,7 @@ OC.L10N.register( "Submit": "Einreichen", "Experimental": "Experimentelle", "Title is mandatory.": "Der Titel ist obligatorisch.", - "Description is mandatory.": "Die Beschreibung ist obligatorisch." + "Description is mandatory.": "Die Beschreibung ist obligatorisch.", + "Here is the list of currently available beta features:": "Hier ist die Liste der derzeit verfügbaren Beta-Funktionen:" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 878e48f34d9b9901ee9aa3bbe27268d3f059d875..a0cf4e193345ce461f5ae18b37d7e8551fe5775e 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -31,7 +31,8 @@ "Submit": "Einreichen", "Experimental": "Experimentelle", "Title is mandatory.": "Der Titel ist obligatorisch.", - "Description is mandatory.": "Die Beschreibung ist obligatorisch." + "Description is mandatory.": "Die Beschreibung ist obligatorisch.", + "Here is the list of currently available beta features:": "Hier ist die Liste der derzeit verfügbaren Beta-Funktionen:" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index 396618d698b252be8aa42f41301bfae32f3b0a2f..323d5a0d428d9555977331e1f839a5d599d8141a 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -32,6 +32,7 @@ OC.L10N.register( "Submit": "Submit", "Experimental": "Experimental", "Title is mandatory.": "Title is mandatory.", - "Description is mandatory.": "Description is mandatory." + "Description is mandatory.": "Description is mandatory.", + "Here is the list of currently available beta features:": "Here is the list of currently available beta features:" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index f07952bbfb10e55de43ed09ea68a556224b7f19d..f4232e511ca84b42af496d444bd89d17e45932ba 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -31,7 +31,8 @@ "Submit": "Submit", "Experimental": "Experimental", "Title is mandatory.": "Title is mandatory.", - "Description is mandatory.": "Description is mandatory." + "Description is mandatory.": "Description is mandatory.", + "Here is the list of currently available beta features:": "Here is the list of currently available beta features:" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index d5187361e920a53e16277d3fcfd810770095eceb..56a8a041757f186d8c7fa73678365cce4da4f485 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -33,6 +33,7 @@ OC.L10N.register( "Submit": "Envíe", "Experimental": "Experimento", "Title is mandatory.": "El título es obligatorio.", - "Description is mandatory.": "La descripción es obligatoria." + "Description is mandatory.": "La descripción es obligatoria.", + "Here is the list of currently available beta features:": "Esta es la lista de funciones de la versión beta disponibles actualmente:" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 68254b135df433a8098417cea520f19924808992..4db89166c3f5a533825dc0d2d45006ce0f7a4775 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -31,7 +31,8 @@ "Submit": "Envíe", "Experimental": "Experimento", "Title is mandatory.": "El título es obligatorio.", - "Description is mandatory.": "La descripción es obligatoria." + "Description is mandatory.": "La descripción es obligatoria.", + "Here is the list of currently available beta features:": "Esta es la lista de funciones de la versión beta disponibles actualmente:" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index ba3d7a762d347ed7ba9e578431d43e789505d5c1..6cbd03937bb190bcce3181020c83916dbb272770 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -32,6 +32,7 @@ OC.L10N.register( "Submit": "Soumettre", "Experimental": "Expérimental", "Title is mandatory.": "Le titre est obligatoire.", - "Description is mandatory.": "La description est obligatoire." + "Description is mandatory.": "La description est obligatoire.", + "Here is the list of currently available beta features:": "Voici la liste des fonctionnalités de la version bêta actuellement disponibles :" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 1a674afb0248dc15b0058190e0479c00e3cdeea4..a91d2a2dd2fa7dc7cf94124880d76999f4069b2c 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -31,7 +31,8 @@ "Submit": "Soumettre", "Experimental": "Expérimental", "Title is mandatory.": "Le titre est obligatoire.", - "Description is mandatory.": "La description est obligatoire." + "Description is mandatory.": "La description est obligatoire.", + "Here is the list of currently available beta features:": "Voici la liste des fonctionnalités de la version bêta actuellement disponibles :" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index dda11d0d3153387db8c557b4d16ec9fafdf59f77..8a53507aa0982658107e36aa50edab4ea95ba65c 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -32,6 +32,7 @@ OC.L10N.register( "Submit": "Invia", "Experimental": "Sperimentale", "Title is mandatory.": "Il titolo è obbligatorio.", - "Description is mandatory.": "La descrizione è obbligatoria." + "Description is mandatory.": "La descrizione è obbligatoria.", + "Here is the list of currently available beta features:": "Ecco l'elenco delle funzioni beta attualmente disponibili:" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index d92b0e3647ab0edafd5e68b7b4f5a438dcecfac3..257703bc9c17eb41f644bc33f30027455e1eda77 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -31,7 +31,8 @@ "Submit": "Invia", "Experimental": "Sperimentale", "Title is mandatory.": "Il titolo è obbligatorio.", - "Description is mandatory.": "La descrizione è obbligatoria." + "Description is mandatory.": "La descrizione è obbligatoria.", + "Here is the list of currently available beta features:": "Ecco l'elenco delle funzioni beta attualmente disponibili:" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/lib/Settings/BetaUserSetting.php b/lib/Settings/BetaUserSetting.php index cbb37c6508888dbc104682eec8fd0182fea8fffa..696d94337ea6a52d26b55ffa5bfd464233aa0465 100644 --- a/lib/Settings/BetaUserSetting.php +++ b/lib/Settings/BetaUserSetting.php @@ -10,6 +10,8 @@ use OCP\IUserSession; use OCP\Settings\ISettings; use OCP\Util; use OCP\IConfig; +use OCP\App\IAppManager; +use OCP\ILogger; class BetaUserSetting implements ISettings { /** @var IUserSession */ @@ -23,34 +25,60 @@ class BetaUserSetting implements ISettings { private $appName; + private $appManager; + + /** @var ILogger */ + private $logger; + public function __construct( $appName, IUserSession $userSession, IGroupManager $groupManager, Util $util, - IConfig $config + IConfig $config, + IAppManager $appManager, + ILogger $logger ) { $this->userSession = $userSession; $this->groupManager = $groupManager; $this->appName = $appName; $this->config = $config; $this->util = $util; + $this->appManager = $appManager; + $this->logger = $logger; } public function getForm(): TemplateResponse { $uid = $this->userSession->getUser()->getUID(); - $isBeta = 0; $betaGroupName = $this->config->getSystemValue("beta_group_name"); - $groupExists = $this->groupManager->groupExists($betaGroupName); - if ($groupExists) { - $isBeta = $this->groupManager->isInGroup($uid, $betaGroupName); - } $this->util->addScript($this->appName, $this->appName . '-beta-user-setting'); - $parameters = ['isBeta' => $isBeta, 'groupExists' => $groupExists]; - return new TemplateResponse($this->appName, 'beta_user_setting', $parameters, ''); + $group = $this->groupManager->get($betaGroupName); + $betaGroupApps = $this->appManager->getEnabledAppsForGroup($group); + $betaApps = []; + foreach ($betaGroupApps as $app) { + $appEnabledGroups = $this->config->getAppValue($app, 'enabled', 'no'); + if (str_contains($appEnabledGroups, $betaGroupName)) { + $info = $this->appManager->getAppInfo($app); + $betaApps[] = $info['name']; + } + } + if ($this->groupManager->isInGroup($uid, $betaGroupName)) { + return new TemplateResponse($this->appName, 'opt_out_beta_user', ['betaApps' => $betaApps], ''); + } + return new TemplateResponse($this->appName, 'become_beta_user', ['betaApps' => $betaApps], ''); } public function getSection(): ?string { + $betaGroupName = $this->config->getSystemValue("beta_group_name"); + if (empty($betaGroupName)) { + $this->logger->warning('Beta group name is not set in config.php', ['app' => 'ecloud-accounts']); + return null; + } + $groupExists = $this->groupManager->groupExists($betaGroupName); + if (! $groupExists) { + $this->logger->warning('Beta group does not exist!', ['app' => 'ecloud-accounts']); + return null; + } return 'beta-user'; } diff --git a/templates/become_beta_user.php b/templates/become_beta_user.php new file mode 100644 index 0000000000000000000000000000000000000000..6d9b82b011085a975217f7f7164bca8393c0fec2 --- /dev/null +++ b/templates/become_beta_user.php @@ -0,0 +1,28 @@ + + +
+
+
+

t('Do you want to become a beta user?')); ?>

+

t('You want to experiment new features ahead of the others and provide feedback on them before and if they\'re released? This section is made for you!')) ?>

+

t('To get a preview of our new features you need to become part of our beta users. To do so, simply click on the button below. You can opt out of beta features at anytime.')) ?>

+
+
+ + +
+
+
+
+

t('Here is the list of currently available beta features:')) ?>

+
    + +
  • + +
+
+
+
+
diff --git a/templates/beta_user_setting.php b/templates/beta_user_setting.php deleted file mode 100644 index 6fdb6b78dc410212dcbd10072bc2c31de1e629e1..0000000000000000000000000000000000000000 --- a/templates/beta_user_setting.php +++ /dev/null @@ -1,50 +0,0 @@ - - -
-
-
- - -

t('You are part of the beta users.')); ?>

-

- t('Note : as the features are not released yet, you may encounter some bugs. Please report them or give your feedback using the form below.')); ?> -

-
-

- -

-

- -

-

- -

-

- -

-

- -

-
-
-

t('Want to take a break from beta features? Just click on the button below. You can become a beta user again anytime!')) ?>

- -

t('Do you want to become a beta user?')); ?>

-

t('You want to experiment new features ahead of the others and provide feedback on them before and if they\'re released? This section is made for you!')) ?>

-

t('To get a preview of our new features you need to become part of our beta users. To do so, simply click on the button below. You can opt out of beta features at anytime.')) ?>

- -
-
- - -
-
-
- -

t('Beta program is not available at the moment.')); ?>

- -
-
-
diff --git a/templates/opt_out_beta_user.php b/templates/opt_out_beta_user.php new file mode 100644 index 0000000000000000000000000000000000000000..d77c76987d2b3b419322096561657c3ace9c5f7f --- /dev/null +++ b/templates/opt_out_beta_user.php @@ -0,0 +1,49 @@ + + +
+
+
+

t('You are part of the beta users.')); ?>

+

+ t('Note : as the features are not released yet, you may encounter some bugs. Please report them or give your feedback using the form below.')); ?> +

+
+

t('Here is the list of currently available beta features:')) ?>

+
    + +
  • + +
+
+
+

+ +

+

+ +

+

+ +

+

+ +

+

+ +

+
+
+

t('Want to take a break from beta features? Just click on the button below. You can become a beta user again anytime!')) ?>

+ +
+
+ + +
+
+
+
+
+