From cca4fee7c9a507a2f045c6cd98abc981403a7c77 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Thu, 4 Sep 2014 06:57:26 +0000 Subject: [PATCH] Fax Server: Multiple file upload, customize contact info line and footer in cover sheet, other minor tweaks. --- app/fax/app_defaults.php | 17 +- app/fax/app_languages.php | 36 +++- app/fax/fax_send.php | 193 +++++++++++++----- core/default_settings/app_languages.php | 15 ++ .../default_settings/default_setting_edit.php | 7 + 5 files changed, 200 insertions(+), 68 deletions(-) diff --git a/app/fax/app_defaults.php b/app/fax/app_defaults.php index 52accdf3c0..f85339b81a 100644 --- a/app/fax/app_defaults.php +++ b/app/fax/app_defaults.php @@ -12,18 +12,18 @@ if ($domains_processed == 1) { $array[$x]['default_setting_description'] = 'Path to image/logo file displayed in the header of the cover sheet.'; $x++; $array[$x]['default_setting_category'] = 'fax'; - $array[$x]['default_setting_subcategory'] = 'cover_disclaimer'; + $array[$x]['default_setting_subcategory'] = 'cover_footer'; $array[$x]['default_setting_name'] = 'text'; - $array[$x]['default_setting_value'] = "The information contained in this facsimile message is intended for the sole confidential use of the designated recipient(s) and may contain confidential information. If you have received this information in error, any review, dissemination, distribution or copying of this information is strictly prohibited. Please notify us immediately and return the original message to us by mail or, if electronic, reroute back to the sender."; - $array[$x]['default_setting_enabled'] = 'false'; - $array[$x]['default_setting_description'] = 'Disclaimer displayed in the footer of the cover sheet.'; + $array[$x]['default_setting_value'] = "The information contained in this facsimile is intended for the sole confidential use of the recipient(s) designated above, and may contain confidential and legally privileged information. If you are not the intended recipient, you are hereby notified that the review, disclosure, dissemination, distribution, copying, duplication in any form, and taking of any action in regards to the contents of this document - except with respect to its direct delivery to the intended recipient - is strictly prohibited. Please notify the sender immediately and destroy this cover sheet and all attachments. If stored or viewed electronically, please permanently delete it from your system."; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Notice displayed in the footer of the cover sheet.'; $x++; $array[$x]['default_setting_category'] = 'fax'; $array[$x]['default_setting_subcategory'] = 'cover_contact_info'; $array[$x]['default_setting_name'] = 'text'; $array[$x]['default_setting_value'] = ''; $array[$x]['default_setting_enabled'] = 'false'; - $array[$x]['default_setting_description'] = 'Contact information displayed below the logo in the cover sheet header.'; + $array[$x]['default_setting_description'] = 'Default contact information to appear beneath the logo in the header of the cover page.'; $x++; $array[$x]['default_setting_category'] = 'fax'; $array[$x]['default_setting_subcategory'] = 'page_size'; @@ -32,6 +32,13 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Set the default page size of new faxes.'; $x++; + $array[$x]['default_setting_category'] = 'fax'; + $array[$x]['default_setting_subcategory'] = 'resolution'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'normal'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'Set the default transmission quality of new faxes.'; + $x++; //iterate and add each, if necessary foreach ($array as $index => $default_settings) { diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php index a4d0b53b54..4aa63006c7 100644 --- a/app/fax/app_languages.php +++ b/app/fax/app_languages.php @@ -75,15 +75,15 @@ $text['label-description']['pt-pt'] = "Descrição"; $text['label-description']['fr-fr'] = "Description"; - $text['label-fax_file']['en-us'] = "Fax File"; - $text['label-fax_file']['es-cl'] = "Subir"; - $text['label-fax_file']['pt-pt'] = "Carregar"; - $text['label-fax_file']['fr-fr'] = "Télécharegr"; + $text['label-fax_files']['en-us'] = "Fax File(s)"; + $text['label-fax_files']['es-cl'] = "Facsímil del Archivo(s)"; + $text['label-fax_files']['pt-pt'] = "Fax Arquivo(s)"; + $text['label-fax_files']['fr-fr'] = "Télécopieur Fichier(s)"; - $text['description-upload']['en-us'] = "Select the file(s) to upload and send."; - $text['description-upload']['es-cl'] = "Seleccione el archivo a subir y enviar como fax."; - $text['description-upload']['pt-pt'] = "Selecione o ficheiro a carregar para enviar por fax."; - $text['description-upload']['fr-fr'] = "Choisir un fichier à télécharger pour être émis en tant que Fax."; + $text['description-fax_files']['en-us'] = "Select the file(s) to upload and send."; + $text['description-fax_files']['es-cl'] = "Seleccione el archivo a subir y enviar como fax."; + $text['description-fax_files']['pt-pt'] = "Selecione o ficheiro a carregar para enviar por fax."; + $text['description-fax_files']['fr-fr'] = "Choisir un fichier à télécharger pour être émis en tant que Fax."; $text['button-edit']['en-us'] = "Edit"; $text['button-edit']['es-cl'] = "Editar"; @@ -278,6 +278,16 @@ $text['description-fax-sender']['pt-pt'] = "Digite o nome do remetente (opcional)."; $text['description-fax-sender']['fr-fr'] = "Entrez le nom de l'expéditeur (facultatif)."; + $text['label-fax-contact-info']['en-us'] = "Contact Info"; + $text['label-fax-contact-info']['es-cl'] = "Información de Contacto"; + $text['label-fax-contact-info']['pt-pt'] = "Informações de Contato"; + $text['label-fax-contact-info']['fr-fr'] = "Contacter"; + + $text['description-fax-contact-info']['en-us'] = "Contact information to appear beneath the logo on the cover page (optional)."; + $text['description-fax-contact-info']['es-cl'] = "La información de contacto para aparecer debajo del logotipo en la portada (opcional)."; + $text['description-fax-contact-info']['pt-pt'] = "Informações de contato para aparecer abaixo do logotipo na página de rosto (opcional)."; + $text['description-fax-contact-info']['fr-fr'] = "Contactez-indications à faire figurer sous le logo sur la page de couverture (en option)."; + $text['label-fax-recipient']['en-us'] = "To"; $text['label-fax-recipient']['es-cl'] = "Destinatario"; $text['label-fax-recipient']['pt-pt'] = "Destinatário"; @@ -318,6 +328,16 @@ $text['description-fax-message']['pt-pt'] = "Digite uma mensagem para a página de rosto (opcional)."; $text['description-fax-message']['fr-fr'] = "Entrez un message pour la page de couverture (en option)."; + $text['label-fax-footer']['en-us'] = "Footer"; + $text['label-fax-footer']['es-cl'] = "Pie de Página"; + $text['label-fax-footer']['pt-pt'] = "Rodapé"; + $text['label-fax-footer']['fr-fr'] = "Footer"; + + $text['description-fax-confidentiality']['en-us'] = "Displayed in the footer of the cover sheet (optional)."; + $text['description-fax-confidentiality']['es-cl'] = "Se muestra en el pie de página de la portada (opcional)."; + $text['description-fax-confidentiality']['pt-pt'] = "Exibido no rodapé da folha de rosto (opcional)."; + $text['description-fax-confidentiality']['fr-fr'] = "Affiché dans le bas de la feuille de couverture (en option)."; + $text['label-fax-resolution']['en-us'] = "Resolution"; $text['label-fax-resolution']['es-cl'] = "Resolución"; $text['label-fax-resolution']['pt-pt'] = "Resolução"; diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index 74177b04aa..27ec33a97e 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -158,6 +158,11 @@ else { //upload (if necessary) and send the fax if (($_POST['action'] == "send")) { + echo "
";
+		print_r($_FILES['fax_files']);
+		echo "
"; + exit; + $fax_number = check_str($_POST['fax_number']); if (strlen($fax_number) > 0) { $fax_number = preg_replace("~[^0-9]~", "",$fax_number); @@ -174,11 +179,13 @@ else { } $fax_sender = check_str($_POST['fax_sender']); + $fax_contact_info = check_str($_POST['fax_contact_info']); $fax_recipient = check_str($_POST['fax_recipient']); $fax_subject = check_str($_POST['fax_subject']); $fax_message = check_str($_POST['fax_message']); $fax_resolution = check_str($_POST['fax_resolution']); $fax_page_size = check_str($_POST['fax_page_size']); + $fax_footer = check_str($_POST['fax_footer']); // process uploaded files, if any foreach ($_FILES['fax_files']['tmp_name'] as $index => $fax_tmp_name) { @@ -298,40 +305,50 @@ else { //showgrid($pdf); //logo - if (isset($_SESSION['fax']['cover_logo']['text'])) { - $logo = $_SESSION['fax']['cover_logo']['text']; + $display_logo = false; + if (!isset($_SESSION['fax']['cover_logo']['text'])) { + $logo = PROJECT_PATH."/app/fax/logo.jpg"; + $display_logo = true; } - if (substr($logo, 0, 4) == 'http') { - $remote_filename = strtolower(pathinfo($logo, PATHINFO_BASENAME)); - $remote_fileext = pathinfo($remote_filename, PATHINFO_EXTENSION); - if ($remote_fileext == 'gif' || $remote_fileext == 'jpg' || $remote_fileext == 'jpeg' || $remote_fileext == 'png' || $remote_fileext == 'bmp') { - if (!file_exists($dir_fax_temp.'/'.$remote_filename)) { - $raw = file_get_contents($logo); - if (file_put_contents($dir_fax_temp.'/'.$remote_filename, $raw)) { - $logo = $dir_fax_temp.'/'.$remote_filename; + else if (isset($_SESSION['fax']['cover_logo']['text']) && $_SESSION['fax']['cover_logo']['text'] != '') { + $logo = $_SESSION['fax']['cover_logo']['text']; + if (substr($logo, 0, 4) == 'http') { + $remote_filename = strtolower(pathinfo($logo, PATHINFO_BASENAME)); + $remote_fileext = pathinfo($remote_filename, PATHINFO_EXTENSION); + if ($remote_fileext == 'gif' || $remote_fileext == 'jpg' || $remote_fileext == 'jpeg' || $remote_fileext == 'png' || $remote_fileext == 'bmp') { + if (!file_exists($dir_fax_temp.'/'.$remote_filename)) { + $raw = file_get_contents($logo); + if (file_put_contents($dir_fax_temp.'/'.$remote_filename, $raw)) { + $logo = $dir_fax_temp.'/'.$remote_filename; + } + else { + unset($logo); + } } else { - unset($logo); + $logo = $dir_fax_temp.'/'.$remote_filename; } } else { - $logo = $dir_fax_temp.'/'.$remote_filename; + unset($logo); } } - else { - unset($logo); - } + $display_logo = true; } - if ($logo == '') { - $logo = PROJECT_PATH."/app/fax/logo.jpg"; + + if ($display_logo) { + $pdf -> Image($logo, 0.5, 0.4, 2.5, 0.9, null, null, 'N', true, 300, null, false, false, 0, true); + } + else { + //set position for contact info, if enabled + $pdf -> SetXY($x + 0.5, $y + 0.4); } - $pdf -> Image($logo, 0.5, 0.4, 2.5, 0.9, null, null, 'N', true, 300, null, false, false, 0, true); //contact info if (isset($_SESSION['fax']['cover_contact_info']['text'])) { $pdf -> SetLeftMargin(0.5); $pdf -> SetFont("times", "", 10); - $pdf -> Write(0.3, $_SESSION['fax']['cover_contact_info']['text']); + $pdf -> Write(0.3, $fax_contact_info); } //fax, cover sheet @@ -347,8 +364,12 @@ else { //field labels $pdf -> SetFont("times", "B", 12); - $pdf -> Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":"); - $pdf -> Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']).":"); + if ($fax_recipient != '' || $fax_number != '') { + $pdf -> Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']).":"); + } + if ($fax_sender != '' || $fax_caller_id_number != '') { + $pdf -> Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']).":"); + } if ($page_count > 0) { $pdf -> Text($x + 0.5, $y + 2.6, strtoupper($text['label-fax-attached']).":"); } @@ -358,8 +379,30 @@ else { //field values $pdf -> SetFont("times", "", 12); - $pdf -> Text($x + 2.0, $y + 2.0, (($fax_recipient != '') ? $fax_recipient.' ('.format_phone($fax_number).')' : format_phone($fax_number)) ); - $pdf -> Text($x + 2.0, $y + 2.3, (($fax_sender != '') ? $fax_sender.' ('.format_phone($fax_caller_id_number).')' : format_phone($fax_caller_id_number)) ); + $pdf -> SetXY($x + 2.0, $y + 1.95); + if ($fax_recipient != '') { + $pdf -> Write(0.3, $fax_recipient); + if ($fax_number != '') { + $pdf -> Write(0.3, ' ('.format_phone($fax_number).')'); + } + } + else { + if ($fax_number != '') { + $pdf -> Write(0.3, format_phone($fax_number)); + } + } + $pdf -> SetXY($x + 2.0, $y + 2.25); + if ($fax_sender != '') { + $pdf -> Write(0.3, $fax_sender); + if ($fax_caller_id_number != '') { + $pdf -> Write(0.3, ' ('.format_phone($fax_caller_id_number).')'); + } + } + else { + if ($fax_caller_id_number != '') { + $pdf -> Write(0.3, format_phone($fax_caller_id_number)); + } + } if ($page_count > 0) { $pdf -> Text($x + 2.0, $y + 2.6, $page_count.' '.$text['label-fax-page'.(($page_count > 1) ? 's' : null)]); } @@ -368,18 +411,18 @@ else { } //message + $pdf -> Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D'); if ($fax_message != '') { - $pdf -> Rect($x + 0.5, $y + 3.4, 7.5, 6.5, 'D'); $pdf -> SetFont("times", "", 12); $pdf -> SetXY($x + 0.75, $y + 3.65); - $pdf -> MultiCell(7, 6, $fax_message, 0, 'L', false); + $pdf -> MultiCell(7, 5.75, $fax_message, 0, 'L', false); } - //disclaimer - if ($_SESSION['fax']['cover_disclaimer']['text'] != '') { + //footer + if ($fax_footer != '') { $pdf -> SetFont("helvetica", "", 8); - $pdf -> SetXY($x + 0.5, $y + 10.15); - $pdf -> MultiCell(7.5, 0.75, $_SESSION['fax']['cover_disclaimer']['text'], 0, 'C', false); + $pdf -> SetXY($x + 0.5, $y + 9.9); + $pdf -> MultiCell(7.5, 0.75, $fax_footer, 0, 'C', false); } // save cover pdf file and add to array of pages @@ -392,8 +435,6 @@ else { $pdf -> Output($dir_fax_temp.'/'.$fax_instance_uuid.'_cover.pdf', "F"); // Display [I]nline, Save to [F]ile, [D]ownload } - - //create new pdf object unset($pdf); $pdf = new FPDI('P', 'in'); @@ -519,7 +560,7 @@ else { $fax_uri = $route_array[0]; $t38 = "fax_enable_t38=true,fax_enable_t38_request=true,"; } - $cmd = "api originate {mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')"; + $cmd = "api originate {domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')"; //send the command to event socket $response = event_socket_request($fp, $cmd); $response = str_replace("\n", "", $response); @@ -530,11 +571,15 @@ else { //wait for a few seconds sleep(5); + /* + //handled with lua retry script + //move the generated tif and pdf files to the sent directory - exec("mv ".$dir_fax_temp.'/'.$fax_instance_uuid.".tif ".$dir_fax_sent.'/'.$fax_instance_uuid.".tif"); + exec("cp ".$dir_fax_temp.'/'.$fax_instance_uuid.".tif ".$dir_fax_sent.'/'.$fax_instance_uuid.".tif"); if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".pdf")) { - exec("mv ".$dir_fax_temp.'/'.$fax_instance_uuid.".pdf ".$dir_fax_sent.'/'.$fax_instance_uuid.".pdf"); + exec("cp ".$dir_fax_temp.'/'.$fax_instance_uuid.".pdf ".$dir_fax_sent.'/'.$fax_instance_uuid.".pdf"); } + */ //copy the original uploaded file to the sent box foreach ($_SESSION['fax']['save'] as $row) { @@ -593,8 +638,19 @@ else { echo "\n"; echo "\n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-sender']."\n"; + echo "
\n"; + echo " ".$text['description-fax-sender']."\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo " ".$text['label-fax-contact-info']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo " ".$text['description-fax-contact-info']."\n"; echo "\n"; echo "\n"; @@ -604,8 +660,8 @@ else { echo "\n"; echo "\n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-recipient']."\n"; + echo "
\n"; + echo " ".$text['description-fax-recipient']."\n"; echo "\n"; echo "\n"; @@ -615,22 +671,38 @@ else { echo "\n"; echo "\n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-number']."\n"; + echo "
\n"; + echo " ".$text['description-fax-number']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " ".$text['label-fax_file']."\n"; + echo " ".$text['label-fax_files']."\n"; echo "\n"; echo "\n"; - for ($f = 1; $f <= 5; $f++) { + echo " "; + for ($f = 1; $f <= 3; $f++) { echo " 1) ? "style='display: none;'" : null).">"; - echo " 1) ? "style='margin-top: 3px;'" : null)." accept='image/tiff,application/pdf' ".(($f < 5) ? "onchange=\"document.getElementById('fax_file_".($f+1)."').style.display='';\"" : null).">
"; + echo " 1) ? "style='margin-top: 3px;'" : null)." accept='image/tiff,application/pdf' onchange=\"".(($f < 3) ? "document.getElementById('fax_file_".($f+1)."').style.display='';" : null)." list_selected_files(".$f.");\" multiple='multiple'>
"; + echo " "; echo "
\n"; } - echo " ".$text['description-upload']."\n"; + echo " ".$text['description-fax_files']."\n"; echo "\n"; echo "\n"; @@ -640,12 +712,12 @@ else { echo "\n"; echo "\n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-resolution']."\n"; + echo "
\n"; + echo " ".$text['description-fax-resolution']."\n"; echo "\n"; echo "\n"; @@ -660,8 +732,8 @@ else { echo " \n"; echo " \n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-page-size']."\n"; + echo "
\n"; + echo " ".$text['description-fax-page-size']."\n"; echo "\n"; echo "\n"; @@ -671,8 +743,8 @@ else { echo "\n"; echo "\n"; echo " \n"; - echo "
\n"; - echo "".$text['description-fax-subject']."\n"; + echo "
\n"; + echo " ".$text['description-fax-subject']."\n"; echo "\n"; echo "\n"; @@ -681,9 +753,20 @@ else { echo " ".$text['label-fax-message']."\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo "".$text['description-fax-message']."\n"; + echo " ".$text['description-fax-message']."\n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo " ".$text['label-fax-footer']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo " ".$text['description-fax-footer']."\n"; echo "\n"; echo "\n"; diff --git a/core/default_settings/app_languages.php b/core/default_settings/app_languages.php index a628de16b4..d331ce5327 100644 --- a/core/default_settings/app_languages.php +++ b/core/default_settings/app_languages.php @@ -148,6 +148,21 @@ $text['label-auto']['pt-pt'] = "Automático"; $text['label-auto']['fr-fr'] = "Automatique"; + $text['label-normal']['en-us'] = "Normal"; + $text['label-normal']['es-cl'] = "Normal"; + $text['label-normal']['pt-pt'] = "Normal"; + $text['label-normal']['fr-fr'] = "Normal"; + + $text['label-fine']['en-us'] = "Fine"; + $text['label-fine']['es-cl'] = "Fine"; + $text['label-fine']['pt-pt'] = "Belas"; + $text['label-fine']['fr-fr'] = "Fin"; + + $text['label-superfine']['en-us'] = "Superfine"; + $text['label-superfine']['es-cl'] = "Superfino"; + $text['label-superfine']['pt-pt'] = "Extrafino"; + $text['label-superfine']['fr-fr'] = "Superfin"; + $text['button-add']['en-us'] = "Add"; $text['button-add']['es-cl'] = "Agregar"; $text['button-add']['pt-pt'] = "Adicionar"; diff --git a/core/default_settings/default_setting_edit.php b/core/default_settings/default_setting_edit.php index fe8e512f13..1b56e90f3a 100644 --- a/core/default_settings/default_setting_edit.php +++ b/core/default_settings/default_setting_edit.php @@ -446,6 +446,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " "; echo " "; } + elseif ($category == "fax" && $subcategory == "resolution" && $name == "text" ) { + echo " "; + } else { echo " \n"; }