Dashboard - Caller ID: Rework style to match other widgets.
This commit is contained in:
parent
e91f78bafe
commit
2c76741976
|
|
@ -315,6 +315,38 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Default value to set whether to record inbound, outbound, or all calls.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "40aac087-c335-44fa-9302-aaddb4bcca00";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "caller_id_chart_color_undefined";
|
||||
$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'] = "103a5aaa-00f8-4cbe-9988-0469a9b9e65d";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "caller_id_chart_color_defined";
|
||||
$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'] = "71b2a34c-86df-4ada-b7fc-70e4048dd202";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "caller_id_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'] = "7a96f83b-c408-418b-99b5-077fa11b7cf5";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "dashboard";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "caller_id_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'] = "";
|
||||
|
||||
//cache details
|
||||
$apps[$x]['cache']['key'] = "directory.\${extension}@\${domain_name}";
|
||||
|
|
|
|||
|
|
@ -1795,6 +1795,52 @@ $text['label-extension_and_voicemail']['sv-se'] = "Anknytning Röstbrevlåda";
|
|||
$text['label-extension_and_voicemail']['uk-ua'] = "Розширення (Extention), Голосова пошта";
|
||||
$text['label-extension_and_voicemail']['tr-tr'] = "";
|
||||
|
||||
$text['label-defined']['en-us'] = "Defined";
|
||||
$text['label-defined']['en-gb'] = "Defined";
|
||||
$text['label-defined']['ar-eg'] = "Defined";
|
||||
$text['label-defined']['de-at'] = "Defined";
|
||||
$text['label-defined']['de-ch'] = "Defined";
|
||||
$text['label-defined']['de-de'] = "Defined";
|
||||
$text['label-defined']['el-gr'] = "Defined";
|
||||
$text['label-defined']['es-cl'] = "Defined";
|
||||
$text['label-defined']['es-mx'] = "Defined";
|
||||
$text['label-defined']['fr-ca'] = "Defined";
|
||||
$text['label-defined']['fr-fr'] = "Defined";
|
||||
$text['label-defined']['he-il'] = "Defined";
|
||||
$text['label-defined']['it-it'] = "Defined";
|
||||
$text['label-defined']['nl-nl'] = "Defined";
|
||||
$text['label-defined']['pl-pl'] = "Defined";
|
||||
$text['label-defined']['pt-br'] = "Defined";
|
||||
$text['label-defined']['pt-pt'] = "Defined";
|
||||
$text['label-defined']['ro-ro'] = "Defined";
|
||||
$text['label-defined']['ru-ru'] = "Defined";
|
||||
$text['label-defined']['sv-se'] = "Defined";
|
||||
$text['label-defined']['uk-ua'] = "Defined";
|
||||
$text['label-defined']['tr-tr'] = "Defined";
|
||||
|
||||
$text['label-undefined']['en-us'] = "Undefined";
|
||||
$text['label-undefined']['en-gb'] = "Undefined";
|
||||
$text['label-undefined']['ar-eg'] = "Undefined";
|
||||
$text['label-undefined']['de-at'] = "Undefined";
|
||||
$text['label-undefined']['de-ch'] = "Undefined";
|
||||
$text['label-undefined']['de-de'] = "Undefined";
|
||||
$text['label-undefined']['el-gr'] = "Undefined";
|
||||
$text['label-undefined']['es-cl'] = "Undefined";
|
||||
$text['label-undefined']['es-mx'] = "Undefined";
|
||||
$text['label-undefined']['fr-ca'] = "Undefined";
|
||||
$text['label-undefined']['fr-fr'] = "Undefined";
|
||||
$text['label-undefined']['he-il'] = "Undefined";
|
||||
$text['label-undefined']['it-it'] = "Undefined";
|
||||
$text['label-undefined']['nl-nl'] = "Undefined";
|
||||
$text['label-undefined']['pl-pl'] = "Undefined";
|
||||
$text['label-undefined']['pt-br'] = "Undefined";
|
||||
$text['label-undefined']['pt-pt'] = "Undefined";
|
||||
$text['label-undefined']['ro-ro'] = "Undefined";
|
||||
$text['label-undefined']['ru-ru'] = "Undefined";
|
||||
$text['label-undefined']['sv-se'] = "Undefined";
|
||||
$text['label-undefined']['uk-ua'] = "Undefined";
|
||||
$text['label-undefined']['tr-tr'] = "Undefined";
|
||||
|
||||
$text['label-extension_only']['en-us'] = "Extension Only";
|
||||
$text['label-extension_only']['en-gb'] = "Extension Only";
|
||||
$text['label-extension_only']['ar-eg'] = "";
|
||||
|
|
|
|||
|
|
@ -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) 2017 - 2022
|
||||
Portions created by the Initial Developer are Copyright (C) 2017-2023
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -89,6 +89,9 @@
|
|||
$x++;
|
||||
}
|
||||
|
||||
//create temp array for session update
|
||||
$array_temp = $array;
|
||||
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p->add("extension_edit", "temp");
|
||||
|
|
@ -100,16 +103,19 @@
|
|||
$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'];
|
||||
if ($message['message'] == 'OK' && $message['code'] == '200') {
|
||||
foreach ($array_temp['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++;
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
unset($array_temp);
|
||||
|
||||
//remove the temporary permission
|
||||
$p->delete("extension_edit", "temp");
|
||||
|
|
@ -128,108 +134,175 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set the sub array index
|
||||
$x = "999";
|
||||
|
||||
//get the extensions
|
||||
$extensions = $_SESSION['user']['extension'];
|
||||
|
||||
//get the destinations
|
||||
$sql = "select destination_caller_id_name, destination_caller_id_number from v_destinations ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and destination_type = 'inbound' ";
|
||||
$sql .= "order by destination_caller_id_name asc, destination_caller_id_number asc";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$destinations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
if (permission_exists('outbound_caller_id_select')) {
|
||||
$sql = "select destination_caller_id_name, destination_caller_id_number from v_destinations ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and destination_type = 'inbound' ";
|
||||
$sql .= "order by destination_caller_id_name asc, destination_caller_id_number asc";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$destinations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
//determine stats
|
||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
foreach ($extensions as $row) {
|
||||
if (is_numeric($row['outbound_caller_id_number'])) {
|
||||
$stats['defined']++;
|
||||
}
|
||||
else {
|
||||
$stats['undefined']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set defaults
|
||||
if ($stats['defined'] == null) { $stats['defined'] = 0; }
|
||||
if ($stats['undefined'] == null) { $stats['undefined'] = 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($_SERVER["DOCUMENT_ROOT"].'/extensions/resources/dashboard/caller_id.php');
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-caller_id_number']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
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 " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
//caller id
|
||||
echo "<div class='hud_box'>\n";
|
||||
|
||||
//doughnut chart
|
||||
echo "<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick=\"$('#hud_caller_id_details').slideToggle('fast');\">\n";
|
||||
echo " <div style='width: 275px; height: 175px;'><canvas id='caller_id_chart'></canvas></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<form id='form_list_extension_caller_id' method='post' action='/app/extensions/resources/dashboard/caller_id.php'>\n";
|
||||
echo "<script>\n";
|
||||
echo " const caller_id_chart = new Chart(\n";
|
||||
echo " document.getElementById('caller_id_chart').getContext('2d'),\n";
|
||||
echo " {\n";
|
||||
echo " type: 'doughnut',\n";
|
||||
echo " data: {\n";
|
||||
echo " labels: [\n";
|
||||
echo " '".$text['label-defined'].": ".$stats['defined']."',\n";
|
||||
echo " '".$text['label-undefined'].": ".$stats['undefined']."',\n";
|
||||
echo " ],\n";
|
||||
echo " datasets: [{\n";
|
||||
echo " data: [\n";
|
||||
echo " '".$stats['defined']."',\n";
|
||||
echo " '".$stats['undefined']."',\n";
|
||||
echo " 0.00001,\n";
|
||||
echo " ],\n";
|
||||
echo " backgroundColor: [\n";
|
||||
echo " '".$_SESSION['dashboard']['caller_id_chart_color_defined']['text']."',\n";
|
||||
echo " '".$_SESSION['dashboard']['caller_id_chart_color_undefined']['text']."',\n";
|
||||
echo " ],\n";
|
||||
echo " borderColor: '".$_SESSION['dashboard']['caller_id_chart_border_color']['text']."',\n";
|
||||
echo " borderWidth: '".$_SESSION['dashboard']['caller_id_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['undefined']."'\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['label-caller_id_number']."'\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo " },\n";
|
||||
echo " plugins: [chart_counter],\n";
|
||||
echo " }\n";
|
||||
echo " );\n";
|
||||
echo "</script>\n";
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\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";
|
||||
//details
|
||||
echo "<form id='form_list_caller_id' method='post' action='".PROJECT_PATH."/app/extensions/resources/dashboard/caller_id.php'>\n";
|
||||
|
||||
echo "<div class='hud_details hud_box' id='hud_caller_id_details' style='text-align: right;'>";
|
||||
|
||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'style'=>"position: absolute; margin-top: -35px; margin-left: -72px;"]);
|
||||
}
|
||||
|
||||
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";
|
||||
echo "<th class='hud_heading'>".$text['label-caller_id']."</th>\n";
|
||||
if (!permission_exists('outbound_caller_id_select')) {
|
||||
echo "<th class='hud_heading'>".$text['label-destination']."</th>\n";
|
||||
}
|
||||
echo " <th class='hide-sm-dn pct-30'>".$text['label-description']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//data
|
||||
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
||||
$x = 0;
|
||||
foreach ($extensions as $row) {
|
||||
//determine whether to hide the element
|
||||
if (is_uuid($device_key_uuid)) {
|
||||
$element['hidden'] = false;
|
||||
$element['visibility'] = "visibility:visible;";
|
||||
}
|
||||
else {
|
||||
$element['hidden'] = true;
|
||||
$element['visibility'] = "visibility:hidden;";
|
||||
}
|
||||
|
||||
echo "<tr class='list-row'>\n";
|
||||
echo " <td>\n";
|
||||
echo " ".$row['destination'];
|
||||
$tr_link = PROJECT_PATH."/app/extensions/extension_edit.php?id=".$row['extension_uuid'];
|
||||
echo "<tr href='".$tr_link."'>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." hud_text'>";
|
||||
echo "<a href='".$tr_link."' title=\"".$text['button-edit']."\">".escape($row['destination'])."</a>";
|
||||
if (is_uuid($row['extension_uuid'])) {
|
||||
echo " <input name='extensions[".$x."][extension_uuid]' type='hidden' value=\"".escape($row['extension_uuid'])."\">\n";
|
||||
echo "<input type='hidden' name='extensions[".$x."][extension_uuid]' value=\"".escape($row['extension_uuid'])."\">\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
//select caller id
|
||||
if (permission_exists('outbound_caller_id_select')) {
|
||||
//caller id select
|
||||
echo " <td class='input'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]." hud_text input tr_link_void'>";
|
||||
if (count($destinations) > 0) {
|
||||
echo " <select name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number' class='formfld'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo "<select class='formfld' name='extensions[".$x."][outbound_caller_id]' id='outbound_caller_id_number_".$x."' style='width: 100%; min-width: 150px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($destinations as &$field) {
|
||||
if(strlen($field['destination_caller_id_number']) > 0) {
|
||||
if ($row['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";
|
||||
}
|
||||
if (strlen($field['destination_caller_id_number']) > 0) {
|
||||
echo "<option value='".escape($field['destination_caller_id_name'])."@".escape($field['destination_caller_id_number'])."' ".($row['outbound_caller_id_number'] == $field['destination_caller_id_number'] ? "selected='selected'" : null).">".escape($field['destination_caller_id_name'])." ".escape($field['destination_caller_id_number'])."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "</select>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</td>\n";
|
||||
}
|
||||
//input caller id
|
||||
else {
|
||||
//caller id name and number inputs
|
||||
echo " <td class='input'>\n";
|
||||
echo " <input class='formfld' style='width: 70%;' type='text' name='extensions[".$x."][outbound_caller_id_name]' maxlength='255' value=\"".escape($row['outbound_caller_id_name'])."\">\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='input'>\n";
|
||||
echo " <input class='formfld' style='width: 70%;' type='text' name='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\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='extensions[".$x."][outbound_caller_id_name]' maxlength='255' value=\"".escape($row['outbound_caller_id_name'])."\">\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='extensions[".$x."][outbound_caller_id_number]' maxlength='255' value=\"".$row['outbound_caller_id_number']."\">\n";
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo " <td class='description overflow hide-sm-dn'>\n";
|
||||
echo " ".$row['description'];
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
unset($extensions);
|
||||
}
|
||||
unset($extensions);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br />\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_caller_id_details').slideToggle('fast');\"><span class='fas fa-ellipsis-h'></span></span>";
|
||||
echo "</div>\n";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Reference in New Issue