mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-01-11 16:18:42 +00:00
cs fixes, bug fixes, code coverage
This commit is contained in:
parent
86375c2ef7
commit
7a8bdeeaa2
|
|
@ -17,7 +17,7 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/admin/module/settings\?id=Navigation.*$' => [
|
||||
'^.*/admin/module/settings\?id=Navigation$' => [
|
||||
[
|
||||
'dest' => '\Modules\Navigation\Controller\BackendController:viewModuleSettings',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -28,4 +28,15 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/admin/module/settings\?id=Navigation&nav=.*?$' => [
|
||||
[
|
||||
'dest' => '\Modules\Navigation\Controller\BackendController:viewModuleNavElementSettings',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => \Modules\Admin\Models\PermissionState::MODULE,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
206
Admin/Settings/Theme/Backend/settings-nav.tpl.php
Normal file
206
Admin/Settings/Theme/Backend/settings-nav.tpl.php
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$nav = $this->getData('nav');
|
||||
$routes = $this->getData('routes');
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('NavigationElement'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('Id'); ?></label>
|
||||
<input id="iId" name="id" type="text" value="<?= $this->printHtml($nav->id); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iApp"><?= $this->getHtml('App'); ?></label>
|
||||
<input id="iApp" name="app" type="text" value="<?= $this->printHtml($nav->app); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPidRaw"><?= $this->getHtml('PidRaw'); ?></label>
|
||||
<input id="iPidRaw" name="pidRaw" type="text" value="<?= $this->printHtml($nav->pidRaw); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input id="iName" name="name" type="text" value="<?= $this->printHtml($nav->name); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<input id="iType" name="type" type="text" value="<?= $this->printHtml($nav->type); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iSubtype"><?= $this->getHtml('Subtype'); ?></label>
|
||||
<input id="iSubtype" name="subtype" type="text" value="<?= $this->printHtml($nav->subtype); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iLinkStatus"><?= $this->getHtml('LinkStatus'); ?></label>
|
||||
<input id="iLinkStatus" name="status" type="text" value="<?= $this->printHtml($nav->status); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iUri"><?= $this->getHtml('Uri'); ?></label>
|
||||
<input id="iUri" name="uri" type="text" value="<?= $this->printHtml($nav->uri); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iFrom"><?= $this->getHtml('From'); ?></label>
|
||||
<input id="iFrom" name="from" type="text" value="<?= $this->printHtml($nav->from); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iParent"><?= $this->getHtml('Parent'); ?></label>
|
||||
<input id="iParent" name="parent" type="text" value="<?= $this->printHtml($nav->parent); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iOrder"><?= $this->getHtml('Order'); ?></label>
|
||||
<input id="iOrder" name="order" type="text" value="<?= $this->printHtml($nav->order); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPermission"><?= $this->getHtml('Permission'); ?></label>
|
||||
<input id="iPermission" name="permPerm" type="text" value="<?= $this->printHtml($nav->permissionPerm); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPermissionType"><?= $this->getHtml('PermissionType'); ?></label>
|
||||
<input id="iPermissionType" name="permType" type="text" value="<?= $this->printHtml($nav->permissionType); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPermissionElement"><?= $this->getHtml('PermissionElement'); ?></label>
|
||||
<input id="iPermissionElement" name="permElement" type="text" value="<?= $this->printHtml($nav->permissionElement); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot"><input id="iSubmitGeneral" name="submitGeneral" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>"></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Routes'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<div class="slider">
|
||||
<table id="navList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Status'); ?>
|
||||
<label for="navList-sort-1">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-2">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('App'); ?>
|
||||
<label for="navList-sort-1">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-2">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Module'); ?>
|
||||
<label for="navList-sort-5">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-5">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-6">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-6">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Route'); ?>
|
||||
<label for="navList-sort-3">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-3">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-4">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-4">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Destination'); ?>
|
||||
<label for="navList-sort-3">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-3">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-4">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-4">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Methods'); ?>
|
||||
<label for="navList-sort-5">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-5">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="navList-sort-6">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-6">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($routes as $route => $data) : ++$count; ?>
|
||||
<tr tabindex="0">
|
||||
<td><<?= $this->printHtml($data['app'] ?? ''); ?>
|
||||
<td><<?= $this->printHtml($data['module'] ?? ''); ?>
|
||||
<td><<?= $this->printHtml($route); ?>
|
||||
<td><<?= $this->printHtml($data['dest'] ?? ''); ?>
|
||||
<td><<?= $this->printHtml($data['verb'] ?? ''); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -105,7 +105,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('From'); ?>
|
||||
<td><?= $this->getHtml('Provider'); ?>
|
||||
<label for="navList-sort-15">
|
||||
<input type="radio" name="navList-sort" id="navList-sort-15">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
|
|
@ -132,7 +132,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($navs as $key => $nav) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/module/settings?id=Navigation&nav=' . $nav->id); ?>
|
||||
$url = UriFactory::build('{/prefix}admin/module/settings?id=Navigation&nav=' . $nav->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $nav->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $nav->pidRaw; ?></a>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all
|
|||
|
||||
### Issues
|
||||
|
||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository.
|
||||
|
||||
The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`.
|
||||
Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code marked with `@todo` or in the [PROJECT.md](https://github.com/Orange-Management/Docs/blob/master/Project/PROJECT.md) file.
|
||||
|
||||
### Code Style
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Method which generates the module profile view.
|
||||
* Method which generates the module settings view.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -190,4 +190,24 @@ final class BackendController extends Controller
|
|||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method which generates a navigation settings 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 viewModuleNavElementSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-nav');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
|
||||
|
||||
$view->addData('nav-element', NavElementMapper::get((int) $request->getData('nav')));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,12 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => []];
|
||||
return ['Navigation' => [
|
||||
'PageId' => 'PageId',
|
||||
'Name' => 'Name',
|
||||
'Type' => 'Type',
|
||||
'Subtype' => 'Subtype',
|
||||
'Uri' => 'Uri',
|
||||
'Provider' => 'Provider',
|
||||
'Parent' => 'Parent',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ namespace Modules\Navigation\tests\Admin;
|
|||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Navigation\Models\Navigation;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ namespace Modules\Navigation\tests\Models;
|
|||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Navigation\Models\Navigation;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Module\ModuleManager;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
|
|
@ -60,6 +59,6 @@ final class NavigationTest extends \PHPUnit\Framework\TestCase
|
|||
$this->expectException(\Exception::class);
|
||||
|
||||
$account = AccountMapper::getWithPermissions(9999);
|
||||
$nav = Navigation::getInstance(null, $account, $GLOBALS['dbpool'], 1, 'Backend');
|
||||
$nav = Navigation::getInstance(null, $account, $GLOBALS['dbpool'], 1, 'Backend');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user