2012-07-19 Sergio Martin <sergio.martin@artica.es>

* 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.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6793 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-07-19 16:51:58 +00:00
parent c5b7b285b4
commit 4da392a6b2
3 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2012-07-19 Sergio Martin <sergio.martin@artica.es>
* 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 <sergio.martin@artica.es>
* godmode/modules/manage_network_components_form.php

View File

@ -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);

View File

@ -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').' <a href="javascript:new_macro()">'.html_print_image('images/add.png',true).'</a>';
$data[1] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
$data[1] .= '<div id="next_row" style="display:none">'.$next_name_number.'</div>';
$data[2] = __('Delete macro').' <a href="javascript:delete_macro()">'.html_print_image('images/cancel.png',true).'</a>';
$data[2] = '<div id="delete_macro_button" style="display:none;">'.__('Delete macro').' <a href="javascript:delete_macro()">'.html_print_image('images/cancel.png',true).'</a></div>';
push_table_row ($data, 'plugin_n');
?>