From f0992b4b6482aaeed852a11963e94a446bf62f43 Mon Sep 17 00:00:00 2001 From: Thomas Hooge Date: Fri, 3 Mar 2023 07:48:35 +0100 Subject: [PATCH] Some more minor GUI improvements --- index.php | 28 ++++++++++++++++++++++------ lang/de.php | 1 + lang/en.php | 1 + location.php | 1 + node.php | 6 ++++-- tpl/index.tpl | 34 ++++++++++++++++++++++++++++++++++ tpl/location.tpl | 4 ++-- tpl/node.tpl | 6 ++++++ 8 files changed, 71 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 2495d89..031717f 100644 --- a/index.php +++ b/index.php @@ -14,29 +14,45 @@ include("header.php"); // Statistics // asset -$sth = $dbh->query("SELECT COUNT(asset_id) AS asset_counter FROM asset"); +$sth = $dbh->query("SELECT COUNT(asset_id) FROM asset"); $smarty->assign("asset_counter", $sth->fetchColumn()); +// assetclass +$sth = $dbh->query("SELECT COUNT(assetclass_id) AS asset_counter FROM assetclass"); +$smarty->assign("assetclass_counter", $sth->fetchColumn()); + +// assetclassgroup +$sth = $dbh->query("SELECT COUNT(assetclassgroup_id) FROM assetclassgroup"); +$smarty->assign("assetclassgroup_counter", $sth->fetchColumn()); + // location -$sth = $dbh->query("SELECT COUNT(location_id) AS location_counter FROM location"); +$sth = $dbh->query("SELECT COUNT(location_id) FROM location"); $smarty->assign("location_counter", $sth->fetchColumn()); // node -$sth = $dbh->query("SELECT COUNT(node_id) AS node_counter FROM node"); +$sth = $dbh->query("SELECT COUNT(node_id) FROM node"); $smarty->assign("node_counter", $sth->fetchColumn()); // subnet -$sth = $dbh->query("SELECT COUNT(subnet_id) AS subnet_counter FROM subnet"); +$sth = $dbh->query("SELECT COUNT(subnet_id) FROM subnet"); $smarty->assign("subnet_counter", $sth->fetchColumn()); +// nat +$sth = $dbh->query("SELECT COUNT(nat_id) FROM nat"); +$smarty->assign("nat_counter", $sth->fetchColumn()); + // vlan -$sth = $dbh->query("SELECT COUNT(vlan_id) AS vlan_counter FROM vlan"); +$sth = $dbh->query("SELECT COUNT(vlan_id) FROM vlan"); $smarty->assign("vlan_counter", $sth->fetchColumn()); // zone -$sth = $dbh->query("SELECT COUNT(zone_id) AS zone_counter FROM zone"); +$sth = $dbh->query("SELECT COUNT(zone_id) FROM zone"); $smarty->assign("zone_counter", $sth->fetchColumn()); +// cable +$sth = $dbh->query("SELECT COUNT(cable_id) FROM cable"); +$smarty->assign("cable_counter", $sth->fetchColumn()); + $smarty->display("index.tpl"); include("footer.php"); diff --git a/lang/de.php b/lang/de.php index 4c372f3..464a3c8 100644 --- a/lang/de.php +++ b/lang/de.php @@ -99,6 +99,7 @@ $lang = array( 'lang_location_edit' => 'Standort ändern', 'lang_location_info' => 'Standortinfo', 'lang_location_name' => 'Standortname', + 'lang_location_hierarchy' => 'Standorthierarchie', 'lang_location_parent' => 'Übergeordneter Standort', 'lang_sublocation_add' => 'Unterstandort hinzufügen', 'lang_location_none' => 'Es sind keine Standorte vorhanden', diff --git a/lang/en.php b/lang/en.php index 02bc48d..1ebf284 100644 --- a/lang/en.php +++ b/lang/en.php @@ -99,6 +99,7 @@ $lang = array( 'lang_location_edit' => 'Modify location', 'lang_location_info' => 'Location info', 'lang_location_name' => 'Location name', + 'lang_location_hierarchy' => 'Location hierarchy', 'lang_location_parent' => 'Parent', 'lang_sublocation_add' => 'Add Sub-location', 'lang_location_none' => 'There are no locations defined', diff --git a/location.php b/location.php index 660c4f9..611705d 100644 --- a/location.php +++ b/location.php @@ -16,6 +16,7 @@ $sql = "SELECT location_id AS id, location_name AS value, location_parent AS par ORDER BY location_parent, location_sort, location_name"; $sth = $dbh->query($sql); $locations = $sth->fetchAll(); +$smarty->assign('location_count', count($locations)); // function for recursion function build_tree($parent_id, $level) { diff --git a/node.php b/node.php index f4a1a10..196b7ce 100644 --- a/node.php +++ b/node.php @@ -34,9 +34,11 @@ if(isset($_GET['subnet_id'])) { // create sql with optional filter $where = join(' AND ', $w); -$sql = "SELECT a.asset_id, a.asset_info, +$sql = "SELECT a.asset_id, + CONCAT(LEFT(a.asset_info,30), IF(CHAR_LENGTH(a.asset_info)>30,'...','')) AS asset_info, REPLACE(a.asset_name, ' ', ' ') AS asset_name, - n.node_id, n.node_ip + n.node_id, n.node_ip, + CONCAT(LEFT(n.node_info,30), IF(CHAR_LENGTH(n.node_info)>30,'...','')) AS node_info FROM node AS n LEFT JOIN asset AS a USING (asset_id)"; if ($where) { $sql .= ' WHERE ' . $where; diff --git a/tpl/index.tpl b/tpl/index.tpl index c58bcf4..fe7d61d 100644 --- a/tpl/index.tpl +++ b/tpl/index.tpl @@ -18,6 +18,22 @@ {$asset_counter} + + + {$lang_assetclasses} + + + {$assetclass_counter} + + + + + {$lang_assetclassgroups} + + + {$assetclassgroup_counter} + + {$lang_locations} @@ -34,6 +50,14 @@ {$node_counter} + + + {$lang_nat_rules} + + + {$nat_counter} + + {$lang_subnets} @@ -58,4 +82,14 @@ {$zone_counter} +{if $suser_admin} + + + {$lang_cables} + + + {$cable_counter} + + +{/if} diff --git a/tpl/location.tpl b/tpl/location.tpl index 17ce48c..091434c 100644 --- a/tpl/location.tpl +++ b/tpl/location.tpl @@ -2,7 +2,7 @@ - {$lang_locations} ({$locations|@count}) + {$lang_locations} ({$location_count}) {if $suser_add || $suser_admin} @@ -16,7 +16,7 @@ diff --git a/tpl/node.tpl b/tpl/node.tpl index a0f0066..6ca28fb 100644 --- a/tpl/node.tpl +++ b/tpl/node.tpl @@ -16,6 +16,9 @@ + @@ -28,6 +31,9 @@ +
- {$lang_location_name} + {$lang_location_hierarchy}
{$lang_ip} + {$lang_node_info} + {$lang_asset_name} {if $node.node_ip}{$node.node_ip}{else}(leer){/if} + {$node.node_info} + {$node.asset_name}