mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Added real notifications (not AJAX jet)
Former-commit-id: 5d0dee32c4fb96ad8dcb4f3f70049e1d1c4936fc
This commit is contained in:
parent
4b86683d23
commit
0124bd0a17
@ -4,22 +4,18 @@
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
require_once ("include/functions_messages.php");
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_notifications.php');
|
||||
require_once 'include/functions_messages.php';
|
||||
require_once 'include/functions_servers.php';
|
||||
require_once 'include/functions_notifications.php';
|
||||
|
||||
// Check permissions
|
||||
|
||||
// Global errors/warnings checking.
|
||||
config_check();
|
||||
|
||||
@ -29,88 +25,86 @@ config_check();
|
||||
<td style="width:90%;">
|
||||
<a href="index.php?sec=main">
|
||||
<?php
|
||||
$custom_logo = 'images/custom_logo/' . $config['custom_logo'];
|
||||
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
|
||||
|
||||
if (!defined ('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name() . ' Opensource';
|
||||
if (!defined('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name().' Opensource';
|
||||
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
|
||||
}
|
||||
else {
|
||||
if (file_exists(ENTERPRISE_DIR . '/' . $custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR . '/' . $custom_logo;
|
||||
}
|
||||
$logo_title = get_product_name() . ' Enterprise';
|
||||
} else {
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
|
||||
}
|
||||
|
||||
echo html_print_image($custom_logo, true,
|
||||
array("alt" => $logo_title, "border" => '0'));
|
||||
$logo_title = get_product_name().' Enterprise';
|
||||
}
|
||||
|
||||
echo html_print_image(
|
||||
$custom_logo,
|
||||
true,
|
||||
[
|
||||
'alt' => $logo_title,
|
||||
'border' => '0',
|
||||
]
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td style="min-width:200px;">
|
||||
<?php
|
||||
$table = new stdClass();
|
||||
$table->id = "header_table";
|
||||
$table->class = "none";
|
||||
$table->id = 'header_table';
|
||||
$table->class = 'none';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->style[0] =
|
||||
$table->style['clippy'] =
|
||||
$table->style[1] =
|
||||
$table->style[3] =
|
||||
$table->style[4] =
|
||||
$table->style[5] =
|
||||
$table->style[6] =
|
||||
$table->style[8] =
|
||||
$table->style[9] =
|
||||
$table->style['qr'] =
|
||||
$table->style['notifications'] =
|
||||
'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->style[0] = $table->style['clippy'] = $table->style[1] = $table->style[3] = $table->style[4] = $table->style[5] = $table->style[6] = $table->style[8] = $table->style[9] = $table->style['qr'] = $table->style['notifications'] = 'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
|
||||
$table->style[7] = 'width: 20px; padding-right: 9px;';
|
||||
$table->style['searchbar'] = 'width: 180px; min-width: 180px;';
|
||||
$table->style[11] = 'padding-left: 10px; padding-right: 5px;width: 16px;';
|
||||
$table->width = "100%";
|
||||
$table->width = '100%';
|
||||
$table->styleTable = 'margin: auto; margin-top: 0px;';
|
||||
$table->rowclass[0] = '';
|
||||
|
||||
$acl_head_search = true;
|
||||
if ($config["acl_enterprise"] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql("SELECT sec FROM tusuario
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql(
|
||||
"SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')");
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
|
||||
);
|
||||
}
|
||||
|
||||
if ($acl_head_search) {
|
||||
$table->data[0][11] = ui_print_help_tip (__("Blank characters are used as AND conditions"), true);
|
||||
$table->data[0][11] = ui_print_help_tip(__('Blank characters are used as AND conditions'), true);
|
||||
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
}
|
||||
else {
|
||||
if (strlen($config['search_keywords']) == 0)
|
||||
} else {
|
||||
if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
else
|
||||
} else {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
}
|
||||
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords']))
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else if (strlen($config['search_keywords']) == 0)
|
||||
$search_bar .= "value='" . __("Enter keywords to search") . "'";
|
||||
else
|
||||
$search_bar .= "value='" . $config['search_keywords'] . "'";
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else {
|
||||
$search_bar .= "value='".$config['search_keywords']."'";
|
||||
}
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
//$search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
|
||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
@ -118,48 +112,44 @@ config_check();
|
||||
}
|
||||
|
||||
// Servers check
|
||||
$servers = array();
|
||||
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
|
||||
$servers["up"] = (int) servers_check_status ();
|
||||
$servers["down"] = $servers["all"] - $servers["up"];
|
||||
if ($servers["up"] == 0) {
|
||||
//All Servers down or no servers at all
|
||||
$servers_check_img = html_print_image("images/header_down.png", true, array("alt" => 'cross', "class" => 'bot', 'title' => __('All systems').': '.__('Down')));
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all
|
||||
$servers_check_img = html_print_image('images/header_down.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down
|
||||
$servers_check_img = html_print_image('images/header_warning.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up
|
||||
$servers_check_img = html_print_image('images/header_ready.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
elseif ($servers["down"] != 0) {
|
||||
//Some servers down
|
||||
$servers_check_img = html_print_image("images/header_warning.png", true, array("alt" => 'error', "class" => 'bot', 'title' => $servers["down"].' '.__('servers down')));
|
||||
}
|
||||
else {
|
||||
//All servers up
|
||||
$servers_check_img = html_print_image("images/header_ready.png", true, array("alt" => 'ok', "class" => 'bot', 'title' => __('All systems').': '.__('Ready')));
|
||||
}
|
||||
unset ($servers); // Since this is the header, we don't like to trickle down variables.
|
||||
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_link_open = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_link_close = '</a>';
|
||||
|
||||
if ($config['show_qr_code_header'] == 0){
|
||||
if ($config['show_qr_code_header'] == 0) {
|
||||
$show_qr_code_header = 'display: none;';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$show_qr_code_header = 'display: inline;';
|
||||
}
|
||||
|
||||
$table->data[0]['qr'] =
|
||||
'<div style="' . $show_qr_code_header . '" id="qr_code_container" style="">' .
|
||||
'<a href="javascript: show_dialog_qrcode();">' .
|
||||
html_print_image(
|
||||
"images/qrcode_icon.png",
|
||||
$table->data[0]['qr'] = '<div style="'.$show_qr_code_header.'" id="qr_code_container" style="">'.'<a href="javascript: show_dialog_qrcode();">'.html_print_image(
|
||||
'images/qrcode_icon.png',
|
||||
true,
|
||||
array("alt" => __('QR Code of the page'),
|
||||
'title' => __('QR Code of the page'))) .
|
||||
'</a>' .
|
||||
'</div>';
|
||||
[
|
||||
'alt' => __('QR Code of the page'),
|
||||
'title' => __('QR Code of the page'),
|
||||
]
|
||||
).'</a>'.'</div>';
|
||||
|
||||
echo "<div style='display: none;' id='qrcode_container' title='" . __('QR code of the page') . "'>";
|
||||
echo "<div style='display: none;' id='qrcode_container' title='".__('QR code of the page')."'>";
|
||||
echo "<div id='qrcode_container_image'></div>";
|
||||
echo "</div>";
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
@ -170,41 +160,46 @@ config_check();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
if ($config['tutorial_mode'] !== 'expert' && !$config['disable_help']) {
|
||||
$table->data[0]['clippy'] =
|
||||
'<a href="javascript: show_clippy();">' .
|
||||
html_print_image(
|
||||
"images/clippy_icon.png",
|
||||
$table->data[0]['clippy'] = '<a href="javascript: show_clippy();">'.html_print_image(
|
||||
'images/clippy_icon.png',
|
||||
true,
|
||||
array("id" => 'clippy',
|
||||
"class" => 'clippy',
|
||||
"alt" => __('%s assistant', get_product_name()),
|
||||
'title' => __('%s assistant', get_product_name()))) .
|
||||
'</a>';
|
||||
[
|
||||
'id' => 'clippy',
|
||||
'class' => 'clippy',
|
||||
'alt' => __('%s assistant', get_product_name()),
|
||||
'title' => __(
|
||||
'%s assistant',
|
||||
get_product_name()
|
||||
),
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
|
||||
$table->data[0][0] = $servers_link_open .
|
||||
$servers_check_img . $servers_link_close;
|
||||
$table->data[0][0] = $servers_link_open.$servers_check_img.$servers_link_close;
|
||||
|
||||
|
||||
|
||||
|
||||
//======= Autorefresh code =============================
|
||||
// ======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = array ('agent_config' => false, 'code' => false);
|
||||
$ignored_params = [
|
||||
'agent_config' => false,
|
||||
'code' => false,
|
||||
];
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
|
||||
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'");
|
||||
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
|
||||
|
||||
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
|
||||
@ -216,34 +211,30 @@ config_check();
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
|
||||
$autorefresh_img = html_print_image('images/header_refresh.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]);
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset ($values);
|
||||
unset($values);
|
||||
|
||||
$autorefresh_link_open_img =
|
||||
'<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">';
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_link_open_txt =
|
||||
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">';
|
||||
}
|
||||
else {
|
||||
$autorefresh_link_open_txt = '<a class="white autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
}
|
||||
else {
|
||||
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
@ -251,9 +242,8 @@ config_check();
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
@ -262,58 +252,55 @@ config_check();
|
||||
$autorefresh_link_close = '';
|
||||
}
|
||||
|
||||
$table->data[0][1] = $autorefresh_link_open_img . $autorefresh_img . $autorefresh_link_close;
|
||||
$table->data[0][2] = $autorefresh_link_open_txt . $autorefresh_txt . $autorefresh_link_close . $autorefresh_additional;
|
||||
//======================================================
|
||||
|
||||
|
||||
$table->data[0][1] = $autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close;
|
||||
$table->data[0][2] = $autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional;
|
||||
// ======================================================
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, "PM");
|
||||
$pandora_management = check_acl($config['id_user'], 0, 'PM');
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_available ();
|
||||
$check_minor_release_available = db_check_minor_relase_available();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
|
||||
if($config['language'] == 'es'){
|
||||
if ($config['language'] == 'es') {
|
||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
$maintenance_link = 'javascript:';
|
||||
$maintenance_title = __("System alerts detected - Please fix as soon as possible");
|
||||
$maintenance_title = __('System alerts detected - Please fix as soon as possible');
|
||||
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
|
||||
|
||||
$maintenance_link_open_txt =
|
||||
'<a href="' . $maintenance_link . '" title="' . $maintenance_title . '" class="' . $maintenance_class . '" id="show_systemalert_dialog">';
|
||||
$maintenance_link_open_img =
|
||||
'<a href="' . $maintenance_link . '" title="' . $maintenance_title . '" class="' . $maintenance_class . '">';
|
||||
$maintenance_link_open_txt = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'" id="show_systemalert_dialog">';
|
||||
$maintenance_link_open_img = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'">';
|
||||
$maintenance_link_close = '</a>';
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
} else {
|
||||
$maintenance_img = $maintenance_link_open_img.html_print_image(
|
||||
'images/header_yellow.png',
|
||||
true,
|
||||
[
|
||||
'title' => __(
|
||||
'You have %d warning(s)',
|
||||
$config['alert_cnt']
|
||||
),
|
||||
'id' => 'yougotalert',
|
||||
'class' => 'bot',
|
||||
]
|
||||
).$maintenance_link_close;
|
||||
}
|
||||
else {
|
||||
$maintenance_img = $maintenance_link_open_img .
|
||||
html_print_image("images/header_yellow.png",
|
||||
true, array(
|
||||
"title" => __('You have %d warning(s)',
|
||||
$config["alert_cnt"]),
|
||||
"id" => "yougotalert",
|
||||
"class" => "bot")) . $maintenance_link_close;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
}
|
||||
else {
|
||||
$maintenance_img = html_print_image ("images/header_ready.png", true, array ("title" => __('There are not warnings'), "id" => "yougotalert", "class" => "bot"));
|
||||
} else {
|
||||
$maintenance_img = html_print_image('images/header_ready.png', true, ['title' => __('There are not warnings'), 'id' => 'yougotalert', 'class' => 'bot']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,49 +308,52 @@ config_check();
|
||||
|
||||
// Main help icon
|
||||
if (!$config['disable_help']) {
|
||||
$table->data[0][4] =
|
||||
'<a href="#" class="modalpopup" id="helpmodal">' .
|
||||
html_print_image("images/header_help.png", true, array(
|
||||
"title" => __('Main help'),
|
||||
"id" => "helpmodal",
|
||||
"class" => "modalpopup")) .
|
||||
'</a>';
|
||||
$table->data[0][4] = '<a href="#" class="modalpopup" id="helpmodal">'.html_print_image(
|
||||
'images/header_help.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Main help'),
|
||||
'id' => 'helpmodal',
|
||||
'class' => 'modalpopup',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
$table->data[0]['notifications'] = notifications_print_ball();
|
||||
|
||||
// Logout
|
||||
$table->data[0][5] = '<a class="white" href="' . ui_get_full_url('index.php?bye=bye') . '">';
|
||||
$table->data[0][5] .= html_print_image("images/header_logout.png", true, array("alt" => __('Logout'), "class" => 'bot', "title" => __('Logout')));
|
||||
$table->data[0][5] = '<a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||
$table->data[0][5] .= html_print_image('images/header_logout.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
|
||||
$table->data[0][5] .= '</a>';
|
||||
|
||||
// User
|
||||
if (is_user_admin ($config["id_user"]) == 1)
|
||||
$table->data[0][6] = html_print_image("images/header_user_admin.png" , true, array("title" => __('Edit my user'), "class" => 'bot', "alt" => 'user'));
|
||||
else
|
||||
$table->data[0][6] = html_print_image("images/header_user.png" , true, array("title" => __('Edit my user'), "class" => 'bot', "alt" => 'user'));
|
||||
if (is_user_admin($config['id_user']) == 1) {
|
||||
$table->data[0][6] = html_print_image('images/header_user_admin.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
} else {
|
||||
$table->data[0][6] = html_print_image('images/header_user.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
}
|
||||
|
||||
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">' . $table->data[0][6] . '</a>';
|
||||
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$table->data[0][6].'</a>';
|
||||
|
||||
$table->data[0][7] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit" class="white_bold"> (' . $config["id_user"] . ')</a>';
|
||||
$table->data[0][7] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit" class="white_bold"> ('.$config['id_user'].')</a>';
|
||||
|
||||
// Chat messages
|
||||
$table->data[0][8] = "<span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$table->data[0][8] .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$table->data[0][8] .= html_print_image('images/header_chat.png', true, array("title" => __('New chat message')));
|
||||
$table->data[0][8] .= "</a>";
|
||||
$table->data[0][8] .= "</span>";
|
||||
$table->data[0][8] .= html_print_image('images/header_chat.png', true, ['title' => __('New chat message')]);
|
||||
$table->data[0][8] .= '</a>';
|
||||
$table->data[0][8] .= '</span>';
|
||||
|
||||
// Messages
|
||||
$msg_cnt = messages_get_count ($config["id_user"]);
|
||||
$msg_cnt = messages_get_count($config['id_user']);
|
||||
if ($msg_cnt > 0) {
|
||||
echo '<div id="dialog_messages" style="display: none"></div>';
|
||||
|
||||
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="' . __("Message overview") . '" id="show_messages_dialog">';
|
||||
$table->data[0][9] .= html_print_image ("images/header_email.png", true, array ("title" => __('You have %d unread message(s)', $msg_cnt), "id" => "yougotmail", "class" => "bot", 'style' => 'width:24px;'));
|
||||
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="'.__('Message overview').'" id="show_messages_dialog">';
|
||||
$table->data[0][9] .= html_print_image('images/header_email.png', true, ['title' => __('You have %d unread message(s)', $msg_cnt), 'id' => 'yougotmail', 'class' => 'bot', 'style' => 'width:24px;']);
|
||||
$table->data[0][9] .= '</a>';
|
||||
}
|
||||
|
||||
$table->data[0]['notifications'] = notifications_print_ball();
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
@ -373,10 +363,11 @@ config_check();
|
||||
<td style="text-align:center">
|
||||
<?php
|
||||
echo "<a href='index.php?sec=main'>";
|
||||
if (isset($config["custom_logo"])) {
|
||||
echo html_print_image("images/custom_logo/" . $config["custom_logo"], true, array("height" => '60', "width" => '139', "alt" => 'Logo'));
|
||||
if (isset($config['custom_logo'])) {
|
||||
echo html_print_image('images/custom_logo/'.$config['custom_logo'], true, ['height' => '60', 'width' => '139', 'alt' => 'Logo']);
|
||||
}
|
||||
echo "</a>";
|
||||
|
||||
echo '</a>';
|
||||
?>
|
||||
</td>
|
||||
-->
|
||||
@ -391,14 +382,40 @@ config_check();
|
||||
if (isset($config['fixed_header'])) {
|
||||
$config_fixed_header = $config['fixed_header'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool)$config_fixed_header); ?>;
|
||||
function addNotifications(event) {
|
||||
var elements = document.getElementsByClassName("notification-wrapper");
|
||||
if (!elements) return;
|
||||
Array.prototype.forEach.call(elements, function(elem) {
|
||||
toggle_element(elem);
|
||||
});
|
||||
attatch_to_image();
|
||||
}
|
||||
|
||||
var new_chat = <?php echo (int)$_SESSION['new_chat'];?>;
|
||||
function attatch_to_image() {
|
||||
var notification_elems = document.getElementsByClassName("notification-wrapper");
|
||||
var image_attached = document.getElementById("notification-ball-header").getBoundingClientRect().left;
|
||||
Array.prototype.forEach.call(notification_elems, function(elem) {
|
||||
elem.style.left = image_attached - 300 + "px";
|
||||
});
|
||||
}
|
||||
function toggle_element(elem) {
|
||||
elem.style.display = elem.style.display === "none" ? "block" : "none";
|
||||
}
|
||||
|
||||
// Resize event
|
||||
window.addEventListener("resize", function() {
|
||||
attatch_to_image();
|
||||
});
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
|
||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||
$(document).ready (function () {
|
||||
<?php
|
||||
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) {
|
||||
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET['refr']))) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
@ -406,7 +423,7 @@ config_check();
|
||||
}
|
||||
}
|
||||
|
||||
$new_dashboard = get_parameter('new_dashboard',0);
|
||||
$new_dashboard = get_parameter('new_dashboard', 0);
|
||||
|
||||
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
|
||||
$do_refresh = false;
|
||||
@ -419,9 +436,9 @@ config_check();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
<?php
|
||||
if($select[0]['time_autorefresh']){
|
||||
if ($select[0]['time_autorefresh']) {
|
||||
?>
|
||||
var refresh = '<?php echo $select[0]["time_autorefresh"] ?>';
|
||||
var refresh = '<?php echo $select[0]['time_autorefresh']; ?>';
|
||||
$(document).attr ("location", href + refresh);
|
||||
<?php
|
||||
}
|
||||
@ -468,7 +485,7 @@ config_check();
|
||||
|
||||
|
||||
<?php
|
||||
if ($config["alert_cnt"] > 0) {
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
?>
|
||||
blinkalert();
|
||||
<?php
|
||||
@ -477,12 +494,12 @@ config_check();
|
||||
blinkpubli();
|
||||
|
||||
<?php
|
||||
if ($_GET["refr"]) {
|
||||
if ($_GET['refr']) {
|
||||
?>
|
||||
var refr_time = <?php echo (int) get_parameter("refr", 0); ?>;
|
||||
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
|
||||
var t = new Date();
|
||||
t.setTime (t.getTime () +
|
||||
parseInt(<?php echo $config["refr"] * 1000; ?>));
|
||||
parseInt(<?php echo ($config['refr'] * 1000); ?>));
|
||||
$("#refrcounter").countdown ({until: t,
|
||||
layout: '%M%nn%M:%S%nn%S',
|
||||
labels: ['', '', '', '', '', '', ''],
|
||||
@ -510,3 +527,6 @@ config_check();
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo notifications_print_dropdown();
|
||||
|
@ -416,13 +416,15 @@ function messages_get_count_sent(string $user='')
|
||||
* @param string $order_dir Direction of order
|
||||
* (ASC = Ascending, DESC = Descending).
|
||||
* @param boolean $incl_read Include read messages in return.
|
||||
* @param boolean $incl_source_info Include source info.
|
||||
*
|
||||
* @return integer The number of messages this user has
|
||||
*/
|
||||
function messages_get_overview(
|
||||
string $order='status',
|
||||
string $order_dir='ASC',
|
||||
bool $incl_read=true
|
||||
bool $incl_read=true,
|
||||
bool $incl_source_info=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
@ -453,9 +455,17 @@ function messages_get_overview(
|
||||
$read = 'where t.read is null';
|
||||
}
|
||||
|
||||
$source_fields = '';
|
||||
$source_join = '';
|
||||
if ($incl_source_info) {
|
||||
$source_fields = ', tns.*';
|
||||
$source_join = 'INNER JOIN tnotification_source tns
|
||||
ON tns.id=tm.id_source';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT * FROM (
|
||||
SELECT tm.*, utimestamp_read > 0 as "read" FROM tmensajes tm
|
||||
SELECT tm.*, utimestamp_read > 0 as "read" %s FROM tmensajes tm
|
||||
LEFT JOIN tnotification_user nu
|
||||
ON tm.id_mensaje=nu.id_mensaje
|
||||
LEFT JOIN (tnotification_group ng
|
||||
@ -463,11 +473,14 @@ function messages_get_overview(
|
||||
ON ng.id_group=up.id_grupo
|
||||
AND up.id_grupo=ng.id_group
|
||||
) ON tm.id_mensaje=ng.id_mensaje
|
||||
%s
|
||||
WHERE utimestamp_erased is null
|
||||
AND (up.id_usuario="%s" OR nu.id_user="%s" OR ng.id_group=0)
|
||||
) t
|
||||
%s
|
||||
ORDER BY %s',
|
||||
$source_fields,
|
||||
$source_join,
|
||||
$config['id_user'],
|
||||
$config['id_user'],
|
||||
$read,
|
||||
|
@ -523,6 +523,11 @@ function notifications_set_user_label_status($source, $user, $label, $value)
|
||||
}
|
||||
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
// UI FUNCTIONS
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Print the notification ball to see unread messages.
|
||||
*
|
||||
@ -533,7 +538,11 @@ function notifications_print_ball()
|
||||
$num_notifications = messages_get_count();
|
||||
$class_status = ($num_notifications == 0) ? 'notification-ball-no-messages' : 'notification-ball-new-messages';
|
||||
return sprintf(
|
||||
'<div class="notification-ball %s" id="notification-ball-header">
|
||||
'<div
|
||||
onclick="addNotifications(event)"
|
||||
class="notification-ball %s"
|
||||
id="notification-ball-header"
|
||||
>
|
||||
%s
|
||||
</div>',
|
||||
$class_status,
|
||||
@ -807,3 +816,58 @@ function notifications_print_user_switch($source, $user, $label)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates the dropdown notifications menu.
|
||||
*
|
||||
* @return string HTML with dropdown menu.
|
||||
*/
|
||||
function notifications_print_dropdown()
|
||||
{
|
||||
$mess = messages_get_overview('status', 'DESC', false, true);
|
||||
if ($mess === false) {
|
||||
$mess = [];
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
"<div class='notification-wrapper' style='display:none;'>
|
||||
%s
|
||||
</div>",
|
||||
array_reduce(
|
||||
$mess,
|
||||
function ($carry, $message) {
|
||||
return $carry.notifications_print_dropdown_element($message);
|
||||
},
|
||||
''
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a single notification box
|
||||
*
|
||||
* @param array $message_info Info of printed message.
|
||||
*
|
||||
* @return string HTML code of single message
|
||||
*/
|
||||
function notifications_print_dropdown_element($message_info)
|
||||
{
|
||||
return sprintf(
|
||||
"<div class='notification-item'>
|
||||
<img src='%s'>
|
||||
<div class='notification-info'>
|
||||
<h4 class='notification-title'>
|
||||
%s
|
||||
</h4>
|
||||
<p class='notification-subtitle'>
|
||||
%s
|
||||
</p>
|
||||
</div>
|
||||
</div>",
|
||||
html_print_image('images/'.$message_info['icon'], true),
|
||||
$message_info['description'],
|
||||
$message_info['mensaje']
|
||||
);
|
||||
}
|
||||
|
@ -4929,6 +4929,59 @@ div#dialog_messages table th:last-child {
|
||||
background-color: #fc4444;
|
||||
}
|
||||
|
||||
.notification-wrapper {
|
||||
background: white;
|
||||
border: #a5a5a5 solid 1px;
|
||||
z-index: 900000;
|
||||
position: absolute;
|
||||
width: 400px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
.notification-wrapper::before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 0px;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-width: 12px;
|
||||
border-style: solid;
|
||||
bottom: 100%;
|
||||
left: 78%;
|
||||
left: calc(78% - 2px);
|
||||
margin-left: -12px;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
.notification-item {
|
||||
background: whitesmoke;
|
||||
height: 100px;
|
||||
margin: 7px;
|
||||
border: #cccccc solid 1px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
.notification-item > * {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.notification-info {
|
||||
width: 87%;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
}
|
||||
.notification-item img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.notification-title {
|
||||
margin: 0;
|
||||
}
|
||||
.notification-subtitle {
|
||||
margin: 0;
|
||||
color: #373737;
|
||||
}
|
||||
|
||||
.global-config-notification-title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
Loading…
x
Reference in New Issue
Block a user