2807.patch
root/usr/share/nethesis/NethServer/Template/NetworkAdapter/Edit.php | ||
---|---|---|
36 | 36 | |
37 | 37 |
$roleId = $view->getClientEventTarget('role'); |
38 | 38 |
$bootprotoId = $view->getClientEventTarget('bootproto'); |
39 |
$gatewayId = $view->getClientEventTarget('gateway'); |
|
39 | 40 |
$view->includeJavascript(" |
40 | 41 |
(function ( $ ) { |
42 |
function toggleGateway() { |
|
43 |
if ($('.${roleId}').val().indexOf('blue') !== -1 || $('.${roleId}').val().indexOf('orange') !== -1) { |
|
44 |
// if blue or orange, hide gateway |
|
45 |
$('.${gatewayId}').hide(); |
|
46 |
$('.${gatewayId}').parent().hide(); |
|
47 |
} else { |
|
48 |
$('.${gatewayId}').show(); |
|
49 |
$('.${gatewayId}').parent().show(); |
|
50 |
} |
|
51 |
} |
|
52 | ||
41 | 53 |
function toggleDHCP() { |
42 | 54 |
if ($('.${roleId}').val().indexOf('red') !== -1) { |
43 | 55 |
$('.${bootprotoId}[value=dhcp]').prop('disabled', false); |
56 |
$('.${bootprotoId}[value=dhcp]').show(); |
|
57 |
$('.${bootprotoId}').parent().show(); |
|
44 | 58 |
} else { |
45 | 59 |
// role is not red |
46 |
$('.${bootprotoId}[value=static]').trigger('click');
|
|
60 |
$('.${bootprotoId}[value=none]').trigger('click');
|
|
47 | 61 |
$('.${bootprotoId}[value=dhcp]').prop('disabled', true); |
62 |
$('.${bootprotoId}').parent().hide(); |
|
48 | 63 |
} |
49 | 64 |
} |
50 | 65 |
$(document).ready(function() { |
51 | 66 |
toggleDHCP(); |
67 |
toggleGateway(); |
|
52 | 68 |
$('.${roleId}').change(toggleDHCP); |
69 |
$('.${roleId}').change(toggleGateway); |
|
53 | 70 |
$('.${roleId}').on('nethguiupdateview', toggleDHCP); |
71 |
$('.${roleId}').on('nethguiupdateview', toggleGateway); |
|
54 | 72 |
}); |
55 | 73 |
} ( jQuery )); |
56 | 74 |
"); |
root/usr/share/nethesis/NethServer/Template/NetworkAdapter/SetIpAddress.php | ||
---|---|---|
19 | 19 | |
20 | 20 |
$roleId = $view->getClientEventTarget('role'); |
21 | 21 |
$bootprotoId = $view->getClientEventTarget('bootproto'); |
22 |
$gatewayId = $view->getClientEventTarget('gateway'); |
|
22 | 23 |
$view->includeJavascript(" |
23 | 24 |
(function ( $ ) { |
25 |
function toggleGateway() { |
|
26 |
if ($('.${roleId}').val().indexOf('blue') !== -1 || $('.${roleId}').val().indexOf('orange') !== -1) { |
|
27 |
// if blue or orange, hide gateway |
|
28 |
$('.${gatewayId}').hide(); |
|
29 |
$('.${gatewayId}').parent().hide(); |
|
30 |
} else { |
|
31 |
$('.${gatewayId}').show(); |
|
32 |
$('.${gatewayId}').parent().show(); |
|
33 |
} |
|
34 |
} |
|
35 | ||
24 | 36 |
function toggleDHCP(e, value) { |
25 | 37 |
if(value === undefined) { |
26 | 38 |
value = $('.${roleId}').val(); |
27 | 39 |
} |
28 | 40 |
if (value === 'red') { |
29 | 41 |
$('.${bootprotoId}[value=dhcp]').prop('disabled',false); |
42 |
$('.${bootprotoId}').parent().show(); |
|
30 | 43 |
} else { |
31 | 44 |
// role is not red |
32 | 45 |
$('.${bootprotoId}[value=static]').trigger('click'); |
33 | 46 |
$('.${bootprotoId}[value=dhcp]').prop('disabled',true); |
47 |
$('.${bootprotoId}').parent().hide(); |
|
34 | 48 |
} |
35 | 49 |
} |
36 | 50 |
$(document).ready(function() { |
37 | 51 |
toggleDHCP(); |
52 |
toggleGateway(); |
|
53 |
$('.${roleId}').change(toggleDHCP); |
|
54 |
$('.${roleId}').change(toggleGateway); |
|
38 | 55 |
$('.${roleId}').on('nethguiupdateview', toggleDHCP); |
56 |
$('.${roleId}').on('nethguiupdateview', toggleGateway); |
|
39 | 57 |
}); |
40 | 58 | |
41 | 59 |
} ( jQuery )); |
42 |
"); |
|
60 |
"); |