networks: Add 'disabled' IPv4 method, i18n

Disabled IPv4 method allows not configuring IPv4 entirely on network
interfaces as required in some cases.

Also, make sure to internationalize all the choices form values in
network module.  There were missed before.
This commit is contained in:
Sunil Mohan Adapa 2016-07-13 12:34:46 +05:30 committed by James Valleroy
parent 04babacafa
commit a9ca2d7cc3
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 15 additions and 9 deletions

View File

@ -45,7 +45,8 @@ class ConnectionForm(forms.Form):
label=_('Firewall Zone'),
help_text=_('The firewall zone will control which services are \
available over this interfaces. Select Internal only for trusted networks.'),
choices=[('external', 'External'), ('internal', 'Internal')])
choices=[('external', _('External')),
('internal', _('Internal'))])
ipv4_method = forms.ChoiceField(
label=_('IPv4 Addressing Method'),
help_text=format_lazy(
@ -55,9 +56,10 @@ available over this interfaces. Select Internal only for trusted networks.'),
'method will make {box_name} act as a router, configure '
'clients on this network and share its Internet connection.'),
box_name=ugettext_lazy(cfg.box_name)),
choices=[('auto', 'Automatic (DHCP)'),
('shared', 'Shared'),
('manual', 'Manual')])
choices=[('auto', _('Automatic (DHCP)')),
('shared', _('Shared')),
('manual', _('Manual')),
('disabled', _('Disabled'))])
ipv4_address = forms.CharField(
label=_('Address'),
validators=[validators.validate_ipv4_address],
@ -195,14 +197,15 @@ class WifiForm(ConnectionForm):
help_text=_('The visible name of the network.'))
mode = forms.ChoiceField(
label=_('Mode'),
choices=[('infrastructure', 'Infrastructure'),
('ap', 'Access Point'),
('adhoc', 'Ad-hoc')])
choices=[('infrastructure', _('Infrastructure')),
('ap', _('Access Point')),
('adhoc', _('Ad-hoc'))])
auth_mode = forms.ChoiceField(
label=_('Authentication Mode'),
help_text=_('Select WPA if the wireless network is secured and \
requires clients to have the password to connect.'),
choices=[('wpa', 'WPA'), ('open', 'Open')])
choices=[('wpa', _('WPA')),
('open', _('Open'))])
passphrase = forms.CharField(
label=_('Passphrase'),
validators=[validators.MinLengthValidator(8)],

View File

@ -68,9 +68,12 @@
ipv4_required(false, ['address']);
ipv4_readonly(false, ['address', 'netmask']);
ipv4_readonly(true, ['gateway', 'dns', 'second_dns']);
} else {
} else if ($("#id_ipv4_method").prop("value") == "auto") {
ipv4_readonly(true, ['address', 'netmask', 'gateway']);
ipv4_readonly(false, ['dns', 'second_dns']);
} else {
ipv4_readonly(true, ['address', 'netmask', 'gateway', 'dns',
'second_dns']);
}
}