function opac_wrapper_set_help_context() {
try {
var tabs = window.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
- tab.in_marc_edit = false;
+ if (tabs) {
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
+ tab.in_marc_edit = false;
+ }
dump('Entering opac.js, opac_wrapper_set_help_context\n');
var cw = bottom_pane.get_contentWindow();
if (cw && typeof cw['location'] != 'undefined') {
}
var marceditRe = /\/marcedit.xul$/;
if (marceditRe.exec(cw.location)) {
- tab.in_marc_edit = true;
+ if (tab) {
+ tab.in_marc_edit = true;
+ }
}
} else {
dump('opac.js: problem in opac_wrapper_set_help_context(): bottom_pane = ' + bottom_pane + ' cw = ' + cw + '\n');
var args = Array.prototype.slice.call(arguments, 1);
if (action_function.name == 'set_marc_edit') {
var tabs = window.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 (tab.marc_edit_changed) {
- xulG.lock_tab();
- tab.marc_edit_allow_multiple_locks = false;
+ if (tab.marc_edit_changed) {
+ xulG.lock_tab();
+ tab.marc_edit_allow_multiple_locks = false;
+ }
}
}
var marc_edit_changed;
var tabs = window.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
- in_marc_edit = tab.in_marc_edit;
- marc_edit_changed = tab.marc_edit_changed;
+ if (tabs) {
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
- if ((in_marc_edit != true) || (marc_edit_changed != true)) {
- if (typeof xulG.is_tab_locked == 'undefined') { return true; }
- if (! xulG.is_tab_locked()) { return true; }
- }
- var r = window.confirm(
- document.getElementById('offlineStrings').getString(
- 'generic.unsaved_data_warning'
- )
- );
+ in_marc_edit = tab.in_marc_edit;
+ marc_edit_changed = tab.marc_edit_changed;
- //If we are confirming from within MARC edit then
- //drop the tab locks. Otherwise the locks get dropped
- //in cmd_search_tcn
- if (r) {
- if (typeof xulG.unlock_tab === 'function') {
- while ( xulG.unlock_tab() > 0 ) {};
+ if ((in_marc_edit != true) || (marc_edit_changed != true)) {
+ if (typeof xulG.is_tab_locked == 'undefined') { return true; }
+ if (! xulG.is_tab_locked()) { return true; }
}
+ var r = window.confirm(
+ document.getElementById('offlineStrings').getString(
+ 'generic.unsaved_data_warning'
+ )
+ );
- return true;
- } else {
- return false;
+ //If we are confirming from within MARC edit then
+ //drop the tab locks. Otherwise the locks get dropped
+ //in cmd_search_tcn
+ if (r) {
+ if (typeof xulG.unlock_tab === 'function') {
+ while ( xulG.unlock_tab() > 0 ) {};
+ }
+
+ return true;
+ } else {
+ return false;
+ }
}
}
function set_lock_on_keypress(ev) {
try {
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];
+ }
//dump('keypress: isChar = ' + ev.isChar + ' char = ' + ev.char + ' charCode = ' + ev.charCode + ' key = ' + ev.key + ' keyCode = ' + ev.keyCode + '\n');
if (! /* NOT */(
ev.altKey
function save_attempt(xml_string) {
try {
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];
+ }
var result = window.xulG.save.func( xml_string );
// I'd prefer to pass on_complete on through to fast_item_add,
// but with the way these window scopes get destroyed with
// tab replacement, maybe not a good idea
var replace_on_complete = false;
if (result) {
- tab.marc_edit_changed = false;
+ if (tab) {
+ tab.marc_edit_changed = false;
+ }
oils_unlock_page();
if (result.id) {
replace_on_complete = fastItemAdd_attempt(result.id);
function loadRecord() {
try {
var tabs = window.parent.parent.document.getElementById('main_tabs');
- var idx = tabs.selectedIndex;
- var tab = tabs.childNodes[idx];
- tab.marc_edit_changed = false;
- tab.marc_edit_allow_multiple_locks = true;
+
+ if (tabs) {
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
+ tab.marc_edit_changed = false;
+ tab.marc_edit_allow_multiple_locks = true;
+ }
var grid_rows = document.getElementById('recGrid').lastChild;