[open-ils-commits] r12033 - in branches/staff-client-experiment/Open-ILS/xul/staff_client: chrome/content/util server/main
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Feb 1 02:52:35 EST 2009
Author: phasefx
Date: 2009-02-01 02:52:31 -0500 (Sun, 01 Feb 2009)
New Revision: 12033
Modified:
branches/staff-client-experiment/Open-ILS/xul/staff_client/chrome/content/util/network.js
branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu.js
branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul
Log:
added a statusbar and a progress meter for network activity. Isn't aware of network activity in HTML-based pages yet
Modified: branches/staff-client-experiment/Open-ILS/xul/staff_client/chrome/content/util/network.js
===================================================================
--- branches/staff-client-experiment/Open-ILS/xul/staff_client/chrome/content/util/network.js 2009-02-01 06:30:01 UTC (rev 12032)
+++ branches/staff-client-experiment/Open-ILS/xul/staff_client/chrome/content/util/network.js 2009-02-01 07:52:31 UTC (rev 12033)
@@ -89,6 +89,12 @@
'\noverride_params = ' + override_params + '\n_params = ' + _params +
'\nResult #' + (++obj.link_id) + ( f ? ' asynced' : ' synced' ) );
+ if (document.getElementById('network_progress')) {
+ if (g && g.menu && g.menu.network_meter && typeof g.menu.network_meter.inc == 'function') g.menu.network_meter.inc(app,name);
+ } else if (typeof xulG != 'undefined') {
+ if (xulG && xulG.network_meter && typeof xulG.network_meter.inc == 'function') xulG.network_meter.inc(app,name);
+ }
+
var request = new RemoteRequest( app, name );
if (_params && _params.secure) {
request.setSecure(true);
@@ -106,6 +112,13 @@
try {
var duration = ( (new Date).getTime() - start_timer )/1000;
if ( obj.get_result(req) == null && duration > obj.network_timeout ) req.cancelled = true;
+
+ if (document.getElementById('network_progress')) {
+ if (g && g.menu && g.menu.network_meter && typeof g.menu.network_meter.dec == 'function') g.menu.network_meter.dec(app,name);
+ } else if (typeof xulG != 'undefined') {
+ if (xulG && xulG.network_meter && typeof xulG.network_meter.dec == 'function') xulG.network_meter.dec(app,name);
+ }
+
var json_string = js2JSON(obj.get_result(req));
obj.error.sdump('D_SES_RESULT','asynced result #'
+ obj.link_id + '\n\n'
@@ -140,6 +153,13 @@
request.send(true);
var duration = ( (new Date).getTime() - start_timer )/1000;
if ( obj.get_result(request) == null && duration > obj.network_timeout ) request.cancelled = true;
+
+ if (document.getElementById('network_progress')) {
+ if (g && g.menu && g.menu.network_meter && typeof g.menu.network_meter.dec == 'function') g.menu.network_meter.dec(app,name);
+ } else if (typeof xulG != 'undefined') {
+ if (xulG && xulG.network_meter && typeof xulG.network_meter.dec == 'function') xulG.network_meter.dec(app,name);
+ }
+
} catch(E) {
throw(E);
}
Modified: branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu.js
===================================================================
--- branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu.js 2009-02-01 06:30:01 UTC (rev 12032)
+++ branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu.js 2009-02-01 07:52:31 UTC (rev 12033)
@@ -12,6 +12,7 @@
JSAN.use('util.window'); this.window = new util.window();
this.w = window;
+ document.getElementById('network_progress').setAttribute('count','0');
}
main.menu.prototype = {
@@ -882,6 +883,22 @@
}
},
+ 'network_meter' : {
+ 'inc' : function(msg) {
+ var m = document.getElementById('network_progress');
+ var count = 1 + Number( m.getAttribute('count') );
+ m.setAttribute('mode','undetermined');
+ m.setAttribute('count', count);
+ },
+ 'dec' : function(msg) {
+ var m = document.getElementById('network_progress');
+ var count = 1 - Number( m.getAttribute('count') );
+ if (count < 0) count = 0;
+ if (count == 0) m.setAttribute('mode','determined');
+ m.setAttribute('count', count);
+ }
+ },
+
'set_tab' : function(url,params,content_params) {
var obj = this;
if (!url) url = '/xul/server/';
@@ -900,6 +917,7 @@
content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); };
content_params.open_chrome_window = function(a,b,c) { return xulG.window.open(a,b,c); };
content_params.url_prefix = function(url) { return obj.url_prefix(url); };
+ content_params.network_meter = obj.network_meter;
content_params.chrome_xulG = xulG;
if (params && params.tab_name) content_params.set_tab_name( params.tab_name );
Modified: branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul
===================================================================
--- branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul 2009-02-01 06:30:01 UTC (rev 12032)
+++ branches/staff-client-experiment/Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul 2009-02-01 07:52:31 UTC (rev 12033)
@@ -38,7 +38,12 @@
<tabpanel id="panel_9"><label value="panel_9"/></tabpanel>
</tabpanels>
</tabbox>
- <toolbox id="entity_toolbox"/>
+ <statusbar>
+ <statusbarpanel />
+ <spacer flex="1" />
+ <progressmeter id="network_progress" flex="1" mode="determined" value="0" />
+ <statusbarpanel />
+ </statusbar>
</box>
<!-- The main top level menubar -->
@@ -49,7 +54,7 @@
<menu id="main.menu.search" />
<menu id="main.menu.circ" />
<menu id="main.menu.cat" />
- <spacer flex="1" />
+ <spacer flex="1" />
<menu id="main.menu.admin" />
<menu id="main.menu.help" />
</menubar>
More information about the open-ils-commits
mailing list