diff --git a/Layout/default/Device/Detail.php b/Layout/default/Device/Detail.php index 3a075c56d..6a161376d 100644 --- a/Layout/default/Device/Detail.php +++ b/Layout/default/Device/Detail.php @@ -2,7 +2,7 @@ ?> - +
@@ -74,7 +46,7 @@ $pagination_entity_name = "Device"; - + @@ -83,7 +55,7 @@ $pagination_entity_name = "Device"; - + @@ -111,7 +83,7 @@ $pagination_entity_name = "Device"; @@ -152,69 +124,13 @@ $pagination_entity_name = "Device"; + \ No newline at end of file diff --git a/Layout/default/Devicemanufactor/Index.php b/Layout/default/Devicemanufactor/Index.php index 82ac82ef2..ce8eb742c 100644 --- a/Layout/default/Devicemanufactor/Index.php +++ b/Layout/default/Devicemanufactor/Index.php @@ -4,43 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter]; $pagination_entity_name = "Devicemanufactor"; ?> - - - +
@@ -118,69 +82,13 @@ $pagination_entity_name = "Devicemanufactor"; + \ No newline at end of file diff --git a/Layout/default/Devicetype/Form.php b/Layout/default/Devicetype/Form.php index a0924f17f..ac4f20d18 100644 --- a/Layout/default/Devicetype/Form.php +++ b/Layout/default/Devicetype/Form.php @@ -1,5 +1,5 @@ - +
diff --git a/Layout/default/Devicetype/Index.php b/Layout/default/Devicetype/Index.php index 7830f643d..f09a21d50 100644 --- a/Layout/default/Devicetype/Index.php +++ b/Layout/default/Devicetype/Index.php @@ -4,42 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter]; $pagination_entity_name = "Devicetype"; ?> - - - +
@@ -133,70 +98,15 @@ $pagination_entity_name = "Devicetype";
+ + \ No newline at end of file diff --git a/Layout/default/Filestore/Index.php b/Layout/default/Filestore/Index.php index e2e52cbb7..36395207d 100644 --- a/Layout/default/Filestore/Index.php +++ b/Layout/default/Filestore/Index.php @@ -1,10 +1,5 @@ -getUrl($Mod, "Index"); -$pagination_baseurl_params = ["filter" => $filter]; -$pagination_entity_name = "Dateien"; -?> - +
@@ -41,14 +36,24 @@ $pagination_entity_name = "Dateien"; -
Geräte NameDevice Name Geräte Typ Hersteller PopSeriennummer Preis max. Leistung
- $device->id]) ?>">name ?> + $device->id]) ?>">name ?> devicetype->name ?> devicetype->devicemanufactor->name ?>
+
+ + + + + + + + + + @@ -63,10 +68,9 @@ $pagination_entity_name = "Dateien"; +
Name Beschreibung Ersteller Bearbeiter
name ?>
- -
@@ -77,9 +81,15 @@ $pagination_entity_name = "Dateien"; + + - \ No newline at end of file diff --git a/Layout/default/Pop/Detail.php b/Layout/default/Pop/Detail.php index 3a075c56d..6cfd89bb6 100644 --- a/Layout/default/Pop/Detail.php +++ b/Layout/default/Pop/Detail.php @@ -2,7 +2,7 @@ ?> - +
@@ -20,13 +28,13 @@
-

Device data->name ?> - $devices->id]) ?>"> +

Pop: data->name ?> + $pops->id, 'returnto' => "pop-detail"]) ?>">

@@ -36,11 +44,14 @@ price)) { - $price = $devices->price; -} else { - $price = $devices->devicetype->price; -} +$vlans = ""; + +if (!empty(trim($pops->vlan_public))) + $vlans .= 'Public: ' . $pops->vlan_public . ''; +if (!empty(trim($pops->vlan_nat))) + $vlans .= 'Nat: ' . $pops->vlan_nat . ''; +if (!empty(trim($pops->vlan_ipv6))) + $vlans .= 'IPv6: ' . $pops->vlan_ipv6 . ''; ?>
@@ -56,113 +67,110 @@ if (!empty($devices->price)) { - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - + + +
Device Namename ?> Netzgebietnetwork->name ?>
IP-Adresseip ?> Namename ?>
Geräte Typdevicetype->name ?> Standort + gps_lat, '0') ?> + , gps_long, 0) ?>
Geräte Herstellerdevicetype->devicemanufactor->name ?> Standort Infolocation) ?>
Mac Adressemac ?> Access VLANs
Seriennummerserial ?>
Preis
Bemerkungcomment) ?> Interne Notiznote) ?>
-
+
-

Standort Informationen

+

Pop Devices

pop->name))) { + if (!empty($devices)) { ?>
- - - - - - - - - - - - -
Pop Namepop->name ?>
Adresse - pop->gps_lat, '0') ?> - , pop->gps_long, 0) ?>
-
- -
Keine Standort Informationen vorhanden
- - - - -
-
-
-

