From 68e82d0238f84aceda66d6d90c51128d8f23bda6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 22 Jan 2022 21:56:01 +0100 Subject: [PATCH] bug fixes and permission tests --- Admin/Install/Navigation.install.json | 17 +++ Admin/Install/Navigation.php | 43 ++++++++ Admin/Routes/Web/Backend.php | 11 ++ .../Theme/Backend/modules-nav-list.tpl.php | 100 ++++++++++++++++++ Controller.js | 6 +- Controller/BackendController.php | 30 ++++++ 6 files changed, 203 insertions(+), 4 deletions(-) create mode 100644 Admin/Install/Navigation.install.json create mode 100644 Admin/Install/Navigation.php create mode 100644 Admin/Settings/Theme/Backend/modules-nav-list.tpl.php diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json new file mode 100644 index 0000000..802e401 --- /dev/null +++ b/Admin/Install/Navigation.install.json @@ -0,0 +1,17 @@ +[ + { + "id": 1000501001, + "pid": "/admin/module", + "type": 3, + "subtype": 1, + "name": "Navigation", + "uri": "{/prefix}admin/module/navigation/list?{?}", + "target": "self", + "icon": null, + "order": 10, + "from": "Navigation", + "permission": { "permission": 2, "type": null, "element": null }, + "parent": 1000105001, + "children": [] + } +] \ No newline at end of file diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..b4b6734 --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,43 @@ + __DIR__ . '/Navigation.install.json']); + } +} diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 0720360..92f3439 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -39,4 +39,15 @@ return [ ], ], ], + '^.*/admin/module/navigation/list\?.*$' => [ + [ + 'dest' => '\Modules\Navigation\Controller\BackendController:viewModuleNavigationList', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => \Modules\Admin\Models\PermissionState::MODULE, + ], + ], + ], ]; diff --git a/Admin/Settings/Theme/Backend/modules-nav-list.tpl.php b/Admin/Settings/Theme/Backend/modules-nav-list.tpl.php new file mode 100644 index 0000000..df1bc25 --- /dev/null +++ b/Admin/Settings/Theme/Backend/modules-nav-list.tpl.php @@ -0,0 +1,100 @@ +getData('navs') ?? []; +$apps = $this->getData('apps') ?? []; + +echo $this->getData('nav')->render(); +?> + +
+
+
+
getHtml('Logs'); ?>
+
+ + + + + + + + +
+
+
diff --git a/Controller.js b/Controller.js index 7ec41f5..2ec657a 100755 --- a/Controller.js +++ b/Controller.js @@ -79,10 +79,8 @@ jsOMS.Modules.Navigation = class { || document.body.clientWidth; /** - * @todo Orange-Management/Modules#192 - * The sidebar navigation is not working properly in many cases - * 1. if the content is too wide then the side nav becomes smaller (resize window for testing) - * 2. if the device is a handheld device it feels unintuitive to open/hide the navigation + * @todo Navigation sidebar width + * The sidebar navigation is not working properly if the content is too wide then the side nav becomes smaller (resize window for testing) */ e.nextElementSibling.checked = width < 800; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 6274da2..d56bdc0 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -16,6 +16,7 @@ namespace Modules\Navigation\Controller; use Model\NullSetting; use Model\SettingMapper; +use Modules\Admin\Models\AppMapper; use Modules\Navigation\Models\NavElementMapper; use Modules\Navigation\Models\Navigation; use Modules\Navigation\Views\NavigationView; @@ -214,4 +215,33 @@ final class BackendController extends Controller return $view; } + + /** + * Method which generates the module profile view. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface Response can be rendered + * + * @since 1.0.0 + */ + public function viewModuleNavigationList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Navigation/Admin/Settings/Theme/Backend/modules-nav-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response)); + + $module = $request->getData('id') ?? ''; + $view->setData('module', $module); + + $activeNavElements = NavElementMapper::getAll()->where('from', $module)->execute(); + $view->setData('navs', $activeNavElements); + + $apps = AppMapper::getAll()->execute(); + $view->setData('apps', $apps); + + return $view; + } }