show item import error counts and rec import error as link to error page; initial...
authorberick <berick@esilibrary.com>
Mon, 25 Apr 2011 15:02:55 +0000 (11:02 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Jul 2011 18:50:50 +0000 (14:50 -0400)
Open-ILS/web/js/ui/default/vandelay/vandelay.js
Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/vandelay/vandelay.tt2

index 7eece79..68eeb0e 100644 (file)
@@ -57,7 +57,8 @@ var globalDivs = [
     'vl-attr-editor-div',
     'vl-marc-export-div',
     'vl-profile-editor-div',
-    'vl-item-attr-editor-div'
+    'vl-item-attr-editor-div',
+    'vl-import-error-div'
 ];
 
 var authtoken;
@@ -587,12 +588,39 @@ 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/>'; // XXX I18N
+        links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');"><b>Record</b></a><br/>'; // TODO I18N
     if(Number(count))
-        links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');"><b>Items ('+count+')</b></a>'; // XXX I18N
+        links += '<a href="javascript:void(0);" onclick="vlLoadErrorUI(' + id + ');">Items ('+count+')</a>'; // TODO I18N
     return links;
 }
 
+//var vlItemErrorColumnPicker;
+function vlLoadErrorUI(id) {
+
+    displayGlobalDiv('vl-import-error-div');
+    openils.Util.show('vl-import-error-grid-some');
+    openils.Util.hide('vl-import-error-grid-all');
+
+    var rec = queuedRecordsMap[id];
+
+    /* TODO: show record attrs and whether it failed import */
+
+    var errorItems = rec.import_items().filter(function(i) {return i.import_error()});
+    if(errorItems) {
+        storeData = vqbr.toStoreData(errorItems);
+        var store = new dojo.data.ItemFileReadStore({data:storeData});
+        vlImportErrorGrid.setStore(store);
+        vlImportErrorGrid.update();
+    }
+}
+
+function vlGetOrg(rowIdx, item) {
+    if(!item) return '';
+    var value = this.grid.store.getValue(item, this.field);
+    if(value) return fieldmapper.aou.findOrgUnit(value).shortname();
+    return '';
+}
+
 function vlFormatViewMatchMARC(id) {
     return '<a href="javascript:void(0);" onclick="vlLoadMARCHtml(' + id + ', true, '+
         'function(){displayGlobalDiv(\'vl-match-div\');});">' + this.name + '</a>';
diff --git a/Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2 b/Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2
new file mode 100644 (file)
index 0000000..5490133
--- /dev/null
@@ -0,0 +1,45 @@
+<h1>Import Errors</h1><br/>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+    <button dojoType='dijit.form.Button' 
+        onclick="displayGlobalDiv('vl-queue-div');">&#x2196; &vandelay.back.to.import.queue;</button>
+</div>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
+    <table id='import-error-table'>
+    </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>
+<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>
+
index 2e2a2e0..4ca2f37 100644 (file)
@@ -40,6 +40,9 @@
 <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-item-attr-editor-div' class='hidden content'>
     [% INCLUDE 'default/vandelay/inc/item_attrs.tt2' %]
 </div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-import-error-div' class='hidden content'>
+    [% INCLUDE 'default/vandelay/inc/import_errors.tt2' %]
+</div>
 
 
 [% END %]