Operator Panel: Optimizations, bug fixes, better auto-complete searching.
This commit is contained in:
parent
f1b1c48e3b
commit
59bd481b6c
|
|
@ -35,6 +35,17 @@ else {
|
|||
|
||||
//search term
|
||||
$term = check_str($_GET['term']);
|
||||
if (isset($_GET['debug'])) {
|
||||
echo "Search Term: ".$term."<br><br>";
|
||||
}
|
||||
|
||||
//if term contains spaces, break into array
|
||||
if (substr_count($term, ' ') > 0) {
|
||||
$terms = explode(' ', $term);
|
||||
}
|
||||
else {
|
||||
$terms[] = $term;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -55,14 +66,19 @@ else {
|
|||
$sql .= "from ";
|
||||
$sql .= "v_extensions e ";
|
||||
$sql .= "where ";
|
||||
$sql .= "( ";
|
||||
$sql .= " lower(e.effective_caller_id_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.outbound_caller_id_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.directory_full_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.description) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.call_group) like lower('%".$term."%') or ";
|
||||
$sql .= " e.extension like '%".$term."%' ";
|
||||
$sql .= ") ";
|
||||
foreach ($terms as $index => $term) {
|
||||
$sql .= "( ";
|
||||
$sql .= " lower(e.effective_caller_id_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.outbound_caller_id_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.directory_full_name) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.description) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(e.call_group) like lower('%".$term."%') or ";
|
||||
$sql .= " e.extension like '%".$term."%' ";
|
||||
$sql .= ") ";
|
||||
if ($index + 1 < sizeof($terms)) {
|
||||
$sql .= " and ";
|
||||
}
|
||||
}
|
||||
$sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and e.enabled = 'true' ";
|
||||
$sql .= "order by ";
|
||||
|
|
@ -99,14 +115,19 @@ else {
|
|||
$sql .= "v_contacts as c, ";
|
||||
$sql .= "v_contact_phones as p ";
|
||||
$sql .= "where ";
|
||||
$sql .= "( ";
|
||||
$sql .= " lower(c.contact_organization) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_given) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_middle) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_family) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_nickname) like lower('%".$term."%') or ";
|
||||
$sql .= " p.phone_number like '%".$term."%' ";
|
||||
$sql .= ") ";
|
||||
foreach ($terms as $index => $term) {
|
||||
$sql .= "( ";
|
||||
$sql .= " lower(c.contact_organization) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_given) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_middle) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_name_family) like lower('%".$term."%') or ";
|
||||
$sql .= " lower(c.contact_nickname) like lower('%".$term."%') or ";
|
||||
$sql .= " p.phone_number like '%".$term."%' ";
|
||||
$sql .= ") ";
|
||||
if ($index + 1 < sizeof($terms)) {
|
||||
$sql .= " and ";
|
||||
}
|
||||
}
|
||||
$sql .= "and c.contact_uuid = p.contact_uuid ";
|
||||
$sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
if (sizeof($user_group_uuids) > 0) {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ else {
|
|||
exit;
|
||||
}
|
||||
|
||||
$document['title'] = $text['title-operator_panel'];
|
||||
require_once "resources/header.php";
|
||||
?>
|
||||
|
||||
|
|
@ -79,8 +80,9 @@ require_once "resources/header.php";
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui.css">
|
||||
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-ui-1.9.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
//ajax refresh
|
||||
var refresh = 1950;
|
||||
var refresh = 1500;
|
||||
var source_url = 'index_inc.php?' <?php if (isset($_GET['debug'])) { echo " + '&debug'"; } ?>;
|
||||
var interval_timer_id;
|
||||
|
||||
|
|
@ -230,16 +232,11 @@ require_once "resources/header.php";
|
|||
}
|
||||
if (cmd != '') {
|
||||
send_cmd('exec.php?cmd='+escape(cmd));
|
||||
$('#destination_'+from_ext+'_'+which).autocomplete("destroy");
|
||||
$('#destination_'+from_ext+'_'+which).removeAttr('onblur');
|
||||
toggle_destination(from_ext, which);
|
||||
refresh_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
toggle_destination(from_ext, which);
|
||||
}
|
||||
}
|
||||
|
||||
//kill call
|
||||
|
|
@ -288,16 +285,16 @@ require_once "resources/header.php";
|
|||
refresh_stop();
|
||||
if (which == 'call') {
|
||||
if ($('#destination_'+ext+'_call').is(':visible')) {
|
||||
$('#destination_'+ext+'_call').fadeOut(200, function() {
|
||||
$('#destination_'+ext+'_call').val('');
|
||||
$('#destination_'+ext+'_call').autocomplete('destroy');
|
||||
$('#destination_control_'+ext+'_call').prop('disabled', false);
|
||||
$('#destination_'+ext+'_call').val('');
|
||||
$('#destination_'+ext+'_call').autocomplete('destroy');
|
||||
$('#destination_'+ext+'_call').hide(0, function() {
|
||||
$('.call_control').children().attr('onmouseout', "refresh_start();");
|
||||
$('.destination_control').attr('onmouseout', "refresh_start();");
|
||||
refresh_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#destination_control_'+ext+'_call').prop('disabled', true);
|
||||
$('#destination_'+ext+'_call').fadeIn(200, function() {
|
||||
$('#destination_'+ext+'_call').show(0, function() {
|
||||
$('#destination_'+ext+'_call').focus();
|
||||
$('#destination_'+ext+'_call').autocomplete({
|
||||
source: "autocomplete.php",
|
||||
|
|
@ -307,31 +304,36 @@ require_once "resources/header.php";
|
|||
$('#frm_destination_'+ext+'_call').submit();
|
||||
}
|
||||
});
|
||||
$('.call_control').children().removeAttr('onmouseout');
|
||||
$('.destination_control').removeAttr('onmouseout');
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (which == 'transfer') {
|
||||
if ($('#destination_'+ext+'_transfer').is(':visible')) {
|
||||
$('#destination_'+ext+'_transfer').fadeOut(200, function() {
|
||||
$('#destination_'+ext+'_transfer').val('');
|
||||
$('#destination_'+ext+'_transfer').autocomplete('destroy');
|
||||
$('#destination_'+ext+'_transfer').hide(0, function() {
|
||||
$('#op_caller_details_'+ext).show();
|
||||
$('#destination_'+ext+'_transfer').val('');
|
||||
$('#destination_'+ext+'_transfer').autocomplete('destroy');
|
||||
$('#destination_control_'+ext+'_transfer').prop('disabled', false);
|
||||
$('.call_control').children().attr('onmouseout', "refresh_start();");
|
||||
$('.destination_control').attr('onmouseout', "refresh_start();");
|
||||
refresh_start();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#op_caller_details_'+ext).hide();
|
||||
$('#destination_'+ext+'_transfer').fadeIn(200, function() {
|
||||
$('#destination_control_'+ext+'_transfer').prop('disabled', true);
|
||||
$('#destination_'+ext+'_transfer').focus();
|
||||
$('#destination_'+ext+'_transfer').autocomplete({
|
||||
source: "autocomplete.php",
|
||||
minLength: 3,
|
||||
select: function(event, ui) {
|
||||
$('#destination_'+ext+'_transfer').val(ui.item.value);
|
||||
$('#frm_destination_'+ext+'_transfer').submit();
|
||||
}
|
||||
$('#op_caller_details_'+ext).hide(0, function() {
|
||||
$('#destination_'+ext+'_transfer').show(0, function() {
|
||||
$('#destination_'+ext+'_transfer').focus();
|
||||
$('#destination_'+ext+'_transfer').autocomplete({
|
||||
source: "autocomplete.php",
|
||||
minLength: 3,
|
||||
select: function(event, ui) {
|
||||
$('#destination_'+ext+'_transfer').val(ui.item.value);
|
||||
$('#frm_destination_'+ext+'_transfer').submit();
|
||||
}
|
||||
});
|
||||
$('.call_control').children().removeAttr('onmouseout');
|
||||
$('.destination_control').removeAttr('onmouseout');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ if (permission_exists('operator_panel_eavesdrop')) {
|
|||
echo " <td valign='top' nowrap='nowrap'>";
|
||||
if (sizeof($_SESSION['user']['extensions']) > 1) {
|
||||
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extensions'][0] : $_REQUEST['eavesdrop_dest'])."\">";
|
||||
echo " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 0px 5px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle' ".$onhover_pause_refresh.">";
|
||||
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();' xonblur='refresh_start();'>\n";
|
||||
echo " <img src='resources/images/eavesdrop.png' style='width: 12px; height: 12px; border: none; margin: 0px 5px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'>";
|
||||
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
|
||||
foreach ($_SESSION['user']['extensions'] as $user_extension) {
|
||||
echo " <option value='".$user_extension."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".$user_extension."</option>\n";
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ if (sizeof($groups) > 0) {
|
|||
//show buttons
|
||||
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$text['button-all']."\" onclick=\"document.getElementById('group').value = '';\" ".$onhover_pause_refresh.">";
|
||||
foreach ($groups as $group) {
|
||||
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\">";
|
||||
echo " <input type='button' class='btn' title=\"".$text['label-call_group']."\" value=\"".$group."\" ".(($_REQUEST['group'] == $group) ? "disabled='disabled'" : null)." onclick=\"document.getElementById('group').value = this.value;\" ".$onhover_pause_refresh.">";
|
||||
}
|
||||
}
|
||||
echo " </td>";
|
||||
|
|
@ -314,6 +314,7 @@ foreach ($activity as $extension => $ext) {
|
|||
$block .= " <span class='op_caller_info'>";
|
||||
$block .= " <table align='right'><tr><td style='text-align: right;'>";
|
||||
$block .= " <span class='op_call_info'>".$ext['call_length']."</span><br>";
|
||||
$block .= " <span class='call_control'>";
|
||||
//record
|
||||
if (permission_exists('operator_panel_record') && $ext_state == 'active') {
|
||||
$call_identifier_record = $ext['call_uuid'];
|
||||
|
|
@ -342,9 +343,10 @@ foreach ($activity as $extension => $ext) {
|
|||
}
|
||||
$block .= "<img src='resources/images/kill.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' title='".$text['label-kill']."' onclick=\"kill_call('".$call_identifier_kill."');\" ".$onhover_pause_refresh.">";
|
||||
}
|
||||
$block .= "</span>";
|
||||
//transfer
|
||||
if (in_array($extension, $_SESSION['user']['extensions']) && $ext_state == 'active') {
|
||||
$block .= "<img id='destination_control_".$extension."_transfer' src='resources/images/keypad_transfer.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' onclick=\"toggle_destination('".$extension."', 'transfer');\">";
|
||||
$block .= "<img id='destination_control_".$extension."_transfer' class='destination_control' src='resources/images/keypad_transfer.png' style='width: 12px; height: 12px; border: none; margin: 4px 0px 0px 5px; cursor: pointer;' onclick=\"toggle_destination('".$extension."', 'transfer');\" ".$onhover_pause_refresh.">";
|
||||
}
|
||||
$block .= " </td></tr></table>";
|
||||
$block .= " <span id='op_caller_details_".$extension."'><strong>".$call_name."</strong><br>".$call_number."</span>";
|
||||
|
|
@ -360,7 +362,7 @@ foreach ($activity as $extension => $ext) {
|
|||
else {
|
||||
//call
|
||||
if (in_array($extension, $_SESSION['user']['extensions'])) {
|
||||
$block .= " <img id='destination_control_".$extension."_call' src='resources/images/keypad_call.png' style='width: 12px; height: 12px; border: none; margin-top: 26px; margin-right: 1px; cursor: pointer;' align='right' onclick=\"toggle_destination('".$extension."', 'call');\">";
|
||||
$block .= " <img id='destination_control_".$extension."_call' class='destination_control' src='resources/images/keypad_call.png' style='width: 12px; height: 12px; border: none; margin-top: 26px; margin-right: 1px; cursor: pointer;' align='right' onclick=\"toggle_destination('".$extension."', 'call');\" ".$onhover_pause_refresh.">";
|
||||
$block .= " <form id='frm_destination_".$extension."_call' onsubmit=\"go_destination('".$extension."', document.getElementById('destination_".$extension."_call').value, 'call'); return false;\">";
|
||||
$block .= " <input type='text' class='formfld' id='destination_".$extension."_call' style='width: 100px; min-width: 100px; max-width: 100px; margin-top: 10px; text-align: center; display: none;' onblur=\"toggle_destination('".$extension."', 'call');\">";
|
||||
$block .= " </form>\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue