initial export drop-down for items UI
authorberick <berick@esilibrary.com>
Fri, 6 May 2011 19:37:32 +0000 (15:37 -0400)
committerberick <berick@esilibrary.com>
Fri, 6 May 2011 19:37:32 +0000 (15:37 -0400)
Open-ILS/web/js/ui/default/vandelay/vandelay.js
Open-ILS/web/templates/default/vandelay/inc/import_errors.tt2

index 193056c..d2405cc 100644 (file)
@@ -377,6 +377,8 @@ function processSpool(key, queueId, type, onload) {
 }
 
 function vlExportInit() {
+
+    // queue export
     var qsel = dojo.byId('vl-queue-export-options');
     qsel.onchange = function(newVal) {
         var value = qsel.options[qsel.selectedIndex].value;
@@ -386,10 +388,37 @@ function vlExportInit() {
         retrieveQueuedRecords(
             currentType, 
             currentQueueId, 
-            function(r) { exportHandler(value, r) },
+            function(r) { 
+                exportHandler(value, r);
+                displayGlobalDiv('vl-queue-div');
+            },
             value
         );
     }
+
+    // item export
+    var isel = dojo.byId('vl-item-export-options');
+    isel.onchange = function(newVal) {
+        var value = isel.options[isel.selectedIndex].value;
+        isel.selectedIndex = 0;
+        if(!value) return;
+        if(!confirm('Export as "' + value + '"?')) return; // TODO: i18n
+
+        var method = 'open-ils.vandelay.import_item.queue.export.' + value;
+
+        fieldmapper.standardRequest(
+            ['open-ils.vandelay', method],
+            {
+                params : [
+                    authtoken, 
+                    currentQueueId, 
+                    {with_import_error: (vlImportItemsShowErrors.checked) ? 1 : null}
+                ],
+                async : true,
+                oncomplete : function(r) {exportHandler(type, r)}
+            }
+        );
+    }
 }
 
 function exportHandler(type, response) {
index f72630b..5554f00 100644 (file)
         <h1>Import Items</h1><br/>
         <input dojoType='dijit.form.CheckBox' jsId='vlImportItemsShowErrors' onchange='vlLoadErrorUIAll();'/>
         <span>Limit to Import Failures</span>
+        <table width='100%'><tr><td width='100%' align='right'>
+            <select id='vl-item-export-options' style='margin-right: 10px;'>
+                <!-- TODO I18N -->
+                <option value=''>Export Items As...</option>
+                <option value='print'>Print</option>
+                <option value='csv'>CSV</option>
+                <option value='email'>Email</option>
+            </select>
+        </td></tr></table>
         <table  jsId="vlAllImportErrorGrid"
                 dojoType="openils.widget.AutoGrid"
                 autoHeight='true'