Devices: Added GUI for new Key Profiles feature.

Destinations: Fixed missing label.
This commit is contained in:
Nate Jones
2015-02-15 00:33:56 +00:00
parent cc8677bbc8
commit 69d4caeed6
10 changed files with 1328 additions and 351 deletions

View File

@@ -102,6 +102,24 @@
$apps[$x]['permissions'][$y]['name'] = 'device_domain';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_profile_view";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_profile_add";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_profile_edit";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "device_profile_delete";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = 'device_profile_domain';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
@@ -132,6 +150,15 @@
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$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++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "v_id";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
@@ -172,16 +199,6 @@
$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']['text'] = "device_username";
//$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "phone_username";
//$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']['text'] = "device_password";
//$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "phone_password";
//$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']['text'] = "device_time_zone";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "phone_time_zone";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
@@ -337,6 +354,15 @@
$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_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++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the key ID.';
@@ -366,4 +392,34 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the label.';
$z++;
$y = 4; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_device_profiles';
$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'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_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_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "device_profile_name";
$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_enabled";
$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_description";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
?>

View File

@@ -76,7 +76,7 @@
$text['description-device_model']['pt-pt'] = "Introduza o nome do modelo ou número.";
$text['description-device_model']['fr-fr'] = "Entrer le nom ou le numéro du modèle";
$text['label-device_firmware_version']['en-us'] = "Firmware Version";
$text['label-device_firmware_version']['en-us'] = "Firmware";
$text['label-device_firmware_version']['es-cl'] = "Versión de Firmware";
$text['label-device_firmware_version']['pt-pt'] = "Versão do Firmware";
$text['label-device_firmware_version']['fr-fr'] = "Version Firmware";
@@ -236,6 +236,88 @@
$text['description-device_description']['pt-pt'] = "Introduza a descrição.";
$text['description-device_description']['fr-fr'] = "Entrez la description.";
//profiles
$text['title-profiles']['en-us'] = "Key Profiles";
$text['title-profiles']['es-cl'] = "Perfiles Clave";
$text['title-profiles']['pt-pt'] = "Perfis-Chave";
$text['title-profiles']['fr-fr'] = "Profils Clés";
$text['title-profile']['en-us'] = "Key Profile";
$text['title-profile']['es-cl'] = "Perfil Clave";
$text['title-profile']['pt-pt'] = "Perfil Chave";
$text['title-profile']['fr-fr'] = "Profil Clés";
$text['header-profiles']['en-us'] = "Key Profiles";
$text['header-profiles']['es-cl'] = "Perfiles Clave";
$text['header-profiles']['pt-pt'] = "Perfis-Chave";
$text['header-profiles']['fr-fr'] = "Profils Clés";
$text['description-profiles']['en-us'] = "Define a set of keys as a profile. Any changes to the profile effect all devices assigned to the profile.";
$text['description-profiles']['es-cl'] = "Definir un conjunto de claves como un perfil. Cualquier cambio en el perfil de efectos todos los dispositivos asignados al perfil.";
$text['description-profiles']['pt-pt'] = "Defina um conjunto de chaves como um perfil. Quaisquer mudanças no perfil de todos os dispositivos de efeito atribuído ao perfil.";
$text['description-profiles']['fr-fr'] = "Définir un ensemble de touches comme un profil. Toute modification apportée à l'effet de profil tous les appareils affectés au profil.";
$text['header-profile']['en-us'] = "Key Profile";
$text['header-profile']['es-cl'] = "Perfil Clave";
$text['header-profile']['pt-pt'] = "Perfil Chave";
$text['header-profile']['fr-fr'] = "Profil Clés";
$text['description-profile']['en-us'] = "Define the assignments for this key profile.";
$text['description-profile']['es-cl'] = "Definir las asignaciones para este perfil de llave.";
$text['description-profile']['pt-pt'] = "Definir as atribuições para esse perfil de chave.";
$text['description-profile']['fr-fr'] = "Définir les missions pour ce profil de clé.";
$text['label-profile']['en-us'] = "Key Profile";
$text['label-profile']['es-cl'] = "Perfil Clave";
$text['label-profile']['pt-pt'] = "Perfil Chave";
$text['label-profile']['fr-fr'] = "Profil Clés";
$text['description-profile2']['en-us'] = "Select a Key Profile and/or define custom keys below.";
$text['description-profile2']['es-cl'] = "Seleccione un perfil de llave y / o definir teclas personalizadas a continuación.";
$text['description-profile2']['pt-pt'] = "Selecione um perfil Key e / ou definir chaves personalizados abaixo.";
$text['description-profile2']['fr-fr'] = "Sélectionnez un profil à clé et / ou définir des touches personnalisées ci-dessous.";
$text['button-profiles']['en-us'] = "Key Profiles";
$text['button-profiles']['es-cl'] = "Perfiles Clave";
$text['button-profiles']['pt-pt'] = "Perfis-Chave";
$text['button-profiles']['fr-fr'] = "Profils Clés";
$text['label-profile_name']['en-us'] = "Name";
$text['label-profile_name']['es-cl'] = "Nombre";
$text['label-profile_name']['pt-pt'] = "Nome";
$text['label-profile_name']['fr-fr'] = "Nom";
$text['description-profile_name']['en-us'] = "Enter a name to identify this profile.";
$text['description-profile_name']['es-cl'] = "Introduzca un nombre para identificar este perfil.";
$text['description-profile_name']['pt-pt'] = "Digite um nome para identificar este perfil.";
$text['description-profile_name']['fr-fr'] = "Entrez un nom pour identifier ce profil.";
$text['label-profile_domain']['en-us'] = "Domain";
$text['label-profile_domain']['es-cl'] = "Dominio";
$text['label-profile_domain']['pt-pt'] = "Domínio";
$text['label-profile_domain']['fr-fr'] = "Domaine";
$text['label-profile_enabled']['en-us'] = "Enabled";
$text['label-profile_enabled']['es-cl'] = "Activado";
$text['label-profile_enabled']['pt-pt'] = "Activado";
$text['label-profile_enabled']['fr-fr'] = "Actif";
$text['description-profile_enabled']['en-us'] = "Select the current state of this profile.";
$text['description-profile_enabled']['es-cl'] = "Seleccione el estado actual de este perfil.";
$text['description-profile_enabled']['pt-pt'] = "Selecione o estado atual deste perfil.";
$text['description-profile_enabled']['fr-fr'] = "Sélectionnez l'état actuel de ce profil.";
$text['label-profile_description']['en-us'] = "Description";
$text['label-profile_description']['es-cl'] = "Descripción";
$text['label-profile_description']['pt-pt'] = "Descrição";
$text['label-profile_description']['fr-fr'] = "Description";
$text['description-profile_description']['en-us'] = "Additional details about this profile.";
$text['description-profile_description']['es-cl'] = "Detalles adicionales acerca de este perfil.";
$text['description-profile_description']['pt-pt'] = "Detalhes adicionais sobre este perfil.";
$text['description-profile_description']['fr-fr'] = "Des détails supplémentaires sur ce profil.";
//keys
$text['label-keys']['en-us'] = "Keys";
$text['label-keys']['es-cl'] = "Claves";

