disable holds Detail View button until the asynchronously loading details UI is ready
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 16:35:20 +0000 (16:35 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 16:35:20 +0000 (16:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17927 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/hold_details.js
Open-ILS/xul/staff_client/server/patron/holds.js
Open-ILS/xul/staff_client/server/patron/holds_overlay.xul

index 4a7b939..3458fb7 100644 (file)
@@ -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() {
index 72c4caa..b1ae0b1 100644 (file)
@@ -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
             }
         );
 
index 106501c..df10145 100644 (file)
@@ -42,7 +42,7 @@
             accesskey="&staff.circ.holds.title_transfer.accesskey;" />
         <command id="cmd_search_opac" />
         <command id="save_columns" />
-        <command id="cmd_alt_view" />
+        <command id="cmd_alt_view" disabled="true"/>
         <command id="cmd_cancelled_holds_view" />
         <command id="cmd_uncancelled_holds_view" />
         <command id="cmd_view_expired_onshelf_holds"