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 = $('', { 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",{
+ html: IPA.messages.dirty
+ }).
+ appendTo($("#navigation"));
+ message_box.dialog({
+ title: 'Dirty',
+ modal:true,
+ width: '20em',
+ buttons: {
+ Ok: function() {
+ $( this ).dialog( "close" );
+ }
+ }
+ });
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+
that.show_page = function (entity_name, facet_name) {
+ if (!IPA.test_dirty()){
+ return false;
+ }
var state = {};
state[entity_name + '-facet'] = facet_name;
@@ -139,6 +170,11 @@ var IPA = ( function () {
};
that.switch_and_show_page = function (this_entity, facet_name, pkey) {
+
+ if (!IPA.test_dirty()){
+ return false;
+ }
+
if (!pkey){
that.show_page(this_entity, facet_name);
return;
diff --git a/install/ui/navigation.js b/install/ui/navigation.js
index 0b8fe528e..4a3fe6916 100644
--- a/install/ui/navigation.js
+++ b/install/ui/navigation.js
@@ -23,9 +23,15 @@
var nav_tabs_lists;
var nav_container;
+
+
function nav_push_state(params)
{
+ if (!IPA.test_dirty()){
+ return false;
+ }
$.bbq.pushState(params);
+ return true;
}
function nav_get_state(key)
@@ -58,8 +64,7 @@ function nav_create(nls, container, tabclass)
var id = parent.attr('id');
var state = {};
state[id] = ui.index;
- nav_push_state(state);
- return true;
+ return nav_push_state(state);
}
});
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index a4b9a0f79..40be12288 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -7398,6 +7398,7 @@
"misc": "Misc. Information",
"to_top": "Back to Top"
},
+ "dirty": "This page has unsaved changes. Please save or revert.",
"facets": {
"details": "Settings",
"search": "Search"
@@ -7447,7 +7448,7 @@
"20110126193538Z"
],
"krblastsuccessfulauth": [
- "20110126194824Z"
+ "20110127024034Z"
],
"krbpasswordexpiration": [
"20110426193538Z"
diff --git a/install/ui/webui.js b/install/ui/webui.js
index 9459c9d1c..a762654b0 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -116,6 +116,12 @@ IPA.tab_state = function(entity_name){
/* main (document onready event handler) */
$(function() {
+ /* main loop (hashchange event handler) */
+ function window_hashchange(evt){
+ nav_update_tabs();
+ }
+
+
function should_show_all_ui(){
var whoami = IPA.whoami;
@@ -167,13 +173,3 @@ $(function() {
IPA.init(null, null, init_on_win, init_on_error);
});
-
-/* main loop (hashchange event handler) */
-function window_hashchange(evt){
- nav_update_tabs();
-}
-
-/* builder function for unimplemented tab content */
-function unimplemented_tab(jobj){
- jobj.text('Not implemented yet!');
-}
diff --git a/install/ui/widget.js b/install/ui/widget.js
index cea86fad0..9f7c8cae8 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -126,14 +126,40 @@ IPA.widget = function(spec) {
}
that.is_dirty = function() {
-
+ if (that.read_only) {
+ return false;
+ }
var values = that.save();
- if (!values && !that.values) return false;
- if (!values || !that.values) return true;
- if (values.length != that.values.length) return true;
+ if (!that.values){
+ if (!values) {
+ return false;
+ }
+ if ( values === "" ){
+ return false;
+ }
+ if ((values instanceof Array) &&
+ (values.length ===1) &&
+ (values[0] === "")){
+ return false;
+ }
+
+ if ((values instanceof Array) &&
+ (values.length === 0)){
+ return false;
+ }
+
+ if (values) {
+ return true;
+ }
+ }
+ if (values.length != that.values.length) {
+ return true;
+ }
for (var i=0; i "+
"Follow these directions to configure your browser.")
- }
+ },
+ "dirty":_("This page has unsaved changes. Please save or revert."),
}
has_output = (
Output('messages', dict, doc=_('Dict of I18N messages')),