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 JSAN.use('util.file');
30 function gen_fm_retrieval_func(classname,data) {
31 var app = data[0]; var method = data[1]; var params = data[2];
34 obj.list[classname] = obj.G.network.request( app, method, params);
35 // store an offline copy
36 var file = new util.file( obj.mw, obj.G, classname );
37 file.set_object( obj.list[classname] );
42 //obj.hash[classname] = convert_object_list_to_hash( obj.list[classname] );
46 obj.G.error.sdump('D_DEBUG','_cacheable_fm_objects = ' + js2JSON(this._cacheable_fm_objects) + '\n');
48 for (var i in this._cacheable_fm_objects) {
49 this.chain.push( gen_fm_retrieval_func(i,this._cacheable_fm_objects[i]) );
53 var other_fm_objects = {
56 'open-ils.actor.org_unit.full_path.retrieve',
57 [ obj.G.auth.session.key ]
61 'open-ils.circ.stat_cat.actor.retrieve.all',
62 [ obj.G.auth.session.key, obj.au.home_ou.id() ]
70 OpenILS.data.prototype = {
75 'init' : function () {
77 if (typeof this.on_complete == 'function') {
79 this.chain.push( this.on_complete );
82 JSAN.use('util.exec');
83 util.exec.chain( this.chain );
86 '_cacheable_fm_objects' : {
88 'pgt' : [ 'open-ils.actor', 'open-ils.actor.groups.retrieve', [] ],
89 'cit' : [ 'open-ils.actor', 'open-ils.actor.user.ident_types.retrieve', [] ],
90 'cst' : [ 'open-ils.actor', 'open-ils.actor.standings.retrieve', [] ],
91 'acpl' : [ 'open-ils.search', 'open-ils.search.config.copy_location.retrieve.all', [] ],
92 'ccs' : [ 'open-ils.search', 'open-ils.search.config.copy_status.retrieve.all', [] ],
93 'aou' : [ 'open-ils.actor', 'open-ils.actor.org_tree.retrieve', [] ],
94 'aout' : [ 'open-ils.actor', 'open-ils.actor.org_types.retrieve', [] ]
99 dump('exiting OpenILS/data.js\n');