diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b06d043ec6..e728b4c226 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,23 @@ +2009-03-13 Esteban Sanchez + + * godmode/db/db_purge.php: Style correction. + + * godmode/modules/manage_nc_groups.php: Complete rewritten. + + * godmode/modules/manage_nc_groups_form.php: Use pandora functions. + Needs more love. + + * godmode/reporting/map_builder.php: Some fixes to make it work in + IE7. + + * include/javascript/jquery.pandora.controls.js: Execute automatically + instead of on ready. Typo fixed that was not allowing to work on IE. + + * include/styles/ie.css: Bit of style corrections. + + * include/functions_ui.php: Added the ie.css code at the bottom, so it + has preferences over other styles. + 2009-03-12 Evi Vanoost * include/functions.php: Added safe_output_xml which makes variables diff --git a/pandora_console/godmode/db/db_purge.php b/pandora_console/godmode/db/db_purge.php index 407bc8735d..6804bc4d87 100644 --- a/pandora_console/godmode/db/db_purge.php +++ b/pandora_console/godmode/db/db_purge.php @@ -36,8 +36,6 @@ if (isset ($_POST["agent"])){ $id_agent = -1; } - - echo '

'.__('Database Maintenance').' > '.__('Database purge').'



@@ -84,7 +82,7 @@ if (isset($_POST["purgedb"])) { echo "

".__('Please be patient. This operation can take a long time depending on the amount of modules.')."

"; $sql = sprintf ("SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = %d", $id_agent); - $result=get_db_all_rows_sql ($sql); + $result = get_db_all_rows_sql ($sql); if (empty ($result)) { $result = array (); } @@ -103,10 +101,10 @@ if (isset($_POST["purgedb"])) { $errors++; $sql = sprintf ("DELETE FROM `tagente_datos_inc` WHERE `id_agente_modulo` = %d AND `utimestamp` < %d",$row["id_agente_modulo"],$from_date); if (process_sql ($sql) === false) - $errors++; + $errors++; $sql = sprintf ("DELETE FROM `tagente_datos_string` WHERE `id_agente_modulo` = %d AND `utimestamp` < %d",$row["id_agente_modulo"],$from_date); if (process_sql ($sql) === false) - $errors++; + $errors++; } if ($errors > 0) { diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index 370f4bb4f6..ccd062e4f7 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -27,86 +27,84 @@ if (! give_acl ($config['id_user'], 0, "PM")) { require ("general/noaccess.php"); exit; } - -if (isset($_GET["create"])){ // Create module - $name = entrada_limpia ($_POST["name"]); - $parent = entrada_limpia ($_POST["parent"]); - $sql_insert="INSERT INTO tnetwork_component_group (name,parent) - VALUES ('$name', '$parent')"; - $result=mysql_query($sql_insert); - if (! $result) - echo "

".__('Not created. Error inserting data')."

"; - else { - echo "

".__('Created successfully')."

"; - $id_sg = mysql_insert_id(); - } -} -if (isset($_GET["update"])){ // if modified any parameter - $id_sg = entrada_limpia ($_GET["id_sg"]); - $name = entrada_limpia ($_POST["name"]); - $parent = entrada_limpia ($_POST["parent"]); - $sql_update ="UPDATE tnetwork_component_group - SET name = '$name', parent = '$parent' - WHERE id_sg = '$id_sg'"; - $result=mysql_query($sql_update); - if (! $result) - echo "

".__('Not updated. Error updating data')."

"; - else - echo "

".__('Updated successfully')."

"; -} +$create = (bool) get_parameter ('create'); +$update = (bool) get_parameter ('update'); +$delete = (bool) get_parameter ('delete'); -if (isset($_GET["delete"])){ // if delete - $id_sg = entrada_limpia ($_GET["id_sg"]); - $sql_delete= "DELETE FROM tnetwork_component_group WHERE id_sg = ".$id_sg; - $result=mysql_query($sql_delete); - if (! $result) - echo "

".__('Not deleted. Error deleting data')."

"; - else - echo "

".__('Deleted successfully')."

"; +echo '

'.__('Module management').' > '. __('Component group management').'

'; + +if ($create) { + $name = (string) get_parameter ('name'); + $parent = (int) get_parameter ('parent'); - $result=mysql_query($sql_delete); + $result = process_sql_insert ('tnetwork_component_group', + array ('name' => $name, + 'parent' => $parent)); + print_error_message ($result, + __('Created successfully'), + __('Not created. Error inserting data')); } -echo "

".__('Module management')." > "; -echo __('Component group management')."

"; - -echo ""; -echo ""; -echo ""; -echo ""; -$sql1='SELECT * FROM tnetwork_component_group ORDER BY parent'; -$result=mysql_query($sql1); -$color=0; -while ($row=mysql_fetch_array($result)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - echo " - - - - "; +if ($update) { + $id = (int) get_parameter ('id_sg'); + $name = (string) get_parameter ('name'); + $parent = (int) get_parameter ('parent'); + + $result = process_sql_update ('tnetwork_component_group', + array ('name' => $name, + 'parent' => $parent), + array ('id_sg' => $id)); + print_error_message ($result, + __('Updated successfully'), + __('Not updated. Error updating data')); } -echo "
".__('Name')."".__('Parent')."".__('Delete')."
- ".$row["name"]." - - ".give_network_component_group_name ($row["parent"])." - - - -
"; -echo ''; -echo '
'; -echo "
"; -echo ""; -echo "
"; +if ($delete) { // if delete + $id = (int) get_parameter ('id_sg'); + + $result = process_sql_delete ('tnetwork_component_group', + array ('id_sg' => $id)); + print_error_message ($result, + __('Deleted successfully'), + __('Not deleted. Error deleting data')); +} + +$table->width = '90%'; +$table->head = array (); +$table->head[0] = __('Name'); +$table->head[1] = __('Parent'); +$table->head[2] = __('Delete'); +$table->style = array (); +$table->style[0] = 'font-weight: bold'; +$table->align = array (); +$table->align[2] = 'center'; +$table->data = array (); + +$groups = get_db_all_rows_filter ('tnetwork_component_group', + array ('order' => 'parent')); +if ($groups === false) + $groups = array (); + +foreach ($groups as $group) { + $data = array (); + + $data[0] = ''.$group["name"].''; + + $data[1] = give_network_component_group_name ($group["parent"]); + $data[2] = ' + '; + + array_push ($table->data, $data); +} + +print_table ($table); + +echo '
'; +echo '
'; +print_input_hidden ('create', 1); +print_submit_button (__('Create'), 'crt', false, 'class="sub next"'); +echo '
'; +echo '
'; ?> diff --git a/pandora_console/godmode/modules/manage_nc_groups_form.php b/pandora_console/godmode/modules/manage_nc_groups_form.php index 6a850f309b..804df639c4 100644 --- a/pandora_console/godmode/modules/manage_nc_groups_form.php +++ b/pandora_console/godmode/modules/manage_nc_groups_form.php @@ -27,22 +27,25 @@ if (! give_acl ($config['id_user'], 0, "PM")) { require ("general/noaccess.php"); exit; } - -if (isset($_GET["edit"])){ // Edit mode + +$create = (bool) get_parameter ('create'); +$edit = (bool) get_parameter ('edit'); + +if ($edit) { // Edit mode $id_sg = entrada_limpia ($_GET["id_sg"]); $sql1 = "SELECT * FROM tnetwork_component_group where id_sg = $id_sg"; $result=mysql_query($sql1); $row=mysql_fetch_array($result); $name = $row["name"]; $parent = $row["parent"]; -} elseif (isset($_GET["create"])){ +} elseif ($create) { $id_sg = -1; $name = ""; $parent = ""; } echo "

".__('Component group management')."

"; -echo ''; +echo '
'; // Different Form url if it's a create or if it's a update form if ($id_sg != -1) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 95b589e061..f1ebc1caa6 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -528,7 +528,13 @@ $(document).ready (function () { $("#form_layout_data_editor #map_linked").attr ('value', data['id_layout_linked']); $("#form_layout_data_editor #hidden-update_layout_data").attr ('value', 1); $("#form_layout_data_editor #hidden-create_layout_data").attr ('value', 0); - $("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id); + if (jQuery.browser.msie) { + $("#form_layout_data_editor #hidden-id_layout_data").remove (); + input = $('').attr ('value', id); + $("#form_layout_data_editor").append (input); + } else { + $("#form_layout_data_editor #hidden-id_layout_data").attr ('value', id); + } $("#form_layout_data_editor #submit-create_layout_data_button").attr ('value', "").removeClass ('wand').addClass ('upd'); $("#form_layout_data_editor #text-label_color").attr ('value', data['label_color']); $(".ColorPickerDivSample").css ('background-color', data['label_color']); @@ -542,9 +548,10 @@ $(document).ready (function () { accept: ".layout-data", drop: function (ev, ui) { image = $('#'+ ui.draggable[0].id + " img").eq (0); - elements = $("#" + this.id + " img").length; + total = $("img", this).length; + id = ui.draggable[0].id.split ("-").pop (); - $(ui.draggable[0]).clone ().css ('margin-left', 60 * elements). + $(ui.draggable[0]).clone ().css ('margin-left', 60 * total). css ('margin-top', 0). attr ('id', 'delete-layout-data-' + id). appendTo ("#"+this.id + " #elements"); $(ui.draggable[0]).remove (); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 9eec8c1b4c..1b54d1133f 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -567,9 +567,6 @@ function process_page_head ($string, $bitfield) { - '; if ($config["language"] != "en") { @@ -661,7 +658,12 @@ function process_page_head ($string, $bitfield) { $output .= ''."\n\t"; } } - + + + $output .= ''; + $output .= $string; return $output; diff --git a/pandora_console/include/javascript/jquery.pandora.controls.js b/pandora_console/include/javascript/jquery.pandora.controls.js index a62d2df676..524dfbc7bb 100644 --- a/pandora_console/include/javascript/jquery.pandora.controls.js +++ b/pandora_console/include/javascript/jquery.pandora.controls.js @@ -1,4 +1,4 @@ -$(document).ready (function () { +(function($) { var dummyFunc = function () { return; }; @@ -109,6 +109,6 @@ $(document).ready (function () { }); $.fn.extend({ pandoraSelectGroup: $.pandoraSelectGroup.construct, - pandoraSelectAgent: $.pandoraSelectAgent.construct, + pandoraSelectAgent: $.pandoraSelectAgent.construct }); -}); +}) (jQuery); diff --git a/pandora_console/include/styles/ie.css b/pandora_console/include/styles/ie.css index e1bd2e9646..3d5411915b 100644 --- a/pandora_console/include/styles/ie.css +++ b/pandora_console/include/styles/ie.css @@ -34,3 +34,11 @@ * html .timeEntry_control { /* IE only */ margin-top: -4px; } + +table#simple input#text-snmp_oid { + width: 70%; +} + +div.configuration { + margin-top: -20px; +}