[open-ils-commits] r10539 - trunk/Open-ILS/web/vandelay
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 4 13:18:20 EDT 2008
Author: erickson
Date: 2008-09-04 13:18:17 -0400 (Thu, 04 Sep 2008)
New Revision: 10539
Modified:
trunk/Open-ILS/web/vandelay/vandelay.html
trunk/Open-ILS/web/vandelay/vandelay.js
Log:
fixed bug in matching attrs to matches. now showing match field_type in list of matched records. started on ui for picking record to overlay
Modified: trunk/Open-ILS/web/vandelay/vandelay.html
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-04 16:22:08 UTC (rev 10538)
+++ trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-04 17:18:17 UTC (rev 10539)
@@ -35,7 +35,7 @@
.tall { height:100%; }
.hidden { display: none; }
</style>
- <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
+ <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'>
@@ -132,6 +132,12 @@
vlMatchGridLayout = [{
defaultCell: {styles: 'text-align: center;'},
cells : [[
+ {
+ name: 'Overlay Target',
+ get: vlGetOverlayTargetSelector,
+ value: '<input type="radio" name="overlay_target" onclick="vlHandleOverlayTargetSelected" id="vl-overlay-target-ID"/>'
+ },
+ {name:'Match Point', field:'field_type'},
{name: 'ID', field:'id'},
{ name: 'View MARC',
get: vlGetViewMARC,
@@ -151,6 +157,10 @@
<div>
<button dojoType='dijit.form.Button'
onclick='displayGlobalDiv("vl-queue-div");'>Back To Import Queue...</button>
+ <span style='padding-left:20px;'>
+ <input dojoType='dijit.form.CheckBox' jsId='vlOverlayTargetEnable' onclick='vlHandleOverlayTargetSelected'/>
+ Overlay selected record with imported 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-09-04 16:22:08 UTC (rev 10538)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-04 17:18:17 UTC (rev 10539)
@@ -47,11 +47,14 @@
var queuedRecordsMap = {};
var bibAttrsFetched = false;
var authAttrsFetched = false;
-var attrMap = {};
+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
+var currentOverlayRecordsMap; // map of import record to overlay record
+var currentImportRecId; // when analyzing matches, this is the current import record
/**
* Grab initial data
@@ -227,6 +230,7 @@
displayGlobalDiv('vl-generic-progress');
var matches = getRecMatchesFromAttrCode(queuedRecordsMap[recId], attrCode);
var records = [];
+ currentImportRecId = recId;
for(var i = 0; i < matches.length; i++)
records.push(matches[i].eg_record());
fieldmapper.standardRequest(
@@ -239,8 +243,18 @@
return alert(e);
displayGlobalDiv('vl-match-div');
resetVlMatchGridLayout();
+ currentMatchedRecords = recs;
vlMatchGrid.setStructure(vlMatchGridLayout);
- var store = new dojo.data.ItemFileReadStore({data:bre.toStoreData(recs)});
+ var dataStore = bre.toStoreData(recs, null, {virtualFields:['field_type']});
+ for(var i = 0; i < dataStore.items.length; i++) {
+ var item = dataStore.items[i];
+ for(var j = 0; j < matches.length; j++) {
+ var match = matches[j];
+ if(match.eg_record() == item.id)
+ item.field_type = match.field_type();
+ }
+ }
+ var store = new dojo.data.ItemFileReadStore({data:dataStore});
var model = new dojox.grid.data.DojoData(
null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
vlMatchGrid.setModel(model);
@@ -250,6 +264,7 @@
);
}
+
function vlLoadMARCHtml(recId) {
displayGlobalDiv('vl-generic-progress');
fieldmapper.standardRequest(
@@ -276,7 +291,7 @@
if(matches.length > 0) { // found some matches
return '<div class="match_div">' +
'<a href="javascript:void(0);" onclick="vlLoadMatchUI('+
- rec.id()+',\''+matches[0].field_type()+'\');">'+
+ rec.id()+',\''+attrCode+'\');">'+
attr.attr_value() + ' ('+matches.length+')</a></div>';
}
@@ -285,16 +300,17 @@
function getRecMatchesFromAttrCode(rec, attrCode) {
var matches = [];
+ var attr = getRecAttrFromCode(rec, attrCode);
for(var j = 0; j < rec.matches().length; j++) {
var match = rec.matches()[j];
- if(match.field_type() == attrCode)
+ if(match.matched_attr() == attr.id())
matches.push(match);
}
return matches;
}
function getRecAttrFromCode(rec, attrCode) {
- var defId = attrMap[attrCode];
+ var defId = attrDefMap[attrCode];
var attrs = rec.attributes();
for(var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
@@ -310,7 +326,6 @@
var attrCode = this.field.split('.')[1];
var rec = queuedRecordsMap[data.id];
var attr = getRecAttrFromCode(rec, attrCode);
- console.log('attr = ' + attr);
if(attr)
return buildAttrColumnUI(rec, attrCode, attr);
return '';
@@ -343,19 +358,43 @@
return this.value.replace('RECID', data.id);
}
+function vlGetOverlayTargetSelector(rowIdx) {
+ data = this.grid.model.getRow(rowIdx);
+ if(data)
+ return this.value.replace('ID', data.id);
+}
+
+function vlHandleOverlayTargetSelected() {
+ //alert(1);
+ console.log("checking target select..");
+ if(!vlOverlayTargetEnable.checked) return;
+ console.log("overlay enabled for for record "+matchRecId);
+ for(var i = 0; i < currentMatchedRecords.length; i++) {
+ var matchRecId = currentMatchedRecords[i].id();
+ console.log("checking id vl-overlay-target-"+matchRecId);
+ if(dojo.byId('vl-overlay-target-'+matchRecId).selected) {
+ console.log("CHECKED");
+ currentOverlayRecordsMap[currentImportRecId] = matchRecId;
+ return;
+ }
+ }
+}
+
function buildRecordGrid(type) {
displayGlobalDiv('vl-queue-div');
+ currentOverlayRecordsMap = {};
+
var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
for(var i = 0; i < defs.length; i++) {
- var attr = defs[i]
- attrMap[attr.code()] = attr.id();
+ var def = defs[i]
+ attrDefMap[def.code()] = def.id();
var col = {
- name:attr.description(),
- field:'attr.' + attr.code(),
+ name:def.description(),
+ field:'attr.' + def.code(),
get: getAttrValue
};
- //if(attr.code().match(/title/i)) col.width = 'auto'; // this is hack.
+ //if(def.code().match(/title/i)) col.width = 'auto'; // this is hack.
vlQueueGridLayout[0].cells[0].push(col);
}
More information about the open-ils-commits
mailing list