From fa61ea75fbcf160d2211b0e12b1ac8297ace63a8 Mon Sep 17 00:00:00 2001 From: James Rose Date: Sat, 24 Nov 2012 07:43:34 +0000 Subject: [PATCH] App->Ring group, preliminary support for translations. Needs more work on ring_groups_edit.php --- app/ring_groups/app_languages.php | 77 ++++++++++++++++++ app/ring_groups/ring_groups.php | 22 ++++-- app/ring_groups/ring_groups_delete.php | 9 ++- app/ring_groups/ring_groups_edit.php | 105 +++++++++++++------------ 4 files changed, 156 insertions(+), 57 deletions(-) create mode 100644 app/ring_groups/app_languages.php diff --git a/app/ring_groups/app_languages.php b/app/ring_groups/app_languages.php new file mode 100644 index 0000000000..dbd04973ae --- /dev/null +++ b/app/ring_groups/app_languages.php @@ -0,0 +1,77 @@ + + 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['title']['en-us'] = 'Ring Groups'; + $text['description']['en-us'] = 'A ring group is a set of extensions that can be called with a ring strategy.'; + $text['label-name']['en-us'] = 'Name'; + $text['label-extension']['en-us'] = 'Extension'; + $text['label-enabled']['en-us'] = 'Enabled'; + $text['label-description']['en-us'] = 'Description'; + $text['message-delete']['en-us'] = 'Do you really want to delete this?'; + $text['message-delete-done']['en-us'] = 'Delete Complete'; + + $text['message-name']['en-us'] = 'Please provide: Name'; + $text['message-extension']['en-us'] = 'Please provide: Extension'; + $text['message-strategy']['en-us'] = 'Please provide: Strategy'; + $text['message-timeout']['en-us'] = 'Please provide: Timeout'; + $text['message-timeout-action']['en-us'] = 'Please provide: Timeout Action'; + $text['message-enabled']['en-us'] = 'Please provide: Enabled'; + $text['message-add-complete']['en-us'] = 'Add Complete'; + $text['message-update-complete']['en-us'] = 'Update Complete'; + $text['label-ring-group']['en-us'] = 'Ring Group'; + $text['button-back']['en-us'] = 'Back'; + $text['description-name']['en-us'] = 'Enter the name.'; + $text['description-extension']['en-us'] = 'Enter the extension.'; + $text['description-enter-context']['en-us'] = 'Enter the context.'; + $text['label-strategy']['en-us'] = 'Strategy'; + $text['dropdown-sequence']['en-us'] = 'sequence'; + $text['dropdown-simultaneous']['en-us'] = 'simultaneous'; + $text['label-sequence']['en-us'] = 'Select the strategy.'; + $text['button-add']['en-us'] = 'Add'; + $text['description-extension']['en-us'] = 'Add the extensions to the ring group'; + $text['label-timeout']['en-us'] = 'Timeout'; + $text['description-timeout']['en-us'] = 'Enter the timeout in seconds.'; + $text['label-destination']['en-us'] = 'Destination'; + $text['description-destination']['en-us'] = 'Select the destination for the ring group.'; + $text['label-cid']['en-us'] = 'CID Prefix'; + $text['description-cid']['en-us'] = 'Set a prefix on the caller ID name'; + $text['label-ringback']['en-us'] = 'Ring Back'; + $text['dropdown-usring']['en-us'] = 'us-ring'; + $text['dropdown-frring']['en-us'] = 'fr-ring'; + $text['dropdown-ukring']['en-us'] = 'uk-ring'; + $text['dropdown-rsring']['en-us'] = 'rs-ring'; + $text['description-ringback']['en-us'] = 'Defines what the caller will hear while the destination is being called.'; + $text['dropdown-true']['en-us'] = 'true'; + $text['dropdown-false']['en-us'] = 'false'; + $text['description-enabled']['en-us'] ='Select to enable or disable the ring group.'; + $text['description-description']['en-us'] = 'Enter the description'; + $text['label-extensions']['en-us'] = 'Extensions'; + + + + + +?> \ No newline at end of file diff --git a/app/ring_groups/ring_groups.php b/app/ring_groups/ring_groups.php index e3e5ffaa5c..fba6d74d56 100644 --- a/app/ring_groups/ring_groups.php +++ b/app/ring_groups/ring_groups.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + James Rose */ require_once "root.php"; require_once "includes/require.php"; @@ -33,6 +34,13 @@ else { echo "access denied"; exit; } + +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + require_once "includes/header.php"; require_once "includes/paging.php"; @@ -49,12 +57,12 @@ require_once "includes/paging.php"; echo "\n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
Ring Groups".$text['title']." 
\n"; - echo " A ring group is a set of extensions that can be called with a ring strategy.