Config Backups

-
- -
- +
- + + + + + + + + + + + + + + + - - - - + price)) { + $price = $device->price; + } else { + $price = $device->devicetype->price; + } + ?> + + + + + + + + + + + + +
Datum/UhrzeitGeräte NameGeräte TypHerstellerIP-AdresseSeriennummerPreismax. Leistung
+ $device->id]) ?>">name ?> + devicetype->name ?>devicetype->devicemanufactor->name ?>ip ?>serial ?>devicetype->power ?> Watt
-
Keine Configs vorhanden
+
Keine Devices vorhanden
+ +
+
@@ -177,6 +185,6 @@ if (!empty($devices->price)) { - + \ No newline at end of file diff --git a/Layout/default/Pop/Index.php b/Layout/default/Pop/Index.php index 415ab89c2..4f20cdddd 100644 --- a/Layout/default/Pop/Index.php +++ b/Layout/default/Pop/Index.php @@ -4,52 +4,7 @@ $pagination_baseurl_params = ["filter" => $filter]; $pagination_entity_name = "Pops"; ?> - - - +
@@ -111,18 +66,19 @@ $pagination_entity_name = "Pops"; $vlans = ""; if (!empty(trim($pop->vlan_public))) - $vlans .= 'Public: ' . $pop->vlan_public . ''; + $vlans .= ' Public: ' . $pop->vlan_public . ''; if (!empty(trim($pop->vlan_nat))) - $vlans .= 'Nat: ' . $pop->vlan_nat . ''; + $vlans .= ' Nat: ' . $pop->vlan_nat . ''; if (!empty(trim($pop->vlan_ipv6))) - $vlans .= 'IPv6: ' . $pop->vlan_ipv6 . ''; + $vlans .= ' IPv6: ' . $pop->vlan_ipv6 . ''; ?> - name ?> + $pop->id]) ?>">name ?> + network->name ?> location ?> - + //refreshMap(); - let table; - $('#filterrow th').each(function (i) { - let title = $('#datatable thead th').eq($(this).index()).text(); - - if ($(this).index() == "5") { - - } else { - $(this).html(''); - } - }); - - table = $('#datatable').DataTable({ - buttons: [ - { - extend: 'excelHtml5', - text: 'XLSX Export', - className: 'btn-success margina' - - } - ], - orderCellsTop: true, - stateSave: true, - "initComplete": function () { - $('#datatable_filter').append(''); - $('#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 () { }); - + \ No newline at end of file diff --git a/application/Device/DeviceController.php b/application/Device/DeviceController.php index 4ff29c800..328dae192 100644 --- a/application/Device/DeviceController.php +++ b/application/Device/DeviceController.php @@ -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); } } \ No newline at end of file diff --git a/application/Device/DeviceModel.php b/application/Device/DeviceModel.php index cd231746d..cd7bfb807 100644 --- a/application/Device/DeviceModel.php +++ b/application/Device/DeviceModel.php @@ -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"; } } diff --git a/application/Devicetype/DevicetypeController.php b/application/Devicetype/DevicetypeController.php index cf5fd500d..3fbe660d6 100644 --- a/application/Devicetype/DevicetypeController.php +++ b/application/Devicetype/DevicetypeController.php @@ -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"); } diff --git a/application/Devicetype/DevicetypeModel.php b/application/Devicetype/DevicetypeModel.php index f52f7f82f..dfa849cbf 100644 --- a/application/Devicetype/DevicetypeModel.php +++ b/application/Devicetype/DevicetypeModel.php @@ -1,6 +1,7 @@ $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"; } } diff --git a/application/Pop/PopController.php b/application/Pop/PopController.php index bc4a7c40c..b4a9c6f74 100644 --- a/application/Pop/PopController.php +++ b/application/Pop/PopController.php @@ -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); } diff --git a/public/assets/css/datatables-std.css b/public/assets/css/datatables-std.css new file mode 100644 index 000000000..64953aef9 --- /dev/null +++ b/public/assets/css/datatables-std.css @@ -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; +} diff --git a/public/assets/css/select2-cstm.css b/public/assets/css/select2-cstm.css new file mode 100644 index 000000000..f9258132e --- /dev/null +++ b/public/assets/css/select2-cstm.css @@ -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; +} \ No newline at end of file diff --git a/public/assets/js/datatables-std.js b/public/assets/js/datatables-std.js new file mode 100644 index 000000000..ef9f7875c --- /dev/null +++ b/public/assets/js/datatables-std.js @@ -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(''); + } +}); + +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(''); + $('#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(); +} \ No newline at end of file diff --git a/public/datatables/json/german.json b/public/datatables/json/german.json new file mode 100644 index 000000000..5e3753a41 --- /dev/null +++ b/public/datatables/json/german.json @@ -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" + } +}