diff --git a/assetclassedit.php b/assetclassedit.php
index c0fe463..4d16503 100644
--- a/assetclassedit.php
+++ b/assetclassedit.php
@@ -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=?";
diff --git a/assetclassview.php b/assetclassview.php
index 9f359d2..b5c17dd 100644
--- a/assetclassview.php
+++ b/assetclassview.php
@@ -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=?";
diff --git a/assetview.php b/assetview.php
index c30afcc..55ed18d 100644
--- a/assetview.php
+++ b/assetview.php
@@ -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));
diff --git a/cable.php b/cable.php
index 7ed2ef6..a7d8d53 100644
--- a/cable.php
+++ b/cable.php
@@ -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();
diff --git a/install/mysql.sql b/install/mysql.sql
index 1a01027..e4f9966 100644
--- a/install/mysql.sql
+++ b/install/mysql.sql
@@ -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,
diff --git a/lang/de.php b/lang/de.php
index 48bc230..4c372f3 100644
--- a/lang/de.php
+++ b/lang/de.php
@@ -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',
diff --git a/lang/en.php b/lang/en.php
index 0b17f0a..02bc48d 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -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',
diff --git a/search.php b/search.php
index 6419334..bcf3479 100644
--- a/search.php
+++ b/search.php
@@ -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
diff --git a/submit.php b/submit.php
index bf43511..902a870 100644
--- a/submit.php
+++ b/submit.php
@@ -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") :
diff --git a/subnet.php b/subnet.php
index 969eb59..50b418e 100644
--- a/subnet.php
+++ b/subnet.php
@@ -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
diff --git a/tpl/assetclassadd.tpl b/tpl/assetclassadd.tpl
index 1168bcf..3f2b1c7 100644
--- a/tpl/assetclassadd.tpl
+++ b/tpl/assetclassadd.tpl
@@ -30,6 +30,14 @@
+
+
+ {$lang_assetclass_desc}
+ |
+
+
+ |
+
diff --git a/tpl/assetclassedit.tpl b/tpl/assetclassedit.tpl
index 07147ce..80096cf 100644
--- a/tpl/assetclassedit.tpl
+++ b/tpl/assetclassedit.tpl
@@ -5,7 +5,8 @@
-
-