Closer to being able to get authority control set from thesaurus code
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 28 Jun 2011 19:28:40 +0000 (15:28 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 11 Jul 2011 17:48:30 +0000 (13:48 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
Open-ILS/web/opac/skin/default/js/authbrowse.js
Open-ILS/web/opac/skin/default/xml/common/js_common.xml

index 9284094..3583d66 100644 (file)
@@ -162,8 +162,23 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) {
             }
         },
 
-        _preFetchWithFielder: function(map) {
-            // TODO get pkeys from fieldmapper but use fielder to get everything
+        _preFetchWithFielder: function(cmap) {
+            for (var hint in cmap) {
+                var cache_key = cmap[hint];
+                var method = "open-ils.fielder." + hint + ".atomic";
+                var pkey = fieldmapper.IDL.fmclasses[hint].pkey;
+
+                var query = {};
+                query[pkey] = {"!=": null};
+
+                openils.AuthorityControlSet[cache_key] = dojo.map(
+                    fieldmapper.standardRequest(
+                        ["open-ils.fielder", method],
+                        [{"cache": 1, "query" : query}]
+                    ),
+                    function(h) { return new fieldmapper[hint]().fromHash(h); }
+                );
+            }
         },
 
         controlSetId: function (x) {
@@ -176,14 +191,12 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) {
         },
 
         controlSetByThesaurusCode: function (x) {
-            console.log("1");
             var thes = dojo.filter(
                 openils.AuthorityControlSet._thesaurus_list,
                 function (at) { return at.code() == x }
             )[0];
-            console.log("2");
 
-            return this.controlSet(thes.controlSet());
+            return this.controlSet(thes.control_set());
         },
 
         bibFieldByTag: function (x) {
index 3aa8f2f..5fcb5ec 100644 (file)
@@ -42,9 +42,7 @@ function displayAuthorityRecords(doc) {
         function(record) {
             console.log("record");
             var m = new MARC.Record({"xml": record});
-            console.log("got m");
             var s = m.extractFixedField("Subj");
-            console.log("got s");
             var cs = acs_helper.controlSetByThesaurusCode(s);
             console.log("got cs");
             dojo.create(
index 498e5df..4fc4605 100644 (file)
@@ -5,7 +5,7 @@
     type='text/javascript'></script>
 <!--#else-->
 <script language='javascript'  
-    src='/IDL2js?mvr,bre,aou,aout,pgt,lasso,cmf,cmc,cmsa,cam,cifm,clfm,citm,cblvl,ccs,aba'
+    src='/IDL2js?mvr,bre,aou,aout,pgt,lasso,cmf,cmc,cmsa,cam,cifm,clfm,citm,cblvl,ccs,aba,acs,at,abaafm,acsaf,acsbf'
     type='text/javascript'></script>
 <!--#endif-->