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 <miguel.dedios@artica.es> + + * 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 <miguel.dedios@artica.es> * 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 "<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{ +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"))); @@ -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 "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&filter_button=Filter'>"; } else { @@ -154,7 +154,7 @@ echo " "; $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)){ +if (!empty($own_groups)) { echo "</a>"; } 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 "<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 { @@ -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 "<span id='shortcut_critical_events' style='font-size: 9pt; color:#696969; echo "</a>"; echo " "; // Calculate opened incidents (id integria incidents are not enabled) -if ($config['integria_enabled'] == 0){ +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 " "; @@ -242,7 +242,7 @@ 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){ +if (isset($_POST['nick']) and $shortcut_state != 2) { html_print_input_hidden("login_console", 1); } else { @@ -334,7 +334,7 @@ echo "</div>"; } ); } - + function shortcut_check_events() { jQuery.post ("ajax.php", {"page" : "general/shortcut_bar", @@ -344,7 +344,7 @@ echo "</div>"; $('#shortcut_critical_events').text(data); } ); - } + } function shortcut_check_incidents() { jQuery.post ("ajax.php", @@ -355,8 +355,8 @@ echo "</div>"; $('#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 "</div>"; $("<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) { - } + {"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", diff --git a/pandora_console/images/add.disabled.png b/pandora_console/images/add.disabled.png new file mode 100644 index 0000000000..9f4c26e3f1 Binary files /dev/null and b/pandora_console/images/add.disabled.png differ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 5e5fd07e2b..8f107bc3aa 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1649,12 +1649,12 @@ function get_periods ($custom = true, $show_default = true) { $periods = array (); - if($custom) { + if ($custom) { $periods[-1] = __('custom'); - } + } - if(empty($config['interval_values'])) { - if($show_default) { + if (empty($config['interval_values'])) { + if ($show_default) { $periods[SECONDS_5MINUTES] = sprintf(__('%s minutes'), '5'); $periods[SECONDS_30MINUTES] = sprintf(__('%s minutes'), '30 '); $periods[SECONDS_1HOUR] = __('1 hour'); @@ -1680,7 +1680,7 @@ function get_periods ($custom = true, $show_default = true) { $periods[$v] = human_time_description_raw ($v, true); } } - + return $periods; } diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 2a7cd47eb6..d70db9f730 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -143,7 +143,7 @@ $idx = 0; foreach ($result as $event) { $data = array (); - if($meta) { + if ($meta) { $event['server_url_hash'] = $servers_url_hash[$event['server_id']]; $event['server_url'] = $servers[$event['server_id']]['server_url']; $event['server_name'] = $servers[$event['server_id']]['server_name']; @@ -151,7 +151,7 @@ foreach ($result as $event) { // Clean url from events and store in array $event['clean_tags'] = events_clean_tags($event['tags']); - + //First pass along the class of this row $myclass = get_priority_class ($event["criticity"]); $table->rowclass[] = $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] .= '</a> '; } - + // 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 '<div id="events_list">'; if (!empty ($table->data)) { echo '<div style="clear:both"></div>'; - if($allow_pagination) { + if ($allow_pagination) { ui_pagination ($total_events, $url, $offset, $pagination); } - if($allow_action) { + if ($allow_action) { echo '<form method="post" id="form_events" action="'.$url.'">'; echo "<input type='hidden' name='delete' id='hidden_delete_events' value='0' />"; } - + html_print_table ($table); - if($allow_action) { + if ($allow_action) { echo '<div style="width:'.$table->width.';" class="action-buttons">'; 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"');