CDR: Move column sort to select box in search form.

This commit is contained in:
Nate 2019-09-26 08:27:13 -06:00
parent 284eb17f86
commit 46a6461630
3 changed files with 246 additions and 102 deletions

View File

@ -1,5 +1,4 @@
<?php
#This file was last reorganized on 27th of September 2017 01:41:51 PM UTC
$text['title2']['en-us'] = "Call Details";
$text['title2']['ar-eg'] = "";
@ -1741,6 +1740,26 @@ $text['label-cancelled']['ru-ru'] = "Отменено";
$text['label-cancelled']['sv-se'] = "Avbröts";
$text['label-cancelled']['uk-ua'] = "скасовано";
$text['label-caller_id']['en-us'] = "Caller ID";
$text['label-caller_id']['ar-eg'] = "CID";
$text['label-caller_id']['de-at'] = "CID";
$text['label-caller_id']['de-ch'] = "CID";
$text['label-caller_id']['de-de'] = "CID";
$text['label-caller_id']['es-cl'] = "CID";
$text['label-caller_id']['es-mx'] = "CID";
$text['label-caller_id']['fr-ca'] = "CID";
$text['label-caller_id']['fr-fr'] = "CID";
$text['label-caller_id']['he-il'] = "CID";
$text['label-caller_id']['it-it'] = "CID";
$text['label-caller_id']['nl-nl'] = "CID";
$text['label-caller_id']['pl-pl'] = "CID";
$text['label-caller_id']['pt-br'] = "CID";
$text['label-caller_id']['pt-pt'] = "CID";
$text['label-caller_id']['ro-ro'] = "CID";
$text['label-caller_id']['ru-ru'] = "CID";
$text['label-caller_id']['sv-se'] = "CID";
$text['label-caller_id']['uk-ua'] = "CID";
$text['label-caller_id_name']['en-us'] = "Caller Name";
$text['label-caller_id_name']['ar-eg'] = "";
$text['label-caller_id_name']['de-at'] = "Anrufer Name"; //copied from de-de
@ -2181,6 +2200,86 @@ $text['label-a-leg']['ru-ru'] = "A-часть";
$text['label-a-leg']['sv-se'] = "A-part";
$text['label-a-leg']['uk-ua'] = "";
$text['label-order']['en-us'] = "Order";
$text['label-order']['ar-eg'] = "Order";
$text['label-order']['de-at'] = "Order";
$text['label-order']['de-ch'] = "Order";
$text['label-order']['de-de'] = "Order";
$text['label-order']['es-cl'] = "Order";
$text['label-order']['es-mx'] = "Order";
$text['label-order']['fr-ca'] = "Order";
$text['label-order']['fr-fr'] = "Order";
$text['label-order']['he-il'] = "Order";
$text['label-order']['it-it'] = "Order";
$text['label-order']['nl-nl'] = "Order";
$text['label-order']['pl-pl'] = "Order";
$text['label-order']['pt-br'] = "Order";
$text['label-order']['pt-pt'] = "Order";
$text['label-order']['ro-ro'] = "Order";
$text['label-order']['ru-ru'] = "Order";
$text['label-order']['sv-se'] = "Order";
$text['label-order']['uk-ua'] = "Order";
$text['label-custom_cdr_fields']['en-us'] = "Custom";
$text['label-custom_cdr_fields']['ar-eg'] = "Custom";
$text['label-custom_cdr_fields']['de-at'] = "Custom";
$text['label-custom_cdr_fields']['de-ch'] = "Custom";
$text['label-custom_cdr_fields']['de-de'] = "Custom";
$text['label-custom_cdr_fields']['es-cl'] = "Custom";
$text['label-custom_cdr_fields']['es-mx'] = "Custom";
$text['label-custom_cdr_fields']['fr-ca'] = "Custom";
$text['label-custom_cdr_fields']['fr-fr'] = "Custom";
$text['label-custom_cdr_fields']['he-il'] = "Custom";
$text['label-custom_cdr_fields']['it-it'] = "Custom";
$text['label-custom_cdr_fields']['nl-nl'] = "Custom";
$text['label-custom_cdr_fields']['pl-pl'] = "Custom";
$text['label-custom_cdr_fields']['pt-br'] = "Custom";
$text['label-custom_cdr_fields']['pt-pt'] = "Custom";
$text['label-custom_cdr_fields']['ro-ro'] = "Custom";
$text['label-custom_cdr_fields']['ru-ru'] = "Custom";
$text['label-custom_cdr_fields']['sv-se'] = "Custom";
$text['label-custom_cdr_fields']['uk-ua'] = "Custom";
$text['label-ascending']['en-us'] = "Ascending";
$text['label-ascending']['ar-eg'] = "Ascending";
$text['label-ascending']['de-at'] = "Ascending";
$text['label-ascending']['de-ch'] = "Ascending";
$text['label-ascending']['de-de'] = "Ascending";
$text['label-ascending']['es-cl'] = "Ascending";
$text['label-ascending']['es-mx'] = "Ascending";
$text['label-ascending']['fr-ca'] = "Ascending";
$text['label-ascending']['fr-fr'] = "Ascending";
$text['label-ascending']['he-il'] = "Ascending";
$text['label-ascending']['it-it'] = "Ascending";
$text['label-ascending']['nl-nl'] = "Ascending";
$text['label-ascending']['pl-pl'] = "Ascending";
$text['label-ascending']['pt-br'] = "Ascending";
$text['label-ascending']['pt-pt'] = "Ascending";
$text['label-ascending']['ro-ro'] = "Ascending";
$text['label-ascending']['ru-ru'] = "Ascending";
$text['label-ascending']['sv-se'] = "Ascending";
$text['label-ascending']['uk-ua'] = "Ascending";
$text['label-descending']['en-us'] = "Descending";
$text['label-descending']['ar-eg'] = "Descending";
$text['label-descending']['de-at'] = "Descending";
$text['label-descending']['de-ch'] = "Descending";
$text['label-descending']['de-de'] = "Descending";
$text['label-descending']['es-cl'] = "Descending";
$text['label-descending']['es-mx'] = "Descending";
$text['label-descending']['fr-ca'] = "Descending";
$text['label-descending']['fr-fr'] = "Descending";
$text['label-descending']['he-il'] = "Descending";
$text['label-descending']['it-it'] = "Descending";
$text['label-descending']['nl-nl'] = "Descending";
$text['label-descending']['pl-pl'] = "Descending";
$text['label-descending']['pt-br'] = "Descending";
$text['label-descending']['pt-pt'] = "Descending";
$text['label-descending']['ro-ro'] = "Descending";
$text['label-descending']['ru-ru'] = "Descending";
$text['label-descending']['sv-se'] = "Descending";
$text['label-descending']['uk-ua'] = "Descending";
$text['description_search']['en-us'] = "<u>Note</u>: Source, Destination and Caller ID (CID) Name fields support the use of an <i>asterisk</i> ('*') as a wildcard character.";
$text['description_search']['ar-eg'] = "";
$text['description_search']['de-at'] = "Info: Quelle, Ziel und Anruferkennung (CID) Namesfelder unterstützen die Verwendung von Stern ('*') als Wildcard Zeichen."; //copied from de-de
@ -2541,4 +2640,4 @@ $text['button-advanced_search']['ru-ru'] = "Расширенный поиск";
$text['button-advanced_search']['sv-se'] = "Avancerad Sökning";
$text['button-advanced_search']['uk-ua'] = "";
?>
?>

