diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 5ea0cff59c..1e01fc4a5f 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -503,6 +503,15 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_profile_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_device_profiles"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "device_profile_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $y = 3; //table array index $z = 0; //field array index diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 78adb69185..6aabb82e13 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -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 " "; echo " "; +//device settings + echo "
| ".$text['label-device_setting_name']." | \n"; + echo "".$text['label-device_setting_value']." | \n"; + echo "".$text['label-enabled']." | \n"; + echo "".$text['label-device_setting_description']." | \n"; + echo "\n"; + echo " |
| \n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + if (strlen($text['description-settings']) > 0) { + echo "\n"; + if (strlen($row['device_setting_uuid']) > 0) { + echo " $v_link_label_delete\n"; + } + echo " | \n"; + echo "\n"; + echo " \n"; + */ + echo " |