Assettype field for active/passive network-components

master
Thomas Hooge 1 year ago
parent 42e327776c
commit 26e9c89405
  1. 6
      assetadd.php
  2. 6
      assetedit.php
  3. 2
      assetview.php
  4. 1
      lang/de.php
  5. 1
      lang/en.php
  6. 13
      submit.php
  7. 8
      tpl/assetadd.tpl
  8. 8
      tpl/assetedit.tpl
  9. 8
      tpl/assetview.tpl

@ -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];

@ -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");

@ -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);

@ -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',

@ -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',

@ -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);

@ -54,6 +54,14 @@
<input type="text" size="6" maxlength="6" name="asset_intf" value="1">
</td>
</tr>
<tr>
<td class="label">
{$lang_asset_type}
</td>
<td class="value">
{html_radios name=asset_type values=$type_ids output=$type_names selected=$type_selected}
</td>
</tr>
</table>
<table class="info">

@ -56,6 +56,14 @@
<input type="text" size="6" maxlength="6" name="asset_intf" value="{$asset->asset_intf}">
</td>
</tr>
<tr>
<td class="label">
{$lang_asset_type}
</td>
<td class="value">
{html_radios name=asset_type values=$type_ids output=$type_names selected=$asset->asset_type}
</td>
</tr>
</table>
<table class="info">

@ -52,6 +52,14 @@
{$asset->asset_intf}
</td>
</tr>
<tr>
<td class="label">
{$lang_asset_type}
</td>
<td class="value">
{$asset->asset_type}
</td>
</tr>
</table>