GUI improvements and new assetclass description

master
Thomas Hooge 2 years ago
parent 6a5c483c42
commit 6ebaea2d45
  1. 1
      assetclassedit.php
  2. 1
      assetclassview.php
  3. 13
      assetview.php
  4. 6
      cable.php
  5. 2
      install/mysql.sql
  6. 7
      lang/de.php
  7. 9
      lang/en.php
  8. 15
      search.php
  9. 25
      submit.php
  10. 4
      subnet.php
  11. 8
      tpl/assetclassadd.tpl
  12. 12
      tpl/assetclassedit.tpl
  13. 4
      tpl/assetclassgroupdel.tpl
  14. 3
      tpl/assetclassgroupedit.tpl
  15. 8
      tpl/assetclassview.tpl
  16. 3
      tpl/assetedit.tpl
  17. 12
      tpl/cableadd.tpl
  18. 14
      tpl/cabledel.tpl
  19. 6
      tpl/cableedit.tpl
  20. 2
      tpl/cableview.tpl
  21. 2
      tpl/locationedit.tpl
  22. 2
      tpl/nodeedit.tpl
  23. 11
      tpl/search.tpl
  24. 3
      tpl/subnetedit.tpl
  25. 5
      tpl/vlanadd.tpl
  26. 3
      tpl/vlanedit.tpl
  27. 3
      tpl/zoneedit.tpl

@ -13,6 +13,7 @@ $assetclass_id = sanitize($_GET['assetclass_id']);
include("header.php");
$sql = "SELECT assetclass_id AS id, assetclass_name AS name,
assetclass_description AS description,
assetclassgroup_id AS group_id
FROM assetclass
WHERE assetclass_id=?";

@ -14,6 +14,7 @@ $assetclass_id = sanitize($_GET['assetclass_id']);
include("header.php");
$sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
a.assetclass_description,
g.assetclassgroup_name, g.assetclassgroup_color
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
WHERE a.assetclass_id=?";

@ -19,17 +19,18 @@ include("header.php");
$sql = "SELECT a.asset_id, a.asset_name, a.asset_hostname, a.asset_info,
a.asset_intf, a.asset_type, c.assetclass_id, c.assetclass_name
FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE a.asset_id=?";
FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE a.asset_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$asset = $sth->fetch(PDO::FETCH_OBJ);
$smarty->assign("asset", $asset);
$sql = "SELECT node_id, node_ip, LEFT(node_info, 40) as node_info
FROM node
WHERE asset_id=?
ORDER BY INET_ATON(node_ip)";
$sql = "SELECT node_id, node_ip,
CONCAT(LEFT(node_info, 40), IF(CHAR_LENGTH(node_info)>40,'...','')) AS node_info
FROM node
WHERE asset_id=?
ORDER BY INET_ATON(node_ip)";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$smarty->assign("nodes", $sth->fetchAll(PDO::FETCH_ASSOC));

