function $(id) { return document.getElementById(id); }
+ function oils_unsaved_data_V() {
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ data.stash_retrieve();
+ if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
+ data.unsaved_data++;
+ data.stash('unsaved_data');
+ }
+
+ function oils_unsaved_data_P() {
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ data.stash_retrieve();
+ if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
+ data.unsaved_data--;
+ if (data.unsaved_data < 0) { data.unsaved_data = 0; }
+ data.stash('unsaved_data');
+ }
+
function oils_lock_page(params) {
dump('oils_lock_page\n');
if (!params) { params = {}; }
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
xulG.lock_tab();
+ } else {
+ oils_unsaved_data_V();
}
+ } else {
+ oils_unsaved_data_V();
}
return window.oils_lock;
}
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
xulG.unlock_tab();
+ } else {
+ oils_unsaved_data_P();
}
+ } else {
+ oils_unsaved_data_P();
}
return window.oils_lock;
}
for (var id in obj.tab_semaphores) {
if (obj.tab_semaphores[id] > 0) {
- obj.global_unsaved_data_P();
+ oils_unsaved_data_P();
}
}
if (this.tab_semaphores[id] > 0) {
var confirmation = window.confirm(offlineStrings.getString('menu.close_tab.unsaved_data_warning'));
if (!confirmation) { return; }
- obj.global_unsaved_data_P();
+ oils_unsaved_data_P();
}
delete this.tab_semaphores[id];
}
'tab_semaphores' : {},
- 'global_unsaved_data_V' : function() {
- var obj = this;
- obj.data.stash_retrieve();
- if (typeof obj.data.unsaved_data == 'undefined') { obj.data.unsaved_data = 0; }
- obj.data.unsaved_data++;
- obj.data.stash('unsaved_data');
- },
- 'global_unsaved_data_P' : function() {
- var obj = this;
- obj.data.stash_retrieve();
- if (typeof obj.data.unsaved_data == 'undefined') { obj.data.unsaved_data = 0; }
- obj.data.unsaved_data++;
- if (obj.data.unsaved_data < 0) { obj.data.unsaved_data = 0; }
- obj.data.stash('unsaved_data');
- },
-
'set_tab' : function(url,params,content_params) {
var obj = this;
if (!url) url = '/xul/server/';
if (obj.tab_semaphores[id] > 0) {
var confirmation = window.confirm(offlineStrings.getString('menu.replace_tab.unsaved_data_warning'));
if (!confirmation) { return; }
- obj.global_unsaved_data_P();
+ oils_unsaved_data_P();
}
delete obj.tab_semaphores[id];
}
obj.tab_semaphores[id] = 0;
}
obj.tab_semaphores[id]++;
- obj.global_unsaved_data_V();
+ oils_unsaved_data_V();
return obj.tab_semaphores[id];
};
content_params.unlock_tab = function() {
}
obj.tab_semaphores[id]--;
if (obj.tab_semaphores[id] < 0) { obj.tab_semaphores[id] = 0; }
- obj.global_unsaved_data_P();
+ oils_unsaved_data_P();
return obj.tab_semaphores[id];
};
content_params.inspect_tab = function() {