From 460b0853c9fc59ce18a08e16e821c059ea367d2c Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 5 Mar 2014 21:16:51 +0000 Subject: [PATCH] Add greeting to the conference center interface. --- app/conference_centers/app_config.php | 4 + app/conference_centers/app_languages.php | 10 ++ .../conference_center_edit.php | 166 +++++++++++++++++- .../conference_room_edit.php | 2 +- 4 files changed, 178 insertions(+), 4 deletions(-) diff --git a/app/conference_centers/app_config.php b/app/conference_centers/app_config.php index c50afb2649..750e582049 100644 --- a/app/conference_centers/app_config.php +++ b/app/conference_centers/app_config.php @@ -200,6 +200,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the pin length."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_center_greeting"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the conference greeting."; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_center_description"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the center description."; diff --git a/app/conference_centers/app_languages.php b/app/conference_centers/app_languages.php index f38784673e..299c3f7016 100644 --- a/app/conference_centers/app_languages.php +++ b/app/conference_centers/app_languages.php @@ -198,6 +198,16 @@ $text['label-conference-name']['pt-pt'] = "Nome da Conferência"; $text['label-conference-name']['fr-fr'] = "Nom de la Conférence"; + $text['label-greeting']['en-us'] = "Greeting"; + $text['label-greeting']['es-cl'] = "Mensaje"; + $text['label-greeting']['pt-pt'] = "Saudaçãoa"; + $text['label-greeting']['fr-fr'] = "Message"; + + $text['description-greeting']['en-us'] = "Select the greeting that is played before joining the conference room."; + $text['description-greeting']['es-cl'] = "Seleccione el saludo que se juega antes de unirse a la sala de conferencias."; + $text['description-greeting']['pt-pt'] = "Selecione a saudação que é jogado antes de entrar para a sala de conferência."; + $text['description-greeting']['fr-fr'] = "Sélectionnez le message qui a joué avant de rejoindre la salle de conférence."; + $text['label-users']['en-us'] = "Users"; $text['label-users']['es-cl'] = "Usuarios"; $text['label-users']['pt-pt'] = "Utilizadores"; diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index f2261561af..d1e6c03769 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s): @@ -50,10 +50,11 @@ else { } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (count($_POST) > 0) { $dialplan_uuid = check_str($_POST["dialplan_uuid"]); $conference_center_name = check_str($_POST["conference_center_name"]); $conference_center_extension = check_str($_POST["conference_center_extension"]); + $conference_center_greeting = check_str($_POST["conference_center_greeting"]); $conference_center_pin_length = check_str($_POST["conference_center_pin_length"]); $conference_center_description = check_str($_POST["conference_center_description"]); $conference_center_enabled = check_str($_POST["conference_center_enabled"]); @@ -156,6 +157,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "conference_center_name, "; $sql .= "conference_center_extension, "; $sql .= "conference_center_pin_length, "; + $sql .= "conference_center_greeting, "; $sql .= "conference_center_description, "; $sql .= "conference_center_enabled "; $sql .= ")"; @@ -167,6 +169,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$conference_center_name', "; $sql .= "'$conference_center_extension', "; $sql .= "'$conference_center_pin_length', "; + $sql .= "'$conference_center_greeting', "; $sql .= "'$conference_center_description', "; $sql .= "'$conference_center_enabled' "; $sql .= ")"; @@ -212,7 +215,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "conference_center_name = '$conference_center_name', "; $sql .= "conference_center_extension = '$conference_center_extension', "; $sql .= "conference_center_pin_length = '$conference_center_pin_length', "; - //$sql .= "conference_center_order = '$conference_center_order', "; + $sql .= "conference_center_greeting = '$conference_center_greeting', "; $sql .= "conference_center_description = '$conference_center_description', "; $sql .= "conference_center_enabled = '$conference_center_enabled' "; $sql .= "where domain_uuid = '$domain_uuid' "; @@ -273,6 +276,56 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) +//function to show the list of sound files + function recur_sounds_dir($dir) { + global $dir_array; + global $dir_path; + $dir_list = opendir($dir); + while ($file = readdir ($dir_list)) { + if ($file != '.' && $file != '..') { + $newpath = $dir.'/'.$file; + $level = explode('/',$newpath); + if (substr($newpath, -4) == ".svn") { + //ignore .svn dir and subdir + } + else { + if (is_dir($newpath)) { //directories + recur_sounds_dir($newpath); + } + else { //files + if (strlen($newpath) > 0) { + //make the path relative + $relative_path = substr($newpath, strlen($dir_path), strlen($newpath)); + //remove the 8000-48000 khz from the path + $relative_path = str_replace("/8000/", "/", $relative_path); + $relative_path = str_replace("/16000/", "/", $relative_path); + $relative_path = str_replace("/32000/", "/", $relative_path); + $relative_path = str_replace("/48000/", "/", $relative_path); + //remove the default_language, default_dialect, and default_voice (en/us/callie) from the path + $file_array = explode( "/", $relative_path ); + $x = 1; + $relative_path = ''; + foreach( $file_array as $tmp) { + if ($x == 5) { $relative_path .= $tmp; } + if ($x > 5) { $relative_path .= '/'.$tmp; } + $x++; + } + //add the file if it does not exist in the array + if (isset($dir_array[$relative_path])) { + //already exists + } + else { + //add the new path + if (strlen($relative_path) > 0) { $dir_array[$relative_path] = '0'; } + } + } + } + } + } + } + closedir($dir_list); + } + //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $conference_center_uuid = $_GET["id"]; @@ -285,6 +338,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { $dialplan_uuid = $row["dialplan_uuid"]; $conference_center_name = $row["conference_center_name"]; + $conference_center_greeting = $row["conference_center_greeting"]; $conference_center_extension = $row["conference_center_extension"]; $conference_center_pin_length = $row["conference_center_pin_length"]; $conference_center_order = $row["conference_center_order"]; @@ -350,6 +404,112 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-greeting'].":\n"; + echo "\n"; + echo "\n"; + if (if_group("superadmin")) { + echo "\n"; + echo "\n"; + } + if (if_group("superadmin")) { + echo " \n"; + } + echo " \n"; + //recordings + if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { + $tmp_selected = false; + $files = Array(); + echo "\n"; + while($file = readdir($dh)) { + if($file != "." && $file != ".." && $file[0] != '.') { + if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) { + //this is a directory + } + else { + if ($conference_center_greeting == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($conference_center_greeting) > 0) { + $tmp_selected = true; + echo " \n"; + } + else { + echo " \n"; + } + } + } + } + closedir($dh); + echo "\n"; + } + //sounds + $dir_path = $_SESSION['switch']['sounds']['dir']; + recur_sounds_dir($_SESSION['switch']['sounds']['dir']); + echo "\n"; + foreach ($dir_array as $key => $value) { + if (strlen($value) > 0) { + if (substr($conference_center_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { + $conference_center_greeting = substr($conference_center_greeting, 71); + } + if ($conference_center_greeting == $key) { + $tmp_selected = true; + echo " \n"; + } else { + echo " \n"; + } + } + } + echo "\n"; + //select + if (strlen($conference_center_greeting) > 0) { + if (if_group("superadmin")) { + if (!$tmp_selected) { + echo "\n"; + if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_center_greeting)) { + echo " \n"; + } elseif (substr($conference_center_greeting, -3) == "wav" || substr($conference_center_greeting, -3) == "mp3") { + echo " \n"; + } else { + echo " \n"; + } + echo "\n"; + } + unset($tmp_selected); + } + } + echo " \n"; + echo "
\n"; + echo $text['description-greeting']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-pin-length'].":\n"; diff --git a/app/conference_centers/conference_room_edit.php b/app/conference_centers/conference_room_edit.php index 5431d5956e..626408a7f2 100644 --- a/app/conference_centers/conference_room_edit.php +++ b/app/conference_centers/conference_room_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s):