This commit is contained in:
markjcrane 2015-08-15 13:17:33 -06:00
commit ed0f02a9e0
3 changed files with 94 additions and 35 deletions

View File

@ -545,6 +545,50 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$document['title'] = $text['title-destination-add'];
}
//js controls
echo "<script type='text/javascript'>\n";
echo " function type_control(dir) {\n";
echo " if (dir == 'outbound') {\n";
echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = 'none'; }\n";
echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = 'none'; }\n";
echo " document.getElementById('tr_actions').style.display = 'none';\n";
echo " document.getElementById('tr_fax_detection').style.display = 'none';\n";
echo " document.getElementById('tr_cid_name_prefix').style.display = 'none';\n";
echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = 'none'; }\n";
echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = 'none'; }\n";
echo " if (document.getElementById('tr_carrier')) { document.getElementById('tr_carrier').style.display = 'none'; }\n";
echo " document.getElementById('tr_account_code').style.display = 'none';\n";
echo " document.getElementById('destination_context').value = '".$_SESSION['domain_name']."'";
echo " }\n";
echo " else if (dir == 'inbound') {\n";
echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = ''; }\n";
echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = ''; }\n";
echo " document.getElementById('tr_actions').style.display = '';\n";
echo " document.getElementById('tr_fax_detection').style.display = '';\n";
echo " document.getElementById('tr_cid_name_prefix').style.display = '';\n";
echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = ''; }\n";
echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = ''; }\n";
echo " if (document.getElementById('tr_carrier')) { document.getElementById('tr_carrier').style.display = ''; }\n";
echo " document.getElementById('tr_account_code').style.display = '';\n";
echo " document.getElementById('destination_context').value = 'public'";
echo " }\n";
echo " ";
echo " }\n";
echo " \n";
echo " function context_control() {\n";
echo " destination_type = document.getElementById('destination_type');\n";
echo" destination_domain = document.getElementById('destination_domain');\n";
echo " if (destination_type.options[destination_type.selectedIndex].value == 'outbound') {\n";
echo " if (destination_domain.options[destination_domain.selectedIndex].value != '') {\n";
echo " document.getElementById('destination_context').value = destination_domain.options[destination_domain.selectedIndex].innerHTML;\n";
echo " }\n";
echo " else {\n";
echo " document.getElementById('destination_context').value = '\${domain_name}';\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>\n";
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
@ -571,7 +615,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-destination_type']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_type'>\n";
echo " <select class='formfld' name='destination_type' id='destination_type' onchange='type_control(this.options[this.selectedIndex].value);'>\n";
switch ($destination_type) {
case "inbound" : $selected[1] = "selected='selected'"; break;
case "outbound" : $selected[2] = "selected='selected'"; break;
@ -597,7 +641,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
if (permission_exists('outbound_caller_id_select')) {
echo "<tr>\n";
echo "<tr id='tr_caller_id_name'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_caller_id_name']."\n";
echo "</td>\n";
@ -608,7 +652,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<tr id='tr_caller_id_number'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_caller_id_number']."\n";
echo "</td>\n";
@ -625,13 +669,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-destination_context']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_context' maxlength='255' value=\"$destination_context\">\n";
echo " <input class='formfld' type='text' name='destination_context' id='destination_context' maxlength='255' value=\"$destination_context\">\n";
echo "<br />\n";
echo $text['description-destination_context']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<tr id='tr_actions'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-detail_action']."\n";
echo "</td>\n";
@ -672,36 +716,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/fax/app_config.php")){
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-fax_uuid']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "order by fax_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
echo " <select name='fax_uuid' id='fax_uuid' class='formfld' style='".$select_style."'>\n";
echo " <option value=''></option>\n";
foreach ($result as &$row) {
if ($row["fax_uuid"] == $fax_uuid) {
echo " <option value='".$row["fax_uuid"]."' selected='selected'>".$row["fax_extension"]." ".$row["fax_name"]."</option>\n";
}
else {
echo " <option value='".$row["fax_uuid"]."'>".$row["fax_extension"]." ".$row["fax_name"]."</option>\n";
}
}
echo " </select>\n";
unset ($prep_statement, $extension);
echo " <br />\n";
echo " ".$text['description-fax_uuid']."\n";
echo "</td>\n";
echo "</tr>\n";
if (is_array($result) && sizeof($result) > 0) {
echo "<tr id='tr_fax_detection'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-fax_uuid']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='fax_uuid' id='fax_uuid' class='formfld' style='".$select_style."'>\n";
echo " <option value=''></option>\n";
foreach ($result as &$row) {
if ($row["fax_uuid"] == $fax_uuid) {
echo " <option value='".$row["fax_uuid"]."' selected='selected'>".$row["fax_extension"]." ".$row["fax_name"]."</option>\n";
}
else {
echo " <option value='".$row["fax_uuid"]."'>".$row["fax_extension"]." ".$row["fax_name"]."</option>\n";
}
}
echo " </select>\n";
echo " <br />\n";
echo " ".$text['description-fax_uuid']."\n";
echo "</td>\n";
echo "</tr>\n";
}
}
echo "<tr>\n";
echo "<tr id='tr_cid_name_prefix'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_cid_name_prefix']."\n";
echo "</td>\n";
@ -714,7 +760,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
// billing
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
echo "<tr>\n";
echo "<tr id='tr_sell'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-monthly_price']."\n";
echo "</td>\n";
@ -726,7 +772,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<tr id='tr_buy'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-monthly_price_buy']."\n";
echo "</td>\n";
@ -738,7 +784,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<tr id='tr_carrier'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-carrier']."\n";
echo "</td>\n";
@ -752,7 +798,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "add") { $destination_accountcode = $_SESSION['domain_name']; }
}
echo "<tr>\n";
echo "<tr id='tr_account_code'>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-account_code']."\n";
echo "</td>\n";
@ -771,7 +817,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-domain']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid'>\n";
echo " <select class='formfld' name='domain_uuid' id='destination_domain' onchange='context_control();'>\n";
if (strlen($domain_uuid) == 0) {
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
}
@ -840,6 +886,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "<br><br>";
echo "</form>";
//adjust form if outbound destination
if ($destination_type == 'outbound') {
echo "<script type='text/javascript'>type_control('outbound');</script>\n";
}
//include the footer
require_once "resources/footer.php";

