[open-ils-commits] r10548 - trunk/Open-ILS/web/vandelay
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Sep 5 13:39:48 EDT 2008
Author: erickson
Date: 2008-09-05 13:39:45 -0400 (Fri, 05 Sep 2008)
New Revision: 10548
Modified:
trunk/Open-ILS/web/vandelay/vandelay.html
trunk/Open-ILS/web/vandelay/vandelay.js
Log:
added a toolbar for choosing interfaces. added a queue picker interface to pick a queue to view
Modified: trunk/Open-ILS/web/vandelay/vandelay.html
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-05 17:38:47 UTC (rev 10547)
+++ trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-05 17:39:45 UTC (rev 10548)
@@ -34,15 +34,30 @@
}
.tall { height:100%; }
.hidden { display: none; }
+ #toolbar { margin-top: 0px; }
+ body { width:100%; height:100%; border:0; margin:0; padding:0; }
+ .progress {
+ width:100%;
+ text-align:center;
+ margin: 20px;
+ }
</style>
<script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
<script type="text/javascript" src='vandelay.js'></script>
</head>
- <body class="tundra" class='tall'>
- <div id="vl-generic-progress" style='width:100%;text-align:center'>
+ <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 dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"
+ onclick='vlShowQueueSelect();' showLabel="true">Inspect Queue</div>
+ </div>
+
+ <div id="vl-generic-progress" class='progress'>
<div dojoType="dijit.ProgressBar" style="width:200px" indeterminate="true"></div>
</div>
- <div id="vl-generic-progress-with-total" class='hidden' style='width:100%;text-align:center;'>
+ <div id="vl-generic-progress-with-total" class='hidden progress'>
<div dojoType="dijit.ProgressBar" jsId='vlControlledProgressBar' style="width:200px"></div>
</div>
@@ -51,7 +66,7 @@
<h1>Evergreen MARC File Upload</h1><br/>
<form id="vl-marc-upload-form" enctype="multipart/form-data">
<input type='hidden' name='ses' id='vl-ses-input'/>
- <br>
+ <br/>
<table>
<tr>
<td>Queue Name</td>
@@ -79,11 +94,11 @@
</tr>
<tr>
<td>
- <span id="vl-file-label">File to Upload:</span><br>
- <span id="vl-file-uploading" class='hidden'>Uploading...</span><br>
+ <span id="vl-file-label">File to Upload:</span>
+ <span id="vl-file-uploading" class='hidden'>Uploading...</span>
</td>
<td id='vl-input-td'>
- <input size='48' type="file" name="marc_upload">
+ <input size='48' type="file" name="marc_upload"/>
</td>
</tr>
<tr>
@@ -105,6 +120,7 @@
<!-- record queue grid -->
<div id='vl-queue-div' class='tall hidden'>
<h1>Record Queue</h1><br/>
+ <div id='vl-queue-no-records' class='hidden'><h2>There are no records in the selected queue</h2></div>
<script>
var vlQueueGridLayout;
function resetVlQueueGridLayout() {
@@ -117,11 +133,13 @@
}];
}
</script>
- <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords();'>Select All</button>
- <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords();'>Select None</button>
- <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>Import Selected</button>
- <div class='tall'>
- <div dojoType='dojox.Grid' jsId='vlQueueGrid'> </div>
+ <div id='vl-queue-div-grid' class='tall'>
+ <button dojoType='dijit.form.Button' onclick='vlSelectAllGridRecords();'>Select All</button>
+ <button dojoType='dijit.form.Button' onclick='vlSelectNoGridRecords();'>Select None</button>
+ <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>Import Selected</button>
+ <div class='tall'>
+ <div dojoType='dojox.Grid' jsId='vlQueueGrid' class='tall'> </div>
+ </div>
</div>
</div>
@@ -154,7 +172,7 @@
}];
}
</script>
- <h1>Import Matches</h1></br>
+ <h1>Import Matches</h1><br/>
<div>
<button dojoType='dijit.form.Button'
onclick='displayGlobalDiv("vl-queue-div");'>Back To Import Queue...</button>
@@ -168,7 +186,6 @@
</div>
</div>
-
<!-- MARC as HTML for matched records -->
<div id='vl-match-html-div' class='tall hidden'>
<h1>MARC Record</h1><br/>
@@ -178,9 +195,36 @@
</div>
<div>
<style>#vl-match-record-html td {padding:0px;}</style>
- <div id='vl-match-record-html'/>
+ <div id='vl-match-record-html'> </div>
</div>
</div>
+ <!-- Form for choosing which queue to view -->
+ <div id='vl-queue-select-div' class='tall hidden'>
+ <h1>Select a Queue to Inspect</h1><br/>
+ <table>
+ <tr>
+ <td>Queue Type</td>
+ <td>
+ <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='alert(1);'>
+ <option value='bib' selected='selected'>Bibliographic Records</option>
+ <option value='auth'>Authority Records</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>Queue</td>
+ <td>
+ <select jsId='vlQueueSelectQueueList' dojoType='dijit.form.FilteringSelect'>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan='2'>
+ <button dojoType='dijit.form.Button' onclick='vlFetchQueueFromForm();'>Retrieve Queue</button>
+ </td>
+ </tr>
+ </table>
+ </div>
</body>
</html>
Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-05 17:38:47 UTC (rev 10547)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-05 17:39:45 UTC (rev 10548)
@@ -36,7 +36,8 @@
'vl-marc-upload-div',
'vl-queue-div',
'vl-match-div',
- 'vl-match-html-div'
+ 'vl-match-html-div',
+ 'vl-queue-select-div'
];
var authtoken;
@@ -55,15 +56,24 @@
var currentMatchedRecords; // set of loaded matched bib records
var currentOverlayRecordsMap; // map of import record to overlay record
var currentImportRecId; // when analyzing matches, this is the current import record
+var userBibQueues;
+var userAuthQueues;
+var selectableGridRecords;
/**
* Grab initial data
*/
function vlInit() {
authtoken = dojo.cookie('ses') || cgi.param('ses');
- bibAttrsFetched = false;
- authAttrsFetched = false;
+ var initNeeded = 4; // how many async responses do we need before we're init'd
+ var initCount = 0; // how many async reponses we've received
+ function checkInitDone() {
+ initCount++;
+ if(initCount == initNeeded)
+ runStartupCommands();
+ }
+
// Fetch the bib and authority attribute definitions
fieldmapper.standardRequest(
['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
@@ -76,7 +86,6 @@
bibAttrDefs.push(def);
},
oncomplete: function() {
- bibAttrsFetched = true;
bibAttrDefs = bibAttrDefs.sort(
function(a, b) {
if(a.id() > b.id()) return 1;
@@ -84,8 +93,7 @@
return 0;
}
);
- if(authAttrsFetched)
- runStartupCommands();
+ checkInitDone();
}
}
);
@@ -101,7 +109,6 @@
authAttrDefs.push(def);
},
oncomplete: function() {
- authAttrsFetched = true;
authAttrDefs = authAttrDefs.sort(
function(a, b) {
if(a.id() > b.id()) return 1;
@@ -109,16 +116,48 @@
return 0;
}
);
- if(bibAttrsFetched)
- runStartupCommands();
+ checkInitDone();
}
}
);
+
+ fieldmapper.standardRequest(
+ ['open-ils.vandelay', 'open-ils.vandelay.bib_queue.owner.retrieve.atomic'],
+ { async: true,
+ params: [authtoken],
+ oncomplete: function(r) {
+ var list = r.recv().content();
+ if(e = openils.Event.parse(list[0]))
+ return alert(e);
+ userBibQueues = list;
+ checkInitDone();
+ }
+ }
+ );
+
+ fieldmapper.standardRequest(
+ ['open-ils.vandelay', 'open-ils.vandelay.authority_queue.owner.retrieve.atomic'],
+ { async: true,
+ params: [authtoken],
+ oncomplete: function(r) {
+ var list = r.recv().content();
+ if(e = openils.Event.parse(list[0]))
+ return alert(e);
+ userAuthQueues = list;
+ checkInitDone();
+ }
+ }
+ );
}
function displayGlobalDiv(id) {
- for(var i = 0; i < globalDivs.length; i++)
- dojo.style(dojo.byId(globalDivs[i]), 'display', 'none');
+ for(var i = 0; i < globalDivs.length; i++) {
+ try {
+ dojo.style(dojo.byId(globalDivs[i]), 'display', 'none');
+ } catch(e) {
+ alert('please define ' + globalDivs[i]);
+ }
+ }
dojo.style(dojo.byId(id),'display','block');
}
@@ -126,7 +165,7 @@
currentQueueId = cgi.param('qid');
currentType = cgi.param('qtype');
if(currentQueueId)
- return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ return retrievenueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
displayGlobalDiv('vl-marc-upload-div');
}
@@ -198,6 +237,7 @@
queuedRecords = [];
queuedRecordsMap = {};
currentOverlayRecordsMap = {};
+ selectableGridRecords = {};
resetVlQueueGridLayout();
fieldmapper.standardRequest(
@@ -326,6 +366,7 @@
var data = this.grid.model.getRow(rowIdx);
if(!data) return '';
var attrCode = this.field.split('.')[1];
+ console.log(attrCode + " : " + data.id + ' : ' + queuedRecordsMap[data.id] + " : count = " + queuedRecords.length);
var rec = queuedRecordsMap[data.id];
var attr = getRecAttrFromCode(rec, attrCode);
if(attr)
@@ -397,6 +438,15 @@
currentOverlayRecordsMap = {};
+ if(queuedRecords.length == 0) {
+ dojo.style(dojo.byId('vl-queue-no-records'), 'display', 'block');
+ dojo.style(dojo.byId('vl-queue-div-grid'), 'display', 'none');
+ return;
+ } else {
+ dojo.style(dojo.byId('vl-queue-no-records'), 'display', 'none');
+ dojo.style(dojo.byId('vl-queue-div-grid'), 'display', 'block');
+ }
+
var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
for(var i = 0; i < defs.length; i++) {
var def = defs[i]
@@ -410,8 +460,6 @@
vlQueueGridLayout[0].cells[0].push(col);
}
- vlQueueGrid.setStructure(vlQueueGridLayout);
-
var storeData;
if(type == 'bib')
storeData = vqbr.toStoreData(queuedRecords);
@@ -423,6 +471,7 @@
null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
vlQueueGrid.setModel(model);
+ vlQueueGrid.setStructure(vlQueueGridLayout);
vlQueueGrid.update();
}
@@ -440,7 +489,6 @@
}
*/
-var selectableGridRecords = {};
function vlQueueGridDrawSelectBox(rowIdx) {
var data = this.grid.model.getRow(rowIdx);
if(!data) return '';
@@ -519,4 +567,24 @@
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});
+ if(data[0])
+ selector.setValue(data[0].id());
+}
+
+function vlShowQueueSelect() {
+ displayGlobalDiv('vl-queue-select-div');
+ vlFleshQueueSelect(vlQueueSelectQueueList, 'bib');
+}
+
+function vlFetchQueueFromForm() {
+ currentType = vlQueueSelectType.getValue();
+ currentQueueId = vlQueueSelectQueueList.getValue();
+ retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+}
+
+
dojo.addOnLoad(vlInit);
More information about the open-ils-commits
mailing list