Device profile settings (#2165)
* Update app_config.php * Update device_profile_edit.php * Update device_setting_delete.php * Update provision.php
This commit is contained in:
@@ -63,7 +63,14 @@
|
||||
$device_key_value = check_str($_POST["device_key_value"]);
|
||||
$device_key_extension = check_str($_POST["device_key_extension"]);
|
||||
$device_key_label = check_str($_POST["device_key_label"]);
|
||||
|
||||
|
||||
//$device_setting_category = check_str($_POST["device_setting_category"]);
|
||||
$device_setting_subcategory = check_str($_POST["device_setting_subcategory"]);
|
||||
//$device_setting_name = check_str($_POST["device_setting_name"]);
|
||||
$device_setting_value = check_str($_POST["device_setting_value"]);
|
||||
$device_setting_enabled = check_str($_POST["device_setting_enabled"]);
|
||||
$device_setting_description = check_str($_POST["device_setting_description"]);
|
||||
|
||||
//allow the domain_uuid to be changed only with the device_profile_domain permission
|
||||
if (permission_exists('device_profile_domain')) {
|
||||
$domain_uuid = check_str($_POST["domain_uuid"]);
|
||||
@@ -122,6 +129,21 @@
|
||||
$x++;
|
||||
}
|
||||
|
||||
$x = 0;
|
||||
foreach ($_POST["device_settings"] as $row) {
|
||||
//unset the empty row
|
||||
if (strlen($row["device_setting_subcategory"]) == 0) {
|
||||
unset($_POST["device_settings"][$x]);
|
||||
}
|
||||
//unset device_detail_uuid if the field has no value
|
||||
if (strlen($row["device_setting_uuid"]) == 0) {
|
||||
unset($_POST["device_settings"][$x]["device_setting_uuid"]);
|
||||
}
|
||||
//increment the row
|
||||
$x++;
|
||||
}
|
||||
|
||||
|
||||
//prepare the array
|
||||
$array['device_profiles'][] = $_POST;
|
||||
|
||||
@@ -246,6 +268,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
//get device settings
|
||||
$sql = "SELECT * FROM v_device_settings ";
|
||||
$sql .= "WHERE device_profile_uuid = '".$device_profile_uuid."' ";
|
||||
$sql .= "ORDER by device_setting_subcategory asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$device_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$device_settings[$x]['device_setting_name'] = '';
|
||||
$device_settings[$x]['device_setting_value'] = '';
|
||||
$device_settings[$x]['enabled'] = '';
|
||||
$device_settings[$x]['device_setting_description'] = '';
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-profile'];
|
||||
@@ -545,6 +579,89 @@
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
//device settings
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-settings']."</td>";
|
||||
echo " <td class='vtable' align='left'>";
|
||||
echo " <table border='0' cellpadding='0' cellspacing='3'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_setting_name']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_setting_value']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-enabled']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_setting_description']."</td>\n";
|
||||
echo " <td> </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
$x = 0;
|
||||
foreach($device_settings as $row) {
|
||||
//determine whether to hide the element
|
||||
if (strlen($device_setting_uuid) == 0) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
//add the primary key uuid
|
||||
if (strlen($row['device_setting_uuid']) > 0) {
|
||||
echo " <input name='device_settings[".$x."][device_setting_uuid]' type='hidden' value=\"".$row['device_setting_uuid']."\"/>\n";
|
||||
}
|
||||
|
||||
//show alls rows in the array
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_settings[".$x."][device_setting_subcategory]' style='width: 120px;' maxlength='255' value=\"".$row['device_setting_subcategory']."\"/>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_settings[".$x."][device_setting_value]' style='width: 120px;' maxlength='255' value=\"".$row['device_setting_value']."\"/>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td align='left'>\n";
|
||||
echo " <select class='formfld' name='device_settings[".$x."][device_setting_enabled]' style='width: 90px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($row['device_setting_enabled'] == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
if ($row['device_setting_enabled'] == "false") {
|
||||
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='device_settings[".$x."][device_setting_description]' style='width: 150px;' maxlength='255' value=\"".$row['device_setting_description']."\"/>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
if (strlen($text['description-settings']) > 0) {
|
||||
echo " <br>".$text['description-settings']."\n";
|
||||
}
|
||||
echo " </td>";
|
||||
|
||||
echo " <td>\n";
|
||||
if (strlen($row['device_setting_uuid']) > 0) {
|
||||
echo " <a href='device_setting_delete.php?device_profile_uuid=".$row['device_profile_uuid']."&id=".$row['device_setting_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
$x++;
|
||||
}
|
||||
/*
|
||||
echo " <td align='left'>\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
|
||||
*/
|
||||
echo " </table>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
|
||||
if (permission_exists('device_profile_domain')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
|
||||
Reference in New Issue
Block a user