From 7feab70ec508d51ab3596d0f35654419a55423e8 Mon Sep 17 00:00:00 2001 From: guruevi Date: Mon, 9 Mar 2009 20:47:42 +0000 Subject: [PATCH] 2009-03-09 Evi Vanoost * include/javascript/pandora.js: Moved agent_changed here from map_builder because it's quite a useful function. * include/functions_visual_map.php: In case you want no labels (a lot of icons on a graph) just set the color to anything not starting with # * godmode/reporting/map_builder_wizard.php: Added the possibility to add modules as well using the wizard. Very useful if you have a switch. * godmode/reporting/map_builder.php: Fixed some issues with the ajax thing and fixed issue #2527894. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1521 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 +++ .../godmode/reporting/map_builder.php | 72 ++++----------- .../godmode/reporting/map_builder_wizard.php | 92 +++++++++++++++---- .../include/functions_visual_map.php | 10 +- pandora_console/include/javascript/pandora.js | 34 +++++++ 5 files changed, 148 insertions(+), 74 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e294903ab9..75a63660fd 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2009-03-09 Evi Vanoost + + * include/javascript/pandora.js: Moved agent_changed here from map_builder + because it's quite a useful function. + + * include/functions_visual_map.php: In case you want no labels (a lot of + icons on a graph) just set the color to anything not starting with # + + * godmode/reporting/map_builder_wizard.php: Added the possibility to add + modules as well using the wizard. Very useful if you have a switch. + + * godmode/reporting/map_builder.php: Fixed some issues with the ajax thing + and fixed issue #2527894. + 2009-03-05 Evi Vanoost * godmode/reporting/map_builder_wizard.php: Fixed small error when no diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index cb6864787f..b8cfc398f3 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -88,9 +88,9 @@ if ($delete_layout) { if ($update_layout) { $name = (string) get_parameter ('name'); - $id_group = (int) get_parameter ('id_group'); - $width = (int) get_parameter ('width'); - $height = (int) get_parameter ('height'); + $id_group = (int) get_parameter ('id_group', 1); + $width = (int) get_parameter ('width', 0); + $height = (int) get_parameter ('height', 0); $background = (string) get_parameter ('background'); $bg_info = array (0, 0); if (file_exists ('images/console/background/'.$background)) @@ -101,15 +101,10 @@ if ($update_layout) { if (! $height) $height = $bg_info[1]; - $result = process_sql_update ('tlayout', - array ('name' => $name, 'background' => $background, - 'height' => $height, 'width' => $width), - array ('id' => $id_layout)); - if ($result) { - echo '

'.__('Update layout successful').'

'; - } else { - echo '

'.__('Update layout failed').'

'; - } + $result = process_sql_update ('tlayout', array ('name' => $name, 'background' => $background, 'height' => $height, 'width' => $width, 'id_group' => $id_group), array ('id' => $id_layout)); + + print_error_message ($result, __('Update layout successful'), __('Update layout failed')); + if (is_ajax ()) { exit; } @@ -377,18 +372,18 @@ if (! $edit_layout && ! $id_layout) { /* Layout_data editor form */ $intervals = array (); - $intervals[1] = __('Hour'); - $intervals[2] = "2 ".__('Hours'); - $intervals[3] = "3 ".__('Hours'); - $intervals[6] = "6 ".__('Hours'); - $intervals[12] = "12 ".__('Hours'); - $intervals[24] = __('Last day'); - $intervals[48] = "2 ". __('days'); - $intervals[168] = __('Last week'); - $intervals[360] = __('15 days'); - $intervals[720] = __('Last Month'); - $intervals[1440] = __('Two Months'); - $intervals[4320] = __('Six Months'); + $intervals[3600] = __('Hour'); + $intervals[7200] = "2 ".__('Hours'); + $intervals[10800] = "3 ".__('Hours'); + $intervals[21600] = "6 ".__('Hours'); + $intervals[43200] = "12 ".__('Hours'); + $intervals[86400] = __('Last day'); + $intervals[172800] = "2 ". __('days'); + $intervals[1209600] = __('Last week'); + $intervals[2419200] = __('15 days'); + $intervals[4838400] = __('Last Month'); + $intervals[9676800] = __('Two Months'); + $intervals[29030400] = __('Six Months'); $agents = get_group_agents ($id_group); @@ -451,33 +446,6 @@ require_javascript_file ('wz_jsgraphics'); require_javascript_file ('pandora_visual_console'); ?> \ No newline at end of file diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index b201e29bdd..809362bf51 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -89,7 +89,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = $z_index = 1; // Print BAD over good // Draw image - echo '
'; + echo '
'; if (!isset($id_agent)) $id_agent = 0; @@ -144,9 +144,11 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = echo ""; - // Print label - echo "
"; - echo $layout_data['label']; + // Print label if valid label_color (only testing for starting with #) otherwise print nothing + if ($layout_data['label_color'][0] == '#') { + echo "
"; + echo $layout_data['label']; + } echo "
"; } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index b8a0befa1a..a53acf432b 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -50,3 +50,37 @@ Array.prototype.in_array = function () { } return false; } + +/** + * Fill up select box with id "module" with modules after agent has been selected + * + * @param event that has been triggered + * @param id_agent Agent ID that has been selected + * @param selected Which module(s) have to be selected + */ +function agent_changed (event, id_agent, selected) { + if (id_agent == undefined) + id_agent = this.value; + $('#module').attr ('disabled', 1); + $('#module').empty (); + $('#module').append ($('').html ("...").attr ("value", 0)); + jQuery.post ('ajax.php', + {"page": "operation/agentes/ver_agente", + "get_agent_modules_json": 1, + "id_agent": id_agent + }, + function (data) { + $('#module').empty (); + $('#module').append ($('').html ("").attr ("value", 0)); + jQuery.each (data, function (i, val) { + s = html_entity_decode (val['nombre']); + $('#module').append ($('').html (s).attr ("value", val['id_agente_modulo'])); + $('#module').fadeIn ('normal'); + }); + if (selected != undefined) + $('#module').attr ('value', selected); + $('#module').attr ('disabled', 0); + }, + "json" + ); +}