Cleanup and implement raw text

This commit is contained in:
Dennis Eichhorn 2017-12-30 11:47:14 +01:00
parent e81d939df1
commit 8ef8dc225f
3 changed files with 112 additions and 68 deletions

View File

@ -15,6 +15,8 @@ declare(strict_types = 1);
namespace Modules\Profile; namespace Modules\Profile;
use Modules\Profile\Models\ProfileMapper; use Modules\Profile\Models\ProfileMapper;
use Modules\Profile\Models\PermissionState;
use phpOMS\Account\PermissionType;
use phpOMS\Contract\RenderableInterface; use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract; use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
@ -114,6 +116,15 @@ class Controller extends ModuleAbstract implements WebInterface
public function viewProfileList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable public function viewProfileList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{ {
$view = new View($this->app, $request, $response); $view = new View($this->app, $request, $response);
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_ID, PermissionState::PROFILE)
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return $view;
}
$view->setTemplate('/Modules/Profile/Theme/Backend/profile-list'); $view->setTemplate('/Modules/Profile/Theme/Backend/profile-list');
$view->setData('accounts', ProfileMapper::getNewest(25)); $view->setData('accounts', ProfileMapper::getNewest(25));
@ -133,11 +144,20 @@ class Controller extends ModuleAbstract implements WebInterface
*/ */
public function viewProfileSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable public function viewProfileSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{ {
$view = new View($this->app, $request, $response);
if (!$this->app->accountManager->get($request->getHeader()->getAccount())->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_ID, PermissionState::PROFILE)
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
return $view;
}
/** @var Head $head */ /** @var Head $head */
$head = $response->get('Content')->getData('head'); $head = $response->get('Content')->getData('head');
$head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css'); $head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css');
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Profile/Theme/Backend/profile-single'); $view->setTemplate('/Modules/Profile/Theme/Backend/profile-single');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000301001, $request, $response)); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000301001, $request, $response));

View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types = 1);
namespace Modules\Profile\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
*
* @category Tasks
* @package Modules
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
abstract class PermissionState extends Enum
{
/* public */ const PROFILE = 1;
}

View File

@ -13,10 +13,8 @@
<div class="tab-content"> <div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2" checked> <input type="radio" id="c-tab-1" name="tabular-2" checked>
<div class="tab"> <div class="tab">
<table class="layout wf-100"> <label for="iSearchAcc">Search</label>
<tbody> <input type="text" id="iSearchAcc" name="receiver-search" data-action='[
<tr><td colspan="2"><label for="iSearchAcc">Search</label>
<tr><td colspan="2"><input type="text" id="iSearchAcc" name="receiver-search" data-action='[
{ {
"listener": "keyup", "action": [ "listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchAcc", "delay": 500, "resets": true}, {"key": 1, "type": "utils.timer", "id": "iSearchAcc", "delay": 500, "resets": true},
@ -26,7 +24,6 @@
] ]
} }
]' autocomplete="off"> ]' autocomplete="off">
<tr><td colspan="2">
<table id="acc-table" class="table"> <table id="acc-table" class="table">
<thead> <thead>
<tr> <tr>
@ -49,21 +46,18 @@
]'> ]'>
<tfoot> <tfoot>
</table> </table>
<tr><td colspan="2"><button type="button" data-action='[ <button type="button" data-action='[
{ {
"listener": "click", "action": [ "listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"} {"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
] ]
} }
]'><?= $this->getHtml('Close', 'Admin') ?></button> ]'><?= $this->getHtml('Close', 'Admin') ?></button>
</table>
</div> </div>
<input type="radio" id="c-tab-2" name="tabular-2"> <input type="radio" id="c-tab-2" name="tabular-2">
<div class="tab"> <div class="tab">
<table class="layout wf-100"> <label for="iSearchGrp">Search</label>
<tbody> <input type="text" id="iSearchGrp" name="receiver-search" data-action='[
<tr><td colspan="2"><label for="iSearchGrp">Search</label>
<tr><td><input type="text" id="iSearchGrp" name="receiver-search" data-action='[
{ {
"listener": "keyup", "action": [ "listener": "keyup", "action": [
{"key": 1, "type": "utils.timer", "id": "iSearchGrp", "delay": 500, "resets": true}, {"key": 1, "type": "utils.timer", "id": "iSearchGrp", "delay": 500, "resets": true},
@ -72,8 +66,7 @@
{"key": 4, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1} {"key": 4, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
] ]
} }
]' autocomplete="off"><td> ]' autocomplete="off">
<tr><td colspan="2">
<table id="grp-table" class="table"> <table id="grp-table" class="table">
<thead> <thead>
<tr> <tr>
@ -83,14 +76,13 @@
<tbody> <tbody>
<tfoot> <tfoot>
</table> </table>
<tr><td colspan="2"><button type="button" data-action='[ <button type="button" data-action='[
{ {
"listener": "click", "action": [ "listener": "click", "action": [
{"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"} {"key": 1, "type": "dom.remove", "selector": "#acc-grp", "aniOut": "fadeOut"}
] ]
} }
]'><?= $this->getHtml('Close', 'Admin') ?></button> ]'><?= $this->getHtml('Close', 'Admin') ?></button>
</table>
</div> </div>
</div> </div>
</div> </div>