function oils_unsaved_data_V() {
var tabs = window.parent.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
+
+ if (tabs) {
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
+ }
+
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; }
- //We allow unsaved data to be incremented only a single time from marc edit
- if (tab.marc_edit_allow_multiple_locks || tab.in_marc_edit == false) {
+ //If there are tabs, we allow unsaved data to be incremented only a single time from marc edit.
+ //If there are not tabs, then we are in a new window like the Copy Editor (so retain original locking).
+ if (tab) {
+ if (tab.marc_edit_allow_multiple_locks || tab.in_marc_edit == false) {
+ data.unsaved_data++;
+ window.oils_lock++;
+ }
+ } else {
data.unsaved_data++;
window.oils_lock++;
}
+
data.stash('unsaved_data');
dump('\n=-=-=-=-=\n');
dump('oils_unsaved_data_V for ' + location.href + '\n');
}
function oils_unsaved_data_P(count) {
- var tabs = window.parent.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
dump('\n=-=-=-=-=\n');
dump('oils_unsaved_data_P for ' + location.href + '\n');
if (!count) { count = 1; }
}
}
var tabs = window.parent.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
+
+ if (tabs) {
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
+ }
+
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
dump('\twith xulG.lock_tab\n');
//make sure we are not in the marc edit window
var marceditRe = /\/marcedit.xul$/;
if (marceditRe.exec(window.document.location)) {
+ //We do not have to check for tab here because
+ //the MARC editor is explicitly in a tabbed window
tab.marc_edit_changed = true;
tab.marc_edit_allow_multiple_locks = false;
}
function oils_unlock_page(params) {
dump('\n=-=-=-=-=\n');
dump('oils_unlock_page for ' + location.href + '\n');
- var marceditRe = /\/marcedit.xul$/;
- var tabs = window.parent.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
+
if (typeof xulG != 'undefined') {
if (typeof xulG.unlock_tab == 'function') {
dump('\twith xulG.unlock_tab\n');