App->Recordings, added preliminary support for translations.

This commit is contained in:
James Rose 2012-11-24 16:50:27 +00:00
parent a3ed8c7a4b
commit 230d6e730d
3 changed files with 84 additions and 26 deletions

View File

@ -0,0 +1,48 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
$text['message-uploaded']['en-us'] = 'Uploaded file to';
$text['title']['en-us'] = 'Recordings';
$text['description']['en-us'] = 'To make a recording dial *732 or you can make a 16bit 8khz/16khz Mono WAV file then copy it to the following directory then refresh the page to play it back. Click on the \'Filename\' to download it or the \'Recording Name\' to play the audio.';
$text['label-upload']['en-us'] = 'File to upload:';
$text['button-upload']['en-us'] = 'Upload';
$text['label-file']['en-us'] = 'Filename (download)';
$text['description-file']['en-us'] = 'Name of the file. example.wav';
$text['label-recording']['en-us'] = 'Recording Name (play)';
$text['description-recording']['en-us'] = 'Recording Name. example: recording_x';
$text['label-description']['en-us'] = 'Description';
$text['description-description']['en-us'] = 'You may enter a description here for your reference (not parsed).';
$text['message-delete']['en-us'] = 'Do you really want to delete this?';
$text['label-edit-file']['en-us'] = 'Please provide: Filename (download)';
$text['label-edit-recording']['en-us'] = 'Please provide: Recording Name (play)';
$text['message-add']['en-us'] = 'Add Complete';
$text['message-update']['en-us'] = 'Update Complete';
$text['title-add']['en-us'] = 'Add Recording';
$text['title-edit']['en-us'] = 'Edit Recording';
$text['button-back']['en-us'] = 'Back';
$text['button-save']['en-us'] = 'Save';
?>

View File

@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "includes/require.php";
@ -35,6 +36,12 @@ else {
}
require_once "includes/paging.php";
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//set the max php execution time
ini_set(max_execution_time,7200);
@ -77,7 +84,7 @@ require_once "includes/paging.php";
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('recordings_upload')) {
if ($_POST['type'] == 'rec') {
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_FILES['ulfile']['name']);
$savemsg = "Uploaded file to ".$_SESSION['switch']['recordings']['dir']."/". htmlentities($_FILES['ulfile']['name']);
$savemsg = $text['message-uploaded']." ".$_SESSION['switch']['recordings']['dir']."/". htmlentities($_FILES['ulfile']['name']);
//system('chmod -R 744 '.$_SESSION['switch']['recordings']['dir'].'*');
unset($_POST['txtCommand']);
}
@ -150,13 +157,9 @@ require_once "includes/paging.php";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><p><span class=\"vexpl\"><span class=\"red\"><strong>Recordings:<br>\n";
echo " <td align='left'><p><span class=\"vexpl\"><span class=\"red\"><strong>".$text['title'].":<br>\n";
echo " </strong></span>\n";
echo " To make a recording dial *732 or you can make a\n";
echo " 16bit 8khz/16khz Mono WAV file then copy it to the\n";
echo " following directory then refresh the page to play it back.\n";
echo " Click on the 'Filename' to download it or the 'Recording Name' to\n";
echo " play the audio.\n";
echo $text['description']."\n";
echo " </span></p></td>\n";
echo " </tr>\n";
echo "</table>";
@ -176,9 +179,9 @@ require_once "includes/paging.php";
echo " <input name=\"type\" type=\"hidden\" value=\"rec\">\n";
echo " </td>\n";
echo " <td valign=\"top\" align='right' class=\"label\" nowrap>\n";
echo " File to upload:\n";
echo " ".$text['label-upload']."\n";
echo " <input name=\"ulfile\" type=\"file\" class=\"btn\" id=\"ulfile\">\n";
echo " <input name=\"submit\" type=\"submit\" class=\"btn\" id=\"upload\" value=\"Upload\">\n";
echo " <input name=\"submit\" type=\"submit\" class=\"btn\" id=\"upload\" value=\"".$text['button-upload']."\">\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
@ -216,10 +219,10 @@ require_once "includes/paging.php";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('recording_filename', 'Filename (download)', $order_by, $order);
echo th_order_by('recording_name', 'Recording Name (play)', $order_by, $order);
echo th_order_by('recording_filename', $text['label-file'], $order_by, $order);
echo th_order_by('recording_name', $text['label-recording'], $order_by, $order);
echo "<th width=\"10%\" class=\"listhdr\" nowrap>Size</th>\n";
echo th_order_by('recording_description', 'Description', $order_by, $order);
echo th_order_by('recording_description', $text['label-description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('recordings_add')) {
echo " <a href='recordings_edit.php' alt='add'>$v_link_label_add</a>\n";
@ -252,7 +255,7 @@ require_once "includes/paging.php";
echo " <a href='recordings_edit.php?id=".$row['recording_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('recordings_delete')) {
echo " <a href='recordings_delete.php?id=".$row['recording_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='recordings_delete.php?id=".$row['recording_uuid']."' alt='delete' onclick=\"return confirm('".$text['message-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";

View File

@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "includes/require.php";
@ -34,6 +35,12 @@ else {
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//set the action as an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
@ -66,8 +73,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
if (strlen($recording_filename) == 0) { $msg .= "Please provide: Filename (download)<br>\n"; }
if (strlen($recording_name) == 0) { $msg .= "Please provide: Recording Name (play)<br>\n"; }
if (strlen($recording_filename) == 0) { $msg .= $text['label-edit-file']."<br>\n"; }
if (strlen($recording_name) == 0) { $msg .= $text['label-edit-recording']."<br>\n"; }
//if (strlen($recording_uuid) == 0) { $msg .= "Please provide: recording_uuid<br>\n"; }
//if (strlen($recording_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
@ -109,7 +116,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=recordings.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo $text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@ -152,7 +159,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=recordings.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo $text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@ -197,33 +204,33 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap><b>Add Recording</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['title-add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>Edit Recording</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['title-edit']."</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='recordings.php'\" value='Back'></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='recordings.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Filename (download):\n";
echo " ".$text['label-file'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='recording_filename' maxlength='255' value=\"$recording_filename\">\n";
echo "<br />\n";
echo "Name of the file. example.wav\n";
echo $text['message-file']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Recording Name (play):\n";
echo " ".$text['label-recording'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='recording_name' maxlength='255' value=\"$recording_name\">\n";
echo "<br />\n";
echo "Recording Name. example: recordingx\n";
echo $text['description-recording']."\n";
echo "</td>\n";
echo "</tr>\n";
@ -245,7 +252,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='recording_description' maxlength='255' value=\"$recording_description\">\n";
echo "<br />\n";
echo "You may enter a description here for your reference (not parsed).\n";
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
@ -253,7 +260,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='hidden' name='recording_uuid' value='$recording_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";