From 309196db05700805407dbe6d8f95e55cc68f12ba Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 23 Sep 2010 16:35:20 +0000 Subject: [PATCH] disable holds Detail View button until the asynchronously loading details UI is ready git-svn-id: svn://svn.open-ils.org/ILS/trunk@17927 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../server/patron/hold_details.js | 57 +++++++++++-------- .../xul/staff_client/server/patron/holds.js | 16 +++++- .../server/patron/holds_overlay.xul | 2 +- 3 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/hold_details.js b/Open-ILS/xul/staff_client/server/patron/hold_details.js index 4a7b939c70..3458fb7f1f 100644 --- a/Open-ILS/xul/staff_client/server/patron/hold_details.js +++ b/Open-ILS/xul/staff_client/server/patron/hold_details.js @@ -21,6 +21,10 @@ function my_init() { if (xulG.ahr_id) fetch_and_render_all(); + if (xul_param('when_done')) { + xul_param('when_done')(); + } + } catch(E) { try { g.error.standard_unexpected_error_alert('/xul/server/patron/hold_notices.xul',E); } catch(E) { alert('FIXME: ' + js2JSON(E)); } } @@ -121,33 +125,38 @@ function init_list() { }, } ); + dump('hold details init_list done\n'); } function a_list_of_one() { - g.list.clear(); - g.list.append( - { - 'row' : { - 'my' : { - 'ahr' : g.ahr, - 'status' : g.blob.status, - 'acp' : g.blob.copy, - 'acn' : g.blob.volume, - 'mvr' : g.blob.mvr, - 'patron_family_name' : g.blob.patron_last, - 'patron_first_given_name' : g.blob.patron_first, - 'patron_barcode' : g.blob.patron_barcode, - 'total_holds' : g.blob.total_holds, - 'queue_position' : g.blob.queue_position, - 'potential_copies' : g.blob.potential_copies, - 'estimated_wait' : g.blob.estimated_wait, - 'ahrn_count' : g.blob.hold.notes().length, - 'blob' : g.blob - } - }, - 'no_auto_select' : true, - } - ); + try { + g.list.clear(); + g.list.append( + { + 'row' : { + 'my' : { + 'ahr' : g.ahr, + 'status' : g.blob.status, + 'acp' : g.blob.copy, + 'acn' : g.blob.volume, + 'mvr' : g.blob.mvr, + 'patron_family_name' : g.blob.patron_last, + 'patron_first_given_name' : g.blob.patron_first, + 'patron_barcode' : g.blob.patron_barcode, + 'total_holds' : g.blob.total_holds, + 'queue_position' : g.blob.queue_position, + 'potential_copies' : g.blob.potential_copies, + 'estimated_wait' : g.blob.estimated_wait, + 'ahrn_count' : g.blob.hold.notes().length, + 'blob' : g.blob + } + }, + 'no_auto_select' : true, + } + ); + } catch(E) { + alert('Error in hold_details.js, a_list_of_one(): ' + E); + } } function retrieve_notifications() { diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index 72c4caa9dd..b1ae0b1100 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -150,7 +150,10 @@ patron.holds.prototype = { obj.controller.view.cmd_holds_edit_request_date.setAttribute('disabled','false'); obj.controller.view.cmd_holds_activate.setAttribute('disabled','false'); obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false'); - obj.controller.view.cmd_alt_view.setAttribute('disabled','false'); + obj.controller.view.cmd_alt_view.setAttribute('rendering_rows','false'); + if (obj.controller.view.cmd_alt_view.getAttribute('ready')=='true') { + obj.controller.view.cmd_alt_view.setAttribute('disabled','false'); + } obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false'); obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false'); obj.controller.view.cmd_holds_uncancel.setAttribute('disabled','false'); @@ -173,6 +176,7 @@ patron.holds.prototype = { obj.controller.view.cmd_holds_activate.setAttribute('disabled','true'); obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true'); obj.controller.view.cmd_alt_view.setAttribute('disabled','true'); + obj.controller.view.cmd_alt_view.setAttribute('rendering_rows','true'); obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true'); obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true'); obj.controller.view.cmd_holds_uncancel.setAttribute('disabled','true'); @@ -1346,6 +1350,14 @@ patron.holds.prototype = { }, 0 ); + $('cmd_alt_view').setAttribute('disabled','true'); + xulG.when_done = function() { + $('cmd_alt_view').setAttribute('ready','true'); + if ($('cmd_alt_view').getAttribute('rendering_rows') != 'true') { + $('cmd_alt_view').setAttribute('disabled','false'); + } + dump('hold details UI ready\n'); + } netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); JSAN.use('util.browser'); obj.browser = new util.browser(); @@ -1355,7 +1367,7 @@ patron.holds.prototype = { 'push_xulG' : true, 'alt_print' : false, 'browser_id' : 'hold_detail_frame', - 'passthru_content_params' : xulG, + 'passthru_content_params' : xulG } ); diff --git a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul index 106501cf9a..df101453fb 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/holds_overlay.xul @@ -42,7 +42,7 @@ accesskey="&staff.circ.holds.title_transfer.accesskey;" /> - +