Added Asset URI can be used for a remote link

This commit is contained in:
johnnyq 2023-09-09 23:40:18 -04:00
parent be7492ae73
commit 747e793e54
7 changed files with 47 additions and 3 deletions

View File

@ -228,6 +228,16 @@
</div>
</div>
<div class="form-group">
<label>URI</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
</div>
<input type="text" class="form-control" name="uri" placeholder="URI http:// ftp:// ssh: etc">
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-purchase">

View File

@ -223,6 +223,16 @@
</div>
</div>
<div class="form-group">
<label>URI</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
</div>
<input type="text" class="form-control" name="uri" placeholder="URI http:// ftp:// ssh: etc">
</div>
</div>
</div>
<div class="tab-pane fade" id="pillsPurchaseCopy<?php echo $asset_id; ?>">

View File

@ -243,6 +243,16 @@
</div>
</div>
<div class="form-group">
<label>URI</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
</div>
<input type="text" class="form-control" name="uri" placeholder="URI http:// ftp:// ssh: etc" value="<?php echo $asset_uri; ?>">
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-purchase<?php echo $asset_id; ?>">

View File

@ -192,6 +192,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text=" . $asset_ip . "><i class='far fa-copy text-secondary'></i></button>";
}
$asset_mac = nullable_htmlentities($row['asset_mac']);
$asset_uri = nullable_htmlentities($row['asset_uri']);
$asset_status = nullable_htmlentities($row['asset_status']);
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
@ -254,6 +255,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<th>
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i>
<a class="text-secondary" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
<?php if(!empty($asset_uri)){ ?>
<a href="<?php echo $asset_uri; ?>" target="_blank"><i class="fas fa-fw fa-external-link-alt ml-2"></i></a>
<?php } ?>
<?php
if ($login_id > 0) {
?>

View File

@ -1306,6 +1306,14 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.7.9'");
}
if (CURRENT_DATABASE_VERSION == '0.7.9') {
//Insert queries here required to update to DB version 0.8.0
mysqli_query($mysqli, "ALTER TABLE `assets` ADD `asset_uri` VARCHAR(250) DEFAULT NULL AFTER `asset_mac`");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.8.0'");
}
//if (CURRENT_DATABASE_VERSION == '0.7.9') {
//Insert queries here required to update to DB version 0.8.0

View File

@ -5,4 +5,4 @@
* It is used in conjunction with database_updates.php
*/
DEFINE("LATEST_DATABASE_VERSION", "0.7.9");
DEFINE("LATEST_DATABASE_VERSION", "0.8.0");

View File

@ -18,6 +18,7 @@ if (isset($_POST['add_asset'])) {
$os = sanitizeInput($_POST['os']);
$ip = sanitizeInput($_POST['ip']);
$mac = sanitizeInput($_POST['mac']);
$uri = sanitizeInput($_POST['uri']);
$status = sanitizeInput($_POST['status']);
$location = intval($_POST['location']);
$vendor = intval($_POST['vendor']);
@ -45,7 +46,7 @@ if (isset($_POST['add_asset'])) {
$alert_extended = "";
mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_notes = '$notes', asset_network_id = $network, asset_client_id = $client_id");
mysqli_query($mysqli,"INSERT INTO assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_uri = '$uri', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_notes = '$notes', asset_network_id = $network, asset_client_id = $client_id");
$asset_id = mysqli_insert_id($mysqli);
@ -89,6 +90,7 @@ if (isset($_POST['edit_asset'])) {
$os = sanitizeInput($_POST['os']);
$ip = sanitizeInput($_POST['ip']);
$mac = sanitizeInput($_POST['mac']);
$uri = sanitizeInput($_POST['uri']);
$status = sanitizeInput($_POST['status']);
$location = intval($_POST['location']);
$vendor = intval($_POST['vendor']);
@ -118,7 +120,7 @@ if (isset($_POST['edit_asset'])) {
$alert_extended = "";
mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_notes = '$notes', asset_network_id = $network WHERE asset_id = $asset_id");
mysqli_query($mysqli,"UPDATE assets SET asset_name = '$name', asset_description = '$description', asset_type = '$type', asset_make = '$make', asset_model = '$model', asset_serial = '$serial', asset_os = '$os', asset_ip = '$ip', asset_mac = '$mac', asset_uri = '$uri', asset_location_id = $location, asset_vendor_id = $vendor, asset_contact_id = $contact, asset_status = '$status', asset_purchase_date = $purchase_date, asset_warranty_expire = $warranty_expire, asset_install_date = $install_date, asset_notes = '$notes', asset_network_id = $network WHERE asset_id = $asset_id");
//If login exists then update the login
if ($login_id > 0 && !empty($_POST['username'])) {