Multilinguified Hunt Groups. Fixed Copy functionality, and added JS extension prompt on Copy.

This commit is contained in:
Nate Jones 2013-05-30 00:51:49 +00:00
parent 545f21a1e5
commit e46e4fc894
9 changed files with 371 additions and 218 deletions

View File

@ -0,0 +1,97 @@
<?php
//Hunt Groups
$text['title-hunt_groups']['en-us'] = 'Hunt Groups';
$text['title-hunt_group']['en-us'] = 'Hunt Group';
$text['title-hunt_group_destination_add']['en-us'] = 'Destination Add';
$text['title-hunt_group_destination_edit']['en-us'] = 'Destination Edit';
$text['title-hunt-group_call_forward']['en-us'] = 'Hunt Group Call Forward';
$text['header-hunt_groups']['en-us'] = 'Hunt Groups';
$text['header-hunt_group']['en-us'] = 'Hunt Group';
$text['header-hunt_group_destinations']['en-us'] = 'Destinations';
$text['header-hunt_group_destination_add']['en-us'] = 'Destination Add';
$text['header-hunt_group_destination_edit']['en-us'] = 'Destination Edit';
$text['header-hunt-group_call_forward']['en-us'] = 'Hunt Group Call Forward';
$text['description-hunt_groups']['en-us'] = 'A Hunt Group is a list of destinations that can be called in sequence or simultaneously.';
$text['description-hunt_group']['en-us'] = 'Specify the attributes of your Hunt Group below.';
$text['description-hunt_group_destinations']['en-us'] = 'The following destinations will be called.';
$text['description-hunt_group_call_forward']['en-us'] = 'Use the links to configure hunt group call forward. The following hunt groups have been assigned to this user account.';
$text['description-hunt_group_call_forward_edit']['en-us'] = 'Directs incoming calls for extension';
$text['label-name']['en-us'] = 'Name';
$text['label-extension']['en-us'] = 'Extension';
$text['label-strategy']['en-us'] = 'Strategy';
$text['label-timeout']['en-us'] = 'Timeout';
$text['label-timeout_destination']['en-us'] = 'Timeout Destination';
$text['label-timeout_type']['en-us'] = 'Timeout Type';
$text['label-ring_back']['en-us'] = 'Ring Back';
$text['label-caller_id_name_prefix']['en-us'] = 'Caller ID Name Prefix';
$text['label-pin_number']['en-us'] = 'PIN Number';
$text['label-caller_announce']['en-us'] = 'Caller Announce';
$text['label-user_list']['en-us'] = 'User List';
$text['label-enabled']['en-us'] = 'Enabled';
$text['label-description']['en-us'] = 'Description';
$text['label-destination']['en-us'] = 'Destination';
$text['label-type']['en-us'] = 'Type';
$text['label-profile']['en-us'] = 'Profile';
$text['label-order']['en-us'] = 'Order';
$text['label-tools']['en-us'] = 'Tools';
$text['label-call_forward']['en-us'] = 'Call Forward';
$text['label-call_prompt']['en-us'] = 'Call Prompt';
$text['label-number']['en-us'] = 'Number';
$text['description-name']['en-us'] = 'Enter a name for this hunt group.';
$text['description-extension']['en-us'] = 'Enter an extension for this hunt group. (eg. 7002)';
$text['description-strategy']['en-us'] = 'Select a ring strategy.';
$text['description-timeout']['en-us'] = 'The timeout sets the time in seconds to continue to call before timing out.';
$text['description-timeout_destination']['en-us'] = 'Enter the timeout destination. (eg. 1001)';
$text['description-timeout_type']['en-us'] = 'Select the timeout destination type.';
$text['description-ring_back']['en-us'] = 'Select what the caller will hear while the destination is being called.';
$text['description-caller_id_name_prefix']['en-us'] = 'Set a prefix on the caller ID name.';
$text['description-pin_number']['en-us'] = 'If this is provided then the caller will be required to enter the PIN number.';
$text['description-user_list_select']['en-us'] = 'Select users above to add to the user list below. This will assign users to this hunt group extension.';
$text['description-user_list_textarea']['en-us'] = 'Assign the users that can manage this hunt group extension.';
$text['description-enabled']['en-us'] = 'Set the status of this hunt group.';
$text['description-description']['en-us'] = 'Enter a description here, if desired (not parsed).';
$text['description-destination_timeout']['en-us'] = 'Select the destination timeout in seconds.';
$text['description-destination_order']['en-us'] = 'The processing of each destination is determined by the order specified above.';
$text['description-destination_examples']['en-us'] = 'Example Values';
$text['description-destination_example_extension']['en-us'] = 'Extension';
$text['description-destination_example_voicemail']['en-us'] = 'Voicemail';
$text['description-destination_example_sip_uri_voicemail']['en-us'] = 'SIP URI (Voicemail)';
$text['description-destination_example_sip_uri_external_number']['en-us'] = 'SIP URI (External Number)';
$text['description-destination_example_sip_uri_auto_attendant']['en-us'] = 'SIP URI (Auto Attendant)';
$text['description-destination_example_sip_uri_user']['en-us'] = 'SIP URI (User)';
$text['option-true']['en-us'] = 'True';
$text['option-false']['en-us'] = 'False';
$text['option-simultaneous']['en-us'] = 'Simultaneous';
$text['option-sequential']['en-us'] = 'Sequential';
$text['option-extension']['en-us'] = 'Extension';
$text['option-voicemail']['en-us'] = 'Voicemail';
$text['option-sip_uri']['en-us'] = 'SIP URI';
$text['option-enabled']['en-us'] = 'Enabled';
$text['option-disabled']['en-us'] = 'Disabled';
$text['button-add']['en-us'] = 'Add';
$text['button-edit']['en-us'] = 'Edit';
$text['button-delete']['en-us'] = 'Delete';
$text['button-advanced']['en-us'] = 'Advanced';
$text['button-copy']['en-us'] = 'Copy';
$text['button-back']['en-us'] = 'Back';
$text['button-save']['en-us'] = 'Save';
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
$text['confirm-copy']['en-us'] = 'Do you really want to copy this?';
$text['message-add']['en-us'] = 'Add Completed';
$text['message-update']['en-us'] = 'Update Completed';
$text['message-delete']['en-us'] = 'Delete Completed';
$text['message-copy']['en-us'] = 'Copy Completed';
$text['message_extension']['en-us'] = 'Enter the new Extension to use...';
$text['message-required']['en-us'] = 'Please provide: ';
?>

