Dashboard: Call Forward widget, Edit position without reload, misc adjustments.

This commit is contained in:
fusionate 2023-01-31 00:19:09 +00:00
parent ba344fd56b
commit d04b6db96a
No known key found for this signature in database
17 changed files with 473 additions and 116 deletions

View File

@ -80,5 +80,53 @@
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_order'] = "0";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the default Follow Me Timeout value.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "ed901e23-1abb-454c-b0d3-e986efed9f56";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_forward_chart_color_call_forward";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#2a9df4";
$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'] = "b65593fa-fe16-4380-936c-16d0d2e9bf48";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_forward_chart_color_follow_me";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#00b337";
$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'] = "c21c0ab6-5d23-4079-ba4d-439547f81978";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_forward_chart_color_do_not_disturb";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "#b30000";
$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'] = "d5dc5bcb-65ff-46a6-9d1a-c83b19c3782e";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_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'] = "add25bdb-c0a5-44e7-adf0-87dea41955e7";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_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'] = "3b2384d4-be62-44a1-96dc-27bb470f9473";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "call_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'] = "";
?>

View File

@ -610,6 +610,28 @@ $text['label-call_forward']['ru-ru'] = "Переадресация";
$text['label-call_forward']['sv-se'] = "Vidarekoppling";
$text['label-call_forward']['uk-ua'] = "Переадресація";
$text['label-active']['en-us'] = "Active";
$text['label-active']['en-gb'] = "Active";
$text['label-active']['ar-eg'] = "Active";
$text['label-active']['de-at'] = "Active";
$text['label-active']['de-ch'] = "Active";
$text['label-active']['de-de'] = "Active";
$text['label-active']['el-gr'] = "Active";
$text['label-active']['es-cl'] = "Active";
$text['label-active']['es-mx'] = "Active";
$text['label-active']['fr-ca'] = "Active";
$text['label-active']['fr-fr'] = "Active";
$text['label-active']['he-il'] = "Active";
$text['label-active']['it-it'] = "Active";
$text['label-active']['nl-nl'] = "Active";
$text['label-active']['pl-pl'] = "Active";
$text['label-active']['pt-br'] = "Active";
$text['label-active']['pt-pt'] = "Active";
$text['label-active']['ro-ro'] = "Active";
$text['label-active']['ru-ru'] = "Active";
$text['label-active']['sv-se'] = "Active";
$text['label-active']['uk-ua'] = "Active";
$text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-on-busy']['en-gb'] = "If enabled, it overrides the value of voicemail enabling in extension.";
$text['description-on-busy']['ar-eg'] = "";

View File

