diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 537e392b70..9944117ac3 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-07-19 Sergio Martin + + * godmode/modules/manage_network_components_form.php + godmode/modules/manage_network_components_form_plugin.php: Fix some + bugs as allow delete first macro, show at least one macro, etc. + 2012-07-19 Sergio Martin * godmode/modules/manage_network_components_form.php diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 72b08c6a84..57056d956b 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -481,10 +481,14 @@ type_change (); // Functions to add and remove dynamic fields for macros function delete_macro() { - var next_row = parseInt($('#next_row').html()); - $('#next_row').html(next_row-2); var next_number = parseInt($('#next_macro').html()); + // Is not possible delete first macro + if(next_number == 3) { + $('#delete_macro_button').hide(); + } + var next_row = parseInt($('#next_row').html()); $('#next_macro').html(next_number-1); + $('#next_row').html(next_row-2); var nrow1 = next_row - 2; var nrow2 = next_row - 1; @@ -494,6 +498,8 @@ function delete_macro() { } function new_macro() { + $('#delete_macro_button').show(); + var next_row = parseInt($('#next_row').html()); $('#next_row').html(next_row+2); diff --git a/pandora_console/godmode/modules/manage_network_components_form_plugin.php b/pandora_console/godmode/modules/manage_network_components_form_plugin.php index 8c46c0f4a0..0806c11ab8 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_plugin.php +++ b/pandora_console/godmode/modules/manage_network_components_form_plugin.php @@ -65,7 +65,8 @@ $macros = json_decode($macros,true); $next_name_number = 5; $i = 1; while(1) { - if(!isset($macros[$i]) || $macros[$i]['desc'] == '') { + // Always print at least one macro + if((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) { break; } $macro_desc_name = 'field'.$i.'_desc'; @@ -120,7 +121,7 @@ while(1) { $data[1] = __('Add macro').' '.html_print_image('images/add.png',true).''; $data[1] .= ''; $data[1] .= ''; - $data[2] = __('Delete macro').' '.html_print_image('images/cancel.png',true).''; + $data[2] = ''; push_table_row ($data, 'plugin_n'); ?>