View File

@ -26,11 +26,22 @@
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "includes/header.php";
require_once "includes/paging.php";
//check permissions
if (permission_exists('hunt_group_call_forward')) {
require_once "includes/header.php";
$page["title"] = $text['title-hunt-group_call_forward'];
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']];
}
$order_by = $_GET["order_by"];
$order = $_GET["order"];
@ -43,9 +54,8 @@ if (permission_exists('hunt_group_call_forward')) {
echo " <br>";
echo " <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Hunt Group Call Forward</b><br>\n";
echo " Use the links to configure hunt group call forward.\n";
echo " The following hunt groups have been assigned to this user account. \n";
echo " <td align='left'><b>".$text['header-hunt-group_call_forward']."</b><br>\n";
echo " ".$text['description-hunt_group_call_forward']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
@ -83,9 +93,9 @@ if (permission_exists('hunt_group_call_forward')) {
else {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Hunt Group Extension</th>\n";
echo "<th>Tools</th>\n";
echo "<th>Description</th>\n";
echo "<th>".$text['label-extension']."</th>\n";
echo "<th>".$text['label-tools']."</th>\n";
echo "<th>".$text['label-description']."</th>\n";
echo "</tr>\n";
}
@ -94,7 +104,7 @@ if (permission_exists('hunt_group_call_forward')) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['hunt_group_extension']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo " <a href='".PROJECT_PATH."/app/hunt_group/hunt_group_call_forward_edit.php?id=".$row['hunt_group_uuid']."&a=call_forward' alt='Call Forward'>Call Forward</a> \n";
echo " <a href='".PROJECT_PATH."/app/hunt_group/hunt_group_call_forward_edit.php?id=".$row['hunt_group_uuid']."&a=call_forward' alt='".$text['label-call_forward']."'>".$text['label-call_forward']."</a> \n";
echo " </td>\n";
echo " <td valign='top' class='row_stylebg' width='40%'>".$row['hunt_group_description']."&nbsp;</td>\n";
echo "</tr>\n";

View File

@ -36,6 +36,12 @@ require_once "includes/checkauth.php";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
function destination_select($select_name, $select_value, $select_default) {
if (strlen($select_value) == 0) { $select_value = $select_default; }
echo " <select class='formfld' style='width: 40px;' name='$select_name'>\n";
@ -56,6 +62,7 @@ function destination_select($select_name, $select_value, $select_default) {
//show the header
require_once "includes/header.php";
$page["title"] = $text['title-hunt-group_call_forward'];
//get the hunt_group_uuid
$hunt_group_uuid = $_REQUEST["id"];
@ -95,9 +102,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//check for all required data
//if (strlen($call_forward_enabled) == 0) { $msg .= "Please provide: Call Forward<br>\n"; }
//if (strlen($call_forward_number) == 0) { $msg .= "Please provide: Number<br>\n"; }
//if (strlen($hunt_group_call_prompt) == 0) { $msg .= "Please provide: call prompt<br>\n"; }
//if (strlen($call_forward_enabled) == 0) { $msg .= $text['message-required'].$text['label-call_forward']."<br>\n"; }
//if (strlen($call_forward_number) == 0) { $msg .= $text['message-required'].$text['label-number']."<br>\n"; }
//if (strlen($hunt_group_call_prompt) == 0) { $msg .= $text['message-required'].$text['label-call_prompt']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@ -343,14 +350,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"3;url=".PROJECT_PATH."/app/hunt_group/hunt_group_call_forward.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete<br />\n";
echo $text['message-update']."<br />\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//show the header
require_once "includes/header.php";
//pre-populate the form
$sql = "select * from v_hunt_groups ";
@ -412,49 +418,47 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap>\n";
echo " <b>Hunt Group Call Forward</b>\n";
echo " <b>".$text['header-hunt-group_call_forward']."</b>\n";
echo "</td>\n";
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='hunt_group_call_forward.php'\" value='Back'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='hunt_group_call_forward.php'\" value='".$text['button-back']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " Directs incoming calls for extension $hunt_group_extension.<br /><br />\n";
echo " ".$text['description-hunt_group_call_forward_edit']." ".$hunt_group_extension."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " <strong>Call Forward:</strong>\n";
echo " <strong>".$text['label-call_forward'].":</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if ($call_forward_enabled == "true") {
echo " <input type='radio' name='call_forward_enabled' value='true' checked='checked'/> Enabled \n";
echo " <input type='radio' name='call_forward_enabled' value='true' checked='checked'/> ".$text['option-enabled']." \n";
}
else {
echo " <input type='radio' name='call_forward_enabled' value='true' /> Enable \n";
echo " <input type='radio' name='call_forward_enabled' value='true' /> ".$text['option-enabled']." \n";
}
if ($call_forward_enabled == "false" || $call_forward_enabled == "") {
echo " <input type='radio' name='call_forward_enabled' value='false' checked='checked' /> Disabled \n";
echo " <input type='radio' name='call_forward_enabled' value='false' checked='checked' /> ".$text['option-disabled']." \n";
}
else {
echo " <input type='radio' name='call_forward_enabled' value='false' /> Disable \n";
echo " <input type='radio' name='call_forward_enabled' value='false' /> ".$text['option-disabled']." \n";
}
echo "<br />\n";
echo "<br />\n";
//echo "Enable or disable call forward.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Number:\n";
echo " ".$text['label-number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='call_forward_number' maxlength='255' value=\"$call_forward_number\">\n";
echo "<br />\n";
//echo "Enter the call forward number.\n";
echo "</td>\n";
echo "</tr>\n";
@ -475,7 +479,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='hidden' name='id' value='$call_forward_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>";

View File

@ -37,12 +37,19 @@ require_once "includes/paging.php";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//set the http get/post variable(s) to a php variable
if (isset($_REQUEST["id"])) {
$hunt_group_uuid = check_str($_REQUEST["id"]);
$hunt_group_extension_new = check_str($_REQUEST["ext"]);
}
//get the v_hunt_group data
//get the v_hunt_group data
$sql = "select * from v_hunt_groups ";
$sql .= "where hunt_group_uuid = '$hunt_group_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
@ -51,7 +58,7 @@ require_once "includes/paging.php";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$hunt_group_extension = $row["hunt_group_extension"];
$hunt_group_name = $row["hunt_group_name"];
$hunt_group_name = $row["hunt_group_name"]."_copy";
$hunt_group_type = $row["hunt_group_type"];
$hunt_group_context = $row["hunt_group_context"];
$hunt_group_timeout = $row["hunt_group_timeout"];
@ -61,6 +68,7 @@ require_once "includes/paging.php";
$hunt_group_cid_name_prefix = $row["hunt_group_cid_name_prefix"];
$hunt_group_pin = $row["hunt_group_pin"];
$hunt_group_caller_announce = $row["hunt_group_caller_announce"];
$hunt_group_user_list = $row["hunt_group_user_list"];
$hunt_group_enabled = $row["hunt_group_enabled"];
$hunt_group_description = "copy: ".$row["hunt_group_description"];
break; //limit to 1 row
@ -68,10 +76,11 @@ require_once "includes/paging.php";
unset ($prep_statement);
//copy the hunt group
$hunt_group_uuid_new = uuid();
$sql = "insert into v_hunt_groups ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_extension, ";
$sql .= "hunt_group_name, ";
$sql .= "hunt_group_type, ";
@ -83,14 +92,15 @@ require_once "includes/paging.php";
$sql .= "hunt_group_cid_name_prefix, ";
$sql .= "hunt_group_pin, ";
$sql .= "hunt_group_caller_announce, ";
$sql .= "hunt_group_user_list, ";
$sql .= "hunt_group_enabled, ";
$sql .= "hunt_group_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$hunt_group_uuid_new', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$hunt_group_uuid', ";
$sql .= "'$hunt_group_extension', ";
$sql .= "'$hunt_group_extension_new', ";
$sql .= "'$hunt_group_name', ";
$sql .= "'$hunt_group_type', ";
$sql .= "'$hunt_group_context', ";
@ -101,6 +111,7 @@ require_once "includes/paging.php";
$sql .= "'$hunt_group_cid_name_prefix', ";
$sql .= "'$hunt_group_pin', ";
$sql .= "'$hunt_group_caller_announce', ";
$sql .= "'$hunt_group_user_list', ";
$sql .= "'$hunt_group_enabled', ";
$sql .= "'$hunt_group_description' ";
$sql .= ")";
@ -115,11 +126,12 @@ require_once "includes/paging.php";
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$hunt_group_uuid = $row["hunt_group_uuid"];
$destination_data = $row["destination_data"];
$destination_type = $row["destination_type"];
$destination_profile = $row["destination_profile"];
$destination_timeout = $row["destination_timeout"];
$destination_order = $row["destination_order"];
$destination_enabled = $row["destination_enabled"];
$destination_description = $row["destination_description"];
//copy the hunt group destinations
@ -132,21 +144,27 @@ require_once "includes/paging.php";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$db_hunt_group_uuid', ";
$sql .= "'$hunt_group_uuid_new', ";
$sql .= "'$hunt_group_destination_uuid', ";
$sql .= "'$destination_data', ";
$sql .= "'$destination_type', ";
$sql .= "'$destination_profile', ";
$sql .= "'$destination_timeout', ";
$sql .= "'$destination_order', ";
$sql .= "'$destination_enabled', ";
$sql .= "'$destination_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
//echo $sql."<br><br>";
//exit();
unset($sql);
}
unset ($prep_statement);
@ -158,7 +176,7 @@ require_once "includes/paging.php";
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_groups.php\">\n";
echo "<div align='center'>\n";
echo "Copy Complete\n";
echo $text['message-copy']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@ -28,12 +28,18 @@ require_once "includes/require.php";
require_once "includes/checkauth.php";
//check permissions
if (permission_exists('hunt_group_delete')) {
//access granted
}
else {
echo "access denied";
exit;
if (permission_exists('hunt_group_delete')) {
//access granted
}
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']];
}
if (count($_GET)>0) {
@ -104,7 +110,7 @@ if (strlen($id)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_groups.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@ -36,6 +36,12 @@ require_once "includes/checkauth.php";
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 = $_GET["id"];
$hunt_group_uuid = check_str($_REQUEST["id2"]);
@ -58,7 +64,7 @@ if (strlen($id)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_group_edit.php?id=".$hunt_group_uuid."\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@ -36,6 +36,12 @@ require_once "includes/checkauth.php";
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";
@ -70,13 +76,13 @@ 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($destination_data) == 0) { $msg .= "Please provide: Destination<br>\n"; }
if (strlen($destination_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($destination_timeout) == 0) { $msg .= "Please provide: Timeout<br>\n"; }
//if (strlen($destination_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
//if (strlen($destination_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($destination_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
if (strlen($destination_data) == 0) { $msg .= $text['message-required'].$text['label-destination']."<br>\n"; }
if (strlen($destination_type) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($destination_timeout) == 0) { $msg .= $text['message-required'].$text['label-timeout']."<br>\n"; }
//if (strlen($destination_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
//if (strlen($destination_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($destination_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@ -127,7 +133,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_group_edit.php?id=".$hunt_group_uuid."\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo $text['message-add']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@ -153,7 +159,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_group_edit.php?id=".$hunt_group_uuid."\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo $text['message-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
@ -185,6 +191,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the header
require_once "includes/header.php";
if ($action == "add") {
$page["title"] = $text['title-hunt_group_destination_add'];
}
if ($action == "update") {
$page["title"] = $text['title-hunt_group_destination_edit'];
}
//show the content
echo "<div align='center'>";
@ -201,54 +213,55 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap><b>Destination Add</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-hunt_group_destination_add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>Destination Edit</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['header-hunt_group_destination_edit']."</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='hunt_group_edit.php?id=".$hunt_group_uuid."'\" value='Back'></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='hunt_group_edit.php?id=".$hunt_group_uuid."'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Destination:\n";
echo " ".$text['label-destination'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data' maxlength='255' value=\"$destination_data\">\n";
echo "<br />\n";
echo "extension: 1001<br />\n";
echo "voicemail: 1001<br />\n";
echo "sip uri (voicemail): sofia/internal/*98@\${domain}<br />\n";
echo "sip uri (external number): sofia/gateway/gatewayname/12081231234<br />\n";
echo "sip uri (auto attendant): sofia/internal/5002@\${domain}<br />\n";
echo "sip uri (user): /user/1001@\${domain}\n";
echo "<b>".$text['description-destination_examples']."</b>...<br>\n";
echo $text['description-destination_example_extension'].": 1001<br />\n";
echo $text['description-destination_example_voicemail'].": 1001<br />\n";
echo $text['description-destination_example_sip_uri_voicemail'].": sofia/internal/*98@\${domain}<br />\n";
echo $text['description-destination_example_sip_uri_external_number'].": sofia/gateway/gatewayname/12081231234<br />\n";
echo $text['description-destination_example_sip_uri_auto_attendant'].": sofia/internal/5002@\${domain}<br />\n";
echo $text['description-destination_example_sip_uri_user'].": /user/1001@\${domain}\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo " ".$text['label-type'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='destination_type' class='formfld'>\n";
echo " <option></option>\n";
if ($destination_type == "extension") {
echo " <option selected='yes'>extension</option>\n";
echo " <option selected='yes' value='extension'>".$text['option-extension']."</option>\n";
}
else {
echo " <option>extension</option>\n";
echo " <option value='extension'>".$text['option-extension']."</option>\n";
}
if ($destination_type == "voicemail") {
echo " <option selected='yes'>voicemail</option>\n";
echo " <option selected='yes' value='voicemail'>".$text['option-voicemail']."</option>\n";
}
else {
echo " <option>voicemail</option>\n";
echo " <option value='voicemail'>".$text['option-voicemail']."</option>\n";
}
if ($destination_type == "sip uri") {
echo " <option selected='yes'>sip uri</option>\n";
echo " <option selected='yes' value='sip uri'>".$text['option-sip_uri']."</option>\n";
}
else {
echo " <option>sip uri</option>\n";
echo " <option value='sip uri'>".$text['option-sip_uri']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
@ -258,7 +271,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Timeout:\n";
echo " ".$text['label-timeout'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='destination_timeout' class='formfld'>\n";
@ -273,17 +286,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
echo " </select>\n";
echo "<br />\n";
echo "Select the destination timeout in seconds. \n";
echo $text['description-destination_timeout']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Order:\n";
echo " ".$text['label-order'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='destination_order' class='formfld'>\n";
//echo " <option></option>\n";
if (strlen($destination_order)> 0) {
echo " <option selected='yes' value='".htmlspecialchars($destination_order)."'>".htmlspecialchars($destination_order)."</option>\n";
}
@ -302,28 +314,28 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
echo " </select>\n";
echo "<br />\n";
echo "Processing of each destination is determined by this order. \n";
echo $text['description-destination_order']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Enabled:\n";
echo " ".$text['label-enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='destination_enabled'>\n";
echo " <option value=''></option>\n";
if ($destination_enabled == "true" || strlen($destination_enabled) == 0) {
echo " <option value='true' selected >true</option>\n";
if ($destination_enabled == "true" || strlen($destination_enabled) == 0) {
echo " <option value='true' selected >".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($destination_enabled == "false") {
echo " <option value='false' selected >false</option>\n";
if ($destination_enabled == "false") {
echo " <option value='false' selected >".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
@ -333,12 +345,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo " ".$text['label-description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_description' maxlength='255' value=\"$destination_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";
@ -348,7 +360,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
echo " <input type='hidden' name='hunt_group_destination_uuid' value='$hunt_group_destination_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>";

View File

@ -37,6 +37,12 @@ require_once "includes/paging.php";
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";
@ -52,7 +58,6 @@ require_once "includes/paging.php";
$hunt_group_extension = check_str($_POST["hunt_group_extension"]);
$hunt_group_name = check_str($_POST["hunt_group_name"]);
$hunt_group_type = check_str($_POST["hunt_group_type"]);
//$hunt_group_context = check_str($_POST["hunt_group_context"]);
$hunt_group_timeout = check_str($_POST["hunt_group_timeout"]);
$hunt_group_timeout_destination = check_str($_POST["hunt_group_timeout_destination"]);
$hunt_group_timeout_type = check_str($_POST["hunt_group_timeout_type"]);
@ -100,21 +105,20 @@ 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($hunt_group_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
if (strlen($hunt_group_name) == 0) { $msg .= "Please provide: Hunt Group Name<br>\n"; }
if (strlen($hunt_group_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($hunt_group_context) == 0) { $msg .= "Please provide: Context<br>\n"; }
if (strlen($hunt_group_timeout) == 0) { $msg .= "Please provide: Timeout<br>\n"; }
if (strlen($hunt_group_timeout_destination) == 0) { $msg .= "Please provide: Timeout Destination<br>\n"; }
if (strlen($hunt_group_timeout_type) == 0) { $msg .= "Please provide: Timeout Type<br>\n"; }
//if (strlen($hunt_group_ringback) == 0) { $msg .= "Please provide: Ring Back<br>\n"; }
//if (strlen($hunt_group_cid_name_prefix) == 0) { $msg .= "Please provide: CID Prefix<br>\n"; }
//if (strlen($hunt_group_pin) == 0) { $msg .= "Please provide: PIN<br>\n"; }
if (strlen($hunt_group_caller_announce) == 0) { $msg .= "Please provide: Caller Announce<br>\n"; }
//if (strlen($hunt_group_user_list) == 0) { $msg .= "Please provide: User List<br>\n"; }
//if (strlen($hunt_group_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
//if (strlen($hunt_group_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid<br>\n"; }
if (strlen($hunt_group_extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."<br>\n"; }
if (strlen($hunt_group_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
if (strlen($hunt_group_type) == 0) { $msg .= $text['message-required'].$text['label-strategy']."<br>\n"; }
if (strlen($hunt_group_timeout) == 0) { $msg .= $text['message-required'].$text['label-timeout']."<br>\n"; }
if (strlen($hunt_group_timeout_destination) == 0) { $msg .= $text['message-required'].$text['label-timeout_destination']."<br>\n"; }
if (strlen($hunt_group_timeout_type) == 0) { $msg .= $text['message-required'].$text['label-timeout_type']."<br>\n"; }
//if (strlen($hunt_group_ringback) == 0) { $msg .= $text['message-required'].$text['label-ring_back']."<br>\n"; }
//if (strlen($hunt_group_cid_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-caller_id_name_prefix']."<br>\n"; }
//if (strlen($hunt_group_pin) == 0) { $msg .= $text['message-required'].$text['label-pin_number']."<br>\n"; }
if (strlen($hunt_group_caller_announce) == 0) { $msg .= $text['message-required'].$text['label-caller_announce']."<br>\n"; }
//if (strlen($hunt_group_user_list) == 0) { $msg .= $text['message-required'].$text['label-user_list']."<br>\n"; }
//if (strlen($hunt_group_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($hunt_group_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/persistformvar.php";
@ -184,7 +188,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_groups.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;
@ -265,7 +269,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=hunt_groups.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;
@ -288,7 +292,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$hunt_group_extension = $row["hunt_group_extension"];
$hunt_group_name = $row["hunt_group_name"];
$hunt_group_type = $row["hunt_group_type"];
//$hunt_group_context = $row["hunt_group_context"];
$hunt_group_timeout = $row["hunt_group_timeout"];
$hunt_group_timeout_destination = $row["hunt_group_timeout_destination"];
$hunt_group_timeout_type = $row["hunt_group_timeout_type"];
@ -306,6 +309,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the header
require_once "includes/header.php";
$page["title"] = $text['title-hunt_group'];
//show the content
echo "<div align='center'>";
@ -324,18 +329,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap>\n";
echo " <span class='vexpl'>\n";
echo " <strong>Hunt Group</strong><br>\n";
echo " <strong>".$text['header-hunt_group']."</strong><br>\n";
echo " </span>\n";
echo "</td>\n";
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='' alt='copy' onclick=\"if (confirm('Do you really want to copy this?')){window.location='hunt_group_copy.php?id=".$hunt_group_uuid."';}\" value='Copy'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='hunt_groups.php'\" value='Back'>\n";
if ($action != "add") {
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"var new_ext = prompt('".$text['message_extension']."'); if (new_ext != null) { window.location='hunt_group_copy.php?id=".$hunt_group_uuid."&ext=' + new_ext; }\" value='".$text['button-copy']."'>\n";
}
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='hunt_groups.php'\" value='".$text['button-back']."'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo " A Hunt Group is a list of destinations that can be called in sequence or simultaneously. \n";
echo " ".$text['description-hunt_group']."\n";
echo " </span><br />\n";
echo "<br />\n";
echo "</td>\n";
@ -347,69 +354,45 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Hunt Group Name:\n";
echo " ".$text['label-name'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_name' maxlength='255' value=\"$hunt_group_name\">\n";
echo "<br />\n";
echo "\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Extension:\n";
echo " ".$text['label-extension'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_extension' maxlength='255' value=\"$hunt_group_extension\">\n";
echo "<br />\n";
echo "example: 7002\n";
echo $text['description-extension']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo " ".$text['label-strategy'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='hunt_group_type'>\n";
echo " <option value=''></option>\n";
if ($hunt_group_type == "simultaneous") {
echo " <option value='simultaneous' selected='selected'>simultaneous</option>\n";
if ($hunt_group_type == "simultaneous") {
echo " <option value='simultaneous' selected='selected'>".$text['option-simultaneous']."</option>\n";
}
else {
echo " <option value='simultaneous'>simultaneous</option>\n";
echo " <option value='simultaneous'>".$text['option-simultaneous']."</option>\n";
}
if ($hunt_group_type == "sequentially") {
echo " <option value='sequentially' selected='selected'>sequentially</option>\n";
if ($hunt_group_type == "sequentially") {
echo " <option value='sequentially' selected='selected'>".$text['option-sequential']."</option>\n";
}
else {
echo " <option value='sequentially'>sequentially</option>\n";
echo " <option value='sequentially'>".$text['option-sequential']."</option>\n";
}
//if ($hunt_group_type == "call_forward") {
// echo " <option value='call_forward' selected='selected'>call_forward</option>\n";
//}
//else {
// echo " <option value='call_forward'>call_forward</option>\n";
//}
//if ($hunt_group_type == "dnd") {
// echo " <option value='dnd' selected='selected'>dnd</option>\n";
//}
//else {
// echo " <option value='dnd'>dnd</option>\n";
//}
//if ($hunt_group_type == "follow_me_sequence") {
// echo " <option value='follow_me_sequence' selected='selected'>follow_me_sequence</option>\n";
//}
//else {
// echo " <option value='follow_me_sequence'>follow_me_sequence</option>\n";
//}
//if ($hunt_group_type == "follow_me_simultaneous") {
// echo " <option value='follow_me_simultaneous' selected='selected'>follow_me_simultaneous</option>\n";
//}
//else {
// echo " <option value='follow_me_simultaneous'>follow_me_simultaneous</option>\n";
//}
echo " </select>\n";
echo "<br />\n";
echo "\n";
@ -418,65 +401,65 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Timeout:\n";
echo " ".$text['label-timeout'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_timeout' maxlength='255' value=\"$hunt_group_timeout\">\n";
echo "<br />\n";
echo "The timeout sets the time in seconds to continue to call before timing out. \n";
echo $text['description-timeout']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Timeout Destination:\n";
echo " ".$text['label-timeout_destination'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_timeout_destination' maxlength='255' value=\"$hunt_group_timeout_destination\">\n";
echo "<br />\n";
echo "Destination. example: 1001\n";
echo $text['description-timeout_destination']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Timeout Type:\n";
echo " ".$text['label-timeout_type'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='hunt_group_timeout_type'>\n";
echo " <option value=''></option>\n";
if ($hunt_group_timeout_type == "extension") {
echo " <option value='extension' SELECTED >extension</option>\n";
if ($hunt_group_timeout_type == "extension") {
echo " <option value='extension' SELECTED >".$text['option-extension']."</option>\n";
}
else {
echo " <option value='extension'>extension</option>\n";
echo " <option value='extension'>".$text['option-extension']."</option>\n";
}
if ($hunt_group_timeout_type == "voicemail") {
echo " <option value='voicemail' SELECTED >voicemail</option>\n";
if ($hunt_group_timeout_type == "voicemail") {
echo " <option value='voicemail' SELECTED >".$text['option-voicemail']."</option>\n";
}
else {
echo " <option value='voicemail'>voicemail</option>\n";
echo " <option value='voicemail'>".$text['option-voicemail']."</option>\n";
}
if ($hunt_group_timeout_type == "sip uri") {
echo " <option value='sip uri' SELECTED >sip uri</option>\n";
if ($hunt_group_timeout_type == "sip uri") {
echo " <option value='sip uri' SELECTED >".$text['option-sip_uri']."</option>\n";
}
else {
echo " <option value='sip uri'>sip uri</option>\n";
echo " <option value='sip uri'>".$text['option-sip_uri']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo $text['description-timeout_type']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Ring Back:\n";
echo " ".$text['label-ring_back'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$select_options = "";
if ($hunt_group_ringback == "\${us-ring}" || $hunt_group_ringback == "us-ring") {
if ($hunt_group_ringback == "\${us-ring}" || $hunt_group_ringback == "us-ring") {
$select_options .= " <option value='\${us-ring}' selected='selected'>us-ring</option>\n";
}
else {
@ -488,13 +471,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
else {
$select_options .= " <option value='\${fr-ring}'>fr-ring</option>\n";
}
if ($hunt_group_ringback == "\${uk-ring}" || $hunt_group_ringback == "uk-ring") {
if ($hunt_group_ringback == "\${uk-ring}" || $hunt_group_ringback == "uk-ring") {
$select_options .= " <option value='\${uk-ring}' selected='selected'>uk-ring</option>\n";
}
else {
$select_options .= " <option value='\${uk-ring}'>uk-ring</option>\n";
}
if ($hunt_group_ringback == "\${rs-ring}" || $hunt_group_ringback == "rs-ring") {
if ($hunt_group_ringback == "\${rs-ring}" || $hunt_group_ringback == "rs-ring") {
$select_options .= " <option value='\${rs-ring}' selected='selected'>rs-ring</option>\n";
}
else {
@ -508,29 +491,29 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo $moh->select();
echo "<br />\n";
echo "Defines what the caller will hear while the destination is being called. The choices are music (music on hold) ring (ring tone.) default: music \n";
echo $text['description-ring_back']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " CID Prefix:\n";
echo " ".$text['label-caller_id_name_prefix'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_cid_name_prefix' maxlength='255' value=\"$hunt_group_cid_name_prefix\">\n";
echo "<br />\n";
echo "Set a prefix on the caller ID name.\n";
echo $text['description-caller_id_name_prefix']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " PIN:\n";
echo " ".$text['label-pin_number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_pin' maxlength='255' value=\"$hunt_group_pin\">\n";
echo "<br />\n";
echo "If this is provided then the caller will be required to enter the PIN number.\n";
echo $text['description-pin_number']."\n";
echo "</td>\n";
echo "</tr>\n";
@ -540,22 +523,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (switch_module_is_running($fp, 'mod_spidermonkey')) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Caller Announce:\n";
echo " ".$text['label-caller_announce'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='hunt_group_caller_announce'>\n";
echo " <option value=''></option>\n";
if ($hunt_group_caller_announce == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
if ($hunt_group_caller_announce == "true") {
echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($hunt_group_caller_announce == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
if ($hunt_group_caller_announce == "false") {
echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
@ -567,14 +550,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (if_group("admin") || if_group("superadmin")) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " User List:\n";
echo " ".$text['label-user_list'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$onchange = "document.getElementById('hunt_group_user_list').value += document.getElementById('username').value + '\\n';";
$table_name = 'v_users'; $field_name = 'username'; $field_current_value = ''; $sql_where_optional = "where domain_uuid = '$domain_uuid' and user_enabled = 'true' ";
echo html_select_on_change($db, $table_name, $field_name, $sql_where_optional, $field_current_value, $onchange);
echo "<br />\n";
echo "Use the select list to add users to the user list. This will assign users to this extension.\n";
echo $text['description-user_list_select']."\n";
echo "<br />\n";
echo "<br />\n";
//replace the vertical bar with a line feed to display in the textarea
@ -586,7 +569,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
echo " <textarea name=\"hunt_group_user_list\" id=\"hunt_group_user_list\" class=\"formfld\" cols=\"30\" rows=\"3\" wrap=\"off\">$hunt_group_user_list</textarea>\n";
echo " <br>\n";
echo "Assign the users that are can manage this hunt group extension.\n";
echo $text['description-user_list_textarea']."\n";
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
@ -594,37 +577,37 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Enabled:\n";
echo " ".$text['label-enabled'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='hunt_group_enabled'>\n";
echo " <option value=''></option>\n";
if ($hunt_group_enabled == "true" || strlen($hunt_group_enabled) == 0) {
echo " <option value='true' selected >true</option>\n";
if ($hunt_group_enabled == "true" || strlen($hunt_group_enabled) == 0) {
echo " <option value='true' selected >".$text['option-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
}
if ($hunt_group_enabled == "false") {
echo " <option value='false' selected >false</option>\n";
if ($hunt_group_enabled == "false") {
echo " <option value='false' selected >".$text['option-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo " ".$text['label-description'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hunt_group_description' maxlength='255' value=\"$hunt_group_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";
@ -633,7 +616,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
echo " <input type='hidden' name='hunt_group_uuid' value='$hunt_group_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>";
@ -657,10 +640,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'><p><span class='vexpl'>\n";
echo " <span class='red'><strong>\n";
echo " Destinations<br />\n";
echo " </strong></span>\n";
echo " The following destinations will be called.\n";
echo " <span class='red'><strong>".$text['header-hunt_group_destinations']."</strong></span><br>\n";
echo " ".$text['description-hunt_group_destinations']."\n";
echo " </span></p></td>\n";
echo " </tr>\n";
echo "</table>\n";
@ -685,14 +666,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th align='center'>Destination</th>\n";
echo "<th align='center'>Type</th>\n";
echo "<th align='center'>Profile</th>\n";
echo "<th align='center'>Order</th>\n";
echo "<th align='center'>Description</th>\n";
echo "<th align='center'>".$text['label-destination']."</th>\n";
echo "<th align='center'>".$text['label-type']."</th>\n";
echo "<th align='center'>".$text['label-profile']."</th>\n";
echo "<th align='center'>".$text['label-order']."</th>\n";
echo "<th align='center'>".$text['label-description']."</th>\n";
echo "<td align='right' width='42'>\n";
if (permission_exists('hunt_group_add')) {
echo " <a href='hunt_group_destination_edit.php?id2=".$hunt_group_uuid."' alt='add'>$v_link_label_add</a>\n";
echo " <a href='hunt_group_destination_edit.php?id2=".$hunt_group_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
@ -701,16 +682,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['destination_data']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['destination_type']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;";
switch($row['destination_type']) {
case "extension" : echo $text['option-extension']; break;
case "voicemail" : echo $text['option-voicemail']; break;
case "sip uri" : echo $text['option-sip_uri']; break;
}
echo "</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['destination_profile']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>&nbsp;&nbsp;".$row['destination_order']."</td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".$row['destination_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('hunt_group_edit')) {
echo " <a href='hunt_group_destination_edit.php?id=".$row['hunt_group_destination_uuid']."&id2=".$hunt_group_uuid."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='hunt_group_destination_edit.php?id=".$row['hunt_group_destination_uuid']."&id2=".$hunt_group_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
}
if (permission_exists('hunt_group_delete')) {
echo " <a href='hunt_group_destination_delete.php?id=".$row['hunt_group_destination_uuid']."&id2=".$hunt_group_uuid."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='hunt_group_destination_delete.php?id=".$row['hunt_group_destination_uuid']."&id2=".$hunt_group_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
@ -727,7 +714,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('hunt_group_add')) {
echo " <a href='hunt_group_destination_edit.php?id2=".$hunt_group_uuid."' alt='add'>$v_link_label_add</a>\n";
echo " <a href='hunt_group_destination_edit.php?id2=".$hunt_group_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
echo " </td>\n";
echo " </tr>\n";

View File

@ -36,7 +36,15 @@ require_once "includes/checkauth.php";
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-hunt_groups'];
require_once "includes/paging.php";
$order_by = $_GET["order_by"];
@ -50,10 +58,8 @@ echo " <br />";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo " <td align='left'><p><span class='vexpl'><span class='red'><strong>Hunt Group<br />\n";
echo " </strong></span>\n";
echo " A Hunt Group is a list of destinations that can be called in sequence or simultaneously.\n";
echo " </span></p></td>\n";
echo " <td align='left'><p><span class='vexpl'><span class='red'><strong>".$text['header-hunt_groups']."<br />\n";
echo " </strong></span>".$text['description-hunt_groups']."</span></p></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
@ -68,7 +74,7 @@ if ($prep_statement) {
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}
else {
else {
$num_rows = '0';
}
}
@ -78,9 +84,9 @@ unset($prep_statement, $result);
$rows_per_page = 150;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = 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, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
//get the hunt group list
$sql = "select * from v_hunt_groups ";
@ -105,13 +111,13 @@ $row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('hunt_group_extension', 'Extension', $order_by, $order);
echo th_order_by('hunt_group_name', 'Hunt Group Name', $order_by, $order);
echo th_order_by('hunt_group_name', 'Enabled', $order_by, $order);
echo th_order_by('hunt_group_description', 'Description', $order_by, $order);
echo th_order_by('hunt_group_extension', $text['label-extension'], $order_by, $order);
echo th_order_by('hunt_group_name', $text['label-name'], $order_by, $order);
echo th_order_by('hunt_group_name', $text['label-enabled'], $order_by, $order);
echo th_order_by('hunt_group_description', $text['label-description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('hunt_group_add')) {
echo " <a href='hunt_group_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='hunt_group_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
@ -121,14 +127,21 @@ if ($result_count > 0) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['hunt_group_extension']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['hunt_group_name']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['hunt_group_enabled']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if ($row['hunt_group_enabled'] == "true") {
echo $text['option-true'];
}
else if ($row['hunt_group_enabled'] == "false") {
echo $text['option-false'];
}
echo "</td>\n";
echo " <td valign='top' class='row_stylebg' width='40%'>".$row['hunt_group_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('hunt_group_edit')) {
echo " <a href='hunt_group_edit.php?id=".$row['hunt_group_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='hunt_group_edit.php?id=".$row['hunt_group_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
}
if (permission_exists('hunt_group_delete')) {
echo " <a href='hunt_group_delete.php?id=".$row['hunt_group_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='hunt_group_delete.php?id=".$row['hunt_group_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
@ -145,7 +158,7 @@ echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('hunt_group_add')) {
echo " <a href='hunt_group_edit.php' alt='add'>$v_link_label_add</a>\n";
echo " <a href='hunt_group_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
}
echo " </td>\n";
echo " </tr>\n";