View File

@ -221,19 +221,45 @@
echo " </table>\n";
echo "</td>";
echo "<td width='".((if_group("admin") || if_group("superadmin") || if_group("cdr")) ? '24%' : '30%')."' style='vertical-align: top;'>\n";
echo "<td width='".((if_group("admin") || if_group("superadmin") || if_group("cdr")) ? '30%' : '40%')."' style='vertical-align: top;'>\n";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-caller_id_number']."\n";
echo " ".$text['label-caller_id']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left' style='white-space: nowrap;'>\n";
echo " <input type='text' class='formfld' style='".escape($style['caller_id_number'])."' name='caller_id_number' id='caller_id_number' value='".escape($caller_id_number)."'>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input type='text' class='formfld' name='caller_id_name' style='min-width: 115px; width: 115px;' placeholder=\"".$text['label-name']."\" value='".escape($caller_id_name)."'>\n";
echo " <input type='text' class='formfld' name='caller_id_number' style='min-width: 115px; width: 115px;' placeholder=\"".$text['label-number']."\" value='".escape($caller_id_number)."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-start_range']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left' style='position: relative; min-width: 250px;'>\n";
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."'>\n";
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>";
echo "<td width='".((if_group("admin") || if_group("superadmin") || if_group("cdr")) ? '24%' : '30%')."' style='vertical-align: top;'>\n";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
if (permission_exists('caller_destination')) {
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-caller_destination']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input type='text' class='formfld' name='caller_destination' value='".escape($caller_destination)."'>\n";
echo " </td>\n";
echo " </tr>\n";
}
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-destination']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left' style='white-space: nowrap;'>\n";
@ -243,98 +269,116 @@
echo " </table>\n";
echo "</td>";
echo "<td width='".((if_group("admin") || if_group("superadmin") || if_group("cdr")) ? '30%' : '40%')."' style='vertical-align: top;'>\n";
echo "<td width='27%' style='vertical-align: top;'>\n";
echo " <table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-start_range']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left' style='position: relative; min-width: 250px;'>\n";
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_begin' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_begin' id='start_stamp_begin' placeholder='".$text['label-from']."' value='".escape($start_stamp_begin)."'>\n";
echo " <input type='text' class='formfld datetimepicker' data-toggle='datetimepicker' data-target='#start_stamp_end' onblur=\"$(this).datetimepicker('hide');\" style='min-width: 115px; width: 115px;' name='start_stamp_end' id='start_stamp_end' placeholder='".$text['label-to']."' value='".escape($start_stamp_end)."'>\n";
echo " </td>\n";
echo " </tr>\n";
if (permission_exists('hangup_cause')) {
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-hangup_cause']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <select name='hangup_cause' class='formfld'>\n";
echo " <option value=''></option>\n";
$cdr_status_options = array(
'NORMAL_CLEARING',
'ORIGINATOR_CANCEL',
'BLIND_TRANSFER',
'LOSE_RACE',
'NO_ANSWER',
'NORMAL_UNSPECIFIED',
'NO_USER_RESPONSE',
'NO_ROUTE_DESTINATION',
'SUBSCRIBER_ABSENT',
'NORMAL_TEMPORARY_FAILURE',
'ATTENDED_TRANSFER',
'PICKED_OFF',
'USER_BUSY',
'CALL_REJECTED',
'INVALID_NUMBER_FORMAT',
'NETWORK_OUT_OF_ORDER',
'DESTINATION_OUT_OF_ORDER',
'RECOVERY_ON_TIMER_EXPIRE',
'MANAGER_REQUEST',
'MEDIA_TIMEOUT',
'UNALLOCATED_NUMBER',
'NONE',
'EXCHANGE_ROUTING_ERROR',
'ALLOTTED_TIMEOUT',
'CHAN_NOT_IMPLEMENTED',
'INCOMPATIBLE_DESTINATION',
'USER_NOT_REGISTERED',
'SYSTEM_SHUTDOWN',
'MANDATORY_IE_MISSING'
);
sort($cdr_status_options);
foreach ($cdr_status_options as $cdr_status) {
$selected = ($hangup_cause == $cdr_status) ? "selected='selected'" : null;
$cdr_status_label = ucwords(strtolower(str_replace("_", " ", $cdr_status)));
echo " <option value='".escape($cdr_status)."' ".escape($selected).">".escape($cdr_status_label)."</option>\n";
}
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
}
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-caller_id_name']."\n";
echo " ".$text['label-order']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input type='text' class='formfld' name='caller_id_name' value='".escape($caller_id_name)."'>\n";
echo " <td class='vtable' align='left' style='white-space: nowrap;'>\n";
echo " <select name='order_by' class='formfld'>\n";
if (permission_exists('xml_cdr_extension')) {
echo " <option value='extension' ".($order_by == 'extension' ? "selected='selected'" : null).">".$text['label-extension']."</option>\n";
}
if (permission_exists('xml_cdr_all')) {
echo " <option value='domain_name' ".($order_by == 'domain_name' ? "selected='selected'" : null).">".$text['label-domain']."</option>\n";
}
echo " <option value='caller_id_name' ".($order_by == 'caller_id_name' ? "selected='selected'" : null).">".$text['label-caller_id_name']."</option>\n";
echo " <option value='caller_id_number' ".($order_by == 'caller_id_number' ? "selected='selected'" : null).">".$text['label-caller_id_number']."</option>\n";
if (permission_exists('caller_destination')) {
echo " <option value='caller_destination' ".($order_by == 'caller_destination' ? "selected='selected'" : null).">".$text['label-caller_destination']."</option>\n";
}
echo " <option value='destination_number' ".($order_by == 'destination_number' ? "selected='selected'" : null).">".$text['label-destination']."</option>\n";
echo " <option value='start_stamp' ".($order_by == 'start_stamp' || $order_by == '' ? "selected='selected'" : null).">".$text['label-start']."</option>\n";
echo " <option value='tta' ".($order_by == 'tta' ? "selected='selected'" : null).">".$text['label-tta']."</option>\n";
echo " <option value='duration' ".($order_by == 'duration' ? "selected='selected'" : null).">".$text['label-duration']."</option>\n";
if (permission_exists('xml_cdr_pdd')) {
echo " <option value='pdd_ms' ".($order_by == 'pdd_ms' ? "selected='selected'" : null).">".$text['label-pdd']."</option>\n";
}
if (permission_exists('xml_cdr_mos')) {
echo " <option value='rtp_audio_in_mos' ".($order_by == 'rtp_audio_in_mos' ? "selected='selected'" : null).">".$text['label-mos']."</option>\n";
}
if (permission_exists('hangup_cause')) {
echo " <option value='hangup_cause' ".($order_by == 'desc' ? "selected='selected'" : null).">".$text['label-hangup_cause']."</option>\n";
}
if (is_array($_SESSION['cdr']['field'])) {
echo " <option value='' disabled='disabled'></option>\n";
echo " <optgroup label=\"".$text['label-custom_cdr_fields']."\">\n";
foreach ($_SESSION['cdr']['field'] as $field) {
$array = explode(",", $field);
$field_name = end($array);
$field_label = ucwords(str_replace("_", " ", $field_name));
$field_label = str_replace("Sip", "SIP", $field_label);
if ($field_name != "destination_number") {
echo " <option value='".$field_name."' ".($order_by == $field_name ? "selected='selected'" : null).">".$field_label."</option>\n";
}
}
echo " </optgroup>\n";
}
echo " </select>\n";
echo " <select name='order' class='formfld'>\n";
echo " <option value='desc' ".($order == 'desc' ? "selected='selected'" : null).">".$text['label-descending']."</option>\n";
echo " <option value='asc' ".($order == 'asc' ? "selected='selected'" : null).">".$text['label-ascending']."</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>";
// show hangup clause filter to super/admin
echo "<td width='27%' style='vertical-align: top;'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
if (permission_exists('hangup_cause')) {
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-hangup_cause']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <select name='hangup_cause' class='formfld'>\n";
echo " <option value=''></option>\n";
$cdr_status_options = array(
'NORMAL_CLEARING',
'ORIGINATOR_CANCEL',
'BLIND_TRANSFER',
'LOSE_RACE',
'NO_ANSWER',
'NORMAL_UNSPECIFIED',
'NO_USER_RESPONSE',
'NO_ROUTE_DESTINATION',
'SUBSCRIBER_ABSENT',
'NORMAL_TEMPORARY_FAILURE',
'ATTENDED_TRANSFER',
'PICKED_OFF',
'USER_BUSY',
'CALL_REJECTED',
'INVALID_NUMBER_FORMAT',
'NETWORK_OUT_OF_ORDER',
'DESTINATION_OUT_OF_ORDER',
'RECOVERY_ON_TIMER_EXPIRE',
'MANAGER_REQUEST',
'MEDIA_TIMEOUT',
'UNALLOCATED_NUMBER',
'NONE',
'EXCHANGE_ROUTING_ERROR',
'ALLOTTED_TIMEOUT',
'CHAN_NOT_IMPLEMENTED',
'INCOMPATIBLE_DESTINATION',
'USER_NOT_REGISTERED',
'SYSTEM_SHUTDOWN',
'MANDATORY_IE_MISSING'
);
sort($cdr_status_options);
foreach ($cdr_status_options as $cdr_status) {
$selected = ($hangup_cause == $cdr_status) ? "selected='selected'" : null;
$cdr_status_label = ucwords(strtolower(str_replace("_", " ", $cdr_status)));
echo " <option value='".escape($cdr_status)."' ".escape($selected).">".escape($cdr_status_label)."</option>\n";
}
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
}
if (permission_exists('caller_destination')) {
echo " <tr>\n";
echo " <td class='vncell' valign='top' nowrap='nowrap'>\n";
echo " ".$text['label-caller_destination']."\n";
echo " </td>\n";
echo " <td class='vtable' align='left'>\n";
echo " <input type='text' class='formfld' name='caller_destination' value='".escape($caller_destination)."'>\n";
echo " </td>\n";
echo " </tr>\n";
}
echo "</table>\n";
echo "</td>";
echo "</tr>";
echo "</table>";
@ -375,18 +419,18 @@
//column headings
echo "<th>&nbsp;</th>\n";
if (permission_exists('xml_cdr_extension')) {
echo th_order_by('extension', $text['label-extension'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-extension']."</th>\n";
}
if ($_REQUEST['show'] == "all" && permission_exists('xml_cdr_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-domain']."</th>\n";
$col_count++;
}
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order, null, null, $param);
echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-caller_id_name']."</th>\n";
echo "<th>".$text['label-caller_id_number']."</th>\n";
if (permission_exists('caller_destination')) {
echo th_order_by('caller_destination', $text['label-caller_destination'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-caller_destination']."</th>\n";
}
echo th_order_by('destination_number', $text['label-destination'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-destination']."</th>\n";
if (permission_exists('recording_play') || permission_exists('recording_download')) {
echo "<th>".$text['label-recording']."</th>\n";
$col_count++;
@ -398,23 +442,24 @@
$field_label = ucwords(str_replace("_", " ", $field_name));
$field_label = str_replace("Sip", "SIP", $field_label);
if ($field_name != "destination_number") {
echo th_order_by($field_name, $field_label, $order_by, $order, null, "style='text-align: right;'", $param);
echo "<th style='text-align: right;'>".$field_label."</th>\n";
$col_count++;
}
}
}
echo th_order_by('start_stamp', $text['label-start'], $order_by, $order, null, "style='text-align: center;'", $param);
echo th_order_by('tta', $text['label-tta'], $order_by, $order, null, "style='text-align: right;'", $param, $text['description-tta']);
echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "style='text-align: center;'", $param);
echo "<th style='text-align: center;'>".$text['label-start']."</th>\n";
echo "<th style='text-align: right;' title=\"".$text['description-tta']."\">".$text['label-tta']."</th>\n";
echo "<th style='text-align: center;'>".$text['label-duration']."</th>\n";
if (permission_exists('xml_cdr_pdd')) {
echo th_order_by('pdd_ms', $text['label-pdd'], $order_by, $order, null, "style='text-align: right;'", $param, $text['description-pdd']);
echo "<th style='text-align: right;' title=\"".$text['description-pdd']."\">".$text['label-pdd']."</th>\n";
$col_count++;
}
if (permission_exists('xml_cdr_mos')) {
echo th_order_by('rtp_audio_in_mos', $text['label-mos'], $order_by, $order, null, "style='text-align: center;'", $param, $text['description-mos']);
echo "<th style='text-align: center;' title=\"".$text['description-mos']."\">".$text['label-mos']."</th>\n";
$col_count++;
}
if (permission_exists('hangup_cause')) {
echo th_order_by('hangup_cause', $text['label-hangup_cause'], $order_by, $order, null, null, $param);
echo "<th>".$text['label-hangup_cause']."</th>\n";
}
else {
echo "<th>".$text['label-status']."</th>\n";
@ -719,4 +764,4 @@
//show the footer
require_once "resources/footer.php";
?>
?>

View File

@ -181,7 +181,7 @@
}
//create the sql query to get the xml cdr records
if (strlen($order_by) == 0) { $order_by = "start_epoch"; }
if (strlen($order_by) == 0) { $order_by = "start_stamp"; }
if (strlen($order) == 0) { $order = "desc"; }
//set a default number of rows to show
@ -521,4 +521,4 @@
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
?>
?>