Fix Exchange draft

This commit is contained in:
Dennis Eichhorn 2018-05-20 14:54:55 +02:00
parent 0ba623c9a9
commit d47963320c
11 changed files with 132 additions and 222 deletions

View File

@ -34,7 +34,7 @@
"type": 3,
"subtype": 1,
"name": "Import",
"uri": "/{/lang}/backend/admin/exchange/import?{?}",
"uri": "/{/lang}/backend/admin/exchange/import/list?{?}",
"target": "self",
"icon": null,
"order": 5,
@ -49,7 +49,7 @@
"type": 3,
"subtype": 1,
"name": "Export",
"uri": "/{/lang}/backend/admin/exchange/export?{?}",
"uri": "/{/lang}/backend/admin/exchange/export/list?{?}",
"target": "self",
"icon": null,
"order": 10,
@ -57,21 +57,6 @@
"permission": { "type": null, "element": null },
"parent": 1007001001,
"children": []
},
{
"id": 1007002004,
"pid": "/backend/admin/exchange",
"type": 3,
"subtype": 1,
"name": "Setup",
"uri": "/{/lang}/backend/admin/exchange/setup?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "Exchange",
"permission": { "type": null, "element": null },
"parent": 1007001001,
"children": []
}
]
}

View File

@ -3,13 +3,25 @@
use phpOMS\Router\RouteVerb;
return [
'^.*/backend/admin/exchange/import.*$' => [
'^.*/backend/admin/exchange/import/list.*$' => [
[
'dest' => '\Modules\Exchange\Controller:viewExchangeImportList',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/exchange/export/list.*$' => [
[
'dest' => '\Modules\Exchange\Controller:viewExchangeExportList',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/exchange/import/profile.*$' => [
[
'dest' => '\Modules\Exchange\Controller:viewExchangeImport',
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/exchange/export.*$' => [
'^.*/backend/admin/exchange/export/profile.*$' => [
[
'dest' => '\Modules\Exchange\Controller:viewExchangeExport',
'verb' => RouteVerb::GET,
@ -21,10 +33,4 @@ return [
'verb' => RouteVerb::GET,
],
],
'^.*/backend/admin/exchange/setup.*$' => [
[
'dest' => '\Modules\Exchange\Controller:viewExchangeSetup',
'verb' => RouteVerb::GET,
],
],
];

View File

@ -82,4 +82,49 @@ final class Controller extends ModuleAbstract implements WebInterface
*/
protected static $dependencies = [
];
public function viewExchangeDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response));
return $view;
}
public function viewExchangeExportList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-export-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response));
return $view;
}
public function viewExchangeImportList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-import-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response));
return $view;
}
public function viewExchangeExport(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-export');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response));
return $view;
}
public function viewExchangeImport(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Exchange/Theme/Backend/exchange-import');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007001001, $request, $response));
return $view;
}
}

View File

@ -15,5 +15,4 @@ return ['Navigation' => [
'Exchange' => 'Exchange',
'Export' => 'Export',
'Import' => 'Import',
'Setup' => 'Setup',
]];

View File

