App->Ring group, preliminary support for translations. Needs more work on ring_groups_edit.php

This commit is contained in:
James Rose
2012-11-24 07:43:34 +00:00
parent 710854ddbe
commit fa61ea75fb
4 changed files with 156 additions and 57 deletions

View File

@@ -0,0 +1,77 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
$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';
?>

View File

@@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
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 "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>Ring Groups</b></td>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " A ring group is a set of extensions that can be called with a ring strategy.<br /><br />\n";
echo " ".$text['description']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
@@ -101,15 +109,15 @@ require_once "includes/paging.php";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\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 "<td align='right' width='42'>\n";
echo " <a href='ring_groups_edit.php' alt='add'>$v_link_label_add</a>\n";
echo "</td>\n";
@@ -129,7 +137,7 @@ require_once "includes/paging.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['ring_group_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='ring_groups_edit.php?id=".$row['ring_group_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='ring_groups_delete.php?id=".$row['ring_group_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='ring_groups_delete.php?id=".$row['ring_group_uuid']."' alt='delete' onclick=\"return confirm('".$text['message-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }

View File

@@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
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 "<meta http-equiv=\"refresh\" content=\"2;url=ring_groups.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo $text['message-delete-done']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
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<br>\n"; }
if (strlen($ring_group_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
if (strlen($ring_group_strategy) == 0) { $msg .= "Please provide: Strategy<br>\n"; }
if (strlen($ring_group_timeout_sec) == 0) { $msg .= "Please provide: Timeout<br>\n"; }
if (strlen($ring_group_timeout_app) == 0) { $msg .= "Please provide: Timeout Action<br>\n"; }
if (strlen($ring_group_name) == 0) { $msg .= $text['message-name']."<br>\n"; }
if (strlen($ring_group_extension) == 0) { $msg .= $text['message-extension']."<br>\n"; }
if (strlen($ring_group_strategy) == 0) { $msg .= $text['message-strategy']."<br>\n"; }
if (strlen($ring_group_timeout_sec) == 0) { $msg .= $text['message-strategy']."<br>\n"; }
if (strlen($ring_group_timeout_app) == 0) { $msg .= $text['message-timeout-action']."<br>\n"; }
//if (strlen($ring_group_cid_name_prefix) == 0) { $msg .= "Please provide: Caller ID Prefix<br>\n"; }
//if (strlen($ring_group_ringback) == 0) { $msg .= "Please provide: Ringback<br>\n"; }
if (strlen($ring_group_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
if (strlen($ring_group_enabled) == 0) { $msg .= $text['message-enabled']."<br>\n"; }
//if (strlen($ring_group_description) == 0) { $msg .= "Please provide: Description<br>\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 "<meta http-equiv=\"refresh\" content=\"2;url=ring_groups_edit.php?id=$ring_group_uuid\">\n";
echo "<div align='center'>\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 "</div>\n";
require_once "includes/footer.php";
@@ -340,35 +347,35 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>Ring Group</b></td>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['label-ring-group']."</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='ring_groups.php'\" value='Back'></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='ring_groups.php'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "A ring group is a set of extensions that can be called with a ring strategy.<br /><br />\n";
echo $text['description']."<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Name:\n";
echo " ".$text['label-name'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ring_group_name' maxlength='255' value=\"$ring_group_name\">\n";
echo "<br />\n";
echo "Enter the name.\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='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='ring_group_extension' maxlength='255' value=\"$ring_group_extension\">\n";
echo "<br />\n";
echo "Enter the extension.\n";
echo $text['description-extension']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -380,38 +387,38 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ring_group_context' maxlength='255' value=\"$ring_group_context\">\n";
echo "<br />\n";
echo "Enter the context.\n";
echo $text['description-enter-context']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Strategy:\n";
echo " ".$text['label-strategy'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='ring_group_strategy'>\n";
echo " <option value=''></option>\n";
if ($ring_group_strategy == "sequence") {
echo " <option value='sequence' selected='selected'>sequence</option>\n";
echo " <option value='selected' selected='selected'>".$text['dropdown-sequence']."</option>\n";
}
else {
echo " <option value='sequence'>sequence</option>\n";
echo " <option value='sequence'>".$text['dropdown-sequence']."</option>\n";
}
if ($ring_group_strategy == "simultaneous") {
echo " <option value='simultaneous' selected='selected'>simultaneous</option>\n";
echo " <option value='simultaneous' selected='selected'>".$text['dropdown-simultaneous']."</option>\n";
}
else {
echo " <option value='simultaneous'>simultaneous</option>\n";
echo " <option value='simultaneous'>".$text['dropdown-simultaneous']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select the strategy.\n";
echo $text['label-sequence']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>Extensions:</td>";
echo " <td class='vncell' valign='top'>".$text['label-extensions'].":</td>";
echo " <td class='vtable' align='left'>";
if ($action == "update") {
echo " <table width='52%'>\n";
@@ -430,7 +437,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n";
echo " <td class='vtable'>".$field['extension']."</td>\n";
echo " <td>\n";
echo " <a href='ring_groups_edit.php?id=".$field['ring_group_extension_uuid']."&ring_group_uuid=".$ring_group_uuid."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='ring_groups_edit.php?id=".$field['ring_group_extension_uuid']."&ring_group_uuid=".$ring_group_uuid."&a=delete' alt='delete' onclick=\"return confirm('".$text['message-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo " </tr>\n";
}
@@ -450,79 +457,79 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
echo " </select>";
if ($action == "update") {
echo " <input type=\"submit\" class='btn' value=\"Add\">\n";
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
}
unset($sql, $result);
echo " <br>\n";
echo " Add the extensions to the ring group.\n";
echo " ".$text['description-extension']."\n";
echo " <br />\n";
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='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='ring_group_timeout_sec' maxlength='255' value='$ring_group_timeout_sec'>\n";
echo "<br />\n";
echo "Enter the timeout in seconds.\n";
echo $text['description-timeout']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Destination:\n";
echo " ".$text['label-destination'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\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 " <br />\n";
echo " Select the timeout destination.\n";
echo " ".$text['description-destination']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " CID Prefix:\n";
echo " ".$text['label-cid'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ring_group_cid_name_prefix' maxlength='255' value='$ring_group_cid_name_prefix'>\n";
echo "<br />\n";
echo "Set a prefix on the caller ID name. \n";
echo $text['description-cid']." \n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Ring Back:\n";
echo " ".$text['label-ringback'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$select_options = "";
if ($ring_group_ringback == "\${us-ring}" || $ring_group_ringback == "us-ring") {
$select_options .= " <option value='\${us-ring}' selected='selected'>us-ring</option>\n";
$select_options .= " <option value='\${us-ring}' selected='selected'>".$text['dropdown-usring']."</option>\n";
}
else {
$select_options .= " <option value='\${us-ring}'>us-ring</option>\n";
$select_options .= " <option value='\${us-ring}'>".$text['dropdown-usring']."</option>\n";
}
if ($ring_group_ringback == "\${fr-ring}" || $ring_group_ringback == "fr-ring") {
$select_options .= " <option value='\${fr-ring}' selected='selected'>fr-ring</option>\n";
$select_options .= " <option value='\${fr-ring}' selected='selected'>".$text['dropdown-frring']."</option>\n";
}
else {
$select_options .= " <option value='\${fr-ring}'>fr-ring</option>\n";
$select_options .= " <option value='\${fr-ring}'>".$text['dropdown-frring']."</option>\n";
}
if ($ring_group_ringback == "\${uk-ring}" || $ring_group_ringback == "uk-ring") {
$select_options .= " <option value='\${uk-ring}' selected='selected'>uk-ring</option>\n";
$select_options .= " <option value='\${uk-ring}' selected='selected'>".$text['dropdown-ukring']."</option>\n";
}
else {
$select_options .= " <option value='\${uk-ring}'>uk-ring</option>\n";
$select_options .= " <option value='\${uk-ring}'>".$text['dropdown-ukring']."</option>\n";
}
if ($ring_group_ringback == "\${rs-ring}" || $ring_group_ringback == "rs-ring") {
$select_options .= " <option value='\${rs-ring}' selected='selected'>rs-ring</option>\n";
$select_options .= " <option value='\${rs-ring}' selected='selected'>".$text['dropdown-rsring']."</option>\n";
}
else {
$select_options .= " <option value='\${rs-ring}'>rs-ring</option>\n";
$select_options .= " <option value='\${rs-ring}'>".$text['dropdown-rsring']."</option>\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 "<br />\n";
echo "Defines what the caller will hear while the destination is being called.\n";
echo $text['description-ringback']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='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='ring_group_enabled'>\n";
echo " <option value=''></option>\n";
if ($ring_group_enabled == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
echo " <option value='true' selected='selected'>".$text['dropdown-true']."</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
echo " <option value='true'>".$text['dropdown-true']."</option>\n";
}
if ($ring_group_enabled == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
echo " <option value='false' selected='selected'>".$text['dropdown-false']."</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
echo " <option value='false'>".$text['dropdown-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select enable or disable the ring group.\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
@@ -568,7 +575,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='ring_group_description' maxlength='255' value=\"$ring_group_description\">\n";
echo "<br />\n";
echo "Enter the description.\n";
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";