@ -35,15 +35,17 @@ switch ($submit = form_get_action()) {
$description = sanitize($_POST['description']);
$color = sanitize($_POST['color']);
$type = sanitize($_POST['cable_type']);
$links = sanitize($_POST['links']);
$info = sanitize($_POST['info']);
$sql = "INSERT INTO cable
(cable_description, cable_color, cable_type, cable_info)
(cable_description, cable_color, cable_type, cable_links, cable_info)
VALUES
(:description, :color, :type, :info)";
(:description, :color, :type, :links, :info)";
$sth = $dbh->prepare($sql);
$sth->bindValue(':description', $description, PDO::PARAM_STR);
$sth->bindValue(':color', $color, PDO::PARAM_STR);
$sth->bindValue(':type', $type, PDO::PARAM_STR);
$sth->bindValue(':links', $info, PDO::PARAM_INT);
$sth->bindValue(':info', $info, PDO::PARAM_STR);
$sth->execute();
$id = $dbh->lastInsertId();

@ -15,6 +15,7 @@ CREATE TABLE assetclass (
assetclass_id int(10) NOT NULL AUTO_INCREMENT,
assetclassgroup_id int(10) NOT NULL,
assetclass_name varchar(100) NOT NULL,
assetclass_description varchar(100) DEFAULT NULL,
PRIMARY KEY (assetclass_id),
INDEX ix_assetclass_name (assetclass_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -28,7 +29,6 @@ CREATE TABLE assetclassgroup (
INDEX ix_assetclassgroup_name (assetclassgroup_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- WIP
CREATE TABLE cable (
cable_id int(10) NOT NULL AUTO_INCREMENT,
cable_description varchar(100) NOT NULL,

@ -32,6 +32,7 @@ $lang = array(
'lang_all' => 'Alle',
'lang_cancel' => 'Abbruch',
'lang_color' => 'Farbe',
'lang_del' => 'Löschen',
'lang_error' => 'Fehler',
'lang_item' => 'Gegenstand',
'lang_language' => 'Sprache',
@ -66,6 +67,7 @@ $lang = array(
'lang_assetclass_del' => 'Objektklasse löschen',
'lang_assetclass_edit' => 'Objektklasse ändern',
'lang_assetclass_name' => 'Objektklassenname',
'lang_assetclass_desc' => 'Beschreibung',
'lang_assetclass_count' => '# Objekte',
'lang_assetclass_none' => 'Es sind keine Objektklassen vorhanden',
@ -104,6 +106,9 @@ $lang = array(
'lang_locationsubnet' => 'Standort/Subnetz',
'lang_locationsubnet_edit' => 'Standort/Subnetz bearbeiten',
'lang_cable_add' => 'Kabel hinzufügen',
'lang_cable_del' => 'Kabel löschen',
'lang_cable_edit' => 'Kabel ändern',
'lang_cable_info' => 'Kabelinfo',
'lang_cable_type' => 'Kabeltyp',
'lang_cable_none' => 'Es sind keine Kabel vorhanden',
@ -169,7 +174,7 @@ $lang = array(
'lang_zone_add' => 'Zone hinzufügen',
'lang_zone_del' => 'Zone löschen',
'lang_zone_edit' => 'Zone bearbeiten',
'lang_zone_edit' => 'Zone ändern',
'lang_zone_none' => 'Es sind keine Zonen vorhanden',
'lang_vlan_add' => 'VLAN hinzufügen',

@ -32,6 +32,7 @@ $lang = array(
'lang_all' => 'All',
'lang_cancel' => 'Cancel',
'lang_color' => 'Color',
'lang_del' => 'Delete',
'lang_error' => 'Error',
'lang_item' => 'Item',
'lang_language' => 'Language',
@ -73,6 +74,7 @@ $lang = array(
'lang_assetclassgroup_del' => 'Delete assetclassgroup',
'lang_assetclassgroup_edit' => 'Modify assetclassgroup',
'lang_assetclassgroup_name' => 'Assetclassgroup Name',
'lang_assetclass_desc' => 'Description',
'lang_assetclassgroup_count' => '# Classes',
'lang_assetclassgroup_none' => 'There are no assetclassegroups defined',
@ -94,7 +96,7 @@ $lang = array(
'lang_location_add' => 'Add location',
'lang_location_del' => 'Delete location',
'lang_location_edit' => 'Mofidy location',
'lang_location_edit' => 'Modify location',
'lang_location_info' => 'Location info',
'lang_location_name' => 'Location name',
'lang_location_parent' => 'Parent',
@ -104,6 +106,9 @@ $lang = array(
'lang_locationsubnet' => 'Location/Subnet',
'lang_locationsubnet_edit' => 'Edit Location/Subnet',
'lang_cable_add' => 'Add cable',
'lang_cable_del' => 'Delete cable',
'lang_cable_edit' => 'Modify cable',
'lang_cable_info' => 'Cable info',
'lang_cable_type' => 'Cable type',
'lang_cable_none' => 'There are no cables defined',
@ -169,7 +174,7 @@ $lang = array(
'lang_zone_add' => 'Add zone',
'lang_zone_del' => 'Delete zone',
'lang_zone_edit' => 'Mofidy zone',
'lang_zone_edit' => 'Modify zone',
'lang_zone_none' => 'There are no zones defined',
'lang_vlan_add' => 'Add VLAN',

@ -28,11 +28,13 @@ $needle = '%' . $search . '%';
$resultcounter = 0;
// asset
$sql = "SELECT asset_id AS id, asset_name AS name, asset_info AS description
FROM asset
WHERE asset_name LIKE :needle OR asset_hostname LIKE :needle
OR asset_info LIKE :needle
ORDER BY asset_name";
$sql = "SELECT a.asset_id AS id, a.asset_name AS name,
CONCAT(LEFT(asset_info, 50), IF(CHAR_LENGTH(asset_info)>50,'...','')) AS description,
c.assetclass_name AS assetclass
FROM asset AS a LEFT JOIN assetclass AS c USING (assetclass_id)
WHERE a.asset_name LIKE :needle OR a.asset_hostname LIKE :needle
OR a.asset_info LIKE :needle
ORDER BY a.asset_name";
$sth = $dbh->prepare($sql);
$sth->execute(['needle' => $needle]);
@ -53,7 +55,8 @@ $resultcounter += count($locations);
$smarty->assign("locations", $locations);
// node
$sql = "SELECT node_id AS id, node_ip AS ip
$sql = "SELECT node_id AS id, node_ip AS ip,
CONCAT(LEFT(node_info, 30), IF(CHAR_LENGTH(node_info)>30,'...','')) AS info
FROM node
WHERE node_ip LIKE :needle OR node_mac LIKE :needle
OR node_dns1 LIKE :needle OR node_dns2 LIKE :needle

@ -121,15 +121,16 @@ if (isset($_POST['add'])) {
break;
case ("assetclass") :
$assetclass_name = sanitize($_POST['assetclass_name']);
$assetclassgroup_id = sanitize($_POST['assetclassgroup_id']);
$name = sanitize($_POST['assetclass_name']);
$description = sanitize($_POST['assetclass_description']);
$group_id = sanitize($_POST['assetclassgroup_id']);
$sql = "INSERT INTO assetclass
(assetclass_name, assetclassgroup_id)
(assetclass_name, assetclass_description, assetclassgroup_id)
VALUE
(?, ?)";
(?, ?, ?)";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_name, $assetclassgroup_id]);
$sth->execute([$name, $description, $group_id]);
header_location("assetclassview.php?assetclass_id=" . $dbh->lastInsertId());
break;
@ -549,17 +550,19 @@ if (isset($_POST['edit'])) {
header_location("assetview.php?asset_id=" . $asset_id);
case ("assetclass") :
$assetclass_id = sanitize($_POST['assetclass_id']);
$assetclass_name = sanitize($_POST['assetclass_name']);
$assetclassgroup_id = sanitize($_POST['assetclassgroup_id']);
$id = sanitize($_POST['assetclass_id']);
$name = sanitize($_POST['assetclass_name']);
$description = sanitize($_POST['assetclass_description']);
$group_id = sanitize($_POST['assetclassgroup_id']);
$sql = "UPDATE assetclass SET
assetclass_name=?, assetclassgroup_id=?
assetclass_name=?, assetclass_description=?,
assetclassgroup_id=?
WHERE assetclass_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_name, $assetclassgroup_id, $assetclass_id]);
$sth->execute([$name, $description, $group_id, $id]);
header_location("assetclassview.php?assetclass_id=" . $assetclass_id);
header_location("assetclassview.php?assetclass_id=" . $id);
break;
case ("assetclassgroup") :

@ -11,8 +11,8 @@ include("includes.php");
include("header.php");
$sql = "SELECT s.subnet_id, s.subnet_address, s.subnet_mask,
s.ntp_server, LEFT(s.subnet_info, 40) AS subnet_info,
CHAR_LENGTH(s.subnet_info) AS subnet_length,
s.ntp_server,
CONCAT(LEFT(s.subnet_info, 50), IF(CHAR_LENGTH(s.subnet_info)>50,'...','')) AS subnet_info,
COUNT(node.subnet_id) AS node_counter
FROM subnet AS s LEFT JOIN node USING (subnet_id)
GROUP BY s.subnet_id

@ -30,6 +30,14 @@
<input type="text" name="assetclass_name">
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclass_desc}
</td>
<td class="value">
<input type="text" name="assetclass_description" size="60" maxlength="100">
</td>
</tr>
</table>
<table class="info">

@ -5,7 +5,8 @@
<table class="title">
<tr>
<td class="header">
{$assetclass->name}
<img class="icon" src="images/brick.png" alt="" />
{$lang_assetclass_edit} : {$assetclass->name}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
@ -31,6 +32,15 @@
<input type="text" name="assetclass_name" value="{$assetclass->name}">
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclass_desc}
</td>
<td class="value">
<input type="text" name="assetclass_description" size="60" maxlength="100" value="{$assetclass->description}">
</td>
</tr>
</table>
<table class="info">

@ -9,13 +9,11 @@
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
<input type="image" name="submit[delete]" src="images/bin.png" alt="{$lang_del}"{if $suser_tooltips} title="{$lang_assetclassgroup_del}"{/if} />
</td>
</tr>
</table>
<p>
<table class="info">
<tr>
<td class="header">

@ -5,7 +5,8 @@
<table class="title">
<tr>
<td class="header">
{$assetclassgroup->name}
<img class="icon" src="images/bricks.png" alt="" />
{$lang_assetclassgroup_edit} : {$assetclassgroup->name}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>

@ -37,6 +37,14 @@
{/if}
</td>
</tr>
<tr>
<td class="label">
{$lang_assetclass_desc}
</td>
<td class="label_right">
{$assetclass->assetclass_description}
</td>
</tr>
</table>
<table class="info">

@ -6,7 +6,8 @@
<table class="title">
<tr>
<td class="header">
{$asset_name}
<img class="icon" src="images/asset.png" alt="" />
{$lang_asset_edit} : {$asset->asset_name}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>

@ -3,6 +3,7 @@
<table class="title">
<tr>
<td class="header">
<img class="icon" src="images/disconnect.png" alt="" />
{$lang_cable_add}
</td>
<td align="right">
@ -17,6 +18,9 @@
<td class="header">
{$lang_cable}
</td>
<td class="header">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
@ -54,6 +58,14 @@
{html_options name=cable_type options=$type_options selected=$cable->cable_type}
</td>
</tr>
<tr>
<td class="label">
# Links
</td>
<td class="value">
<input type="text" size="4" name="links" maxlength="4">
</td>
</tr>
<tr>
<td class="label">
{$lang_color}

@ -1,5 +1,5 @@
<form method="POST" action="cable.php">
<input type="hidden" name="id" value="{$cable->id}">
<input type="hidden" name="id" value="{$id}">
<table class="title">
<tr>
@ -7,12 +7,8 @@
{$lang_cable_del}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
<input type="image" src="image.php?icon=shred" alt="{$lang_assetclass_del}" {if $suser_tooltips}title="{$lang_assetclass_del}" {/if}/>
<a href="#" onClick="history.go(-1)"><img src="images/control_rewind_blue.png" alt="Abbruch"{if $suser_tooltips} title="{$lang_cancel}"{/if} /></a>
<input type="image" name="submit[delete]" src="images/delete.png" alt="Löschen"{if $suser_tooltips} title="Löschen"{/if} />
<a href="#" onClick="history.go(-1)"><img src="images/control_rewind_blue.png" alt="{$lang_cancel}"{if $suser_tooltips} title="{$lang_cancel}"{/if} /></a>
<input type="image" name="submit[delete]" src="images/bin.png" alt="{$lang_del}"{if $suser_tooltips} title="{$lang_cable_del}"{/if} />
</td>
</tr>
</table>
@ -28,10 +24,10 @@
</tr>
<tr>
<td class="label">
{$lang_cable_name}
{$lang_description}
</td>
<td class="value">
<a href="cable.php?id={$cable->id}">{$cable->description}</a>
<a href="cable.php?id={$id}">{$description}</a>
</td>
</tr>
</table>

@ -4,7 +4,8 @@
<table class="title">
<tr>
<td class="header">
{$lang_cable_add}
<img class="icon" src="images/disconnect.png" alt="" />
{$lang_cable_edit} : {$cable->description}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="images/control_rewind_blue.png" alt="{$lang_cancel}"{if $suser_tooltips} title="{$lang_cancel}"{/if} /></a>
@ -18,6 +19,9 @@
<td class="header">
{$lang_cable}
</td>
<td class="header">
&nbsp;
</td>
</tr>
<tr>
<td class="label">

@ -16,7 +16,7 @@
<td class="header">
{$lang_cable}
</td>
<td class="header_right">
<td class="header">
&nbsp;
</td>
</tr>

@ -6,7 +6,7 @@
<tr>
<td class="header">
<img class="icon" src="images/building.png" alt="" />
{$location_name}
{$lang_location_edit} : {$location->name}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>

@ -6,7 +6,7 @@
<tr>
<td class="header">
<img class="icon" src="images/network-ethernet.png" alt="" />
{$node_ip}
{$lang_node_edit} : {$node->ip}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>

@ -28,10 +28,9 @@
{if $assets|@count > 0}
<table class="info">
<tr>
<td class="header">
<td class="header" colspan="3">
{$lang_assets} ({$assets|@count})
</td>
<td class="header"></td>
</tr>
{foreach item=asset from=$assets}
<tr>
@ -41,6 +40,9 @@
<td class="value">
{$asset.description}
</td>
<td class="value">
{$asset.assetclass}
</td>
</tr>
{/foreach}
</table>
@ -66,7 +68,7 @@
{if $nodes|@count > 0}
<table class="info">
<tr>
<td class="header">
<td class="header" colspan="2">
{$lang_nodes} ({$nodes|@count})
</td>
</tr>
@ -75,6 +77,9 @@
<td class="value">
<a href="nodeview.php?node_id={$node.id}">{$node.ip}</a>
</td>
<td class="value">
{$node.info}
</td>
</tr>
{/foreach}
</table>

@ -5,7 +5,8 @@
<table class="title">
<tr>
<td class="header">
{$lang_subnet_edit}
<img class="icon" src="images/plugin.png" alt="" />
{$lang_subnet_edit} : {$subnet->address}/{$subnet->mask}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>

@ -18,6 +18,9 @@
<td class="header">
{$lang_vlan}
</td>
<td class="header">
&nbsp;
</td>
</tr>
<tr>
<td class="label">
@ -40,7 +43,7 @@
{$lang_color}
</td>
<td class="value">
#<input type="text" {literal}class="color {pickerPosition:'right'}"{/literal} name="vlan_color" size="6" maxlength="6" value="{$vlan->color}">
#<input type="text" {literal}class="color {pickerPosition:'right'}"{/literal} name="vlan_color" size="6" maxlength="6">
</td>
</tr>
<tr>

@ -5,7 +5,8 @@
<table class="title">
<tr>
<td class="header">
{$vlan->name}
<img class="icon" src="images/tag-blue.png" alt="" />
{$lang_vlan_edit} : {$vlan->name}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>

@ -5,7 +5,8 @@
<table class="title">
<tr>
<td class="header">
{$zone_origin}
<img class="icon" src="images/table.png" alt="" />
{$lang_zone_edit} : {$zone->zone_origin}
</td>
<td align="right">
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}"></a>