diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dffaf7..ae81a08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,17 @@ ## [Unreleased] +## 3.3.0 +### Added +* add documentation in admin page +* add app sorter in user config side (#160) +### Fixed +* fix #164: open apps in new tab does not work +* fix #162 #159: top and side apps does work correctly + ## 3.2.1 ### Fixed -* fix #150: Active app is not visible has active in menu (except in default menu) -* fix #150: opener position +* fix #150: active app is not visible has active in menu (except in default menu) +* fix #151: opener position ## 3.2.0 ### Added diff --git a/appinfo/info.xml b/appinfo/info.xml index 6e60309..b78caea 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -32,7 +32,7 @@ Notice Because I believe in a free and decentralized Internet, [Gitnet](https://gitnet.fr) is **self-hosted at home**. In case of downtime, you can download **Custom Menu** from [here](https://kim.deblan.fr/~side_menu/). ]]> - 3.2.1 + 3.3.0 agpl Simon Vieille SideMenu diff --git a/css/admin.css b/css/admin.css index 086d0d7..5332c4e 100644 --- a/css/admin.css +++ b/css/admin.css @@ -73,7 +73,7 @@ .side-menu-setting-list { margin: 10px 4px 4px 0px; - border: 1px solid var(--color-border-dark); + border: 2px solid var(--color-border-dark); border-radius: 15px; } @@ -175,3 +175,42 @@ .btn-reset--progress { transform: rotate(-359deg); } + +.badges { + margin-bottom: 14px; + margin-top: 4px; +} + +.badge { + border-size: 1px; + padding: 2px 8px; + margin-right: 2px; + margin-bottom: 5px; + display: inline-block; + border-radius: 4px; + font-size: 13px; +} + +.badge-1 { + background: #d4ce14; + border-color: #cad413; + color: #373a05; +} + +.badge-2 { + background: #96d47f; + border-color: #7ed49b; + color: #333; +} + +.badge-3 { + background: #d4540a; + border-color: #d4700c; + color: #fff; +} + +.badge-4 { + background: #9d81d4; + border-color: #c681d4; + color: #fff; +} diff --git a/lib/Controller/JsController.php b/lib/Controller/JsController.php index 32cd630..c0831a9 100644 --- a/lib/Controller/JsController.php +++ b/lib/Controller/JsController.php @@ -100,10 +100,12 @@ class JsController extends Controller $useAvatar = $this->config->getAppValueBool('use-avatar', '0'); $isForced = $this->config->getAppValueBool('force', '0'); $addLogoLink = $this->config->getAppValueBool('add-logo-link', '1'); + $appsOrder = $this->config->getAppValueArray('apps-order', '[]'); $avatar = null; $settings = null; if ($this->user) { + $userAppsOrder = $this->config->getUserValueArray($this->user, 'apps-order', '[]'); $userTopMenuApps = $this->config->getUserValueArray($this->user, 'top-menu-apps', '[]'); $userTopSideMenuApps = $this->config->getUserValueArray($this->user, 'top-side-menu-apps', '[]'); @@ -115,6 +117,10 @@ class JsController extends Controller $topSideMenuApps = $userTopSideMenuApps; } + if (!empty($userAppsOrder) && !$isForced) { + $appsOrder = $userAppsOrder; + } + $userTargetBlankMode = $this->config->getUserValueInt($this->user, 'target-blank-mode', '1'); $userTargetBlankApps = $this->config->getUserValueArray($this->user, 'target-blank-apps', '[]'); @@ -162,7 +168,7 @@ class JsController extends Controller 'side-with-categories' => $this->config->getAppValueBool('side-with-categories', '0'), 'big-menu' => $this->config->getAppValueBool('big-menu', '0'), 'big-menu-hidden-apps' => $this->config->getAppValueArray('big-menu-hidden-apps', '[]'), - 'apps-order' => $this->config->getAppValueArray('apps-order', '[]'), + 'apps-order' => $appsOrder, 'avatar' => $avatar, 'top-menu-apps' => $topMenuApps, 'top-side-menu-apps' => $topSideMenuApps, diff --git a/lib/Controller/NavController.php b/lib/Controller/NavController.php index ac766a5..a461ce3 100644 --- a/lib/Controller/NavController.php +++ b/lib/Controller/NavController.php @@ -93,11 +93,13 @@ class NavController extends Controller ]); } - $apps = $this->appRepository->getOrderedApps(); + $apps = $this->appRepository->getOrderedApps($user); $categoriesLabels = $this->categoryRepository->getOrderedCategories(); $hiddenApps = $this->config->getAppValueArray('big-menu-hidden-apps', '[]'); $isForced = $this->config->getAppValueBool('force', '0'); $topMenuApps = $this->config->getAppValueArray('top-menu-apps', '[]'); + $topSideMenuApps = $this->config->getAppValueArray('top-side-menu-apps', '[]'); + $userTopSideMenuApps = $this->config->getUserValueArray($user, 'top-side-menu-apps', '[]'); $userTopMenuApps = $this->config->getUserValueArray($user, 'top-menu-apps', '[]'); $appsCategories = []; $categoriesAppsCount = []; @@ -106,8 +108,12 @@ class NavController extends Controller $topMenuApps = $userTopMenuApps; } + if (!$isForced && !empty($userTopSideMenuApps)) { + $topSideMenuApps = $userTopSideMenuApps; + } + foreach ($apps as $app) { - if (in_array($app['id'], $topMenuApps)) { + if (in_array($app['id'], $topMenuApps) && !in_array($app['id'], $userTopSideMenuApps)) { continue; } diff --git a/lib/Controller/PersonalSettingController.php b/lib/Controller/PersonalSettingController.php index bdc9fca..6f126c7 100644 --- a/lib/Controller/PersonalSettingController.php +++ b/lib/Controller/PersonalSettingController.php @@ -97,7 +97,7 @@ class PersonalSettingController extends Controller } } - if (in_array($name, ['top-menu-apps', 'top-side-menu-apps'])) { + if (in_array($name, ['top-menu-apps', 'top-side-menu-apps', 'apps-order'])) { $doSave = true; $data = json_decode($value, true); diff --git a/lib/Service/AppRepository.php b/lib/Service/AppRepository.php index 2ae59d5..ce96107 100644 --- a/lib/Service/AppRepository.php +++ b/lib/Service/AppRepository.php @@ -2,6 +2,7 @@ namespace OCA\SideMenu\Service; +use OC\User\User; use OCP\L10N\IFactory; /** @@ -110,11 +111,19 @@ class AppRepository ); } - public function getOrderedApps() + public function getOrderedApps(?User $user = null) { $apps = $this->getVisibleApps(); $orders = $this->config->getAppValueArray('apps-order', '[]'); + if (null !== $user && !$this->config->getAppValueBool('force', '0')) { + $userOrders = $this->config->getUserValueArray($user, 'apps-order', '[]'); + + if (!empty($userOrders)) { + $orders = $userOrders; + } + } + usort($apps, function ($a, $b) use ($orders) { $ak = array_keys($orders, $a['id'])[0] ?? null; $bk = array_keys($orders, $b['id'])[0] ?? null; diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php index 9ac24c7..e61f9e5 100644 --- a/lib/Settings/Personal.php +++ b/lib/Settings/Personal.php @@ -81,7 +81,9 @@ class Personal implements ISettings 'top-side-menu-apps' => $this->config->getUserValueArray($user, 'top-side-menu-apps', '[]'), 'target-blank-mode' => $this->config->getUserValue($user, 'target-blank-mode', '1'), 'target-blank-apps' => $this->config->getUserValueArray($user, 'target-blank-apps', '[]'), + 'apps-order' => $this->config->getUserValueArray($user, 'apps-order', '[]'), 'apps' => $this->appRepository->getVisibleApps(), + 'ordered-apps' => $this->appRepository->getOrderedApps($user), ]; return new TemplateResponse(Application::APP_ID, 'settings/personal-form', $parameters, ''); diff --git a/screenshots/admin_settings.png b/screenshots/admin_settings.png index ba7a744..4d7a0e0 100644 Binary files a/screenshots/admin_settings.png and b/screenshots/admin_settings.png differ diff --git a/screenshots/personal_settings.png b/screenshots/personal_settings.png index ba62403..05a73ee 100644 Binary files a/screenshots/personal_settings.png and b/screenshots/personal_settings.png differ diff --git a/src/AppMenu.vue b/src/AppMenu.vue index 20fc9db..8f043e8 100644 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -33,6 +33,7 @@
@@ -75,6 +76,7 @@ export default { apps: null, appLimit: 0, observer: null, + targetBlankApps: [], } }, mounted() { @@ -93,6 +95,7 @@ export default { } }) + this.targetBlankApps = window.targetBlankApps this.observer = new ResizeObserver(this.resize) this.observer.observe(this.$el) this.resize() diff --git a/src/l10n/fixtures/cs.yaml b/src/l10n/fixtures/cs.yaml index 920f630..0e3f028 100644 --- a/src/l10n/fixtures/cs.yaml +++ b/src/l10n/fixtures/cs.yaml @@ -53,14 +53,10 @@ \ obrazovky)" "Display the big menu": "Zobrazit velkou nabídku" "Display the logo": "Zobrazit logo" -"This feature is not compatible with the big menu display.": "Tato funkce\ - \ není kompatibilní se zobrazením velké nabídky." "Icons and texts": "Ikony a texty" "Loader enabled": "Načítání zapnuto" "Tips": "Tipy" "Always displayed": "Vždy zobrazeno" -"The logo will be hidden when the menu is always displayed.": "Pokud je nabídka zobrazena\ - \ trvale, logo bude skryto." "This is the automatic behavior when the menu is always displayed.": "Toto je automatické\ \ chování, kdy je nabídka vždy zobrazena." "Not compatible with touch screens.": "Nekompatibilní s dotykovými obrazovkami." @@ -97,8 +93,6 @@ "With categories": "S kategoriemi" "Custom categories": "Vlastní kategorie" "Customize application categories": "Přizpůsobte kategorie aplikací" -"Apps only visible in the top menu": "Aplikace jsou viditelné pouze v horní nabídce" -"Apps visible in the top and side menus": "Aplikace viditelné v horní a boční nabídce" "Reset to default": "Vrátit zpět na výchozí hodnoty" "Hidden icon": "Skrytá ikona" "Small icon": "Malá ikona" @@ -109,3 +103,6 @@ "Normal text": "Normální text" "Big text": "Velký text" "Applications": "Applications" +"Applications kept in the top menu": "Applications kept in the top menu" +"Applications kept in the top menu but also shown in side menu": "Applications kept in the top menu but also shown in side menu" +"These applications must be selected in the previous option.": "These applications must be selected in the previous option." diff --git a/src/l10n/fixtures/de.yaml b/src/l10n/fixtures/de.yaml index 134b29f..d8d9bc1 100644 --- a/src/l10n/fixtures/de.yaml +++ b/src/l10n/fixtures/de.yaml @@ -53,14 +53,10 @@ \ deaktiviert)" "Display the big menu": "Großes Menü anzeigen" "Display the logo": "Logo anzeigen" -"This feature is not compatible with the big menu display.": "Diese Funktion\ - \ ist nicht mit dem großen Menü kompatibel." "Icons and texts": "Symbole und Texte" "Loader enabled": "Ladestandanzeige aktiviert" "Tips": "Tipps" "Always displayed": "Immer anzeigen" -"The logo will be hidden when the menu is always displayed.": "Das Logo wird ausgeblendet,\ - \ wenn das Menü immer angezeigt wird." "This is the automatic behavior when the menu is always displayed.": "Dies ist das\ \ automatische Verhalten, wenn das Menü immer angezeigt wird." "Not compatible with touch screens.": "Nicht kompatibel mit Touchscreens." @@ -100,8 +96,6 @@ "With categories": "Mit Kategorien" "Custom categories": "Benutzerdefinierte Kategorien" "Customize application categories": "Anwendungskategorien anpassen" -"Apps only visible in the top menu": "Apps nur im oberen Menü sichtbar" -"Apps visible in the top and side menus": "Apps im oberen und seitlichen Menü sichtbar" "Reset to default": "Auf Standard zurücksetzen" "Hidden icon": "Verstecktes Symbol" "Small icon": "Kleines Symbol" @@ -112,3 +106,6 @@ "Normal text": "Normaler Text" "Big text": "Großer Text" "Applications": "Applications" +"Applications kept in the top menu": "Applications kept in the top menu" +"Applications kept in the top menu but also shown in side menu": "Applications kept in the top menu but also shown in side menu" +"These applications must be selected in the previous option.": "These applications must be selected in the previous option." diff --git a/src/l10n/fixtures/fr.yaml b/src/l10n/fixtures/fr.yaml index fa3eccd..e1a535b 100644 --- a/src/l10n/fixtures/fr.yaml +++ b/src/l10n/fixtures/fr.yaml @@ -61,14 +61,10 @@ \ le menu au passage de la souris (automatiquement désactivé sur les écrans tactiles)" "Display the big menu": "Afficher le menu large" "Display the logo": "Afficher le logo" -"This feature is not compatible with the big menu display.": "Cette fonctionnalité\ - \ n'est pas compatible avec l'affichage Menu large." "Icons and texts": "Icônes et textes" "Loader enabled": "Activation de l'indicateur de chargement" "Tips": "Astuces" "Always displayed": "Toujours affiché" -"The logo will be hidden when the menu is always displayed.": "Le logo sera masque\ - \ si le menu est toujours affiché." "This is the automatic behavior when the menu is always displayed.": "C'est le comportement\ \ automatique lorsque le menu est toujours affiché." "Not compatible with touch screens.": "Incompatible avec les écrans tactiles." @@ -108,9 +104,8 @@ "With categories": "Avec les catégories" "Custom categories": "Catégories personnalisées" "Customize application categories": "Personnaliser les catégories des applications" -"Apps only visible in the top menu": "Applications visibles uniquement dans le menu\ - \ supérieur" -"Apps visible in the top and side menus": "Applications visibles dans le menus supérieur\ - \ et latéral" "Reset to default": "Restaurer les valeurs par défaut" "Applications": "Applications" +"Applications kept in the top menu": "Applications conservées dans le menu supérieur" +"Applications kept in the top menu but also shown in side menu": "Applications conservées dans le menu supérieur mais également affichées dans le menu latéral" +"These applications must be selected in the previous option.": "Ces applications doivent également être sélectionnées dans l'option précédente" diff --git a/src/l10n/fixtures/tpl/base.yaml b/src/l10n/fixtures/tpl/base.yaml index e7c1980..eb9bdab 100644 --- a/src/l10n/fixtures/tpl/base.yaml +++ b/src/l10n/fixtures/tpl/base.yaml @@ -52,12 +52,10 @@ "Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "" "Display the big menu": "" "Display the logo": "" -"This feature is not compatible with the big menu display.": "" "Icons and texts": "" "Loader enabled": "" "Tips": "" "Always displayed": "" -"The logo will be hidden when the menu is always displayed.": "" "This is the automatic behavior when the menu is always displayed.": "" "Not compatible with touch screens.": "" "Big menu": "" @@ -89,7 +87,8 @@ "With categories": "" "Custom categories": "" "Customize application categories": "" -"Apps only visible in the top menu": "" -"Apps visible in the top and side menus": "" "Reset to default": "" "Applications": "" +"Applications kept in the top menu": "" +"Applications kept in the top menu but also shown in side menu": "" +"These applications must be selected in the previous option.": "" diff --git a/src/l10n/fixtures/zh_CN.yaml b/src/l10n/fixtures/zh_CN.yaml index 8fdec79..df3b412 100644 --- a/src/l10n/fixtures/zh_CN.yaml +++ b/src/l10n/fixtures/zh_CN.yaml @@ -41,12 +41,10 @@ "Open the menu when the mouse is hover the opener (automatically disabled on touch screens)": "鼠标悬停时打开菜单 (触摸屏时将自动禁用)" "Display the big menu": "显示大型菜单" "Display the logo": "显示logo" -"This feature is not compatible with the big menu<\/code> display.": "此功能与显示大型菜单<\/code>不兼容。" "Icons and texts": "图标与文字" "Loader enabled": "菜单指示器已激活" "Tips": "技巧" "Always displayed": "一直显示" -"The logo will be hidden when the menu is always displayed.": "一直显示菜单时logo将被隐藏。" "This is the automatic behavior when the menu is always displayed.": "一直显示菜单时的自动动作。" "Not compatible with touch screens.": "与触屏不兼容。" "Big menu": "大型菜单" @@ -78,8 +76,6 @@ "With categories": "有类别" "Custom categories": "自定义类别" "Customize application categories": "自定义应用程序类别" -"Apps only visible in the top menu": "应用程序仅在顶部菜单中可见" -"Apps visible in the top and side menus": "顶部和侧边菜单中可见的应用程序" "Reset to default": "重置为默认设置" "Hidden icon": "隐藏图标" "Small icon": "小图标" @@ -90,3 +86,6 @@ "Normal text": "普通文本" "Big text": "大文本" "Applications": "Applications" +"Applications kept in the top menu": "Applications kept in the top menu" +"Applications kept in the top menu but also shown in side menu": "Applications kept in the top menu but also shown in side menu" +"These applications must be selected in the previous option.": "These applications must be selected in the previous option." diff --git a/templates/js/script.php b/templates/js/script.php index 797f013..2607866 100644 --- a/templates/js/script.php +++ b/templates/js/script.php @@ -22,10 +22,10 @@ if ($_['always-displayed']) { const nextcloud = document.querySelector('#nextcloud') const isTouchDevice = window.matchMedia("(pointer: coarse)").matches - const targetBlankApps = + window.targetBlankApps = window.topMenuApps = - window.topSideMenuApps = + window.topSideMenuApps = window.menuAppsOrder = diff --git a/templates/settings/admin-form.php b/templates/settings/admin-form.php index 5a55946..5d1d088 100644 --- a/templates/settings/admin-form.php +++ b/templates/settings/admin-form.php @@ -41,8 +41,104 @@ $choicesSizes = [ $labelShowHideApps = 'Show and hide the list of applications'; $labelReset = 'Reset to default'; + ?>
+ +
+

