var obj = this;
+ obj.event_listeners = new EventListenerList();
obj.patron_id = params.patron_id;
obj.auto_override_events = [];
e.appendChild( ml );
ml.setAttribute('id','checkout_menulist');
ml.setAttribute('accesskey','');
- ml.addEventListener(
+ obj.event_listeners.add(ml,
'command',
function(ev) {
var tb = obj.controller.view.checkout_barcode_entry_textbox;
},
+ 'cleanup' : function() {
+ var obj = this;
+ obj.controller.cleanup();
+ obj.event_listeners.removeAll();
+ },
+
'check_disable' : function() {
var obj = this;
try {
<window id="checkout_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.checkout.cleanup();
+ } catch(E) {
+ try {
+ g.error.standard_unexpected_error_alert('circ/checkout.xul',E);
+ } catch(F) {
+ dump('FIXME: circ/checkout.xul -> ' + E + ' -> ' + F + '\n');
+ }
+ }
+ }
+
function default_focus() {
try {
var x = document.getElementById('checkout_barcode_entry_textbox');
staff.patron.bill_cc_info.need_cc_number=You must provide a credit card number
staff.patron.bill_cc_info.need_approval_code=You must provide an approval code or an imprint slip number
staff.patron.bill_details.my_init.error=bill_details.xul, my_init:
+staff.patron.bill_details.my_cleanup.error=bill_details.xul, my_cleanup:
staff.patron.bill_details.handle_edit_bill_note.note_dialog.title=Replacement Note
staff.patron.bill_details.handle_edit_bill_note.note_dialog.prompt=Enter new note:
staff.patron.bill_details.handle_edit_bill_note.failure=Note for selected bills not likely updated.
<window id="patron_barcode_entry_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
var tb = document.getElementById('barcode_tb');
- tb.addEventListener(
+ window.barcode_entry_event_listeners = new EventListenerList();
+ window.barcode_entry_event_listeners.add(tb,
'keypress',
function(ev) {
if (ev.keyCode == 13 || ev.keyCode == 77) {
}
}
+ function my_cleanup() {
+ try {
+ window.barcode_entry_event_listeners.removeAll();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/barcode_entry.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function submit() {
var tb;
try {
g.data.voided_billings = []; g.data.stash('voided_billings');
g.error.sdump('D_TRACE','my_init() for bill2.xul');
+ window.bill_event_listeners = new EventListenerList();
document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.current_bills');
}
}
+function my_cleanup() {
+ try {
+ window.bill_event_listeners.removeAll();
+ g.bill_list.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill2.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+}
+
function event_listeners() {
try {
- $('details').addEventListener(
+ window.bill_event_listeners.add($('details'),
'command',
handle_details,
false
);
- $('add').addEventListener(
+ window.bill_event_listeners.add($('add'),
'command',
handle_add,
false
);
- $('voidall').addEventListener(
+ window.bill_event_listeners.add($('voidall'),
'command',
handle_void_all,
false
);
- $('refund').addEventListener(
+ window.bill_event_listeners.add($('refund'),
'command',
handle_refund,
false
);
- $('opac').addEventListener(
+ window.bill_event_listeners.add($('opac'),
'command',
handle_opac,
false
);
- $('copy_details').addEventListener(
+ window.bill_event_listeners.add($('copy_details'),
'command',
handle_copy_details,
false
);
- $('payment').addEventListener(
+ window.bill_event_listeners.add($('payment'),
'change',
function(ev) {
if ($('payment_type').value == 'credit_payment') {
false
);
- $('payment').addEventListener(
+ window.bill_event_listeners.add($('payment'),
'focus',
function(ev) { ev.target.select(); },
false
);
- $('payment').addEventListener(
+ window.bill_event_listeners.add($('payment'),
'keypress',
function(ev) {
if (! (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) ) { return; }
false
);
- $('bill_patron_btn').addEventListener(
+ window.bill_event_listeners.add($('bill_patron_btn'),
'command',
function() {
JSAN.use('util.window'); var win = new util.window();
false
);
- $('bill_history_btn').addEventListener(
+ window.bill_event_listeners.add($('bill_history_btn'),
'command',
function() {
xulG.display_window.g.patron.right_deck.reset_iframe(
false
);
- $('convert_change_to_credit').addEventListener(
+ window.bill_event_listeners.add($('convert_change_to_credit'),
'command',
function(ev) {
if (ev.target.checked) {
false
);
- $('apply_payment_btn').addEventListener(
+ window.bill_event_listeners.add($('apply_payment_btn'),
'command',
function(ev) {
try {
<window id="bill_interface_win" width="700" height="550" oils_persist="sizemode width height" active="true"
onload="try{ font_helper(); persist_helper(); my_init(); } catch(E) { alert(E); }"
+ onunload="try{ my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<window id="patron_bill" title="&staff.patron.bill_cc_info.title;"
orient="vertical" style="overflow: auto" oils_persist="height width sizemode"
onload="try{info_init(); font_helper(); refresh_fields(); persist_helper(); }catch(E){alert(E);}"
+ onunload="try { persist_helper_cleanup(); } catch(E) { alert(E) }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<window id="patron_bill" title="&staff.patron.bill_check_info.title;"
orient="vertical" style="overflow: auto" oils_persist="height width sizemode"
onload="try{info_init(); font_helper(); persist_helper(); }catch(E){alert(E);}"
+ onunload="try{ persist_helper_cleanup(); }catch(E){alert(E);}"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
g.mbts_id = xul_param('mbts_id');
+ window.bill_details_event_listeners = new EventListenerList();
+
retrieve_patron();
retrieve_mbts();
retrieve_mb();
retrieve_mp();
- $('void').addEventListener(
+ window.bill_details_event_listeners.add($('void'),
'command',
handle_void,
false
);
- $('edit_bill_note').addEventListener(
+ window.bill_details_event_listeners.add($('edit_bill_note'),
'command',
handle_edit_bill_note,
false
);
- $('edit_payment_note').addEventListener(
+ window.bill_details_event_listeners.add($('edit_payment_note'),
'command',
handle_edit_payment_note,
false
}
}
+function my_cleanup() {
+ try {
+ g.bill_list.cleanup();
+ g.payment_list.cleanup();
+ window.bill_details_event_listeners.removeAll();
+ } catch(E) {
+ try { g.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bill_details.my_cleanup.error'),E); } catch(F) { alert(E); }
+ }
+}
+
function handle_edit_bill_note() {
try {
var mb_list = util.functional.map_list(g.bill_list_selection, function(o){return g.mb_list[o].id();});
<window id="bill_details_win" width="700" height="550" oils_persist="width height sizemode"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
g.funcs = []; g.bill_map = {}; g.payments_map = {};
g.patron_id = xul_param('patron_id');
+ window.bill_history_event_listeners = new EventListenerList();
init_lists();
retrieve_mbts_for_list();
- $('details').addEventListener(
+ window.bill_history_event_listeners.add($('details'),
'command',
gen_handle_details('bills'),
false
);
- $('payments_details').addEventListener(
+ window.bill_history_event_listeners.add($('payments_details'),
'command',
gen_handle_details('payments'),
false
);
- $('copy_details').addEventListener(
+ window.bill_history_event_listeners.add($('copy_details'),
'command',
gen_handle_copy_details('bills'),
false
);
- $('copy_details_from_payments').addEventListener(
+ window.bill_history_event_listeners.add($('copy_details_from_payments'),
'command',
gen_handle_copy_details('payments'),
false
);
- $('add').addEventListener(
+ window.bill_history_event_listeners.add($('add'),
'command',
handle_add,
false
}
}
+function my_cleanup() {
+ try {
+ g.bill_list.cleanup();
+ g.payments_list.cleanup();
+ window.bill_history_event_listeners.removeAll();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill_history.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+}
+
+
function handle_add() {
if(g.bill_list_selection.length > 1)
var msg = $("patronStrings").getFormattedString('staff.patron.bill_history.handle_add.message_plural', [g.bill_list_selection]);
<window id="bill_history_win" width="700" height="550" oils_persist="sizemode width height"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
);
ml.setAttribute('id','billing_type');
document.getElementById('menu_placeholder').appendChild(ml);
- ml.addEventListener(
+ window.bill_wizard_event_listeners = new EventListenerList();
+ window.bill_wizard_event_listeners.add(ml,
'command',
function() {
if ( g.OpenILS.data.hash.cbt[ ml.value ] ) {
}
+function patron_bill_cleanup() {
+ try {
+ window.bill_wizard_event_listeners.removeAll();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill_wizard.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+
+}
+
function patron_bill_finish() {
try {
var do_not_process_bill = xul_param('do_not_process_bill');
<window id="patron_bill" title="&staff.patron.bill_wizard.title;"
orient="vertical" style="overflow: auto" oils_persist="width height sizemode"
onload="try { patron_bill_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }" width="700" height="550"
+ onunload="try { patron_bill_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
var obj = this;
+ obj.event_listeners = new EventListenerList();
obj.barcode = params['barcode'];
obj.id = params['id'];
}
);
- var x = document.getElementById("PatronNavBar_checkout");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_refresh");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_items");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_holds");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_other");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_edit");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_bills");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
- var x = document.getElementById("PatronNavBar_messages");
- x.addEventListener( 'focus', function(xx) { return function() { try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {}; } }(x), false);
+ var make_listener = function(xx) {
+ return function() {
+ try { document.getElementById("PatronNavBarScrollbox").ensureElementIsVisible(xx); } catch(E) {};
+ }
+ };
+
+
+ var need_focus_listeners = [
+ 'PatronNavBar_checkout', 'PatronNavBar_refresh', 'PatronNavBar_items', 'PatronNavBar_holds',
+ 'PatronNavBar_other', 'PatronNavBar_edit', 'PatronNavBar_bills', 'PatronNavBar_messages'
+ ];
+ for (var i = 0; i < need_focus_listeners.length; i++) {
+ var elementID = need_focus_listeners[i];
+ var x = document.getElementById(elementID);
+ obj.event_listeners.add(x, 'focus', make_listener(x), false);
+ }
if (obj.barcode || obj.id) {
if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
}
},
+ 'cleanup' : function( params ) {
+ var obj = this;
+ obj.controller.cleanup();
+ obj.event_listeners.removeAll();
+ },
+
'reset_nav_styling' : function(btn,dont_hide_summary) {
try {
if (!dont_hide_summary) { dont_hide_summary = false; }
<window id="patron_display_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.patron.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/display.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function default_focus() {
setTimeout(
function() {
<window id="patron_display_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.patron.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/display.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function default_focus() {
setTimeout(
function() {
}
/* set widget behavior */
- document.getElementById('csp_menulist').addEventListener(
+ window.edit_standing_penalty_event_listeners = new EventListenerList();
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('csp_menulist'),
'command',
function() {
document.getElementById('note_btn').checked = false;
},
false
);
- document.getElementById('note_btn').addEventListener(
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('note_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('alert_btn').addEventListener(
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('alert_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('block_btn').addEventListener(
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('block_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('cancel_btn').addEventListener(
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('cancel_btn'),
'command', function() { window.close(); }, false
);
- document.getElementById('apply_btn').addEventListener(
+ window.edit_standing_penalty_event_listeners.add(document.getElementById('apply_btn'),
'command',
function() {
var note = document.getElementById('note_tb').value;
}
+function edit_penalty_cleanup() {
+ try {
+ window.edit_standing_penalty_event_listeners.removeAll();
+ } catch(E) {
+ var err_prefix = 'standing_penalties.js -> penalty_cleanup() : ';
+ if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+ }
+
+}
+
function build_penalty_menu() {
try {
<window id="edit_penalty_win"
onload="try { edit_penalty_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { edit_penalty_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
oils_persist="height width sizemode"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&staff.patron_display.edit_penalty_dialog.title;">
build_cancel_reason_menu();
/* set widget behavior */
- document.getElementById('cancel_btn').addEventListener(
+ window.hold_cancel_event_listeners = new EventListenerList();
+ window.hold_cancel_event_listeners.add(document.getElementById('cancel_btn'),
'command', function() { window.close(); }, false
);
- document.getElementById('apply_btn').addEventListener(
+ window.hold_cancel_event_listeners.add(document.getElementById('apply_btn'),
'command',
function() {
var note = document.getElementById('note_tb').value;
}
+function hold_cancel_cleanup() {
+ try {
+ window.hold_cancel_event_listeners.removeAll();
+ } catch(E) {
+ var err_prefix = 'hold_cancel.js -> hold_cancel_cleanup() : ';
+ if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+ }
+
+}
+
function build_cancel_reason_menu() {
try {
<window id="hold_cancel_win"
onload="try { hold_cancel_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { hold_cancel_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&staff.hold_list.cancel_hold_dialog.title;">
}
}
+function my_cleanup() {
+ try {
+ g.list.cleanup();
+ } catch(E) {
+ try { g.error.standard_unexpected_error_alert('/xul/server/patron/hold_notices.xul',E); } catch(E) { alert('FIXME: ' + js2JSON(E)); }
+ }
+}
+
function fetch_and_render_all(do_not_refresh_parent_interface) {
try {
if (!xulG.ahr_id) { return; }
<window id="hold_notices_win" width="700" height="550" oils_persist="sizemode width height"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }" title="&staff.patron.hold_notices.title;"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
var obj = this;
dojo.require("openils.Util");
+ obj.event_listeners = new EventListenerList();
obj.patron_id = params['patron_id'];
obj.patron_barcode = params['patron_barcode'];
},
+ 'cleanup' : function() {
+ var obj = this;
+ obj.controller.cleanup();
+ obj.list.cleanup();
+ obj.event_listeners.removeAll();
+ },
+
'determine_hold_interface_type' : function() {
var obj = this;
if (obj.patron_id) { /*************************************************** PATRON ******************************/
var ml = util.widgets.make_menulist( list_data[0], obj.data.list.au[0].ws_ou() );
ml.setAttribute('id','lib_menu');
x.appendChild( ml );
- ml.addEventListener(
+ obj.event_listeners.add(ml,
'command',
function(ev) {
obj.filter_lib = ev.target.value;
<window id="holds_win" active="true"
onload="try { font_helper(); persist_helper(); my_init(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.holds.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/holds.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function default_focus() { try { document.getElementById('holds_print').focus(); } catch(E) { } }
]]>
}
}
+function my_cleanup() {
+ try {
+ list.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/info_group.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+}
+
function retrieve_money_summaries() {
try {
JSAN.use('util.money');
<window id="patron_info_group_win" width="700" height="550" active="true"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<window id="patron_info_win" width="700" height="550"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
g.new_note = false;
+ g.info_notes_event_listeners = new EventListenerList();
+
refresh();
} catch(E) {
}
}
+ function my_cleanup() {
+ try {
+ g.info_notes_event_listeners.removeAll();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/info_notes.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function refresh() {
retrieve_notes(); render_notes();
}
btn1.setAttribute('label',$("patronStrings").getString('staff.patron.info_notes.render_notes.btn1.delete_note.label'));
btn1.setAttribute('image',"/xul/server/skin/media/images/up_arrow.gif");
- btn1.addEventListener(
+ g.info_notes_event_listeners.add(btn1,
'command',
function(id){
return function() {
btn2.setAttribute('label',$("patronStrings").getString('staff.patron.info_notes.render_notes.btn2.print_note.label'));
btn2.setAttribute('image',"/xul/server/skin/media/images/up_arrow.gif");
- btn2.addEventListener(
+ g.info_notes_event_listeners.add(btn2,
'command',
function(id){ return function() {
try {
<window id="patron_info_stat_cats_win" width="700" height="550"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try{ persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<window id="patron_info_surveys_win" width="700" height="550"
onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try{ persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
obj.controller.view.cmd_show_catalog2.setAttribute('disabled','true');
},
+ 'cleanup' : function() {
+ var obj = this;
+ obj.list.cleanup();
+ obj.list2.cleanup();
+ },
+
'show_noncats' : function() {
var obj = this; var checkout = {};
try {
<window id="items_win" active="true"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.items.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/items.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function default_focus() { try { var x = document.getElementById('noncat'); x.focus(); } catch(E) { try { g.error.sdump('D_ERROR','item.xul, default_focus: ' + E); } catch(F) { dump(E); } } }
]]>
}
/* set widget behavior */
- document.getElementById('csp_menulist').addEventListener(
+ window.new_standing_penalty_event_listeners = new EventListenerList();
+ window.new_standing_penalty_event_listeners.add(document.getElementById('csp_menulist'),
'command',
function() {
document.getElementById('note_btn').checked = false;
},
false
);
- document.getElementById('note_btn').addEventListener(
+ window.new_standing_penalty_event_listeners.add(document.getElementById('note_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('alert_btn').addEventListener(
+ window.new_standing_penalty_event_listeners.add(document.getElementById('alert_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('block_btn').addEventListener(
+ window.new_standing_penalty_event_listeners.add(document.getElementById('block_btn'),
'command',
function() {
document.getElementById('csp_menulist').setAttribute('label','');
},
false
);
- document.getElementById('cancel_btn').addEventListener(
+ window.new_standing_penalty_event_listeners.add(document.getElementById('cancel_btn'),
'command', function() { window.close(); }, false
);
- document.getElementById('apply_btn').addEventListener(
+ window.new_standing_penalty_event_listeners.add(document.getElementById('apply_btn'),
'command',
function() {
var note = document.getElementById('note_tb').value;
}
+function new_penalty_cleanup() {
+ try {
+ window.new_standing_penalty_event_listeners.removeAll();
+ } catch(E) {
+ var err_prefix = 'standing_penalties.js -> penalty_cleanup() : ';
+ if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+ }
+
+}
+
function build_penalty_menu() {
try {
<window id="new_penalty_win"
onload="try { new_penalty_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { new_penalty_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
oils_persist="height width sizemode"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&staff.patron_display.apply_penalty_dialog.title;">
populate_hold_usr_textbox();
populate_pickup_lib_menu();
- $('request_btn').addEventListener(
+ window.place_hold_event_listeners = new EventListenerList();
+ window.place_hold_event_listeners.add($('request_btn'),
'command',
function(ev) {
make_request(copy_ids,false);
}
}
+function my_cleanup() {
+ try {
+ window.place_hold_event_listeners.removeAll();
+ } catch(E) {
+ alert('Error in place_hold.js, my_init(): ' + E);
+ }
+}
+
function make_request(copy_ids,override) {
try {
)
);
addCSSClass(err_msg,'click_link');
- err_msg.addEventListener(
+ window.place_hold_event_listeners.add(err_msg,
'click',
function(copy_ids) {
return function(ev) {
);
err_box.appendChild(retry_btn);
- retry_btn.addEventListener(
+ window.place_hold_event_listeners.add(retry_btn,
'command',
function(copy_ids) {
return function(ev) {
);
err_box.appendChild(override_btn);
- override_btn.addEventListener(
+ window.place_hold_event_listeners.add(override_btn,
'command',
function(copy_ids) {
return function(ev) {
function set_remaining_event_listeners() {
try {
- $('hold_type_menu').addEventListener(
+ window.place_hold_event_listeners.add($('hold_type_menu'),
'command',
function(ev) { oils_lock_page(); },
false
);
- $('cancel_btn').addEventListener(
+ window.place_hold_event_listeners.add($('cancel_btn'),
'command',
function(ev) { xulG.close_tab(); },
false
'value',
patron.util.format_name(au_obj)
);
- $('hold_usr_textbox').addEventListener(
+ window.place_hold_event_listeners.add($('hold_usr_textbox'),
'change',
function(ev) {
try {
$('pickup_lib_menu_placeholder').appendChild(ml);
- ml.addEventListener(
+ window.place_hold_event_listeners.add(ml,
'command',
function(ev) { oils_lock_page(); },
false
<window id="place_hold_win"
onload="try{my_init();font_helper();persist_helper();}catch(E){alert(E);}"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- /////////////////////////////////////////////////////////////////// -->
'init' : function( params ) {
var obj = this;
+ obj.event_listeners = new EventListenerList();
// The bulk of params.query is getting parsed/rendered by obj.controller.init below, and will be reconstituted from possibly modified XUL elements upon Submit.
// But we're going to let search_limit and search_sort be configurable now by those spawning this interface, and let's assume there are no corresponding widgets for now.
obj.controller.render();
var nl = document.getElementsByTagName('textbox');
for (var i = 0; i < nl.length; i++) {
- nl[i].addEventListener('keypress',function(ev){
+ obj.event_listeners.add(nl[i], 'keypress', function(ev) {
if (ev.target.tagName != 'textbox') return;
if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* enter on a mac */) setTimeout( function() { obj.submit(); }, 0);
},false);
}
)
);
- ml.addEventListener('command', function() {
+ obj.event_listeners.add(ml, 'command', function() {
ml.parentNode.setAttribute('value',ml.value);
var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
util.widgets.save_attributes(file, { 'search_depth_ml' : [ 'value' ], 'inactive' : [ 'value' ] });
}
var cb = obj.controller.view.inactive;
- cb.addEventListener('command',function() {
+ obj.event_listeners.add(cb, 'command',function() {
cb.setAttribute('value',cb.checked ? "true" : "false");
var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
util.widgets.save_attributes(file, { 'search_depth_ml' : [ 'value' ], 'inactive' : [ 'value' ] });
}
)
);
- profile_ml.addEventListener('command', function() {
+ obj.event_listeners.add(profile_ml, 'command', function() {
profile_ml.parentNode.setAttribute('value', profile_ml.value);
}, false
);
}
},
+ 'cleanup' : function() {
+ var obj = this;
+ obj.controller.cleanup();
+ obj.event_listeners.removeAll();
+ },
+
'on_submit' : function(q) {
var msg = 'Query = ' + q;
this.error.sdump('D_PATRON', msg);
<window id="patron_search_form_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.search_form.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/search_form.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function default_focus() {
setTimeout(
function() {
<window id="patron_search_form_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
alert(err_msg);
}
}
+
+ function my_cleanup() {
+ try {
+ g.search_form.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/search_form.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
function default_focus() {
setTimeout(
},'mailing_')
);
+ obj.dblclick_handler = function(ev) {
+ JSAN.use('util.functional');
+ var sel = obj.list.retrieve_selection();
+ var list = util.functional.map_list(
+ sel,
+ function(o) { return o.getAttribute('retrieve_id'); }
+ );
+ obj.controller.view.cmd_sel_clip.setAttribute('disabled', list.length < 1 );
+ if (typeof obj.on_dblclick == 'function') {
+ obj.on_dblclick(list);
+ }
+ if (typeof window.xulG == 'object' && typeof window.xulG.on_dblclick == 'function') {
+ obj.error.sdump('D_PATRON','patron.search_result: Calling external .on_dblclick()\n');
+ window.xulG.on_dblclick(list);
+ } else {
+ obj.error.sdump('D_PATRON','patron.search_result: No external .on_dblclick()\n');
+ }
+ };
+
obj.list.init(
{
'columns' : columns,
}
);
},
- 'on_dblclick' : function(ev) {
- JSAN.use('util.functional');
- var sel = obj.list.retrieve_selection();
- var list = util.functional.map_list(
- sel,
- function(o) { return o.getAttribute('retrieve_id'); }
- );
- obj.controller.view.cmd_sel_clip.setAttribute('disabled', list.length < 1 );
- if (typeof obj.on_dblclick == 'function') {
- obj.on_dblclick(list);
- }
- if (typeof window.xulG == 'object' && typeof window.xulG.on_dblclick == 'function') {
- obj.error.sdump('D_PATRON','patron.search_result: Calling external .on_dblclick()\n');
- window.xulG.on_dblclick(list);
- } else {
- obj.error.sdump('D_PATRON','patron.search_result: No external .on_dblclick()\n');
- }
- },
+ 'on_dblclick' : obj.dblclick_handler,
'on_select' : function(ev) {
JSAN.use('util.functional');
var sel = obj.list.retrieve_selection();
if (obj.query) obj.search(obj.query);
},
+ 'cleanup' : function( params ) {
+ var obj = this;
+ obj.controller.cleanup();
+ obj.list.cleanup();
+ },
+
'search' : function(query) {
var obj = this;
var search_hash = {};
<window id="patron_search_result_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ g.search_result.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/search_result.xul', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
]]>
</script>
dojo.require('openils.Util');
+ window.staged_event_listeners = new EventListenerList();
populate_lib_menu();
init_list();
$('list_actions').appendChild( list.render_list_actions() );
list.set_list_actions();
- $('cmd_cancel').addEventListener('command', gen_event_handler('cancel'), false);
- $('cmd_load').addEventListener('command', gen_event_handler('load'), false);
- $('cmd_reload').addEventListener('command', function() { populate_list(); }, false);
+ window.staged_event_listeners.add($('cmd_cancel'), 'command', gen_event_handler('cancel'), false);
+ window.staged_event_listeners.add($('cmd_load'), 'command', gen_event_handler('load'), false);
+ window.staged_event_listeners.add($('cmd_reload'), 'command', function() { populate_list(); }, false);
populate_list();
default_focus();
}
}
+function staged_cleanup() {
+ try {
+ list.cleanup();
+ window.staged_event_listeners.removeAll();
+ } catch(E) {
+ var err_prefix = 'staged.js -> staged_cleanup() : ';
+ if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+ }
+}
+
function populate_lib_menu() {
try {
JSAN.use('util.widgets');
var ml = util.widgets.make_menulist( list_data[0], menu_lib );
ml.setAttribute('id','lib_menu');
x.appendChild( ml );
- ml.addEventListener(
+ window.staged_event_listeners.add(ml,
'command',
function(ev) {
menu_lib = ev.target.value;
<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
<window id="staged_win" onload="try { font_helper(); persist_helper(); staged_init(); } catch(E) { alert(E); }"
+ onunload="try { staged_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
init_list();
init_archived_list();
+ window.standing_penalties_event_listeners = new EventListenerList();
document.getElementById('date1').year = document.getElementById('date1').year - 1;
- document.getElementById('cmd_apply_penalty').addEventListener('command', handle_apply_penalty, false);
- document.getElementById('cmd_remove_penalty').addEventListener('command', handle_remove_penalty, false);
- document.getElementById('cmd_edit_penalty').addEventListener('command', handle_edit_penalty, false);
- document.getElementById('cmd_archive_penalty').addEventListener('command', handle_archive_penalty, false);
- document.getElementById('cmd_retrieve_archived_penalties').addEventListener('command', handle_retrieve_archived_penalties, false);
+ window.standing_penalties_event_listeners.add(document.getElementById('cmd_apply_penalty'), 'command', handle_apply_penalty, false);
+ window.standing_penalties_event_listeners.add(document.getElementById('cmd_remove_penalty'), 'command', handle_remove_penalty, false);
+ window.standing_penalties_event_listeners.add(document.getElementById('cmd_edit_penalty'), 'command', handle_edit_penalty, false);
+ window.standing_penalties_event_listeners.add(document.getElementById('cmd_archive_penalty'), 'command', handle_archive_penalty, false);
+ window.standing_penalties_event_listeners.add(document.getElementById('cmd_retrieve_archived_penalties'), 'command', handle_retrieve_archived_penalties, false);
populate_list();
default_focus();
}
}
+function penalty_cleanup() {
+ try {
+ window.standing_penalties_event_listeners.removeAll();
+ list.cleanup();
+ archived_list.cleanup();
+ } catch(E) {
+ var err_prefix = 'standing_penalties.js -> penalty_cleanup() : ';
+ if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+ }
+}
+
function init_list() {
try {
<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
<window id="penalty_win" onload="try { penalty_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { penalty_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
'init' : function( params ) {
var obj = this;
+ obj.event_listeners = new EventListenerList();
obj.barcode = params['barcode'];
obj.id = params['id'];
var caption = document.getElementById("PatronSummaryContact_caption");
var arrow = document.getAnonymousNodes(caption)[0];
var gb_content = document.getAnonymousNodes(caption.parentNode)[1];
- arrow.addEventListener(
+ obj.event_listeners.add(arrow,
'click',
function() {
setTimeout(
}
},
+ 'cleanup' : function() {
+ var obj = this;
+ if (typeof obj.group_list != 'undefined') obj.group_list.cleanup();
+ if (typeof obj.stat_cat_list != 'undefined') obj.stat_cat_list.cleanup();
+ obj.controller.cleanup();
+ obj.event_listeners.removeAll();
+ },
+
'retrieve' : function() {
try {
<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
<window id="patron_summary_win"
- onload="try { font_helper(); my_init(); persist_helper(); } catch(E) { alert(E); }" onunload="try { observer.unregister(); } catch(E) { alert(E); }"
+ onload="try { font_helper(); my_init(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { my_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
}
}
+ function my_cleanup() {
+ try {
+ observer.unregister();
+ g.summary.cleanup();
+ } catch(E) {
+ var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul:my_init()', E]);
+ try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+ alert(err_msg);
+ }
+ }
+
function export_address(ev) {
var action = ev.originalTarget.id;
var a;
<window id="example_template_win"
onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+ onunload="try { persist_helper_cleanup(); } catch(E) { alert(E); }"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->