From 2d889a0e8d5ab6cd06684b09cc646366bb54873e Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 29 Dec 2013 06:47:25 +0000 Subject: [PATCH] Add Device Key Category. --- app/devices/app_config.php | 6 ++- app/devices/app_languages.php | 15 ++++++++ app/devices/device_edit.php | 65 ++++++++++++++++++++++++--------- app/devices/device_key_edit.php | 43 ++++++++++++++++++++++ 4 files changed, 111 insertions(+), 18 deletions(-) diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 7eb68bed97..404a4dfdf3 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -349,6 +349,10 @@ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_devices'; $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'device_uuid'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_category'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.'; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_id'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the key ID.'; @@ -366,4 +370,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the label.'; $z++; -?> +?> \ No newline at end of file diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index 5f5c04f2ef..6459ed3130 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -229,6 +229,12 @@ $text['description-device_key']['en-us'] = 'Select the key.'; $text['description-device_key']['pt-pt'] = ''; + $text['label-device_key_category']['en-us'] = 'Category'; + $text['label-device_key_category']['pt-pt'] = ''; + + $text['description-device_key_category']['en-us'] = 'Select the category.'; + $text['description-device_key_category']['pt-pt'] = ''; + $text['label-device_key_type']['en-us'] = 'Type'; $text['label-device_key_type']['pt-pt'] = ''; @@ -256,6 +262,15 @@ $text['label-park']['en-us'] = 'park'; $text['label-park']['pt-pt'] = ''; + $text['label-programmable']['en-us'] = 'programmable'; + $text['label-programmable']['pt-pt'] = ''; + + $text['label-memory']['en-us'] = 'memory'; + $text['label-memory']['pt-pt'] = ''; + + $text['label-expansion']['en-us'] = 'expansion'; + $text['label-expansion']['pt-pt'] = ''; + //general translations $text['label-true']['en-us'] = "true"; $text['label-true']['pt-pt'] = "sim"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index c1bbd0bdde..98a928d97d 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -555,6 +555,7 @@ require_once "resources/require.php"; echo " \n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -593,23 +594,53 @@ require_once "resources/require.php"; } echo "\n"; - echo " \n"; + echo "\n"; + + echo "\n"; echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
".$text['label-device_key_id']."".$text['label-device_key_category']."".$text['label-device_key_type']."".$text['label-device_key_value']."".$text['label-device_key_label']."
\n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo "\n"; + echo " \n"; + echo "\n"; echo " \n"; diff --git a/app/devices/device_key_edit.php b/app/devices/device_key_edit.php index 3c88deab9d..4c6e5694c3 100644 --- a/app/devices/device_key_edit.php +++ b/app/devices/device_key_edit.php @@ -57,6 +57,7 @@ else { //get http post variables and set them to php variables if (count($_POST)>0) { $device_key_id = check_str($_POST["device_key_id"]); + $device_key_category = check_str($_POST["device_key_category"]); $device_key_type = check_str($_POST["device_key_type"]); $device_key_value = check_str($_POST["device_key_value"]); $device_key_label = check_str($_POST["device_key_label"]); @@ -71,6 +72,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //check for all required data //if (strlen($device_key_id) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_id']."
\n"; } + //if (strlen($device_key_category) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_category']."
\n"; } //if (strlen($device_key_type) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_type']."
\n"; } //if (strlen($device_key_value) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_value']."
\n"; } //if (strlen($device_key_label) == 0) { $msg .= $text['message-required']." ".$text['label-device_key_label']."
\n"; } @@ -97,6 +99,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "device_uuid, "; $sql .= "device_key_id, "; $sql .= "device_key_type, "; + $sql .= "device_key_type, "; $sql .= "device_key_value, "; $sql .= "device_key_label "; $sql .= ")"; @@ -107,6 +110,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$device_uuid', "; $sql .= "'$device_key_id', "; $sql .= "'$device_key_type', "; + $sql .= "'$device_key_type', "; $sql .= "'$device_key_value', "; $sql .= "'$device_key_label' "; $sql .= ")"; @@ -126,6 +130,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql = "update v_device_keys set "; $sql .= "device_key_id = '$device_key_id', "; $sql .= "device_key_type = '$device_key_type', "; + $sql .= "device_key_type = '$device_key_type', "; $sql .= "device_key_value = '$device_key_value', "; $sql .= "device_key_label = '$device_key_label' "; $sql .= "where domain_uuid = '$domain_uuid' "; @@ -156,6 +161,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { $device_key_id = $row["device_key_id"]; $device_key_type = $row["device_key_type"]; + $device_key_type = $row["device_key_type"]; $device_key_value = $row["device_key_value"]; $device_key_label = $row["device_key_label"]; } @@ -180,6 +186,43 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; + echo " ".$text['label-device_key_category'].":\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-device_key_category']."\n"; + echo "
\n"; echo " ".$text['label-device_key_id'].": \n";