1 /* ---------------------------------------------------------------------------
2 * Copyright (C) 2008 Georgia Public Library Service
3 * Author: Bill Erickson <erickson@esilibrary.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * ---------------------------------------------------------------------------
17 if(!dojo._hasResource["openils.CopyLocation"]) {
19 dojo._hasResource["openils.CopyLocation"] = true;
20 dojo.provide("openils.CopyLocation");
21 dojo.declare('openils.CopyLocation', null, {
24 openils.CopyLocation.cache = {};
25 openils.CopyLocation.storeCache = {};
27 openils.CopyLocation.createStore = function(focusOrg, onload, nocache) {
28 if(!nocache && openils.CopyLocation.storeCache[focusOrg])
29 return onload(openils.CopyLocation.storeCache[focusOrg]);
31 var locs = r.recv().content();
32 for(var i = 0; i < locs.length; i++)
33 openils.CopyLocation.cache[locs[i].id()] = locs[i];
34 openils.CopyLocation.storeCache[focusOrg] = acpl.toStoreData(locs);
35 onload(openils.CopyLocation.storeCache[focusOrg]);
37 fieldmapper.standardRequest(
38 ['open-ils.circ', 'open-ils.circ.copy_location.retrieve.all'],
46 openils.CopyLocation.retrieve = function(id) {
47 if(openils.CopyLocation.cache[id])
48 return openils.CopyLocation.cache[id];
49 return openils.CopyLocation.cache[id] =
50 fieldmapper.standardRequest(
51 ['open-ils.circ', 'open-ils.circ.copy_location.retrieve'], [id]);