[open-ils-commits] r10780 - in trunk/Open-ILS/web/vandelay: . inc
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Oct 7 10:48:13 EDT 2008
Author: erickson
Date: 2008-10-07 10:48:11 -0400 (Tue, 07 Oct 2008)
New Revision: 10780
Modified:
trunk/Open-ILS/web/vandelay/inc/matches.xml
trunk/Open-ILS/web/vandelay/vandelay.js
Log:
fixed bugs in displaying multiple matches on the same destionation record. fixed bugs in choosing overlay target and persisting chosen selection
Modified: trunk/Open-ILS/web/vandelay/inc/matches.xml
===================================================================
--- trunk/Open-ILS/web/vandelay/inc/matches.xml 2008-10-07 14:39:00 UTC (rev 10779)
+++ trunk/Open-ILS/web/vandelay/inc/matches.xml 2008-10-07 14:48:11 UTC (rev 10780)
@@ -7,8 +7,8 @@
{
name: '&vandelay.overlay.target;',
get: vlGetOverlayTargetSelector,
- value: '<input type="radio" name="overlay_target" '+
- 'onclick="vlHandleOverlayTargetSelected();" id="vl-overlay-target-ID"/>'
+ value: '<input type="checkbox" name="vl-overlay-target-RECID" '+
+ 'onclick="vlHandleOverlayTargetSelected(ID, GRIDID);" gridid="GRIDID" match="ID"/>'
},
{name:'&vandelay.source.match.point;', field:'src_matchpoint'},
{name:'&vandelay.dest.match.point;', field:'dest_matchpoint'},
@@ -32,10 +32,6 @@
<div>
<button dojoType='dijit.form.Button'
onclick="displayGlobalDiv('vl-queue-div');">↖ &vandelay.back.to.import.queue;</button>
- <span style='padding-left:20px;'>
- <input dojoType='dijit.form.CheckBox' jsId='vlOverlayTargetEnable' onclick='vlHandleOverlayTargetSelected'/>
- &vandelay.overlay.selected.record;
- </span>
</div>
<div class='tall'>
<div dojoType='dojox.Grid' jsId='vlMatchGrid'> </div>
Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js 2008-10-07 14:39:00 UTC (rev 10779)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2008-10-07 14:48:11 UTC (rev 10780)
@@ -65,6 +65,7 @@
var userCache = {};
var currentMatchedRecords; // set of loaded matched bib records
var currentOverlayRecordsMap; // map of import record to overlay record
+var currentOverlayRecordsMapGid; // map of import record to overlay record grid id
var currentImportRecId; // when analyzing matches, this is the current import record
var userBibQueues = []; // only non-complete queues
var userAuthQueues = []; // only non-complete queues
@@ -274,6 +275,7 @@
queuedRecords = [];
queuedRecordsMap = {};
currentOverlayRecordsMap = {};
+ currentOverlayRecordsMapGid = {};
selectableGridRecords = {};
resetVlQueueGridLayout();
@@ -317,10 +319,8 @@
);
}
-//function vlLoadMatchUI(recId, attrCode) {
function vlLoadMatchUI(recId) {
displayGlobalDiv('vl-generic-progress');
- //var matches = getRecMatchesFromAttrCode(queuedRecordsMap[recId], attrCode);
var matches = queuedRecordsMap[recId].matches();
var records = [];
currentImportRecId = recId;
@@ -347,24 +347,27 @@
displayGlobalDiv('vl-match-div');
resetVlMatchGridLayout();
currentMatchedRecords = recs;
- vlMatchGrid.setStructure(vlMatchGridLayout);
+ if(!vlMatchGrid.structure)
+ vlMatchGrid.setStructure(vlMatchGridLayout);
// build the data store of records with match information
var dataStore = bre.toStoreData(recs, null,
{virtualFields:['dest_matchpoint', 'src_matchpoint', '_id']});
dataStore.identifier = '_id';
+ var matchSeenMap = {};
for(var i = 0; i < dataStore.items.length; i++) {
var item = dataStore.items[i];
item._id = i; // just need something unique
for(var j = 0; j < matches.length; j++) {
var match = matches[j];
- if(match.eg_record() == item.id) {
+ if(match.eg_record() == item.id && !matchSeenMap[match.id()]) {
item.dest_matchpoint = match.field_type();
var attr = getRecAttrFromMatch(queuedRecordsMap[recId], match);
- //item.src_matchpoint = getRecAttrDefFromAttr(attr, currentType).description();
item.src_matchpoint = getRecAttrDefFromAttr(attr, currentType).code();
+ matchSeenMap[match.id()] = 1;
+ break;
}
}
}
@@ -517,10 +520,11 @@
function vlGetOverlayTargetSelector(rowIdx) {
data = this.grid.model.getRow(rowIdx);
if(data) {
- var value = this.value.replace('ID', data.id);
- var overlay = currentOverlayRecordsMap[currentImportRecId];
- if(overlay && overlay == data.id)
- value = value.replace('/>', 'checked="checked"/>');
+ var value = this.value.replace(/GRIDID/g, data._id);
+ value = value.replace(/RECID/g, currentImportRecId);
+ value = value.replace(/ID/g, data.id);
+ if(data._id == currentOverlayRecordsMapGid[currentImportRecId])
+ return value.replace('/>', 'checked="checked"/>');
return value;
}
}
@@ -529,21 +533,31 @@
* see if the user has enabled overlays for the current match set and,
* if so, map the current import record to the overlay target.
*/
-function vlHandleOverlayTargetSelected() {
- if(vlOverlayTargetEnable.checked) {
- for(var i = 0; i < currentMatchedRecords.length; i++) {
- var matchRecId = currentMatchedRecords[i].id();
- if(dojo.byId('vl-overlay-target-'+matchRecId).checked) {
- console.log("found overlay target " + matchRecId);
+function vlHandleOverlayTargetSelected(recId, gridId) {
+ var noneSelected = true;
+ var checkboxes = dojo.query('[name=vl-overlay-target-'+currentImportRecId+']');
+ for(var i = 0; i < checkboxes.length; i++) {
+ var checkbox = checkboxes[i];
+ var matchRecId = checkbox.getAttribute('match');
+ var gid = checkbox.getAttribute('gridid');
+ if(checkbox.checked) {
+ if(matchRecId == recId && gid == gridId) {
+ noneSelected = false;
currentOverlayRecordsMap[currentImportRecId] = matchRecId;
+ currentOverlayRecordsMapGid[currentImportRecId] = gid;
dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = true;
dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = 'overlay_selected';
- return;
+ } else {
+ checkbox.checked = false;
}
}
- } else {
+ }
+
+ if(noneSelected) {
delete currentOverlayRecordsMap[currentImportRecId];
+ delete currentOverlayRecordsMapGid[currentImportRecId];
dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = false;
+ dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = '';
}
}
More information about the open-ils-commits
mailing list