From 3d36d02aee3c0c5faf14d52fc9d39e29fcbba232 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 30 Dec 2012 00:58:17 +0000 Subject: [PATCH] Fix the multi-lingual framework for voicemail messages, and add a link to it. --- app/voicemails/app_languages.php | 67 +++++++++++++++++++ app/voicemails/voicemail_messages.php | 95 ++++++++++++++++++++++++--- app/voicemails/voicemails.php | 15 ++++- 3 files changed, 166 insertions(+), 11 deletions(-) diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php index 7d47e4cc4a..429e76abeb 100644 --- a/app/voicemails/app_languages.php +++ b/app/voicemails/app_languages.php @@ -58,6 +58,15 @@ $text['description-voicemail_description']['en-us'] = 'Enter the description.'; $text['description-voicemail_description']['pt-pt'] = ''; + $text['label-count']['en-us'] = 'Count'; + $text['label-count']['pt-pt'] = ''; + + $text['label-tools']['en-us'] = 'Tools'; + $text['label-tools']['pt-pt'] = 'Ferramentas'; + + $text['label-view']['en-us'] = 'View'; + $text['label-view']['pt-pt'] = ''; + $text['label-true']['en-us'] = 'true'; $text['label-true']['pt-pt'] = ''; @@ -97,4 +106,62 @@ $text['message-required']['en-us'] = 'Please provide: '; $text['message-required']['pt-pt'] = ''; + //Voicemail Messages + $text['title-voicemail_messages']['en-us'] = 'Voicemail Messages'; + $text['title-voicemail_messages']['pt-pt'] = ''; + + $text['title-voicemail_message']['en-us'] = 'Voicemail Message'; + $text['title-voicemail_message']['pt-pt'] = ''; + + $text['description-voicemail_message']['en-us'] = 'Voicemail Messages.'; + $text['description-voicemail_message']['pt-pt'] = ''; + + $text['label-voicemail_uuid']['en-us'] = 'Voicemail UUID'; + $text['label-voicemail_uuid']['pt-pt'] = ''; + + $text['description-voicemail_uuid']['en-us'] = 'Voicemail UUID'; + $text['description-voicemail_uuid']['pt-pt'] = ''; + + $text['label-created_epoch']['en-us'] = 'Created Epoch'; + $text['label-created_epoch']['pt-pt'] = ''; + + $text['description-created_epoch']['en-us'] = 'Created Epoch'; + $text['description-created_epoch']['pt-pt'] = ''; + + $text['label-read_epoch']['en-us'] = 'Read Epoch'; + $text['label-read_epoch']['pt-pt'] = ''; + + $text['description-read_epoch']['en-us'] = 'Read Epoch'; + $text['description-read_epoch']['pt-pt'] = ''; + + $text['label-caller_id_name']['en-us'] = 'Caller ID Name'; + $text['label-caller_id_name']['pt-pt'] = ''; + + $text['description-caller_id_name']['en-us'] = 'Caller ID Name'; + $text['description-caller_id_name']['pt-pt'] = ''; + + $text['label-caller_id_number']['en-us'] = 'Caller ID Number'; + $text['label-caller_id_number']['pt-pt'] = ''; + + $text['description-caller_id_number']['en-us'] = 'Caller ID Number'; + $text['description-caller_id_number']['pt-pt'] = ''; + + $text['label-message_length']['en-us'] = 'Length'; + $text['label-message_length']['pt-pt'] = ''; + + $text['description-message_length']['en-us'] = 'Length'; + $text['description-message_length']['pt-pt'] = ''; + + $text['label-message_status']['en-us'] = 'Status'; + $text['label-message_status']['pt-pt'] = ''; + + $text['description-message_status']['en-us'] = 'Status'; + $text['description-message_status']['pt-pt'] = ''; + + $text['label-message_priority']['en-us'] = 'Priority'; + $text['label-message_priority']['pt-pt'] = ''; + + $text['description-message_priority']['en-us'] = 'Priority'; + $text['description-message_priority']['pt-pt'] = ''; + ?> \ No newline at end of file diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 3d98adf663..3d16893e9d 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -39,6 +39,76 @@ else { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } +//download the voicemail + if ($_GET['a'] == "download") { + + session_cache_limiter('public'); + $uuid = check_str($_GET["uuid"]); + + $sql = "select * from v_voicemail_messages "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and voicemail_message_uuid = '$uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $voicemail_uuid = $row["voicemail_uuid"]; + $created_epoch = $row["created_epoch"]; + $read_epoch = $row["read_epoch"]; + $caller_id_name = $row["caller_id_name"]; + $caller_id_number = $row["caller_id_number"]; + $message_length = $row["message_length"]; + $message_status = $row["message_status"]; + $message_priority = $row["message_priority"]; + } + unset ($prep_statement); + + $sql = "select * from v_voicemails "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and voicemail_uuid = '$voicemail_uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $voicemail_id = $row["voicemail_id"]; + } + unset ($prep_statement); + + if ($_GET['type'] = "vm") { + file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$voicemail_id."/msg_".$voicemail_uuid.".wav"; + if (file_exists($file_path)) { + $fd = fopen($file_path, "rb"); + if ($_GET['t'] == "bin") { + header("Content-Type: application/force-download"); + header("Content-Type: application/octet-stream"); + header("Content-Type: application/download"); + header("Content-Description: File Transfer"); + $file_ext = substr($file_path, -3); + if ($file_ext == "wav") { + header('Content-Disposition: attachment; filename="voicemail.wav"'); + } + if ($file_ext == "mp3") { + header('Content-Disposition: attachment; filename="voicemail.mp3"'); + } + } + else { + $file_ext = substr($file_path, -3); + if ($file_ext == "wav") { + header("Content-Type: audio/x-wav"); + } + if ($file_ext == "mp3") { + header("Content-Type: audio/mp3"); + } + } + header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past + header("Content-Length: " . filesize($file_path)); + fpassthru($fd); + } + return; + } + } + //get the html values and set them as variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; @@ -87,7 +157,7 @@ else { } //prepare to page the results - $rows_per_page = 10; + $rows_per_page = 150; $param = ""; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } @@ -98,7 +168,12 @@ else { $sql = "select * from v_voicemail_messages "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and voicemail_uuid = '$voicemail_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + if (strlen($order_by) == 0) { + $sql .= "order by created_epoch desc "; + } + else { + $sql .= "order by $order_by $order "; + } $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); @@ -113,14 +188,14 @@ else { echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('voicemail_uuid', $text['label-voicemail_uuid'], $order_by, $order); + //echo th_order_by('voicemail_uuid', $text['label-voicemail_uuid'], $order_by, $order); echo th_order_by('created_epoch', $text['label-created_epoch'], $order_by, $order); - echo th_order_by('read_epoch', $text['label-read_epoch'], $order_by, $order); + //echo th_order_by('read_epoch', $text['label-read_epoch'], $order_by, $order); echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order); echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order); echo th_order_by('message_length', $text['label-message_length'], $order_by, $order); echo th_order_by('message_status', $text['label-message_status'], $order_by, $order); - echo th_order_by('message_priority', $text['label-message_priority'], $order_by, $order); + //echo th_order_by('message_priority', $text['label-message_priority'], $order_by, $order); echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; + //echo " \n"; + echo "\n"; + //echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; - echo " \n"; + //echo " \n"; echo " \n"; + echo "\n"; echo th_order_by('voicemail_enabled', $text['label-voicemail_enabled'], $order_by, $order); echo th_order_by('voicemail_description', $text['label-voicemail_description'], $order_by, $order); echo "\n"; echo " \n"; echo " \n"; + //echo " \n"; + echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo "
\n"; if (permission_exists('voicemail_message_add')) { echo " $v_link_label_add\n"; @@ -134,14 +209,16 @@ else { if ($result_count > 0) { foreach($result as $row) { echo "
".$row['voicemail_uuid']." ".$row['created_epoch']." ".$row['read_epoch']." ".$row['voicemail_uuid']." "; + echo " ".date("j M Y g:i a",$row['created_epoch']); + echo "".$row['read_epoch']." ".$row['caller_id_name']." ".$row['caller_id_number']." ".$row['message_length']." ".$row['message_status']." ".$row['message_priority']." ".$row['message_priority']." \n"; if (permission_exists('voicemail_message_edit')) { echo " $v_link_label_edit\n"; diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index 3d0006a7e7..f88982639f 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -93,7 +93,12 @@ else { //get the list $sql = "select * from v_voicemails "; $sql .= "where domain_uuid = '$domain_uuid' "; - if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } + if (strlen($order_by) == 0) { + $sql .= "order by voicemail_id asc "; + } + else { + $sql .= "order by $order_by $order "; + } $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); @@ -114,6 +119,8 @@ else { echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order); echo th_order_by('voicemail_attach_file', $text['label-voicemail_attach_file'], $order_by, $order); echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order); + //echo "".$text['label-count']."".$text['label-tools']."\n"; @@ -135,8 +142,12 @@ else { echo " ".$row['voicemail_mail_to']." ".$row['voicemail_attach_file']." ".$row['voicemail_local_after_email']."  \n"; + echo " ".$text['label-view']." \n"; + echo " ".$row['voicemail_enabled']." ".$row['voicemail_description']." ".$row['voicemail_description']." \n"; if (permission_exists('voicemail_edit')) { echo " $v_link_label_edit\n";