\n"; + echo " ".$text['description']."

\n"; echo "
\n"; @@ -101,15 +109,15 @@ require_once "includes/paging.php"; echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('ring_group_name', 'Name', $order_by, $order); - echo th_order_by('ring_group_extension', 'Extension', $order_by, $order); + echo th_order_by('ring_group_name', $text['label-name'], $order_by, $order); + echo th_order_by('ring_group_extension', $text['label-extension'], $order_by, $order); //echo th_order_by('ring_group_context', 'Context', $order_by, $order); //echo th_order_by('ring_group_strategy', 'Strategy', $order_by, $order); //echo th_order_by('ring_group_timeout_sec', 'Timeout', $order_by, $order); //echo th_order_by('ring_group_timeout_app', 'Timeout App', $order_by, $order); //echo th_order_by('ring_group_timeout_data', 'Timeout Data', $order_by, $order); - echo th_order_by('ring_group_enabled', 'Enabled', $order_by, $order); - echo th_order_by('ring_group_description', 'Description', $order_by, $order); + echo th_order_by('ring_group_enabled', $text['label-enabled'], $order_by, $order); + echo th_order_by('ring_group_description', $text['label-description'], $order_by, $order); echo "\n"; @@ -129,7 +137,7 @@ require_once "includes/paging.php"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } diff --git a/app/ring_groups/ring_groups_delete.php b/app/ring_groups/ring_groups_delete.php index 5669bbe6f8..9440dcadcf 100644 --- a/app/ring_groups/ring_groups_delete.php +++ b/app/ring_groups/ring_groups_delete.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + James Rose */ require_once "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']]; + } + //get the http value and set it as a php variable if (count($_GET)>0) { $id = check_str($_GET["id"]); @@ -80,7 +87,7 @@ else { require_once "includes/header.php"; echo "\n"; echo "
\n"; - echo "Delete Complete\n"; + echo $text['message-delete-done']."\n"; echo "
\n"; require_once "includes/footer.php"; return; diff --git a/app/ring_groups/ring_groups_edit.php b/app/ring_groups/ring_groups_edit.php index 2893864716..9b031a61bc 100644 --- a/app/ring_groups/ring_groups_edit.php +++ b/app/ring_groups/ring_groups_edit.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + James Rose */ require_once "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']]; + } + //delete the user from the v_extension_users if ($_GET["a"] == "delete" && permission_exists("user_delete")) { //set the variables @@ -102,14 +109,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //check for all required data - if (strlen($ring_group_name) == 0) { $msg .= "Please provide: Name
\n"; } - if (strlen($ring_group_extension) == 0) { $msg .= "Please provide: Extension
\n"; } - if (strlen($ring_group_strategy) == 0) { $msg .= "Please provide: Strategy
\n"; } - if (strlen($ring_group_timeout_sec) == 0) { $msg .= "Please provide: Timeout
\n"; } - if (strlen($ring_group_timeout_app) == 0) { $msg .= "Please provide: Timeout Action
\n"; } + if (strlen($ring_group_name) == 0) { $msg .= $text['message-name']."
\n"; } + if (strlen($ring_group_extension) == 0) { $msg .= $text['message-extension']."
\n"; } + if (strlen($ring_group_strategy) == 0) { $msg .= $text['message-strategy']."
\n"; } + if (strlen($ring_group_timeout_sec) == 0) { $msg .= $text['message-strategy']."
\n"; } + if (strlen($ring_group_timeout_app) == 0) { $msg .= $text['message-timeout-action']."
\n"; } //if (strlen($ring_group_cid_name_prefix) == 0) { $msg .= "Please provide: Caller ID Prefix
\n"; } //if (strlen($ring_group_ringback) == 0) { $msg .= "Please provide: Ringback
\n"; } - if (strlen($ring_group_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } + if (strlen($ring_group_enabled) == 0) { $msg .= $text['message-enabled']."
\n"; } //if (strlen($ring_group_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; @@ -271,10 +278,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "
\n"; if ($action == "add") { - echo "Add Complete\n"; + echo $text['message-enabled']."\n"; } if ($action == "update") { - echo "Update Complete\n"; + echo $text['message-update-complete']."\n"; } echo "
\n"; require_once "includes/footer.php"; @@ -340,35 +347,35 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "
\n"; echo " $v_link_label_add\n"; echo "".$row['ring_group_description']." \n"; echo " $v_link_label_edit\n"; - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\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"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -380,38 +387,38 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " "; - echo " "; + echo " "; echo "
Ring Group".$text['label-ring-group']."
\n"; - echo "A ring group is a set of extensions that can be called with a ring strategy.

