From e992af1a96818ab2e15fd0f8b710f1de9a8cf4f6 Mon Sep 17 00:00:00 2001 From: James Rose Date: Sat, 24 Nov 2012 21:25:22 +0000 Subject: [PATCH] Outbound Dialplan add/edit, added preliminary support for translations. --- app/dialplan_outbound/app_languages.php | 90 +++++++++ .../dialplan_outbound_add.php | 186 +++++++++--------- 2 files changed, 186 insertions(+), 90 deletions(-) create mode 100644 app/dialplan_outbound/app_languages.php diff --git a/app/dialplan_outbound/app_languages.php b/app/dialplan_outbound/app_languages.php new file mode 100644 index 0000000000..c9e15075b5 --- /dev/null +++ b/app/dialplan_outbound/app_languages.php @@ -0,0 +1,90 @@ + + 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-provide']['en-us'] = 'Please Provide'; + $text['label-gateway-name']['en-us'] = 'Gateway Name'; + $text['label-dialplan-expression']['en-us'] = 'Dialplan Expression'; + $text['label-2d']['en-us'] = '2 digits'; + $text['label-3d']['en-us'] = '3 digits'; + $text['label-4d']['en-us'] = '4 digits'; + $text['label-5d']['en-us'] = '5 digits'; + $text['label-6d']['en-us'] = '6 digits'; + $text['label-7d']['en-us'] = '7 digits local'; + $text['label-8d']['en-us'] = '8 digits'; + $text['label-9d']['en-us'] = '9 digits'; + $text['label-10d']['en-us'] = '10 digits long distance'; + $text['label-11d']['en-us'] = '11 digits long distance'; + $text['label-12d']['en-us'] = '12 digits'; + $text['label-13d']['en-us'] = '13 digits'; + $text['label-14d']['en-us'] = '14 digits'; + $text['label-int']['en-us'] = '15 digits International'; + $text['label-311']['en-us'] = '311 information'; + $text['label-411']['en-us'] = '411 information'; + $text['label-911']['en-us'] = '911 emergency'; + $text['label-9d2']['en-us'] = 'dial 9, then 2 digits'; + $text['label-9d3']['en-us'] = 'dial 9, then 3 digits'; + $text['label-9d4']['en-us'] = 'dial 9, then 4 digits'; + $text['label-9d5']['en-us'] = 'dial 9, then 5 digits'; + $text['label-9d6']['en-us'] = 'dial 9, then 6 digits'; + $text['label-9d7']['en-us'] = 'dial 9, then 7 digits'; + $text['label-9d8']['en-us'] = 'dial 9, then 8 digits'; + $text['label-9d9']['en-us'] = 'dial 9, then 9 digits'; + $text['label-9d10']['en-us'] = 'dial 9, then 10 digits'; + $text['label-9d11']['en-us'] = 'dial 9, then 11 digits'; + $text['label-9d12']['en-us'] = 'dial 9, then 12 digits'; + $text['label-9d13']['en-us'] = 'dial 9, then 13 digits'; + $text['label-9d14']['en-us'] = 'dial 9, then 14 digits'; + $text['label-9d15']['en-us'] = 'dial 9, then International'; + $text['label-800']['en-us'] = 'toll free'; + $text['message-update']['en-us'] = 'Update Complete'; + $text['label-outbound-routes']['en-us'] = 'Outbound Routes'; + $text['button-back']['en-us'] = 'Back'; + $text['description-outbound-routes']['en-us'] = 'Outbound dialplans have one or more conditions that are matched to attributes of a call. When a call matches the conditions the call is then routed to the gateway.'; + $text['label-gateway']['en-us'] = 'Gateway'; + $text['label-sip-gateway']['en-us'] = 'SIP Gateways'; + $text['label-add-options']['en-us'] = 'Additional Options'; + $text['message-add-options']['en-us'] = 'Select the gateway to use with this outbound route.'; + $text['label-alt1']['en-us'] = 'Alternate 1'; + $text['message-add-options1']['en-us'] = 'Select another gateway as an alternative to use if the first one fails.'; + $text['label-alt2']['en-us'] = 'Alternate 2'; + $text['message-add-options2']['en-us'] = 'Select another gateway as an alternative to use if the second one fails.'; + $text['description-shortcut']['en-us'] = 'Shortcut to create the outbound dialplan entries for this Gateway.'; + $text['label-prefix']['en-us'] = 'Prefix'; + $text['description-enter-prefix']['en-us'] = 'Enter a prefix number to add to the beginning of the destination number.'; + $text['label-limit']['en-us'] = 'Limit'; + $text['description-limit']['en-us'] = 'Enter limit to restrict the number of outbound calls.'; + $text['label-order']['en-us'] = 'Order'; + $text['description-order']['en-us'] = 'Select the order number. The order number determines the order of the outbound routes when there is more than one.'; + $text['label-enabled']['en-us'] = 'Enabled'; + $text['label-true']['en-us'] = 'true'; + $text['label-false']['en-us'] = 'false'; + $text['description-enabled']['en-us'] = 'Choose to enable or disable the outbound route.'; + $text['label-description']['en-us'] = 'Description'; + $text['description-description']['en-us'] = 'Enter a description for the outbound route.'; + $text['button-save']['en-us'] = 'Save'; + + +?> \ No newline at end of file diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 954937bdb6..b56b908b61 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.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']]; + } + //show the header require_once "includes/header.php"; require_once "includes/paging.php"; @@ -179,10 +186,10 @@ else { //process the http form values if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //check for all required data - if (strlen($gateway) == 0) { $msg .= "Please provide: Gateway Name
\n"; } + if (strlen($gateway) == 0) { $msg .= $text['message-provide'].": ".$text['label-gateway-name']."
\n"; } //if (strlen($gateway_2) == 0) { $msg .= "Please provide: Alternat 1
\n"; } //if (strlen($gateway_3) == 0) { $msg .= "Please provide: Alternat 2
\n"; } - if (strlen($dialplan_expression) == 0) { $msg .= "Please provide: Dialplan Expression
\n"; } + if (strlen($dialplan_expression) == 0) { $msg .= $text['message-provide'].": ".$text['label-dialplan-expression']."
\n"; } //if (strlen($dialplan_name) == 0) { $msg .= "Please provide: Extension Name
\n"; } //if (strlen($condition_field_1) == 0) { $msg .= "Please provide: Condition Field
\n"; } //if (strlen($condition_expression_1) == 0) { $msg .= "Please provide: Condition Expression
\n"; } @@ -244,90 +251,90 @@ else { } switch ($dialplan_expression) { case "^(\d{7})$": - $label = "7 digits"; + $label = $text['label-7d']; $abbrv = "7d"; break; case "^(\d{8})$": - $label = "8 digits"; + $label = $text['label-8d']; $abbrv = "8d"; break; case "^(\d{9})$": - $label = "9 digits"; + $label = $text['label-9d']; $abbrv = "9d"; break; case "^(\d{10})$": - $label = "10 digits"; + $label = $text['label-10d']; $abbrv = "10d"; break; case "^\+?(\d{11})$": - $label = "11 digits"; + $label = $text['label-11d']; $abbrv = "11d"; break; case "^(\d{12})$": - $label = "12 digits"; + $label = $text['label-12d']; $abbrv = "12d"; break; case "^(\d{13})$": - $label = "13 digits"; + $label = $text['label-13d']; $abbrv = "13d"; break; case "^(\d{14})$": - $label = "14 digits"; + $label = $text['label-14d']; $abbrv = "14d"; break; case "^(\d{12,15})$": - $label = "International"; + $label = $text['label-int']; $abbrv = "Intl"; break; case "^(311)$": - $label = "311"; + $label = $text['label-311']; $abbrv = "311"; break; case "^(411)$": - $label = "411"; + $label = $text['label-411']; $abbrv = "411"; break; case "^(911)$": - $label = "911"; + $label = $text['label-911']; $abbrv = "911"; break; case "^9(\d{3})$": - $label = "dial 9, 3 digits"; + $label = $text['label-9d3']; $abbrv = "9.3d"; break; case "^9(\d{4})$": - $label = "dial 9, 4 digits"; + $label = $text['label-9d4']; $abbrv = "9.4d"; break; case "^9(\d{7})$": - $label = "dial 9, 7 digits"; + $label = $text['label-9d7']; $abbrv = "9.7d"; break; case "^9(\d{10})$": - $label = "dial 9, 10 digits"; + $label = $text['label-9d10']; $abbrv = "9.10d"; break; case "^9(\d{11})$": - $label = "dial 9, 11 digits"; + $label = $text['label-9d11']; $abbrv = "9.11d"; break; case "^9(\d{12})$": - $label = "dial 9, 12 digits"; + $label = $text['label-9d12']; $abbrv = "9.Intl"; break; case "^9(\d{13})$": - $label = "dial 9, 13 digits"; + $label = $text['label-9d13']; $abbrv = "9.13d"; break; case "^9(\d{14})$": - $label = "dial 9, 14 digits"; + $label = $text['label-9d14']; break; case "^9(\d{12,15})$": - $label = "dial 9, International"; + $label = $text['label-9d15']; $abbrv = "9.Intl"; break; case "^1?(8(00|55|66|77|88)[2-9]\d{6})$": - $label = "toll free"; + $label = $text['label-800']; $abbrv = "tollfree"; break; default: @@ -561,7 +568,7 @@ else { 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; @@ -612,18 +619,17 @@ function type_onchange(dialplan_detail_type) { echo " \n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; @@ -636,7 +642,7 @@ function type_onchange(dialplan_detail_type) { 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 ""; 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"; @@ -976,7 +982,7 @@ function type_onchange(dialplan_detail_type) { if ($action == "update") { echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo "";
Outbound Routes\n"; + echo " ".$text['label-outbound-routes']."\n"; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " \n"; - echo " Outbound dialplans have one or more conditions that are matched to attributes of a call. \n"; - echo " When a call matches the conditions the call is then routed to the gateway.\n"; + echo " ".$text['description-outbound-routes']."\n"; echo " \n"; echo "
\n"; - echo " Gateway:\n"; + echo " ".$text['label-gateway'].":\n"; echo "\n"; @@ -687,7 +693,7 @@ function type_onchange(dialplan_detail_type) { unset ($prep_statement, $sql); echo "\n"; echo "
\n"; - echo "Select the gateway to use with this outbound route.\n"; + echo $text['message-add-options']."\n"; echo "
\n"; - echo " Alternate 1:\n"; + echo " ".$text['label-alt1'].":\n"; echo "\n"; @@ -746,7 +752,7 @@ function type_onchange(dialplan_detail_type) { unset ($prep_statement, $sql); echo "\n"; echo "
\n"; - echo "Select another gateway as an alternative to use if the first one fails.\n"; + echo $text['message-add-options1']."\n"; echo "
\n"; - echo " Alternate 2:\n"; + echo " ".$text['label-alt2'].":\n"; echo "\n"; @@ -805,7 +811,7 @@ function type_onchange(dialplan_detail_type) { unset ($prep_statement, $sql); echo "\n"; echo "
\n"; - echo "Select another gateway as an alternative to use if the second one fails.\n"; + echo $text['message-add-options2']."\n"; echo "
Dialplan Expression:".$text['label-dialplan-expression'].":"; echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo "
\n"; - echo " Shortcut to create the outbound dialplan entries for this Gateway. \n"; + echo " ".$text['description-shortcut']." \n"; echo "
\n"; - echo " Prefix:\n"; + echo " ".$text['label-prefix'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter a prefix number to add to the beginning of the destination number.\n"; + echo $text['description-enter-prefix']."\n"; echo "
\n"; - echo " Limit:\n"; + echo " ".$text['label-limit'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter limit to restrict the number of outbound calls.\n"; + echo $text['description-limit']."\n"; echo "
\n"; - echo " Order:\n"; + echo " ".$text['label-order'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Select the order number. The order number determines the order of the outbound routes when there is more than one.\n"; + echo $text['description-order']."\n"; echo "
\n"; - echo " Enabled:\n"; + echo " ".$text['label-enabled'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Choose to enable or disable the outbound route.\n"; + echo $text['description-enabled']."\n"; echo "
\n"; - echo " Description:\n"; + echo " ".$text['label-description'].":\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter a description for the outbound route.\n"; + echo $text['description-description']."\n"; echo "