}
}
+ function get_contentWindow(frame) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ if (frame && frame.contentWindow) {
+ if (typeof frame.contentWindow.wrappedJSObject != 'undefined') return frame.contentWindow.wrappedJSObject;
+ return frame.contentWindow;
+ } else {
+ return null;
+ }
+ }
+
function update_modal_xulG(v) {
try {
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
return x;
} else {
if (my_xulG) {
- if (w.contentWindow) {
- w.contentWindow.xulG = my_xulG;
+ if (get_contentWindow(w)) {
+ get_contentWindow(w).xulG = my_xulG;
} else {
w.xulG = my_xulG;
}
}
}
};
- x.contentWindow.xulG = newG;
+ get_contentWindow(x).xulG = newG;
} catch(E) {
obj.error.standard_unexpected_error_alert('Error uploading xacts',E);
g.printer_settings = function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var w = document.getElementById('sample').contentWindow;
+ var w = get_contentWindow(document.getElementById('sample'));
g.print.NSPrint(w ? w : window, false, {});
g.print.save_settings();
}
};
$('marc_editor').setAttribute('src',url);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- $('marc_editor').contentWindow.xulG = params;
+ get_contentWindow($('marc_editor')).xulG = params;
/* hide template widgets */
$('actions').hidden = true;
g.doc_id = xul_param('doc_id');
document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + window.escape(g.doc_id));
- document.getElementById('summary').contentWindow.xulG = { 'docid' : g.doc_id };
+ get_contentWindow(document.getElementById('summary')).xulG = { 'docid' : g.doc_id };
g.copy_shortcut = xul_param('copy_shortcut',{'JSON2js_if_cgi':true});
g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));
n.setAttribute('toggle','1');
n.setAttribute('label','Results View');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- var f = document.getElementById('marc_frame').contentWindow;
+ var f = get_contentWindow(document.getElementById('marc_frame'));
f.xulG = { 'marcxml' : obj.results.records[ n.getAttribute('retrieve_id') ].marcxml };
f.my_init();
f.document.body.firstChild.focus();
if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
$('top').setAttribute('src',urls.XUL_BIB_BRIEF);// + '?docid=' + g.callnumber.record());
- $('top').contentWindow.xulG = { 'docid' : g.callnumber.record() };
+ get_contentWindow($('top')).xulG = { 'docid' : g.callnumber.record() };
$('mid').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + g.copy.id());
- $('mid').contentWindow.xulG = { 'copy_id' : g.copy.id() };
+ get_contentWindow($('mid')).xulG = { 'copy_id' : g.copy.id() };
show_circs();
iframe.setAttribute('flex','1');
gb.appendChild(iframe);
iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
- iframe.contentWindow.xulG = { 'circ_id' : g.circs[j].id() };
+ get_contentWindow(iframe).xulG = { 'circ_id' : g.circs[j].id() };
}
} catch(E) {
g.error.standard_unexpected_error_alert('error showing circs',E);
//if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
$('top').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.callnumber.record());
- $('top').contentWindow.xulG = { 'docid' : g.callnumber.record() };
+ get_contentWindow($('top')).xulG = { 'docid' : g.callnumber.record() };
//g.data.temp_copy = g.copy; g.data.stash('temp_copy');
//g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber');
$('item_summary').setAttribute('src',urls.XUL_COPY_SUMMARY);
- $('item_summary').contentWindow.xulG = { 'copy' : g.copy, 'callnumber' : g.callnumber };
+ get_contentWindow($('item_summary')).xulG = { 'copy' : g.copy, 'callnumber' : g.callnumber };
$('r_last').disabled = true;
if (g.circ) {
$('r_last').disabled = false;
g.data.temp_circ = g.circ; g.data.stash('temp_circ');
$('circ').setAttribute('src',urls.XUL_CIRC_BRIEF); // + '?no_border=1');
- $('circ').contentWindow.xulG = { 'no_border' : 1 };
+ get_contentWindow($('circ')).xulG = { 'no_border' : 1 };
if (g.circ.checkin_time()) {
$('circ_caption').setAttribute('label','Last Circulation');
} else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
$('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
- $('copy_summary').contentWindow.xulG = { 'copy_id' : r_circ.target_copy() };
+ get_contentWindow($('copy_summary')).xulG = { 'copy_id' : r_circ.target_copy() };
$('copy_summary').hidden=false;
g.network.simple_request(
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
$('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
- $('copy_summary').contentWindow.xulG = { 'copy_id' : r_circ.target_copy() };
+ get_contentWindow($('copy_summary')).xulG = { 'copy_id' : r_circ.target_copy() };
$('copy_summary').hidden=false;
g.network.simple_request(
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.checkout_window = frame.contentWindow;
+ obj.checkout_window = get_contentWindow(frame);
}
JSAN.use('util.controller'); obj.controller = new util.controller();
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.items_window = frame.contentWindow;
+ obj.items_window = get_contentWindow(frame);
}
],
'cmd_patron_edit' : [
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.bill_window = f.contentWindow;
+ obj.bill_window = get_contentWindow(f);
}
],
'patron_name' : [
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window = frame.contentWindow;
+ obj.summary_window = get_contentWindow(frame);
} else {
obj.render_search_form(params);
}
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect"
);
- obj.summary_window = frame.contentWindow;
+ obj.summary_window = get_contentWindow(frame);
obj.patron = obj.summary_window.g.summary.patron;
obj.controller.render('patron_name');
}, 0
}
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_result = list_frame.contentWindow;
+ obj.search_result = get_contentWindow(list_frame);
}
};
my_xulG
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.search_window = form_frame.contentWindow;
+ obj.search_window = get_contentWindow(form_frame);
obj._checkout_spawned = true;
},
for (var i = 0; i < obj.right_deck.node.childNodes.length; i++) {
try {
var f = obj.right_deck.node.childNodes[i];
- var w = f.contentWindow;
+ var w = get_contentWindow(f);
if (url) {
if (w.location.href == url) w.refresh(true);
} else {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var node = g.patron.right_deck.node.selectedPanel;
- if (node && node.contentWindow && typeof node.contentWindow.default_focus == 'function') {
- node.contentWindow.default_focus();
+ if (node && get_contentWindow(node) && typeof get_contentWindow(node).default_focus == 'function') {
+ get_contentWindow(node).default_focus();
} else {
var node = g.patron.left_deck.node.selectedPanel;
- if (node && node.contentWindow && typeof node.contentWindow.default_focus == 'function') {
- node.contentWindow.default_focus();
+ if (node && get_contentWindow(node) && typeof get_contentWindow(node).default_focus == 'function') {
+ get_contentWindow(node).default_focus();
}
}
} catch(E) {
a_list_of_one();
document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.ahr.target());
- document.getElementById('bib_brief').contentWindow.xulG = { 'docid' : g.ahr.target() };
+ get_contentWindow(document.getElementById('bib_brief')).xulG = { 'docid' : g.ahr.target() };
refresh();
try{
$('notes_frame').setAttribute('src',urls.XUL_PATRON_INFO_NOTES);
- $('notes_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
+ get_contentWindow($('notes_frame')).xulG =
+ { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
}catch(E){alert(E);}
try{
$('stat_cats_frame').setAttribute('src',urls.XUL_PATRON_INFO_STAT_CATS);
- $('stat_cats_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
+ get_contentWindow($('stat_cats_frame')).xulG =
+ { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
}catch(E){alert(E);}
try{
$('surveys_frame').setAttribute('src',urls.XUL_PATRON_INFO_SURVEYS);
- $('surveys_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
+ get_contentWindow($('surveys_frame')).xulG =
+ { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
}catch(E){alert(E);}
try{
$('group_frame').setAttribute('src',urls.XUL_PATRON_INFO_GROUP);
- $('group_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
+ get_contentWindow($('group_frame')).xulG =
+ { 'patron_id' : g.patron_id, 'url_prefix' : xulG.url_prefix, 'new_tab' : xulG.new_tab };
}catch(E){alert(E);}
} catch(E) {
function refresh() {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- if ($('notes_frame').contentWindow && typeof $('notes_frame').contentWindow.refresh == 'function') {
- $('notes_frame').contentWindow.refresh();
- }
- if ($('stat_cats_frame').contentWindow && typeof $('stat_cats_frame').contentWindow.refresh == 'function') {
- $('stat_cats_frame').contentWindow.refresh();
- }
- if ($('surveys_frame').contentWindow && typeof $('surveys_frame').contentWindow.refresh == 'function') {
- $('surveys_frame').contentWindow.refresh();
- }
- if ($('group_frame').contentWindow && typeof $('group_frame').contentWindow.refresh == 'function') {
- $('group_frame').contentWindow.refresh();
+ for (var i in [ 'notes_frame', 'stat_cats_frame', 'surveys_frame', 'group_frame' ]) {
+ if (get_contentWindow($(i)) && typeof get_contentWindow($(i)).refresh == 'function') {
+ get_contentWindow($(i)).refresh();
+ }
}
} catch(E) {
alert(E);
if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
for (var i = 0; i < g.sel_list.length; i++) {
try {
- var url = urls.XUL_PATRON_DISPLAY
- + '?id=' + window.escape( g.sel_list[i] );
+ var url = urls.XUL_PATRON_DISPLAY// + '?id=' + window.escape( g.sel_list[i] );
window.xulG.new_tab(
- url, { 'tab_name' : 'Retrieving Patron..' }, {}
+ url,
+ { 'tab_name' : 'Retrieving Patron..' },
+ {
+ 'id' : g.sel_list[i],
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ }
);
} catch(E) {
g.error.standard_unexpected_error_alert('Failed to retrieve patron.',E);
var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER );
//+ '?url=' + window.escape( urls.XUL_PATRON_EDIT + '?ses='
//+ window.escape( ses() ) + '&clone=' + g.sel_list[i] );
- xulG.new_tab(
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') xulG.new_tab(
loc,
{},
{
'show_print_button' : true ,
'tab_name' : 'Register Patron Clone for Group' ,
'passthru_content_params' : {
- 'ses' : ses(,
+ 'ses' : ses(),
'clone' : g.sel_list[i],
'spawn_search' : spawn_search,
'spawn_editor' : spawn_editor,
passthru[i] = p[i];
}
var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
- xulG.new_tab(
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') xulG.new_tab(
loc,
{},
{
g.error.sdump('D_TRACE', 'Editor would like to search for: ' + js2JSON(s) );
var loc = xulG.url_prefix(urls.XUL_PATRON_DISPLAY);
//loc += '?doit=1&query=' + window.escape(js2JSON(s));
- xulG.new_tab( loc, {}, {'doit':1,'query':s} );
+ if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function')
+ xulG.new_tab( loc, {}, {'doit':1,'query':s} );
} catch(E) {
g.error.standard_unexpected_error_alert('spawn search',E);
}