mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2012-03-08 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql, extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql, extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added the field shortcut_data for to save as serialize the quick links. * general/shortcut_bar.php: added code to new feature to save in the sortcut the important links for quick access. * include/functions_menu.php, godmode/agentes/modificar_agente.php: added class "item_drag_shortcut" to links for drag to shorcut. For make a example. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5729 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
93e51b8144
commit
1da151df03
@ -1,3 +1,17 @@
|
|||||||
|
2012-03-08 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql,
|
||||||
|
extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: added the field
|
||||||
|
shortcut_data for to save as serialize the quick links.
|
||||||
|
|
||||||
|
* general/shortcut_bar.php: added code to new feature to save in the
|
||||||
|
sortcut the important links for quick access.
|
||||||
|
|
||||||
|
* include/functions_menu.php, godmode/agentes/modificar_agente.php: added
|
||||||
|
class "item_drag_shortcut" to links for drag to shorcut. For make a example.
|
||||||
|
|
||||||
2012-03-08 Sancho Lerena <slerena@artica.es>
|
2012-03-08 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* include/functions_visual_map.php
|
* include/functions_visual_map.php
|
||||||
|
@ -55,6 +55,7 @@ CREATE TABLE IF NOT EXISTS `tnetflow_report_content` (
|
|||||||
|
|
||||||
ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0;
|
ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0;
|
||||||
ALTER TABLE `tusuario` ADD COLUMN `shortcut` tinyint(1) DEFAULT 0;
|
ALTER TABLE `tusuario` ADD COLUMN `shortcut` tinyint(1) DEFAULT 0;
|
||||||
|
ALTER TABLE tusuario ADD COLUMN `shortcut_data` text default '';
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tincidencia`
|
-- Table `tincidencia`
|
||||||
|
@ -168,9 +168,15 @@ ALTER TABLE tgraph ADD (id_graph_template NUMBER(11, 0) default 0 NOT NULL);
|
|||||||
-- Table `ttipo_modulo`
|
-- Table `ttipo_modulo`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1;
|
UPDATE ttipo_modulo SET descripcion='Generic data' WHERE id_tipo=1;
|
||||||
|
|
||||||
UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4;
|
UPDATE ttipo_modulo SET descripcion='Generic data incremental' WHERE id_tipo=4;
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `tusuario`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
ALTER TABLE tusuario ADD COLUMN disabled NUMBER(10, 0) NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE tusuario ADD COLUMN shortcut NUMBER(5, 0) DEFAULT 0;
|
||||||
|
ALTER TABLE tusuario ADD COLUMN shortcut_data CLOB default '';
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tusuario`
|
-- Table `tusuario`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@ -155,9 +155,15 @@ ALTER TABLE "tgraph" ADD COLUMN "id_graph_template" INTEGER NOT NULL default 0;
|
|||||||
-- Table `ttipo_modulo`
|
-- Table `ttipo_modulo`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
UPDATE "ttipo_modulo" SET "descripcion"='Generic data' WHERE "id_tipo"=1;
|
UPDATE "ttipo_modulo" SET "descripcion"='Generic data' WHERE "id_tipo"=1;
|
||||||
|
|
||||||
UPDATE "ttipo_modulo" SET "descripcion"='Generic data incremental' WHERE "id_tipo"=4;
|
UPDATE "ttipo_modulo" SET "descripcion"='Generic data incremental' WHERE "id_tipo"=4;
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `tusuario`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
ALTER TABLE "tusuario" ADD COLUMN "disabled" INTEGER NOT NULL DEFAULT 0;
|
||||||
|
ALTER TABLE "tusuario" ADD COLUMN "shortcut" SMALLINT DEFAULT 0;
|
||||||
|
ALTER TABLE "tusuario" ADD COLUMN "shortcut_data" text default '';
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `tusuario`
|
-- Table `tusuario`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
@ -14,215 +14,268 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
$shortcut_state = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $config['id_user']));
|
global $config;
|
||||||
|
|
||||||
// If shortcut bar is disabled return to index.php
|
// Login check
|
||||||
if ($shortcut_state == 0)
|
check_login ();
|
||||||
return;
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()){
|
||||||
require_once("include/functions_events.php");
|
require_once("include/functions_reporting.php");
|
||||||
|
|
||||||
|
$save_item_shorcut = get_parameter("save_item_shorcut", 0);
|
||||||
|
|
||||||
|
if ($save_item_shorcut) {
|
||||||
|
$data = get_parameter("data", '');
|
||||||
|
$id_user = get_parameter('id_user', 0);
|
||||||
|
|
||||||
|
if ($config['id_user'] != $id_user) return;
|
||||||
|
|
||||||
$update_shortcut_state = get_parameter('update_shortcut_state', 0);
|
$shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $id_user);
|
||||||
$get_critical_events = get_parameter('get_critical_events', 0);
|
if ($shortcut_data !== false) {
|
||||||
$get_opened_incidents = get_parameter('get_opened_incidents', 0);
|
$serialize = $shortcut_data;
|
||||||
|
$unserialize = json_decode($serialize, true);
|
||||||
// Update if shortcut is visible or hidden
|
|
||||||
if ($update_shortcut_state){
|
$unserialize['item_shorcut'][] = $data;
|
||||||
$value = get_parameter('value', 0);
|
$shortcut_data = array();
|
||||||
db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['id_user']));
|
$shortcut_data['shortcut_data'] = json_encode($unserialize);
|
||||||
|
|
||||||
|
db_process_sql_update('tusuario', $shortcut_data, array('id_user' => $id_user));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get critical events (realtime update)
|
|
||||||
if ($get_critical_events){
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
|
||||||
|
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
|
||||||
else
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
|
||||||
|
|
||||||
// Get events in the last 8 hours
|
|
||||||
$shortcut_events_update = events_get_group_events($own_groups, 28800, time());
|
|
||||||
if ($shortcut_events_update == false)
|
|
||||||
$shortcut_events_update = array();
|
|
||||||
|
|
||||||
$critical_events_update = 0;
|
|
||||||
foreach($shortcut_events_update as $event_update){
|
|
||||||
if ($event_update['criticity'] == 4 and $event_update['estado'] == 0){
|
|
||||||
$critical_events_update++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $critical_events_update;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select only opened incidents
|
|
||||||
if ($get_opened_incidents){
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
|
||||||
|
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
|
||||||
else
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
|
||||||
|
|
||||||
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
|
||||||
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
|
||||||
ORDER BY actualizacion";
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($own_groups)){
|
|
||||||
$result_incidents_update = db_get_all_rows_sql ($sql);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$result_incidents_update = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result_incidents_update === false)
|
|
||||||
$shortcut_incidents = 0;
|
|
||||||
else
|
|
||||||
$shortcut_incidents = $result_incidents_update[0]['total_incidents'];
|
|
||||||
|
|
||||||
echo $shortcut_incidents;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$shortcut_state = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $config['id_user']));
|
||||||
|
|
||||||
if ($shortcut_state == 2){
|
// If shortcut bar is disabled return to index.php
|
||||||
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 40px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
if ($shortcut_state == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
require_once("include/functions_events.php");
|
||||||
|
|
||||||
|
|
||||||
|
$update_shortcut_state = get_parameter('update_shortcut_state', 0);
|
||||||
|
$get_critical_events = get_parameter('get_critical_events', 0);
|
||||||
|
$get_opened_incidents = get_parameter('get_opened_incidents', 0);
|
||||||
|
|
||||||
|
// Update if shortcut is visible or hidden
|
||||||
|
if ($update_shortcut_state){
|
||||||
|
$value = get_parameter('value', 0);
|
||||||
|
db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['id_user']));
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 0px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
// Get critical events (realtime update)
|
||||||
}
|
if ($get_critical_events){
|
||||||
html_print_image("images/pandora_textlogo.png", false, array("title" => __("Press here to activate shortcut bar")));
|
|
||||||
echo "</div>";
|
|
||||||
if ($shortcut_state == 2){
|
|
||||||
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 20px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 0px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo " ";
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
|
||||||
|
|
||||||
// If user is admin can see all groups
|
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
|
||||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&filter_button=Filter'>";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "AR", false));
|
|
||||||
if (!empty($own_groups)){
|
|
||||||
$alerts_group = array_shift($own_groups);
|
|
||||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&ag_group=$alerts_group&filter_button=Filter'>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;"));
|
|
||||||
echo " ";
|
|
||||||
|
|
||||||
// Calculate alerts fired
|
|
||||||
$data_reporting = reporting_get_group_stats();
|
|
||||||
|
|
||||||
echo "<span id='shortcut_alerts_fired' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Alerts fired') . "'>" . $data_reporting['monitor_alerts_fired'] . "</span>";
|
|
||||||
if (!empty($own_groups)){
|
|
||||||
echo "</a>";
|
|
||||||
}
|
|
||||||
echo " ";
|
|
||||||
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
|
||||||
|
|
||||||
// If user is admin can see all groups
|
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
|
||||||
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&filter_only_alert=-1'>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
|
||||||
if (!empty($own_groups)){
|
|
||||||
$events_group = array_shift($own_groups);
|
|
||||||
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&ev_group=$events_group&filter_only_alert=-1'>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;"));
|
|
||||||
echo " ";
|
|
||||||
|
|
||||||
// Calculate critical events (not validated)
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
$own_info = get_user_info ($config['id_user']);
|
||||||
|
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
||||||
else
|
else
|
||||||
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||||
|
|
||||||
// Get events in the last 8 hours
|
// Get events in the last 8 hours
|
||||||
$shortcut_events = events_get_group_events($own_groups, 28800, time());
|
$shortcut_events_update = events_get_group_events($own_groups, 28800, time());
|
||||||
if ($shortcut_events == false)
|
if ($shortcut_events_update == false)
|
||||||
$shortcut_events = array();
|
$shortcut_events_update = array();
|
||||||
|
|
||||||
|
$critical_events_update = 0;
|
||||||
|
foreach($shortcut_events_update as $event_update){
|
||||||
|
if ($event_update['criticity'] == 4 and $event_update['estado'] == 0) {
|
||||||
|
$critical_events_update++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $critical_events_update;
|
||||||
|
}
|
||||||
|
|
||||||
$critical_events = 0;
|
// Select only opened incidents
|
||||||
foreach($shortcut_events as $event){
|
if ($get_opened_incidents) {
|
||||||
if ($event['criticity'] == 4 and $event['estado'] == 0){
|
$own_info = get_user_info ($config['id_user']);
|
||||||
$critical_events++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<span id='shortcut_critical_events' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Critical events') . "'>" . $critical_events . "</span>";
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||||
echo "</a>";
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
||||||
echo " ";
|
else
|
||||||
// Calculate opened incidents (id integria incidents are not enabled)
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||||
if ($config['integria_enabled'] == 0){
|
|
||||||
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
|
|
||||||
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;"));
|
|
||||||
echo " ";
|
|
||||||
// Select only opened incidents
|
|
||||||
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
|
||||||
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
|
||||||
ORDER BY actualizacion";
|
|
||||||
|
|
||||||
if (!empty($own_groups)){
|
|
||||||
$result_incidents = db_get_all_rows_sql ($sql);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$result_incidents = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result_incidents === false)
|
|
||||||
$shortcut_incidents = 0;
|
|
||||||
else
|
|
||||||
$shortcut_incidents = $result_incidents[0]['total_incidents'];
|
|
||||||
|
|
||||||
|
|
||||||
echo "<span id='shortcut_incidents_opened' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Incidents opened') . "'>" . $shortcut_incidents . "</span>";
|
|
||||||
echo "</a>";
|
|
||||||
echo " ";
|
|
||||||
}
|
|
||||||
echo " ";
|
|
||||||
echo "<span style='font-size: 9pt; color:#696969; font-weight: bold;'>|</span>";
|
|
||||||
echo " ";
|
|
||||||
echo " ";
|
|
||||||
|
|
||||||
echo "<a href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting'>";
|
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
||||||
html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;"));
|
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
||||||
echo "</a>";
|
ORDER BY actualizacion";
|
||||||
|
|
||||||
echo " ";
|
|
||||||
|
if (!empty($own_groups)) {
|
||||||
echo "<a href='index.php?sec=messages&sec2=operation/messages/message'>";
|
$result_incidents_update = db_get_all_rows_sql ($sql);
|
||||||
html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;"));
|
|
||||||
echo "</a>";
|
|
||||||
|
|
||||||
// Login in Console and shortcut bar is disabled
|
|
||||||
// This will show and hide the shortcut value in Javascript code
|
|
||||||
if (isset($_POST['nick']) and $shortcut_state != 2){
|
|
||||||
html_print_input_hidden("login_console", 1);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html_print_input_hidden("login_console", 0);
|
$result_incidents_update = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($result_incidents_update === false)
|
||||||
|
$shortcut_incidents = 0;
|
||||||
|
else
|
||||||
|
$shortcut_incidents = $result_incidents_update[0]['total_incidents'];
|
||||||
|
|
||||||
html_print_input_hidden("shortcut_id_user", $config['id_user']);
|
echo $shortcut_incidents;
|
||||||
echo "</div>";
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($shortcut_state == 2) {
|
||||||
|
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 40px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 0px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
||||||
|
}
|
||||||
|
html_print_image("images/pandora_textlogo.png", false, array("title" => __("Press here to activate shortcut bar")));
|
||||||
|
echo "</div>";
|
||||||
|
if ($shortcut_state == 2) {
|
||||||
|
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 20px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 0px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " ";
|
||||||
|
$own_info = get_user_info ($config['id_user']);
|
||||||
|
|
||||||
|
// If user is admin can see all groups
|
||||||
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
||||||
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&filter_button=Filter'>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$own_groups = array_keys(users_get_groups($config['id_user'], "AR", false));
|
||||||
|
if (!empty($own_groups)) {
|
||||||
|
$alerts_group = array_shift($own_groups);
|
||||||
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&ag_group=$alerts_group&filter_button=Filter'>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;"));
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
// Calculate alerts fired
|
||||||
|
$data_reporting = reporting_get_group_stats();
|
||||||
|
|
||||||
|
echo "<span id='shortcut_alerts_fired' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Alerts fired') . "'>" . $data_reporting['monitor_alerts_fired'] . "</span>";
|
||||||
|
if (!empty($own_groups)){
|
||||||
|
echo "</a>";
|
||||||
|
}
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
$own_info = get_user_info ($config['id_user']);
|
||||||
|
|
||||||
|
// If user is admin can see all groups
|
||||||
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
||||||
|
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&filter_only_alert=-1'>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||||
|
if (!empty($own_groups)){
|
||||||
|
$events_group = array_shift($own_groups);
|
||||||
|
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&ev_group=$events_group&filter_only_alert=-1'>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;"));
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
// Calculate critical events (not validated)
|
||||||
|
$own_info = get_user_info ($config['id_user']);
|
||||||
|
|
||||||
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||||
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
||||||
|
else
|
||||||
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
||||||
|
|
||||||
|
// Get events in the last 8 hours
|
||||||
|
$shortcut_events = events_get_group_events($own_groups, 28800, time());
|
||||||
|
if ($shortcut_events == false)
|
||||||
|
$shortcut_events = array();
|
||||||
|
|
||||||
|
$critical_events = 0;
|
||||||
|
foreach($shortcut_events as $event){
|
||||||
|
if ($event['criticity'] == 4 and $event['estado'] == 0){
|
||||||
|
$critical_events++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<span id='shortcut_critical_events' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Critical events') . "'>" . $critical_events . "</span>";
|
||||||
|
echo "</a>";
|
||||||
|
echo " ";
|
||||||
|
// Calculate opened incidents (id integria incidents are not enabled)
|
||||||
|
if ($config['integria_enabled'] == 0){
|
||||||
|
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
|
||||||
|
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;"));
|
||||||
|
echo " ";
|
||||||
|
// Select only opened incidents
|
||||||
|
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
||||||
|
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
||||||
|
ORDER BY actualizacion";
|
||||||
|
|
||||||
|
if (!empty($own_groups)) {
|
||||||
|
$result_incidents = db_get_all_rows_sql ($sql);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$result_incidents = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($result_incidents === false)
|
||||||
|
$shortcut_incidents = 0;
|
||||||
|
else
|
||||||
|
$shortcut_incidents = $result_incidents[0]['total_incidents'];
|
||||||
|
|
||||||
|
|
||||||
|
echo "<span id='shortcut_incidents_opened' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Incidents opened') . "'>" . $shortcut_incidents . "</span>";
|
||||||
|
echo "</a>";
|
||||||
|
echo " ";
|
||||||
|
}
|
||||||
|
echo " ";
|
||||||
|
echo "<span style='font-size: 9pt; color:#696969; font-weight: bold;'>|</span>";
|
||||||
|
echo " ";
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
echo "<a href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting'>";
|
||||||
|
html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;"));
|
||||||
|
echo "</a>";
|
||||||
|
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
echo "<a href='index.php?sec=messages&sec2=operation/messages/message'>";
|
||||||
|
html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;"));
|
||||||
|
echo "</a>";
|
||||||
|
|
||||||
|
// Login in Console and shortcut bar is disabled
|
||||||
|
// This will show and hide the shortcut value in Javascript code
|
||||||
|
if (isset($_POST['nick']) and $shortcut_state != 2){
|
||||||
|
html_print_input_hidden("login_console", 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
html_print_input_hidden("login_console", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_input_hidden("shortcut_id_user", $config['id_user']);
|
||||||
|
|
||||||
|
|
||||||
|
//Quick access
|
||||||
|
$shortcut_data = db_get_value('shortcut_data', 'tusuario', 'id_user', $config['id_user']);
|
||||||
|
if (!empty($shortcut_data)) {
|
||||||
|
$serialize = $shortcut_data;
|
||||||
|
$unserialize = json_decode($serialize, true);
|
||||||
|
|
||||||
|
$items = $unserialize['item_shorcut'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$items = array();
|
||||||
|
}
|
||||||
|
echo "<div id='shortcut_icons_box' style='font-size: 9pt; color:#696969; font-weight: bold; display: inline; float: right; padding-right: 20px;'>" .
|
||||||
|
__("Shortcut: ");
|
||||||
|
echo "<ul style='display: inline; font-size: 9pt; color:#000;'>";
|
||||||
|
foreach ($items as $item) {
|
||||||
|
echo "<li style='display: inline; padding-right: 10px;'>" . io_safe_output($item) . "</li>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -308,8 +361,42 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
//TODO: Fix the change the content for the menu as html.
|
||||||
setInterval("shortcut_check_alerts()", (10 * 1000)); //10 seconds between ajax request
|
setInterval("shortcut_check_alerts()", (10 * 1000)); //10 seconds between ajax request
|
||||||
setInterval("shortcut_check_events()", (10 * 1000)); //10 seconds between ajax request
|
setInterval("shortcut_check_events()", (10 * 1000)); //10 seconds between ajax request
|
||||||
setInterval("shortcut_check_incidents()", (10 * 1000)); //10 seconds between ajax request
|
setInterval("shortcut_check_incidents()", (10 * 1000)); //10 seconds between ajax request
|
||||||
|
|
||||||
|
//For to make a link as item for drag only put "item_drag_shortcut" as class.
|
||||||
|
|
||||||
|
//TODO: In the future show better as icons and the handle some icon.
|
||||||
|
//TODO: Remove the class "item_drag_shortcut" for avoid drag.
|
||||||
|
//TODO: Method for remove items.
|
||||||
|
|
||||||
|
$("#shortcut_icons_box").droppable({
|
||||||
|
drop: function( event, ui ) {
|
||||||
|
var item = ui.draggable.clone();
|
||||||
|
//unescape for avoid change returns
|
||||||
|
var content_item = unescape($('<div id="content_item"></div>').html(item).html()); //hack
|
||||||
|
|
||||||
|
//Add the element
|
||||||
|
$("<li style='display: inline; padding-right: 10px;'></li>").html(item).appendTo($("#shortcut_icons_box > ul"));
|
||||||
|
|
||||||
|
jQuery.post ('ajax.php',
|
||||||
|
{"page": "general/shortcut_bar",
|
||||||
|
"save_item_shorcut": 1,
|
||||||
|
"id_user": "<?php echo $config['id_user'];?>",
|
||||||
|
"data": content_item
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".item_drag_shortcut").draggable({
|
||||||
|
appendTo: 'body',
|
||||||
|
helper: "clone",
|
||||||
|
scroll: false
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -401,7 +401,7 @@ if ($agents !== false) {
|
|||||||
echo "<em>";
|
echo "<em>";
|
||||||
}
|
}
|
||||||
echo '<span class="left">';
|
echo '<span class="left">';
|
||||||
echo "<strong><a href='index.php?sec=gagente&
|
echo "<strong><a class='item_drag_shortcut' href='index.php?sec=gagente&
|
||||||
sec2=godmode/agentes/configurar_agente&tab=main&
|
sec2=godmode/agentes/configurar_agente&tab=main&
|
||||||
id_agente=".$agent["id_agente"]."'>" . ui_print_truncate_text($agent["nombre"], 60, true, true, true, '[…]', 'font-size: 7pt')."</a></strong>";
|
id_agente=".$agent["id_agente"]."'>" . ui_print_truncate_text($agent["nombre"], 60, true, true, true, '[…]', 'font-size: 7pt')."</a></strong>";
|
||||||
if ($agent["disabled"]) {
|
if ($agent["disabled"]) {
|
||||||
|
@ -184,7 +184,7 @@ function menu_print_menu (&$menu) {
|
|||||||
} else {
|
} else {
|
||||||
$title = '';
|
$title = '';
|
||||||
}
|
}
|
||||||
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&sec2='.$subsec2.($sub["refr"] ? '&refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
|
$submenu_output .= '<a class="item_drag_shortcut" href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&sec2='.$subsec2.($sub["refr"] ? '&refr=' . $sub["refr"] : '').$link_add.'"' . $title . '>'.$sub["text"].'</a>';
|
||||||
$submenu_output .= '</li>';
|
$submenu_output .= '</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,6 +869,7 @@ CREATE TABLE tusuario (
|
|||||||
id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL,
|
id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL,
|
||||||
disabled NUMBER(10, 0) default 0 NOT NULL,
|
disabled NUMBER(10, 0) default 0 NOT NULL,
|
||||||
shortcut NUMBER(5, 0) DEFAULT 0,
|
shortcut NUMBER(5, 0) DEFAULT 0,
|
||||||
|
shortcut_data CLOB default '',
|
||||||
section VARCHAR2(255) NOT NULL,
|
section VARCHAR2(255) NOT NULL,
|
||||||
data_section VARCHAR2(255) NOT NULL
|
data_section VARCHAR2(255) NOT NULL
|
||||||
);
|
);
|
||||||
|
@ -699,6 +699,7 @@ CREATE TABLE "tusuario" (
|
|||||||
"id_skin" INTEGER NOT NULL DEFAULT 0,
|
"id_skin" INTEGER NOT NULL DEFAULT 0,
|
||||||
"disabled" INTEGER NOT NULL default 1,
|
"disabled" INTEGER NOT NULL default 1,
|
||||||
"shortcut" SMALLINT DEFAULT 0,
|
"shortcut" SMALLINT DEFAULT 0,
|
||||||
|
"shortcut_data" text default '',
|
||||||
"section" varchar(255) NOT NULL,
|
"section" varchar(255) NOT NULL,
|
||||||
"data_section" varchar(255) NOT NULL
|
"data_section" varchar(255) NOT NULL
|
||||||
);
|
);
|
||||||
|
@ -774,6 +774,7 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
|
|||||||
`id_skin` int(10) unsigned NOT NULL,
|
`id_skin` int(10) unsigned NOT NULL,
|
||||||
`disabled` int(4) NOT NULL DEFAULT 0,
|
`disabled` int(4) NOT NULL DEFAULT 0,
|
||||||
`shortcut` tinyint(1) DEFAULT 0,
|
`shortcut` tinyint(1) DEFAULT 0,
|
||||||
|
`shortcut_data` text default '',
|
||||||
`section` TEXT NOT NULL,
|
`section` TEXT NOT NULL,
|
||||||
`data_section` TEXT NOT NULL,
|
`data_section` TEXT NOT NULL,
|
||||||
UNIQUE KEY `id_user` (`id_user`)
|
UNIQUE KEY `id_user` (`id_user`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user