added import-all option in queue display, repaired some bugs which prevented going...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Oct 2008 18:59:18 +0000 (18:59 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Oct 2008 18:59:18 +0000 (18:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10810 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/vandelay.dtd
Open-ILS/web/vandelay/inc/queue.xml
Open-ILS/web/vandelay/vandelay.css
Open-ILS/web/vandelay/vandelay.js
Open-ILS/web/vandelay/vandelay.xml

index 9e7b116..fd26641 100644 (file)
@@ -32,6 +32,7 @@
 <!ENTITY vandelay.import.matches "Import Matches">
 <!ENTITY vandelay.import.records "Import Records">
 <!ENTITY vandelay.import.selected "Import Selected">
+<!ENTITY vandelay.import.all "Import All">
 <!ENTITY vandelay.import.time "Import Time">
 <!ENTITY vandelay.inspect.queue "Inspect Queue">
 <!ENTITY vandelay.last.edit.date "Last Edit Date">
index 61777f4..00e5722 100644 (file)
@@ -1,4 +1,8 @@
 <h1>&vandelay.record.queue;</h1><br/>
+<div>
+    <span style='font-size:105%;' id='vl-queue-summary-name'/>
+    <span id='vl-queue-summary-import-count'/> / <span id='vl-queue-summary-total-count'/>
+</div>
 <script>
     var vlQueueGridLayout;
     function resetVlQueueGridLayout() {
@@ -37,7 +41,7 @@
                         <button jsId='vlQueueGridColumnPickerButton' 
                             onclick='
                                 vlQueueGridColumePickerDialog.hide();
-                                vlQueueGridColumePicker.update(true);'
+                                vlQueueGridColumePicker[currentType].update(true);'
                             dojoType='dijit.form.Button'>&vandelay.done;</button>
                     </td>
                 </tr>
     <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
         <table width='100%' style='margin-bottom:0px;'>
             <tr>
-                <td align='left'>
+                <td align='left' valign='bottom'>
                     <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>&vandelay.import.selected;</button>
+                    <button dojoType='dijit.form.Button' onclick='vlImportAllRecords();'>&vandelay.import.all;</button>
                     <button dojoType='dijit.form.Button' onclick="
                         if(confirm('&vandelay.sure.to.delete.queue;')) {
                             vlDeleteQueue(currentType, currentQueueId, 
                                 function() { displayGlobalDiv('vl-marc-upload-div'); });
                         }">&vandelay.delete.queue;</button>
                 </td>
-                <td align='middle'>
+                <td align='middle' valign='bottom'>
                     <style>.filter_td { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
                     <table><tr>
                         <td class='filter_td'>
-                            &vandelay.limit.to.collision.matches;
-                            <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches'/>
-                        </td>
-                        <td class='filter_td' style='padding-left:5px;'>
-                            &vandelay.limit.to.non.imported;
-                            <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked'/>
+                            <table class='small_form_table'><tr>
+                                    <td>&vandelay.limit.to.collision.matches;</td>
+                                    <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches'/></td>
+                                </tr><tr>
+                                    <td>&vandelay.limit.to.non.imported;</td>
+                                    <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked'/></td>
+                            </tr></table>
                         </td>
                         <td class='filter_td' style='padding-left:5px;'>
-                            &vandelay.results.per.page; 
-                            <select style='width:68px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
-                                <option value='10'>10</option>
-                                <option value='20'>20</option>
-                                <option value='50'>50</option>
-                                <option value='100'>100</option>
-                            </select>
+                            <div class='nav_row_div'>&vandelay.results.per.page;</div>
+                            <div class='nav_row_div'>
+                                <select style='width:68px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
+                                    <option value='10'>10</option>
+                                    <option value='20'>20</option>
+                                    <option value='50'>50</option>
+                                    <option value='100'>100</option>
+                                </select>
+                            </div>
                         </td>
                         <td class='filter_td' style='padding-left:5px;'>
-                            &vandelay.page; <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+                            <div class='nav_row_div'>&vandelay.page;</div>
+                            <div class='nav_row_div'>
+                                <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+                            </div>
                         </td>
                         <td style='padding-left:5px;'>
                             <button dojoType='dijit.form.Button' 
index 2516d6e..f42d9f4 100644 (file)
@@ -6,6 +6,7 @@ html,body { width:100%; height:100%; border:0; margin:0; padding:0; }
 table { border-collapse: collapse; }
 table.dijitTooltipTable { border-collapse: separate; }
 .form_table td { padding: 6px; }
+.small_form_table td { padding: 1px; }
 .match_div {
     height: 95%;
     width: 95%;
@@ -30,3 +31,4 @@ table.dijitTooltipTable { border-collapse: separate; }
 }
 
 .export_tr_border td { border-top: 1px solid #808080; }
+.nav_row_div {padding:1px; text-align:center; }
index ca02597..b7a32f7 100644 (file)
@@ -74,7 +74,7 @@ var allUserBibQueues;
 var allUserAuthQueues;
 var selectableGridRecords;
 var cgi = new openils.CGI();
-var vlQueueGridColumePicker;
+var vlQueueGridColumePicker = {};
 
 /**
   * Grab initial data
@@ -289,20 +289,21 @@ function retrieveQueuedRecords(type, queueId, onload) {
     var limit = parseInt(vlQueueDisplayLimit.getValue());
     var offset = limit * parseInt(vlQueueDisplayPage.getValue()-1);
 
+    var params =  [authtoken, queueId, {clear_marc: 1, offset: offset, limit: limit}];
+    if(vlQueueGridShowNonImport.checked)
+        params[2].non_imported = 1;
+
     fieldmapper.standardRequest(
         ['open-ils.vandelay', method],
         {   async: true,
-            params: [authtoken, queueId, 
-                {   clear_marc: 1, 
-                    offset: offset,
-                    limit: limit
-                }
-            ],
-            /* intermittent bug in streaming, multipart requests prevents use of onreponse for now...
+            params: params,
+            /*
             onresponse: function(r) {
+                console.log("ONREPONSE");
                 var rec = r.recv().content();
                 if(e = openils.Event.parse(rec))
                     return alert(e);
+                console.log("got record " + rec.id());
                 queuedRecords.push(rec);
                 queuedRecordsMap[rec.id()] = rec;
             },
@@ -465,7 +466,7 @@ function getRecAttrDefFromAttr(attr, type) {
 }
 
 function getRecAttrFromCode(rec, attrCode) {
-    var defId = attrDefMap[attrCode];
+    var defId = attrDefMap[currentType][attrCode];
     var attrs = rec.attributes();
     for(var i = 0; i < attrs.length; i++) {
         var attr = attrs[i];
@@ -565,17 +566,18 @@ function vlHandleOverlayTargetSelected(recId, gridId) {
     }
 }
 
-var vlQueueGridBuilt = false;
+var valLastQueueType = null;
 function buildRecordGrid(type) {
     displayGlobalDiv('vl-queue-div');
 
-    currentOverlayRecordsMap = {};
-
-    if(!vlQueueGridBuilt) {
+    if(valLastQueueType != type) {
+        valLastQueueType = type;
+        resetVlQueueGridLayout();
         var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
+        attrDefMap[type] = {};
         for(var i = 0; i < defs.length; i++) {
             var def = defs[i]
-            attrDefMap[def.code()] = def.id();
+            attrDefMap[type][def.code()] = def.id();
             var col = {
                 name:def.description(), 
                 field:'attr.' + def.code(),
@@ -584,7 +586,6 @@ function buildRecordGrid(type) {
             };
             vlQueueGridLayout[0].cells[0].push(col);
         }
-        vlQueueGridBuilt = true;
     }
 
     var storeData;
@@ -598,13 +599,14 @@ function buildRecordGrid(type) {
         null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
     vlQueueGrid.setModel(model);
 
-    if(vlQueueGridColumePicker) {
+
+    if(vlQueueGridColumePicker[type]) {
         vlQueueGrid.update();
     } else {
-        vlQueueGridColumePicker = 
+        vlQueueGridColumePicker[type] = 
             new openils.GridColumnPicker(vlQueueGridColumePickerDialog, 
-                vlQueueGrid, vlQueueGridLayout, authtoken, 'vandelay.queue');
-        vlQueueGridColumePicker.load();
+                vlQueueGrid, vlQueueGridLayout, authtoken, 'vandelay.queue.'+type);
+        vlQueueGridColumePicker[type].load();
     }
 }
 
@@ -661,8 +663,31 @@ function vlToggleQueueGridSelect() {
 
 var handleRetrieveRecords = function() {
     buildRecordGrid(currentType);
+    vlFetchQueueSummary(currentQueueId, currentType, 
+        function(summary) {
+            dojo.byId('vl-queue-summary-name').innerHTML = summary.queue.name();
+            dojo.byId('vl-queue-summary-total-count').innerHTML = summary.total +'';
+            dojo.byId('vl-queue-summary-import-count').innerHTML = summary.imported + '';
+        }
+    );
 }
 
+function vlFetchQueueSummary(qId, type, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.summary.retrieve'],
+        {   async: true,
+            params: [authtoken, qId],
+            oncomplete : function(r) {
+                var summary = r.recv().content();
+                if(e = openils.Event.parse(summary))
+                    return alert(e);
+                return onload(summary);
+            }
+        }
+    );
+}
+    
+
 function vlImportSelectedRecords() {
     displayGlobalDiv('vl-generic-progress-with-total');
     var records = [];
@@ -684,15 +709,21 @@ function vlImportSelectedRecords() {
                 var resp = r.recv().content();
                 if(e = openils.Event.parse(resp))
                     return alert(e);
-                vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
-            },
-            oncomplete: function() {
-                return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-            }
+                if(resp.complete) {
+                    return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+                } else {
+                    vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+                }
+            }, 
         }
     );
 }
 
+function vlImportAllRecords() {
+    vlImportRecordQueue(currentType, currentQueueId, false,
+        function(){displayGlobalDiv('vl-queue-div');});
+}
+
 function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
     displayGlobalDiv('vl-generic-progress-with-total');
     var method = 'open-ils.vandelay.bib_queue.import';
index 7de894d..dbbfa63 100644 (file)
@@ -22,7 +22,7 @@
     <head>
         <title>&vandelay.vandelay;</title>
         <link type='text/css' rel='stylesheet' href="/vandelay/vandelay.css"/>
-        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
+        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='/js/dojo/openils/MarcXPathParser.js'></script>
         <script type="text/javascript" src='/vandelay/vandelay.js'></script>
     </head>