show rec summary and import failure reason when appropriate
authorberick <berick@esilibrary.com>
Mon, 25 Apr 2011 15:38:52 +0000 (11:38 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Jul 2011 18:50:50 +0000 (14:50 -0400)
Open-ILS/web/css/skin/default/vandelay.css
Open-ILS/web/js/ui/default/vandelay/vandelay.js
Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2

index d60ba06..7476377 100644 (file)
@@ -28,3 +28,9 @@ table.dijitTooltipTable { border-collapse: separate; }
 .export_tr_border td { border-top: 1px solid #808080; }
 .nav_row_div {padding:1px; text-align:center; }
 .toolbar_selected { border: 2px dashed #808080; text-decoration:underline; font-weight:bold;}
+
+#vl-import-error-record { margin: 10px; }
+#vl-import-error-record tr:nth-child(even) {background: #EEE}
+#vl-import-error-record td:first-child { text-decoration: underline; }
+#vl-import-error-record td { padding: 5px; }
+#vl-error-import-error { font-weight: bold; }
index 68eeb0e..344f2ec 100644 (file)
@@ -588,7 +588,7 @@ function vlFormatViewErrors(chunk) {
     var count = chunk.split(':')[2];
     var links = '';
     if(rec) 
-        links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');"><b>Record</b></a><br/>'; // TODO I18N
+        links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');">Record</a><br/>'; // TODO I18N
     if(Number(count))
         links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');">Items ('+count+')</a>'; // TODO I18N
     return links;
@@ -598,15 +598,31 @@ function vlFormatViewErrors(chunk) {
 function vlLoadErrorUI(id) {
 
     displayGlobalDiv('vl-import-error-div');
-    openils.Util.show('vl-import-error-grid-some');
     openils.Util.hide('vl-import-error-grid-all');
+    openils.Util.show('vl-import-error-record');
 
     var rec = queuedRecordsMap[id];
 
-    /* TODO: show record attrs and whether it failed import */
+    dojo.byId('vl-error-id').innerHTML = rec.id();
+    dojo.forEach( // TODO sane authority rec. fields
+        ['title', 'author', 'isbn', 'issn', 'upc'],
+        function(field) {
+            var attr =  getRecAttrFromCode(rec, field);
+            var eid = 'vl-error-' + field;
+            if(attr) {
+                openils.Util.show(dojo.byId(eid).parentNode, 'table-row');
+                dojo.byId(eid).innerHTML = attr.attr_value();
+            } else {
+                openils.Util.hide(dojo.byId(eid).parentNode);
+            }
+        }
+    )
+    dojo.byId('vl-error-import-error').innerHTML = rec.import_error();
+    dojo.byId('vl-error-error-detail').innerHTML = rec.error_detail();
 
     var errorItems = rec.import_items().filter(function(i) {return i.import_error()});
-    if(errorItems) {
+    if(errorItems.length) {
+        openils.Util.show('vl-import-error-grid-some');
         storeData = vqbr.toStoreData(errorItems);
         var store = new dojo.data.ItemFileReadStore({data:storeData});
         vlImportErrorGrid.setStore(store);
index 5490133..6b08db4 100644 (file)
@@ -6,40 +6,56 @@
 </div>
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
-    <table id='import-error-table'>
+    <table id='vl-import-error-record' class='hidden'>
+        <tbody>
+            <tr><td>ID</td><td id='vl-error-id'/></tr>
+            <tr><td>Import Error</td><td id='vl-error-import-error'/></tr>
+            <tr><td>Error Detail</td><td id='vl-error-error-detail'/></tr>
+            <tr><td>Title</td><td id='vl-error-title'/></tr>
+            <tr><td>Author</td><td id='vl-error-author'/></tr>
+            <tr><td>ISBN</td><td id='vl-error-isbn'/></tr>
+            <tr><td>ISSN</td><td id='vl-error-issn'/></tr>
+            <tr><td>UPC</td><td id='vl-error-upc'/></tr>
+        </tbody>
     </table>
 </div>
 
-<div dojoType="dijit.layout.ContentPane" layoutAlign='client' class='hidden' id='vl-import-error-grid-some'>
-    <table  jsId="vlImportErrorGrid"
-            dojoType="openils.widget.AutoGrid"
-            autoHeight='true'
-            fieldOrder="['barcode', 'call_number', 'owning_lib', 'import_error', 'error_detail']"
-            query="{id: '*'}"
-            hidePaginator='true'
-            showColumnPicker='true'
-            columnPickerPrefix='"vandelay.item.import_error"'
-            fmClass='vii'>
-            <thead>
-                <th field='owning_lib' get='vlGetOrg'/>
-                <th field='circ_lib' get='vlGetOrg'/>
-            </thead>
-    </table>
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+    <div class='hidden' id='vl-import-error-grid-some'>
+        <h3>Item Import Errors</h3>
+        <table  jsId="vlImportErrorGrid"
+                dojoType="openils.widget.AutoGrid"
+                autoHeight='true'
+                fieldOrder="['barcode', 'call_number', 'owning_lib', 'import_error', 'error_detail']"
+                query="{id: '*'}"
+                hidePaginator='true'
+                showColumnPicker='true'
+                columnPickerPrefix='"vandelay.item.import_error"'
+                fmClass='vii'>
+                <thead>
+                    <th field='owning_lib' get='vlGetOrg'/>
+                    <th field='circ_lib' get='vlGetOrg'/>
+                </thead>
+        </table>
+    </div>
 </div>
-<div dojoType="dijit.layout.ContentPane" layoutAlign='client' class='hidden' id='vl-import-error-grid-all'>
-    <table  jsId="vlAllImportErrorGrid"
-            dojoType="openils.widget.AutoGrid"
-            autoHeight='true'
-            fieldOrder="['barcode', 'call_number', 'owning_lib', 'import_error', 'error_detail']"
-            query="{id: '*'}"
-            showPaginator='true'
-            showColumnPicker='true'
-            columnPickerPrefix='"vandelay.item.import_error"'
-            fmClass='vii'>
-            <thead>
-                <th field='owning_lib' get='vlGetOrg'/>
-                <th field='circ_lib' get='vlGetOrg'/>
-            </thead>
-    </table>
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+    <div class='hidden' id='vl-import-error-grid-all'>
+        <h3>Item Import Errors</h3>
+        <table  jsId="vlAllImportErrorGrid"
+                dojoType="openils.widget.AutoGrid"
+                autoHeight='true'
+                fieldOrder="['barcode', 'call_number', 'owning_lib', 'import_error', 'error_detail']"
+                query="{id: '*'}"
+                showPaginator='true'
+                showColumnPicker='true'
+                columnPickerPrefix='"vandelay.item.import_error"'
+                fmClass='vii'>
+                <thead>
+                    <th field='owning_lib' get='vlGetOrg'/>
+                    <th field='circ_lib' get='vlGetOrg'/>
+                </thead>
+        </table>
+    </div>
 </div>