Feature Update

This commit is contained in:
Daniel Spitzer
2023-02-21 12:24:44 +00:00
committed by Frank Schubert
parent 0763f068bd
commit aa72b1ba95
18 changed files with 437 additions and 526 deletions

View File

@@ -2,7 +2,7 @@
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
<style>
.card-border {
@@ -22,11 +22,11 @@
</li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Device") ?>">Devices</a>
</li>
<li class="breadcrumb-item active">Devices Detail</li>
<li class="breadcrumb-item active">Device Detail</li>
</ol>
</div>
<h4 class="page-title">Device <?= $devices->data->name ?> <span class="ml-2">
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id]) ?>">
<h4 class="page-title">Device: <span class="font-weight-normal ml-1"><?= $devices->data->name ?></span> <span class="ml-2">
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id, 'returnto' => "device-detail"]) ?>">
<button class="btn btn-primary">Bearbeiten</button>
</a>
</span></h4>
@@ -95,17 +95,30 @@ if (!empty($devices->price)) {
</div>
<div class="col-4 card-border">
<div>
<h4>Standort Informationen</h4>
<h4>Pop Informationen</h4>
</div>
<?php
if (!empty(trim($devices->pop->name))) {
$vlans = "";
if (!empty(trim($devices->pop->vlan_public)))
$vlans .= '<span class="order-date-pill active mb-0">Public: <span class="font-weight-500">' . $devices->pop->vlan_public . '</span class="font-weight-500"></span>';
if (!empty(trim($devices->pop->vlan_nat)))
$vlans .= '<span class="order-date-pill active mb-0">Nat: <span class="font-weight-500">' . $devices->pop->vlan_nat . '</span></span>';
if (!empty(trim($devices->pop->vlan_ipv6)))
$vlans .= '<span class="order-date-pill active mb-0">IPv6: <span class="font-weight-500">' . $devices->pop->vlan_ipv6 . '</span></span>';
?>
<div>
<table class="table table-sm">
<tbody>
<tr>
<th>Pop Name</th>
<td><?= $devices->pop->name ?> </td>
<td>
<a href="<?= self::getUrl("Pop", "Detail", ["id" => $devices->pop->id]) ?>"><?= $devices->pop->name ?></a>
</td>
</tr>
<tr>
<th>Adresse</th>
@@ -116,7 +129,14 @@ if (!empty($devices->price)) {
target="_blank"><?= rtrim($devices->pop->gps_lat, '0') ?>
, <?= rtrim($devices->pop->gps_long, 0) ?></a></td>
</tr>
<tr>
<th>Standort Info</th>
<td><?= nl2br($devices->pop->location) ?> </td>
</tr>
<tr>
<th>Access VLANs</th>
<td><?= $vlans ?> </td>
</tr>
</tbody>
</table>
</div>

View File

@@ -1,5 +1,13 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<?php
foreach ($devicetypes as $devicetype) {
$deviceTypes[$devicetype->id]=$devicetype->devicemanufactor->name . " " . $devicetype->name;
}
asort($deviceTypes);
?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css" rel="stylesheet" type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
@@ -14,7 +22,7 @@
</ol>
</div>
<h4 class="page-title">Geräte</h4>
<h4 class="page-title">Devices</h4>
</div>
</div>
</div>
@@ -28,7 +36,7 @@
<h4 class="header-title mb-2"><?= ($device->id) ? "Device bearbeiten" : "Neues Gerät" ?></h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("Device", "save") ?>">
action="<?= self::getUrl("Device", "save", ["returnto" => $_GET["returnto"]]) ?>">
<div class="card">
<div class="card-body">
@@ -46,9 +54,9 @@
<label class="col-lg-2 col-form-label" for="devicetype_id">Gerätetyp *</label>
<div class="col-lg-10">
<select class="select2 form-control " name="devicetype_id" id="devicetype_id">
<option></option>
<?php foreach ($devicetypes as $devicetype): ?>
<option value="<?= $devicetype->id ?>" <?= ($device->devicetype_id == $devicetype->id) ? "selected='selected'" : "" ?>><?= ($devicetype->devicemanufactor->name . " " . $devicetype->name) ?></option>
<option>&nbsp;</option>
<?php foreach ($deviceTypes as $key => $devicetype): ?>
<option value="<?= $key ?>" <?= ($device->devicetype_id == $key) ? "selected='selected'" : "" ?>><?= ($devicetype) ?></option>
<?php endforeach; ?>
</select>
</div>
@@ -57,7 +65,7 @@
<label class="col-lg-2 col-form-label" for="pop_id">Pop</label>
<div class="col-lg-10">
<select class="select2 form-control " name="pop_id" id="pop_id">
<option></option>
<option value="0">&nbsp;</option>
<?php foreach ($pops as $pop): ?>
<option value="<?= $pop->id ?>" <?= ($device->pop_id == $pop->id) ? "selected='selected'" : "" ?>><?= ($pop->devicemanufactor->name . " " . $pop->name) ?></option>
<?php endforeach; ?>
@@ -117,7 +125,7 @@
allowClear: true,
placeholder: ""
});
$("#addresstypes").select2();
$(".select2").select2();
// disable mousewheel on a input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {

View File

@@ -4,37 +4,9 @@ $pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Device";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?=self::getResourcePath()?>assets/css/datatables-std.css" rel="stylesheet" type="text/css" />
<style>
#filterrow input {
width: 100%;
padding: 3px;
box-sizing: border-box;
display: table-header-group;
height: unset;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;
}
.dataTables_wrapper .dataTables_length {
float: right;
}
.clear-fa {
margin-left: 5px;
font-size: 23px;
vertical-align: middle;
color: #cb2929;
cursor: pointer;
}
.margina {
margin-left: 30px !important;
margin-top: -5px;
}
</style>
<!-- start page title -->
<div class="row">
@@ -74,7 +46,7 @@ $pagination_entity_name = "Device";
<table id="datatable" class="table table-striped table-hover">
<thead>
<tr>
<th>Geräte Name</th>
<th>Device Name</th>
<th class="text-center">Geräte Typ</th>
<th class="text-center">Hersteller</th>
<th class="text-center">Pop</th>
@@ -83,7 +55,7 @@ $pagination_entity_name = "Device";
<th class="text-center">Seriennummer</th>
<th class="text-center">Preis</th>
<th class="text-center">max. Leistung</th>
<th class="w15"></th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
@@ -111,7 +83,7 @@ $pagination_entity_name = "Device";
<tr>
<td>
<a href="<?= self::getUrl("Device", "detail", ["id" => $device->id]) ?>"><?= $device->name ?></a>
<a href="<?= self::getUrl("Device", "Detail", ["id" => $device->id]) ?>"><?= $device->name ?></a>
</td>
<td class="text-center"><?= $device->devicetype->name ?></td>
<td class="text-center"><?= $device->devicetype->devicemanufactor->name ?></td>
@@ -152,69 +124,13 @@ $pagination_entity_name = "Device";
<script type="text/javascript">
let table;
$('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text();
var hidesearch=[9];
if ($(this).index() == "9") {
} else {
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
}
});
table = $('#datatable').DataTable({
buttons: [
{
extend: 'excelHtml5',
text: 'XLSX Export',
className: 'btn-success margina'
}
],
orderCellsTop: true,
stateSave: true,
"initComplete": function () {
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
$('#clear_cookie').click(function () {
$('input').val('');
table.search('').columns().search('').draw();
});
},
"dom": 'flBrtip'
});
$('#filterrow').on('keyup', 'input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
var state = table.state.loaded();
if (state) {
table.columns().eq(0).each(function (colIdx) {
var colSearch = state.columns[colIdx].search;
if (colSearch.search) {
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
}
});
table.draw();
}
$(document).ready(function () {
});
</script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/datatables-std.js"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -4,43 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Devicemanufactor";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<style>
#filterrow input {
width: 100%;
padding: 3px;
box-sizing: border-box;
display: table-header-group;
height: unset;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;
}
.dataTables_wrapper .dataTables_length {
float: right;
}
.clear-fa {
margin-left: 5px;
font-size: 23px;
vertical-align: middle;
color: #cb2929;
cursor: pointer;
}
.margina {
margin-left: 30px !important;
margin-top: -5px;
}
.edit-weight {
width: 50px;
}
</style>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
@@ -81,7 +45,7 @@ $pagination_entity_name = "Devicemanufactor";
<tr>
<th class="text-center">Name</th>
<th class="text-center">Erstellt von</th>
<th class="edit-weight"></th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
@@ -118,69 +82,13 @@ $pagination_entity_name = "Devicemanufactor";
<script type="text/javascript">
let table;
$('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text();
var hidesearch = [2];
if ($(this).index() == "2") {
} else {
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
}
});
table = $('#datatable').DataTable({
buttons: [
{
extend: 'excelHtml5',
text: 'XLSX Export',
className: 'btn-success margina'
}
],
orderCellsTop: true,
stateSave: true,
"initComplete": function () {
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
$('#clear_cookie').click(function () {
$('input').val('');
table.search('').columns().search('').draw();
});
},
"dom": 'flBrtip'
});
$('#filterrow').on('keyup', 'input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
var state = table.state.loaded();
if (state) {
table.columns().eq(0).each(function (colIdx) {
var colSearch = state.columns[colIdx].search;
if (colSearch.search) {
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
}
});
table.draw();
}
$(document).ready(function () {
});
</script>
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/datatables-std.js"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -1,5 +1,5 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?=self::getResourcePath()?>assets/css/select2-cstm.css" rel="stylesheet" type="text/css" />
<!-- start page title -->
<div class="row">
<div class="col-12">

View File

@@ -4,42 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Devicetype";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<style>
#filterrow input {
width: 100%;
padding: 3px;
box-sizing: border-box;
display: table-header-group;
height: unset;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;
}
.dataTables_wrapper .dataTables_length {
float: right;
}
.clear-fa {
margin-left: 5px;
font-size: 23px;
vertical-align: middle;
color: #cb2929;
cursor: pointer;
}
.margina {
margin-left: 30px !important;
margin-top: -5px;
}
.edit-weight {
width: 50px;
}
</style>
<link href="<?=self::getResourcePath()?>assets/css/datatables-std.css" rel="stylesheet" type="text/css" />
<!-- start page title -->
<div class="row">
<div class="col-12">
@@ -133,70 +98,15 @@ $pagination_entity_name = "Devicetype";
</div>
<script type="text/javascript">
let table;
$('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text();
var hidesearch=[5];
if ($(this).index() == "5") {
} else {
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
}
});
table = $('#datatable').DataTable({
buttons: [
{
extend: 'excelHtml5',
text: 'XLSX Export',
className: 'btn-success margina'
}
],
orderCellsTop: true,
stateSave: true,
"initComplete": function () {
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
$('#clear_cookie').click(function () {
$('input').val('');
table.search('').columns().search('').draw();
});
},
"dom": 'flBrtip'
});
$('#filterrow').on('keyup', 'input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
var state = table.state.loaded();
if (state) {
table.columns().eq(0).each(function (colIdx) {
var colSearch = state.columns[colIdx].search;
if (colSearch.search) {
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
}
});
table.draw();
}
$(document).ready(function () {
});
</script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/datatables-std.js"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -1,10 +1,5 @@
<?php
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Dateien";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?=self::getResourcePath()?>assets/css/datatables-std.css" rel="stylesheet" type="text/css" />
<!-- start page title -->
<div class="row">
@@ -41,14 +36,24 @@ $pagination_entity_name = "Dateien";
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<table id="datatable" class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Beschreibung</th>
<th>Ersteller</th>
<th>Bearbeiter</th>
<th ></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($files as $file): ?>
<tr>
<td><?= $file->name ?></td>
@@ -63,10 +68,9 @@ $pagination_entity_name = "Dateien";
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<?php include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
</div>
@@ -77,9 +81,15 @@ $pagination_entity_name = "Dateien";
<script type="text/javascript">
var hidesearch=[2,3,4];
var cstmdom = "flrtip";
$(document).ready(function () {
});
</script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/datatables-std.js"></script>
<script>
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -2,7 +2,7 @@
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
<style>
.card-border {
@@ -11,6 +11,14 @@
border-radius: 3px;
}
.font-weight-500 {
font-weight: 500;
}
.order-date-pill {
margin: 2px;
white-space: nowrap;
}
</style>
<!-- start page title -->
<div class="row">
@@ -20,13 +28,13 @@
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Device") ?>">Devices</a>
<li class="breadcrumb-item"><a href="<?= self::getUrl("Pop") ?>">Pops</a>
</li>
<li class="breadcrumb-item active">Devices Detail</li>
<li class="breadcrumb-item active">Pop Detail</li>
</ol>
</div>
<h4 class="page-title">Device <?= $devices->data->name ?> <span class="ml-2">
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id]) ?>">
<h4 class="page-title">Pop: <span class="font-weight-normal ml-1"><?= $pops->data->name ?></span> <span class="ml-2">
<a href="<?= self::getUrl("Pop", "edit", ["id" => $pops->id, 'returnto' => "pop-detail"]) ?>">
<button class="btn btn-primary">Bearbeiten</button>
</a>
</span></h4>
@@ -36,11 +44,14 @@
<!-- end page title -->
<?php
if (!empty($devices->price)) {
$price = $devices->price;
} else {
$price = $devices->devicetype->price;
}
$vlans = "";
if (!empty(trim($pops->vlan_public)))
$vlans .= '<span class="order-date-pill active mb-0">Public: <span class="font-weight-500">' . $pops->vlan_public . '</span class="font-weight-500"></span>';
if (!empty(trim($pops->vlan_nat)))
$vlans .= '<span class="order-date-pill active mb-0">Nat: <span class="font-weight-500">' . $pops->vlan_nat . '</span></span>';
if (!empty(trim($pops->vlan_ipv6)))
$vlans .= '<span class="order-date-pill active mb-0">IPv6: <span class="font-weight-500">' . $pops->vlan_ipv6 . '</span></span>';
?>
<div class="row">
<div class="col-12">
@@ -56,113 +67,110 @@ if (!empty($devices->price)) {
<table class="table table-sm">
<tbody>
<tr>
<th>Device Name</th>
<td><?= $devices->name ?> </td>
<th style="min-width: 250px; width: 300px;">Netzgebiet</th>
<td><?= $pops->network->name ?> </td>
</tr>
<tr>
<th>IP-Adresse</th>
<td><?= $devices->ip ?> </td>
<th>Name</th>
<td><?= $pops->name ?> </td>
</tr>
<tr>
<th>Geräte Typ</th>
<td><?= $devices->devicetype->name ?> </td>
<th>Standort</th>
<td>
<a title="Google-Maps: <?= rtrim($pop->gps_lat, '0') ?> , <?= $pop->gps_long ?>"
class="mapsLink"
href="http://maps.google.com/?q=<?= $pops->gps_lat ?> , <?= $pops->gps_long ?>"
target="_blank"><?= rtrim($pops->gps_lat, '0') ?>
, <?= rtrim($pops->gps_long, 0) ?></a></td>
</tr>
<tr>
<th>Geräte Hersteller</th>
<td><?= $devices->devicetype->devicemanufactor->name ?> </td>
<th>Standort Info</th>
<td><?= nl2br($pops->location) ?> </td>
</tr>
<tr>
<th>Mac Adresse</th>
<td><?= $devices->mac ?> </td>
<th>Access VLANs</th>
<td><?= $vlans ?> </td>
</tr>
<tr>
<th>Seriennummer</th>
<td><?= $devices->serial ?> </td>
</tr>
<tr>
<th>Preis</th>
<td><?= $price ?> €</td>
</tr>
<tr>
<th>Bemerkung</th>
<td><?= nl2br($devices->comment) ?> </td>
<th>Interne Notiz</th>
<td><?= nl2br($pops->note) ?> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-4 card-border">
<div class="col-7 card-border">
<div>
<h4>Standort Informationen</h4>
<h4>Pop Devices</h4>
</div>
<?php
if (!empty(trim($devices->pop->name))) {
if (!empty($devices)) {
?>
<div>
<table class="table table-sm">
<tbody>
<tr>
<th>Pop Name</th>
<td><?= $devices->pop->name ?> </td>
</tr>
<tr>
<th>Adresse</th>
<td>
<a title="Google-Maps: <?= rtrim($devices->pop->gps_lat, '0') ?> , <?= $devices->pop->gps_long ?>"
class="mapsLink"
href="http://maps.google.com/?q=<?= $devices->pop->gps_lat ?> , <?= $devices->pop->gps_long ?>"
target="_blank"><?= rtrim($devices->pop->gps_lat, '0') ?>
, <?= rtrim($devices->pop->gps_long, 0) ?></a></td>
</tr>
</tbody>
</table>
</div>
<?php
} else {
?>
<h5 class="text-center">Keine Standort Informationen vorhanden</h5>
<?php
}
?>
</div>
<div class="col-3 card-border">
<div>
<h4>Config Backups</h4>
</div>
<?php
if (!empty($configs)) {
?>
<div>
<table class="table table-sm">
<table id="datatable" class="table table-striped table-hover">
<thead>
<tr>
<th>Datum/Uhrzeit</th>
<th>Geräte Name</th>
<th class="text-center">Geräte Typ</th>
<th class="text-center">Hersteller</th>
<th class="text-center">IP-Adresse</th>
<th class="text-center">Seriennummer</th>
<th class="text-center">Preis</th>
<th class="text-center">max. Leistung</th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<?php
foreach ($devices as $device):
if (!empty($device->price)) {
$price = $device->price;
} else {
$price = $device->devicetype->price;
}
?>
<tr>
<td>
<a href="<?= self::getUrl("Device", "detail", ["id" => $device->id]) ?>"><?= $device->name ?></a>
</td>
<td class="text-center"><?= $device->devicetype->name ?></td>
<td class="text-center"><?= $device->devicetype->devicemanufactor->name ?></td>
<td class="text-center"><?= $device->ip ?></td>
<td class="text-center"><?= $device->serial ?></td>
<td class="text-right"><?= $price ?> €</td>
<td class="text-right"><?= $device->devicetype->power ?> Watt</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php
} else {
?>
<h5 class="text-center">Keine Configs vorhanden</h5>
<h5 class="text-center">Keine Devices vorhanden</h5>
<?php
}
?>
</div>
</div>
</div>
@@ -177,6 +185,6 @@ if (!empty($devices->price)) {
</script>
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/datatables-std.js"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -4,39 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Pops";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<style>
#filterrow input {
width: 100%;
padding: 3px;
box-sizing: border-box;
display: table-header-group;
height: unset;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;
}
.dataTables_wrapper .dataTables_length {
float: right;
}
.clear-fa {
margin-left: 5px;
font-size: 23px;
vertical-align: middle;
color: #cb2929;
cursor: pointer;
}
.margina {
margin-left: 30px !important;
margin-top: -5px;
}
</style>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css" rel="stylesheet" type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
@@ -78,9 +46,9 @@ $pagination_entity_name = "Pops";
<th>Name</th>
<th>Netgebiet</th>
<th>Zutritt</th>
<th>Vlan Public/Nat</th>
<th>Vlan Public/Nat/IPv6</th>
<th>Koordinaten</th>
<th></th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
@@ -94,13 +62,23 @@ $pagination_entity_name = "Pops";
</tr>
</thead>
<tbody>
<?php foreach ($pops as $pop): ?>
<?php foreach ($pops as $pop):
$vlans = "";
if (!empty(trim($pop->vlan_public)))
$vlans .= ' <span class="order-date-pill active mb-0">Public: <span class="font-weight-500">' . $pop->vlan_public . '</span class="font-weight-500"></span>';
if (!empty(trim($pop->vlan_nat)))
$vlans .= ' <span class="order-date-pill active mb-0">Nat: <span class="font-weight-500">' . $pop->vlan_nat . '</span></span>';
if (!empty(trim($pop->vlan_ipv6)))
$vlans .= ' <span class="order-date-pill active mb-0">IPv6: <span class="font-weight-500">' . $pop->vlan_ipv6 . '</span></span>';
?>
<tr>
<td><?= $pop->name ?></td>
<td><a href="<?= self::getUrl("Pop", "Detail", ["id" => $pop->id]) ?>"><?= $pop->name ?></a>
</td>
<td><?= $pop->network->name ?></td>
<td><?= $pop->location ?></td>
<td class="text-center"><?= $pop->vlan_public ?> / <?= $pop->vlan_nat ?></td>
<td class="text-center"><?= trim($vlans) ?></td>
<td class="text-center"><a
title="Google-Maps: <?= rtrim($pop->gps_lat, '0') ?> , <?= $pop->gps_long ?>"
class="mapsLink"
@@ -294,69 +272,11 @@ $pagination_entity_name = "Pops";
<?php if(is_array($filter) && count($filter)): ?>
//refreshMap();
<?php endif; ?>
let table;
$('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text();
if ($(this).index() == "5") {
} else {
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
}
});
table = $('#datatable').DataTable({
buttons: [
{
extend: 'excelHtml5',
text: 'XLSX Export',
className: 'btn-success margina'
}
],
orderCellsTop: true,
stateSave: true,
"initComplete": function () {
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
$('#clear_cookie').click(function () {
$('input').val('');
table.search('').columns().search('').draw();
});
},
"dom": 'flBrtip'
});
$('#filterrow').on('keyup', 'input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
var state = table.state.loaded();
if (state) {
table.columns().eq(0).each(function (colIdx) {
var colSearch = state.columns[colIdx].search;
if (colSearch.search) {
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
}
});
table.draw();
}
var hidesearch = [5];
$(document).ready(function () {
});
</script>
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/datatables-std.js"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -93,13 +93,11 @@ class DeviceController extends mfBaseController
$data = [];
$data['name'] = trim($r->name);
$data['devicetype_id'] = $r->devicetype_id;
if (empty(trim($r->pop_id))) {
if (trim($r->pop_id)=="0") {
$data['pop_id'] = NULL;
} else {
$data['pop_id'] = $r->pop_id;
}
$data['ip'] = $r->ip;
$data['mac'] = $r->mac;
$data['serial'] = $r->serial;
@@ -139,11 +137,38 @@ class DeviceController extends mfBaseController
$this->layout()->setFlash("Device konnte nicht angelegt werden", "error");
$this->redirect("Device");
}
$returnUrl="Device";
$returnAction = "Index";
$returnVariables = array();
$returnAnker = "";
if ($this->request->returnto) {
if (strpos($this->request->returnto, "-") !== false) {
$urls = explode('-', $this->request->returnto);
$urlCounter = 0;
$returnUrlGen = "";
foreach ($urls as $url) {
if ($urlCounter > 0) {
$returnUrlGen .= "/";
}
$returnUrlGen .= ucfirst($url);
$urlCounter++;
}
$returnAction = "";
$returnVariables['id'] = $id;
$returnUrl = $returnUrlGen;
} else {
$returnUrl = ucfirst($this->request->returnto);
}
}
if ($mode == "edit") {
$this->layout()->setFlash("Device erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Device erfolgreich angelegt", "success");
}
$this->redirect("Device");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
}

View File

@@ -100,9 +100,8 @@ class DeviceModel
public static function search($filter) {
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Device", "*", "$where ORDER BY name, network_id");
$res = $db->select("Device", "*", "$where ORDER BY name");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Device($data);
@@ -115,10 +114,10 @@ class DeviceModel
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("network_id", $filter)) {
$networkid = $filter['network_id'];
if(is_numeric($networkid)) {
$where .= " AND network_id=$networkid";
if(array_key_exists("pop_id", $filter)) {
$popid = $filter['pop_id'];
if(is_numeric($popid)) {
$where .= " AND pop_id=$popid";
}
}

View File

@@ -60,7 +60,7 @@ class DevicetypeController extends mfBaseController
$mode = "edit";
$devicetype = new Devicetype($id);
if (!$devicetype->id) {
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
$this->redirect("Devicetype");
}
} else {
@@ -109,14 +109,14 @@ class DevicetypeController extends mfBaseController
$id = $devicetype->save();
if (!$id) {
$this->layout()->setFlash("Gerätehersteller konnte nicht angelegt werden", "error");
$this->layout()->setFlash("Gerätetyp konnte nicht angelegt werden", "error");
$this->redirect("Devicetype");
}
if ($mode == "edit") {
$this->layout()->setFlash("Gerätehersteller erfolgreich geändert", "success");
$this->layout()->setFlash("Gerätetyp erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Gerätehersteller erfolgreich angelegt", "success");
$this->layout()->setFlash("Gerätetyp erfolgreich angelegt", "success");
}
$this->redirect("Devicetype");
}
@@ -127,7 +127,7 @@ class DevicetypeController extends mfBaseController
$id = $this->request->id;
$devicetype = new Devicetype($id);
if (!$devicetype->id || $devicetype->id != $id) {
$this->layout()->setFlash("Gerätehersteller nicht gefunden.", "error");
$this->layout()->setFlash("Gerätetyp nicht gefunden.", "error");
$this->redirect("Devicetype");
}

View File

@@ -1,6 +1,7 @@
<?php
class DevicetypeModel {
class DevicetypeModel
{
public $name = null;
public $power = null;
public $price = null;
@@ -12,16 +13,18 @@ class DevicetypeModel {
public $create = null;
public $edit = null;
public static function find($data) {
public static function find($data)
{
}
public static function create(Array $data) {
public static function create(array $data)
{
$model = new Devicetype();
foreach($data as $field => $value) {
if(property_exists(get_called_class(), $field)) {
if(substr($field, 0, 5) == "vlan_" && !$value) {
foreach ($data as $field => $value) {
if (property_exists(get_called_class(), $field)) {
if (substr($field, 0, 5) == "vlan_" && !$value) {
$model->$field = null;
continue;
}
@@ -30,45 +33,47 @@ class DevicetypeModel {
}
$me = mfValuecache::singleton()->get("me");
if(!$me) {
if (!$me) {
$me = new User();
$me->loadMe();
mfValuecache::singleton()->set("me", $me);
}
if($model->create_by === null) {
if ($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
if ($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id) {
if(!is_numeric($id) || !$id) {
public static function getOne($id)
{
if (!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select("Devicetype", "*", "id=$id LIMIT 1");
if($db->num_rows($res)) {
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Devicetype($data);
}
return $item;
}
public static function getAll() {
public static function getAll()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("Devicetype", "*");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$res = $db->select("Devicetype", "*", "1=1 ORDER BY name");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Devicetype($data);
}
}
@@ -76,15 +81,16 @@ class DevicetypeModel {
}
public static function getFirst() {
public static function getFirst()
{
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id");
if($db->num_rows($res)) {
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Devicetype($data);
if($item->id) {
if ($item->id) {
return $item;
} else {
return null;
@@ -93,27 +99,29 @@ class DevicetypeModel {
return null;
}
public static function search($filter) {
public static function search($filter)
{
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Devicetype($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
private static function getSqlFilter($filter)
{
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("network_id", $filter)) {
if (array_key_exists("network_id", $filter)) {
$networkid = $filter['network_id'];
if(is_numeric($networkid)) {
if (is_numeric($networkid)) {
$where .= " AND network_id=$networkid";
}
}

View File

@@ -35,13 +35,15 @@ class PopController extends mfBaseController
$this->redirect("Pop");
}
$device = new Device($id);
if ($device->id != $id) {
$pop = new Pop($id);
if ($pop->id != $id) {
$this->layout()->setFlash("Pop nicht gefunden", "error");
$this->redirect("Pop");
}
$this->layout()->setTemplate("Pop/Detail");
$filter['pop_id'] = $id;
$this->layout()->set("devices", DeviceModel::search($filter));
$pops = PopModel::getOne($id);
$this->layout()->set("pops", $pops);
@@ -130,11 +132,36 @@ class PopController extends mfBaseController
return $this->addAction();
}
if ($this->request->returnto) {
$this->returUrl = ucfirst($this->request->returnto);
$returnAction = "Index";
$returnVariables = array();
$returnAnker = "";
if (strpos($this->request->returnto, "-") !== false) {
$urls = explode('-', $this->request->returnto);
$urlCounter = 0;
$returnUrl = "";
foreach ($urls as $url) {
if ($urlCounter > 0) {
$returnUrl .= "/";
}
$returnUrl .= ucfirst($url);
$urlCounter++;
}
$returnAction = "";
$returnVariables['id'] = $id;
$this->returUrl = $returnUrl;
var_dump($returnUrl);
} else {
$this->returUrl = ucfirst($this->request->returnto);
}
} else {
$returnAnker = "view=pops&net=" . $pop->network_id;
}
$this->layout()->setFlash("Pop erfolgreich gespeichert.", "success");
$this->redirect($this->returUrl, "Index", [], "view=pops&net=" . $pop->network_id);
$this->redirect($this->returUrl, $returnAction, $returnVariables, $returnAnker);
}

View File

@@ -0,0 +1,42 @@
#filterrow input {
width: 100%;
padding: 3px;
box-sizing: border-box;
display: table-header-group;
height: unset;
}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;
}
.dataTables_wrapper .dataTables_length {
float: right;
}
.clear-fa {
margin-left: 5px;
font-size: 23px;
vertical-align: middle;
color: #cb2929;
cursor: pointer;
}
.margina {
margin-left: 30px !important;
margin-top: -5px;
}
.edit-width {
width: 50px;
}
.order-date-pill {
margin: 2px;
white-space: nowrap;
}
.font-weight-500 {
font-weight: 500;
}

View File

@@ -0,0 +1,11 @@
.select2-container .select2-selection--single {
height: calc(1.5em + 0.9rem + 2px);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: calc(1.5em + 0.9rem + 2px);
}
.select2-container--default .select2-selection--single {
border: 1px solid #ced4da;
}

View File

@@ -0,0 +1,74 @@
let table;
if (typeof hidesearch === "undefined") {
var hidesearch;
hidesearch = [100];
console.log(hidesearch);
}
if (typeof cstmdom === "undefined") {
var cstmdom;
cstmdom = "flBrtip";
}
$('#filterrow th').each(function (i) {
let title = $('#datatable thead th').eq($(this).index()).text();
if (hidesearch.includes($(this).index())) {
} else {
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
}
});
table = $('#datatable').DataTable({
buttons: [
{
extend: 'excelHtml5',
text: 'XLSX Export',
className: 'btn-success margina'
}
],
"language": {
"url": "/datatables/json/german.json"
},
orderCellsTop: true,
stateSave: true,
"initComplete": function () {
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
$('#clear_cookie').click(function () {
$('input').val('');
table.search('').columns().search('').draw();
});
},
"dom": cstmdom
});
$('#filterrow').on('keyup', 'input', function () {
table
.column($(this).data('index'))
.search(this.value)
.draw();
});
let state = table.state.loaded();
if (state) {
table.columns().eq(0).each(function (colIdx) {
var colSearch = state.columns[colIdx].search;
if (colSearch.search) {
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
}
});
table.draw();
}

View File

@@ -0,0 +1,25 @@
{
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "_MENU_ Einträge anzeigen",
"sLoadingRecords": "Wird geladen...",
"sProcessing": "Bitte warten...",
"sSearch": "Suchen",
"sZeroRecords": "Keine Einträge vorhanden.",
"oPaginate": {
"sFirst": "Erste",
"sPrevious": "Zurück",
"sNext": "Nächste",
"sLast": "Letzte"
},
"oAria": {
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
}
}