fetch bib/auth attr defs at startup time. leave some debugging for now
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 30 Aug 2008 16:03:13 +0000 (16:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 30 Aug 2008 16:03:13 +0000 (16:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10490 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/vandelay/vandelay.html
Open-ILS/web/vandelay/vandelay.js

index f98d063..5c48ae3 100644 (file)
@@ -24,7 +24,7 @@
         <script type="text/javascript" djConfig="parseOnLoad: true" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='vandelay.js'></script>
     </head>
-    <body class="tundra">
+    <body class="tundra" onload='vlInit();'>
         <!-- MARC upload form -->
         <div id='vl-marc-upload-div'>
             <h1>Evergreen MARC File Upload</h1>
index 548f67f..fcfec72 100644 (file)
@@ -25,6 +25,41 @@ dojo.require('openils.Event');
 
 var authtoken = dojo.cookie('ses') || new openils.CGI().param('ses');
 var VANDELAY_URL = '/vandelay';
+var bibAttrDefs = [];
+var authAttrDefs = [];
+
+/**
+  * Grab initial data
+  */
+function vlInit() {
+
+    // Fetch the bib and authority attribute definitions
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
+        {   async: true,
+            params: [authtoken, {id:{'!=':null}}],
+            onresponse: function(r) {
+                var def = r.recv().content(); 
+                if(openils.Event.parse(def)) 
+                    return alert(def);
+                bibAttrDefs.push(def);
+            },
+        }
+    );
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.search.vqarad'],
+        {   async: true,
+            params: [authtoken, {id:{'!=':null}}],
+            onresponse: function(r) {
+                var def = r.recv().content(); 
+                if(openils.Event.parse(def)) 
+                    return alert(def);
+                authAttrDefs.push(def);
+            }
+        }
+    );
+}
 
 /**
   * asynchronously upload a file of MARC records
@@ -66,7 +101,7 @@ function createQueue(queueName, type, onload) {
                 var queue = r.recv().content();
                 if(e = openils.Event.parse(queue)) 
                     return alert(e);
-                onload(queue.id());
+                onload(queue);
             }
         }
     );
@@ -105,10 +140,12 @@ function batchUpload() {
     }
 
     var handleUploadMARC = function(key) {
+        alert('marc uploaded');
         processSpool(key, currentQueue, recordType, handleProcessSpool);
     };
 
     var handleCreateQueue = function(queue) {
+        alert('queue created ' + queue.name());
         currentQueue = queue;
         uploadMARC(handleUploadMARC);
     };