Dashboard: App list view updates, token integration, bug fixes.
This commit is contained in:
parent
e95183a14e
commit
1f67a6f8f4
|
|
@ -177,12 +177,15 @@
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
if ($is_included) {
|
if ($is_included) {
|
||||||
echo "<b>".$text['header-call_routing']."</b>\n";
|
echo "<div class='action_bar sub'>\n";
|
||||||
|
echo " <div class='heading'><b>".$text['header-call_routing']."</b></div>\n";
|
||||||
|
echo " <div class='actions'>\n";
|
||||||
if ($num_rows > 10) {
|
if ($num_rows > 10) {
|
||||||
echo "<div align='right'>\n";
|
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'project-diagram','collapse'=>false,'link'=>PROJECT_PATH.'/app/calls/calls.php']);
|
||||||
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'link'=>PROJECT_PATH.'/app/calls/calls.php']);
|
|
||||||
echo "</div>\n";
|
|
||||||
}
|
}
|
||||||
|
echo " </div>\n";
|
||||||
|
echo " <div style='clear: both;'></div>\n";
|
||||||
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<div class='action_bar' id='action_bar'>\n";
|
echo "<div class='action_bar' id='action_bar'>\n";
|
||||||
|
|
|
||||||
|
|
@ -1541,6 +1541,26 @@ $text['label-column_name']['ru-ru'] = "";
|
||||||
$text['label-column_name']['sv-se'] = "";
|
$text['label-column_name']['sv-se'] = "";
|
||||||
$text['label-column_name']['uk-ua'] = "";
|
$text['label-column_name']['uk-ua'] = "";
|
||||||
|
|
||||||
|
$text['label-destination']['en-us'] = "Destination";
|
||||||
|
$text['label-destination']['ar-eg'] = "جهات الأتصال";
|
||||||
|
$text['label-destination']['de-at'] = "Ziele"; //copied from de-de
|
||||||
|
$text['label-destination']['de-ch'] = "Ziele"; //copied from de-de
|
||||||
|
$text['label-destination']['de-de'] = "Ziele";
|
||||||
|
$text['label-destination']['es-cl'] = "Destino";
|
||||||
|
$text['label-destination']['es-mx'] = "Destino"; //copied from es-cl
|
||||||
|
$text['label-destination']['fr-ca'] = "Destination"; //copied from fr-fr
|
||||||
|
$text['label-destination']['fr-fr'] = "Destination";
|
||||||
|
$text['label-destination']['he-il'] = "יעדים";
|
||||||
|
$text['label-destination']['it-it'] = "Destinazioni";
|
||||||
|
$text['label-destination']['nl-nl'] = "Bestemmingen";
|
||||||
|
$text['label-destination']['pl-pl'] = "Destynacje";
|
||||||
|
$text['label-destination']['pt-br'] = "Destino"; //copied from pt-pt
|
||||||
|
$text['label-destination']['pt-pt'] = "Destino";
|
||||||
|
$text['label-destination']['ro-ro'] = "Destinații";
|
||||||
|
$text['label-destination']['ru-ru'] = "Направления";
|
||||||
|
$text['label-destination']['sv-se'] = "Destinationer";
|
||||||
|
$text['label-destination']['uk-ua'] = "Номери";
|
||||||
|
|
||||||
$text['header-extensions']['en-us'] = "Extensions";
|
$text['header-extensions']['en-us'] = "Extensions";
|
||||||
$text['header-extensions']['ar-eg'] = "الأرقام الداخلية";
|
$text['header-extensions']['ar-eg'] = "الأرقام الداخلية";
|
||||||
$text['header-extensions']['de-at'] = "Nebenstellen"; //copied from de-de
|
$text['header-extensions']['de-at'] = "Nebenstellen"; //copied from de-de
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,20 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2017 All Rights Reserved.
|
Portions created by the Initial Developer are Copyright (C) 2017 - 2019
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//includes
|
//includes
|
||||||
require_once "root.php";
|
require_once "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
|
||||||
|
|
||||||
//check permissions
|
//check permissions
|
||||||
require_once "resources/check_auth.php";
|
|
||||||
if (permission_exists('extension_caller_id')) {
|
if (permission_exists('extension_caller_id')) {
|
||||||
//access granted
|
//access granted
|
||||||
}
|
}
|
||||||
|
|
@ -40,93 +44,93 @@
|
||||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/extensions');
|
$text = $language->get($_SESSION['domain']['language']['code'], 'app/extensions');
|
||||||
|
|
||||||
//add or update the database
|
//add or update the database
|
||||||
if (count($_POST) > 0) {
|
if (is_array($_POST['extensions']) && @sizeof($_POST['extensions']) != 0) {
|
||||||
|
|
||||||
//add or update the database
|
|
||||||
if ($_POST["persistformvar"] != "true") {
|
|
||||||
|
|
||||||
//build a new array to make sure it only contains what the user is allowed to change
|
|
||||||
$x=0;
|
|
||||||
foreach($_POST['extensions'] as $row) {
|
|
||||||
//loop through the extensions
|
|
||||||
$found = false;
|
|
||||||
foreach($_SESSION['user']['extension'] as $field) {
|
|
||||||
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
|
||||||
//set as found
|
|
||||||
$found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//build the array on what is allowed.
|
|
||||||
if ($found) {
|
|
||||||
if (permission_exists('outbound_caller_id_select')) {
|
|
||||||
$caller_id = explode('@', $row['outbound_caller_id']);
|
|
||||||
$outbound_caller_id_name = $caller_id[0];
|
|
||||||
$outbound_caller_id_number = $caller_id[1];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$outbound_caller_id_name = $row['outbound_caller_id_name'];
|
|
||||||
$outbound_caller_id_number = $row['outbound_caller_id_number'];
|
|
||||||
}
|
|
||||||
$array['extensions'][$x]['extension_uuid'] = $row['extension_uuid'];
|
|
||||||
$array['extensions'][$x]['outbound_caller_id_name'] = $outbound_caller_id_name;
|
|
||||||
if (is_numeric($outbound_caller_id_number)) {
|
|
||||||
$array['extensions'][$x]['outbound_caller_id_number'] = $outbound_caller_id_number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//increment the row id
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//add the dialplan permission
|
|
||||||
$p = new permissions;
|
|
||||||
$p->add("extension_edit", "temp");
|
|
||||||
|
|
||||||
//save to the data
|
|
||||||
$database = new database;
|
|
||||||
$database->app_name = 'extensions';
|
|
||||||
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
|
||||||
$database->save($array);
|
|
||||||
$message = $database->message;
|
|
||||||
|
|
||||||
//update the session array
|
|
||||||
foreach($array['extensions'] as $row) {
|
|
||||||
$x=0;
|
|
||||||
foreach($_SESSION['user']['extension'] as $field) {
|
|
||||||
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
|
||||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
|
|
||||||
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
|
|
||||||
}
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//remove the temporary permission
|
|
||||||
$p->delete("extension_edit", "temp");
|
|
||||||
|
|
||||||
//clear the cache
|
|
||||||
$cache = new cache;
|
|
||||||
foreach($_SESSION['user']['extension'] as $field) {
|
|
||||||
$cache->delete("directory:".$field['destination']."@".$field['user_context']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//set the message
|
|
||||||
message::add($text['message-update']);
|
|
||||||
|
|
||||||
//redirect the browser
|
|
||||||
header("Location: /core/user_settings/user_dashboard.php");
|
|
||||||
exit;
|
|
||||||
|
|
||||||
|
//validate the token
|
||||||
|
$token = new token;
|
||||||
|
if (!$token->validate('/app/extensions/extension_dashboard.php')) {
|
||||||
|
message::add($text['message-invalid_token'],'negative');
|
||||||
|
header('Location: /core/user_settings/user_dashboard.php');
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//build a new array to make sure it only contains what the user is allowed to change
|
||||||
|
$x=0;
|
||||||
|
foreach ($_POST['extensions'] as $row) {
|
||||||
|
//loop through the extensions
|
||||||
|
$found = false;
|
||||||
|
foreach ($_SESSION['user']['extension'] as $field) {
|
||||||
|
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
||||||
|
//set as found
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//build the array on what is allowed.
|
||||||
|
if ($found) {
|
||||||
|
if (permission_exists('outbound_caller_id_select')) {
|
||||||
|
$caller_id = explode('@', $row['outbound_caller_id']);
|
||||||
|
$outbound_caller_id_name = $caller_id[0];
|
||||||
|
$outbound_caller_id_number = $caller_id[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$outbound_caller_id_name = $row['outbound_caller_id_name'];
|
||||||
|
$outbound_caller_id_number = $row['outbound_caller_id_number'];
|
||||||
|
}
|
||||||
|
$array['extensions'][$x]['extension_uuid'] = $row['extension_uuid'];
|
||||||
|
$array['extensions'][$x]['outbound_caller_id_name'] = $outbound_caller_id_name;
|
||||||
|
if (is_numeric($outbound_caller_id_number)) {
|
||||||
|
$array['extensions'][$x]['outbound_caller_id_number'] = $outbound_caller_id_number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//increment the row id
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//add the dialplan permission
|
||||||
|
$p = new permissions;
|
||||||
|
$p->add("extension_edit", "temp");
|
||||||
|
|
||||||
|
//save to the data
|
||||||
|
$database = new database;
|
||||||
|
$database->app_name = 'extensions';
|
||||||
|
$database->app_uuid = 'e68d9689-2769-e013-28fa-6214bf47fca3';
|
||||||
|
$database->save($array);
|
||||||
|
$message = $database->message;
|
||||||
|
|
||||||
|
//update the session array
|
||||||
|
foreach ($array['extensions'] as $row) {
|
||||||
|
$x=0;
|
||||||
|
foreach ($_SESSION['user']['extension'] as $field) {
|
||||||
|
if ($field['extension_uuid'] == $row['extension_uuid']) {
|
||||||
|
$_SESSION['user']['extension'][$x]['outbound_caller_id_name'] = $row['outbound_caller_id_name'];
|
||||||
|
$_SESSION['user']['extension'][$x]['outbound_caller_id_number'] = $row['outbound_caller_id_number'];
|
||||||
|
}
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove the temporary permission
|
||||||
|
$p->delete("extension_edit", "temp");
|
||||||
|
|
||||||
|
//clear the cache
|
||||||
|
$cache = new cache;
|
||||||
|
foreach($_SESSION['user']['extension'] as $field) {
|
||||||
|
$cache->delete("directory:".$field['destination']."@".$field['user_context']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//set the message
|
||||||
|
message::add($text['message-update']);
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
|
header("Location: /core/user_settings/user_dashboard.php");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the sub array index
|
//set the sub array index
|
||||||
$x = "999";
|
$x = "999";
|
||||||
|
|
||||||
//show the header
|
|
||||||
//require_once "resources/header.php";
|
|
||||||
|
|
||||||
//get the extensions
|
//get the extensions
|
||||||
$extensions = $_SESSION['user']['extension'];
|
$extensions = $_SESSION['user']['extension'];
|
||||||
|
|
||||||
|
|
@ -140,44 +144,36 @@
|
||||||
$destinations = $database->select($sql, $parameters, 'all');
|
$destinations = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
|
//create token
|
||||||
|
$object = new token;
|
||||||
|
$token = $object->create('/app/extensions/extension_dashboard.php');
|
||||||
|
|
||||||
//show the content
|
//show the content
|
||||||
echo "<form name='caller_id_form' id='caller_id_form' method='post' action='/app/extensions/extension_dashboard.php'>\n";
|
echo "<div class='action_bar sub'>\n";
|
||||||
|
echo " <div class='heading'><b>".$text['label-caller_id_number']."</b></div>\n";
|
||||||
echo "<div style='float: left;'>";
|
echo " <div class='actions'>\n";
|
||||||
echo " <b>".$text['label-caller_id_number']."</b><br />";
|
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'onclick'=>"list_form_submit('form_list_extension_caller_id');"]);
|
||||||
echo " <br />";
|
echo " </div>\n";
|
||||||
|
echo " <div style='clear: both;'></div>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
echo "<div style='float: right;'></div>\n";
|
echo "<form id='form_list_extension_caller_id' method='post' action='".PROJECT_PATH."/app/extensions/extension_dashboard.php'>\n";
|
||||||
|
|
||||||
echo "<div style='float: right;'>\n";
|
echo "<table class='list'>\n";
|
||||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
echo "<tr class='list-header'>\n";
|
||||||
echo "</div>\n";
|
echo " <th>".$text['label-extension']."</th>\n";
|
||||||
|
echo " <th>".$text['label-caller_id']."</th>\n";
|
||||||
|
if (!permission_exists('outbound_caller_id_select')) {
|
||||||
|
echo " <th>".$text['label-destination']."</th>\n";
|
||||||
|
}
|
||||||
|
echo " <th class='hide-sm-dn pct-30'>".$text['label-description']."</th>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
||||||
$x = 0;
|
|
||||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||||
foreach($extensions as $row) {
|
$x = 0;
|
||||||
//set the variables
|
foreach ($extensions as $row) {
|
||||||
$extension_uuid = $row['extension_uuid'];
|
|
||||||
$user = $row['user'];
|
|
||||||
$number_alias = $row['number_alias'];
|
|
||||||
$destination = $row['destination'];
|
|
||||||
$outbound_caller_id_name = $row['outbound_caller_id_name'];
|
|
||||||
$outbound_caller_id_number = $row['outbound_caller_id_number'];
|
|
||||||
$description = $row['description'];
|
|
||||||
|
|
||||||
//set the column names
|
|
||||||
if ($x === 0 && $previous_extension_uuid != $row['extension_uuid']) {
|
|
||||||
echo " <tr>\n";
|
|
||||||
echo " <th>".$text['label-extension']."</th>\n";
|
|
||||||
echo " <th>".$text['label-caller_id']."</th>\n";
|
|
||||||
echo " <th>".$text['label-description']."</th>\n";
|
|
||||||
echo " </tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
//determine whether to hide the element
|
//determine whether to hide the element
|
||||||
if (strlen($device_key_uuid) == 0) {
|
if (is_uuid($device_key_uuid)) {
|
||||||
$element['hidden'] = false;
|
$element['hidden'] = false;
|
||||||
$element['visibility'] = "visibility:visible;";
|
$element['visibility'] = "visibility:visible;";
|
||||||
}
|
}
|
||||||
|
|
@ -186,69 +182,54 @@
|
||||||
$element['visibility'] = "visibility:hidden;";
|
$element['visibility'] = "visibility:hidden;";
|
||||||
}
|
}
|
||||||
|
|
||||||
//start the row
|
echo "<tr class='list-row'>\n";
|
||||||
echo " <tr>\n";
|
echo " <td>\n";
|
||||||
|
echo " ".$row['destination'];
|
||||||
//add the primary key uuid
|
if (is_uuid($row['extension_uuid'])) {
|
||||||
if (strlen($row['extension_uuid']) > 0) {
|
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".escape($row['extension_uuid'])."\">\n";
|
||||||
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".escape($row['extension_uuid'])."\">\n";
|
}
|
||||||
}
|
echo " </td>\n";
|
||||||
|
if (permission_exists('outbound_caller_id_select')) {
|
||||||
//show the destination
|
//caller id select
|
||||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
echo " <td class='input'>\n";
|
||||||
echo " ".$row['destination'];
|
if (count($destinations) > 0) {
|
||||||
echo " </td>\n";
|
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
//caller id form input
|
foreach ($destinations as &$field) {
|
||||||
if (permission_exists('outbound_caller_id_select')) {
|
if(strlen($field['destination_caller_id_number']) > 0) {
|
||||||
//caller id select
|
if ($row['outbound_caller_id_number'] == $field['destination_caller_id_number']) {
|
||||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' selected='selected'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||||
if (count($destinations) > 0) {
|
}
|
||||||
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
|
else {
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||||
foreach ($destinations as &$field) {
|
|
||||||
if(strlen($field['destination_caller_id_number']) > 0) {
|
|
||||||
if ($outbound_caller_id_number == $field['destination_caller_id_number']) {
|
|
||||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' selected='selected'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo " <option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."'>".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo " </select>\n";
|
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </select>\n";
|
||||||
}
|
}
|
||||||
else {
|
echo " </td>\n";
|
||||||
//caller id name an number input text
|
}
|
||||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
else {
|
||||||
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_name]' maxlength='255' value=\"".escape($row['outbound_caller_id_name'])."\">\n";
|
//caller id name and number inputs
|
||||||
echo " </td>\n";
|
echo " <td class='input'>\n";
|
||||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_name]' maxlength='255' value=\"".escape($row['outbound_caller_id_name'])."\">\n";
|
||||||
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\n";
|
echo " </td>\n";
|
||||||
echo " </td>\n";
|
echo " <td class='input'>\n";
|
||||||
}
|
echo " <input class='formfld' style='min-width: 50px; max-width: 100px;' type='text' name='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\n";
|
||||||
|
echo " </td>\n";
|
||||||
//show the description
|
}
|
||||||
echo " <td class='row_style".$c." row_style_slim'>\n";
|
echo " <td class='description overflow hide-sm-dn'>\n";
|
||||||
echo " ".$row['description'];
|
echo " ".$row['description'];
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
//end the row
|
$x++;
|
||||||
echo " </tr>\n";
|
|
||||||
//set the previous extension_uuid
|
|
||||||
$previous_extension_uuid = $extension_uuid;
|
|
||||||
//increment the array key
|
|
||||||
$x++;
|
|
||||||
//alternate the value
|
|
||||||
$c = $c ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($extensions, $row);
|
unset($extensions);
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
|
||||||
|
?>
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -27,9 +27,10 @@
|
||||||
//includes
|
//includes
|
||||||
require_once "root.php";
|
require_once "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
require_once "resources/paging.php";
|
||||||
|
|
||||||
//check permissions
|
//check permissions
|
||||||
require_once "resources/check_auth.php";
|
|
||||||
if (permission_exists('ring_group_edit') || permission_exists('ring_group_forward')) {
|
if (permission_exists('ring_group_edit') || permission_exists('ring_group_forward')) {
|
||||||
//access granted
|
//access granted
|
||||||
}
|
}
|
||||||
|
|
@ -42,10 +43,6 @@
|
||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get($_SESSION['domain']['language']['code'], 'app/ring_groups');
|
$text = $language->get($_SESSION['domain']['language']['code'], 'app/ring_groups');
|
||||||
|
|
||||||
//additional includes
|
|
||||||
require_once "resources/header.php";
|
|
||||||
require_once "resources/paging.php";
|
|
||||||
|
|
||||||
//get variables used to control the order
|
//get variables used to control the order
|
||||||
$order_by = $_GET["order_by"];
|
$order_by = $_GET["order_by"];
|
||||||
$order = $_GET["order"];
|
$order = $_GET["order"];
|
||||||
|
|
@ -63,45 +60,52 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//update ring group forwarding
|
//update ring group forwarding
|
||||||
if (sizeof($_POST) > 0) {
|
if (is_array($_POST['ring_groups']) && @sizeof($_POST['ring_groups']) != 0 && permission_exists('ring_group_forward')) {
|
||||||
if (is_array($_POST['ring_groups']) && @sizeof($_POST['ring_groups']) != 0 && permission_exists('ring_group_forward')) {
|
|
||||||
$x = 0;
|
//validate the token
|
||||||
foreach ($_POST['ring_groups'] as $row) {
|
$token = new token;
|
||||||
//remove non-numeric characters
|
if (!$token->validate('/app/ring_groups/ring_group_forward.php')) {
|
||||||
$ring_group_uuid = $row['ring_group_uuid'];
|
message::add($text['message-invalid_token'],'negative');
|
||||||
$ring_group_forward_destination = preg_replace("~[^0-9]~", "", $row['ring_group_forward_destination']);
|
header('Location: '.$validated_path);
|
||||||
$ring_group_forward_enabled = ($row['ring_group_forward_enabled'] == 'true') ? $ring_group_forward_enabled = 'true' : $ring_group_forward_enabled = 'false';
|
exit;
|
||||||
//build array
|
|
||||||
if (is_uuid($ring_group_uuid)) {
|
|
||||||
$array['ring_groups'][$x]['ring_group_uuid'] = $ring_group_uuid;
|
|
||||||
$array['ring_groups'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
||||||
$array['ring_groups'][$x]['ring_group_forward_enabled'] =$ring_group_forward_enabled;
|
|
||||||
$array['ring_groups'][$x]['ring_group_forward_destination'] = $ring_group_forward_destination;
|
|
||||||
}
|
|
||||||
//increment counter
|
|
||||||
$x++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($array) && sizeof($array) != 0) {
|
$x = 0;
|
||||||
//update ring group
|
foreach ($_POST['ring_groups'] as $row) {
|
||||||
$p = new permissions;
|
//remove non-numeric characters
|
||||||
$p->add('ring_group_edit', 'temp');
|
$ring_group_uuid = $row['ring_group_uuid'];
|
||||||
|
$ring_group_forward_destination = preg_replace("~[^0-9]~", "", $row['ring_group_forward_destination']);
|
||||||
|
$ring_group_forward_enabled = $row['ring_group_forward_enabled'] == 'true' && is_numeric($ring_group_forward_destination) ? 'true' : 'false';
|
||||||
|
//build array
|
||||||
|
if (is_uuid($ring_group_uuid)) {
|
||||||
|
$array['ring_groups'][$x]['ring_group_uuid'] = $ring_group_uuid;
|
||||||
|
$array['ring_groups'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
|
$array['ring_groups'][$x]['ring_group_forward_enabled'] = $ring_group_forward_enabled;
|
||||||
|
$array['ring_groups'][$x]['ring_group_forward_destination'] = $ring_group_forward_destination;
|
||||||
|
}
|
||||||
|
//increment counter
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
$database = new database;
|
if (is_array($array) && sizeof($array) != 0) {
|
||||||
$database->app_name = 'ring_groups';
|
//update ring group
|
||||||
$database->app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2';
|
$p = new permissions;
|
||||||
$database->save($array);
|
$p->add('ring_group_edit', 'temp');
|
||||||
unset($array);
|
|
||||||
|
|
||||||
$p->delete('ring_group_edit', 'temp');
|
$database = new database;
|
||||||
|
$database->app_name = 'ring_groups';
|
||||||
|
$database->app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2';
|
||||||
|
$database->save($array);
|
||||||
|
unset($array);
|
||||||
|
|
||||||
//set message
|
$p->delete('ring_group_edit', 'temp');
|
||||||
message::add($text['message-update']);
|
|
||||||
|
|
||||||
//redirect the user
|
//set message
|
||||||
header("Location: ".$validated_path);
|
message::add($text['message-update']);
|
||||||
exit;
|
|
||||||
}
|
//redirect the user
|
||||||
|
header("Location: ".$validated_path);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,68 +159,78 @@
|
||||||
$result = $database->select($sql, $parameters, 'all');
|
$result = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
echo "<form method='post' name='frm' action='".$validated_path."'>\n";
|
//create token
|
||||||
echo " <div style='float: left;'>";
|
$object = new token;
|
||||||
echo " <b>".$text['header-ring-group-forward']."</b><br />";
|
$token = $object->create('/app/ring_groups/ring_group_forward.php');
|
||||||
if (!$is_included) {
|
|
||||||
echo " ".$text['description-ring-group-forward']."<br />";
|
|
||||||
}
|
|
||||||
echo " <br />";
|
|
||||||
echo " </div>\n";
|
|
||||||
|
|
||||||
echo "<div style='float: right;'>\n";
|
//include header
|
||||||
if ($num_rows > 10) {
|
require_once "resources/header.php";
|
||||||
echo " <input id='btn_viewall_ringgroups' type='button' class='btn' value='".$text['button-view_all']."' onclick=\"document.location.href='".PROJECT_PATH."/app/ring_groups/ring_group_forward.php';\">\n";
|
|
||||||
|
//show content
|
||||||
|
echo "<div class='action_bar sub'>\n";
|
||||||
|
echo " <div class='heading'><b>".$text['header-ring-group-forward']."</b></div>\n";
|
||||||
|
echo " <div class='actions'>\n";
|
||||||
|
if ($is_included && $num_rows > 10) {
|
||||||
|
echo button::create(['type'=>'button','label'=>$text['button-view_all'],'icon'=>'share-square','collapse'=>'hide-xs','link'=>PROJECT_PATH.'/app/ring_groups/ring_group_forward.php']);
|
||||||
}
|
}
|
||||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
|
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'onclick'=>"list_form_submit('form_list_ring_group_forward');"]);
|
||||||
|
echo " </div>\n";
|
||||||
|
echo " <div style='clear: both;'></div>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|
||||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
if (!$is_included) {
|
||||||
echo "<tr>\n";
|
echo $text['description-ring-group-forward']."\n";
|
||||||
|
echo "<br /><br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<form id='form_list_ring_group_forward' method='post' action='".$validated_path."'>\n";
|
||||||
|
|
||||||
|
echo "<table class='list'>\n";
|
||||||
|
echo "<tr class='list-header'>\n";
|
||||||
echo th_order_by('ring_group_name', $text['label-name'], $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_extension', $text['label-extension'], $order_by, $order);
|
||||||
echo "<th>".$text['label-forwarding']."</th>";
|
echo "<th class='shrink'>".$text['label-forwarding']."</th>";
|
||||||
if (!$is_included) {
|
if (!$is_included) {
|
||||||
echo th_order_by('ring_group_description', $text['label-description'], $order_by, $order);
|
echo th_order_by('ring_group_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
$c = 0; $x = 0;
|
$x = 0;
|
||||||
if (is_array($result) && @sizeof($result) != 0) {
|
if (is_array($result) && @sizeof($result) != 0) {
|
||||||
foreach($result as $row) {
|
$x = 0;
|
||||||
|
foreach ($result as $row) {
|
||||||
$onclick = "onclick=\"document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex = (document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex) ? 0 : 1; if (document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex) { document.getElementById('destination').focus(); }\"";
|
$onclick = "onclick=\"document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex = (document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex) ? 0 : 1; if (document.getElementById('".escape($row['ring_group_uuid'])."').selectedIndex) { document.getElementById('destination').focus(); }\"";
|
||||||
echo "<tr>\n";
|
echo "<tr class='list-row'>\n";
|
||||||
echo " <td valign='top' class='row_style".$c."' ".$onclick.">".escape($row['ring_group_name'])." </td>\n";
|
echo " <td ".$onclick.">".escape($row['ring_group_name'])." </td>\n";
|
||||||
echo " <td valign='top' class='row_style".$c."' ".$onclick.">".escape($row['ring_group_extension'])." </td>\n";
|
echo " <td ".$onclick.">".escape($row['ring_group_extension'])." </td>\n";
|
||||||
echo " <td valign='top' class='row_style".$c." row_style_slim' width='5'>";
|
echo " <td class='input'>";
|
||||||
echo " <input type='hidden' name='ring_groups[".$x."][ring_group_uuid]' id='destination' value=\"".escape($row["ring_group_uuid"])."\">";
|
echo " <input type='hidden' name='ring_groups[".$x."][ring_group_uuid]' value=\"".escape($row["ring_group_uuid"])."\">";
|
||||||
echo " <select class='formfld' name='ring_groups[".$x."][ring_group_forward_enabled]\" id='".escape($row['ring_group_uuid'])."' onchange=\"(this.selectedIndex == 1) ? document.getElementById('destination').focus() : null;\">";
|
echo " <select class='formfld' name='ring_groups[".$x."][ring_group_forward_enabled]' id='".escape($row['ring_group_uuid'])."' onchange=\"this.selectedIndex ? document.getElementById('destination').focus() : null;\">";
|
||||||
echo " <option value='false'>".$text['option-disabled']."</option>";
|
echo " <option value='false'>".$text['option-disabled']."</option>";
|
||||||
echo " <option value='true' ".(($row["ring_group_forward_enabled"] == 'true') ? "selected='selected'" : null).">".$text['option-enabled']."</option>";
|
echo " <option value='true' ".($row["ring_group_forward_enabled"] == 'true' ? "selected='selected'" : null).">".$text['option-enabled']."</option>";
|
||||||
echo " </select>";
|
echo " </select>";
|
||||||
echo " <input class='formfld' style='width: 100px;' type='text' name='ring_groups[".$x."][ring_group_forward_destination]' id='destination' placeholder=\"".$text['label-forward_destination']."\" maxlength='255' value=\"".escape($row["ring_group_forward_destination"])."\">";
|
echo " <input class='formfld' style='width: 100px;' type='text' name='ring_groups[".$x."][ring_group_forward_destination]' id='destination' placeholder=\"".$text['label-forward_destination']."\" maxlength='255' value=\"".escape($row["ring_group_forward_destination"])."\">";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
if (!$is_included) {
|
if (!$is_included) {
|
||||||
echo " <td valign='top' class='row_stylebg tr_link_void' ".$onclick.">".escape($row['ring_group_description'])." </td>\n";
|
echo " <td class='description overflow hide-sm-dn' ".$onclick.">".escape($row['ring_group_description'])." </td>\n";
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
$c = ($c) ? 0 : 1;
|
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($result, $row);
|
unset($result);
|
||||||
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "<br />\n";
|
||||||
if (!$is_included) {
|
if (!$is_included) {
|
||||||
echo "<center>".$paging_controls."</center>\n";
|
echo "<div align='center'>".$paging_controls."</div>\n";
|
||||||
echo "<br><br>";
|
|
||||||
}
|
}
|
||||||
|
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
if (!$is_included) {
|
if (!$is_included) {
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -1232,12 +1232,12 @@
|
||||||
if (!is_array($selected_blocks) || in_array('caller_id', $selected_blocks)) {
|
if (!is_array($selected_blocks) || in_array('caller_id', $selected_blocks)) {
|
||||||
//caller id management
|
//caller id management
|
||||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/extension_dashboard.php")) {
|
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/extension_dashboard.php")) {
|
||||||
if (permission_exists('extension_caller_id')) {
|
if (permission_exists('extension_caller_id')) {
|
||||||
$is_included = true;
|
$is_included = true;
|
||||||
echo "<div class='col-xs-12 col-sm-12 col-md-6 col-lg-6' style='margin: 0 0 30px 0;'>\n";
|
echo "<div class='col-xs-12 col-sm-12 col-md-6 col-lg-6' style='margin: 0 0 30px 0;'>\n";
|
||||||
require_once "app/extensions/extension_dashboard.php";
|
require_once "app/extensions/extension_dashboard.php";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1981,5 +1981,13 @@
|
||||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-file-export";
|
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-file-export";
|
||||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
||||||
|
$y++;
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "adc48491-d2df-499b-b53e-4fcaa5ef2183";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_save";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-bolt";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||||
|
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -2427,6 +2427,13 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-row > .input {
|
||||||
|
margin: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.list-row > .overflow {
|
.list-row > .overflow {
|
||||||
max-width: 50px;
|
max-width: 50px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue