[open-ils-commits] r9945 - in branches/acq-experiment: . Open-ILS/web/js/dojo/openils

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 26 18:11:41 EDT 2008


Author: erickson
Date: 2008-06-26 18:11:36 -0400 (Thu, 26 Jun 2008)
New Revision: 9945

Added:
   branches/acq-experiment/Open-ILS/web/js/dojo/openils/CopyLocation.js
Modified:
   branches/acq-experiment/
Log:
Merged revisions 9943 via svnmerge from 
svn://svn.open-ils.org/ILS/trunk

........
  r9943 | erickson | 2008-06-26 18:09:57 -0400 (Thu, 26 Jun 2008) | 1 line
  
  adding some copy loc handling code
........



Property changes on: branches/acq-experiment
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-9941
   + /trunk:1-9944

Copied: branches/acq-experiment/Open-ILS/web/js/dojo/openils/CopyLocation.js (from rev 9943, trunk/Open-ILS/web/js/dojo/openils/CopyLocation.js)
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/CopyLocation.js	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/CopyLocation.js	2008-06-26 22:11:36 UTC (rev 9945)
@@ -0,0 +1,54 @@
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008  Georgia Public Library Service
+ * Author: Bill Erickson <erickson at esilibrary.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * ---------------------------------------------------------------------------
+ */
+
+if(!dojo._hasResource["openils.CopyLocation"]) {
+
+    dojo._hasResource["openils.CopyLocation"] = true;
+    dojo.provide("openils.CopyLocation");
+    dojo.declare('openils.CopyLocation', null, {
+    });
+
+    openils.CopyLocation.cache = {};
+    openils.CopyLocation.storeCache = {};
+
+    openils.CopyLocation.createStore = function(focusOrg, onload, nocache) {
+        if(!nocache && openils.CopyLocation.storeCache[focusOrg])
+            return onload(openils.CopyLocation.storeCache[focusOrg]);
+        function mkStore(r) {
+            var locs = r.recv().content();
+            for(var i = 0; i < locs.length; i++) 
+                openils.CopyLocation.cache[locs[i].id()] = locs[i];
+            openils.CopyLocation.storeCache[focusOrg] = acpl.toStoreData(locs);
+            onload(openils.CopyLocation.storeCache[focusOrg]);
+        }
+        fieldmapper.standardRequest(
+            ['open-ils.circ', 'open-ils.circ.copy_location.retrieve.all'],
+            {   async: true,
+                params: [focusOrg],
+                oncomplete: mkStore
+            }
+        );
+    }
+
+    openils.CopyLocation.retrieve = function(id) {
+        if(openils.CopyLocation.cache[id])
+            return openils.CopyLocation.cache[id];
+        return openils.CopyLocation.cache[id] = 
+            fieldmapper.standardRequest(
+                ['open-ils.circ', 'open-ils.circ.copy_location.retrieve'], [id]);
+    }
+}
+



More information about the open-ils-commits mailing list