Dashboard - Ring Group Forward: Rework style to match other widgets.

This commit is contained in:
fusionate 2023-02-17 23:02:25 +00:00
parent a677c6abc3
commit 0334768c30
No known key found for this signature in database
4 changed files with 198 additions and 81 deletions

View File

@ -177,6 +177,38 @@
$apps[$x]['default_settings'][$y]['default_setting_value'] = "3";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "79aec8c7-c9ae-48d6-b343-4359f4f867c9";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "ring_group_forward_chart_color_forwarding";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#ea4c46";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "3b23cd36-b1c1-45fd-a533-8d9604dcb46a";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "ring_group_forward_chart_color_active";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#d4d4d4";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "abc10faf-7277-40cd-a7b3-0df4ea6c6c2b";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "ring_group_forward_chart_border_color";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "rgba(0,0,0,0)";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "506d4482-dee8-4047-9e1c-4375c9a521bb";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "ring_group_forward_chart_border_width";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "0";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "";
//schema details
$y=0;

View File

@ -841,6 +841,48 @@ $text['label-distinctive_ring']['ru-ru'] = "Отличительный вызо
$text['label-distinctive_ring']['sv-se'] = "Distinkt Ringning";
$text['label-distinctive_ring']['uk-ua'] = "";
$text['label-active']['en-us'] = "Active";
$text['label-active']['en-gb'] = "Active";
$text['label-active']['ar-eg'] = "";
$text['label-active']['de-at'] = "Aktiv"; //copied from de-de
$text['label-active']['de-ch'] = "Aktiv"; //copied from de-de
$text['label-active']['de-de'] = "Aktiv";
$text['label-active']['es-cl'] = "";
$text['label-active']['es-mx'] = "";
$text['label-active']['fr-ca'] = "Actif";
$text['label-active']['fr-fr'] = "Actif";
$text['label-active']['he-il'] = "";
$text['label-active']['it-it'] = "Attivo";
$text['label-active']['nl-nl'] = "";
$text['label-active']['pl-pl'] = "";
$text['label-active']['pt-br'] = "";
$text['label-active']['pt-pt'] = "";
$text['label-active']['ro-ro'] = "";
$text['label-active']['ru-ru'] = "Активные";
$text['label-active']['sv-se'] = "Aktiv";
$text['label-active']['uk-ua'] = "";
$text['label-destination']['en-us'] = "Destination";
$text['label-destination']['en-gb'] = "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['label-destinations']['en-us'] = "Destinations";
$text['label-destinations']['en-gb'] = "Destinations";
$text['label-destinations']['ar-eg'] = "";

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2013-2022
Portions created by the Initial Developer are Copyright (C) 2013-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -31,8 +31,6 @@
//includes files
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//add multi-lingual support
$language = new text;
@ -47,10 +45,6 @@
$domain_uuid = $_SESSION['user']['domain_uuid'];
}
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//connect to the database
if (!isset($database)) {
$database = new database;
@ -113,35 +107,6 @@
}
}
//prepare to page the results
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit')) {
//show all ring groups
$sql = "select count(*) from v_ring_groups ";
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
}
else {
//show only assigned ring groups
$sql = "select count(*) from v_ring_groups as r, v_ring_group_users as u ";
$sql .= "where r.ring_group_uuid = u.ring_group_uuid ";
$sql .= "and r.domain_uuid = :domain_uuid ";
$sql .= "and u.user_uuid = :user_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
}
$num_rows = $database->select($sql, $parameters, 'column');
unset($parameters);
//prepare to page the results
$rows_per_page = $is_included ? 10 : (is_numeric($_SESSION['domain']['paging']['numeric']) ? $_SESSION['domain']['paging']['numeric'] : 50);
$param = "";
if (isset($_GET['page'])) {
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
}
//get the list
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit')) {
//show all ring groups
@ -159,77 +124,148 @@
$parameters['domain_uuid'] = $_SESSION['user']['domain_uuid'];
$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
}
$sql .= order_by($order_by, $order, 'ring_group_extension', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$sql .= "order by ring_group_extension asc ";
$result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//determine keys and stats
unset($stats);
if (is_array($result) && @sizeof($result) != 0) {
foreach ($result as $row) {
$stats['forwarding'] += $row['ring_group_forward_enabled'] == 'true' && $row['ring_group_forward_destination'] ? 1 : 0;
}
$stats['active'] = @sizeof($result) - $stats['forwarding'];
}
//set defaults
if ($stats['forwarding'] == null) { $stats['forwarding'] = 0; }
if ($stats['active'] == null) { $stats['active'] = 0; }
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//create token
$object = new token;
$token = $object->create('/app/ring_groups/ring_group_forward.php');
//include header
require_once "resources/header.php";
//ring group forward
echo "<div class='hud_box'>\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 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";
//doughnut chart
echo "<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick=\"$('#hud_ring_group_forward_details').slideToggle('fast');\">\n";
echo " <div style='width: 275px; height: 175px;'><canvas id='ring_group_forward_chart'></canvas></div>\n";
echo "</div>\n";
if (!$is_included) {
echo $text['description-ring-group-forward']."\n";
echo "<br /><br />\n";
}
echo "<script>\n";
echo " const ring_group_forward_chart = new Chart(\n";
echo " document.getElementById('ring_group_forward_chart').getContext('2d'),\n";
echo " {\n";
echo " type: 'doughnut',\n";
echo " data: {\n";
echo " labels: [\n";
echo " '".$text['label-active'].": ".$stats['active']."',\n";
echo " '".$text['label-forwarding'].": ".$stats['forwarding']."',\n";
echo " ],\n";
echo " datasets: [{\n";
echo " data: [\n";
echo " '".$stats['active']."',\n";
echo " '".$stats['forwarding']."',\n";
echo " ],\n";
echo " backgroundColor: [\n";
echo " '".$_SESSION['dashboard']['ring_group_forward_chart_color_active']['text']."',\n";
echo " '".$_SESSION['dashboard']['ring_group_forward_chart_color_forwarding']['text']."',\n";
echo " ],\n";
echo " borderColor: '".$_SESSION['dashboard']['ring_group_forward_chart_border_color']['text']."',\n";
echo " borderWidth: '".$_SESSION['dashboard']['ring_group_forward_chart_border_width']['text']."',\n";
echo " cutout: chart_cutout,\n";
echo " }]\n";
echo " },\n";
echo " options: {\n";
echo " responsive: true,\n";
echo " maintainAspectRatio: false,\n";
echo " plugins: {\n";
echo " chart_counter: {\n";
echo " chart_text: '".$stats['forwarding']."'\n";
echo " },\n";
echo " legend: {\n";
echo " position: 'right',\n";
echo " reverse: true,\n";
echo " labels: {\n";
echo " usePointStyle: true,\n";
echo " pointStyle: 'rect'\n";
echo " }\n";
echo " },\n";
echo " title: {\n";
echo " display: true,\n";
echo " text: '".$text['header-ring-group-forward']."'\n";
echo " }\n";
echo " }\n";
echo " },\n";
echo " plugins: [chart_counter],\n";
echo " }\n";
echo " );\n";
echo "</script>\n";
//details
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_extension', $text['label-extension'], $order_by, $order);
echo "<th class='shrink'>".$text['label-forwarding']."</th>";
if (!$is_included) {
echo th_order_by('ring_group_description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
}
echo "<div class='hud_details hud_box' id='hud_ring_group_forward_details' style='text-align: right;'>";
echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'style'=>"position: absolute; margin-top: -35px; margin-left: -72px;",'onclick'=>"list_form_submit('form_list_ring_group_forward');"]);
echo "<table class='tr_hover' width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
echo "<tr style='position: -webkit-sticky; position: sticky; z-index: 5; top: 0;'>\n";
echo "<th class='hud_heading'>".$text['label-name']."</th>\n";
echo "<th class='hud_heading'>".$text['label-extension']."</th>\n";
echo "<th class='hud_heading'>".$text['label-forwarding']."</th>\n";
echo "<th class='hud_heading'>".$text['label-destination']."</th>\n";
echo "</tr>\n";
//data
if (is_array($result) && @sizeof($result) != 0) {
$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(); }\"";
echo "<tr class='list-row'>\n";
echo " <td ".$onclick.">".escape($row['ring_group_name'])."&nbsp;</td>\n";
echo " <td ".$onclick.">".escape($row['ring_group_extension'])."&nbsp;</td>\n";
echo " <td class='input'>";
$tr_link = PROJECT_PATH."/app/ring_groups/ring_group_edit.php?id=".$row['ring_group_uuid'];
echo "<tr href='".$tr_link."'>\n";
echo " <td valign='top' class='".$row_style[$c]." hud_text'>".escape($row['ring_group_name'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]." hud_text'><a href='".$tr_link."' title=\"".$text['button-edit']."\">".escape($row['ring_group_extension'])."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]." hud_text input tr_link_void' style='width: 1%; text-align: center;'>";
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 ? document.getElementById('destination').focus() : null;\">";
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 " </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 " </td>\n";
if (!$is_included) {
echo " <td class='description overflow hide-sm-dn' ".$onclick.">".escape($row['ring_group_description'])."&nbsp;</td>\n";
// switch
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='".escape($row['ring_group_uuid'])."' name='ring_groups[".$x."][ring_group_forward_enabled]' value='true' ".($row["ring_group_forward_enabled"] == 'true' ? "checked='checked'" : null)." onclick=\"this.checked && !document.getElementById('destination_".$x."').value ? document.getElementById('destination_".$x."').focus() : null;\">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
// select
else {
echo " <select class='formfld' id='".escape($row['ring_group_uuid'])."' name='ring_groups[".$x."][ring_group_forward_enabled]' onchange=\"this.selectedIndex && !document.getElementById('destination_".$x."').value ? document.getElementById('destination_".$x."').focus() : null;\">\n";
echo " <option value='false'>".$text['option-disabled']."</option>\n";
echo " <option value='true' ".($row["ring_group_forward_enabled"] == 'true' ? "selected='selected'" : null).">".$text['option-enabled']."</option>\n";
echo " </select>\n";
}
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
echo " <input class='formfld' style='width: 100%; min-width: 80px;' type='text' name='ring_groups[".$x."][ring_group_forward_destination]' id='destination_".$x."' placeholder=\"".$text['label-forward_destination']."\" maxlength='255' value=\"".escape($row["ring_group_forward_destination"])."\">";
echo " </td>\n";
echo "</tr>\n";
$x++;
$c = ($c) ? 0 : 1;
}
unset($result);
}
unset($result);
echo "</table>\n";
echo "<br />\n";
if (!$is_included) {
echo "<div align='center'>".$paging_controls."</div>\n";
}
echo "</div>";
$n++;
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
?>
echo "<span class='hud_expander' onclick=\"$('#hud_ring_group_forward_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
echo "</div>\n";
?>

View File

@ -2492,6 +2492,13 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
vertical-align: middle;
}
td.hud_text.input {
margin: 0;
padding-top: 0;
padding-bottom: 0;
white-space: nowrap;
}
span.hud_expander {
display: block;
clear: both;