From 9d8886b92508438ec73fb0e315192c32ab8a6971 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Tue, 14 May 2013 15:09:15 +0000 Subject: [PATCH] Multilinguified Call Flows. --- app/call_flows/app_languages.php | 140 ++++++++++++++++++++++++++++ app/call_flows/call_flow_delete.php | 8 +- app/call_flows/call_flow_edit.php | 111 +++++++++++++--------- app/call_flows/call_flows.php | 41 ++++---- 4 files changed, 237 insertions(+), 63 deletions(-) create mode 100644 app/call_flows/app_languages.php diff --git a/app/call_flows/app_languages.php b/app/call_flows/app_languages.php new file mode 100644 index 0000000000..a091d255b7 --- /dev/null +++ b/app/call_flows/app_languages.php @@ -0,0 +1,140 @@ + \ No newline at end of file diff --git a/app/call_flows/call_flow_delete.php b/app/call_flows/call_flow_delete.php index cccb609d65..747b7eaecd 100644 --- a/app/call_flows/call_flow_delete.php +++ b/app/call_flows/call_flow_delete.php @@ -34,6 +34,12 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + if (count($_GET)>0) { $id = check_str($_GET["id"]); } @@ -90,7 +96,7 @@ if (strlen($id)>0) { require_once "includes/header.php"; echo "\n"; echo "
\n"; - echo "Delete Complete\n"; + echo $text['message-delete']."\n"; echo "
\n"; require_once "includes/footer.php"; return; diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index 49bc13590a..4822a4b6a0 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -34,6 +34,12 @@ else { exit; } +//add multi-lingual support + require_once "app_languages.php"; + foreach($text as $key => $value) { + $text[$key] = $value[$_SESSION['domain']['language']['code']]; + } + //action add or update if (isset($_REQUEST["id"])) { $action = "update"; @@ -89,20 +95,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } //check for all required data - if (strlen($call_flow_name) == 0) { $msg .= "Please provide: Name
\n"; } - if (strlen($call_flow_extension) == 0) { $msg .= "Please provide: Extension
\n"; } - //if (strlen($call_flow_feature_code) == 0) { $msg .= "Please provide: Feature Code
\n"; } - if (strlen($call_flow_context) == 0) { $msg .= "Please provide: Context
\n"; } - //if (strlen($call_flow_status) == 0) { $msg .= "Please provide: Status
\n"; } - //if (strlen($call_flow_pin_number) == 0) { $msg .= "Please provide: PIN Number
\n"; } - //if (strlen($call_flow_status) == 0) { $msg .= "Please provide: Status
\n"; } - //if (strlen($call_flow_label) == 0) { $msg .= "Please provide: Destination Label
\n"; } - //if (strlen($call_flow_app) == 0) { $msg .= "Please provide: Application
\n"; } - //if (strlen($call_flow_data) == 0) { $msg .= "Please provide: Application Data
\n"; } - //if (strlen($call_flow_anti_label) == 0) { $msg .= "Please provide: Alternate Destination Label
\n"; } - //if (strlen($call_flow_anti_app) == 0) { $msg .= "Please provide: Alternate Application
\n"; } - //if (strlen($call_flow_anti_data) == 0) { $msg .= "Please provide: Application Data
\n"; } - //if (strlen($call_flow_description) == 0) { $msg .= "Please provide: Description
\n"; } + if (strlen($call_flow_name) == 0) { $msg .= $text['message-required'].$text['label-name']."
\n"; } + if (strlen($call_flow_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."
\n"; } + //if (strlen($call_flow_feature_code) == 0) { $msg .= $text['message-required'].$text['label-feature_code']."
\n"; } + if (strlen($call_flow_context) == 0) { $msg .= $text['message-required'].$text['label-context']."
\n"; } + //if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."
\n"; } + //if (strlen($call_flow_pin_number) == 0) { $msg .= $text['message-required'].$text['label-pin_number']."
\n"; } + //if (strlen($call_flow_status) == 0) { $msg .= $text['message-required'].$text['label-status']."
\n"; } + //if (strlen($call_flow_label) == 0) { $msg .= $text['message-required'].$text['label-destination_label']."
\n"; } + //if (strlen($call_flow_app) == 0) { $msg .= $text['message-required'].$text['label-destination']."
\n"; } + //if (strlen($call_flow_data) == 0) { $msg .= $text['message-required'].$text['label-destination']."
\n"; } + //if (strlen($call_flow_anti_label) == 0) { $msg .= $text['message-required'].$text['label-alternate_label']."
\n"; } + //if (strlen($call_flow_anti_app) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."
\n"; } + //if (strlen($call_flow_anti_data) == 0) { $msg .= $text['message-required'].$text['label-alternate_destination']."
\n"; } + //if (strlen($call_flow_description) == 0) { $msg .= $text['message-required'].$text['label-description']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; @@ -351,16 +357,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "
\n"; if ($action == "add") { - echo "Add Complete\n"; + echo $text['message-add']."\n"; } if ($action == "update") { - echo "Update Complete\n"; + echo $text['message-update']."\n"; } echo "
\n"; require_once "includes/footer.php"; return; } - } //if ($_POST["persistformvar"] != "true") + } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form @@ -420,6 +426,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //show the header require_once "includes/header.php"; + if ($action == "update") { + $page["title"] = $text['title-call_flow-edit']; + } + if ($action == "add") { + $page["title"] = $text['title-call_flow-add']; + } //show the content echo "
"; @@ -432,57 +444,64 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { 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"; 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"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -611,7 +630,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo " "; echo "
Call Flow"; + if ($action == "update") { + echo $text['header-call_flow-edit']; + } + if ($action == "add") { + echo $text['header-call_flow-add']; + } + 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 number.\n"; + echo $text['description-extension']."\n"; echo "
\n"; - echo " Feature Code:\n"; + echo " ".$text['label-feature_code'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the feature code.\n"; + echo $text['description-feature_code']."\n"; echo "
\n"; - echo " Context:\n"; + echo " ".$text['label-context'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the context.\n"; + echo $text['description-context']."\n"; echo "
\n"; - echo " Status:\n"; + echo " ".$text['label-status'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Select the status.\n"; + echo $text['description-status']."\n"; echo "
\n"; - echo " PIN Number:\n"; + echo " ".$text['label-pin_number'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the pin number\n"; + echo $text['description-pin_number']."\n"; echo "
\n"; - echo " Destination Label:\n"; + echo " ".$text['label-destination_label'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the destination label\n"; + echo $text['description-destination_label']."\n"; echo "
\n"; - echo " Destination:\n"; + echo " ".$text['label-destination'].":\n"; echo "\n"; $select_value = ''; @@ -562,24 +581,24 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { switch_select_destination("dialplan", $destination_label, "call_flow_destination", $select_value, "", $call_flow_data); unset($select_value); echo "
\n"; - echo "Select the destination.\n"; + echo $text['description-destination']."\n"; echo "
\n"; - echo " Alternate Label:\n"; + echo " ".$text['label-alternate_label'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the alternate destination label\n"; + echo $text['description-alternate_label']."\n"; echo "
\n"; - echo " Alternate Destination:\n"; + echo " ".$text['label-alternate_destination'].":\n"; echo "\n"; //switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='') @@ -590,18 +609,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { switch_select_destination("dialplan", $alternate_destination_label, "call_flow_alternate_destination", $select_value, "", $call_flow_anti_data); unset($select_value); echo "
\n"; - echo "Select the alternate destination.\n"; + echo $text['description-alternate_destination']."\n"; echo "
\n"; - echo " Description:\n"; + echo " ".$text['label-description'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the description.\n"; + echo $text['description-description']."\n"; echo "
"; diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index c49e292f97..2885af8c2c 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -33,7 +33,16 @@ 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"; + $page["title"] = $text['title-call_flows']; + require_once "includes/paging.php"; //get variables used to control the order @@ -49,12 +58,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 "
Call Flows".$text['header-call_flows']." 
\n"; - echo " Direct calls between two destinations by calling a feature code.

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

\n"; echo "
\n"; @@ -79,9 +88,9 @@ require_once "includes/paging.php"; $rows_per_page = 10; $param = ""; $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; + if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } + list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $offset = $rows_per_page * $page; //get the list $sql = "select * from v_call_flows "; @@ -101,16 +110,16 @@ require_once "includes/paging.php"; echo "
\n"; echo "\n"; echo "\n"; - echo th_order_by('call_flow_status', 'Status', $order_by, $order); - //echo th_order_by('call_flow_name', 'Name', $order_by, $order); - echo th_order_by('call_flow_extension', 'Extension', $order_by, $order); - echo th_order_by('call_flow_feature_code', 'Feature Code', $order_by, $order); - //echo "\n"; - //echo "\n"; - echo th_order_by('call_flow_description', 'Description', $order_by, $order); + echo th_order_by('call_flow_status', $text['label-status'], $order_by, $order); + //echo th_order_by('call_flow_name', $text['label-name'], $order_by, $order); + echo th_order_by('call_flow_extension', $text['label-extension'], $order_by, $order); + echo th_order_by('call_flow_feature_code', $text['label-feature_code'], $order_by, $order); + //echo "\n"; + //echo "\n"; + echo th_order_by('call_flow_description', $text['label-description'], $order_by, $order); echo "\n"; echo " \n"; echo "\n"; @@ -158,7 +167,7 @@ require_once "includes/paging.php"; echo " \n"; echo "
DestinationAlternate Destination".$text['label-destination']."".$text['label-alternate_destination']."\n"; if (permission_exists('call_flow_add')) { - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; } else { echo "  \n"; @@ -138,10 +147,10 @@ require_once "includes/paging.php"; echo " ".$row['call_flow_description']." \n"; if (permission_exists('call_flow_edit')) { - echo " $v_link_label_edit\n"; + echo " $v_link_label_edit\n"; } if (permission_exists('call_flow_delete')) { - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; } echo "
$paging_controls\n"; if (permission_exists('call_flow_add')) { - echo " $v_link_label_add\n"; + echo " $v_link_label_add\n"; } else { echo "  \n";