diff options
Diffstat (limited to 'install/ui/details.js')
-rw-r--r-- | install/ui/details.js | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/install/ui/details.js b/install/ui/details.js index 84a5c4098..c9e78bdef 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -49,6 +49,16 @@ IPA.details_field = function (spec) { that.record = record; that.values = record[that.name]; that.reset(); + + var param_info = IPA.get_param_info(that.entity_name, that.name); + if (param_info) { + if (param_info['primary_key']) { + that.read_only = true; + } + if ('no_update' in param_info['flags']) { + that.read_only = true; + } + } } that.update = function() { @@ -129,7 +139,10 @@ IPA.details_field = function (spec) { var label = $('<label/>', { html:value.toString() }); - if (!IPA.is_field_writable(rights)) return label; + if (!IPA.is_field_writable(rights)) { + that.read_only = true; + return label; + } var param_info = IPA.get_param_info(that.entity_name, that.name); if (param_info) { @@ -191,6 +204,7 @@ IPA.details_field = function (spec) { }).appendTo(span) ; if (!IPA.is_field_writable(rights)) { + that.read_only = true; input.attr('disabled', 'disabled'); } @@ -383,6 +397,16 @@ IPA.details_section = function (spec){ } }; + that.is_dirty = function(){ + for (var i=0; i<that.fields.length; i++) { + var field = that.fields[i]; + if (field.is_dirty()){ + return true; + } + } + return false; + } + // methods that should be invoked by subclasses that.section_init = that.init; that.section_create = that.create; @@ -653,10 +677,24 @@ IPA.details_facet = function (spec) { } } - function is_dirty() { + function new_key(){ var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; return pkey != that.pkey; } + that.new_key = new_key; + + + function is_dirty() { + + var i; + for ( i =0; i < that.sections.length; i +=1 ){ + if (that.sections[i].is_dirty()){ + return true; + } + } + + return false; + } function load(record) { that.record = record; |