fixed ticket 4123 and 4124
This commit is contained in:
parent
aab6db3f65
commit
bc5f00a2e7
|
@ -33,6 +33,8 @@ $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
|||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
$classdisabledBecauseInPolicy = '';
|
||||
$largeclassdisabledBecauseInPolicy = '';
|
||||
$page = get_parameter('page', '');
|
||||
if (strstr($page, "policy_modules") === false) {
|
||||
if ($config['enterprise_installed']) {
|
||||
|
@ -41,8 +43,12 @@ if (strstr($page, "policy_modules") === false) {
|
|||
else {
|
||||
$disabledBecauseInPolicy = false;
|
||||
}
|
||||
if ($disabledBecauseInPolicy)
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
if ($disabledBecauseInPolicy){
|
||||
$disabledTextBecauseInPolicy = 'readonly = "yes"';
|
||||
$classdisabledBecauseInPolicy = 'readonly';
|
||||
$largeclassdisabledBecauseInPolicy = 'class = readonly';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
define ('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||
|
@ -68,7 +74,8 @@ if ($id_module_type >= 6 && $id_module_type <= 7) {
|
|||
}
|
||||
else {
|
||||
$data[2] = __('Port');
|
||||
$data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true, $disabledBecauseInPolicy);
|
||||
$data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
|
||||
push_table_simple ($data, 'target_ip');
|
||||
|
@ -85,7 +92,8 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
|||
$adopt = policies_is_module_adopt($id_agent_module);
|
||||
}
|
||||
if (!$adopt) {
|
||||
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
else {
|
||||
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 15, 60, true, false);
|
||||
|
@ -95,11 +103,13 @@ $data[2] = _('SNMP version');
|
|||
|
||||
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||
$data[3] = html_print_select ($snmp_versions, 'snmp_version', $tcp_send,
|
||||
'', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
'', '', '', true, false, false, '', $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
else {
|
||||
$data[3] = html_print_select ($snmp_versions, 'snmp_version', 0, '', '',
|
||||
'', true, false, false, '', $disabledBecauseInPolicy);
|
||||
'', true, false, false, '', $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
if($disabledBecauseInPolicy){
|
||||
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||
|
@ -111,7 +121,8 @@ push_table_simple ($data, 'snmp_1');
|
|||
$data = array ();
|
||||
$data[0] = __('SNMP OID');
|
||||
$data[1] = '<span class="left"; style="width: 50%">';
|
||||
$data[1] .= html_print_input_text ('snmp_oid', $snmp_oid, '', 30, 255, true, $disabledBecauseInPolicy);
|
||||
$data[1] .= html_print_input_text ('snmp_oid', $snmp_oid, '', 30, 255, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
$data[1] .= '<span class="invisible" id="oid">';
|
||||
$data[1] .= html_print_select (array (), 'select_snmp_oid', $snmp_oid, '', '', 0, true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= html_print_image("images/edit.png", true, array("class" => "invisible clickable", "id" => "edit_oid"));
|
||||
|
@ -128,13 +139,13 @@ push_table_simple ($data, 'snmp_2');
|
|||
/* Advanced stuff */
|
||||
$data = array ();
|
||||
$data[0] = __('TCP send') . ' ' . ui_print_help_icon ("tcp_send", true);
|
||||
$data[1] = html_print_textarea ('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true);
|
||||
$data[1] = html_print_textarea ('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$table_simple->colspan['tcp_send'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'tcp_send');
|
||||
|
||||
$data[0] = __('TCP receive');
|
||||
$data[1] = html_print_textarea ('tcp_rcv', 2, 65, $tcp_rcv, $disabledTextBecauseInPolicy, true);
|
||||
$data[1] = html_print_textarea ('tcp_rcv', 2, 65, $tcp_rcv, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$table_simple->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'tcp_receive');
|
||||
|
@ -173,27 +184,31 @@ else if ($id_agent_module === false) {
|
|||
|
||||
$data = array();
|
||||
$data[0] = __('Auth user');
|
||||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[1] = html_print_input_text ('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, '', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] = html_print_input_password ('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
$data[3] .= html_print_input_hidden('active_snmp_v3', 0, true);
|
||||
if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row1'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row1');
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$data[1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[2] = __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$data[3] = html_print_input_password ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
$data[3] = html_print_input_password ('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true, $disabledBecauseInPolicy,
|
||||
false, $largeclassdisabledBecauseInPolicy);
|
||||
|
||||
if ($snmp_version != 3) $table_simple->rowstyle['field_snmpv3_row2'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row2');
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Auth method');
|
||||
$data[1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$data[1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[2] = __('Security level');
|
||||
$data[3] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_security_level', $snmp3_security_level, '', '', '', true);
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_security_level', $snmp3_security_level, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
if ($snmp_version != 3)
|
||||
$table_simple->rowstyle['field_snmpv3_row3'] = 'display: none;';
|
||||
push_table_simple($data, 'field_snmpv3_row3');
|
||||
|
@ -203,6 +218,24 @@ snmp_browser_print_container (false, '100%', '60%', 'none');
|
|||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#id_module_type").change(function (){
|
||||
if ((this.value == "17") || (this.value == "18") || (this.value == "16") || (this.value == "15")) {
|
||||
if ($("#snmp_version").val() == "3"){
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
$("#simple-field_snmpv3_row2").attr("style", "");
|
||||
$("#simple-field_snmpv3_row3").attr("style", "");
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
}
|
||||
} else {
|
||||
$("#simple-field_snmpv3_row1").css("display", "none");
|
||||
$("#simple-field_snmpv3_row2").css("display", "none");
|
||||
$("#simple-field_snmpv3_row3").css("display", "none");
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
if (this.value == "3") {
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
|
|
|
@ -21,14 +21,17 @@ $macros = $module['macros'];
|
|||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
$classdisabledBecauseInPolicy = '';
|
||||
$page = get_parameter('page', '');
|
||||
if (strstr($page, "policy_modules") === false) {
|
||||
if ($config['enterprise_installed'])
|
||||
$disabledBecauseInPolicy = policies_is_module_in_policy($id_agent_module) && policies_is_module_linked($id_agent_module);
|
||||
else
|
||||
$disabledBecauseInPolicy = false;
|
||||
if ($disabledBecauseInPolicy)
|
||||
if ($disabledBecauseInPolicy){
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
$classdisabledBecauseInPolicy = 'readonly';
|
||||
}
|
||||
}
|
||||
|
||||
define ('ID_NETWORK_COMPONENT_TYPE', 4);
|
||||
|
@ -93,7 +96,8 @@ if (!empty($macros)) {
|
|||
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 255, true);
|
||||
}
|
||||
else {
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true);
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true,
|
||||
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
|
||||
}
|
||||
$table_simple->colspan['macro'.$m['macro']][1] = 3;
|
||||
$table_simple->rowclass['macro'.$m['macro']] = 'macro_field';
|
||||
|
|
|
@ -16,14 +16,17 @@ enterprise_include_once('include/functions_policies.php');
|
|||
|
||||
$disabledBecauseInPolicy = false;
|
||||
$disabledTextBecauseInPolicy = '';
|
||||
$classdisabledBecauseInPolicy = '';
|
||||
$page = get_parameter('page', '');
|
||||
if (strstr($page, "policy_modules") === false) {
|
||||
if ($config['enterprise_installed'])
|
||||
$disabledBecauseInPolicy = policies_is_module_in_policy($id_agent_module) && policies_is_module_linked($id_agent_module);
|
||||
else
|
||||
$disabledBecauseInPolicy = false;
|
||||
if ($disabledBecauseInPolicy)
|
||||
if ($disabledBecauseInPolicy){
|
||||
$disabledTextBecauseInPolicy = 'disabled = "disabled"';
|
||||
$classdisabledBecauseInPolicy = 'readonly';
|
||||
}
|
||||
}
|
||||
|
||||
$extra_title = __('WMI server module');
|
||||
|
@ -43,22 +46,25 @@ $data[0] = __('Target IP');
|
|||
$data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true);
|
||||
$data[2] = __('Namespace');
|
||||
$data[2] .= ui_print_help_icon ('wminamespace', true);
|
||||
$data[3] = html_print_input_text ('tcp_send', $tcp_send, '', 5, 20, true, $disabledBecauseInPolicy);
|
||||
|
||||
$data[3] = html_print_input_text ('tcp_send', $tcp_send, '', 5, 20, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
push_table_simple ($data, 'target_ip');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('Username');
|
||||
$data[1] = html_print_input_text ('plugin_user', $plugin_user, '', 15, 60, true);
|
||||
$data[1] = html_print_input_text ('plugin_user', $plugin_user, '', 15, 60, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Password');
|
||||
$data[3] = html_print_input_password ('plugin_pass', $plugin_pass, '', 15, 60, true);
|
||||
$data[3] = html_print_input_password ('plugin_pass', $plugin_pass, '', 15, 60, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
|
||||
push_table_simple ($data, 'user_pass');
|
||||
|
||||
$data = array ();
|
||||
$data[0] = __('WMI query');
|
||||
$data[0] .= ui_print_help_icon ('wmiquery', true);
|
||||
$data[1] = html_print_input_text ('snmp_oid', $snmp_oid, '', 35, 255, true, $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_input_text ('snmp_oid', $snmp_oid, '', 35, 255, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
$table_simple->colspan['wmi_query'][1] = 3;
|
||||
|
||||
push_table_simple ($data, 'wmi_query');
|
||||
|
@ -66,10 +72,12 @@ push_table_simple ($data, 'wmi_query');
|
|||
$data = array ();
|
||||
$data[0] = __('Key string');
|
||||
$data[0] .= ui_print_help_icon ('wmikey', true);
|
||||
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 20, 60, true, $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 20, 60, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
$data[2] = __('Field number');
|
||||
$data[2] .= ui_print_help_icon ('wmifield', true);
|
||||
$data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 15, true, $disabledBecauseInPolicy);
|
||||
$data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 15, true, $disabledBecauseInPolicy, false,
|
||||
'', $classdisabledBecauseInPolicy);
|
||||
|
||||
push_table_simple ($data, 'key_field');
|
||||
?>
|
||||
|
|
|
@ -701,7 +701,8 @@ function html_print_extended_select_for_post_process($name, $selected = '',
|
|||
|
||||
function html_print_extended_select_for_time ($name, $selected = '',
|
||||
$script = '', $nothing = '', $nothing_value = '0', $size = false,
|
||||
$return = false, $select_style = false, $unique_name = true) {
|
||||
$return = false, $select_style = false, $unique_name = true, $class='',
|
||||
$readonly = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -756,12 +757,16 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
else {
|
||||
$uniq_name = $name;
|
||||
}
|
||||
|
||||
if ($readonly){
|
||||
$readonly = true;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
//Use the no_meta parameter because this image is only in the base console
|
||||
echo '<div id="'.$uniq_name.'_default" style="width:100%;display:inline;">';
|
||||
html_print_select ($fields, $uniq_name . '_select', $selected,"" . $script,
|
||||
$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
|
||||
$nothing, $nothing_value, false, false, false, $class, $readonly, 'font-size: xx-small;'.$select_style);
|
||||
echo ' <a href="javascript:">' .
|
||||
html_print_image('images/pencil.png', true,
|
||||
array('class' => $uniq_name . '_toggler',
|
||||
|
@ -772,11 +777,11 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
echo '</div>';
|
||||
|
||||
echo '<div id="'.$uniq_name.'_manual" style="width:100%;display:inline;">';
|
||||
html_print_input_text ($uniq_name . '_text', $selected, '', $size);
|
||||
|
||||
html_print_input_text ($uniq_name . '_text', $selected, '', $size, 255, false, $readonly, false, '', $class);
|
||||
|
||||
html_print_input_hidden ($name, $selected, false, $uniq_name);
|
||||
html_print_select ($units, $uniq_name . '_units', 1, "" . $script,
|
||||
$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
|
||||
$nothing, $nothing_value, false, false, false, $class, $readonly, 'font-size: xx-small;'.$select_style);
|
||||
echo ' <a href="javascript:">' .
|
||||
html_print_image('images/default_list.png', true,
|
||||
array('class' => $uniq_name . '_toggler',
|
||||
|
@ -1043,7 +1048,7 @@ function html_print_div ($options, $return = false) {
|
|||
*/
|
||||
function html_print_input_password ($name, $value, $alt = '',
|
||||
$size = 50, $maxlength = 255, $return = false, $disabled = false,
|
||||
$required = false) {
|
||||
$required = false, $class = '') {
|
||||
|
||||
if ($maxlength == 0)
|
||||
$maxlength = 255;
|
||||
|
@ -1054,6 +1059,8 @@ function html_print_input_password ($name, $value, $alt = '',
|
|||
$attr = array();
|
||||
if ($required)
|
||||
$attr['required'] = 'required';
|
||||
if ($class)
|
||||
$attr['class'] = $class;
|
||||
|
||||
return html_print_input_text_extended ($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true);
|
||||
}
|
||||
|
@ -1073,7 +1080,7 @@ function html_print_input_password ($name, $value, $alt = '',
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false, $required = false, $function = "") {
|
||||
function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false, $required = false, $function = "", $class = "") {
|
||||
if ($maxlength == 0)
|
||||
$maxlength = 255;
|
||||
|
||||
|
@ -1083,6 +1090,8 @@ function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength
|
|||
$attr = array();
|
||||
if ($required)
|
||||
$attr['required'] = 'required';
|
||||
if ($class != '')
|
||||
$attr['class'] = $class;
|
||||
|
||||
return html_print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, false, $function);
|
||||
}
|
||||
|
@ -1312,8 +1321,8 @@ function html_print_button ($label = 'OK', $name = '', $disabled = false, $scrip
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_textarea ($name, $rows, $columns, $value = '', $attributes = '', $return = false) {
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' >';
|
||||
function html_print_textarea ($name, $rows, $columns, $value = '', $attributes = '', $return = false, $class = '') {
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.'" '.$class.'>';
|
||||
//$output .= io_safe_input ($value);
|
||||
$output .= ($value);
|
||||
$output .= '</textarea>';
|
||||
|
|
Loading…
Reference in New Issue