using addOnLoad (thanks, dbs). using atomic version of queued record fetcher to...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Sep 2008 13:58:45 +0000 (13:58 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 2 Sep 2008 13:58:45 +0000 (13:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10503 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 85c6edd..ed982e8 100644 (file)
@@ -25,7 +25,7 @@
         <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='vandelay.js'></script>
     </head>
-    <body class="tundra" onload='vlInit();'>
+    <body class="tundra" style='height:100%;'>
         <div id="vl-generic-progress" style='width:100%;text-align:center'>
             <div dojoType="dijit.ProgressBar" style="width:200px" indeterminate="true"></div>
         </div>
index 1477b8f..48acd60 100644 (file)
@@ -166,9 +166,10 @@ function processSpool(key, queue, type, onload) {
 
 function retrieveQueuedRecords(type, queueId, onload) {
     fieldmapper.standardRequest(
-        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.records.retrieve'],
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic'],
         {   async: true,
             params: [authtoken, queueId, {clear_marc:1}],
+            /* intermittent bug in streaming, multipart requests prevents use of onreponse for now...
             onresponse: function(r) {
                 var rec = r.recv().content();
                 if(e = openils.Event.parse(rec))
@@ -176,7 +177,18 @@ function retrieveQueuedRecords(type, queueId, onload) {
                 queuedRecords.push(rec);
                 queuedRecordsMap[rec.id()] = rec;
             },
-            oncomplete: function(){onload();}
+            */
+            oncomplete: function(r){
+                var recs = r.recv().content();
+                if(e = openils.Event.parse(recs))
+                    return alert(e);
+                for(var i = 0; i < recs.length; i++) {
+                    var rec = recs[i];
+                    queuedRecords.push(rec);
+                    queuedRecordsMap[rec.id()] = rec;
+                }
+                onload();
+            }
         }
     );
 }
@@ -201,9 +213,9 @@ function buildRecordGrid(type) {
 
     /* test structure... */
     var structure = [{
-        noscroll : true,
+        //noscroll : true,
         cells : [[
-            {name: 'ID', field: 'id'},
+            //{name: 'ID', field: 'id'},
         ]]
     }];
 
@@ -211,11 +223,13 @@ function buildRecordGrid(type) {
     for(var i = 0; i < defs.length; i++) {
         var attr = defs[i]
         attrMap[attr.code()] = attr.id();
-        structure[0].cells[0].push({
+        var col = {
             name:attr.description(), 
             field:'attr.' + attr.code(),
             get: getAttrValue
-        });
+        };
+        if(attr.code().match(/title/i)) col.width = 'auto'; // this is hack.
+        structure[0].cells[0].push(col);
     }
 
     vlQueueGrid.setStructure(structure);
@@ -263,3 +277,5 @@ function batchUpload() {
 
     createQueue(queueName, currentType, handleCreateQueue);
 }
+
+dojo.addOnLoad(vlInit);