+ t('Panel')); ?> +

+ + !$_['always-displayed'] && !$_['big-menu'] && !$_['side-with-categories'], + 'always-displayed' => $_['always-displayed'] && !$_['big-menu'] && !$_['side-with-categories'], + 'side-with-categories' => $_['side-with-categories'] && !$_['always-displayed'] && !$_['big-menu'], + 'big-menu' => $_['big-menu'] && !$_['always-displayed'] && !$_['side-with-categories'], + ]; + ?> + +
+ +
+

+ <?php p($l->t('Default')); ?> +

+ +
+ +
+

+ <?php p($l->t('With categories')); ?> +

+ +
+ +
+

+ <?php p($l->t('Big menu')); ?> +

+ +
+ +
+

t('Not compatible with touch screens.')); ?>

+

+ <?php p($l->t('Always displayed')); ?> +

+ + + + +
+

t('Colors')); ?> @@ -50,6 +146,13 @@ $labelReset = 'Reset to default'; t('Live preview')); ?>

+
+ t('Default')); ?> + t('With categories')); ?> + t('Big menu')); ?> + t('Always displayed')); ?> +
+
@@ -234,6 +337,13 @@ $labelReset = 'Reset to default'; t('Dark mode colors')); ?> +
+ t('Default')); ?> + t('With categories')); ?> + t('Big menu')); ?> + t('Always displayed')); ?> +
+

