From f44258e7f54013e6c64f1aeeb617f4b7f016a696 Mon Sep 17 00:00:00 2001 From: berick <berick@esilibrary.com> Date: Mon, 25 Apr 2011 11:02:55 -0400 Subject: [PATCH] show item import error counts and rec import error as link to error page; initial error page --- Open-ILS/web/js/ui/default/vandelay/vandelay.js | 34 ++++++++++++++-- .../default/vandelay/inc/import_errors.tt2 | 45 ++++++++++++++++++++++ .../web/templates/default/vandelay/vandelay.tt2 | 3 ++ 3 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2 diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 7eece794e0..68eeb0efc3 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -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 index 0000000000..549013335e --- /dev/null +++ b/Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2 @@ -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');">↖ &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> + diff --git a/Open-ILS/web/templates/default/vandelay/vandelay.tt2 b/Open-ILS/web/templates/default/vandelay/vandelay.tt2 index 2e2a2e0ab5..4ca2f375db 100644 --- a/Open-ILS/web/templates/default/vandelay/vandelay.tt2 +++ b/Open-ILS/web/templates/default/vandelay/vandelay.tt2 @@ -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 %] -- 2.11.0