1 dump('entering OpenILS/data.js\n');
3 if (typeof OpenILS == 'undefined') OpenILS = {};
4 OpenILS.data = function (mw,G) {
6 this.mw = mw; this.G = G;
15 obj.au = obj.G.network.request(
17 'open-ils.search.actor.user.session',
18 [ obj.G.auth.session.key ]
26 function a_get(obj,i) { return [i, obj[i]]; } // funkiness with loops and closures
28 for (var i in this._cacheable_fm_objects) {
29 var classname = a_get(this._cacheable_fm_objects,i)[0];
30 var data = a_get(this._cacheable_fm_objects,i)[1];
31 var app = data[0]; var method = data[1]; var params = data[2];
35 obj.list[classname] = obj.G.network.request( app, method, params);
36 // store an offline copy
40 //obj.hash[classname] = convert_object_list_to_hash( obj.list[classname] );
46 var other_fm_objects = {
49 'open-ils.actor.org_unit.full_path.retrieve',
50 [ obj.G.auth.session.key ]
54 'open-ils.circ.stat_cat.actor.retrieve.all',
55 [ obj.G.auth.session.key, obj.au.home_ou.id() ]
63 OpenILS.data.prototype = {
68 'init' : function () {
70 if (typeof this.on_complete == 'function') {
72 this.chain.push( this.on_complete );
75 JSAN.use('util.exec');
76 util.exec.chain( this.chain );
79 '_cacheable_fm_objects' : {
81 'pgt' : [ 'open-ils.actor', 'open-ils.actor.groups.retrieve', [] ],
82 'cit' : [ 'open-ils.actor', 'open-ils.actor.user.ident_types.retrieve', [] ],
83 'cst' : [ 'open-ils.actor', 'open-ils.actor.standings.retrieve', [] ],
84 'acpl' : [ 'open-ils.search', 'open-ils.search.config.copy_location.retrieve.all', [] ],
85 'ccs' : [ 'open-ils.search', 'open-ils.search.config.copy_status.retrieve.all', [] ],
86 'aou' : [ 'open-ils.actor', 'open-ils.actor.org_tree.retrieve', [] ],
87 'aout' : [ 'open-ils.actor', 'open-ils.actor.org_types.retrieve', [] ]
92 dump('exiting OpenILS/data.js\n');