From ff86b65c6501265ce7a01b33d33bb36a2fb577a7 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 25 Feb 2013 16:21:11 +0000 Subject: [PATCH] 2013-02-25 Miguel de Dios * include/functions.php, operation/events/events.build_table.php, general/shortcut_bar.php: improved the code style. * images/add.disabled.png: added lost icon file for alerts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7717 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++ pandora_console/general/shortcut_bar.php | 46 +++++++++--------- pandora_console/images/add.disabled.png | Bin 0 -> 442 bytes pandora_console/include/functions.php | 10 ++-- .../operation/events/events.build_table.php | 22 ++++----- 5 files changed, 46 insertions(+), 39 deletions(-) create mode 100644 pandora_console/images/add.disabled.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c299d49d85..1ed6e877b0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-02-25 Miguel de Dios + + * include/functions.php, operation/events/events.build_table.php, + general/shortcut_bar.php: improved the code style. + + * images/add.disabled.png: added lost icon file for alerts. + 2013-02-25 Miguel de Dios * include/functions_api.php, operation/agentes/alerts_status.php: diff --git a/pandora_console/general/shortcut_bar.php b/pandora_console/general/shortcut_bar.php index 6cff9d69a7..e60c10019a 100644 --- a/pandora_console/general/shortcut_bar.php +++ b/pandora_console/general/shortcut_bar.php @@ -19,11 +19,11 @@ global $config; // Login check check_login (); -if (is_ajax()){ +if (is_ajax()) { 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); @@ -51,14 +51,14 @@ if (is_ajax()){ $get_opened_incidents = get_parameter('get_opened_incidents', 0); // Update if shortcut is visible or hidden - if ($update_shortcut_state){ + if ($update_shortcut_state) { $value = get_parameter('value', 0); db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['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")) @@ -121,7 +121,7 @@ if ($shortcut_state == 0) if ($shortcut_state == 2) { echo "
"; } -else{ +else { echo "
"; } html_print_image("images/pandora_textlogo.png", false, array("title" => __("Press here to activate shortcut bar"))); @@ -137,7 +137,7 @@ 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")){ +if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) { echo ""; } else { @@ -154,7 +154,7 @@ echo " "; $data_reporting = reporting_get_group_stats(); echo "" . $data_reporting['monitor_alerts_fired'] . ""; -if (!empty($own_groups)){ +if (!empty($own_groups)) { echo ""; } echo "     "; @@ -162,7 +162,7 @@ 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")){ +if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) { echo ""; } else { @@ -189,7 +189,7 @@ if ($shortcut_events == false) $shortcut_events = array(); $critical_events = 0; -foreach($shortcut_events as $event){ +foreach ($shortcut_events as $event) { if ($event['criticity'] == 4 and $event['estado'] == 0) { $critical_events++; } @@ -199,7 +199,7 @@ echo ""; html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;")); echo " "; @@ -242,7 +242,7 @@ echo ""; // 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){ +if (isset($_POST['nick']) and $shortcut_state != 2) { html_print_input_hidden("login_console", 1); } else { @@ -334,7 +334,7 @@ echo "
"; } ); } - + function shortcut_check_events() { jQuery.post ("ajax.php", {"page" : "general/shortcut_bar", @@ -344,7 +344,7 @@ echo "
"; $('#shortcut_critical_events').text(data); } ); - } + } function shortcut_check_incidents() { jQuery.post ("ajax.php", @@ -355,8 +355,8 @@ echo ""; $('#shortcut_incidents_opened').text(data); } ); - } - + } + $(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 @@ -379,17 +379,17 @@ echo ""; $("
  • ").html(item).appendTo($("#shortcut_icons_box > ul")); jQuery.post ('ajax.php', - {"page": "general/shortcut_bar", - "save_item_shorcut": 1, - "id_user": "", - "data": content_item - }, - function (data) { - } + {"page": "general/shortcut_bar", + "save_item_shorcut": 1, + "id_user": "", + "data": content_item + }, + function (data) { + } ); } }); - + $(".item_drag_shortcut").draggable({ appendTo: 'body', helper: "clone", diff --git a/pandora_console/images/add.disabled.png b/pandora_console/images/add.disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..9f4c26e3f18559d49b2881cb14aecc586d7cc68a GIT binary patch literal 442 zcmV;r0Y(0aP)Q|*A4h+)bV@O5bC>5^b zrAQ=H38o5@PER3`NI)VH%N&?=2>H_L8LC7=(yaV&hO8TjipAN&6QUV)9#UP k9rowclass[] = $myclass; @@ -195,20 +195,20 @@ foreach ($result as $event) { $data[$i] .= html_print_input_hidden('similar_ids_' . $event["id_evento"], $similar_ids, true); $data[$i] .= html_print_input_hidden('timestamp_first_' . $event["id_evento"], $timestamp_first, true); $data[$i] .= html_print_input_hidden('timestamp_last_' . $event["id_evento"], $timestamp_last, true); - + // Store server id if is metaconsole. 0 otherwise - if($meta) { + if ($meta) { $server_id = $event['server_id']; // If meta activated, propagate the id of the event on node (source id) $data[$i] .= html_print_input_hidden('source_id_' . $event["id_evento"], $event['id_source_event'], true); - } + } else { $server_id = 0; } $data[$i] .= html_print_input_hidden('server_id_' . $event["id_evento"], $server_id, true); - + if (empty($event['event_rep'])) { $event['event_rep'] = 0; } @@ -426,7 +426,7 @@ foreach ($result as $event) { array ("title" => __('Validate event'))); $data[$i] .= ' '; } - + // Delete event if (tags_check_acl ($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags']) == 1) { if($event['estado'] != 2) { @@ -470,18 +470,18 @@ foreach ($result as $event) { echo '
    '; if (!empty ($table->data)) { echo '
    '; - if($allow_pagination) { + if ($allow_pagination) { ui_pagination ($total_events, $url, $offset, $pagination); } - if($allow_action) { + if ($allow_action) { echo '
    '; echo ""; } - + html_print_table ($table); - if($allow_action) { + if ($allow_action) { echo '
    '; if (tags_check_acl ($config["id_user"], 0, "EW", $event['clean_tags']) == 1) { html_print_button(__('Validate selected'), 'validate_button', false, 'validate_selected();', 'class="sub ok"');