@ -10,61 +10,8 @@
* @version 1.0.0
* @link http://website.orange-management.de
*/
$logs = $this->app->logger->countLogs();
$penetrators = $this->app->logger->getHighestPerpetrator();
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('System'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getHtml('OS'); ?><td><?= $this->printHtml(php_uname('s')); ?>
<tr><td><?= $this->getHtml('Version'); ?><td><?= $this->printHtml(php_uname('v')); ?>
<tr><td><?= $this->getHtml('Release'); ?><td><?= $this->printHtml(php_uname('r')); ?>
<tr><td><?= $this->getHtml('RAMUsage'); ?><td><?= $this->printHtml(memory_get_usage(true)/(1024*1024)); ?> MB
<tr><td><?= $this->getHtml('MemoryLimit'); ?><td><?= $this->printHtml(ini_get('memory_limit')); ?>
<tr><td><?= $this->getHtml('SystemRAM'); ?><td><?= $this->printHtml(\phpOMS\System\SystemUtils::getRAM()/(1024)); ?> MB
<tr><td><?= $this->getHtml('CPUUsage'); ?><td><?= $this->printHtml(\phpOMS\System\SystemUtils::getCpuUsage()); ?>%
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Logs'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getHtml('Emergencies'); ?><td><?= $this->printHtml($logs['emergency'] ?? 0); ?>
<tr><td><?= $this->getHtml('Criticals'); ?><td><?= $this->printHtml($logs['critical'] ?? 0); ?>
<tr><td><?= $this->getHtml('Errors'); ?><td><?= $this->printHtml($logs['error'] ?? 0); ?>
<tr><td><?= $this->getHtml('Warnings'); ?><td><?= $this->printHtml($logs['warning'] ?? 0); ?>
<tr><td><?= $this->getHtml('Alerts'); ?><td><?= $this->printHtml($logs['alert'] ?? 0); ?>
<tr><td><?= $this->getHtml('Notices'); ?><td><?= $this->printHtml($logs['notice'] ?? 0); ?>
<tr><td><?= $this->getHtml('Info'); ?><td><?= $this->printHtml($logs['info'] ?? 0); ?>
<tr><td><?= $this->getHtml('Debug'); ?><td><?= $this->printHtml($logs['debug'] ?? 0); ?>
<tr><td><?= $this->getHtml('Total'); ?><td><?= $this->printHtml(array_sum($logs)); ?>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Penetrators'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<?php foreach ($penetrators as $ip => $count) : ?>
<tr><td><?= $this->printHtml($ip); ?><td><?= $this->printHtml($count); ?>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,17 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>

View File

@ -0,0 +1,17 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>

View File

@ -0,0 +1,17 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>

View File

@ -0,0 +1,17 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render(); ?>

View File

@ -1,92 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
$log = $this->app->logger->getByLine((int) $this->request->getData('id') ?? 1);
$temp = trim($log['backtrace']);
$log['backtrace'] = json_decode($temp, true);
$details = '* Uri: `' . trim($log['path']) . "`\n"
. '* Level: `' . trim($log['level']) . "`\n"
. '* Message: `' . trim($log['message']) . "`\n"
. '* File: `' . trim($log['file']) . "`\n"
. '* Line: `' . trim($log['line']) . "`\n"
. '* Version: `' . trim($log['version']) . "`\n"
. '* OS: `' . trim($log['os']) . "`\n\n"
. "Backtrace: \n\n```\n" . json_encode($log['backtrace'], JSON_PRETTY_PRINT);
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Logs') ?></h1></header>
<div class="inner">
<table class="list w-100">
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td><i class="fa fa-anchor"></i>
<td class="wf-100"><?= $this->printHtml((int) $this->request->getData('id') ?? 0); ?>
<tr>
<td><?= $this->getHtml('Time') ?>
<td><i class="fa fa-clock-o"></i>
<td><?= $this->printHtml($log['datetime']); ?>
<tr>
<td><?= $this->getHtml('Uri') ?>
<td><i class="fa fa-globe"></i>
<td><?= $this->printHtml($log['path']); ?>
<tr>
<td><?= $this->getHtml('Source') ?>
<td><i class="fa fa-wifi"></i>
<td><?= $this->printHtml($log['ip']); ?>
<tr>
<td><?= $this->getHtml('Level') ?>
<td>
<i class="fa fa-<?= $this->printHtml(in_array($log['level'], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'); ?>"></i>
<td><?= $this->printHtml($log['level']); ?>
<tr>
<td><?= $this->getHtml('Message') ?>
<td><i class="fa fa-commenting"></i>
<td><?= $this->printHtml($log['message']); ?>
<tr>
<td><?= $this->getHtml('File') ?>
<td><i class="fa fa-file"></i>
<td><?= $this->printHtml($log['file']); ?>
<tr>
<td><?= $this->getHtml('Line') ?>
<td><i class="fa fa-commenting"></i>
<td><?= $this->printHtml($log['line']); ?>
<tr>
<td><?= $this->getHtml('Version') ?>
<td><i class="fa fa-pencil"></i>
<td><?= $this->printHtml($log['version']); ?>
<tr>
<td><?= $this->getHtml('OS') ?>
<td><i class="fa fa-laptop"></i>
<td><?= $this->printHtml($log['os']); ?>
<tr>
<td colspan="3"><?= $this->getHtml('Backtrace') ?>
<tr>
<td colspan="3">
<pre><?= $this->printHtml(json_encode($log['backtrace'], JSON_PRETTY_PRINT)); ?></pre>
<tr>
<td colspan="3" style="padding-top: 10px"><a class="button" target="_blank"
href="https://gitreports.com/issue/Orange-Management/Orange-Management/?name=Guest&issue_title=<?= $this->printHtml(urlencode($log['message'])); ?>&details=<?= $this->printHtml(urlencode($details)); ?>"><?= $this->getHtml('Report') ?></a>
</table>
</div>
</section>
</div>
</div>

View File

@ -1,48 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package TBD
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
$logs = array_reverse($this->app->logger->get(25), true);
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="box col-xs-12 wf-100">
<table class="table red">
<caption><?= $this->getHtml('Logs') ?></caption>
<thead>
<tr>
<td><?= $this->getHtml('Timestamp') ?>
<td><?= $this->getHtml('Level') ?>
<td><?= $this->getHtml('Source') ?>
<td class="wf-100"><?= $this->getHtml('Message') ?>
<tfoot>
<tr>
<td colspan="5">
<tbody>
<?php foreach ($logs as $key => $value) :
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/monitoring/logs/single?{?}&id=' . $key);?>
<tr>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-clock-o"></i> <?= $this->printHtml($value[0] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-<?= $this->printHtml(in_array($value[1], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'); ?>"></i> <?= $this->printHtml($value[1] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-wifi"></i> <?= $this->printHtml($value[2] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-commenting"></i> <?= $this->printHtml($value[7] ?? ''); ?></a>
<?php endforeach;
if (!isset($key)) : ?>
<tr>
<td colspan="4">
<?php endif; ?>
</table>
</div>
</div>