var docid;
-function my_init() {
+function my_init(orientation) {
try {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- if (typeof JSAN == 'undefined') { throw( document.getElementById("commonStrings").getString('common.jsan.missing') ); }
- JSAN.errorLevel = "die"; // none, warn, or die
- JSAN.addRepository('/xul/server/');
- JSAN.use('util.error'); g.error = new util.error();
- g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+ ui_init(); // JSAN, etc.
+
+ JSAN.use('OpenILS.data');
+ g.data = new OpenILS.data();
+ g.data.stash_retrieve();
docid = xul_param('docid');
+ // hackery if modal and invoked with util.window
var key = location.pathname + location.search + location.hash;
- if (!docid && typeof g.data.modal_xulG_stack != 'undefined' && typeof g.data.modal_xulG_stack[key] != 'undefined') {
- var xulG = g.data.modal_xulG_stack[key][ g.data.modal_xulG_stack[key].length - 1 ];
+ if (!docid
+ && typeof g.data.modal_xulG_stack != 'undefined'
+ && typeof g.data.modal_xulG_stack[key] != 'undefined'
+ ) {
+ var xulG = g.data.modal_xulG_stack[key][
+ g.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');
- document.getElementById('caption').setAttribute('tooltiptext',document.getElementById('catStrings').getFormattedString('staff.cat.bib_brief.record_id', [docid]));
+ document.getElementById('caption').setAttribute(
+ 'tooltiptext',
+ document.getElementById('catStrings').getFormattedString(
+ 'staff.cat.bib_brief.record_id', [docid]
+ )
+ );
if (docid > -1) {
'MODS_SLIM_RECORD_RETRIEVE.authoritative',
[ docid ],
function (req) {
- var mods = req.getResultObject();
-
- if (window.xulG && typeof window.xulG.set_tab_name == 'function') {
- try {
- window.xulG.set_tab_name(mods.tcn());
- } catch(E) {
- g.error.sdump('D_ERROR','bib_brief.xul, set_tab: ' + E);
- }
- }
-
- g.network.simple_request(
- 'FM_BRE_RETRIEVE_VIA_ID.authoritative',
- [ ses(), [ docid ] ],
- function (req) {
- try {
- var meta = req.getResultObject();
- if (typeof meta.ilsevent != 'undefined') throw(meta);
- meta = meta[0];
- var t = document.getElementById('caption').getAttribute('label');
- if (get_bool( meta.deleted() )) {
- t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.deleted') + ' ';
- document.getElementById('caption').setAttribute('style','background: red; color: white;');
+ try {
+ g.mods = req.getResultObject();
+ set_tab_name();
+ g.network.simple_request(
+ 'FM_BRE_RETRIEVE_VIA_ID.authoritative',
+ [ ses(), [ docid ] ],
+ function (req2) {
+ try {
+ g.meta = req2.getResultObject()[0];
+ set_caption();
+ bib_brief_overlay({
+ 'mvr' : g.mods,
+ 'bre' : g.meta
+ });
+ } catch(E) {
+ alert('Error in bib_brief.js, '
+ + 'req handler 2: ' + E + '\n');
}
- if ( ! get_bool( meta.active() ) ) {
- t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.inactive') + ' ';
- document.getElementById('caption').setAttribute('style','background: red; color: white;');
- }
- document.getElementById('caption').setAttribute('label',t);
-
- bib_brief_overlay( { 'mvr' : mods, 'bre' : meta } );
-
- } catch(E) {
- g.error.standard_unexpected_error_alert('meta retrieve',E);
}
- }
- );
+ );
+ } catch(E) {
+ alert('Error in bib_brief.js, req handler 1: '
+ + E + '\n');
+ }
}
);
} else {
var t = document.getElementById('caption').getAttribute('label');
- t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.noncat') + ' ';
+ t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.noncat') + ' ';
document.getElementById('caption').setAttribute('style','background: red; color: white;');
document.getElementById('caption').setAttribute('label',t);
}
}
}
+function set_tab_name() {
+ try {
+ window.xulG.set_tab_name(g.mods.tcn());
+ } catch(E) {
+ dump('Error in bib_brief.js, set_tab_name(): ' + E + '\n');
+ }
+}
+
+function set_caption() {
+ try {
+ var t = document.getElementById('caption').getAttribute('label');
+ if (get_bool( g.meta.deleted() )) {
+ t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.deleted') + ' ';
+ document.getElementById('caption').setAttribute('style','background: red; color: white;');
+ }
+ if ( ! get_bool( g.meta.active() ) ) {
+ t += ' ' + document.getElementById('catStrings').getString('staff.cat.bib_brief.inactive') + ' ';
+ document.getElementById('caption').setAttribute('style','background: red; color: white;');
+ }
+ document.getElementById('caption').setAttribute('label',t);
+
+ } catch(E) {
+ dump('Error in bib_brief.js, set_caption(): ' + E + '\n');
+ }
+}
+
function unhide_add_volumes_button() {
if (xulG && typeof xulG == 'object' && typeof xulG['new_tab'] == 'function') {
document.getElementById('add_volumes').hidden = false;
alert('Error in server/cat/bib_brief.js, add_volumes(): ' + E);
}
}
+
+function ui_init() {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ if (typeof JSAN == 'undefined') {
+ throw(
+ document.getElementById("commonStrings").getString(
+ 'common.jsan.missing'
+ )
+ );
+ }
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('/xul/server/');
+ JSAN.use('util.error'); g.error = new util.error();
+ g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
+}
+