View File

@ -190,7 +190,9 @@ class destinations {
if (count($row['result']['data']) > 0 and strlen($row['select_value'][$destination_type]) > 0) {
$response .= " <optgroup label='".$text2['title-'.$label]."'>\n";
$label2 = $label;
foreach ($row['result']['data'] as $data) {
$did = ($label2 == 'destinations') ? true : false;
$select_value = $row['select_value'][$destination_type];
$select_label = $row['select_label'];
foreach ($row['field'] as $key => $value) {
@ -217,6 +219,7 @@ class destinations {
$select_label = str_replace("\${domain_name}", $_SESSION['domain_name'], $select_label);
$select_label = str_replace("\${context}", $_SESSION['context'], $select_label);
if ($select_value == $destination_value) { $selected = "selected='selected' "; $select_found = true; } else { $selected = ''; }
if ($did) { $select_label = format_phone(trim($select_label)); }
$response .= " <option value='".$select_value."' ".$selected.">".trim($select_label)."</option>\n";
}
$response .= " </optgroup>\n";

View File

@ -886,12 +886,14 @@ legend {
}
#logout_icon {
width: 28px;
height: 23px;
border: none;
filter: alpha(opacity=80);
opacity: 0.85;
-moz-opacity: 0.85;
-khtml-opacity: 0.85;
margin-left: 8px;
margin-right: 18px;
}
#logout_icon:hover {
@ -903,6 +905,9 @@ legend {
}
#domain_selector_icon {
width: 28px;
height: 23px;
border: none;
filter: alpha(opacity=80);
opacity: 0.85;
-moz-opacity: 0.85;
@ -1403,17 +1408,17 @@ SPAN.playback_progress_bar {
<a href='<?php echo $logo_link; ?>'><img src='<?php echo $logo; ?>' style='border: none; height: 30px;'></a>
</td>
<td width="100%"><!--{menu}--></td>
<td style='white-space: nowrap;'>
<td style='white-space: nowrap; padding-right: 18px;'>
<?php
//domain selector icon
if ($_SESSION["username"] != '' && permission_exists("domain_select") && count($_SESSION['domains']) > 1) {
echo "<span id='domain_selector_domain'>".$_SESSION['domain_name']."</span><img id='domain_selector_icon' src='".PROJECT_PATH."/themes/minimized/images/icon_domain_selector.png' style='width: 28px; height: 23px; border: none;' title='".$_SESSION['domain_name']." &#10;".$text['theme-label-open_selector']."' align='absmiddle'>";
echo "<span id='domain_selector_domain'>".$_SESSION['domain_name']."</span><img id='domain_selector_icon' src='".PROJECT_PATH."/themes/minimized/images/icon_domain_selector.png' title='".$_SESSION['domain_name']." &#10;".$text['theme-label-open_selector']."' align='absmiddle'>";
}
//logout icon
if ($_SESSION['username'] != '' && $_SESSION['theme']['logout_icon_visible']['text'] == "true") {
$username_full = $_SESSION['username'].((count($_SESSION['domains']) > 1) ? "@".$_SESSION["user_context"] : null);
echo "<a href='".PROJECT_PATH."/logout.php' onclick=\"return confirm('".$text['theme-confirm-logout']."');\"><img id='logout_icon' src='".PROJECT_PATH."/themes/minimized/images/icon_logout.png' style='width: 28px; height: 23px; border: none;' title='".$text['theme-label-logout']." ".$username_full."' align='absmiddle'></a>";
echo "<a href='".PROJECT_PATH."/logout.php' onclick=\"return confirm('".$text['theme-confirm-logout']."');\"><img id='logout_icon' src='".PROJECT_PATH."/themes/minimized/images/icon_logout.png' title='".$text['theme-label-logout']." ".$username_full."' align='absmiddle'></a>";
unset($username_full);
}
?>