From 230d6e730d0381d21376e3098856de3c1c582caf Mon Sep 17 00:00:00 2001 From: James Rose Date: Sat, 24 Nov 2012 16:50:27 +0000 Subject: [PATCH] App->Recordings, added preliminary support for translations. --- app/recordings/app_languages.php | 48 ++++++++++++++++++++++++++++++ app/recordings/recordings.php | 29 ++++++++++-------- app/recordings/recordings_edit.php | 33 ++++++++++++-------- 3 files changed, 84 insertions(+), 26 deletions(-) create mode 100644 app/recordings/app_languages.php diff --git a/app/recordings/app_languages.php b/app/recordings/app_languages.php new file mode 100644 index 0000000000..8a1c6864a7 --- /dev/null +++ b/app/recordings/app_languages.php @@ -0,0 +1,48 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane + James Rose +*/ + $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'; + +?> \ No newline at end of file diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index a3d2638932..ab2f4b35a8 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + James Rose */ 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 "\n"; echo " \n"; - echo " \n"; echo " \n"; echo "

Recordings:
\n"; + echo "

".$text['title'].":
\n"; echo "
\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 "

"; @@ -176,9 +179,9 @@ require_once "includes/paging.php"; echo " \n"; echo " \n"; echo " \n"; - echo " File to upload:\n"; + echo " ".$text['label-upload']."\n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -216,10 +219,10 @@ require_once "includes/paging.php"; echo "\n"; echo "\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 "\n"; - echo th_order_by('recording_description', 'Description', $order_by, $order); + echo th_order_by('recording_description', $text['label-description'], $order_by, $order); echo "\n"; echo "\n"; diff --git a/app/recordings/recordings_edit.php b/app/recordings/recordings_edit.php index 6fb91feb74..7df6302764 100644 --- a/app/recordings/recordings_edit.php +++ b/app/recordings/recordings_edit.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + James Rose */ 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
\n"; } - if (strlen($recording_filename) == 0) { $msg .= "Please provide: Filename (download)
\n"; } - if (strlen($recording_name) == 0) { $msg .= "Please provide: Recording Name (play)
\n"; } + if (strlen($recording_filename) == 0) { $msg .= $text['label-edit-file']."
\n"; } + if (strlen($recording_name) == 0) { $msg .= $text['label-edit-recording']."
\n"; } //if (strlen($recording_uuid) == 0) { $msg .= "Please provide: recording_uuid
\n"; } //if (strlen($recording_description) == 0) { $msg .= "Please provide: Description
\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 "\n"; echo "
\n"; - echo "Add Complete\n"; + echo $text['message-add']."\n"; echo "
\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 "\n"; echo "
\n"; - echo "Update Complete\n"; + echo $text['message-update']."\n"; echo "
\n"; require_once "includes/footer.php"; return; @@ -197,33 +204,33 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; if ($action == "add") { - echo "\n"; + echo "\n"; } if ($action == "update") { - 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"; @@ -245,7 +252,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; echo " \n"; @@ -253,7 +260,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo " "; echo "
Size\n"; if (permission_exists('recordings_add')) { echo " $v_link_label_add\n"; @@ -252,7 +255,7 @@ require_once "includes/paging.php"; echo " $v_link_label_edit\n"; } if (permission_exists('recordings_delete')) { - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; } echo "
Add Recording".$text['title-add']."Edit Recording".$text['title-edit']."
\n"; - echo " Filename (download):\n"; + echo " ".$text['label-file'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Name of the file. example.wav\n"; + echo $text['message-file']."\n"; echo "
\n"; - echo " Recording Name (play):\n"; + echo " ".$text['label-recording'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Recording Name. example: recordingx\n"; + echo $text['description-recording']."\n"; echo "
\n"; echo " \n"; echo "
\n"; - echo "You may enter a description here for your reference (not parsed).\n"; + echo $text['description-description']."\n"; echo "
";