View File

@@ -98,6 +98,8 @@ require_once "resources/require.php";
$user_id = check_str($_POST["user_id"]);
$auth_id = check_str($_POST["auth_id"]);
$password = check_str($_POST["password"]);
//profile
$device_profile_uuid = check_str($_POST["device_profile_uuid"]);
//keys
$device_key_category = check_str($_POST["device_key_category"]);
$device_key_id = check_str($_POST["device_key_id"]);
@@ -277,6 +279,7 @@ require_once "resources/require.php";
$device_firmware_version = $row["device_firmware_version"];
$device_provision_enable = $row["device_provision_enable"];
$device_template = $row["device_template"];
$device_profile_uuid = $row["device_profile_uuid"];
$device_description = $row["device_description"];
}
unset ($prep_statement);
@@ -312,7 +315,7 @@ require_once "resources/require.php";
$sql .= "ORDER by ";
$sql .= "CASE device_key_category ";
$sql .= "WHEN 'line' THEN 1 ";
$sql .= "WHEN 'memort' THEN 2 ";
$sql .= "WHEN 'memory' THEN 2 ";
$sql .= "WHEN 'programmable' THEN 3 ";
$sql .= "WHEN 'expansion' THEN 4 ";
$sql .= "ELSE 100 END, ";
@@ -406,18 +409,16 @@ require_once "resources/require.php";
</script>
<?php
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' name='frm' id='frm' action='' onsubmit=\"check_mac_duplicate(document.getElementById('device_mac_address').value, '".$device_uuid."'); return false;\">\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['header-device']."</b></td>\n";
echo "<td width='70%' align='right'>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'>";
echo " <b>".$text['header-device']."</b>";
echo " <br><br>";
echo " ".$text['description-device'];
echo " <br><br>";
echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='devices.php'\" value='".$text['button-back']."'>\n";
if ($action != "add") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_mac = prompt('".$text['message_device']."'); if (new_mac != null) { window.location='device_copy.php?id=".$device_uuid."&mac=' + new_mac; }\" value='".$text['button-copy']."'>\n";
@@ -426,15 +427,9 @@ require_once "resources/require.php";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2' align='left'>\n";
echo $text['description-device']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_mac_address'].":\n";
echo " ".$text['label-device_mac_address']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_mac_address' id='device_mac_address' maxlength='255' value=\"$device_mac_address\" pattern='^([0-9A-Fa-f]{2}[:-]?){5}([0-9A-Fa-f]{2})$' required='required'>\n";
@@ -447,7 +442,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_label'].":\n";
echo " ".$text['label-device_label']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_label' maxlength='255' value=\"$device_label\">\n";
@@ -458,7 +453,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-device_template'].":\n";
echo " ".$text['label-device_template']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$device = new device;
@@ -500,7 +495,7 @@ require_once "resources/require.php";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-lines'].":</td>";
echo " <td class='vncell' valign='top'>".$text['label-lines']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
@@ -614,10 +609,35 @@ require_once "resources/require.php";
echo " </tr>";
if (permission_exists('device_key_add') || permission_exists('device_key_edit')) {
//device profile
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
$sql .= "order by device_profile_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
if ($result_count > 0) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-profile']."</td>";
echo " <td class='vtable' align='left'>";
echo " <select class='formfld' name='device_profile_uuid'>\n";
echo " <option value=''></option>\n";
foreach($result as $row) {
echo " <option value='".$row['device_profile_uuid']."' ".(($row['device_profile_uuid'] == $device_profile_uuid) ? "selected='selected'" : null).">".$row['device_profile_name']." ".(($row['domain_uuid'] == '') ? "&nbsp;&nbsp;(".$text['select-global'].")" : null)."</option>\n";
}
echo " </select>\n";
echo " <br>".$text['description-profile2']."\n";
echo " </td>";
echo " </tr>";
}
//custom keys
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-keys'].":</td>";
echo " <td class='vncell' valign='top'>".$text['label-keys']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vtable'>".$text['label-device_key_category']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n";
@@ -856,23 +876,12 @@ require_once "resources/require.php";
<?php
echo "</td>\n";
$selected = "selected='selected'";
echo "<td class='vtable' valign='top' align='left' nowrap='nowrap'>\n";
echo " <select class='formfld' style='width: 45px;' name='device_keys[".$x."][device_key_line]'>\n";
echo " <option value=''></option>\n";
echo " <option value='0' ".($row['device_key_line'] == "0" ? $selected:"").">0</option>\n";
echo " <option value='1' ".($row['device_key_line'] == "1" ? $selected:"").">1</option>\n";
echo " <option value='2' ".($row['device_key_line'] == "2" ? $selected:"").">2</option>\n";
echo " <option value='3' ".($row['device_key_line'] == "3" ? $selected:"").">3</option>\n";
echo " <option value='4' ".($row['device_key_line'] == "4" ? $selected:"").">4</option>\n";
echo " <option value='5' ".($row['device_key_line'] == "5" ? $selected:"").">5</option>\n";
echo " <option value='6' ".($row['device_key_line'] == "6" ? $selected:"").">6</option>\n";
echo " <option value='7' ".($row['device_key_line'] == "7" ? $selected:"").">7</option>\n";
echo " <option value='8' ".($row['device_key_line'] == "8" ? $selected:"").">8</option>\n";
echo " <option value='9' ".($row['device_key_line'] == "9" ? $selected:"").">9</option>\n";
echo " <option value='10' ".($row['device_key_line'] == "10" ? $selected:"").">10</option>\n";
echo " <option value='11' ".($row['device_key_line'] == "11" ? $selected:"").">11</option>\n";
echo " <option value='12' ".($row['device_key_line'] == "12" ? $selected:"").">12</option>\n";
echo " <option value=''></option>\n";
for ($l = 0; $l <= 12; $l++) {
echo " <option value='".$l."' ".(($row['device_key_line'] == $l) ? "selected='selected'" : null).">".$l."</option>\n";
}
echo " </select>\n";
echo "</td>\n";
@@ -913,9 +922,9 @@ require_once "resources/require.php";
//device settings
if (permission_exists('device_setting_add')) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-settings'].":</td>";
echo " <td class='vncell' valign='top'>".$text['label-settings']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <table border='0' cellpadding='0' cellspacing='0'>\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";
@@ -1001,7 +1010,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_vendor'].":\n";
echo " ".$text['label-device_vendor']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_vendor' maxlength='255' value=\"$device_vendor\">\n";
@@ -1012,7 +1021,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_model'].":\n";
echo " ".$text['label-device_model']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_model' maxlength='255' value=\"$device_model\">\n";
@@ -1023,7 +1032,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_firmware_version'].":\n";
echo " ".$text['label-device_firmware_version']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_firmware_version' maxlength='255' value=\"$device_firmware_version\">\n";
@@ -1032,34 +1041,10 @@ require_once "resources/require.php";
echo "</td>\n";
echo "</tr>\n";
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_username'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_username' maxlength='255' value=\"$device_username\">\n";
echo "<br />\n";
echo $text['description-device_username']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_password'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_password' maxlength='255' value=\"$device_password\">\n";
echo "<br />\n";
echo $text['description-device_password']."\n";
echo "</td>\n";
echo "</tr>\n";
*/
if (permission_exists('device_domain')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-domain'].":\n";
echo " ".$text['label-domain']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid'>\n";
@@ -1086,7 +1071,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_provision_enable'].":\n";
echo " ".$text['label-device_provision_enable']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='device_provision_enable'>\n";
@@ -1110,7 +1095,7 @@ require_once "resources/require.php";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-device_description'].":\n";
echo " ".$text['label-device_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_description' maxlength='255' value=\"$device_description\">\n";
@@ -1123,17 +1108,13 @@ require_once "resources/require.php";
if ($action == "update") {
echo " <input type='hidden' name='device_uuid' value='$device_uuid'>\n";
}
echo " <br>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -41,20 +41,26 @@ else {
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$device_uuid = check_str($_GET["device_uuid"]);
$device_profile_uuid = check_str($_GET["device_profile_uuid"]);
}
if (strlen($id)>0) {
//delete device_key
$sql = "delete from v_device_keys ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and device_key_uuid = '$id' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and device_key_uuid = '".$id."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
$_SESSION["message"] = $text['message-delete'];
header("Location: device_edit.php?id=".$device_uuid);
if ($device_uuid != '') {
header("Location: device_edit.php?id=".$device_uuid);
}
else if ($device_profile_uuid != '') {
header("Location: device_profile_edit.php?id=".$device_profile_uuid);
}
return;
?>

View File

@@ -0,0 +1,83 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
}
//delete the data and subdata
if (strlen($id) > 0) {
//delete device profile keys
$sql = "delete from v_device_keys ";
$sql .= "where device_profile_uuid = '".$id."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete device profile
$sql = "delete from v_device_profiles ";
$sql .= "where device_profile_uuid = '".$id."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//remove device profile uuid from any assigned devices
$sql = "update v_devices set ";
$sql .= "device_profile_uuid = null ";
$sql .= "where device_profile_uuid = '".$id."' ";
$db->exec(check_sql($sql));
unset($sql);
}
/*
// necessary?
//write the provision files
require_once "app/provision/provision_write.php";
*/
//set the message and redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: device_profiles.php");
return;
?>

View File

@@ -0,0 +1,610 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2013 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_profile_add') || permission_exists('device_profile_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$device_profile_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//echo "<textarea>"; print_r($_POST); echo "</textarea>"; exit;
$device_profile_name = check_str($_POST["device_profile_name"]);
$device_profile_domain_uuid = check_str($_POST["domain_uuid"]);
$device_profile_enabled = check_str($_POST["device_profile_enabled"]);
$device_profile_description = check_str($_POST["device_profile_description"]);
$device_key_category = check_str($_POST["device_key_category"]);
$device_key_id = check_str($_POST["device_key_id"]);
$device_key_type = check_str($_POST["device_key_type"]);
$device_key_line = check_str($_POST["device_key_line"]);
$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"]);
}
//add or update the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//check for all required data
$msg = '';
if (strlen($device_profile_name) == 0) { $msg .= $text['message-required'].$text['label-profile_name']."<br>\n"; }
if (strlen($msg) > 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
//add domain_uuid to the array
foreach ($_POST as $key => $value) {
if (is_array($value)) {
$y = 0;
foreach ($value as $k => $v) {
if (!isset($v["domain_uuid"])) {
$_POST[$key][$y]["domain_uuid"] = $_POST["domain_uuid"];
}
$y++;
}
}
}
//array cleanup
$x = 0;
foreach ($_POST["device_keys"] as $row) {
//unset the empty row
if (strlen($row["device_key_category"]) == 0) {
unset($_POST["device_keys"][$x]);
}
//unset device_detail_uuid if the field has no value
if (strlen($row["device_key_uuid"]) == 0) {
unset($_POST["device_keys"][$x]["device_key_uuid"]);
}
//increment the row
$x++;
}
//set the default
$save = true;
//save the profile
if ($save) {
$orm = new orm;
$orm->name('device_profiles');
if (strlen($device_profile_uuid) > 0) {
$orm->uuid($device_profile_uuid);
}
$orm->save($_POST);
$response = $orm->message;
if (strlen($response['uuid']) > 0) {
$device_profile_uuid = $response['uuid'];
}
}
/*
// necessary?
//write the provision files
if (strlen($_SESSION['switch']['provision']['dir']) > 0) {
require_once "app/provision/provision_write.php";
}
*/
//set the message
if (!isset($_SESSION['message'])) {
if ($save) {
if ($action == "add") {
//save the message to a session variable
$_SESSION['message'] = $text['message-add'];
}
if ($action == "update") {
//save the message to a session variable
$_SESSION['message'] = $text['message-update'];
}
//redirect the browser
header("Location: device_profile_edit.php?id=".$device_profile_uuid);
exit;
}
}
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$orm = new orm;
$orm->name('device_profiles');
$orm->uuid($device_profile_uuid);
$result = $orm->find()->get();
//$message = $orm->message;
foreach ($result as &$row) {
$device_profile_name = $row["device_profile_name"];
$device_profile_domain_uuid = $row["domain_uuid"];
$device_profile_enabled = $row["device_profile_enabled"];
$device_profile_description = $row["device_profile_description"];
}
unset ($prep_statement);
}
//set the sub array index
$x = "999";
//get device keys
$sql = "select * from v_device_keys ";
$sql .= "where device_profile_uuid = '".$device_profile_uuid."' ";
$sql .= "order by ";
$sql .= "case device_key_category ";
$sql .= " when 'line' then 1 ";
$sql .= " when 'memory' then 2 ";
$sql .= " when 'programmable' then 3 ";
$sql .= " when 'expansion' then 4 ";
$sql .= "else ";
$sql .= " 100 ";
$sql .= "end, ";
if ($db_type == "mysql") {
$sql .= "device_key_id asc ";
}
else {
$sql .= "cast(device_key_id as numeric) asc ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_keys = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$device_keys[$x]['device_key_category'] = '';
$device_keys[$x]['device_key_id'] = '';
$device_keys[$x]['device_key_type'] = '';
$device_keys[$x]['device_key_line'] = '';
$device_keys[$x]['device_key_value'] = '';
$device_keys[$x]['device_key_extension'] = '';
$device_keys[$x]['device_key_label'] = '';
//show the header
require_once "resources/header.php";
$document['title'] = $text['title-profile'];
//javascript to change select to input and back again
?><script language="javascript">
var objs;
function change_to_input(obj){
tb=document.createElement('INPUT');
tb.type='text';
tb.name=obj.name;
tb.className='formfld';
tb.setAttribute('style', 'width: 175px;');
tb.value=obj.options[obj.selectedIndex].value;
tbb=document.createElement('INPUT');
tbb.setAttribute('class', 'btn');
tbb.setAttribute('style', 'margin-left: 4px;');
tbb.type='button';
tbb.value=$("<div />").html('&#9665;').text();
tbb.objs=[obj,tb,tbb];
tbb.onclick=function(){ replace_param(this.objs); }
obj.parentNode.insertBefore(tb,obj);
obj.parentNode.insertBefore(tbb,obj);
obj.parentNode.removeChild(obj);
replace_param(this.objs);
}
function replace_param(obj){
obj[2].parentNode.insertBefore(obj[0],obj[2]);
obj[0].parentNode.removeChild(obj[1]);
obj[0].parentNode.removeChild(obj[2]);
}
</script>
<?php
//show the content
echo "<form method='post' name='frm' id='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'>";
echo " <b>".$text['header-profile']."</b>";
echo " <br><br>";
echo " ".$text['description-profile'];
echo " <br><br>";
echo "</td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_profiles.php'\" value='".$text['button-back']."'>\n";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-profile_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_profile_name' maxlength='255' value=\"".$device_profile_name."\">\n";
echo "<br />\n";
echo $text['description-profile_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-keys']."</td>";
echo " <td class='vtable' align='left'>";
echo " <table border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vtable'>".$text['label-device_key_category']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_type']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_line']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_value']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_extension']."</td>\n";
echo " <td class='vtable'>".$text['label-device_key_label']."</td>\n";
echo " <td>&nbsp;</td>\n";
echo " </tr>\n";
$x = 0;
foreach($device_keys as $row) {
//determine whether to hide the element
if (strlen($device_key_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_key_uuid']) > 0) {
echo " <input name='device_keys[".$x."][device_key_uuid]' type='hidden' value=\"".$row['device_key_uuid']."\">\n";
}
//show all the rows in the array
echo " <tr>\n";
echo "<td class='vtable' valign='top' align='left' nowrap='nowrap'>\n";
echo " <select class='formfld' style='width: auto;' name='device_keys[".$x."][device_key_category]'>\n";
echo " <option value=''></option>\n";
if ($row['device_key_category'] == "line") {
echo " <option value='line' selected='selected'>".$text['label-line']."</option>\n";
}
else {
echo " <option value='line'>".$text['label-line']."</option>\n";
}
if ($row['device_key_category'] == "memory") {
echo " <option value='memory' selected='selected'>".$text['label-memory']."</option>\n";
}
else {
echo " <option value='memory'>".$text['label-memory']."</option>\n";
}
if ($row['device_key_category'] == "programmable") {
echo " <option value='programmable' selected='selected'>".$text['label-programmable']."</option>\n";
}
else {
echo " <option value='programmable'>".$text['label-programmable']."</option>\n";
}
if (strlen($device_vendor) == 0) {
if ($row['device_key_category'] == "expansion") {
echo " <option value='expansion' selected='selected'>".$text['label-expansion']."</option>\n";
}
else {
echo " <option value='expansion'>".$text['label-expansion']."</option>\n";
}
}
else {
if (strtolower($device_vendor) == "cisco") {
if ($row['device_key_category'] == "expansion-1" || $row['device_key_category'] == "expansion") {
echo " <option value='expansion-1' selected='selected'>".$text['label-expansion']." 1</option>\n";
}
else {
echo " <option value='expansion-1'>".$text['label-expansion']." 1</option>\n";
}
if ($row['device_key_category'] == "expansion-2") {
echo " <option value='expansion-2' selected='selected'>".$text['label-expansion']." 2</option>\n";
}
else {
echo " <option value='expansion-2'>".$text['label-expansion']." 2</option>\n";
}
}
else {
if ($row['device_key_category'] == "expansion") {
echo " <option value='expansion' selected='selected'>".$text['label-expansion']."</option>\n";
}
else {
echo " <option value='expansion'>".$text['label-expansion']."</option>\n";
}
}
}
echo " </select>\n";
echo "</td>\n";
echo "<td class='vtable' valign='top' align='left' nowrap='nowrap'>\n";
echo " <select class='formfld' style='width:auto;' name='device_keys[".$x."][device_key_id]'>\n";
echo " <option value=''></option>\n";
for ($i = 1; $i <= 99; $i++) {
echo " <option value='".$i."' ".(($row['device_key_id'] == $i) ? "selected='selected'" : null).">".$i."</option>\n";
}
echo " </select>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
?>
<?php $selected = "selected='selected'"; ?>
<?php $found = false; ?>
<select class='formfld' style='width:80px;' name='device_keys[<?php echo $x; ?>][device_key_type]'>
<option value=''></option>
<?php
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Aastra'>"; }
?>
<option value='blf' <?php if ($row['device_key_type'] == "blf") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
<option value='blfxfer' <?php if ($row['device_key_type'] == "blfxfer") { echo $selected;$found=true; } ?>><?php echo $text['label-blf_xfer'] ?></option>
<option value='dnd' <?php if ($row['device_key_type'] == "dnd") { echo $selected;$found=true; } ?>><?php echo $text['label-dnd'] ?></option>
<option value='speeddial' <?php if ($row['device_key_type'] == "speeddial") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Cisco'>"; }
?>
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='disabled' <?php if ($row['device_key_type'] == "disabled") { echo $selected;$found=true; } ?>><?php echo $text['label-disabled'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Grandstream'>"; }
?>
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='shared line' <?php if ($row['device_key_type'] == "shared line") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
<option value='speed dial' <?php if ($row['device_key_type'] == "speed dial") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
<option value='blf' <?php if ($row['device_key_type'] == "blf") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
<option value='presence watcher' <?php if ($row['device_key_type'] == "presence watcher") { echo $selected;$found=true; } ?>><?php echo $text['label-presence_watcher'] ?></option>
<option value='eventlist blf' <?php if ($row['device_key_type'] == "eventlist blf") { echo $selected;$found=true; } ?>><?php echo $text['label-eventlist_blf'] ?></option>
<option value='speed dial active' <?php if ($row['device_key_type'] == "speed dial active") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial_active'] ?></option>
<option value='dial dtmf' <?php if ($row['device_key_type'] == "dial dtmf") { echo $selected;$found=true; } ?>><?php echo $text['label-dial_dtmf'] ?></option>
<option value='voicemail' <?php if ($row['device_key_type'] == "voicemail") { echo $selected;$found=true; } ?>><?php echo $text['label-voicemail'] ?></option>
<option value='call return' <?php if ($row['device_key_type'] == "call return") { echo $selected;$found=true; } ?>><?php echo $text['label-call_return'] ?></option>
<option value='transfer' <?php if ($row['device_key_type'] == "transfer") { echo $selected;$found=true; } ?>><?php echo $text['label-transfer'] ?></option>
<option value='call park' <?php if ($row['device_key_type'] == "call park") { echo $selected;$found=true; } ?>><?php echo $text['label-call_park'] ?></option>
<option value='intercom' <?php if ($row['device_key_type'] == "intercom") { echo $selected;$found=true; } ?>><?php echo $text['label-intercom'] ?></option>
<option value='ldap search' <?php if ($row['device_key_type'] == "ldap search") { echo $selected;$found=true; } ?>><?php echo $text['label-ldap_search'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Polycom'>"; }
?>
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='automata' <?php if ($row['device_key_type'] == "automata") { echo $selected;$found=true; } ?>><?php echo $text['label-automata'] ?></option>
<option value='normal' <?php if ($row['device_key_type'] == "normal") { echo $selected;$found=true; } ?>><?php echo $text['label-normal'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Snom'>"; }
?>
<option value='none' <?php if ($row['device_key_type'] == "none") { echo $selected;$found=true; } ?>><?php echo $text['label-none'] ?></option>
<option value='url' <?php if ($row['device_key_type'] == "url") { echo $selected;$found=true; } ?>><?php echo $text['label-action_url'] ?></option>
<option value='auto_answer' <?php if ($row['device_key_type'] == "auto_answer") { echo $selected;$found=true; } ?>><?php echo $text['label-auto_answer'] ?></option>
<option value='blf' <?php if ($row['device_key_type'] == "blf") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
<option value='button' <?php if ($row['device_key_type'] == "button") { echo $selected;$found=true; } ?>><?php echo $text['label-button'] ?></option>
<option value='call_agent' <?php if ($row['device_key_type'] == "call_agent") { echo $selected;$found=true; } ?>><?php echo $text['label-call_agent'] ?></option>
<option value='conference' <?php if ($row['device_key_type'] == "conference") { echo $selected;$found=true; } ?>><?php echo $text['label-conference'] ?></option>
<option value='dtmf' <?php if ($row['device_key_type'] == "dtmf") { echo $selected;$found=true; } ?>><?php echo $text['label-dtmf'] ?></option>
<option value='dest' <?php if ($row['device_key_type'] == "dest") { echo $selected;$found=true; } ?>><?php echo $text['label-extension'] ?></option>
<option value='redirect' <?php if ($row['device_key_type'] == "redirect") { echo $selected;$found=true; } ?>><?php echo $text['label-redirect'] ?></option>
<option value='icom' <?php if ($row['device_key_type'] == "icom") { echo $selected;$found=true; } ?>><?php echo $text['label-intercom'] ?></option>
<option value='ivr' <?php if ($row['device_key_type'] == "ivr") { echo $selected;$found=true; } ?>><?php echo $text['label-ivr'] ?></option>
<option value='keyevent' <?php if ($row['device_key_type'] == "keyevent") { echo $selected;$found=true; } ?>><?php echo $text['label-key_event'] ?></option>
<option value='line' <?php if ($row['device_key_type'] == "line") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='multicast' <?php if ($row['device_key_type'] == "multicast") { echo $selected;$found=true; } ?>><?php echo $text['label-multicast_page'] ?></option>
<option value='orbit' <?php if ($row['device_key_type'] == "orbit") { echo $selected;$found=true; } ?>><?php echo $text['label-orbit'] ?></option>
<option value='presence' <?php if ($row['device_key_type'] == "presence") { echo $selected;$found=true; } ?>><?php echo $text['label-presence'] ?></option>
<option value='p2t' <?php if ($row['device_key_type'] == "p2t") { echo $selected;$found=true; } ?>><?php echo $text['label-p2t'] ?></option>
<option value='mult' <?php if ($row['device_key_type'] == "mult") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
<option value='speed' <?php if ($row['device_key_type'] == "speed") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
<option value='transfer' <?php if ($row['device_key_type'] == "transfer") { echo $selected;$found=true; } ?>><?php echo $text['label-transfer'] ?></option>
<option value='recorder' <?php if ($row['device_key_type'] == "recorder") { echo $selected;$found=true; } ?>><?php echo $text['label-record'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0) {
if (strlen($device_vendor) == 0) { echo "<optgroup label='Yealink'>"; }
?>
<option value='0' <?php if ($row['device_key_type'] == "0") { echo $selected;$found=true; } ?>><?php echo $text['label-na'] ?></option>
<option value='15' <?php if ($row['device_key_type'] == "15") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
<option value='1' <?php if ($row['device_key_type'] == "1") { echo $selected;$found=true; } ?>><?php echo $text['label-conference'] ?></option>
<option value='2' <?php if ($row['device_key_type'] == "2") { echo $selected;$found=true; } ?>><?php echo $text['label-forward'] ?></option>
<option value='3' <?php if ($row['device_key_type'] == "3") { echo $selected;$found=true; } ?>><?php echo $text['label-transfer'] ?></option>
<option value='4' <?php if ($row['device_key_type'] == "4") { echo $selected;$found=true; } ?>><?php echo $text['label-hold'] ?></option>
<option value='5' <?php if ($row['device_key_type'] == "5") { echo $selected;$found=true; } ?>><?php echo $text['label-dnd'] ?></option>
<option value='6' <?php if ($row['device_key_type'] == "6") { echo $selected;$found=true; } ?>><?php echo $text['label-redial'] ?></option>
<option value='7' <?php if ($row['device_key_type'] == "7") { echo $selected;$found=true; } ?>><?php echo $text['label-call_return'] ?></option>
<option value='8' <?php if ($row['device_key_type'] == "8") { echo $selected;$found=true; } ?>><?php echo $text['label-sms'] ?></option>
<option value='9' <?php if ($row['device_key_type'] == "9") { echo $selected;$found=true; } ?>><?php echo $text['label-call_pickup'] ?></option>
<option value='10' <?php if ($row['device_key_type'] == "10") { echo $selected;$found=true; } ?>><?php echo $text['label-call_park'] ?></option>
<option value='11' <?php if ($row['device_key_type'] == "11") { echo $selected;$found=true; } ?>><?php echo $text['label-dtmf'] ?></option>
<option value='12' <?php if ($row['device_key_type'] == "12") { echo $selected;$found=true; } ?>><?php echo $text['label-voicemail'] ?></option>
<option value='13' <?php if ($row['device_key_type'] == "13") { echo $selected;$found=true; } ?>><?php echo $text['label-speed_dial'] ?></option>
<option value='14' <?php if ($row['device_key_type'] == "14") { echo $selected;$found=true; } ?>><?php echo $text['label-intercom'] ?></option>
<option value='16' <?php if ($row['device_key_type'] == "16") { echo $selected;$found=true; } ?>><?php echo $text['label-blf'] ?></option>
<option value='17' <?php if ($row['device_key_type'] == "17") { echo $selected;$found=true; } ?>><?php echo $text['label-url'] ?></option>
<option value='19' <?php if ($row['device_key_type'] == "19") { echo $selected;$found=true; } ?>><?php echo $text['label-public_hold'] ?></option>
<option value='20' <?php if ($row['device_key_type'] == "20") { echo $selected;$found=true; } ?>><?php echo $text['label-private'] ?></option>
<option value='21' <?php if ($row['device_key_type'] == "21") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
<option value='22' <?php if ($row['device_key_type'] == "22") { echo $selected;$found=true; } ?>><?php echo $text['label-xml_group'] ?></option>
<option value='23' <?php if ($row['device_key_type'] == "23") { echo $selected;$found=true; } ?>><?php echo $text['label-group_pickup'] ?></option>
<option value='24' <?php if ($row['device_key_type'] == "24") { echo $selected;$found=true; } ?>><?php echo $text['label-paging'] ?></option>
<option value='25' <?php if ($row['device_key_type'] == "25") { echo $selected;$found=true; } ?>><?php echo $text['label-record'] ?></option>
<option value='27' <?php if ($row['device_key_type'] == "27") { echo $selected;$found=true; } ?>><?php echo $text['label-xml_browser'] ?></option>
<option value='28' <?php if ($row['device_key_type'] == "28") { echo $selected;$found=true; } ?>><?php echo $text['label-history'] ?></option>
<option value='29' <?php if ($row['device_key_type'] == "29") { echo $selected;$found=true; } ?>><?php echo $text['label-directory'] ?></option>
<option value='30' <?php if ($row['device_key_type'] == "30") { echo $selected;$found=true; } ?>><?php echo $text['label-menu'] ?></option>
<option value='32' <?php if ($row['device_key_type'] == "32") { echo $selected;$found=true; } ?>><?php echo $text['label-new_sms'] ?></option>
<option value='33' <?php if ($row['device_key_type'] == "33") { echo $selected;$found=true; } ?>><?php echo $text['label-status'] ?></option>
<option value='34' <?php if ($row['device_key_type'] == "34") { echo $selected;$found=true; } ?>><?php echo $text['label-hot_desking'] ?></option>
<option value='35' <?php if ($row['device_key_type'] == "35") { echo $selected;$found=true; } ?>><?php echo $text['label-url_record'] ?></option>
<option value='38' <?php if ($row['device_key_type'] == "38") { echo $selected;$found=true; } ?>><?php echo $text['label-ldap'] ?></option>
<option value='39' <?php if ($row['device_key_type'] == "39") { echo $selected;$found=true; } ?>><?php echo $text['label-blf_list'] ?></option>
<option value='40' <?php if ($row['device_key_type'] == "40") { echo $selected;$found=true; } ?>><?php echo $text['label-prefix'] ?></option>
<option value='41' <?php if ($row['device_key_type'] == "41") { echo $selected;$found=true; } ?>><?php echo $text['label-zero_sp_touch'] ?></option>
<option value='42' <?php if ($row['device_key_type'] == "42") { echo $selected;$found=true; } ?>><?php echo $text['label-acd'] ?></option>
<option value='43' <?php if ($row['device_key_type'] == "43") { echo $selected;$found=true; } ?>><?php echo $text['label-local_phonebook'] ?></option>
<option value='44' <?php if ($row['device_key_type'] == "44") { echo $selected;$found=true; } ?>><?php echo $text['label-broadsoft_phonebook'] ?></option>
<option value='45' <?php if ($row['device_key_type'] == "45") { echo $selected;$found=true; } ?>><?php echo $text['label-local_group'] ?></option>
<option value='46' <?php if ($row['device_key_type'] == "46") { echo $selected;$found=true; } ?>><?php echo $text['label-broadsoft_group'] ?></option>
<option value='47' <?php if ($row['device_key_type'] == "47") { echo $selected;$found=true; } ?>><?php echo $text['label-xml_phonebook'] ?></option>
<option value='48' <?php if ($row['device_key_type'] == "48") { echo $selected;$found=true; } ?>><?php echo $text['label-switch_account_up'] ?></option>
<option value='49' <?php if ($row['device_key_type'] == "49") { echo $selected;$found=true; } ?>><?php echo $text['label-switch_account_down'] ?></option>
<option value='50' <?php if ($row['device_key_type'] == "50") { echo $selected;$found=true; } ?>><?php echo $text['label-keypad_lock'] ?></option>
<?php
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
}
?>
</select>
<?php
echo "</td>\n";
echo "<td class='vtable' valign='top' align='left' nowrap='nowrap'>\n";
echo " <select class='formfld' style='width: 45px;' name='device_keys[".$x."][device_key_line]'>\n";
echo " <option value=''></option>\n";
for ($l = 0; $l <= 12; $l++) {
echo " <option value='".$l."' ".(($row['device_key_line'] == $l) ? "selected='selected'" : null).">".$l."</option>\n";
}
echo " </select>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_value]' style='width: 120px;' maxlength='255' value=\"".$row['device_key_value']."\">\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_extension]' style='width: 120px;' maxlength='255' value=\"".$row['device_key_extension']."\">\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_label]' style='width: 150px;' maxlength='255' value=\"".$row['device_key_label']."\">\n";
echo "</td>\n";
echo " <td nowrap='nowrap'>\n";
if (strlen($row['device_key_uuid']) > 0) {
echo " <a href='device_key_delete.php?device_profile_uuid=".$row['device_profile_uuid']."&id=".$row['device_key_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
//increment the array key
$x++;
}
echo " </table>\n";
if (strlen($text['description-keys']) > 0) {
echo " <br>".$text['description-keys']."\n";
}
echo " </td>";
echo " </tr>";
if (permission_exists('device_profile_domain')) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-profile_domain']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid'>\n";
if ($action == "update") {
echo " <option value='' ".(($device_profile_domain_uuid == '') ? "selected='selected'" : null).">".$text['select-global']."</option>\n";
foreach ($_SESSION['domains'] as $dom) {
echo "<option value='".$dom['domain_uuid']."' ".(($device_profile_domain_uuid == $dom['domain_uuid']) ? "selected='selected'" : null).">".$dom['domain_name']."</option>\n";
}
}
else {
echo " <option value=''>".$text['select-global']."</option>\n";
foreach ($_SESSION['domains'] as $dom) {
echo "<option value='".$dom['domain_uuid']."' ".(($domain_uuid == $dom['domain_uuid']) ? "selected='selected'" : null).">".$dom['domain_name']."</option>\n";
}
}
echo " </select>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-profile_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='device_profile_enabled'>\n";
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <option value='false' ".(($device_profile_enable == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-profile_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-profile_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='device_profile_description' maxlength='255' value=\"".$device_profile_description."\">\n";
echo "<br />\n";
echo $text['description-profile_description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='device_profile_uuid' value='".$device_profile_uuid."'>\n";
}
echo " <br>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo "</tr>";
echo "</table>";
echo "</form>";
//show the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,177 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2008-2012 All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('device_profile_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//additional includes
require_once "resources/header.php";
$document['title'] = $text['title-profiles'];
require_once "resources/paging.php";
//show the content
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-profiles']."</b>";
echo " <br /><br />";
echo " ".$text['description-profiles'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
}
//prepare to page the results
$rows_per_page = 50;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the list
$sql = "select * from v_device_profiles ";
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
if (strlen($search) > 0) {
$sql .= "and (";
$sql .= " device_profile_name like '%".$search."%' ";
$sql .= " or device_profile_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by device_profile_name asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
echo th_order_by('enabled', $text['label-profile_enabled'], $order_by, $order);
echo th_order_by('description', $text['label-profile_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
echo (permission_exists('device_profile_edit')) ? "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."'>".$row['device_profile_name']."</a>" : $row['device_profile_name'];
echo ($row['domain_uuid'] == '') ? "&nbsp;&nbsp;&nbsp;&nbsp;<span style='color: #888; font-size: 80%'>".$text['select-global']."</span>" : null;
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_profile_enabled']]."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_profile_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_edit')) {
echo "<a href='device_profile_edit.php?id=".$row['device_profile_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
}
if (permission_exists('device_profile_delete')) {
echo "<a href='device_profile_delete.php?id=".$row['device_profile_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
$c = ($c == 0) ? 1 : 0;
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='4'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_profile_add')) {
echo " <a href='device_profile_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -49,24 +49,23 @@ else {
require_once "resources/paging.php";
//show the content
echo "<br />";
echo "<div align='center'>";
echo "<table width='100%' border='0'>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-devices']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='30%' align='right'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['description-devices']."<br /><br />\n";
echo " <td width='100%' align='left' valign='top'>";
echo " <b>".$text['header-devices']."</b>";
echo " <br /><br />";
echo " ".$text['description-devices'];
echo " </td>\n";
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
echo " <form method='get' action=''>\n";
echo " <input type='button' class='btn' value='".$text['button-profiles']."' onclick=\"document.location.href='device_profiles.php';\">";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </form>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />";
//prepare to page the results
$sql = "select count(*) as num_rows from v_devices ";
@@ -81,7 +80,6 @@ else {
$sql .= " or device_description like '%".$search."%' ";
$sql .= ") ";
}
//if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
@@ -132,22 +130,15 @@ else {
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
//echo th_order_by('device_uuid', $text['label-device_uuid'], $order_by, $order);
echo th_order_by('device_mac_address', $text['label-device_mac_address'], $order_by, $order);
echo th_order_by('device_label', $text['label-device_label'], $order_by, $order);
echo th_order_by('device_vendor', $text['label-device_vendor'], $order_by, $order);
//echo th_order_by('device_model', $text['label-device_model'], $order_by, $order);
//echo th_order_by('device_firmware_version', $text['label-device_firmware_version'], $order_by, $order);
echo th_order_by('device_provision_enable', $text['label-device_provision_enable'], $order_by, $order);
echo th_order_by('device_template', $text['label-device_template'], $order_by, $order);
//echo th_order_by('device_username', $text['label-device_username'], $order_by, $order);
//echo th_order_by('device_password', $text['label-device_password'], $order_by, $order);
//echo th_order_by('device_time_zone', $text['label-device_time_zone'], $order_by, $order);
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_add')) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
@@ -164,7 +155,6 @@ else {
$tr_link = (permission_exists('device_edit')) ? "href='device_edit.php?id=".$row['device_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_uuid']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('device_edit')) {
echo "<a href='device_edit.php?id=".$row['device_uuid']."'>".$row['device_mac_address']."</a>";
@@ -175,13 +165,8 @@ else {
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_label']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_vendor']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_model']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_firmware_version']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_provision_enable']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['device_provision_enable']]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_template']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_username']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_password']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_time_zone']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['device_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_edit')) {
@@ -198,19 +183,14 @@ else {
} //end if results
echo "<tr>\n";
echo "<td colspan='8' align='left'>\n";
echo "<td colspan='8'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_add')) {
echo "<a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
echo " </td>\n";
echo " </tr>\n";
@@ -218,7 +198,6 @@ else {
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br /><br />";
//include the footer