]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/evergreen/main/network.js
36e5831c6ea87d0df26cc2c111cb46919207324b
[Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / evergreen / main / network.js
1 dump('entering main/network.js\n');
2
3 if (typeof main == 'undefined') main = {};
4 main.network = function (mw,G) {
5
6         this.mw = mw; this.G = G;
7
8         // Place a test here for network connectivity
9         // this.offline = true;
10
11         return this;
12 };
13
14 main.network.prototype = {
15
16         // Flag for whether the staff client should act as if it were offline or not
17         'offline' : false,
18
19         'request' : function (app,name,params,f) {
20
21                 try {
22
23                         this.G.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
24                         var request = new RemoteRequest( app, name );
25                         for(var index in params) {
26                                 request.addParam(params[index]);
27                         }
28         
29                         if (f)  {
30                                 request.setCompleteCallback(f);
31                                 request.send(false);
32                                 this.G.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
33                                 return null;
34                         } else {
35                                 request.send(true);
36                                 var result = request.getResultObject();
37                                 this.G.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
38                                 return result;
39                         }
40
41                 } catch(E) {
42                         if (instanceOf(E,perm_ex)) {
43                                 alert('permission exception: ' + js2JSON(E));
44                         }
45                         throw(E);
46                 }
47         }
48 }
49
50 /*
51 function sample_callback(request) {
52         var result = request.getResultObject();
53 }
54 */
55
56 dump('exiting main/network.js\n');