progressmeter as a "throbber" for page loads, etc. in staff client browser
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 23 Mar 2010 16:35:01 +0000 (16:35 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 23 Mar 2010 16:35:01 +0000 (16:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15938 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/browser.js
Open-ILS/xul/staff_client/chrome/content/util/browser.xul
Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul

index 5ffe5ac..6cd7a3b 100644 (file)
@@ -231,6 +231,24 @@ util.browser.prototype = {
                         var s = obj.url + '\n' + obj.get_content().location.href + '\n';
                         const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
                         const nsIChannel = Components.interfaces.nsIChannel;
+                        ////// handle the throbber
+                        var throbber = document.getElementById('throbber');
+                        if (throbber) {
+                            var busy = false;
+                            if (!(stateFlags & nsIWebProgressListener.STATE_RESTORING)) {
+                                busy = true;
+                                throbber.setAttribute('mode','undetermined'); 
+                            }
+                            if (stateFlags & nsIWebProgressListener.STATE_STOP) {
+                                busy = false;
+                                setTimeout(
+                                    function() {
+                                        if (!busy) { throbber.setAttribute('mode','determined'); }
+                                    }, 2000
+                                );
+                            }
+                        }
+                        //////
                         if (stateFlags == 65540 || stateFlags == 65537 || stateFlags == 65552) { return; }
                         s += ('onStateChange: stateFlags = ' + stateFlags + ' status = ' + status + '\n');
                         if (stateFlags & nsIWebProgressListener.STATE_IS_REQUEST) {
@@ -279,6 +297,7 @@ util.browser.prototype = {
                             s += ('\tSTATE_STOP\n');
                         }
                         //obj.error.sdump('D_BROWSER',s);    
+                        if (throbber) { throbber.setAttribute('tooltiptext',s); }
                     } catch(E) {
                         obj.error.sdump('D_ERROR','util.browser.progresslistener.onstatechange: ' + (E));
                     }
index d927992..a58845d 100644 (file)
             <button id="reload" command="cmd_reload" disabled="false" hidden="false"/>
             <button id="forward" command="cmd_forward" disabled="true" hidden="true"/>
             <spacer flex="1"/>
+            <progressmeter id="throbber" mode="determined" flex="1"/>
             <label id="debug" value="Debug" disabled="true" command="cmd_debug" onclick="this.doCommand();" />
             <button id="browser_print" label="Print Page" command="cmd_print" hidden="true"/>
         </hbox>
index 8ba1a70..10325cb 100644 (file)
             <button id="reload" command="cmd_reload" disabled="false" hidden="false"/>
             <button id="forward" command="cmd_forward" disabled="true" hidden="true"/>
             <spacer flex="1"/>
+            <progressmeter id="throbber" mode="determined" flex="1"/>
             <label id="debug" value="Debug" disabled="true" command="cmd_debug" onclick="this.doCommand();" />
             <button id="browser_print" label="Print Page" oldcommand="cmd_print" hidden="true"
                 oncommand="netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); if (g.browser.alt_print) { JSAN.use('util.print'); var p = new util.print(); p.NSPrint(g.browser.get_content(),false,{}); } else { g.browser.get_content().print(); }"