Phrases: Add support for using base64 recordings. Already existing phrases don't yet convert.

This commit is contained in:
Nate Jones
2015-04-26 00:19:02 +00:00
parent 942060d2de
commit 751a9f342b
+29 -31
View File
@@ -369,9 +369,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n"; echo "<tr>\n";
echo " <td class='vtable' align='left' nowrap='nowrap'>\n"; echo " <td class='vtable' align='left' nowrap='nowrap'>\n";
echo " <select name='phrase_detail_function' class='formfld' onchange=\"if (this.selectedIndex == 2) { changeToInput(getElementById('phrase_detail_data')); }\">\n"; echo " <select name='phrase_detail_function' class='formfld' onchange=\"if (this.selectedIndex == 2) { changeToInput(getElementById('phrase_detail_data')); }\">\n";
echo " <option value='play-file'>".$text['label-play']."</option>\n"; if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
echo " <option value='execute'>".$text['label-play']."</option>\n";
}
else {
echo " <option value='play-file'>".$text['label-play']."</option>\n";
}
if (if_group("superadmin")) { if (if_group("superadmin")) {
echo " <option value='execute'>".$text['label-execute']."</option>\n"; echo " <option value='execute'>".$text['label-execute']."</option>\n";
} }
echo " </select>\n"; echo " </select>\n";
echo " </td>\n"; echo " </td>\n";
@@ -379,49 +384,42 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <select name='phrase_detail_data' id='phrase_detail_data' class='formfld' style='width: 300px' ".((if_group("superadmin")) ? "onchange='changeToInput(this);'" : null).">\n"; echo " <select name='phrase_detail_data' id='phrase_detail_data' class='formfld' style='width: 300px' ".((if_group("superadmin")) ? "onchange='changeToInput(this);'" : null).">\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
//recordings //recordings
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) { $sql = "select * from v_recordings ";
$tmp_selected = false; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
$files = Array(); $sql .= "order by recording_name asc ";
echo " <optgroup label='Recordings'>\n"; $prep_statement = $db->prepare(check_sql($sql));
while($file = readdir($dh)) { $prep_statement->execute();
if($file != "." && $file != ".." && $file[0] != '.') { $recordings = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) { $tmp_selected = false;
//this is a directory if (count($recordings) > 0) {
} echo "<optgroup label='Recordings'>\n";
else { foreach ($recordings as &$row) {
if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($ivr_menu_greet_short) > 0) { if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$tmp_selected = true; echo " <option value='lua(streamfile.lua ".$row["recording_filename"].")'>".$row["recording_name"]."</option>\n";
echo "<option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected='selected'>".$file."</option>\n"; }
} else {
else { echo " <option value='".$row["recording_filename"]."'>".$row["recording_name"]."</option>\n";
echo "<option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
}
}
} }
} }
closedir($dh); echo "</optgroup>\n";
echo " </optgroup>\n";
} }
unset($sql, $prep_statement, $recordings);
//sounds //sounds
$dir_path = $_SESSION['switch']['sounds']['dir']; $dir_path = $_SESSION['switch']['sounds']['dir'];
recur_sounds_dir($_SESSION['switch']['sounds']['dir']); recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
if (count($dir_array) > 0) { if (count($dir_array) > 0) {
echo " <optgroup label='Sounds'>\n"; echo "<optgroup label='Sounds'>\n";
foreach ($dir_array as $key => $value) { foreach ($dir_array as $key => $value) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
if (substr($ivr_menu_greet_long, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") { if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
$ivr_menu_greet_long = substr($ivr_menu_greet_long, 71); echo " <option value='lua(streamfile.lua ".$key.")'>".$key."</option>\n";
}
if ($ivr_menu_greet_long == $key) {
$tmp_selected = true;
echo "<option value='$key' selected='selected'>$key</option>\n";
} }
else { else {
echo "<option value='$key'>$key</option>\n"; echo " <option value='".$key."'>".$key."</option>\n";
} }
} }
} }
echo " </optgroup>\n"; echo "</optgroup>\n";
} }
echo " </select>\n"; echo " </select>\n";
echo " </td>\n"; echo " </td>\n";