added upload-to-existing-queue. styling records to overlay slightly differently
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Sep 2008 20:38:58 +0000 (20:38 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Sep 2008 20:38:58 +0000 (20:38 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10551 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/vandelay/vandelay.html
Open-ILS/web/vandelay/vandelay.js

index bf0b5bb..7151fe3 100644 (file)
                 text-align:center;
                 margin: 20px;
             }
+            .overlay_selected { 
+                padding: 2px; 
+                background: #d9e8f9;
+                border: 1px solid red; 
+            }
         </style>
-        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
+        <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
         <script type="text/javascript" src='vandelay.js'></script>
     </head>
     <body class="tundra tall">
-
         <div dojoType="dijit.Toolbar" id='toolbar'>
             <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" 
                 onclick='displayGlobalDiv("vl-marc-upload-div");' showLabel="true">Import Records</div>
         </div>
 
         <div id="vl-generic-progress" class='progress'>
-            <div dojoType="dijit.ProgressBar" style="width:200px" indeterminate="true"></div>
+            <div dojoType="dijit.ProgressBar" style="width:300px" indeterminate="true"></div>
         </div>
         <div id="vl-generic-progress-with-total" class='hidden progress'>
-            <div dojoType="dijit.ProgressBar" jsId='vlControlledProgressBar' style="width:200px"></div>
+            <div dojoType="dijit.ProgressBar" jsId='vlControlledProgressBar' style="width:300px"></div>
         </div>
 
         <!-- MARC upload form -->
                 <br/>
                 <table>
                     <tr>
-                        <td>Queue Name</td>
-                        <td>
-                            <input type='text' dojoType='dijit.form.TextBox' id='vl-queue-name' size='32'></input>
+                        <td>Record Type</td>
+                        <td colspan='4'>
+                            <select id='vl-record-type' dojoType='dijit.form.FilteringSelect' 
+                                    jsId='vlUploadRecordType' onchange='vlShowUploadForm();'>
+                                <option value='bib' selected='selected'>Bibliographic Records</option>
+                                <option value='auth'>Authority Records</option>
+                            </select>
                         </td>
                     </tr>
                     <tr>
-                        <td>Record Type</td>
+                        <td>Create a Upload New Queue</td>
                         <td>
-                            <select id='vl-record-type' dojoType='dijit.form.FilteringSelect'>
-                                <option value='bib'>Bibliographic Records</option>
-                                <option value='auth'>Authority Records</option>
+                            <input type='text' dojoType='dijit.form.TextBox' id='vl-queue-name' size='32'></input>
+                        </td>
+                        <td>or Add to an Existing Queue</td>
+                        <td>
+                            <select jsId='vlUploadQueueSelector' dojoType='dijit.form.FilteringSelect'>
                             </select>
                         </td>
                     </tr>
                     <tr>
                         <td>Purpose</td>
-                        <td>
+                        <td colspan='4'>
                             <select name='purpose' dojoType='dijit.form.FilteringSelect'>
                                 <option value='import'>Import</option>
                                 <option value='overlay'>Overlay</option>
                             <span id="vl-file-label">File to Upload:</span>
                             <span id="vl-file-uploading" class='hidden'>Uploading...</span>
                         </td>
-                        <td id='vl-input-td'>
+                        <td id='vl-input-td' colspan='4'>
                             <input size='48' type="file" name="marc_upload"/>
                         </td>
                     </tr>
                     <tr>
-                        <td colspan='2'>
+                        <td colspan='4'>
                             <span id="vl-upload-progress-span" class='hidden'>
                                 <div dojoType="dijit.ProgressBar" style="width:200px" indeterminate="true"></div>
                             </span>
                         </td>
                     </tr>
                     <tr>
-                        <td colspan='2' align='center'>
+                        <td align='center' colspan='4'>
                             <button dojoType="dijit.form.Button" onclick="batchUpload()">Upload</button>
                         </td>
                     </tr>
                 <tr>
                     <td>Queue Type</td>
                     <td>
-                        <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='alert(1);'>
+                        <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='vlShowQueueSelect();'>
                             <option value='bib' selected='selected'>Bibliographic Records</option>
                             <option value='auth'>Authority Records</option>
                         </select>
index 265304a..8f9596d 100644 (file)
@@ -50,7 +50,6 @@ var bibAttrsFetched = false;
 var authAttrsFetched = false;
 var attrDefMap = {}; // maps attr def code names to attr def ids
 var currentType;
-var cgi = new openils.CGI();
 var currentQueueId = null;
 var userCache = {};
 var currentMatchedRecords; // set of loaded matched bib records
@@ -59,6 +58,7 @@ var currentImportRecId; // when analyzing matches, this is the current import re
 var userBibQueues;
 var userAuthQueues;
 var selectableGridRecords;
+var cgi = new openils.CGI();
 
 /**
   * Grab initial data
@@ -166,7 +166,7 @@ function runStartupCommands() {
     currentType = cgi.param('qtype');
     if(currentQueueId)
         return retrievenueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-    displayGlobalDiv('vl-marc-upload-div');
+    vlShowUploadForm();
 }
 
 /**
@@ -234,6 +234,7 @@ function processSpool(key, queueId, type, onload) {
 }
 
 function retrieveQueuedRecords(type, queueId, onload) {
+    displayGlobalDiv('vl-generic-progress');
     queuedRecords = [];
     queuedRecordsMap = {};
     currentOverlayRecordsMap = {};
@@ -424,6 +425,7 @@ function vlHandleOverlayTargetSelected() {
                 console.log("found overlay target " + matchRecId);
                 currentOverlayRecordsMap[currentImportRecId] = matchRecId;
                 dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = true;
+                dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = 'overlay_selected';
                 return;
             }
         }
@@ -494,7 +496,7 @@ function vlQueueGridDrawSelectBox(rowIdx) {
     if(!data) return '';
     var domId = 'vl-record-list-selected-' +data.id;
     selectableGridRecords[domId] = data.id;
-    return "<input type='checkbox' id='"+domId+"'/>";
+    return "<div><input type='checkbox' id='"+domId+"'/></div>";
 }
 
 function vlSelectAllGridRecords() {
@@ -563,21 +565,34 @@ function batchUpload() {
         currentQueueId = queue.id();
         uploadMARC(handleUploadMARC);
     };
-
-    createQueue(queueName, currentType, handleCreateQueue);
+    
+    if(vlUploadQueueSelector.getValue() && !queueName) {
+        currentQueueId = vlUploadQueueSelector.getValue();
+        console.log('adding records to existing queue ' + currentQueueId);
+        uploadMARC(handleUploadMARC);
+    } else {
+        createQueue(queueName, currentType, handleCreateQueue);
+    }
 }
 
 
 function vlFleshQueueSelect(selector, type) {
     var data = (type == 'bib') ? vbq.toStoreData(userBibQueues) : vaq.toStoreData(userAuthQueues);
     selector.store = new dojo.data.ItemFileReadStore({data:data});
+    selector.setValue(null);
+    selector.setDisplayedValue('');
     if(data[0])
         selector.setValue(data[0].id());
 }
 
+function vlShowUploadForm() {
+    displayGlobalDiv('vl-marc-upload-div');
+    vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue());
+}
+
 function vlShowQueueSelect() {
     displayGlobalDiv('vl-queue-select-div');
-    vlFleshQueueSelect(vlQueueSelectQueueList, 'bib');
+    vlFleshQueueSelect(vlQueueSelectQueueList, vlQueueSelectType.getValue());
 }
 
 function vlFetchQueueFromForm() {
@@ -585,6 +600,5 @@ function vlFetchQueueFromForm() {
     currentQueueId = vlQueueSelectQueueList.getValue();
     retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
 }
-    
 
 dojo.addOnLoad(vlInit);