From bacd854b35fb9fe6441188c6fc26cf44c69c60a3 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Sat, 12 Jul 2014 07:47:46 +0000 Subject: [PATCH] Call Block: Enhanced Recent Calls list (row hover click, direction icon, view icon link to CDR record, etc). --- app/call_block/app_languages.php | 20 ++++++++++++ app/call_block/call_block_edit.php | 51 ++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/app/call_block/app_languages.php b/app/call_block/app_languages.php index 3de60b0157..9eb1e04c61 100644 --- a/app/call_block/app_languages.php +++ b/app/call_block/app_languages.php @@ -40,6 +40,16 @@ $text['label-enabled']['pt-pt'] = "Activado"; $text['label-enabled']['fr-fr'] = "Actif"; + $text['label-inbound']['en-us'] = "Inbound"; + $text['label-inbound']['es-cl'] = "Entrada"; + $text['label-inbound']['pt-pt'] = "Entrada"; + $text['label-inbound']['fr-fr'] = "Entrant"; + + $text['label-local']['en-us'] = "Local"; + $text['label-local']['es-cl'] = "Local"; + $text['label-local']['pt-pt'] = "Local"; + $text['label-local']['fr-fr'] = "Local"; + $text['button-edit']['en-us'] = "Edit"; $text['button-edit']['es-cl'] = "Editar"; $text['button-edit']['pt-pt'] = "Editar"; @@ -54,6 +64,11 @@ $text['button-add']['pt-pt'] = "Adicionar"; $text['button-add']['fr-fr'] = "Ajouter"; + $text['button-view']['en-us'] = "View"; + $text['button-view']['es-cl'] = "Ver"; + $text['button-view']['pt-pt'] = "Vista"; + $text['button-view']['fr-fr'] = "Voir"; + $text['confirm-delete']['en-us'] = "Do you really want to delete this?"; $text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar el número?"; $text['confirm-delete']['pt-pt'] = "Deseja realmente remover isto?"; @@ -102,6 +117,11 @@ $text['label-called-on']['pt-pt'] = "Chamado em"; $text['label-called-on']['fr-fr'] = "Appelé sur"; + $text['label-duration']['en-us'] = "Duration"; + $text['label-duration']['es-cl'] = "Duración"; + $text['label-duration']['pt-pt'] = "Duração"; + $text['label-duration']['fr-fr'] = "Durée"; + $text['label-edit-add']['en-us'] = "Call Block"; $text['label-edit-add']['es-cl'] = "Agregar bloqueo de llamada"; $text['label-edit-add']['pt-pt'] = "Adicionar Bloqueio de Chamadas"; diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 15840c71b1..ea1e9c3f4f 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -329,7 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //get recent calls from the db (if not editing an existing call block record) if (!isset($_REQUEST["id"])) { - $sql = "select caller_id_number, caller_id_name, start_epoch, uuid from v_xml_cdr "; + $sql = "select caller_id_number, caller_id_name, start_epoch, direction, hangup_cause, duration, billsec, uuid from v_xml_cdr "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and direction != 'outbound' "; $sql .= "order by start_stamp DESC "; @@ -342,29 +342,57 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "".$text['label-edit-add-recent'].""; echo "

"; - echo "\n"; - echo "\n"; + echo "
\n"; + echo "\n"; echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order); echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order); echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order); - + echo th_order_by('duration', $text['label-duration'], $order_by, $order); + echo "\n"; $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; if ($result_count > 0) { foreach($result as $row) { + $tr_onclick = " onclick=\"call_block_recent('".$row['uuid']."','".urlencode($row['caller_id_name'])."');\" "; if (strlen($row['caller_id_number']) >= 7) { if (defined('TIME_24HR') && TIME_24HR == 1) { $tmp_start_epoch = date("j M Y H:i:s", $row['start_epoch']); } else { $tmp_start_epoch = date("j M Y h:i:sa", $row['start_epoch']); } - echo "\n"; - echo " \n"; + if ( + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_missed.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_connected.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png") && + file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_connected.png") + ) { + echo " \n"; + } + else { + echo " "; + } + echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; + $seconds = ($row['hangup_cause']=="ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; //If they cancelled, show the ring time, not the bill time. + echo " \n"; + echo " "; echo "\n";
  
"; + echo "
"; + switch ($row['direction']) { + case "inbound" : + if ($row['billsec'] == 0) + echo "".$text[\n"; + else + echo "".$text[\n"; + break; + case "local" : + if ($row['billsec'] == 0) + echo "".$text[\n"; + else + echo "".$text[\n"; + break; + } + echo "  "; echo $row['caller_id_name'].' '; echo " "; + echo " "; if (is_numeric($row['caller_id_number'])) { echo format_phone($row['caller_id_number']).' '; } @@ -372,8 +400,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $row['caller_id_number'].' '; } echo " ".$tmp_start_epoch.""; + echo " ".$tmp_start_epoch."".gmdate("G:i:s", $seconds).""; + if (if_group("admin") || if_group("superadmin")) { + echo " ".$v_link_label_view.""; + } echo "".$v_link_label_add.""; echo "