Don't feed big G to the objects hanging off of G if we don't have to. But can I...
[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 () {
5
6         JSAN.use('util.error'); this.error = new util.error();
7         // Place a test here for network connectivity
8         // this.offline = true;
9
10         return this;
11 };
12
13 main.network.prototype = {
14
15         // Flag for whether the staff client should act as if it were offline or not
16         'offline' : false,
17
18         'request' : function (app,name,params,f) {
19
20                 try {
21
22                         this.error.sdump('D_SES','=-=-=-=-= user_request("'+app+'","'+name+'",'+js2JSON(params)+')\n');
23                         var request = new RemoteRequest( app, name );
24                         for(var index in params) {
25                                 request.addParam(params[index]);
26                         }
27         
28                         if (f)  {
29                                 request.setCompleteCallback(f);
30                                 request.send(false);
31                                 this.error.sdump('D_SES_RESULT','=-=-= result asynced\n');
32                                 return null;
33                         } else {
34                                 request.send(true);
35                                 var result = request.getResultObject();
36                                 this.error.sdump('D_SES_RESULT','=-=-= result = ' + js2JSON(result) + '\n');
37                                 return result;
38                         }
39
40                 } catch(E) {
41                         if (instanceOf(E,perm_ex)) {
42                                 alert('permission exception: ' + js2JSON(E));
43                         }
44                         throw(E);
45                 }
46         }
47 }
48
49 /*
50 function sample_callback(request) {
51         var result = request.getResultObject();
52 }
53 */
54
55 dump('exiting main/network.js\n');