t('This parameters are used when Dark theme or Breeze Dark Theme are enabled.'); ?>

@@ -422,6 +532,13 @@ $labelReset = 'Reset to default'; t('Opener')); ?> +
+ t('Default')); ?> + t('With categories')); ?> + t('Big menu')); ?> + t('Always displayed')); ?> +
+
-
-
-
-

- t('Panel')); ?> -

- - !$_['always-displayed'] && !$_['big-menu'] && !$_['side-with-categories'], - 'always-displayed' => $_['always-displayed'] && !$_['big-menu'] && !$_['side-with-categories'], - 'side-with-categories' => $_['side-with-categories'] && !$_['always-displayed'] && !$_['big-menu'], - 'big-menu' => $_['big-menu'] && !$_['always-displayed'] && !$_['side-with-categories'], - ]; - ?> - -
- -
-

- <?php p($l->t('Default')); ?> -

- -
- -
-

- <?php p($l->t('With categories')); ?> -

- -
- -
-

- <?php p($l->t('Big menu')); ?> -

- -
- -
-

t('Not compatible with touch screens.')); ?>

-

- <?php p($l->t('Always displayed')); ?> -

- - - - -
- - -
t('Open the menu when the mouse is hover the opener (automatically disabled on touch screens)')); ?> @@ -589,16 +608,18 @@ $labelReset = 'Reset to default';
+
+
+
+
t('Display the logo')); ?> -
- - t('This feature is not compatible with the big menu display.'); ?> -
- t('The logo will be hidden when the menu is always displayed.')); ?> -
+ +
+ t('Default')); ?> +
@@ -629,6 +654,10 @@ $labelReset = 'Reset to default';
t('The logo is a link to the default app')); ?> + +
+ t('Default')); ?> +
' name="apps-order" class="side-menu-setting" id="side-menu-apps-order" data-personal> +
+
+
+