summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-08-08 17:24:05 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-08-10 14:27:31 +0000
commit503470916c296db419e2cbeb096fc2b4173574ba (patch)
tree951397838484a244adbc05b4d1c48d7a0c1b34dd /install
parent5681aea2afbb22c9eacc9bdcd910854499788e35 (diff)
downloadfreeipa-503470916c296db419e2cbeb096fc2b4173574ba.zip
freeipa-503470916c296db419e2cbeb096fc2b4173574ba.tar.gz
freeipa-503470916c296db419e2cbeb096fc2b4173574ba.tar.xz
Fixed DNS zone adder dialog.
The DNS zone adder dialog has been modified to use radio buttons to select whether to enter a zone name or a reverse zone IP network. Ticket #1575
Diffstat (limited to 'install')
-rw-r--r--install/ui/dialog.js1
-rw-r--r--install/ui/dns.js224
2 files changed, 187 insertions, 38 deletions
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 0ec84a7..5d0ce14 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -259,6 +259,7 @@ IPA.dialog = function(spec) {
that.dialog_create = that.create;
that.dialog_open = that.open;
that.dialog_close = that.close;
+ that.dialog_save = that.save;
var fields = spec.fields || [];
for (var i=0; i<fields.length; i++) {
diff --git a/install/ui/dns.js b/install/ui/dns.js
index a5ebc2c..20660d1 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -88,16 +88,21 @@ IPA.entity_factories.dnszone = function() {
width: 500,
height: 300,
fields: [
- 'idnsname',
{
- factory: IPA.checkbox_widget,
- name: 'name_from_ip',
+ name: 'idnsname',
+ optional: true,
undo: false
},
+ 'name_from_ip',
'idnssoamname',
- 'idnssoarname',
{
- factory: IPA.force_dnszone_add_checkbox_widget
+ name: 'idnssoarname',
+ optional: true,
+ undo: false
+ },
+ {
+ factory: IPA.force_dnszone_add_checkbox_widget,
+ name: 'force'
}
]
}).
@@ -110,36 +115,180 @@ IPA.dnszone_adder_dialog = function(spec) {
var that = IPA.add_dialog(spec);
- that.save = function(record) {
+ that.create = function() {
- var idnsname;
- var name_from_ip;
+ that.container.addClass('dnszone-adder-dialog');
- var fields = that.fields.values;
- for (var i=0; i<fields.length; i++) {
- var field = fields[i];
+ var table = $('<table/>').appendTo(that.container);
- if (field.name == 'idnsname') {
+ var field = that.get_field('idnsname');
- idnsname = field.save()[0];
+ var tr = $('<tr/>').appendTo(table);
- } else if (field.name == 'name_from_ip') {
+ var td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
- name_from_ip = field.save()[0];
- if (name_from_ip) {
- record.name_from_ip = idnsname;
- } else {
- record.idnsname = idnsname;
- }
+ var label = $('<label/>', {
+ 'for': 'dnszone-adder-dialog-idnsname-radio'
+ }).appendTo(td);
- } else if (field.name == 'idnssoarname') {
+ that.idnsname_radio = $('<input/>', {
+ type: 'radio',
+ id: 'dnszone-adder-dialog-idnsname-radio',
+ name: 'type',
+ value: 'idnsname'
+ }).appendTo(label);
- field.optional = name_from_ip;
+ label.append(field.label+':');
- } else {
- var values = field.save();
- record[field.name] = values.join(',');
- }
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ var span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+
+ var idnsname_input = $('input', span);
+
+ field = that.get_field('name_from_ip');
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ label = $('<label/>', {
+ 'for': 'dnszone-adder-dialog-name_from_ip-radio'
+ }).appendTo(td);
+
+ var name_from_ip_radio = $('<input/>', {
+ type: 'radio',
+ id: 'dnszone-adder-dialog-name_from_ip-radio',
+ name: 'type',
+ value: 'name_from_ip'
+ }).appendTo(label);
+
+ label.append(field.label+':');
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+
+ var name_from_ip_input = $('input', span);
+
+ that.idnsname_radio.click(function() {
+ idnsname_input.attr('disabled', false);
+ name_from_ip_input.attr('disabled', true);
+ });
+
+ name_from_ip_radio.click(function() {
+ idnsname_input.attr('disabled', true);
+ name_from_ip_input.attr('disabled', false);
+ });
+
+ idnsname_input.focus(function() {
+ that.idnsname_radio.attr('checked', true);
+ });
+
+ name_from_ip_input.focus(function() {
+ name_from_ip_radio.attr('checked', true);
+ });
+
+ that.idnsname_radio.click();
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ colspan: 2,
+ html: '&nbsp;'
+ }).appendTo(tr);
+
+ field = that.get_field('idnssoamname');
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ label = $('<label/>', {
+ text: field.label+':'
+ }).appendTo(td);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+
+ field = that.get_field('idnssoarname');
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ label = $('<label/>', {
+ text: field.label+':'
+ }).appendTo(td);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+
+ field = that.get_field('force');
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ label = $('<label/>', {
+ text: field.label+':'
+ }).appendTo(td);
+
+ td = $('<td/>', {
+ title: field.label
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+ };
+
+ that.save = function(record) {
+
+ that.dialog_save(record);
+
+ if (that.idnsname_radio.is(':checked')) {
+ delete record.name_from_ip;
+ } else {
+ delete record.idnsname;
}
};
@@ -376,25 +525,25 @@ IPA.dnsrecord_redirection_dialog = function(spec) {
return that;
};
-IPA.dnsrecord_host_link_widget = function(spec){
+IPA.dnsrecord_host_link_widget = function(spec) {
var that = IPA.entity_link_widget(spec);
- that.other_pkeys = function(){
+ that.other_pkeys = function() {
var pkey = that.entity.get_primary_key();
return [pkey[0]+'.'+pkey[1]];
};
return that;
};
-IPA.dns_record_types = function(){
+IPA.dns_record_types = function() {
var attrs = IPA.metadata.objects.dnsrecord.default_attributes;
var record_types = [];
- for (var i =0; i < attrs.length; i+=1){
+ for (var i=0; i<attrs.length; i++) {
var attr = attrs[i];
var index = attr.search('record$');
- if (index > -1){
+ if (index > -1) {
var rec_type = {
- label: attr.substring(0,index).toUpperCase(),
- value: attr
+ label: attr.substring(0, index).toUpperCase(),
+ value: attr
};
record_types.push(rec_type);
}
@@ -402,7 +551,7 @@ IPA.dns_record_types = function(){
return record_types;
};
-IPA.dnsrecord_type_widget = function (spec){
+IPA.dnsrecord_type_widget = function(spec) {
spec.options = IPA.dns_record_types();
var that = IPA.select_widget(spec);
@@ -410,16 +559,15 @@ IPA.dnsrecord_type_widget = function (spec){
};
IPA.force_dnszone_add_checkbox_widget = function(spec) {
- var param_info = IPA.get_method_option('dnszone_add', 'force');
- spec.name = 'force';
+ var param_info = IPA.get_method_option('dnszone_add', spec.name);
spec.label = param_info.label;
spec.tooltip = param_info.doc;
spec.undo = false;
- return IPA.checkbox_widget(spec);
+ return IPA.checkbox_widget(spec);
};
-IPA.dnsrecord_get_delete_values = function(){
+IPA.dnsrecord_get_delete_values = function() {
var records = {};
var value;