CDR & Archive: Merge and simplify, integrating some features of CDR into Archive.
This commit is contained in:
+59
-48
@@ -45,13 +45,13 @@
|
||||
$text = $language->get();
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['xml_cdrs'])) {
|
||||
if (!$archive_request && is_array($_POST['xml_cdrs'])) {
|
||||
$action = $_POST['action'];
|
||||
$xml_cdrs = $_POST['xml_cdrs'];
|
||||
}
|
||||
|
||||
//process the http post data by action
|
||||
if ($action != '' && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) {
|
||||
if (!$archive_request && $action != '' && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) {
|
||||
switch ($action) {
|
||||
case 'delete':
|
||||
if (permission_exists('xml_cdr_delete')) {
|
||||
@@ -69,8 +69,13 @@
|
||||
$object = new token;
|
||||
$token = $object->create($_SERVER['PHP_SELF']);
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-call_detail_records'];
|
||||
//include the header
|
||||
if ($archive_request) {
|
||||
$document['title'] = $text['title-call_detail_records_archive'];
|
||||
}
|
||||
else {
|
||||
$document['title'] = $text['title-call_detail_records'];
|
||||
}
|
||||
require_once "resources/header.php";
|
||||
|
||||
//xml cdr include
|
||||
@@ -79,17 +84,17 @@
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
echo "function send_cmd(url) {\n";
|
||||
echo " if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari\n";
|
||||
echo " xmlhttp=new XMLHttpRequest();\n";
|
||||
echo " function send_cmd(url) {\n";
|
||||
echo " if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari\n";
|
||||
echo " xmlhttp=new XMLHttpRequest();\n";
|
||||
echo " }\n";
|
||||
echo " else {// code for IE6, IE5\n";
|
||||
echo " xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
|
||||
echo " }\n";
|
||||
echo " xmlhttp.open(\"GET\",url,true);\n";
|
||||
echo " xmlhttp.send(null);\n";
|
||||
echo " document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
|
||||
echo " }\n";
|
||||
echo " else {// code for IE6, IE5\n";
|
||||
echo " xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
|
||||
echo " }\n";
|
||||
echo " xmlhttp.open(\"GET\",url,true);\n";
|
||||
echo " xmlhttp.send(null);\n";
|
||||
echo " document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;\n";
|
||||
echo "}\n";
|
||||
echo "</script>\n";
|
||||
|
||||
//javascript to toggle export select box
|
||||
@@ -103,11 +108,29 @@
|
||||
echo " }";
|
||||
echo "</script>";
|
||||
|
||||
//page title and description
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_detail_records']."</b></div>\n";
|
||||
echo " <div class='heading'>";
|
||||
if ($archive_request) {
|
||||
echo "<b>".$text['title-call_detail_records_archive']."</b>";
|
||||
}
|
||||
else {
|
||||
echo "<b>".$text['title-call_detail_records']."</b>";
|
||||
}
|
||||
echo "</div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo " <form id='frm_export' class='inline' method='post' action='xml_cdr_export.php'>\n";
|
||||
if (!$archive_request) {
|
||||
if (permission_exists('xml_cdr_statistics')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-statistics'],'icon'=>'chart-area','link'=>'xml_cdr_statistics.php']);
|
||||
}
|
||||
if (permission_exists('xml_cdr_archive')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-archive'],'icon'=>'archive','link'=>'xml_cdr_archive.php'.($_REQUEST['show'] == 'all' ? '?show=all' : null)]);
|
||||
}
|
||||
}
|
||||
echo "<form id='frm_export' class='inline' method='post' action='xml_cdr_export.php'>\n";
|
||||
if ($archive_request) {
|
||||
echo " <input type='hidden' name='archive_request' value='true'>\n";
|
||||
}
|
||||
echo " <input type='hidden' name='cdr_id' value='".escape($cdr_id)."'>\n";
|
||||
echo " <input type='hidden' name='direction' value='".escape($direction)."'>\n";
|
||||
echo " <input type='hidden' name='caller_id_name' value='".escape($caller_id_name)."'>\n";
|
||||
@@ -138,14 +161,14 @@
|
||||
echo " <input type='hidden' name='bridge_uuid' value='".escape($bridge_uuid)."'>\n";
|
||||
echo " <input type='hidden' name='leg' value='".escape($leg)."'>\n";
|
||||
if (permission_exists('xml_cdr_all') && $_REQUEST['show'] == 'all') {
|
||||
echo "<input type='hidden' name='show' value='all'>\n";
|
||||
echo " <input type='hidden' name='show' value='all'>\n";
|
||||
}
|
||||
if (is_array($_SESSION['cdr']['field'])) {
|
||||
foreach ($_SESSION['cdr']['field'] as $field) {
|
||||
$array = explode(",", $field);
|
||||
$field_name = $array[count($array) - 1];
|
||||
if (isset($_REQUEST[$field_name])) {
|
||||
echo "<input type='hidden' name='".escape($field_name)."' value='".escape($$field_name)."'>\n";
|
||||
echo " <input type='hidden' name='".escape($field_name)."' value='".escape($$field_name)."'>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,30 +176,25 @@
|
||||
echo " <input type='hidden' name='order_by' value='".escape($order_by)."'>\n";
|
||||
echo " <input type='hidden' name='order' value='".escape($order)."'>\n";
|
||||
}
|
||||
if (permission_exists('xml_cdr_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
if (permission_exists('xml_cdr_all')) {
|
||||
if ($_REQUEST['show'] !== 'all') {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
|
||||
}
|
||||
if ($archive_request) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'xml_cdr.php']);
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>'sync-alt','style'=>'margin-left: 15px;','onclick'=>'location.reload(true);']);
|
||||
if ($_GET['call_result'] != 'missed') {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-missed'],'icon'=>'phone-slash','link'=>'?call_result=missed']);
|
||||
}
|
||||
if (permission_exists('xml_cdr_statistics')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-statistics'],'icon'=>'chart-area','link'=>'xml_cdr_statistics.php']);
|
||||
}
|
||||
if (permission_exists('xml_cdr_archive')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-archive'],'icon'=>'archive','link'=>'xml_cdr_archive.php'.($_REQUEST['show'] == 'all' ? '?show=all' : null)]);
|
||||
}
|
||||
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'onclick'=>"toggle_select('export_format'); this.blur();"]);
|
||||
echo "<select class='formfld' style='display: none; width: auto;' name='export_format' id='export_format' onchange=\"display_message('".$text['message-preparing_download']."'); toggle_select('export_format'); document.getElementById('frm_export').submit();\">";
|
||||
echo " <option value='' disabled='disabled' selected='selected'>".$text['label-format']."</option>";
|
||||
echo " <option value='csv'>CSV</option>";
|
||||
echo " <option value='pdf'>PDF</option>";
|
||||
echo " </select>";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>'sync-alt','link'=>'xml_cdr.php']);
|
||||
if (!$archive_request && permission_exists('xml_cdr_delete')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'onclick'=>"if (confirm('".$text['confirm-delete']."')) { list_action_set('delete'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
}
|
||||
if (permission_exists('xml_cdr_all') && $_REQUEST['show'] !== 'all') {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
|
||||
}
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
||||
}
|
||||
@@ -467,10 +485,10 @@
|
||||
if (permission_exists('xml_cdr_all') && $_REQUEST['show'] == 'all') {
|
||||
echo "<input type='hidden' name='show' value='all'>\n";
|
||||
}
|
||||
if (permission_exists('xml_cdr_search_advanced')) {
|
||||
if (!$archive_request && permission_exists('xml_cdr_search_advanced')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-advanced_search'],'icon'=>'tools','link'=>"xml_cdr_search.php".($_REQUEST['show'] == 'all' ? '?show=all' : null),'style'=>'margin-right: 15px;']);
|
||||
}
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','link'=>'xml_cdr.php']);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','link'=>($archive_request ? 'xml_cdr_archive.php' : 'xml_cdr.php')]);
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','name'=>'submit']);
|
||||
echo "</div>\n";
|
||||
echo "<div style='font-size: 85%; padding-top: 12px; margin-bottom: 40px;'>".$text['description_search']."</div>\n";
|
||||
@@ -489,7 +507,7 @@
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
$col_count = 0;
|
||||
if (permission_exists('xml_cdr_delete')) {
|
||||
if (!$archive_request && permission_exists('xml_cdr_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
@@ -645,7 +663,7 @@
|
||||
$list_row_url = "xml_cdr_details.php?id=".urlencode($row['xml_cdr_uuid']).($_REQUEST['show'] ? "&show=all" : null);
|
||||
}
|
||||
$content .= "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
if (permission_exists('xml_cdr_delete')) {
|
||||
if (!$archive_request && permission_exists('xml_cdr_delete')) {
|
||||
$content .= " <td class='checkbox middle'>\n";
|
||||
$content .= " <input type='checkbox' name='xml_cdrs[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
||||
$content .= " <input type='hidden' name='xml_cdrs[$x][uuid]' value='".escape($row['xml_cdr_uuid'])."' />\n";
|
||||
@@ -669,7 +687,7 @@
|
||||
}
|
||||
if (strlen($row['direction']) > 0) {
|
||||
$image_name = "icon_cdr_" . $row['direction'] . "_" . $call_result;
|
||||
if($row['leg'] == 'b') {
|
||||
if ($row['leg'] == 'b') {
|
||||
$image_name .= '_b';
|
||||
}
|
||||
$image_name .= ".png";
|
||||
@@ -826,12 +844,7 @@
|
||||
else {
|
||||
$content .= " <td class='middle no-wrap hide-sm-dn'>".ucwords(escape($call_result))."</td>\n";
|
||||
}
|
||||
//action icon
|
||||
//if (permission_exists('xml_cdr_details')) {
|
||||
// $content .= " <td class='action-button'>";
|
||||
// $content .= button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]);
|
||||
// $content .= " </td>\n";
|
||||
//}
|
||||
|
||||
$content .= "</tr>\n";
|
||||
|
||||
//show the leg b only to those with the permission
|
||||
@@ -845,15 +858,13 @@
|
||||
|
||||
$x++;
|
||||
}
|
||||
unset($sql, $result, $row_count);
|
||||
}
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
//store last search/sort query parameters in session
|
||||
@@ -862,4 +873,4 @@
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user