$('server').value = g.data.server_unadorned;
- g.cgi = new CGI();
- addCSSClass(document.documentElement,g.cgi.param('login_type'))
+ addCSSClass(document.documentElement,xul_param('login_type',{'modal_xulG':true}))
- if (g.cgi.param('desc_brief')) {
+ if (xul_param('desc_brief',{'modal_xulG':true})) {
$('desc').hidden = false;
- $('desc_brief').appendChild( document.createTextNode( g.cgi.param('desc_brief') ) );
+ $('desc_brief').appendChild( document.createTextNode( xul_param('desc_brief',{'modal_xulG':true}) ) );
}
- if (g.cgi.param('desc_full')) {
+ if (xul_param('desc_full',{'modal_xulG':true})) {
$('desc').hidden = false;
- $('desc_full').appendChild( document.createTextNode( g.cgi.param('desc_full') ) );
+ $('desc_full').appendChild( document.createTextNode( xul_param('desc_full',{'modal_xulG':true}) ) );
}
$('username').focus();
'password_prompt' : $('password'),
'server_prompt' : $('server'),
},
- g.cgi.param('login_type') || 'temp'
+ xul_param('login_type',{'modal_xulG':true}) || 'temp'
);
g.session.on_init = function() {
- JSAN.use('util.network'); var n = new util.network();
- var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
- g.data.temporary_session = { 'key' : g.session.key, 'authtime' : g.session.authtime, 'usr' : js2JSON(staff) };
- g.data.stash('temporary_session');
- window.close();
+ try {
+ JSAN.use('util.network'); var n = new util.network();
+ var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
+ g.data.temporary_session = { // old way because of local chrome still out there
+ 'key' : g.session.key,
+ 'authtime' : g.session.authtime,
+ 'usr' : js2JSON(staff)
+ }
+ g.data.stash('temporary_session');
+ var my_xulG = { // new way, to minimize the use of global spaces
+ 'temporary_session' : g.data.temporary_session
+ };
+ update_modal_xulG(my_xulG);
+ window.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('simple_auth.session.on_init',E);
+ }
}
g.session.on_init_error = function() {
$('password').value = '';
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
XML_HTTP_SERVER = data.server_unadorned;
- g.cgi = new CGI();
- var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
- if (!name) {
- if (typeof window.xulG == 'object') {
- name = window.xulG.name || window.xulG.tab_name || null;
- }
- }
- var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
+ var name = xul_param('tab_name') || xul_param('name') || null;
+ var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
if (!url) url = urls.browser;
JSAN.use('util.browser'); g.browser = new util.browser();
var push_xulG = true;
- if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
+ if (xul_param('no_xulG')) push_xulG = false;
var alt_print = false;
- if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
+ if (xul_param('alternate_print')) alt_print = true;
var p = {
'url' : url,
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
}
- if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
+ if (xul_param('show_nav_buttons')) {
document.getElementById('back').hidden = false;
document.getElementById('forward').hidden = false;
}
- if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
+ if (xul_param('show_print_button')) {
document.getElementById('browser_print').hidden = false;
}
- if (g.cgi.param('title')) {
- try { document.title = g.cgi.param('title'); } catch(E) {}
- try { window.title = g.cgi.param('title'); } catch(E) {}
+ if (xul_param('title')) {
+ try { document.title = xul_param('title'); } catch(E) {}
+ try { window.title = xul_param('title'); } catch(E) {}
}
} catch(E) {
<script type="text/javascript" src="/xul/server/main/JSAN.js"/>
<script>
<![CDATA[
+
+ var xulG = {};
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for fancy_prompt.xul');
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
- g.data.fancy_prompt_data = {};
+ //JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ //g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
+ //g.data.fancy_prompt_data = {};
+
+ xulG.fancy_status = 'incomplete';
- g.cgi = new CGI();
+ //var key = location.pathname + location.search + location.hash;
+ //if (typeof g.data.modal_xulG_stack != 'undefined' && typeof g.data.modal_xulG_stack[key] != 'undefined') {
+ // xulG = g.data.modal_xulG_stack[key][ g.data.modal_xulG_stack[key].length - 1 ];
+ //}
- var top_xml = g.cgi.param('top_xml') || g.data[ g.cgi.param('top_xml_in_stash') ];
+ var top_xml = xul_param('top_xml',{'stash_name':xul_param('top_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
if (top_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( top_xml, 'text/xml' );
if (node) document.getElementById('fancy_prompt_topbar').appendChild(node);
}
- var my_xml = g.cgi.param('xml') || g.data[ g.cgi.param('xml_in_stash') ];
+ var my_xml = xul_param('xml',{'stash_name':xul_param('xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
if (my_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( my_xml, 'text/xml' );
if (node) document.getElementById('fancy_prompt_main').appendChild(node);
}
- var bot_xml = g.cgi.param('bot_xml') || g.data[ g.cgi.param('bottom_xml_in_stash') ];
+ var bot_xml = xul_param('bot_xml',{'stash_name':xul_param('bottom_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});;
if (bot_xml) {
var parser = new DOMParser();
var doc = parser.parseFromString( bot_xml, 'text/xml' );
nl[i].addEventListener('command',function(ev) { window.close(); },false);
}
- if (g.cgi.param('title')) {
- try { window.title = g.cgi.param('title'); } catch(E) {}
- try { document.title = g.cgi.param('title'); } catch(E) {}
+ if (xul_param('title',{'modal_xulG':true})) {
+ try { window.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
+ try { document.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
}
- if (g.cgi.param('focus')) document.getElementById(g.cgi.param('focus')).focus();
+ if (xul_param('focus',{'modal_xulG':true})) document.getElementById(xul_param('focus',{'modal_xulG':true})).focus();
} catch(E) {
var err_msg = "!! This software has encountered an error. Please tell your friendly " +
}
function fancy_save(ev) {
- if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
- g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
- var nl = document.getElementsByAttribute('name','fancy_data');
- for (var i = 0; i < nl.length; i++) {
- g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+ try {
+ //if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
+ //g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
+ //var nl = document.getElementsByAttribute('name','fancy_data');
+ //for (var i = 0; i < nl.length; i++) {
+ // g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+ //}
+ //g.data.stash('fancy_prompt_data');
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ if (ev.target.id) xulG[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
+ xulG[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
+ var nl = document.getElementsByAttribute('name','fancy_data');
+ for (var i = 0; i < nl.length; i++) {
+ xulG[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+ }
+ xulG.fancy_status = 'complete';
+ var key = location.pathname + location.search + location.hash;
+ data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ] = xulG;
+ data.stash('modal_xulG_stack');
+
+ window.close();
+ } catch(E) {
+ try { g.error.standard_unexpected_error_alert('fancy_save',E); } catch(F) { alert('fancy_save ' + E + ' ' + F); }
}
- g.data.stash('fancy_prompt_data');
- window.close();
}
]]>
</script>
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for util_browser.xul');
- g.cgi = new CGI();
- var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
- if (!name) {
- if (typeof window.xulG == 'object') {
- name = window.xulG.name || window.xulG.tab_name || null;
- }
- }
- var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
+ var name = xul_param('tab_name') || xul_param('name') || null;
+ var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
if (!url) url = urls.browser;
if (!g.browser) {
}
var push_xulG = true;
- if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
+ if (xul_param('no_xulG')) push_xulG = false;
var alt_print = false;
- if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
+ if (xul_param('alternate_print')) alt_print = true;
var p = {
'url' : url,
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
}
- if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
+ if (xul_param('show_nav_buttons')) {
document.getElementById('back').hidden = false;
document.getElementById('forward').hidden = false;
}
- if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
+ if (xul_param('show_print_button')) {
document.getElementById('browser_print').hidden = false;
}
- if (g.cgi.param('title')) {
- try { document.title = g.cgi.param('title'); } catch(E) {}
- try { window.title = g.cgi.param('title'); } catch(E) {}
+ if (xul_param('title')) {
+ try { document.title = xul_param('title'); } catch(E) {}
+ try { window.title = xul_param('title'); } catch(E) {}
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for holds.xul');
- g.cgi = new CGI();
-
JSAN.use('patron.holds'); g.holds = new patron.holds();
g.holds.init(
{
'tree_id' : 'holds_pull_list',
- 'patron_id' : g.cgi.param('patron_id'),
- 'docid' : g.cgi.param('docid'),
- 'shelf' : g.cgi.param('shelf'),
- 'pull' : g.cgi.param('pull'),
+ 'patron_id' : xul_param('patron_id'),
+ 'docid' : xul_param('docid'),
+ 'shelf' : xul_param('shelf'),
+ 'pull' : xul_param('pull'),
}
);
window.refresh = function(p) { g.holds.retrieve(p); }
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for admin_offline_manage_xacts.xul');
- g.cgi = new CGI();
-
JSAN.use('admin.offline_manage_xacts'); g.admin = new admin.offline_manage_xacts();
g.admin.init({});
JSAN.errorLevel = "die"; // none, warn, or die
JSAN.addRepository('..');
JSAN.use('util.error'); g.error = new util.error();
- g.error.sdump('D_TRACE','my_init() for offline_checkout.html');
+ g.error.sdump('D_TRACE','my_init() for upload_xacts.html');
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
try { window.xulG.set_tab_name('Upload Offline Transactions'); } catch(E) { alert(E); }
}
- g.cgi = new CGI();
-
- JSAN.use('util.file'); g.file = new util.file( g.cgi.param('filename') );
+ JSAN.use('util.file'); g.file = new util.file( xul_param('filename') );
if (g.file._file.exists()) {
$('submit').disabled = false;
return;
}
- $( 'ws' ).setAttribute('value', g.cgi.param('ws'));
- $( 'ses' ).setAttribute('value', g.cgi.param('ses'));
- $( 'seskey' ).setAttribute('value', g.cgi.param('seskey'));
- $( 'delta' ).setAttribute('value', g.cgi.param('delta'));
+ $( 'ws' ).setAttribute('value', xul_param('ws'));
+ $( 'ses' ).setAttribute('value', xul_param('ses'));
+ $( 'seskey' ).setAttribute('value', xul_param('seskey'));
+ $( 'delta' ).setAttribute('value', xul_param('delta'));
$( 'form' ).setAttribute('action', xulG.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS_CGI));
<link rel="stylesheet" type="text/css" media="all" href="chrome://global/skin/" title="chrome_skin" />
<script type="text/javascript" src="/xul/server/main/JSAN.js"></script>
<script type="text/javascript" src="/xul/server/main/constants.js" />
+ <script type="text/javascript" src="/xul/server/OpenILS/global_util.js" />
<script type="text/javascript" src="/opac/common/js/utils.js" />
<script type="text/javascript" src="/opac/common/js/CGI.js" />
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
- g.cgi = new CGI();
- docid = g.cgi.param('docid');
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+ docid = xul_param('docid');
+
+ var key = location.pathname + location.search + location.hash;
+ if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+ var xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
+ if (typeof xulG == 'object') {
+ docid = xulG.docid;
+ }
+ }
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
if (docid > -1) {
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
data.last_record = docid; data.stash('last_record');
g.network.request(
}
function view_marc() {
- JSAN.use('util.window'); var win = new util.window();
- if (docid < 0) {
- alert('Item not cataloged.');
- } else {
- win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
+ try {
+ JSAN.use('util.window'); var win = new util.window();
+ if (docid < 0) {
+ alert('Item not cataloged.');
+ } else {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ //win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
+ win.open( urls.XUL_MARC_VIEW, 'marc_view', 'chrome,resizable,modal,width=400,height=400',{'noprint':1,'docid':docid});
+ }
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('spawning marc display',E);
}
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
- +'?doc_id=' + window.escape(obj.docid)
- +'&ou_ids=' + window.escape( js2JSON(list) )
- +'©_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(obj.docid)
+ //+'&ou_ids=' + window.escape( js2JSON(list) )
+ //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
title,
'chrome,resizable'
);
w.refresh = function() { obj.refresh_list(); }
+ w.xulG = { 'doc_id':obj.docid, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut };
} catch(E) {
obj.error.standard_unexpected_error_alert('copy browser -> add copies',E);
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
- +'?doc_id=' + window.escape(obj.docid)
- +'&ou_ids=' + window.escape( js2JSON(list) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(obj.docid)
+ //+'&ou_ids=' + window.escape( js2JSON(list) ),
title,
'chrome,resizable'
);
w.refresh = function() { obj.refresh_list() };
+ w.xulG = { 'doc_id' : obj.docid, 'ou_ids' : list };
} catch(E) {
obj.error.standard_unexpected_error_alert('copy browser -> add volumes',E);
}
var title = list.length == 1 ? 'Volume' : 'Volumes';
JSAN.use('util.window'); var win = new util.window();
- obj.data.volumes_temp = js2JSON( list );
- obj.data.stash('volumes_temp');
- var w = win.open(
+ //obj.data.volumes_temp = js2JSON( list );
+ //obj.data.stash('volumes_temp');
+ var my_xulG = win.open(
window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
title,
- 'chrome,modal,resizable'
+ 'chrome,modal,resizable',
+ { 'volumes' : list }
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- obj.data.stash_retrieve();
- var volumes = JSON2js( obj.data.volumes_temp );
- obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
- if (volumes=='') return;
+ //obj.data.stash_retrieve();
+ var volumes = my_xulG.volumes;
+ if (!volumes) return;
volumes = util.functional.filter_list(
volumes,
xml += '</vbox>';
JSAN.use('OpenILS.data');
var data = new OpenILS.data(); data.init({'via':'stash'});
- data.temp_transfer = xml; data.stash('temp_transfer');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_transfer'
- + '&title=' + window.escape('Volume Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+ //data.temp_transfer = xml; data.stash('temp_transfer');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_transfer'
+ //+ '&title=' + window.escape('Volume Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+ { 'xml' : xml, 'title' : 'Volume Transfer' }
);
- data.init({'via':'stash'});
- if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
var robj = obj.network.simple_request(
'FM_ACN_TRANSFER',
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_copy_browser.xul');
- g.cgi = new CGI();
-
JSAN.use('cat.copy_browser'); g.copy_browser = new cat.copy_browser();
- g.copy_browser.init( { 'docid' : g.cgi.param('docid') } );
+ g.copy_browser.init( { 'docid' : xul_param('docid') } );
//if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
// try { window.xulG.set_tab_name('Holdings Maintenance'); } catch(E) { alert(E); }
var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'copy',bucket]);
- if (typeof robj == 'object') throw robj;
+ if (typeof robj == 'object') {
+ if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
+ alert('You already have a bucket with that name.');
+ return;
+ }
+ throw robj;
+ }
alert('Bucket "' + name + '" created.');
function(o) { return JSON2js(o)[1]; }
);
var url = urls.XUL_COPY_STATUS; // + '?barcodes=' + window.escape( js2JSON(barcodes) );
- JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
- data.temp_barcodes_for_copy_status = barcodes;
- data.stash('temp_barcodes_for_copy_status');
- xulG.new_tab( url, {}, {});
+ //JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+ //data.temp_barcodes_for_copy_status = barcodes;
+ //data.stash('temp_barcodes_for_copy_status');
+ xulG.new_tab( url, {}, { 'barcodes' : barcodes });
} catch(E) {
obj.error.standard_unexpected_error_alert('Copy Status from Copy Buckets',E);
}
g.error.sdump('D_TRACE','my_init() for copy_buckets.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.cgi = new CGI();
- var copy_ids = [];
- if (g.cgi.param('copy_ids')) copy_ids = copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
- if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
- copy_ids = copy_ids.concat( window.xulG.copy_ids );
- if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
- copy_ids = copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
- g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
- }
+ var copy_ids = xul_param(
+ 'copy_ids',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'JSON2js_if_xpcom' : true,
+ 'stash_name':'cb_temp_copy_ids',
+ 'clear_xpcom' : true,
+ }
+ );
JSAN.use('cat.copy_buckets'); g.copy_buckets = new cat.copy_buckets();
g.copy_buckets.init(
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.cgi = new CGI();
- g.copy_ids = [];
- if (g.cgi.param('copy_ids')) g.copy_ids = g.copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
- if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
- g.copy_ids = g.copy_ids.concat( window.xulG.copy_ids );
- if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
- g.copy_ids = g.copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
- g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
- }
+ g.copy_ids = xul_param(
+ 'copy_ids',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'JSON2js_if_xpcom' : true,
+ 'stash_name':'cb_temp_copy_ids',
+ 'clear_xpcom' : true,
+ }
+ );
$('desc').appendChild( document.createTextNode(
(g.copy_ids.length == 1 ?
var g = {};
+var xulG = {};
+
function my_init() {
try {
/******************************************************************************************************/
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
JSAN.use('util.network'); g.network = new util.network();
- g.cgi = new CGI();
-
- g.docid = g.cgi.param('docid');
- g.handle_update = g.cgi.param('handle_update');
+ g.docid = xul_param('docid',{'modal_xulG':true});
+ g.handle_update = xul_param('handle_update',{'modal_xulG':true});
/******************************************************************************************************/
/* Get the copy ids from various sources and flesh them */
- var copy_ids = [];
- if (g.cgi.param('copy_ids')) copy_ids = JSON2js( g.cgi.param('copy_ids') );
- if (window.xulG && window.xulG.copy_ids) copy_ids = copy_ids.concat( window.xulG.copy_ids );
- if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) );
+ var copy_ids = xul_param('copy_ids',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xulG':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copy_ids','clear_xpcom':true,'modal_xulG':true});
if (!copy_ids) copy_ids = [];
- if (copy_ids.length > 0) g.copies = g.network.request(
- api.FM_ACP_FLESHED_BATCH_RETRIEVE.app,
- api.FM_ACP_FLESHED_BATCH_RETRIEVE.method,
+ if (copy_ids.length > 0) g.copies = g.network.simple_request(
+ 'FM_ACP_FLESHED_BATCH_RETRIEVE',
[ copy_ids ]
);
/* And other fleshed copies if any */
if (!g.copies) g.copies = [];
- if (window.xulG && window.xulG.copies) g.copies = g.copies.concat( window.xulG.copies );
- if (g.cgi.param('copies')) g.copies = g.copies.concat( JSON2js( g.cgi.param('copies') ) );
- if (g.data.temp_copies != 'undefined' && g.data.temp_copies) g.copies = g.copies.concat( JSON2js( g.data.temp_copies ) );
- g.data.temp_copies = null; g.data.stash('temp_copies');
+ var c = xul_param('copies',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copies','clear_xpcom':true,'modal_xulG':true})
+ if (c) g.copies = g.copies.concat(c);
/******************************************************************************************************/
/* We try to retrieve callnumbers for existing copies, but for new copies, we rely on this */
- if (window.xulG && window.xulG.callnumbers) g.callnumbers = window.xulG.callnumbers;
- if (g.cgi.param('callnumbers')) g.callnumbers = JSON2js( g.cgi.param('callnumbers') );
- if (g.data.temp_callnumbers != 'undefined') g.callnumbers = JSON2js( g.data.temp_callnumbers );
+ g.callnumbers = xul_param('callnumbers',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_callnumbers','clear_xpcom':true,'modal_xulG':true});
/******************************************************************************************************/
/* Is the interface an editor or a viewer, single or multi copy, existing copies or new copies? */
- if (g.cgi.param('edit') == '1') {
+ if (xul_param('edit',{'modal_xulG':true}) == '1') {
g.edit = true;
document.getElementById('caption').setAttribute('label','Copy Editor');
document.getElementById('save').setAttribute('hidden','false');
/* store the copies in the global xpcom stash */
g.stash_and_close = function() {
- if (g.handle_update) {
- try {
- var r = g.network.request(
- api.FM_ACP_FLESHED_BATCH_UPDATE.app,
- api.FM_ACP_FLESHED_BATCH_UPDATE.method,
- [ ses(), g.copies, true ]
- );
- if (typeof r.ilsevent != 'undefined') {
- g.error.standard_unexpected_error_alert('copy update',r);
- } else {
- alert('Items added/modified.');
+ try {
+ if (g.handle_update) {
+ try {
+ var r = g.network.request(
+ api.FM_ACP_FLESHED_BATCH_UPDATE.app,
+ api.FM_ACP_FLESHED_BATCH_UPDATE.method,
+ [ ses(), g.copies, true ]
+ );
+ if (typeof r.ilsevent != 'undefined') {
+ g.error.standard_unexpected_error_alert('copy update',r);
+ } else {
+ alert('Items added/modified.');
+ }
+ /* FIXME -- revisit the return value here */
+ } catch(E) {
+ alert('copy update error: ' + js2JSON(E));
}
- /* FIXME -- revisit the return value here */
- } catch(E) {
- alert('copy update error: ' + js2JSON(E));
}
+ //g.data.temp_copies = js2JSON( g.copies );
+ //g.data.stash('temp_copies');
+ xulG.copies = g.copies;
+ update_modal_xulG(xulG);
+ window.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('stash and close',E);
}
- g.data.temp_copies = js2JSON( g.copies );
- g.data.stash('temp_copies');
- g.error.sdump('D_CAT','in modal window, g.data.temp_copies = \n' + g.data.temp_copies + '\n');
- window.close();
}
/******************************************************************************************************/
g.copy_notes = function() {
JSAN.use('util.window'); var win = new util.window();
- win.open(urls.XUL_COPY_NOTES + '?copy_id=' + window.escape(g.copies[0].id()),'Copy Notes','chrome,resizable,modal');
+ win.open(
+ urls.XUL_COPY_NOTES,
+ //+ '?copy_id=' + window.escape(g.copies[0].id()),
+ 'Copy Notes','chrome,resizable,modal',
+ { 'copy_id' : g.copies[0].id() }
+ );
}
g.error.sdump('D_TRACE','my_init() for copy_notes.xul');
- g.cgi = new CGI();
- g.copy_id = g.cgi.param('copy_id');
+ g.copy_id = xul_param('copy_id',{'modal_xulG':true});
refresh();
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1"><caption label="New Note"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows><row><label value="Public?"/><checkbox id="pub" name="fancy_data" checked="false"/></row><row><label value="Title"/><textbox id="title" name="fancy_data"/></row><row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row><row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/><button label="Add Note" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- g.data.init({'via':'stash'});
- g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_note_xml'
- + '&focus=' + window.escape('title')
- + '&title=' + window.escape('Add Note'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ //g.data.init({'via':'stash'});
+ //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_note_xml'
+ //+ '&focus=' + window.escape('title')
+ //+ '&title=' + window.escape('Add Note'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'xml' : xml, 'focus' : 'title', 'title' : 'Add Note' }
);
- g.data.init({'via':'stash'});
- if (g.data.fancy_prompt_data != '') {
+ //g.data.init({'via':'stash'});
+ if (fancy_prompt_data.fancy_status == 'complete') {
//alert(js2JSON(g.data.fancy_prompt_data));
var note = new acpn();
note.isnew(1);
- note.title( g.data.fancy_prompt_data.title );
- note.value( g.data.fancy_prompt_data.note );
- note.pub( get_bool( g.data.fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
+ note.title( fancy_prompt_data.title );
+ note.value( fancy_prompt_data.note );
+ note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
note.owning_copy( g.copy_id );
var r = g.network.simple_request('FM_ACPN_CREATE',[ ses(), note ]);
if (typeof r.ilsevent != 'undefined') throw(r);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_copy_summary.xul');
- g.cgi = new CGI();
- var copy_id = g.cgi.param('copy_id');
+ var copy_id = xul_param('copy_id');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date'); JSAN.use('util.widgets');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
- var copy;
- if (g.data.temp_copy) {
- copy = g.data.temp_copy; g.data.temp_copy = null; g.data.stash('temp_copy');
- }
- var callnumber;
- if (g.data.temp_callnumber) {
- callnumber = g.data.temp_callnumber; g.data.temp_callnumber = null; g.data.stash('temp_callnumber');
- }
+ var copy = xul_param('copy',{'stash_name':'temp_copy','clear_xpcom':true});
+ var callnumber = xul_param('callnumber',{'stash_name':'temp_callnumber','clear_xpcom':true});
$('caption').setAttribute('tooltiptext','Copy ID = ' + (copy_id || copy.id() ) );
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat/marc_view.xul');
- g.cgi = new CGI();
- var docid = g.cgi.param('docid');
+ var docid = xul_param('docid');
+ var noprint = xul_param('noprint');
+
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ var key = location.pathname + location.search + location.hash;
+ if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+ var modal_xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
+ if (typeof modal_xulG == 'object') {
+ docid = modal_xulG.docid;
+ if (modal_xulG.noprint) noprint = modal_xulG.noprint;
+ }
+ }
JSAN.use('util.network'); g.network = new util.network();
[ docid ],
function(req) {
marc_html = req.getResultObject();
- if (g.cgi.param('noprint')||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
+ if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
}
);
var holdings_obj;
var holds_obj;
+ var iframe_method = 'reset_iframe'; // set_iframe
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.network'); g.network = new util.network();
- g.cgi = new CGI();
- try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
- try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
- try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
+ try { authtime = xul_param('authtime'); } catch(E) { g.error.sdump('D_ERROR',E); }
+ try { docid = xul_param('docid'); } catch(E) { g.error.sdump('D_ERROR',E); }
+ try { opac_url = xul_param('opac_url'); } catch(E) { g.error.sdump('D_ERROR',E); }
JSAN.use('util.deck');
top_pane = new util.deck('top_pane');
}
function set_brief_view() {
- try {
- var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
- dump('spawning ' + url + '\n');
- top_pane.set_iframe(
- url,
- {},
- {
- 'set_tab_name' : function(n) {
- if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
- try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
- } else {
- dump('no set_tab_name\n');
+ try {
+ var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ); // + '?docid=' + window.escape(docid);
+ dump('spawning ' + url + '\n');
+ top_pane[iframe_method](
+ url,
+ {},
+ {
+ 'docid' : docid,
+ 'set_tab_name' : function(n) {
+ if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+ try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
+ } else {
+ dump('no set_tab_name\n');
+ }
}
- }
- }
- );
- } catch(E) {
- alert(E);
- }
+ }
+ );
+ } catch(E) {
+ alert(E);
+ }
}
function set_marc_view() {
- try {
- bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
- } catch(E) {
- alert(E);
- }
+ try {
+ bottom_pane[iframe_method](
+ xulG.url_prefix( urls.XUL_MARC_VIEW ), // + '?docid=' + window.escape(docid),
+ {},
+ {
+ 'docid' : docid,
+ }
+ );
+ } catch(E) {
+ alert(E);
+ }
}
function set_marc_edit() {
},
},
'url' : xulG.url_prefix( urls.XUL_MARC_EDIT ),
+ 'name' : 'MarcEditor',
};
if (editor_obj) return;
JSAN.use('util.browser');
editor_obj = new util.browser();
editor_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=MarcEditor',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=MarcEditor',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'editor',
function set_copy_browser() {
try {
bottom_pane.node.selectedIndex = 2;
+ xulG.docid = docid;
var content_params = {
'show_nav_buttons' : false,
'show_print_button' : false,
'passthru_content_params' : xulG,
- 'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),
+ 'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ), // + '?docid=' + window.escape(docid),
+ 'name' : 'HoldingsMaintenance',
};
if (holdings_obj) return;
JSAN.use('util.browser');
holdings_obj = new util.browser();
holdings_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=HoldingsMaintenance',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=HoldingsMaintenance',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'holdings',
function set_hold_browser() {
try {
bottom_pane.node.selectedIndex = 3;
+ xulG.docid = docid;
var content_params = {
'show_nav_buttons' : false,
'show_print_button' : false,
'passthru_content_params' : xulG,
- 'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),
+ 'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ), // + '?docid=' + window.escape(docid),
+ 'name' : 'Holds',
};
if (holds_obj) return;
JSAN.use('util.browser');
holds_obj = new util.browser();
holds_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Holds',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Holds',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'holds',
win.attachEvt("rdetail", "recordRetrieved",
function(id){
try {
- var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid)
- dump('removing ' + url + '\n');
- try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
docid = id;
+ browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
+ top_pane.clear(); bottom_pane.clear();
set_brief_view();
document.getElementById('nav').setAttribute('hidden','false');
} catch(E) {
);
},
'url_prefix' : xulG.url_prefix,
+ 'name' : 'Catalog',
};
if (opac_url) content_params.url = opac_url;
if (browser_obj) return;
browser_obj = new util.browser();
browser_obj.init(
{
- 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog',
+ 'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Catalog',
'push_xulG' : true,
'alt_print' : false,
'browser_id' : 'browser',
function remove_me() {
try {
- var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
- dump('removing ' + url + '\n');
- try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
- document.getElementById('nav').setAttribute('hidden','true');
+ browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
+ top_pane.clear(); bottom_pane.clear();
+ document.getElementById('nav').setAttribute('hidden','true');
} catch(E) {
alert(E);
}
}
function add_to_bucket() {
- try {
- JSAN.use('util.window'); var win = new util.window();
- win.open(
- xulG.url_prefix(urls.XUL_RECORD_BUCKETS)
- + '?record_ids=' + js2JSON( [ docid ] ),
- 'sel_bucket_win' + win.window_name_increment(),
- 'chrome,resizable,modal,center'
- );
- } catch(E) {
- alert(E);
- }
+ try {
+ JSAN.use('util.window'); var win = new util.window();
+ win.open(
+ xulG.url_prefix(urls.XUL_RECORD_BUCKETS),
+ //+ '?record_ids=' + js2JSON( [ docid ] ),
+ 'sel_bucket_win' + win.window_name_increment(),
+ 'chrome,resizable,modal,center',
+ { 'record_ids' : [ docid ] }
+ );
+ } catch(E) {
+ alert(E);
+ }
}
function refresh() {
var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
- if (typeof robj == 'object') throw robj;
+ if (typeof robj == 'object') {
+ if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
+ alert('You already have a bucket with that name.');
+ return;
+ }
+ throw robj;
+ }
+
alert('Bucket "' + name + '" created.');
xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
}
xml += '</tr></table></form>';
- obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
- obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
+ //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
+ //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_merge_mid'
- + '&top_xml_in_stash=temp_merge_top'
- + '&title=' + window.escape('Record Merging'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_merge_mid'
+ //+ '&top_xml_in_stash=temp_merge_top'
+ //+ '&title=' + window.escape('Record Merging'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ {
+ 'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Merging'
+ }
);
obj.data.stash_retrieve();
if (obj.data.fancy_prompt_data == '') { alert('Merge Aborted'); return; }
g.error.sdump('D_TRACE','my_init() for record_buckets.xul');
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.cgi = new CGI();
- var record_ids = [];
- if (g.cgi.param('record_ids')) record_ids = record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
- if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
- record_ids = record_ids.concat( window.xulG.record_ids );
- if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
- record_ids = record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
- g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
- }
-
+ var record_ids = xul_param(
+ 'record_ids',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'JSON2js_if_xpcom' : true,
+ 'stash_name':'rb_temp_record_ids',
+ 'clear_xpcom' : true,
+ }
+ );
JSAN.use('cat.record_buckets'); g.record_buckets = new cat.record_buckets();
g.record_buckets.init(
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.cgi = new CGI();
- g.record_ids = [];
- if (g.cgi.param('record_ids')) g.record_ids = g.record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
- if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
- g.record_ids = g.record_ids.concat( window.xulG.record_ids );
- if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
- g.record_ids = g.record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
- g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
- }
+ g.record_ids = xul_param(
+ 'record_ids',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'JSON2js_if_xpcom' : true,
+ 'stash_name':'rb_temp_record_ids',
+ 'clear_xpcom' : true,
+ }
+ );
$('desc').appendChild( document.createTextNode(
(g.record_ids.length == 1 ?
}
html += '</body></html>';
JSAN.use('util.window'); var win = new util.window();
- var loc = ( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
+ var loc = ( urls.XUL_REMOTE_BROWSER );
+ //+ '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550');
- w.xulG = { 'on_url_load' : function(b) {
- try {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
- if (typeof w.xulG.written == 'undefined') {
- w.xulG.written = true;
- w.g.browser.get_content().document.write(html);
- w.g.browser.get_content().document.close();
+ w.xulG = {
+ 'url' : 'about:blank',
+ 'show_print_button' : 1,
+ 'alternate_print' : 1,
+ 'no_xulG' : 1,
+ 'title' : 'Spine Labels',
+ 'on_url_load' : function(b) {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ if (typeof w.xulG.written == 'undefined') {
+ w.xulG.written = true;
+ w.g.browser.get_content().document.write(html);
+ w.g.browser.get_content().document.close();
+ }
+ } catch(E) {
+ alert(E);
}
- } catch(E) {
- alert(E);
- }
- } };
+ },
+ };
} catch(E) {
g.error.standard_unexpected_error_alert('Preview and Print',E);
}
xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + params.docid + '"/>';
xml += '</vbox>';
- data.temp_transfer = xml; data.stash('temp_transfer');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_transfer'
- + '&title=' + window.escape('Item Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+ //data.temp_transfer = xml; data.stash('temp_transfer');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_transfer'
+ //+ '&title=' + window.escape('Item Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+ { 'xml' : xml, 'title' : 'Item Transfer' }
);
- data.stash_retrieve();
- if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
JSAN.use('util.functional');
cat.util.spawn_copy_editor = function(list,edit) {
try {
var obj = {};
- JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
JSAN.use('util.network'); obj.network = new util.network();
JSAN.use('util.error'); obj.error = new util.error();
title += ' Copy Attributes';
JSAN.use('util.window'); var win = new util.window();
- obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
- obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
- obj.data.temp_copy_ids = js2JSON(list);
- obj.data.stash('temp_copy_ids');
- var w = win.open(
- window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
- +'?handle_update=1&edit='+edit,
+ //JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+ //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
+ //obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
+ //obj.data.temp_copy_ids = js2JSON(list); obj.data.stash('temp_copy_ids');
+ var my_xulG = win.open(
+ //window.xulG.url_prefix(urls.XUL_COPY_EDITOR),
+ (urls.XUL_COPY_EDITOR),
+ // +'?handle_update=1&edit='+edit,
title,
- 'chrome,modal,resizable'
+ 'chrome,modal,resizable',
+ {
+ 'handle_update' : 1,
+ 'edit' : edit,
+ 'copy_ids' : js2JSON(list),
+ }
);
- /* FIXME -- need to unique the temp space, and not rely on modalness of window */
- obj.data.stash_retrieve();
- if (!obj.data.temp_copies) alert('Copies not modified.');
- obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
- obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
- obj.data.temp_copy_ids = undefined; obj.data.stash('temp_copy_ids');
+ //obj.data.stash_retrieve();
+ if (!my_xulG.copies) alert('Copies not modified.');
+ //if (!obj.data.temp_copies) alert('Copies not modified.');
+ //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
} catch(E) {
JSAN.use('util.error'); var error = new util.error();
error.standard_unexpected_error_alert('error in cat.util.spawn_copy_editor',E);
JSAN.use('util.network'); g.network = new util.network();
- g.cgi = new CGI();
-
/***********************************************************************************************************/
/* What record am I dealing with? Am I adding just copies or copies and volumes? */
- g.doc_id = g.cgi.param('doc_id');
- document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + window.escape(g.doc_id));
+ 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 };
- g.copy_shortcut = g.cgi.param('copy_shortcut');
- g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + g.cgi.param('ou_ids'));
- if (g.copy_shortcut) g.copy_shortcut = JSON2js( g.copy_shortcut );
+ 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'));
- var ou_ids = [];
- if (g.cgi.param('ou_ids'))
- ou_ids = JSON2js( g.cgi.param('ou_ids') );
- if (!ou_ids) ou_ids = [];
- if (window.xulG && window.xulG.ou_ids)
- ou_ids = ou_ids.concat( window.xulG.ou_ids );
+ var ou_ids = xul_param('ou_ids',{'JSON2js_if_cgi' : true, 'concat' : true});;
/***********************************************************************************************************/
/* For the call number drop down */
JSAN.use('util.window'); var win = new util.window();
if (copies.length > 0) {
- g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
- g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
- //g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
- g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
- var w = win.open(
- urls.XUL_COPY_EDITOR
- +'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
+ //g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
+ //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+ ////g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
+ //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+ var my_xulG = win.open(
+ urls.XUL_COPY_EDITOR,
+ //+'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
title,
- 'chrome,modal,resizable'
+ 'chrome,modal,resizable',
+ { 'edit' : 1, 'handle_update' : 1, 'docid' : g.doc_id, 'copies' : copies }
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- g.data.stash_retrieve();
- copies = JSON2js( g.data.temp_copies );
- g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
- g.data.temp_copies = undefined; g.data.stash('temp_copies');
- g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+ //g.data.stash_retrieve();
+ //copies = JSON2js( g.data.temp_copies );
+ copies = my_xulG.copies;
+ //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+ //g.data.temp_copies = undefined; g.data.stash('temp_copies');
+ //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
if (!copies) {
alert('Items were not created.');
return;
<script>
<![CDATA[
+ var xulG = {};
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
- g.cgi = new CGI();
-
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.functional');
- g.volumes = JSON2js( g.data.volumes_temp );
- g.data.volumes_temp = ''; g.data.stash('volumes_temp');
+ g.volumes = xul_param('volumes',{'stash_name':'volumes_temp','clear_xpcom':true,'modal_xulG':true}); //JSON2js( g.data.volumes_temp );
+ //g.data.volumes_temp = ''; g.data.stash('volumes_temp');
var rows = document.getElementById('rows');
}
tb.setAttribute('value',g.volumes[i].label());
- tb.setAttribute('onchange','var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value );');
+ tb.setAttribute('onchange','try { var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value ); } catch(E) { alert(E); }');
}
} catch(E) {
}
g.stash_and_close = function() {
- g.data.volumes_temp = js2JSON( g.volumes );
- g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
- g.data.stash('volumes_temp');
- window.close();
+ try {
+ //g.data.volumes_temp = js2JSON( g.volumes );
+ //g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
+ //g.data.stash('volumes_temp');
+ xulG.volumes = g.volumes;
+ update_modal_xulG(xulG);
+ window.close();
+ } catch(E) {
+ alert('FIXME: volume editor -> ' + E);
+ }
}
]]>
},
'confirm_overlay' : function(record_ids) {
- var obj = this; JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+ var obj = this; // JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
var top_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" >';
top_xml += '<description>Overlay this record?</description>';
xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
}
xml += '</tr></table></form>';
- data.temp_merge_top = top_xml; data.stash('temp_merge_top');
- data.temp_merge_mid = xml; data.stash('temp_merge_mid');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_merge_mid'
- + '&top_xml_in_stash=temp_merge_top'
- + '&title=' + window.escape('Record Overlay'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ // data.temp_merge_top = top_xml; data.stash('temp_merge_top');
+ // data.temp_merge_mid = xml; data.stash('temp_merge_mid');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ // + '?xml_in_stash=temp_merge_mid'
+ // + '&top_xml_in_stash=temp_merge_top'
+ // + '&title=' + window.escape('Record Overlay'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Overlay' }
);
- data.stash_retrieve();
- if (data.fancy_prompt_data == '') { alert('Overlay Aborted'); return false; }
+ //data.stash_retrieve();
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Overlay Aborted'); return false; }
return true;
},
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for cat_z3950.xul');
- g.cgi = new CGI();
-
JSAN.use('cat.z3950'); g.z3950 = new cat.z3950();
g.z3950.init(
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for checkin.xul');
- g.cgi = new CGI(); var tab_name;
- if (g.cgi.param('hold_capture') == 1) {
+ var tab_name;
+ if (xul_param('hold_capture')) {
document.getElementById('checkin_auto').checked = true;
document.getElementById('checkin_auto').hidden = true;
document.getElementById('checkin_effective_date_hbox').hidden = true;
this.check_disable();
- var robj = obj.network.simple_request(
+ var robj = obj.network.cached_request(
'FM_CIRC_COUNT_RETRIEVE_VIA_USER',
[ ses(), obj.patron_id ]
);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for checkout.xul');
- g.cgi = new CGI();
-
- var patron_id = g.cgi.param('patron_id') || xulG.patron_id;
+ var patron_id = xul_param('patron_id');
JSAN.use('circ.checkout'); g.checkout = new circ.checkout();
g.checkout.init(
try {
g.error.standard_unexpected_error_alert('circ/checkout.xul',E);
} catch(F) {
- alert('FIXME: circ/checkout.xul -> ' + E);
+ dump('FIXME: circ/checkout.xul -> ' + E + ' -> ' + F + '\n');
}
}
}
function default_focus() {
try {
var x = document.getElementById('checkout_barcode_entry_textbox');
+ if (!x) return;
if (x.disabled) {
document.getElementById('checkout_duedate_menu').inputField.focus();
} else {
x.focus();
}
} catch(E) {
- g.error.sdump('D_ERROR','checkout default_focus(): ' + js2JSON(E));
+ try { g.error.sdump('D_ERROR','checkout default_focus(): ' + js2JSON(E)); } catch(F) { dump('FIXME: circ/checkout.xul default_focus() -> ' + E + ' -> ' + F) }
}
}
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
- g.cgi = new CGI();
- g.circ_id = g.cgi.param('circ_id');
+ g.circ_id = xul_param('circ_id');
- if (g.cgi.param('caption')) $('caption').setAttribute('label',g.cgi.param('caption'));
- if (g.cgi.param('no_border')) $('gb').setAttribute('style','border: none');
+ var caption = xul_param('caption'); if (caption) $('caption').setAttribute('label',caption);
+ if (xul_param('no_border')) $('gb').setAttribute('style','border: none');
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
JSAN.use('util.window');
var win = new util.window();
var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD
- + '?patron_id=' + window.escape(g.patron_id)
- + '&xact_id=' + window.escape( g.circ_id ),
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(g.patron_id)
+ //+ '&xact_id=' + window.escape( g.circ_id ),
'billwizard',
- 'chrome,resizable,modal'
+ 'chrome,resizable,modal',
+ { 'patron_id' : g.patron_id, 'xact_id' : g.circ_id }
);
}
<![CDATA[
function $(id) { return document.getElementById(id); }
+ var xulG = {};
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
- g.cgi = new CGI();
- g.copy_id = g.cgi.param('copy_id');
- g.count = g.cgi.param('count');
+ g.copy_id = xul_param('copy_id',{'modal_xulG':true});
+ g.count = xul_param('count',{'modal_xulG':true});
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
- $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
- $('mid').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + g.copy.id());
+ $('top').setAttribute('src',urls.XUL_BIB_BRIEF);// + '?docid=' + g.callnumber.record());
+ $('top').contentWindow.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() };
show_circs();
iframe.setAttribute('style','overflow: none; min-height: 100px;');
iframe.setAttribute('flex','1');
gb.appendChild(iframe);
- iframe.setAttribute('src', urls.XUL_CIRC_BRIEF + '?circ_id=' + g.circs[j].id() );
+ iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
+ iframe.contentWindow.xulG = { 'circ_id' : g.circs[j].id() };
}
} catch(E) {
g.error.standard_unexpected_error_alert('error showing circs',E);
}
function retrieve_last() {
- g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
- g.data.stash('fancy_prompt_data');
- window.close();
+ try {
+ //g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
+ //g.data.stash('fancy_prompt_data');
+ xulG.retrieve_these_patrons = [ g.circs[0].usr() ];
+ update_modal_xulG(xulG);
+ window.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('retrieve_last',E);
+ }
}
function retrieve_all() {
- var patrons = []; var p_hash = {};
- for (var i = 0; i < g.circs.length; i++) {
- var usr = g.circs[i].usr();
- if (typeof p_hash[usr] != 'undefined') { continue; }
- p_hash[usr] = true;
- patrons.push( function(a){return a;}(usr) );
+ try {
+ var patrons = []; var p_hash = {};
+ for (var i = 0; i < g.circs.length; i++) {
+ var usr = g.circs[i].usr();
+ if (typeof p_hash[usr] != 'undefined') { continue; }
+ p_hash[usr] = true;
+ patrons.push( function(a){return a;}(usr) );
+ }
+ //g.data.fancy_prompt_data = js2JSON(patrons);
+ //g.data.stash('fancy_prompt_data');
+ xulG.retrieve_these_patrons = patrons;
+ update_modal_xulG(xulG);
+ window.close();
+ } catch(E) {
+ g.error.standard_unexpected_error_alert('retrieve_all',E);
}
- g.data.fancy_prompt_data = js2JSON(patrons);
- g.data.stash('fancy_prompt_data');
- window.close();
}
]]>
<![CDATA[
function $(id) { return document.getElementById(id); }
+ var xulG = {};
+
function my_init() {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for circ_copy_details.xul');
- g.cgi = new CGI();
- g.copy_id = g.cgi.param('copy_id');
+ g.copy_id = xul_param('copy_id',{'modal_xulG':true});
JSAN.use('util.network'); g.network = new util.network();
JSAN.use('util.date');
//g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
//if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
- $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?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');
+ $('top').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.callnumber.record());
+ $('top').contentWindow.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 };
$('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').setAttribute('src',urls.XUL_CIRC_BRIEF); // + '?no_border=1');
+ $('circ').contentWindow.xulG = { 'no_border' : 1 };
if (g.circ.checkin_time()) {
$('circ_caption').setAttribute('label','Last Circulation');
} else {
function retrieve_last_patron() {
try {
- g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
- g.data.stash('fancy_prompt_data');
+ //g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
+ //g.data.stash('fancy_prompt_data');
+ xulG.retrieve_these_patrons = [ g.circ.user() ];
+ update_modal_xulG(xulG);
window.close();
} catch(E) {
alert(E);
function retrieve_hold_patron() {
try {
- g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
- g.data.stash('fancy_prompt_data');
+ //g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
+ //g.data.stash('fancy_prompt_data');
+ xulG.retrieve_these_patrons = [ g.hold.user() ];
+ update_modal_xulG(xulG);
window.close();
} catch(E) {
alert(E);
JSAN.use('util.barcode');
JSAN.use('util.date');
JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+ JSAN.use('util.sound'); this.sound = new util.sound();
}
circ.copy_status.prototype = {
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
- +'?doc_id=' + window.escape(r)
- +'&ou_ids=' + window.escape( js2JSON(list) )
- +'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(r)
+ //+'&ou_ids=' + window.escape( js2JSON(list) )
+ //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
title,
- 'chrome,resizable'
+ 'chrome,resizable',
+ { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] }
);
}
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
- window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
- +'?doc_id=' + window.escape(r)
- +'&ou_ids=' + window.escape( js2JSON(list) ),
+ window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+ //+'?doc_id=' + window.escape(r)
+ //+'&ou_ids=' + window.escape( js2JSON(list) ),
title,
- 'chrome,resizable'
+ 'chrome,resizable',
+ { 'doc_id' : r, 'ou_ids' : list }
);
}
var title = (list.length == 1 ? 'Volume' : 'Volumes') + ' for record # ' + rec;
JSAN.use('util.window'); var win = new util.window();
- obj.data.volumes_temp = js2JSON( list );
- obj.data.stash('volumes_temp');
- var w = win.open(
+ //obj.data.volumes_temp = js2JSON( list );
+ //obj.data.stash('volumes_temp');
+ var my_xulG = win.open(
window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
title,
- 'chrome,modal,resizable'
+ 'chrome,modal,resizable',
+ { 'volumes' : list }
);
/* FIXME -- need to unique the temp space, and not rely on modalness of window */
- obj.data.stash_retrieve();
- var volumes = JSON2js( obj.data.volumes_temp );
- obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
- if (volumes=='') return;
+ //obj.data.stash_retrieve();
+ //var volumes = JSON2js( obj.data.volumes_temp );
+ var volumes = my_xulG.volumes;
+ if (!volumes) return;
volumes = util.functional.filter_list(
volumes,
xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
xml += '</vbox>';
JSAN.use('OpenILS.data');
- var data = new OpenILS.data(); data.init({'via':'stash'});
- data.temp_transfer = xml; data.stash('temp_transfer');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_transfer'
- + '&title=' + window.escape('Volume Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+ //var data = new OpenILS.data(); data.init({'via':'stash'});
+ //data.temp_transfer = xml; data.stash('temp_transfer');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_transfer'
+ //+ '&title=' + window.escape('Volume Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+ { 'xml' : xml, 'title' : 'Volume Transfer' }
);
- data.init({'via':'stash'});
- if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+ if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
var robj = obj.network.simple_request(
'FM_ACN_TRANSFER',
if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
}
JSAN.use('circ.util');
- obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ], function(req) {
+ function handle_req(req) {
try {
var details = req.getResultObject();
if (details == null) {
} catch(E) {
obj.error.standard_unexpected_error_alert('',E);
}
- } );
+ }
+ var result = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ]);
+ handle_req({'getResultObject':function(){return result;}}); // used to be async
obj.controller.view.copy_status_barcode_entry_textbox.value = '';
obj.controller.view.copy_status_barcode_entry_textbox.focus();
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for copy_status.xul');
- g.cgi = new CGI();
-
JSAN.use('circ.copy_status'); g.copy_status = new circ.copy_status();
g.copy_status.init(
{
try { window.xulG.set_tab_name('Item Status'); } catch(E) { alert(E); }
}
- g.barcodes = [];
- if (g.cgi.param('barcodes')) {
- g.barcodes = g.barcodes.concat( JSON2js(g.cgi.param('barcodes')) );
- }
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
- if (g.data.temp_barcodes_for_copy_status) {
- g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_copy_status );
- g.data.temp_barcodes_for_copy_status = null; g.data.stash('temp_barcodes_for_copy_status');
- }
+ g.barcodes = xul_param(
+ 'barcodes',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'stash_name':'temp_barcodes_for_copy_status',
+ 'clear_xpcom' : true,
+ }
+ ) || [];
+
if (g.barcodes.length > 0) {
JSAN.use('util.exec'); var exec = new util.exec();
var funcs = [];
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for hold_capture.xul');
- g.cgi = new CGI();
-
JSAN.use('circ.hold_capture'); g.hold_capture = new circ.hold_capture();
g.hold_capture.init(
{
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for in_house_use.xul');
- g.cgi = new CGI();
-
JSAN.use('circ.in_house_use'); g.in_house_use = new circ.in_house_use();
g.in_house_use.init(
{
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for print_list.xul');
- g.cgi = new CGI();
-
JSAN.use('circ.print_list_template_editor');
g.editor = new circ.print_list_template_editor();
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
- g.cgi = new CGI();
-
var tb = document.getElementById('barcode_tb');
tb.addEventListener(
'keypress',
try { window.xulG.set_tab_name('User Permission Editor'); } catch(E) { alert(E); }
}
- if (g.cgi.param('error')) {
- var error = g.cgi.param('error');
+ if (xul_param('error')) {
+ var error = xul_param('error');
alert(error);
}
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
- g.cgi = new CGI();
-
var tb = document.getElementById('barcode_tb');
tb.addEventListener(
'keypress',
try { window.xulG.set_tab_name('Check Out'); } catch(E) { alert(E); }
}
- if (g.cgi.param('error')) {
- var error = g.cgi.param('error');
+ if (xul_param('error')) {
+ var error = xul_param('error');
alert(error);
}
function $(id) { return document.getElementById(id); }
function retrieve_patron() {
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
if (g.patron_id) {
JSAN.use('patron.util');
if (get_bool(r_circ.phone_renewal() ) ) r += 'PHONE ';
$('renewal').value = r || 'No';
- $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
+ 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() };
$('copy_summary').hidden=false;
g.network.simple_request(
g.error.sdump('D_TRACE','my_init() for bill_details.xul');
- g.cgi = new CGI();
-
- g.mbts_id = g.cgi.param('mbts_id');
+ g.mbts_id = xul_param('mbts_id');
retrieve_patron();
function $(id) { return document.getElementById(id); }
function retrieve_patron() {
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
if (g.patron_id) {
JSAN.use('patron.util');
function retrieve_mbts_for_list() {
//var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
var method = 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY';
- if (g.cgi.param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
+ if (xul_param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
if (g.mbts_ids.ilsevent) {
switch(g.mbts_ids.ilsevent) {
$('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
$('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
- $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
+ 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() };
$('copy_summary').hidden=false;
g.network.simple_request(
g.error.sdump('D_TRACE','my_init() for bill_history.xul');
- g.cgi = new CGI();
-
retrieve_patron();
init_lists();
false
);
- if (g.cgi.param('current')) {
+ if (xul_param('current')) {
$('caption').setAttribute('label','Current Bills');
document.title = 'Current Bills';
} else {
JSAN.use('util.window');
var win = new util.window();
var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD
- + '?patron_id=' + window.escape(g.patron_id)
- + '&xact_id=' + window.escape( g.bill_list_selection[0] ),
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(g.patron_id)
+ //+ '&xact_id=' + window.escape( g.bill_list_selection[0] ),
'billwizard',
- 'chrome,resizable,modal'
+ 'chrome,resizable,modal',
+ { 'patron_id' : g.patron_id, 'xact_id' : g.bill_list_selection[0] }
);
g.bill_list.clear();
retrieve_mbts_for_list();
function handle_details() {
JSAN.use('util.window'); var win = new util.window();
- var w = win.open(
- urls.XUL_PATRON_BILL_DETAILS
- + '?patron_id=' + window.escape(g.patron_id)
- + '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_DETAILS,
+ //+ '?patron_id=' + window.escape(g.patron_id)
+ //+ '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
'test_billdetails',
- 'chrome,resizable'
+ 'chrome,resizable',
+ {
+ 'patron_id' : g.patron_id,
+ 'mbts_id' : g.bill_list_selection[0],
+ 'refresh' : function() {
+ if (typeof window.refresh == 'function') window.refresh();
+ if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
+ },
+ }
);
- w.xulG = { 'refresh' : function() {
- if (typeof window.refresh == 'function') window.refresh();
- if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
- } };
}
function print_bills() {
try {
g.bill_list.on_all_fleshed = function() {
try {
- var template = 'bills_historical'; if (g.cgi.param('current')) template = 'bills_current';
+ var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';
JSAN.use('patron.util');
var params = {
'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id),
}
function retrieve_patron() {
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id',{'modal_xulG':true});
if (g.patron_id) {
JSAN.use('patron.util');
ml.setAttribute('id','billing_type');
document.getElementById('menu_placeholder').appendChild(ml);
- g.cgi = new CGI();
-
retrieve_patron();
$('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
$('bill_amount').focus();
- if (g.cgi.param('xact_id')) {
- g.mbts_id = g.cgi.param('xact_id');
+ if (xul_param('xact_id',{'modal_xulG':true})) {
+ g.mbts_id = xul_param('xact_id',{'modal_xulG':true});
$('summary').hidden = false;
retrieve_mbts();
retrieve_circ();
function patron_bill_finish() {
try {
- var xact_id = g.cgi.param('xact_id');
+ var xact_id = xul_param('xact_id',{'modal_xulG':true});
if (!xact_id) {
var grocery = new mg();
grocery.isnew('1');
try {
JSAN.use('util.window');
var win = new util.window();
- var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD
- + '?patron_id=' + window.escape(obj.patron_id),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id),
'billwizard',
- 'chrome,resizable,modal'
+ 'chrome,resizable,modal',
+ { 'patron_id' : obj.patron_id }
);
obj.refresh();
} catch(E) {
JSAN.use('util.window');
var win = new util.window();
//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
- var w = win.open(
- urls.XUL_PATRON_BILL_HISTORY
- + '?patron_id=' + window.escape(obj.patron_id),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_HISTORY,
+ //+ '?patron_id=' + window.escape(obj.patron_id),
'billhistory',
//'chrome,resizable,modal'
- 'chrome,resizable'
+ 'chrome,resizable',
+ {
+ 'patron_id' : obj.patron_id,
+ 'refresh' : function() { obj.refresh(); }
+ }
);
- w.xulG = { 'refresh' : function() { obj.refresh(); } };
- //w.refresh = function() { obj.refresh(); };
} catch(E) {
obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E);
}
JSAN.use('util.window');
var win = new util.window();
//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
- var w = win.open(
- urls.XUL_PATRON_BILL_HISTORY
- + '?current=1&patron_id=' + window.escape(obj.patron_id),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_HISTORY,
+ //+ '?current=1&patron_id=' + window.escape(obj.patron_id),
'billhistory',
//'chrome,resizable,modal'
- 'chrome,resizable'
+ 'chrome,resizable',
+ {
+ 'current' : 1,
+ 'patron_id' : obj.patron_id,
+ 'refresh' : function() { obj.refresh(); },
+ }
);
- w.xulG = { 'refresh' : function() { obj.refresh(); } };
- //w.refresh = function() { obj.refresh(); };
} catch(E) {
obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);
}
var win = new util.window();
switch(obj.controller.view.payment_type.value) {
case 'credit_card_payment' :
- obj.OpenILS.data.temp = '';
- obj.OpenILS.data.stash('temp');
- var w = win.open(
+ //obj.OpenILS.data.temp = '';
+ //obj.OpenILS.data.stash('temp');
+ var my_xulG = win.open(
urls.XUL_PATRON_BILL_CC_INFO,
'billccinfo',
'chrome,resizable,modal'
);
- obj.OpenILS.data.stash_retrieve();
- /* FIXME -- need unique temp space name */
- payment_blob = JSON2js( obj.OpenILS.data.temp );
+ //obj.OpenILS.data.stash_retrieve();
+ payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
break;
case 'check_payment' :
- obj.OpenILS.data.temp = '';
- obj.OpenILS.data.stash('temp');
- var w = win.open(
+ //obj.OpenILS.data.temp = '';
+ //obj.OpenILS.data.stash('temp');
+ var my_xulG = win.open(
urls.XUL_PATRON_BILL_CHECK_INFO,
'billcheckinfo',
'chrome,resizable,modal'
);
- obj.OpenILS.data.stash_retrieve();
- /* FIXME -- need unique temp space name */
- payment_blob = JSON2js( obj.OpenILS.data.temp );
+ //obj.OpenILS.data.stash_retrieve();
+ payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
break;
}
if (payment_blob=='' || payment_blob.cancelled=='true') { alert('cancelled'); return; }
'command',
function(ev) {
JSAN.use('util.window'); var win = new util.window();
- var w = win.open(
- urls.XUL_PATRON_BILL_DETAILS
- + '?patron_id=' + window.escape(obj.patron_id)
- + '&mbts_id=' + window.escape(my.mobts.id()),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_DETAILS,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&mbts_id=' + window.escape(my.mobts.id()),
'test' + my.mobts.id(),
- 'chrome,resizable'
+ 'chrome,resizable',
+ {
+ 'patron_id' : obj.patron_id,
+ 'mbts_id' : my.mobts.id(),
+ 'refresh' : function() { obj.refresh(); },
+ }
);
- w.xulG = { 'refresh' : function() { obj.refresh(); } };
},
false
);
function(ev) {
JSAN.use('util.window');
var win = new util.window();
- var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD
- + '?patron_id=' + window.escape(obj.patron_id)
- + '&xact_id=' + window.escape( my.mobts.id() ),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&xact_id=' + window.escape( my.mobts.id() ),
'billwizard',
- 'chrome,resizable,modal'
+ 'chrome,resizable,modal',
+ {
+ 'patron_id' : obj.patron_id,
+ 'xact_id' : my.mobts.id(),
+ }
);
obj.refresh();
},
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for bills.xul');
- g.cgi = new CGI();
-
JSAN.use('patron.bills'); g.bills = new patron.bills();
g.bills.init(
{
- 'patron_id' : g.cgi.param('patron_id'),
+ 'patron_id' : xul_param('patron_id'),
}
);
window.refresh = function(p) { g.bills.refresh(p); }
function(ev) {
obj.reset_nav_styling('cmd_patron_items');
var frame = obj.right_deck.set_iframe(
- urls.XUL_PATRON_ITEMS
- + '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_ITEMS,
+ //+ '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
+ 'patron_id' : obj.patron.id(),
'on_list_change' : function(b) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
obj.summary_window.g.summary.controller.render('patron_checkouts');
obj.error.sdump('D_TRACE', 'Editor would like to search for: ' + js2JSON(s) );
obj.data.stash_retrieve();
var loc = xulG.url_prefix(urls.XUL_PATRON_DISPLAY);
- loc += '?doit=1&query=' + window.escape(js2JSON(s));
- xulG.new_tab( loc, {}, {} );
+ //loc += '?doit=1&query=' + window.escape(js2JSON(s));
+ xulG.new_tab( loc, {}, { 'doit' : 1, 'query' : s } );
}
function spawn_editor(p) {
var url = urls.XUL_PATRON_EDIT;
- var param_count = 0;
- for (var i in p) {
- if (param_count++ == 0) url += '?'; else url += '&';
- url += i + '=' + window.escape(p[i]);
- }
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+ //var param_count = 0;
+ //for (var i in p) {
+ // if (param_count++ == 0) url += '?'; else url += '&';
+ // url += i + '=' + window.escape(p[i]);
+ //}
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
xulG.new_tab(
loc,
{},
{
+ 'url' : url,
'show_print_button' : true ,
'tab_name' : 'Editing Related Patron' ,
'passthru_content_params' : {
'spawn_editor' : spawn_editor,
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
+ 'params' : p,
}
}
);
}
obj.right_deck.set_iframe(
- urls.XUL_REMOTE_BROWSER
- + '?url=' + window.escape(
- urls.XUL_PATRON_EDIT
- + '?ses=' + window.escape( ses() )
- + '&usr=' + window.escape( obj.patron.id() )
- ),
+ urls.XUL_REMOTE_BROWSER,
+ //+ '?url=' + window.escape(
+ // urls.XUL_PATRON_EDIT
+ // + '?ses=' + window.escape( ses() )
+ // + '&usr=' + window.escape( obj.patron.id() )
+ //),
{}, {
+ 'url' : urls.XUL_PATRON_EDIT,
'show_print_button' : true,
'passthru_content_params' : {
+ 'params' : {
+ 'ses' : ses(),
+ 'usr' : obj.patron.id(),
+ },
'on_save' : function(p) {
try {
if (obj.barcode) obj.barcode = p.card().barcode();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window.g.summary.retrieve();
+ //obj.summary_window.g.summary.retrieve();
+ obj.refresh_all();
} catch(E) {
alert(E);
}
function(ev) {
obj.reset_nav_styling('cmd_patron_info');
obj.right_deck.set_iframe(
- urls.XUL_PATRON_INFO + '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_INFO, // + '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
+ 'patron_id' : obj.patron.id(),
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
}
function(ev) {
obj.reset_nav_styling('cmd_patron_holds');
obj.right_deck.set_iframe(
- urls.XUL_PATRON_HOLDS
- + '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_HOLDS,
+ //+ '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
+ 'patron_id' : obj.patron.id(),
'on_list_change' : function(h) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window.g.summary.controller.render('patron_holds');
- obj.summary_window.g.summary.controller.render('patron_standing');
+ //obj.summary_window.g.summary.controller.render('patron_holds');
+ //obj.summary_window.g.summary.controller.render('patron_standing');
+ obj.refresh_all();
},
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
function(ev) {
obj.reset_nav_styling('cmd_patron_bills');
var f = obj.right_deck.set_iframe(
- urls.XUL_PATRON_BILLS
- + '?patron_id=' + window.escape( obj.patron.id() ),
+ urls.XUL_PATRON_BILLS,
+ //+ '?patron_id=' + window.escape( obj.patron.id() ),
{},
{
+ 'patron_id' : obj.patron.id(),
'url_prefix' : xulG.url_prefix,
'on_money_change' : function(b) {
//alert('test');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- obj.summary_window.g.summary.retrieve(true);
- obj.items_window.g.items.retrieve(true);
+ //obj.summary_window.g.summary.retrieve(true);
+ //obj.items_window.g.items.retrieve(true);
+ obj.refresh_all();
}
}
);
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
obj.controller.view.cmd_search_form.setAttribute('disabled','true');
- var loc = urls.XUL_PATRON_SEARCH_FORM + '?blah=blah';
- if (params['query']) {
- var query = JSON2js(params['query']);
- for (var i in query) {
- loc += '&'+window.escape(i)+'='+window.escape(query[i].value);
- }
- if (params.doit) {
- loc += '&doit=1';
+ var loc = urls.XUL_PATRON_SEARCH_FORM;
+ var my_xulG = {
+ 'clear_left_deck' : function() { setTimeout( function() { obj.left_deck.clear_all_except(loc); obj.render_search_form(params); }, 0); },
+ 'on_submit' : function(query) {
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
+ var list_frame = obj.right_deck.reset_iframe(
+ urls.XUL_PATRON_SEARCH_RESULT, // + '?' + query,
+ {},
+ {
+ 'query' : query,
+ 'on_select' : function(list) {
+ if (!list) return;
+ if (list.length < 1) return;
+ obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
+ obj.controller.view.cmd_search_form.setAttribute('disabled','false');
+ obj.retrieve_ids = list;
+ obj.controller.view.patron_name.setAttribute('value','Retrieving...');
+ document.documentElement.setAttribute('class','');
+ setTimeout(
+ function() {
+ var frame = obj.left_deck.set_iframe(
+ urls.XUL_PATRON_SUMMARY, // + '?id=' + window.escape(list[0]),
+ {},
+ {
+ 'id' : list[0],
+ 'on_finished' : function(patron) {
+ obj.patron = patron;
+ obj.controller.render();
+ }
+ }
+ );
+ netscape.security.PrivilegeManager.enablePrivilege(
+ "UniversalXPConnect"
+ );
+ obj.summary_window = frame.contentWindow;
+ 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;
}
+ };
+
+ if (params['query']) {
+ my_xulG.query = JSON2js(params['query']);
+ if (params.doit) my_xulG.doit = 1;
}
+
var form_frame = obj.left_deck.set_iframe(
loc,
{},
- {
- 'clear_left_deck' : function() { setTimeout( function() { obj.left_deck.clear_all_except(loc); obj.render_search_form(params); }, 0); },
- 'on_submit' : function(query) {
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
- var list_frame = obj.right_deck.reset_iframe(
- urls.XUL_PATRON_SEARCH_RESULT + '?' + query,
- {},
- {
- 'on_select' : function(list) {
- if (!list) return;
- if (list.length < 1) return;
- obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','false');
- obj.controller.view.cmd_search_form.setAttribute('disabled','false');
- obj.retrieve_ids = list;
- obj.controller.view.patron_name.setAttribute('value','Retrieving...');
- document.documentElement.setAttribute('class','');
- setTimeout(
- function() {
- var frame = obj.left_deck.set_iframe(
- urls.XUL_PATRON_SUMMARY + '?id=' + window.escape(list[0]),
- {},
- {
- 'on_finished' : function(patron) {
- obj.patron = patron;
- obj.controller.render();
- }
- }
- );
- netscape.security.PrivilegeManager.enablePrivilege(
- "UniversalXPConnect"
- );
- obj.summary_window = frame.contentWindow;
- 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;
- }
- }
+ my_xulG
);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
obj.search_window = form_frame.contentWindow;
'refresh_all' : function() {
var obj = this;
+ obj.OpenILS.data.cached_request = {}; obj.OpenILS.data.stash('cached_request'); /* FIXME - do a more selective purging here */
obj.controller.view.patron_name.setAttribute(
'value','Retrieving...'
);
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron_display.xul');
- g.cgi = new CGI();
-
JSAN.use('patron.display'); g.patron = new patron.display();
g.patron.init( {
- 'barcode' : g.cgi.param('barcode') || xulG.barcode ,
- 'id' : g.cgi.param('id') || xulG.id,
- 'query' : g.cgi.param('query') || xulG.query,
- 'doit' : g.cgi.param('doit') || xulG.doit,
+ 'barcode' : xul_param('barcode'),
+ 'id' : xul_param('id'),
+ 'query' : xul_param('query'),
+ 'doit' : xul_param('doit'),
} );
//document.documentElement.style.setProperty('font-size-adjust','1','important');
g.error.sdump('D_TRACE','my_init() for hold_notices.xul');
- g.cgi = new CGI();
- g.ahr_id = g.cgi.param('ahr_id');
+ g.ahr_id = xul_param('ahr_id');
g.ahr = g.network.simple_request('FM_AHR_RETRIEVE',[ ses(), g.ahr_id ]);
if (typeof g.ahr.ilsevent != 'undefined') { throw(g.ahr); }
g.ahr = g.ahr[0];
a_list_of_one();
- document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.ahr.target());
+ document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.ahr.target());
+ document.getElementById('bib_brief').contentWindow.xulG = { 'docid' : g.ahr.target() };
refresh();
xml += '<row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row>';
xml += '<row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/>';
xml += '<button label="Add Notification Record" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- g.data.init({'via':'stash'});
- g.data.temp_notification_xml = xml; g.data.stash('temp_notification_xml');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_notification_xml'
- + '&focus=' + window.escape('method')
- + '&title=' + window.escape('Add Notification Record'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ //g.data.init({'via':'stash'});
+ //g.data.temp_notification_xml = xml; g.data.stash('temp_notification_xml');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = window.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_notification_xml'
+ //+ '&focus=' + window.escape('method')
+ //+ '&title=' + window.escape('Add Notification Record'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'xml' : xml, 'focus' : 'method', 'title' : 'Add Notification Record' }
);
- g.data.init({'via':'stash'});
- if (g.data.fancy_prompt_data != '') {
+ if (fancy_prompt_data.fancy_status == 'complete') {
var notification = new ahn();
notification.isnew(1);
notification.hold(g.ahr_id);
- notification.method( g.data.fancy_prompt_data.method );
- notification.note( g.data.fancy_prompt_data.note );
+ notification.method( fancy_prompt_data.method );
+ notification.note( fancy_prompt_data.note );
var r = g.network.simple_request('FM_AHN_CREATE',[ ses(), notification ]); if (typeof r.ilsevent != 'undefined') throw(r);
setTimeout(function(){refresh();},0);
}
for (var i = 0; i < obj.retrieve_ids.length; i++) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
win.open(
- xulG.url_prefix(urls.XUL_HOLD_NOTICES)
- + '?ahr_id=' + obj.retrieve_ids[i].id,
+ xulG.url_prefix(urls.XUL_HOLD_NOTICES), // + '?ahr_id=' + obj.retrieve_ids[i].id,
'hold_notices_' + obj.retrieve_ids[i].id,
- 'chrome,resizable'
+ 'chrome,resizable',
+ { 'ahr_id' : obj.retrieve_ids[i].id }
);
}
} catch(E) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_mid'
- + '&bottom_xml_in_stash=temp_bot'
- + '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal'
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Pick Up Library' }
);
- obj.data.init({'via':'stash'});
- if (obj.data.fancy_prompt_data == '') { return; }
- var selection = obj.data.fancy_prompt_data.selection;
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var selection = fancy_prompt_data.selection;
var msg = 'Are you sure you would like to change the Hold Range for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + obj.data.hash.aout[selection].opac_label() + '"?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_mid'
- + '&bottom_xml_in_stash=temp_bot'
- + '&title=' + window.escape('Choose a Pick Up Library'),
- 'fancy_prompt', 'chrome,resizable,modal'
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Pick Up Library'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Pick Up Library' }
);
- obj.data.init({'via':'stash'});
- if (obj.data.fancy_prompt_data == '') { return; }
- var pickup_lib = obj.data.fancy_prompt_data.lib;
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var pickup_lib = fancy_prompt_data.lib;
var msg = 'Are you sure you would like to change the Pick Up Lib for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to ' + obj.data.hash.aou[pickup_lib].shortname() + '?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
bot_xml += '<spacer flex="1"/><button label="Done" accesskey="D" name="fancy_submit"/>';
bot_xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_mid'
- + '&bottom_xml_in_stash=temp_bot'
- + '&title=' + window.escape('Choose a Hold Notification Phone Number')
- + '&focus=phone',
- 'fancy_prompt', 'chrome,resizable,modal'
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Choose a Hold Notification Phone Number')
+ //+ '&focus=phone',
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Choose a Hold Notification Phone Number', 'focus' : 'phone' }
);
- obj.data.init({'via':'stash'});
- if (obj.data.fancy_prompt_data == '') { return; }
- var phone = obj.data.fancy_prompt_data.phone;
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var phone = fancy_prompt_data.phone;
var msg = 'Are you sure you would like to change the Notification Phone Number for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + ' to "' + phone + '"?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
bot_xml += '<spacer flex="1"/><button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- obj.data.temp_mid = xml; obj.data.stash('temp_mid');
- obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_mid'
- + '&bottom_xml_in_stash=temp_bot'
- + '&title=' + window.escape('Set Email Notification for Holds'),
- 'fancy_prompt', 'chrome,resizable,modal'
+ //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
+ //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Set Email Notification for Holds'),
+ 'fancy_prompt', 'chrome,resizable,modal',
+ { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Set Email Notification for Holds' }
);
- obj.data.init({'via':'stash'});
- if (obj.data.fancy_prompt_data == '') { return; }
- var email = obj.data.fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
+ if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+ var email = fancy_prompt_data.fancy_submit == 'email' ? get_db_true() : get_db_false();
var msg = 'Are you sure you would like ' + ( get_bool( email ) ? 'enable' : 'disable' ) + ' email notification for hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
if (r == 0) {
var patron_id = obj.retrieve_ids[i].usr;
if (seen[patron_id]) continue; seen[patron_id] = true;
xulG.new_tab(
- xulG.url_prefix(urls.XUL_PATRON_DISPLAY) + '?id=' + patron_id,
+ xulG.url_prefix(urls.XUL_PATRON_DISPLAY), // + '?id=' + patron_id,
{},
- {}
+ { 'id' : patron_id }
);
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for holds.xul');
- g.cgi = new CGI();
-
JSAN.use('patron.holds'); g.holds = new patron.holds();
g.holds.init(
{
- 'patron_id' : g.cgi.param('patron_id'),
- 'docid' : g.cgi.param('docid'),
- 'shelf' : g.cgi.param('shelf'),
- 'pull' : g.cgi.param('pull'),
+ 'patron_id' : xul_param('patron_id'),
+ 'docid' : xul_param('docid'),
+ 'shelf' : xul_param('shelf'),
+ 'pull' : xul_param('pull'),
}
);
window.refresh = function(p) { g.holds.retrieve(p); }
<script>
<![CDATA[
+ // FIXME - change this to load each tab/sub-interface as needed and not all at once
+
function $(id) { return document.getElementById(id); }
function my_init() {
g.error.sdump('D_TRACE','my_init() for patron_info.xul');
- g.cgi = new CGI();
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
try{
- $('notes_frame').setAttribute('src',urls.XUL_PATRON_INFO_NOTES + '?patron_id=' + window.escape(g.patron_id));
- $('notes_frame').contentWindow.xulG = xulG;
+ $('notes_frame').setAttribute('src',urls.XUL_PATRON_INFO_NOTES);
+ $('notes_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
}catch(E){alert(E);}
try{
- $('stat_cats_frame').setAttribute('src',urls.XUL_PATRON_INFO_STAT_CATS + '?patron_id=' + window.escape(g.patron_id));
- $('stat_cats_frame').contentWindow.xulG = xulG;
+ $('stat_cats_frame').setAttribute('src',urls.XUL_PATRON_INFO_STAT_CATS);
+ $('stat_cats_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
}catch(E){alert(E);}
try{
- $('surveys_frame').setAttribute('src',urls.XUL_PATRON_INFO_SURVEYS + '?patron_id=' + window.escape(g.patron_id));
- $('surveys_frame').contentWindow.xulG = xulG;
+ $('surveys_frame').setAttribute('src',urls.XUL_PATRON_INFO_SURVEYS);
+ $('surveys_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
}catch(E){alert(E);}
try{
- $('group_frame').setAttribute('src',urls.XUL_PATRON_INFO_GROUP + '?patron_id=' + window.escape(g.patron_id));
- $('group_frame').contentWindow.xulG = xulG;
+ $('group_frame').setAttribute('src',urls.XUL_PATRON_INFO_GROUP);
+ $('group_frame').contentWindow.xulG = { 'patron_id' : g.patron_id };
}catch(E){alert(E);}
} catch(E) {
g.error.sdump('D_TRACE','my_init() for patron_info_group.xul');
- g.cgi = new CGI();
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
tree_init();
if (! g.sel_list ) return;
try {
for (var i = 0; i < g.sel_list.length; i++) {
- 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] );
+ 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(
loc,
{},
{
+ 'url' : urls.XUL_PATRON_EDIT, // + '?ses=' + window.escape(ses()) + '&clone=' + g.sel_list[i],
'show_print_button' : true ,
'tab_name' : 'Register Patron Clone for Group' ,
'passthru_content_params' : {
+ 'ses' : ses(,
+ 'clone' : g.sel_list[i],
'spawn_search' : spawn_search,
'spawn_editor' : spawn_editor,
'on_save' : function() { refresh(); },
function spawn_editor(p) {
var url = urls.XUL_PATRON_EDIT;
- var param_count = 0;
+ var passthru = {
+ 'spawn_search' : spawn_search,
+ 'spawn_editor' : spawn_editor,
+ 'on_save' : function() { refresh(); },
+ 'url_prefix' : xulG.url_prefix,
+ 'new_tab' : xulG.new_tab,
+ };
for (var i in p) {
- if (param_count++ == 0) url += '?'; else url += '&';
- url += i + '=' + window.escape(p[i]);
+ passthru[i] = p[i];
}
- var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+ var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
xulG.new_tab(
loc,
{},
{
+ 'url' : url,
'show_print_button' : true ,
'tab_name' : 'Editing Related Patron' ,
- 'passthru_content_params' : {
- 'spawn_search' : spawn_search,
- 'spawn_editor' : spawn_editor,
- 'on_save' : function() { refresh(); },
- 'url_prefix' : xulG.url_prefix,
- 'new_tab' : xulG.new_tab,
- },
+ 'passthru_content_params' : passthru,
'url_prefix' : xulG.url_prefix,
'new_tab' : xulG.new_tab,
}
try {
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, {}, {} );
+ //loc += '?doit=1&query=' + window.escape(js2JSON(s));
+ xulG.new_tab( loc, {}, {'doit':1,'query':s} );
} catch(E) {
g.error.standard_unexpected_error_alert('spawn search',E);
}
var bot_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto"><hbox>';
bot_xml += '</hbox></vbox>';
- g.data.temp_top = top_xml; g.data.stash('temp_top');
- g.data.temp_mid = xml; g.data.stash('temp_mid');
- g.data.temp_bot = bot_xml; g.data.stash('temp_bot');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_mid'
- + '&top_xml_in_stash=temp_top'
- + '&bottom_xml_in_stash=temp_bot'
- + '&title=' + window.escape('Move Patron into a Usergroup'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ //g.data.temp_top = top_xml; g.data.stash('temp_top');
+ //g.data.temp_mid = xml; g.data.stash('temp_mid');
+ //g.data.temp_bot = bot_xml; g.data.stash('temp_bot');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_mid'
+ //+ '&top_xml_in_stash=temp_top'
+ //+ '&bottom_xml_in_stash=temp_bot'
+ //+ '&title=' + window.escape('Move Patron into a Usergroup'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'xml' : xml, 'top_xml' : top_xml, 'bottom_xml' : bot_xml, 'title' : 'Move Patron into a Usergroup' }
);
- g.data.init({'via':'stash'});
- if (g.data.fancy_prompt_data == '') { continue; }
+ if (fancy_prompt_data.fancy_status == 'incomplete') { continue; }
else {
var patron_c;
switch(direction) {
g.error.sdump('D_TRACE','my_init() for patron_info.xul');
- g.cgi = new CGI();
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
+
+ g.new_note = false;
refresh();
}
function retrieve_notes() {
- g.notes = g.network.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
+ if (g.new_note) {
+ g.notes = g.network.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
+ g.new_note = false;
+ } else {
+ g.notes = g.network.cached_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : g.patron_id } ]).reverse();
+ }
}
function apply(node,field,value) {
var r = g.error.yns_alert('Delete the note titled "' + g.notes[id].title() + '" created on ' + g.notes[id].create_date().toString().substr(0,10) + '?','Delete Note','Yes','No',null,'Check here to confirm this action');
if (r == 0) {
g.network.simple_request('FM_AUN_DELETE',[ses(),g.notes[id].id()]);
- setTimeout(function(){ alert('Note deleted.'); refresh();},0);
+ setTimeout(function(){ g.new_note = true; alert('Note deleted.'); refresh();},0);
}
} }(i),
false
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1"><caption label="New Note"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows><row><label value="Patron Visible?"/><checkbox id="pub" name="fancy_data"/></row><row><label value="Title"/><textbox id="title" name="fancy_data"/></row><row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row><row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/><button label="Add Note" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
- g.data.init({'via':'stash'});
- g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_note_xml'
- + '&focus=' + window.escape('title')
- + '&title=' + window.escape('Add Note'),
- 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+ //g.data.init({'via':'stash'});
+ //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
+ JSAN.use('util.window'); var win = new util.window();
+ var fancy_prompt_data = win.open(
+ urls.XUL_FANCY_PROMPT,
+ //+ '?xml_in_stash=temp_note_xml'
+ //+ '&focus=' + window.escape('title')
+ //+ '&title=' + window.escape('Add Note'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+ { 'xml' : xml, 'focus' : 'title', 'title' : 'Add Note' }
);
- g.data.init({'via':'stash'});
- if (g.data.fancy_prompt_data != '') {
+ if (fancy_prompt_data.fancy_status == 'complete') {
//alert(js2JSON(g.data.fancy_prompt_data));
var note = new aun();
note.isnew(1);
- note.title( g.data.fancy_prompt_data.title );
- note.value( g.data.fancy_prompt_data.note );
- note.pub( get_bool( g.data.fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
+ note.title( fancy_prompt_data.title );
+ note.value( fancy_prompt_data.note );
+ note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
note.usr( g.patron_id );
var r = g.network.simple_request('FM_AUN_CREATE',[ ses(), note ]);
if (typeof r.ilsevent != 'undefined') throw(r);
- setTimeout(function(){ alert('Note added.'); refresh();},0);
+ setTimeout(function(){ g.new_note = true; alert('Note added.'); refresh();},0);
}
} catch(E) {
g.error.standard_unexpected_error_alert('The note was not likely created.',E);
g.error.sdump('D_TRACE','my_init() for patron_info_stat_cats.xul');
- g.cgi = new CGI();
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
refresh();
g.error.sdump('D_TRACE','my_init() for patron_info_surveys.xul');
- g.cgi = new CGI();
- g.patron_id = g.cgi.param('patron_id');
+ g.patron_id = xul_param('patron_id');
refresh();
try {
var retrieve_ids = ( which == 2 ? obj.retrieve_ids2 : obj.retrieve_ids );
if (!retrieve_ids || retrieve_ids.length == 0) return;
- JSAN.use('util.window');
- var win = new util.window();
+ JSAN.use('util.window'); var win = new util.window();
for (var i = 0; i < retrieve_ids.length; i++) {
var circ_id = retrieve_ids[i].circ_id;
- var w = win.open(
- urls.XUL_PATRON_BILL_WIZARD
- + '?patron_id=' + window.escape(obj.patron_id)
- + '&xact_id=' + window.escape( circ_id ),
+ var my_xulG = win.open(
+ urls.XUL_PATRON_BILL_WIZARD,
+ //+ '?patron_id=' + window.escape(obj.patron_id)
+ //+ '&xact_id=' + window.escape( circ_id ),
'billwizard',
- 'chrome,resizable,modal'
+ 'chrome,resizable,modal',
+ { 'patron_id' : obj.patron_id, 'xact_id' : circ_id }
);
}
} catch(E) {
JSAN.use('util.error'); g.error = new util.error();
try { g.error.sdump('D_TRACE','my_init() for items.xul'); } catch(E) { dump(E); }
- g.cgi = new CGI();
-
JSAN.use('patron.items'); g.items = new patron.items();
g.items.init(
{
- 'patron_id' : g.cgi.param('patron_id'),
+ 'patron_id' : xul_param('patron_id'),
}
);
for (var i = 0; i < keys.length; i++) {
query[keys[i]] = g.cgi.param(keys[i]);
}
+ if (typeof xulG != 'undefined') if (xulG.query) {
+ for (var i in xulG.query) {
+ query[i] = xulG.query[i];
+ }
+ }
JSAN.use('patron.search_result'); g.search_result = new patron.search_result();
g.search_result.init( { 'query' : query } );
function(e) {
return function() {
e.setAttribute('value','...');
- obj.network.simple_request(
+ obj.network.cached_request(
'FM_MOUS_RETRIEVE',
[ ses(), obj.patron.id() ],
function(req) {
var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) e4.setAttribute('value','...');
var e5 = document.getElementById( 'patron_lost' ); if (e5) e5.setAttribute('value','...');
var e6 = document.getElementById( 'patron_noncat' ); if (e6) e6.setAttribute('value','...');
- obj.network.simple_request(
+ obj.network.cached_request(
'FM_CIRC_COUNT_RETRIEVE_VIA_USER',
[ ses(), obj.patron.id() ],
function(req) {
- var robj = req.getResultObject();
- e.setAttribute('value', robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
- if (e2) e2.setAttribute('value', robj.overdue );
- if (e3) e3.setAttribute('value', robj.claims_returned );
- if (e4) e4.setAttribute('value', robj.long_overdue );
- if (e5) e5.setAttribute('value', robj.lost );
+ try {
+ var robj = req.getResultObject();
+ e.setAttribute('value', robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
+ if (e2) e2.setAttribute('value', robj.overdue );
+ if (e3) e3.setAttribute('value', robj.claims_returned );
+ if (e4) e4.setAttribute('value', robj.long_overdue );
+ if (e5) e5.setAttribute('value', robj.lost );
+ } catch(E) {
+ alert(E);
+ }
}
);
obj.network.simple_request(
try {
var robj;
if (obj.barcode && obj.barcode != 'null') {
- robj = obj.network.request(
- api.FM_AU_RETRIEVE_VIA_BARCODE.app,
- api.FM_AU_RETRIEVE_VIA_BARCODE.method,
+ robj = obj.network.simple_request(
+ 'FM_AU_RETRIEVE_VIA_BARCODE',
[ ses(), obj.barcode ]
);
} else if (obj.id && obj.id != 'null') {
JSAN.use('util.error'); g.error = new util.error();
g.error.sdump('D_TRACE','my_init() for patron_summary.xul');
- g.cgi = new CGI();
-
- var patron_id = g.cgi.param('id');
- if (typeof window.xulG == 'object' && typeof window.xulG.id != 'undefined') patron_id = window.xulG.id;
- var patron_bc = g.cgi.param('barcode');
- if (typeof window.xulG == 'object' && typeof window.xulG.barcode != 'undefined') patron_bc = window.xulG.barcode;
+ var patron_id = xul_param('id');
+ var patron_bc = xul_param('barcode');
JSAN.use('patron.summary'); g.summary = new patron.summary();
g.summary.init( {
'barcode' : patron_bc,
'id' : patron_id,
- 'show_name' : g.cgi.param('show_name'),
+ 'show_name' : xul_param('show_name'),
} );
window.refresh = function () { g.summary.retrieve(); }
_debug('uEditInit(): ' + location.search);
cgi = new CGI();
- session = cgi.param('ses');
- clone = cgi.param('clone');
+ session = cgi.param('ses');
+ if (xulG) if (xulG.ses) session = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
+ clone = cgi.param('clone');
+ if (xulG) if (xulG.clone) clone = xulG.clone;
+ if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
if(!session) throw "User session is not defined";
fetchUser(session);
fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
uEditBuildLibSelector();
- patron = fetchFleshedUser(cgi.param('usr'));
+ var usr = cgi.param('usr');
+ if (xulG) if (xulG.usr) usr = xulG.usr;
+ if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
+ patron = fetchFleshedUser(usr);
if(!patron) patron = uEditNewPatron();
_debug("xulG funcs defined...");
if( !patron.isnew() && cloneme ) {
_debug("calling spawn_editor to clone user...");
- window.xulG.spawn_editor({ses:cgi.param('ses'),clone:cloneme});
+ var ses = cgi.param('ses');
+ if (xulG.ses) ses = xulG.ses;
+ if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+ window.xulG.spawn_editor({ses:ses,clone:cloneme});
}
window.xulG.on_save(newuser, cloneme);
var href = location.href;
href = href.replace(/\&?usr=\d+/, '');
href = href.replace(/\&?clone=\d+/, '');
- var id = cgi.param('usr')
+ var id = cgi.param('usr');
+ if (xulG) if (xulG.usr) id = xulG.usr;
+ if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
/* reload the current user if available */
if( id ) href += "&usr=" + id;
location.href = href;
hideMe($n(row, 'owner_link_div'));
} else {
-
+
+ var ses = cgi.param('ses');
+ if (xulG.ses) ses = xulG.ses;
+ if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
link.onclick =
- function() { window.xulG.spawn_editor({ses:cgi.param('ses'),usr:id}) };
+ function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
if( userCache[id] ) {
nnode.appendChild(text(
var x = document.getElementById('editor').elements;
cgi = new CGI();
- if (cgi.param('adv')) adv_mode = true;
+ if (cgi.param('adv')) adv_mode = true;
+ if (xulG) if (xulG.adv) adv_mode = true;
+ if (xulG) if (xulG.params) if (xulG.params.adv) adv_mode = true;
apply_adv_mode(document.getElementById('editor'));
- ses_id = cgi.param('ses');
+ ses_id = cgi.param('ses');
+ if (xulG) if (xulG.ses) ses_id = xulG.ses;
+ if (xulG) if (xulG.params) if (xulG.params.ses) ses_id = xulG.params.ses;
- var usr_id = cgi.param('usr');
- var usr_barcode = cgi.param('barcode');
+ var usr_id = cgi.param('usr');
+ if (xulG) if (xulG.usr_id) usr_id = xulG.usr_id;
+ if (xulG) if (xulG.params) if (xulG.params.usr_id) usr_id = xulG.params.usr_id;
+
+ var usr_barcode = cgi.param('barcode');
+ if (xulG) if (xulG.usr_barcode) usr_ibarcode = xulG.usr_barcode;
+ if (xulG) if (xulG.params) if (xulG.params.usr_barcode) usr_ibarcode = xulG.params.usr_barcode;
try {
var req;
uEditSetVal( patron, "ident_value", $('ue_primary_ident'), null, err );
*/
- var identdata = uEditParseIdent(
+ //FIXME - I think this file is deprecated, but there's this syntax error sitting here
+ //var identdata = uEditParseIdent(
var it1 = getSelectorVal($('ue_primary_ident_type'));
var name = getSelectorName($('ue_primary_ident_type'));
patron.util.retrieve_au_via_id = function(session, id, f) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.request(
- api.FM_AU_RETRIEVE_VIA_ID.app,
- api.FM_AU_RETRIEVE_VIA_ID.method,
+ var patron_obj = network.cached_request(
+ 'FM_AU_RETRIEVE_VIA_ID',
[ session, id ],
f
);
patron.util.retrieve_name_via_id = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var parts = network.simple_request(
+ var parts = network.cached_request(
'BLOB_AU_PARTS_RETRIEVE',
[ session, id, ['family_name', 'first_given_name', 'second_given_name', 'home_ou' ] ]
);
patron.util.retrieve_fleshed_au_via_id = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.simple_request(
+ var patron_obj = network.cached_request(
'FM_AU_FLESHED_RETRIEVE_VIA_ID',
[ session, id ]
);
patron.util.retrieve_fleshed_au_via_barcode = function(session, id) {
JSAN.use('util.network');
var network = new util.network();
- var patron_obj = network.simple_request(
+ var patron_obj = network.cached_request(
'FM_AU_RETRIEVE_VIA_BARCODE',
[ session, id ]
);
removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3');
JSAN.use('util.network'); var net = new util.network();
- net.simple_request('FM_MOUS_RETRIEVE',[ ses(), patron.id() ], function(req) {
+ net.cached_request('FM_MOUS_RETRIEVE',[ ses(), patron.id() ], function(req) {
if (req.getResultObject().balance_owed() > 0) addCSSClass(document.documentElement,'PATRON_HAS_BILLS');
});
- net.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER',[ ses(), patron.id() ], function(req) {
- var co = req.getResultObject();
- if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
+ net.cached_request('FM_CIRC_COUNT_RETRIEVE_VIA_USER',[ ses(), patron.id() ], function(req) {
+ try {
+ var co = req.getResultObject();
+ if (co.overdue > 0 || co.long_overdue > 0) addCSSClass(document.documentElement,'PATRON_HAS_OVERDUES');
+ } catch(E) {
+ alert(E);
+ }
});
- net.simple_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : patron.id() } ], function(req) {
+ net.cached_request('FM_AUN_RETRIEVE_ALL',[ ses(), { 'patronid' : patron.id() } ], function(req) {
var notes = req.getResultObject();
if (notes.length > 0) addCSSClass(document.documentElement,'PATRON_HAS_NOTES');
});