@ -1,38 +1,10 @@
<?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) 2021
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
//includes
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
//access granted
}
@ -41,14 +13,203 @@
exit;
}
//connect to the database
if (!isset($database)) {
$database = new database;
}
//add multi-lingual support
$language = new text;
$text = $language->get($_SESSION['domain']['language']['code'], 'app/call_forward');
//set a variable for the included code to know its included
$is_included = true;
//set the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//include the call forward
require_once "app/call_forward/call_forward.php";
//get data
$sql = "
select
extension_uuid,
extension,
forward_all_enabled,
forward_all_destination,
follow_me_enabled,
follow_me_uuid,
do_not_disturb
from
v_extensions ";
if ($_GET['show'] == "all" && permission_exists('call_forward_all')) {
$sql .= "where true ";
}
else {
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
$sql .= "and enabled = 'true' ";
if (!permission_exists('extension_edit')) {
if (is_array($_SESSION['user']['extension']) && count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//used to hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$sql .= order_by($order_by, $order, 'extension', 'asc');
$database = new database;
$extensions = $database->select($sql, $parameters, 'all');
unset($parameters);
?>
//determine keys and stats
unset($stats);
$show_stat = false;
if (is_array($extensions) && @sizeof($extensions) != 0) {
foreach ($extensions as $row) {
if (permission_exists('call_forward')) {
$stats['call_forward'] += $row['forward_all_enabled'] == 'true' && $row['forward_all_destination'] ? 1 : 0;
}
if (permission_exists('follow_me')) {
$stats['follow_me'] += $row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid']) ? 1 : 0;
}
if (permission_exists('do_not_disturb')) {
$stats['dnd'] += $row['do_not_disturb'] == 'true' ? 1 : 0;
}
}
$stats['active'] = @sizeof($extensions) - $stats['call_forward'] - $stats['follow_me'] - $stats['dnd'];
}
if (is_array($stats) && @sizeof($stats) != 0) {
$show_stat = true;
}
//begin widget
echo "<div class='hud_box'>\n";
//doughnut chart
if ($show_stat) {
echo "<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick=\"$('#hud_call_forward_details').slideToggle('fast');\">\n";
echo " <div style='width: 250px; height: 175px;'><canvas id='call_forward_chart'></canvas></div>\n";
echo "</div>\n";
echo "<script>\n";
echo " const call_forward_chart = new Chart(\n";
echo " document.getElementById('call_forward_chart').getContext('2d'),\n";
echo " {\n";
echo " type: 'doughnut',\n";
echo " data: {\n";
echo " labels: [\n";
echo " '".$text['label-dnd'].": ".$stats['dnd']."',\n";
echo " '".$text['label-follow_me'].": ".$stats['follow_me']."',\n";
echo " '".$text['label-call_forward'].": ".$stats['call_forward']."',\n";
echo " '".$text['label-active'].": ".$stats['active']."',\n";
echo " ],\n";
echo " datasets: [{\n";
echo " data: [\n";
echo " '".$stats['dnd']."',\n";
echo " '".$stats['follow_me']."',\n";
echo " '".$stats['call_forward']."',\n";
echo " '".$stats['active']."',\n";
echo " ],\n";
echo " backgroundColor: [\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_do_not_disturb']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_follow_me']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_call_forward']['text']."',\n";
echo " '".$_SESSION['dashboard']['call_forward_chart_color_active']['text']."',\n";
echo " '#000',\n";
echo " ],\n";
echo " borderColor: '".$_SESSION['dashboard']['call_forward_chart_border_color']['text']."',\n";
echo " borderWidth: '".$_SESSION['dashboard']['call_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['call_forward']."'\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-call_forward']."'\n";
echo " }\n";
echo " }\n";
echo " },\n";
echo " plugins: [chart_counter],\n";
echo " }\n";
echo " );\n";
echo "</script>\n";
}
//details
echo "<div class='hud_details hud_box' id='hud_call_forward_details'>";
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-extension']."</th>\n";
if (permission_exists('call_forward')) {
echo " <th class='hud_heading' style='text-align: center;'>".$text['label-call_forward']."</th>\n";
}
if (permission_exists('follow_me')) {
echo " <th class='hud_heading' style='text-align: center;'>".$text['label-follow_me']."</th>\n";
}
if (permission_exists('do_not_disturb')) {
echo " <th class='hud_heading' style='text-align: center;'>".$text['label-dnd']."</th>\n";
}
echo "</tr>\n";
// data
if (is_array($extensions) && @sizeof($extensions) != 0) {
foreach($extensions as $row) {
$tr_link = PROJECT_PATH."/app/call_forward/call_forward_edit.php?id=".$row['extension_uuid'];
echo "<tr href='".$tr_link."'>\n";
echo " <td valign='top' class='".$row_style[$c]." hud_text'><a href='".$tr_link."' title=\"".$text['button-edit']."\">".escape($row['extension'])."</a></td>\n";
if (permission_exists('call_forward')) {
echo " <td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".($row['forward_all_enabled'] == 'true' ? escape(format_phone($row['forward_all_destination'])) : '&nbsp;')."</td>\n";
}
if (permission_exists('follow_me')) {
//get destination count
$follow_me_destination_count = 0;
if ($row['follow_me_enabled'] == 'true' && is_uuid($row['follow_me_uuid'])) {
$sql = "select count(*) from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = :follow_me_uuid ";
$sql .= "and domain_uuid = :domain_uuid ";
$parameters['follow_me_uuid'] = $row['follow_me_uuid'];
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$follow_me_destination_count = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
}
echo " <td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".($follow_me_destination_count ? $text['label-enabled'].' ('.$follow_me_destination_count.')' : '&nbsp;')."</td>\n";
}
if (permission_exists('do_not_disturb')) {
echo " <td valign='top' class='".$row_style[$c]." hud_text' style='text-align: center;'>".($row['do_not_disturb'] == 'true' ? $text['label-enabled'] : '&nbsp;')."</td>\n";
}
echo "</tr>\n";
$c = ($c) ? 0 : 1;
}
unset($extensions);
}
echo "</table>\n";
echo "</div>";
$n++;
echo "<span class='hud_expander' onclick=\"$('#hud_call_forward_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>\n";
echo "</div>\n";
?>

View File

@ -1,5 +1,6 @@
<?php
$x++;
$array['dashboard'][$x]['dashboard_uuid'] = 'ba60799a-1c40-44a8-80ef-c2be4f4692fb';
$array['dashboard'][$x]['dashboard_name'] = 'Call Forward';
$array['dashboard'][$x]['dashboard_path'] = 'app/call_forward/resources/dashboard/call_forward.php';

View File

@ -79,7 +79,7 @@
//add doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_switch_status_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_switch_status_details').slideToggle('fast');">
<canvas id='switch_status_chart' width='175px' height='175px'></canvas>
</div>

View File

@ -285,7 +285,7 @@
if ($show_stat) {
//add doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_system_counts_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_system_counts_details').slideToggle('fast');">
<div style='width: 250px; height: 175px;'><canvas id='system_counts_chart'></canvas></div>
</div>

View File

@ -56,7 +56,7 @@
//add half doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_system_cpu_status_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_system_cpu_status_details').slideToggle('fast');">
<div><canvas id='system_cpu_status_chart' width='175px' height='175px' ></canvas></div>
</div>

View File

@ -41,7 +41,7 @@
if ($percent_disk_usage != '') {
//add half doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_system_status_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_system_status_details').slideToggle('fast');">
<div><canvas id='system_status_chart' width='175px' height='175px'></canvas></div>
</div>

View File

@ -59,7 +59,7 @@
//add doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_voicemail_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_voicemail_details').slideToggle('fast');">
<canvas id='new_messages_chart' width='175px' height='175px'></canvas>
</div>

View File

@ -82,7 +82,7 @@
//add doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_missed_calls_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_missed_calls_details').slideToggle('fast');">
<canvas id='missed_calls_chart' width='175px' height='175px'></canvas>
</div>

View File

@ -84,7 +84,7 @@
//add doughnut chart
?>
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px; cursor: pointer;' onclick="$('#hud_recent_calls_details').slideToggle('fast');">
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_recent_calls_details').slideToggle('fast');">
<canvas id='recent_calls_chart' width='175px' height='175px'></canvas>
</div>

View File

@ -426,4 +426,50 @@
$text['label-welcome']['ru-ru'] = "Добро пожаловать:";
$text['label-welcome']['sv-se'] = "Välkommen:";
$text['label-welcome']['uk-ua'] = "Ласкаво просимо:";
?>
$text['button-contract_all']['en-us'] = "Contract All";
$text['button-contract_all']['en-gb'] = "Contract All";
$text['button-contract_all']['ar-eg'] = "Contract All";
$text['button-contract_all']['de-at'] = "Contract All";
$text['button-contract_all']['de-ch'] = "Contract All";
$text['button-contract_all']['de-de'] = "Contract All";
$text['button-contract_all']['el-gr'] = "Contract All";
$text['button-contract_all']['es-cl'] = "Contract All";
$text['button-contract_all']['es-mx'] = "Contract All";
$text['button-contract_all']['fr-ca'] = "Contract All";
$text['button-contract_all']['fr-fr'] = "Contract All";
$text['button-contract_all']['he-il'] = "Contract All";
$text['button-contract_all']['it-it'] = "Contract All";
$text['button-contract_all']['nl-nl'] = "Contract All";
$text['button-contract_all']['pl-pl'] = "Contract All";
$text['button-contract_all']['pt-br'] = "Contract All";
$text['button-contract_all']['pt-pt'] = "Contract All";
$text['button-contract_all']['ro-ro'] = "Contract All";
$text['button-contract_all']['ru-ru'] = "Contract All";
$text['button-contract_all']['sv-se'] = "Contract All";
$text['button-contract_all']['uk-ua'] = "Contract All";
$text['button-contract_all']['tr-tr'] = "Contract All";
$text['button-expand_all']['en-us'] = "Expand All";
$text['button-expand_all']['en-gb'] = "Expand All";
$text['button-expand_all']['ar-eg'] = "Expand All";
$text['button-expand_all']['de-at'] = "Expand All";
$text['button-expand_all']['de-ch'] = "Expand All";
$text['button-expand_all']['de-de'] = "Expand All";
$text['button-expand_all']['el-gr'] = "Expand All";
$text['button-expand_all']['es-cl'] = "Expand All";
$text['button-expand_all']['es-mx'] = "Expand All";
$text['button-expand_all']['fr-ca'] = "Expand All";
$text['button-expand_all']['fr-fr'] = "Expand All";
$text['button-expand_all']['he-il'] = "Expand All";
$text['button-expand_all']['it-it'] = "Expand All";
$text['button-expand_all']['nl-nl'] = "Expand All";
$text['button-expand_all']['pl-pl'] = "Expand All";
$text['button-expand_all']['pt-br'] = "Expand All";
$text['button-expand_all']['pt-pt'] = "Expand All";
$text['button-expand_all']['ro-ro'] = "Expand All";
$text['button-expand_all']['ru-ru'] = "Expand All";
$text['button-expand_all']['sv-se'] = "Expand All";
$text['button-expand_all']['uk-ua'] = "Expand All";
$text['button-expand_all']['tr-tr'] = "Expand All";
?>

View File

@ -241,6 +241,7 @@
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-dashboard']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','style'=>'margin-right: 15px;','link'=>'index.php']);
if (permission_exists('dashboard_add')) {
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard_edit.php']);
}

View File

@ -172,6 +172,14 @@
</script>
<?php
// determine initial state all button to display
if (is_array($dashboard) && @sizeof($dashboard) != 0) {
$expanded_all = true;
foreach ($dashboard as $row) {
if ($row['dashboard_details_state'] == 'contracted') { $expanded_all = false; }
}
}
//show the content
echo "<form id='dashboard' method='POST' onsubmit='setFormSubmitting()'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
@ -181,13 +189,13 @@
echo " ".$text['label-welcome']." <a href='".PROJECT_PATH."/core/users/user_edit.php?id=user'>".$_SESSION["username"]."</a>&nbsp; &nbsp;";
}
if (permission_exists('dashboard_edit')) {
if ($_GET['edit'] == 'true') {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','link'=>'index.php']);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','name'=>'btn_save']);
}
else {
echo button::create(['type'=>'button','label'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'id'=>'btn_edit','name'=>'btn_edit','link'=>'index.php?edit=true']);
}
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','name'=>'btn_back','style'=>'display: none;','onclick'=>"edit_mode('off');"]);
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','name'=>'btn_save','style'=>'display: none; margin-left: 15px;']);
echo "<span id='expand_contract'>\n";
echo button::create(['type'=>'button','label'=>$text['button-expand_all'],'icon'=>$_SESSION['theme']['button_icon_expand'],'id'=>'btn_expand','name'=>'btn_expand','style'=>($expanded_all ? 'display: none;' : null),'onclick'=>"$('.hud_details').slideDown('fast'); $(this).hide(); $('#btn_contract').show();"]);
echo button::create(['type'=>'button','label'=>$text['button-contract_all'],'icon'=>$_SESSION['theme']['button_icon_contract'],'id'=>'btn_contract','name'=>'btn_contract','style'=>(!$expanded_all ? 'display: none;' : null),'onclick'=>"$('.hud_details').slideUp('fast'); $(this).hide(); $('#btn_expand').show();"]);
echo "</span>\n";
echo button::create(['type'=>'button','label'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'id'=>'btn_edit','name'=>'btn_edit','style'=>'margin-left: 15px;','onclick'=>"edit_mode('on');"]);
echo button::create(['type'=>'button','label'=>$text['button-settings'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'dashboard.php']);
}
echo " </div>\n";
@ -213,6 +221,7 @@
.widget {
/*background-color: #eee;*/
cursor: pointer;
}
.widgets {
@ -312,11 +321,7 @@
foreach($dashboard as $row) {
$dashboard_name = strtolower($row['dashboard_name']);
$dashboard_name = str_replace(" ", "_", $dashboard_name);
$draggable = '';
if ($_GET['edit'] == 'true') {
$draggable = "draggable='true'";
}
echo "<div class='widget' id='".$dashboard_name."' ".$draggable.">\n";
echo "<div class='widget' id='".$dashboard_name."' draggable='false'>\n";
include($row['dashboard_path']);
echo "</div>\n";
$x++;
@ -324,7 +329,7 @@
echo "</div>\n";
//begin edit
if ($_GET['edit'] == 'true') {
if (permission_exists('dashboard_edit')) {
?>
<style>
@ -336,83 +341,112 @@
user-select: none;
}
.widget {
div.widget.editable {
cursor: move;
}
.hud_box {
.hud_box.editable {
transition: 0.2s;
border: 1px dashed rgba(0,0,0,0.4);
}
.hud_box:hover {
.hud_box.editable:hover {
box-shadow: 0 5px 10px rgba(0,0,0,0.2);
border: 1px dashed rgba(0,0,0,0.4);
transform: scale(1.03, 1.03);
transition: 0.2s;
}
.hud_box .hud_box:hover {
.hud_box .hud_box.editable:hover {
box-shadow: none;
transform: none;
}
.ghost {
border: 3px dashed rgba(0,0,0,1);
border: 2px dashed rgba(0,0,0,1);
<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
-webkit-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
-moz-border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
border-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?> <?php echo $br['tr']['n'].$br['tr']['u']; ?> <?php echo $br['br']['n'].$br['br']['u']; ?> <?php echo $br['bl']['n'].$br['bl']['u']; ?>;
<?php unset($br); ?>
opacity: 0.2;
}
</style>
<script>
//make widgets draggable
var widgets = document.getElementById('widgets');
var sortable = Sortable.create(widgets, {
animation: 150,
draggable: ".widget",
preventOnFilter: true,
ghostClass: 'ghost',
/*
onChange: function (evt) {
//check if chart exists
let chart_status = Chart.getChart(evt.item.id + "_chart");
if(chart_status !== undefined && chart_status !== null) {
let context = eval(evt.item.id + "_chart_context");
let chart = Chart.getChart(context);
let config = eval(evt.item.id + "_chart_config");
var sortable;
//make widgets draggable
function edit_mode(state) {
//re render the chart
chart.destroy();
chart.options.animation = { duration: 0 };
chart = new Chart(context, config);
}
},
*/
onSort: function (evt) {
let widget_ids = document.querySelectorAll("#widgets > div[id]");
let widget_ids_list = [];
for (let i = 0; i < widget_ids.length; i++) {
widget_ids_list.push(widget_ids[i].id);
}
document.getElementById('widget_order').value = widget_ids_list;
},
});
if (state == 'on') {
$('span#expand_contract, #btn_edit, #btn_add').hide();
$('.hud_box').addClass('editable');
$('#btn_back, #btn_save').show();
$('div.widget').attr('draggable',true).addClass('editable');
/*
//warn the user before leaving the page
var formSubmitting = false;
var setFormSubmitting = function() { formSubmitting = true; };
sortable = Sortable.create(widgets, {
animation: 150,
draggable: ".widget",
preventOnFilter: true,
ghostClass: 'ghost',
/*
onChange: function (evt) {
//check if chart exists
let chart_status = Chart.getChart(evt.item.id + "_chart");
if(chart_status !== undefined && chart_status !== null) {
let context = eval(evt.item.id + "_chart_context");
let chart = Chart.getChart(context);
let config = eval(evt.item.id + "_chart_config");
window.onload = function() {
window.addEventListener("beforeunload", function (e) {
var confirmationMessage = 'You have unsaved changes which will not be saved.';
//re render the chart
chart.destroy();
chart.options.animation = { duration: 0 };
chart = new Chart(context, config);
}
},
*/
onSort: function (evt) {
let widget_ids = document.querySelectorAll("#widgets > div[id]");
let widget_ids_list = [];
for (let i = 0; i < widget_ids.length; i++) {
widget_ids_list.push(widget_ids[i].id);
}
document.getElementById('widget_order').value = widget_ids_list;
},
});
if (formSubmitting) {
return undefined;
}
/*
//warn the user before leaving the page
var formSubmitting = false;
var setFormSubmitting = function() { formSubmitting = true; };
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
};
*/
window.onload = function() {
window.addEventListener("beforeunload", function (e) {
var confirmationMessage = 'You have unsaved changes which will not be saved.';
if (formSubmitting) {
return undefined;
}
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
};
*/
}
else { // off
$('div.widget').attr('draggable',false).removeClass('editable');
$('.hud_box').removeClass('editable');
$('#btn_back, #btn_save').hide();
$('span#expand_contract, #btn_edit, #btn_add').show();
sortable.option('disabled', true);
}
}
</script>
<?php
} //end edit
@ -420,4 +454,4 @@
//show the footer
require_once "resources/footer.php";
?>
?>

View File

@ -2589,16 +2589,16 @@ $text['label-active']['ru-ru'] = "Активные";
$text['label-active']['sv-se'] = "Aktiv";
$text['label-active']['uk-ua'] = "";
$text['label-inactive']['en-us'] = "InActive";
$text['label-inactive']['en-gb'] = "InActive";
$text['label-inactive']['en-us'] = "Inactive";
$text['label-inactive']['en-gb'] = "Inactive";
$text['label-inactive']['ar-eg'] = "";
$text['label-inactive']['de-at'] = "InAktiv"; //copied from de-de
$text['label-inactive']['de-ch'] = "InAktiv"; //copied from de-de
$text['label-inactive']['de-de'] = "InAktiv";
$text['label-inactive']['de-at'] = "Inaktiv"; //copied from de-de
$text['label-inactive']['de-ch'] = "Inaktiv"; //copied from de-de
$text['label-inactive']['de-de'] = "Inaktiv";
$text['label-inactive']['es-cl'] = "";
$text['label-inactive']['es-mx'] = "";
$text['label-inactive']['fr-ca'] = "InActif";
$text['label-inactive']['fr-fr'] = "InActif";
$text['label-inactive']['fr-ca'] = "Inactif";
$text['label-inactive']['fr-fr'] = "Inactif";
$text['label-inactive']['he-il'] = "";
$text['label-inactive']['it-it'] = "Non Attivo";
$text['label-inactive']['nl-nl'] = "";
@ -2607,7 +2607,7 @@ $text['label-inactive']['pt-br'] = "";
$text['label-inactive']['pt-pt'] = "";
$text['label-inactive']['ro-ro'] = "";
$text['label-inactive']['ru-ru'] = "Неактивный";
$text['label-inactive']['sv-se'] = "InAktiv";
$text['label-inactive']['sv-se'] = "Inaktiv";
$text['label-inactive']['uk-ua'] = "";
?>

View File

@ -2335,6 +2335,22 @@
$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'] = "75424d2d-cb7d-4469-9269-7cb814e863b8";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_expand";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-expand";
$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'] = "df614b6d-217c-43a6-a6ce-5cef689e5348";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "button_icon_contract";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "fas fa-compress";
$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'] = "814ed631-a315-4bde-a822-4038432ae2a6";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "theme";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "keyboard_shortcut_check_all_enabled";

View File

@ -2431,7 +2431,6 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
-webkit-box-shadow: inset 0 7px 7px -7px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>, inset 0 -8px 12px -10px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>;
box-shadow: inset 0 7px 7px -7px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>, inset 0 -8px 12px -10px <?php echo ($_SESSION['theme']['dashboard_detail_shadow_color']['text'] != '') ? $_SESSION['theme']['dashboard_detail_shadow_color']['text'] : '#737983'; ?>;
*/
padding-top: 3px;
padding-bottom: 15px;
overflow-y: auto;
}
@ -2455,6 +2454,35 @@ header('Expires: '.gmdate('D, d M Y H:i:s',time()+3600).' GMT');
font-size: <?php echo ($_SESSION['theme']['dashboard_detail_heading_text_size']['text'] != '') ? $_SESSION['theme']['dashboard_detail_heading_text_size']['text'] : '11px'; ?>;
font-family: <?php echo ($_SESSION['theme']['table_heading_text_font']['text'] != '') ? $_SESSION['theme']['table_heading_text_font']['text'] : 'arial'; ?>
color: <?php echo ($_SESSION['theme']['table_heading_text_color']['text'] != '') ? $_SESSION['theme']['table_heading_text_color']['text'] : '#3164ad'; ?>;
padding-top: 3px;
<?php
$color_edge = ($_SESSION['theme']['dashboard_detail_background_color_edge']['text'] != '') ? $_SESSION['theme']['dashboard_detail_background_color_edge']['text'] : '#edf1f7';
$color_center = ($_SESSION['theme']['dashboard_detail_background_color_center']['text'] != '') ? $_SESSION['theme']['dashboard_detail_background_color_center']['text'] : '#f9fbfe';
?>
background: <?php echo $color_center; ?>;
background-image: -ms-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
background-image: -moz-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
background-image: -o-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
background-image: -webkit-gradient(linear, left, right, color-stop(0, <?php echo $color_edge; ?>), color-stop(0.30, <?php echo $color_center; ?>), color-stop(0.70, <?php echo $color_center; ?>), color-stop(1, <?php echo $color_edge; ?>));
background-image: -webkit-linear-gradient(left, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
background-image: linear-gradient(to right, <?php echo $color_edge; ?> 0%, <?php echo $color_center; ?> 30%, <?php echo $color_center; ?> 70%, <?php echo $color_edge; ?> 100%);
<?php unset($color_edge, $color_center); ?>
}
th.hud_heading:first-of-type {
<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
-webkit-border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
-moz-border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
border-top-left-radius: <?php echo $br['tl']['n'].$br['tl']['u']; ?>;
<?php unset($br); ?>
}
th.hud_heading:first-of-type {
<?php $br = format_border_radius($_SESSION['theme']['dashboard_border_radius']['text'], '5px'); ?>
-webkit-border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
-moz-border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
border-top-left-radius: <?php echo $br['tr']['n'].$br['tr']['u']; ?>;
<?php unset($br); ?>
}
td.hud_text {