diff --git a/assetadd.php b/assetadd.php
index 980f0f7..d411f44 100644
--- a/assetadd.php
+++ b/assetadd.php
@@ -18,6 +18,12 @@ $sql = "SELECT assetclass_id, assetclass_name
ORDER BY assetclass_name";
$sth = $dbh->query($sql);
+$types = db_load_enum('asset','asset_type');
+
+$smarty->assign("type_ids", $types);
+$smarty->assign("type_names", $types);
+$smarty->assign("type_selected", $types[0]);
+
$assetclass_options = array();
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$assetclass_options[$rec[0]] = $rec[1];
diff --git a/assetedit.php b/assetedit.php
index 7f1e4fb..f5c0e8b 100644
--- a/assetedit.php
+++ b/assetedit.php
@@ -14,13 +14,17 @@ $asset_id = sanitize($_GET['asset_id']);
include("header.php");
$sql = "SELECT asset_id, asset_name, asset_hostname, asset_info, asset_intf,
- assetclass_id
+ assetclass_id, asset_type
FROM asset
WHERE asset_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$smarty->assign("asset", $sth->fetch(PDO::FETCH_OBJ));
+// Type selection
+$smarty->assign("type_ids", ['active', 'passive']);
+$smarty->assign("type_names", ['Active', 'Passive']);
+
$smarty->assign("assetclass_options", db_get_options_assetclass());
$smarty->display("assetedit.tpl");
diff --git a/assetview.php b/assetview.php
index 2580535..12756c7 100644
--- a/assetview.php
+++ b/assetview.php
@@ -14,7 +14,7 @@ $asset_id = sanitize($_GET['asset_id']);
include("header.php");
$sql = "SELECT a.asset_id, a.asset_name, a.asset_hostname, a.asset_info,
- a.asset_intf, c.assetclass_id, c.assetclass_name
+ 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=?";
$sth = $dbh->prepare($sql);
diff --git a/lang/de.php b/lang/de.php
index fa7eac9..9a30f39 100644
--- a/lang/de.php
+++ b/lang/de.php
@@ -57,6 +57,7 @@ $lang = array(
'lang_asset_hostname' => 'Hostname',
'lang_asset_none' => 'Es sind keine Objekte vorhanden',
'lang_asset_intf' => 'Anzahl Schnittstellen',
+ 'lang_asset_type' => 'Objekttyp',
'lang_assetclass_add' => 'Objektklasse hinzufügen',
'lang_assetclass_del' => 'Objektklasse löschen',
diff --git a/lang/en.php b/lang/en.php
index 282ca1a..21b873b 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -57,6 +57,7 @@ $lang = array(
'lang_asset_hostname' => 'Hostname',
'lang_asset_none' => 'There are no assets defined',
'lang_asset_intf' => 'Number of interfaces',
+ 'lang_asset_type' => 'Asset type',
'lang_assetclass_add' => 'Add assetclass',
'lang_assetclass_del' => 'Delete assetclass',
diff --git a/submit.php b/submit.php
index 0d3d688..75b5878 100644
--- a/submit.php
+++ b/submit.php
@@ -107,13 +107,15 @@ if (isset($_POST['add'])) {
$assetclass_id = sanitize($_POST['assetclass_id']);
$info = sanitize($_POST['asset_info']);
$intf = sanitize($_POST['asset_intf']);
+ $asset_type = sanitize($_POST['asset_type']);
$sql = "INSERT INTO asset
- (asset_name, asset_hostname, assetclass_id, asset_info, asset_intf)
+ (asset_name, asset_hostname, assetclass_id, asset_info,
+ asset_intf, asset_type)
VALUE
- (?, ?, ?, ?, ?)";
+ (?, ?, ?, ?, ?, ?)";
$sth = $dbh->prepare($sql);
- $sth->execute([$name, $hostname, $assetclass_id, $info, $intf]);
+ $sth->execute([$name, $hostname, $assetclass_id, $info, $intf, $asset_type]);
header_location("assetview.php?asset_id=" . $dbh->lastInsertId());
break;
@@ -532,14 +534,15 @@ if (isset($_POST['edit'])) {
$asset_intf = sanitize($_POST['asset_intf']);
$asset_hostname = sanitize($_POST['asset_hostname']);
$assetclass_id = sanitize($_POST['assetclass_id']);
+ $asset_type = sanitize($_POST['asset_type']);
$sql = "UPDATE asset SET
asset_name=?, asset_info=?, asset_hostname=?,
- assetclass_id=?, asset_intf=?
+ assetclass_id=?, asset_intf=?, asset_type=?
WHERE asset_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_name, $asset_info, $asset_hostname,
- $assetclass_id, $asset_intf,
+ $assetclass_id, $asset_intf, $asset_type,
$asset_id]);
header_location("assetview.php?asset_id=" . $asset_id);
diff --git a/tpl/assetadd.tpl b/tpl/assetadd.tpl
index 7ed81a4..e22d8b3 100644
--- a/tpl/assetadd.tpl
+++ b/tpl/assetadd.tpl
@@ -54,6 +54,14 @@
+
+
+ {$lang_asset_type}
+ |
+
+ {html_radios name=asset_type values=$type_ids output=$type_names selected=$type_selected}
+ |
+
diff --git a/tpl/assetview.tpl b/tpl/assetview.tpl
index 67bf67c..093713d 100644
--- a/tpl/assetview.tpl
+++ b/tpl/assetview.tpl
@@ -52,6 +52,14 @@
{$asset->asset_intf}
+
+
+ {$lang_asset_type}
+ |
+
+ {$asset->asset_type}
+ |
+