2009-11-27 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: add disabled parameter in functions, "print_input_password" and "print_checkbox". * godmode/agentes/module_manager_editor_common.php, godmode/agentes/module_manager_editor_network.php, godmode/agentes/module_manager_editor_wmi.php, godmode/agentes/module_manager_editor_plugin.php, godmode/agentes/module_manager_editor_prediction.php: check the module is in any policy and disable some form fields. Fixes: 2902631 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2138 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6eee94779b
commit
864840773b
|
@ -1,3 +1,15 @@
|
|||
2009-11-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_html.php: add disabled parameter in functions,
|
||||
"print_input_password" and "print_checkbox".
|
||||
* godmode/agentes/module_manager_editor_common.php,
|
||||
godmode/agentes/module_manager_editor_network.php,
|
||||
godmode/agentes/module_manager_editor_wmi.php,
|
||||
godmode/agentes/module_manager_editor_plugin.php,
|
||||
godmode/agentes/module_manager_editor_prediction.php: check the module is in
|
||||
any policy and disable some form fields.
|
||||
Fixes: 2902631
|
||||
|
||||
2009-11-26 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_alerts.php: add more values into function
|
||||
|
|
|
@ -90,6 +90,16 @@ function add_component_selection ($id_network_component_type) {
|
|||
}
|
||||
|
||||
require_once ('include/functions_network_components.php');
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
if ($config['enterprise_installed'] && ($id_agent_module != 0)) {
|
||||
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
}
|
||||
|
||||
$update_module_id = (int) get_parameter_get ('update_module');
|
||||
|
||||
|
@ -105,49 +115,50 @@ $table_simple->style[0] = 'font-weight: bold; vertical-align: top';
|
|||
$table_simple->style[2] = 'font-weight: bold; vertical-align: top';
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = print_input_text ('name', $name, '', 20, 100, true);
|
||||
$table_simple->data[0][1] = print_input_text ('name', $name, '', 20, 100, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[0][2] = __('Disabled');
|
||||
$table_simple->data[0][3] = print_checkbox ("disabled", 1, $disabled, true);
|
||||
|
||||
$table_simple->data[1][0] = __('Type').' '.print_help_icon ('module_type', true);
|
||||
if ($id_agent_module) {
|
||||
$table_simple->data[1][1] = '<em>'.get_moduletype_description ($id_module_type).'</em>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
$table_simple->data[1][1] = print_select_from_sql ($sql, 'id_module_type',
|
||||
'', '', '', '', true, false, false);
|
||||
'', '', '', '', true, false, false, $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
$table_simple->data[1][2] = __('Module group');
|
||||
$table_simple->data[1][3] = print_select_from_sql ('SELECT id_mg, name FROM tmodule_group ORDER BY name',
|
||||
'id_module_group', $id_module_group, '', __('Not assigned'), '0',
|
||||
true);
|
||||
true, false, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_simple->data[2][0] = __('Warning status');
|
||||
$table_simple->data[2][1] = '<em>'.__('Min.').'</em>';
|
||||
$table_simple->data[2][1] .= print_input_text ('min_warning', $min_warning,
|
||||
'', 5, 15, true);
|
||||
'', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[2][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[2][1] .= print_input_text ('max_warning', $max_warning,
|
||||
'', 5, 15, true);
|
||||
'', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[2][2] = __('Critical status');
|
||||
$table_simple->data[2][3] = '<em>'.__('Min.').'</em>';
|
||||
$table_simple->data[2][3] .= print_input_text ('min_critical', $min_critical,
|
||||
'', 5, 15, true);
|
||||
'', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[2][3] .= '<br /><em>'.__('Max.').'</em>';
|
||||
$table_simple->data[2][3] .= print_input_text ('max_critical', $max_critical,
|
||||
'', 5, 15, true);
|
||||
'', 5, 15, true, $disabledBecauseInPolicy);
|
||||
|
||||
/* FF stands for Flip-flop */
|
||||
$table_simple->data[3][0] = __('FF threshold').' '.print_help_icon ('ff_threshold', true);
|
||||
$table_simple->data[3][1] = print_input_text ('ff_event', $ff_event,
|
||||
'', 5, 15, true);
|
||||
'', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$table_simple->data[3][2] = __('Historical data');
|
||||
$table_simple->data[3][3] = print_checkbox ("history_data", 1, $history_data, true);
|
||||
$table_simple->data[3][3] = print_checkbox ("history_data", 1, $history_data, true, $disabledBecauseInPolicy);
|
||||
|
||||
/* Advanced form part */
|
||||
$table_advanced->id = 'advanced';
|
||||
|
@ -162,7 +173,7 @@ $table_advanced->colspan = array ();
|
|||
$table_advanced->data[0][0] = __('Description');
|
||||
$table_advanced->colspan[0][1] = 3;
|
||||
$table_advanced->data[0][1] = print_textarea ('description', 2, 65,
|
||||
$description, '', true);
|
||||
$description, $disabledTextBecauseInPolicy, true);
|
||||
|
||||
$table_advanced->data[1][0] = __('Custom ID');
|
||||
$table_advanced->data[1][1] = print_input_text ('custom_id', $custom_id,
|
||||
|
@ -170,19 +181,19 @@ $table_advanced->data[1][1] = print_input_text ('custom_id', $custom_id,
|
|||
|
||||
$table_advanced->data[2][0] = __('Interval');
|
||||
$table_advanced->data[2][1] = print_input_text ('module_interval', $interval,
|
||||
'', 5, 10, true);
|
||||
'', 5, 10, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[2][2] = __('Post process').' '.print_help_icon ('postprocess', true);
|
||||
$table_advanced->data[2][3] = print_input_text ('post_process',
|
||||
$post_process, '', 12, 25, true);
|
||||
$post_process, '', 12, 25, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[3][0] = __('Min. Value');
|
||||
$table_advanced->data[3][1] = print_input_text ('min', $min, '', 5, 15, true);
|
||||
$table_advanced->data[3][1] = print_input_text ('min', $min, '', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->data[3][2] = __('Max. Value');
|
||||
$table_advanced->data[3][3] = print_input_text ('max', $max, '', 5, 15, true);
|
||||
$table_advanced->data[3][3] = print_input_text ('max', $max, '', 5, 15, true, $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[4][0] = __('Export target');
|
||||
$table_advanced->data[4][1] = print_select_from_sql ('SELECT id, name FROM tserver_export ORDER BY name',
|
||||
'id_export', $id_export, '',__('None'),'0', true, false, false);
|
||||
'id_export', $id_export, '',__('None'),'0', true, false, false, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[4][1] = 3;
|
||||
?>
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
if ($config['enterprise_installed'] && ($id_agent_module != 0)) {
|
||||
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
}
|
||||
|
||||
define ('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||
|
||||
if (empty ($update_module_id)) {
|
||||
|
@ -28,7 +38,7 @@ $data = array ();
|
|||
$data[0] = __('Target IP');
|
||||
$data[1] = print_input_text ('ip_target', $ip_target, '', 15, 60, true);
|
||||
$data[2] = _('Port');
|
||||
$data[3] = print_input_text ('tcp_port', $tcp_port, '', 5, 20, true);
|
||||
$data[3] = print_input_text ('tcp_port', $tcp_port, '', 5, 20, true, $disabledBecauseInPolicy);
|
||||
|
||||
push_table_simple ($data, 'target_ip');
|
||||
|
||||
|
@ -37,16 +47,16 @@ $snmp_versions['2'] = 'v. 2';
|
|||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$data = array ();
|
||||
$data[0] = __('SNMP community');
|
||||
$data[1] = print_input_text ('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
$data[1] = print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy);
|
||||
|
||||
$data[2] = _('SNMP version');
|
||||
$snmp_version = 1;
|
||||
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||
$data[3] = print_select ($snmp_versions, 'snmp_version', $snmp_version,
|
||||
'', '', '', true);
|
||||
'', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
} else {
|
||||
$data[3] = print_select ($snmp_versions, 'snmp_version', 0, '', '',
|
||||
'', true);
|
||||
'', true, false, false, '', $disabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
push_table_simple ($data, 'snmp_1');
|
||||
|
@ -54,16 +64,24 @@ push_table_simple ($data, 'snmp_1');
|
|||
$data = array ();
|
||||
$data[0] = __('SNMP OID');
|
||||
$data[1] = '<span class="left"; style="width: 50%">';
|
||||
$data[1] .= print_input_text ('snmp_oid', $snmp_oid, '', 30, 120, true);
|
||||
$data[1] .= print_input_text ('snmp_oid', $snmp_oid, '', 30, 120, true, $disabledBecauseInPolicy);
|
||||
$data[1] .= '<span class="invisible" id="oid">';
|
||||
$data[1] .= print_select (array (), 'select_snmp_oid', $snmp_oid, '', '', 0, true);
|
||||
$data[1] .= print_select (array (), 'select_snmp_oid', $snmp_oid, '', '', 0, true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= '<img src="images/edit.png" class="invisible clickable" id="edit_oid" />';
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '<span id="no_snmp" class="error invisible">'.__('Unable to do SNMP walk').'</span>';
|
||||
$data[1] .= '</span> <span class="right" style="width: 50%; text-align: right"><span id="oid_loading" class="invisible">';
|
||||
$data[1] .= '<img src="images/spinner.png" />';
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= print_button (__('SNMP walk'), 'snmp_walk', $ip_target == '', '',
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disableButton = true;
|
||||
else
|
||||
if ($ip_target == '')
|
||||
$disableButton = true;
|
||||
else
|
||||
$disableButton = false;
|
||||
|
||||
$data[1] .= print_button (__('SNMP walk'), 'snmp_walk', $disableButton, '',
|
||||
'class="sub next"', true);
|
||||
$data[1] .= print_help_icon ('snmpwalk', true);
|
||||
$data[1] .= '</span>';
|
||||
|
@ -74,13 +92,13 @@ push_table_simple ($data, 'snmp_2');
|
|||
/* Advanced stuff */
|
||||
$data = array ();
|
||||
$data[0] = __('TCP send').' '.print_help_icon ("tcp_send", true);
|
||||
$data[1] = print_textarea ('tcp_send', 2, 65, $tcp_send, '', true);
|
||||
$data[1] = print_textarea ('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true);
|
||||
$table_advanced->colspan['tcp_send'][1] = 3;
|
||||
|
||||
push_table_advanced ($data, 'tcp_send');
|
||||
|
||||
$data[0] = __('TCP receive');
|
||||
$data[1] = print_textarea ('tcp_rcv', 2, 65, $tcp_rcv, '', true);
|
||||
$data[1] = print_textarea ('tcp_rcv', 2, 65, $tcp_rcv, $disabledTextBecauseInPolicy, true);
|
||||
$table_advanced->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_advanced ($data, 'tcp_receive');
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
if ($config['enterprise_installed'] && ($id_agent_module != 0)) {
|
||||
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
}
|
||||
|
||||
define ('ID_NETWORK_COMPONENT_TYPE', 4);
|
||||
|
||||
if (empty ($update_module_id)) {
|
||||
|
@ -27,7 +37,7 @@ $extra_title = __('Plugin server module');
|
|||
$data = array ();
|
||||
$data[0] = __('Plugin');
|
||||
$data[1] = print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name',
|
||||
'id_plugin', $id_plugin, '', __('None'), 0, true, false, false);
|
||||
'id_plugin', $id_plugin, '', __('None'), 0, true, false, false, $disabledBecauseInPolicy);
|
||||
$table_simple->colspan['plugin_1'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'plugin_1');
|
||||
|
@ -51,7 +61,7 @@ push_table_simple ($data, 'plugin_2');
|
|||
$data = array ();
|
||||
$data[0] = __('Plugin parameters');
|
||||
$data[0] .= print_help_icon ('plugin_parameters', true);
|
||||
$data[1] = print_input_text ('plugin_parameter', $plugin_parameter, '', 255, 255, true);
|
||||
$data[1] = print_input_text ('plugin_parameter', $plugin_parameter, '', 255, 255, true, $disabledBecauseInPolicy);
|
||||
$table_simple->colspan['plugin_3'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'plugin_3');
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
if ($config['enterprise_installed'] && ($id_agent_module != 0)) {
|
||||
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
}
|
||||
|
||||
$extra_title = __('Prediction server module');
|
||||
|
||||
|
@ -32,19 +41,19 @@ $modules = get_agent_modules ($prediction_id_agent, false, 'disabled = 0 AND his
|
|||
|
||||
$data[1] = '<label for="prediction_id_group">'.__('Group').'</label>';
|
||||
$data[1] .= print_select ($groups, 'prediction_id_group', $prediction_id_group, '',
|
||||
'', '', true);
|
||||
'', '', true, false, true, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= ' <span id="agent_loading" class="invisible">';
|
||||
$data[1] .= '<img src="images/spinner.png" />';
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '<label for="prediction_id_agent">'.__('Agent').'</label>';
|
||||
$data[1] .= print_select ($agents, 'prediction_id_agent', $prediction_id_agent, '',
|
||||
'', '', true);
|
||||
'', '', true, false, true, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= ' <span id="module_loading" class="invisible">';
|
||||
$data[1] .= '<img src="images/spinner.png" />';
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '<label for="prediction_module">'.__('Module').'</label>';
|
||||
$data[1] .= print_select ($modules, 'prediction_module', $prediction_module, '',
|
||||
'', '', true);
|
||||
'', '', true, false, true, '', $disabledBecauseInPolicy);
|
||||
|
||||
$table_simple->colspan['prediction_module'][1] = 3;
|
||||
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
if ($config['enterprise_installed'] && ($id_agent_module != 0)) {
|
||||
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
}
|
||||
|
||||
$extra_title = __('WMI server module');
|
||||
|
||||
|
@ -29,7 +38,7 @@ $data[0] = __('Target IP');
|
|||
$data[1] = print_input_text ('ip_target', $ip_target, '', 15, 60, true);
|
||||
$data[2] = _('Namespace');
|
||||
$data[2] .= print_help_icon ('wminamespace', true);
|
||||
$data[3] = print_input_text ('tcp_send', $tcp_send, '', 5, 20, true);
|
||||
$data[3] = print_input_text ('tcp_send', $tcp_send, '', 5, 20, true, $disabledBecauseInPolicy);
|
||||
|
||||
push_table_simple ($data, 'target_ip');
|
||||
|
||||
|
@ -44,7 +53,7 @@ push_table_simple ($data, 'user_pass');
|
|||
$data = array ();
|
||||
$data[0] = __('WMI query');
|
||||
$data[0] .= print_help_icon ('wmiquery', true);
|
||||
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 35, 255, true);
|
||||
$data[1] = print_input_text ('snmp_oid', $snmp_oid, '', 35, 255, true, $disabledBecauseInPolicy);
|
||||
$table_simple->colspan['wmi_query'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'wmi_query');
|
||||
|
@ -52,10 +61,10 @@ push_table_simple ($data, 'wmi_query');
|
|||
$data = array ();
|
||||
$data[0] = __('Key string');
|
||||
$data[0] .= print_help_icon ('wmikey', true);
|
||||
$data[1] = print_input_text ('snmp_community', $snmp_community, '', 20, 60, true);
|
||||
$data[1] = print_input_text ('snmp_community', $snmp_community, '', 20, 60, true, $disabledBecauseInPolicy);
|
||||
$data[2] = __('Field number');
|
||||
$data[2] .= print_help_icon ('wmifield', true);
|
||||
$data[3] = print_input_text ('tcp_port', $tcp_port, '', 5, 15, true);
|
||||
$data[3] = print_input_text ('tcp_port', $tcp_port, '', 5, 15, true, $disabledBecauseInPolicy);
|
||||
|
||||
push_table_simple ($data, 'key_field');
|
||||
?>
|
||||
|
|
|
@ -383,11 +383,12 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
|
|||
* @param int $size Size of the input (optional).
|
||||
* @param int $maxlength Maximum length allowed (optional).
|
||||
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param bool $disabled Disable the button (optional, button enabled by default).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false) {
|
||||
$output = print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, false, '', '', true, true);
|
||||
function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false) {
|
||||
$output = print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', '', true, true);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
@ -917,11 +918,12 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
|
|||
* @param string Input value.
|
||||
* @param string Set the button to be marked (optional, unmarked by default).
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param bool $disabled Disable the button (optional, button enabled by default).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_checkbox ($name, $value, $checked = false, $return = false) {
|
||||
$output = print_checkbox_extended ($name, $value, (bool) $checked, false, '', '', true);
|
||||
function print_checkbox ($name, $value, $checked = false, $return = false, $disabled = false) {
|
||||
$output = print_checkbox_extended ($name, $value, (bool) $checked, $disabled, '', '', true);
|
||||
|
||||
if ($return === false)
|
||||
echo $output;
|
||||
|
|
Loading…
Reference in New Issue