Add a link to unset the alternate device.

This commit is contained in:
Mark Crane 2015-05-24 05:00:40 +00:00
parent 05f3ed8e4a
commit be8aba2e39
1 changed files with 28 additions and 3 deletions

View File

@ -347,6 +347,17 @@ require_once "resources/require.php";
//set the sub array index
$x = "999";
//alternate device settings
if (strlen($device_uuid_alternate) > 0) {
$sql = "select * from v_devices ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
$sql .= "and device_uuid = '$device_uuid_alternate' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_alternate = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
}
//get device lines
$sql = "SELECT * FROM v_device_lines ";
$sql .= "where device_uuid = '".$device_uuid."' ";
@ -1125,9 +1136,23 @@ require_once "resources/require.php";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_uuid_alternate']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">\n";
echo "<br />\n";
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
if (strlen($device_uuid_alternate) == 0) {
echo " <input class='formfld' type='text' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">";
}
else {
$label = $device_alternate[0]['device_label'];
if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; }
if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; }
echo " <table>\n";
echo " <tr>\n";
echo " <td><a href='?id=$device_uuid_alternate' id='device_uuid_alternate_link'>$label</a><input class='formfld' type='hidden' name='device_uuid_alternate' id='device_uuid_alternate' maxlength='255' value=\"$device_uuid_alternate\">&nbsp;</td>";
echo " <td><a href='#' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('device_uuid_alternate').value = ''; document.getElementById('device_uuid_alternate_link').hidden = 'true'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>$v_link_label_delete</a></td>\n";
echo " </tr>\n";
echo " </table>\n";
unset($label);
}
echo $text['description-device_uuid_alternate']."\n";
echo "</td>\n";
echo "</tr>\n";