after queueing, retrieve the recs and shove them into a grid. need to add attr display
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 30 Aug 2008 16:48:14 +0000 (16:48 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 30 Aug 2008 16:48:14 +0000 (16:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10492 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 5c48ae3..29d3317 100644 (file)
@@ -19,6 +19,7 @@
             @import "/js/dojo/dojo/resources/dojo.css";
             @import "/js/dojo/dijit/themes/tundra/tundra.css";
             @import "/js/dojo/dijit/tests/css/dijitTests.css"; 
+            @import "/js/dojo/dojox/grid/_grid/Grid.css";
             td { padding: 6px; }
         </style>
         <script type="text/javascript" djConfig="parseOnLoad: true" src="/js/dojo/dojo/dojo.js"></script>
                 </table>
             </form>
         </div>
+        <div id='vl-queue-div' style='display:none;height:100%;'>
+            <h1>Record Queue</h1>
+            <div style='height:100%;'>
+                <div dojoType='dojox.Grid' jsId='vlQueueGrid'> </div>
+            </div>
+        </div>
     </body>
 </html>
index fcfec72..6777340 100644 (file)
@@ -18,7 +18,10 @@ dojo.require("dijit.ProgressBar");
 dojo.require("dijit.form.Button"); 
 dojo.require("dijit.form.FilteringSelect"); 
 dojo.require("dojo.cookie");
+dojo.require("dojox.grid.Grid");
+dojo.require("dojo.data.ItemFileReadStore");
 dojo.require("fieldmapper.Fieldmapper");
+dojo.require("fieldmapper.dojoData");
 dojo.require('openils.CGI');
 dojo.require('openils.User');
 dojo.require('openils.Event');
@@ -27,6 +30,7 @@ var authtoken = dojo.cookie('ses') || new openils.CGI().param('ses');
 var VANDELAY_URL = '/vandelay';
 var bibAttrDefs = [];
 var authAttrDefs = [];
+var queuedRecords = [];
 
 /**
   * Grab initial data
@@ -126,6 +130,51 @@ function processSpool(key, queue, type, onload) {
     );
 }
 
+function retrieveQueuedRecords(type, queueId, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.records.retrieve'],
+        {   async: true,
+            params: [authtoken, queueId, {clear_marc:1}],
+            onresponse: function(r) {
+                var rec = r.recv().content();
+                if(e = openils.Event.parse(rec))
+                    return alert(e);
+                queuedRecords.push(rec);
+            },
+            oncomplete: function(){onload();}
+        }
+    );
+}
+
+function buildRecordGrid(type) {
+    dojo.style(dojo.byId('vl-marc-upload-div'),"display","none");
+    dojo.style(dojo.byId('vl-queue-div'),"display","block");
+
+    /* test structure... */
+    var structure = [{
+        cells : [[
+            {name: 'ID', field: 'id'},
+            {name: 'Create Time', field: 'create_time'},
+            {name: 'Import Time', field: 'import_time'},
+            {name: 'Purpose', field: 'purpose'},
+        ]]
+    }];
+
+    vlQueueGrid.setStructure(structure);
+
+    var storeData;
+    if(type == 'bib')
+        storeData = vqbr.toStoreData(queuedRecords);
+    else
+        storeData = vqar.toStoreData(queuedRecords);
+
+    var store = new dojo.data.ItemFileReadStore({data:storeData});
+    var model = new dojox.grid.data.DojoData(
+        null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}});
+    vlQueueGrid.setModel(model);
+    vlQueueGrid.update();
+}
+
 /**
   * Create queue, upload MARC, process spool, load the newly created queue 
   */
@@ -135,8 +184,14 @@ function batchUpload() {
 
     var currentQueue = null;
 
+    var handleRetrieveRecords = function() {
+        alert("building record grid");
+        buildRecordGrid(recordType);
+    }
+
     var handleProcessSpool = function() {
         alert('records uploaded and spooled');
+        retrieveQueuedRecords(recordType, currentQueue.id(), handleRetrieveRecords);
     }
 
     var handleUploadMARC = function(key) {