diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fd9c844ef7..710ea32d9c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-02-25 Miguel de Dios + + * godmode/modules/manage_network_components_form_common.php, + godmode/massive/massive_edit_modules.php, + include/functions_api.php: improved the form of modules the part + of critical and warning widgets. + + Fixes: #3605482 + 2013-02-22 Sergio Martin * include/functions_html.php diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a1e586e766..d94389b89b 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -276,25 +276,78 @@ $table->data[4][3] = html_print_select (array(), 'module[]', $table->data['edit1'][0] = __('Warning status'); -$table->data['edit1'][1] = '' . __('Min.') . ''; -$table->data['edit1'][1] .= html_print_input_text('min_warning', '', '', - 5, 15, true); -$table->data['edit1'][1] .= '
' . __('Max.') . ''; -$table->data['edit1'][1] .= html_print_input_text ('max_warning', '', '', 5, 15, true); -$table->data['edit1'][1] .= '
'.__('Str.').''; -$table->data['edit1'][1] .= html_print_input_text ('str_warning', '', '', 5, 15, true); -$table->data['edit1'][1] .= '
'.__('Inverse interval').''; -$table->data['edit1'][1] .= html_print_checkbox ("warning_inverse", 1, '', true); +$table->data['edit1'][1] = ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; +$table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= '' . __('Min.') . ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text('min_warning', + '', '', 5, 15, true); + $table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= '' . __('Max.') . ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text ('max_warning', '', '', 5, 15, true); + $table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= ''.__('Str.').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text ('str_warning', '', '', 5, 15, true); + $table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= ''.__('Inverse interval').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_checkbox ("warning_inverse", 1, '', true); + $table->data['edit1'][1] .= '
'; $table->data['edit1'][2] = __('Critical status'); -$table->data['edit1'][3] = ''.__('Min.').''; -$table->data['edit1'][3] .= html_print_input_text ('min_critical', '', '', 5, 15, true); -$table->data['edit1'][3] .= '
'.__('Max.').''; -$table->data['edit1'][3] .= html_print_input_text ('max_critical', '', '', 5, 15, true); -$table->data['edit1'][3] .= '
'.__('Str.').''; -$table->data['edit1'][3] .= html_print_input_text ('str_critical', '', '', 5, 15, true); -$table->data['edit1'][3] .= '
'.__('Inverse interval').''; -$table->data['edit1'][3] .= html_print_checkbox ("critical_inverse", 1, '', true); +$table->data['edit1'][3] = ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; +$table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= '' . __('Min.') . ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text('min_critical', + '', '', 5, 15, true); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= '' . __('Max.') . ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text ('max_critical', '', '', 5, 15, true); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Str.').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text ('str_critical', '', '', 5, 15, true); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Inverse interval').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_checkbox ("critical_inverse", 1, '', true); + $table->data['edit1'][3] .= '
'; $table->data['edit2'][0] = __('Interval'); $table->data['edit2'][1] = html_print_extended_select_for_time ('module_interval', 0, '', __('No change'), '0', 10, true, 'width: 150px'); diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index d4db6e8ff6..afc30b3fcb 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -51,11 +51,11 @@ $table->data = array (); $table->data[0][0] = __('Name'); $table->data[0][1] = html_print_input_text ('name', $name, '', 55, 255, true); -if(enterprise_installed()) { +if (enterprise_installed()) { if(defined('METACONSOLE')) { $table->data[0][2] = __('Wizard level'); $wizard_levels = array('basic' => __('Basic'), - 'advanced' => __('Advanced')); + 'advanced' => __('Advanced')); $table->data[0][3] = html_print_select($wizard_levels,'wizard_level',$wizard_level,'','',-1,true, false, false); } else { @@ -71,9 +71,25 @@ $sql = sprintf ('SELECT id_tipo, descripcion ORDER BY descripcion', implode (',', $categories)); $table->data[1][1] = html_print_select_from_sql ($sql, 'type', - $type, ($id_component_type == 2 ? 'type_change()' : ''), '', '', true, + $type, '', '', '', true, false, false, false, true, false, false, false, 0); +// Store the relation between id and name of the types on a hidden field +$sql = sprintf ('SELECT id_tipo, nombre + FROM ttipo_modulo + WHERE categoria IN (%s) + ORDER BY descripcion', + implode (',', $categories)); +$type_names = db_get_all_rows_sql($sql); + +$type_names_hash = array(); +foreach($type_names as $tn) { + $type_names_hash[$tn['id_tipo']] = $tn['nombre']; +} + +$table->data[1][1] .= html_print_input_hidden('type_names', + base64_encode(json_encode($type_names_hash)),true); + $table->data[1][2] = __('Module group'); $table->data[1][3] = html_print_select_from_sql ('SELECT id_mg, name FROM tmodule_group ORDER BY name', @@ -88,28 +104,28 @@ $table->data[2][3] = html_print_extended_select_for_time ('module_interval' , $m $table->data[3][0] = __('Warning status'); -$table->data[3][1] = ''.__('Min.').''; +$table->data[3][1] = ''.__('Min.').'  '; $table->data[3][1] .= html_print_input_text ('min_warning', $min_warning, '', 5, 15, true); -$table->data[3][1] .= '
'.__('Max.').''; +$table->data[3][1] .= '
'.__('Max.').' '; $table->data[3][1] .= html_print_input_text ('max_warning', $max_warning, - '', 5, 15, true); -$table->data[3][1] .= '
'.__('Str.').''; + '', 5, 15, true) . '
'; +$table->data[3][1] .= ''.__('Str.').'  '; $table->data[3][1] .= html_print_input_text ('str_warning', $str_warning, - '', 5, 15, true); + '', 5, 15, true) . ''; $table->data[3][1] .= '
'.__('Inverse interval').''; $table->data[3][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true); $table->data[3][2] = __('Critical status'); -$table->data[3][3] = ''.__('Min.').''; +$table->data[3][3] = ''.__('Min.').'  '; $table->data[3][3] .= html_print_input_text ('min_critical', $min_critical, '', 5, 15, true); -$table->data[3][3] .= '
'.__('Max.').''; +$table->data[3][3] .= '
'.__('Max.').' '; $table->data[3][3] .= html_print_input_text ('max_critical', $max_critical, - '', 5, 15, true); -$table->data[3][3] .= '
'.__('Str.').''; + '', 5, 15, true) . '
'; +$table->data[3][3] .= ''.__('Str.').'  '; $table->data[3][3] .= html_print_input_text ('str_critical', $str_critical, - '', 5, 15, true); + '', 5, 15, true) . ''; $table->data[3][3] .= '
'.__('Inverse interval').''; $table->data[3][3] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true); @@ -185,3 +201,30 @@ $table->data[$next_row][3] .= html_print_select_from_sql ( $next_row++; ?> + diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 7ef9d8627a..153c7952f2 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -166,7 +166,7 @@ function isInACL($ip) { // If the IP is not in the list, we check one by one, all the wildcard registers foreach($config['list_ACL_IPs_for_API'] as $acl_ip) { - if(preg_match('/\*/', $acl_ip)) { + if (preg_match('/\*/', $acl_ip)) { // Scape for protection $acl_ip = str_replace('.','\.',$acl_ip); @@ -175,7 +175,7 @@ function isInACL($ip) { $acl_ip = str_replace('*','.*',$acl_ip); // If the string match with the beginning of the IP give it access - if(preg_match('/'.$acl_ip.'/', $ip)) { + if (preg_match('/'.$acl_ip.'/', $ip)) { return true; } }