Add device key vendor to assign a key to a vendor.
This commit is contained in:
@@ -399,6 +399,10 @@
|
|||||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
||||||
$z++;
|
$z++;
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_vendor';
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||||
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the vendor.';
|
||||||
|
$z++;
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_type';
|
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_type';
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
|
||||||
|
|||||||
@@ -24,14 +24,31 @@
|
|||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//set all lines to enabled (true) where null or empty string
|
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
$sql = "update v_device_lines set ";
|
//set all lines to enabled (true) where null or empty string
|
||||||
$sql .= "enabled = 'true' ";
|
$sql = "update v_device_lines set ";
|
||||||
$sql .= "where enabled is null ";
|
$sql .= "enabled = 'true' ";
|
||||||
$sql .= "or enabled = '' ";
|
$sql .= "where enabled is null ";
|
||||||
$db->exec(check_sql($sql));
|
$sql .= "or enabled = '' ";
|
||||||
unset($sql);
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
//set the device key vendor
|
||||||
|
$sql = "select * from v_device_keys as k, v_devices as d ";
|
||||||
|
$sql .= "where d.device_uuid = k.device_uuid ";
|
||||||
|
$sql .= "and k.device_uuid is not null ";
|
||||||
|
$sql .= "and k.device_key_vendor is null ";
|
||||||
|
$s = $db->prepare($sql);
|
||||||
|
$s->execute();
|
||||||
|
$device_keys = $s->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
foreach ($device_keys as &$row) {
|
||||||
|
$sql = "update v_device_lines ";
|
||||||
|
$sql .= "set device_key_vendor = '".$row["device_vendor"]."' ";
|
||||||
|
$sql .= "where device_key_uuid = '".$row["device_key_uuid"]."';\n ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
}
|
||||||
|
unset($device_keys, $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
+21
-15
@@ -835,17 +835,23 @@ require_once "resources/require.php";
|
|||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
|
|
||||||
echo "<td align='left'>\n";
|
echo "<td align='left' nowrap='nowrap'>\n";
|
||||||
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
|
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
|
||||||
|
if (strlen($row['device_key_vendor']) > 0) {
|
||||||
|
$device_key_vendor = $row['device_key_vendor'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$device_key_vendor = $device_vendor;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
<input class='formfld' type='hidden' id='key_vendor_<?php echo $x; ?>' name='device_keys[<?php echo $x; ?>][device_key_vendor]' value="<?php echo $device_key_vendor; ?>">
|
||||||
<?php $selected = "selected='selected'"; ?>
|
<?php $selected = "selected='selected'"; ?>
|
||||||
<?php $found = false; ?>
|
<?php $found = false; ?>
|
||||||
<select class='formfld' name='device_keys[<?php echo $x; ?>][device_key_type]'>
|
<select class='formfld' name='device_keys[<?php echo $x; ?>][device_key_type]' id='key_type_<?php echo $x; ?>' onchange="document.getElementById('key_vendor_<?php echo $x; ?>').value=document.getElementById('key_type_<?php echo $x; ?>').options[document.getElementById('key_type_<?php echo $x; ?>').selectedIndex].parentNode.label.toLowerCase();" >
|
||||||
<option value=''></option>
|
<option value=''></option>
|
||||||
<?php
|
<?php
|
||||||
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Aastra'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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='blfxfer' <?php if ($row['device_key_type'] == "blfxfer") { echo $selected;$found=true; } ?>><?php echo $text['label-blf_xfer'] ?></option>
|
||||||
@@ -854,16 +860,16 @@ require_once "resources/require.php";
|
|||||||
<?php
|
<?php
|
||||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||||
}
|
}
|
||||||
if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "cisco" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Cisco'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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>
|
<option value='disabled' <?php if ($row['device_key_type'] == "disabled") { echo $selected;$found=true; } ?>><?php echo $text['label-disabled'] ?></option>
|
||||||
<?php
|
<?php
|
||||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||||
}
|
}
|
||||||
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "grandstream" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Grandstream'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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='shared line' <?php if ($row['device_key_type'] == "shared line") { echo $selected;$found=true; } ?>><?php echo $text['label-shared_line'] ?></option>
|
||||||
@@ -882,8 +888,8 @@ require_once "resources/require.php";
|
|||||||
<?php
|
<?php
|
||||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||||
}
|
}
|
||||||
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "polycom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Polycom'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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='automata' <?php if ($row['device_key_type'] == "automata") { echo $selected;$found=true; } ?>><?php echo $text['label-automata'] ?></option>
|
||||||
@@ -891,8 +897,8 @@ require_once "resources/require.php";
|
|||||||
<?php
|
<?php
|
||||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||||
}
|
}
|
||||||
if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Snom'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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='url' <?php if ($row['device_key_type'] == "url") { echo $selected;$found=true; } ?>><?php echo $text['label-action_url'] ?></option>
|
||||||
@@ -919,8 +925,8 @@ require_once "resources/require.php";
|
|||||||
<?php
|
<?php
|
||||||
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
if (strlen($device_vendor) == 0) { echo "</optgroup>"; }
|
||||||
}
|
}
|
||||||
if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0 || strlen($device_username) > 0) {
|
||||||
if (strlen($device_vendor) == 0) { echo "<optgroup label='Yealink'>"; }
|
if (strlen($device_vendor) == 0 || strlen($device_username) > 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='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='15' <?php if ($row['device_key_type'] == "15") { echo $selected;$found=true; } ?>><?php echo $text['label-line'] ?></option>
|
||||||
|
|||||||
@@ -371,12 +371,18 @@ require_once "resources/require.php";
|
|||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
|
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||||
|
if (strlen($row['device_key_vendor']) > 0) {
|
||||||
|
$device_key_vendor = $row['device_key_vendor'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$device_key_vendor = $device_vendor;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
<input class='formfld' type='hidden' id='key_vendor_<?php echo $x; ?>' name='device_keys[<?php echo $x; ?>][device_key_vendor]' value="<?php echo $device_key_vendor; ?>">
|
||||||
<?php $selected = "selected='selected'"; ?>
|
<?php $selected = "selected='selected'"; ?>
|
||||||
<?php $found = false; ?>
|
<?php $found = false; ?>
|
||||||
<select class='formfld' style='width:80px;' name='device_keys[<?php echo $x; ?>][device_key_type]'>
|
<select class='formfld' style='width:80px;' name='device_keys[<?php echo $x; ?>][device_key_type]' id='key_type_<?php echo $x; ?>' onchange="document.getElementById('key_vendor_<?php echo $x; ?>').value=document.getElementById('key_type_<?php echo $x; ?>').options[document.getElementById('key_type_<?php echo $x; ?>').selectedIndex].parentNode.label.toLowerCase();">
|
||||||
<option value=''></option>
|
<option value=''></option>
|
||||||
<?php
|
<?php
|
||||||
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
|
if (strtolower($device_vendor) == "aastra" || strlen($device_vendor) == 0) {
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ include "root.php";
|
|||||||
$sql .= "or device_profile_uuid = '".$device_profile_uuid."' ";
|
$sql .= "or device_profile_uuid = '".$device_profile_uuid."' ";
|
||||||
}
|
}
|
||||||
$sql .= ") ";
|
$sql .= ") ";
|
||||||
//$sql .= "AND domain_uuid = '".$domain_uuid."' ";
|
$sql .= "AND (device_key_vendor = '".$device_vendor."' or device_key_vendor is null) ";
|
||||||
$sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc";
|
$sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc";
|
||||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
|
|||||||
Reference in New Issue
Block a user