DNS forward policy: checkboxes changed to radio buttons

DNS forward policy fields were using mutually exclusive checkboxes. Such behavior is unusual for users.

Checkboxes were changed to radios.

https://fedorahosted.org/freeipa/ticket/2599
This commit is contained in:
Petr Vobornik
2012-04-04 10:49:16 +02:00
parent dedc7889dc
commit db24a831d4
4 changed files with 41 additions and 14 deletions

View File

@@ -52,10 +52,19 @@ IPA.dns.config_entity = function(spec) {
validators: [IPA.dnsforwarder_validator()]
},
{
type: 'checkboxes',
type: 'radio',
name: 'idnsforwardpolicy',
mutex: true,
options: IPA.create_options(['only', 'first'])
default_value: 'first',
options: [
{
value: 'first',
label: IPA.messages.objects.dnsconfig.forward_first
},
{
value: 'only',
label: IPA.messages.objects.dnsconfig.forward_only
}
]
},
'idnszonerefresh'
]
@@ -170,10 +179,19 @@ IPA.dns.zone_entity = function(spec) {
validators: [IPA.dnsforwarder_validator()]
},
{
type: 'checkboxes',
type: 'radio',
name: 'idnsforwardpolicy',
mutex: true,
options: IPA.create_options(['only', 'first'])
default_value: 'first',
options: [
{
value: 'first',
label: IPA.messages.objects.dnsconfig.forward_first
},
{
value: 'only',
label: IPA.messages.objects.dnsconfig.forward_only
}
]
},
{
type: 'checkbox',

View File

@@ -1516,17 +1516,22 @@ IPA.limit_text = function(value, max_length) {
return limited_text;
};
IPA.create_options = function(labels, values) {
if(!values) values = labels;
IPA.create_options = function(values) {
var options = [];
for (var i=0; i<labels.length; i++) {
options.push({
label: labels[i],
value: values[i]
});
for (var i=0; i<values.length; i++) {
var val = values[i];
var option = val;
if (typeof val === 'string') {
option = {
value: val,
label: val
};
}
options.push(option);
}
return options;

View File

@@ -201,6 +201,8 @@
},
"delegation": {},
"dnsconfig": {
"forward_first": "Forward first",
"forward_only": "Forward only",
"options": "Options"
},
"dnsrecord": {

View File

@@ -338,6 +338,8 @@ class i18n_messages(Command):
"delegation": {
},
"dnsconfig": {
"forward_first": _("Forward first"),
"forward_only": _("Forward only"),
"options": _("Options"),
},
"dnsrecord": {