\n"; + echo $text['description']."

\n"; echo "
\n"; - echo " Name:\n"; + echo " ".$text['label-name'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the name.\n"; + echo $text['description-name']."\n"; echo "
\n"; - echo " Extension:\n"; + echo " ".$text['label-extension'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the extension.\n"; + echo $text['description-extension']."\n"; echo "
\n"; echo " \n"; echo "
\n"; - echo "Enter the context.\n"; + echo $text['description-enter-context']."\n"; echo "
\n"; - echo " Strategy:\n"; + echo " ".$text['label-strategy'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Select the strategy.\n"; + echo $text['label-sequence']."\n"; echo "
Extensions:".$text['label-extensions'].":"; if ($action == "update") { echo " \n"; @@ -430,7 +437,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; } @@ -450,79 +457,79 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } echo " "; if ($action == "update") { - echo " \n"; + echo " \n"; } unset($sql, $result); echo "
\n"; - echo " Add the extensions to the ring group.\n"; + echo " ".$text['description-extension']."\n"; echo "
\n"; echo " "; echo " "; 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"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -568,7 +575,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n";
".$field['extension']."\n"; - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; echo "
\n"; - echo " Timeout:\n"; + echo " ".$text['label-timeout'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the timeout in seconds.\n"; + echo $text['description-timeout']."\n"; echo "
\n"; - echo " Destination:\n"; + echo " ".$text['label-destination'].":\n"; echo "\n"; //switch_select_destination(select_type, select_label, select_name, select_value, select_style, action); switch_select_destination("dialplan", "", "ring_group_timeout_action", $ring_group_timeout_action, "", ""); echo "
\n"; - echo " Select the timeout destination.\n"; + echo " ".$text['description-destination']."\n"; echo "
\n"; - echo " CID Prefix:\n"; + echo " ".$text['label-cid'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Set a prefix on the caller ID name. \n"; + echo $text['description-cid']." \n"; echo "
\n"; - echo " Ring Back:\n"; + echo " ".$text['label-ringback'].":\n"; echo "\n"; $select_options = ""; if ($ring_group_ringback == "\${us-ring}" || $ring_group_ringback == "us-ring") { - $select_options .= " \n"; + $select_options .= " \n"; } else { - $select_options .= " \n"; + $select_options .= " \n"; } if ($ring_group_ringback == "\${fr-ring}" || $ring_group_ringback == "fr-ring") { - $select_options .= " \n"; + $select_options .= " \n"; } else { - $select_options .= " \n"; + $select_options .= " \n"; } if ($ring_group_ringback == "\${uk-ring}" || $ring_group_ringback == "uk-ring") { - $select_options .= " \n"; + $select_options .= " \n"; } else { - $select_options .= " \n"; + $select_options .= " \n"; } if ($ring_group_ringback == "\${rs-ring}" || $ring_group_ringback == "rs-ring") { - $select_options .= " \n"; + $select_options .= " \n"; } else { - $select_options .= " \n"; + $select_options .= " \n"; } require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php"; $moh = new switch_music_on_hold; @@ -532,32 +539,32 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $moh->select(); echo "
\n"; - echo "Defines what the caller will hear while the destination is being called.\n"; + echo $text['description-ringback']."\n"; echo "
\n"; - echo " Enabled:\n"; + echo " ".$text['label-enabled'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Select enable or disable the ring group.\n"; + echo $text['description-enabled']."\n"; echo "
\n"; echo " \n"; echo "
\n"; - echo "Enter the description.\n"; + echo $text['description-description']."\n"; echo "