[open-ils-commits] r10699 - trunk/Open-ILS/web/vandelay
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 25 09:25:12 EDT 2008
Author: erickson
Date: 2008-09-25 09:25:11 -0400 (Thu, 25 Sep 2008)
New Revision: 10699
Modified:
trunk/Open-ILS/web/vandelay/vandelay.html
trunk/Open-ILS/web/vandelay/vandelay.js
Log:
instead of displaying a link on match cells, have a dedicated match column, which links to a page with all matches.
Modified: trunk/Open-ILS/web/vandelay/vandelay.html
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-25 02:52:39 UTC (rev 10698)
+++ trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-25 13:25:11 UTC (rev 10699)
@@ -142,8 +142,13 @@
get: vlQueueGridDrawSelectBox },
{ name: 'View MARC',
get: vlGetViewMARC,
- value:'<a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, false, function(){displayGlobalDiv(\'vl-queue-div\');});">View MARC</a>'
+ value:'<a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, false, '+
+ 'function(){displayGlobalDiv(\'vl-queue-div\');});">View MARC</a>'
},
+ { name: 'Matches',
+ get: vlGetViewMatches,
+ value:'<a href="javascript:void(0);" onclick="vlLoadMatchUI(RECID);">Matches</a>'
+ },
{name: 'Import Time', field:'import_time', get:vlGetDateTimeField, selectableColumn:true}
]]
}];
@@ -245,13 +250,16 @@
{
name: 'Overlay Target',
get: vlGetOverlayTargetSelector,
- value: '<input type="radio" name="overlay_target" onclick="vlHandleOverlayTargetSelected();" id="vl-overlay-target-ID"/>'
+ value: '<input type="radio" name="overlay_target" '+
+ 'onclick="vlHandleOverlayTargetSelected();" id="vl-overlay-target-ID"/>'
},
- {name:'Match Point', field:'field_type'},
+ {name:'Source Match Point', field:'src_matchpoint'},
+ {name:'Destination Match Point', field:'dest_matchpoint'},
{name: 'ID', field:'id'},
{ name: 'View MARC',
get: vlGetViewMARC,
- value:'<a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, true, function(){displayGlobalDiv(\'vl-match-div\');});">View MARC</a>'
+ value:'<a href="javascript:void(0);" onclick="vlLoadMARCHtml(RECID, '+
+ 'true, function(){displayGlobalDiv(\'vl-match-div\');});">View MARC</a>'
},
{name: 'Creator', get: vlGetCreator},
{name: 'Create Date', field:'create_date', get: vlGetDateTimeField},
@@ -316,10 +324,11 @@
</tr>
</table>
</div>
+ <!--
<div style='text-align:center;width:100%;' dojoType="dijit.layout.ContentPane" layoutAlign='bottom'>
- I live at the bottom of the page and I'm powered by Evergreen!
+ Powered by Evergreen!
</div>
-
+ -->
</div>
</body>
</html>
Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-25 02:52:39 UTC (rev 10698)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-25 13:25:11 UTC (rev 10699)
@@ -292,9 +292,11 @@
);
}
-function vlLoadMatchUI(recId, attrCode) {
+//function vlLoadMatchUI(recId, attrCode) {
+function vlLoadMatchUI(recId) {
displayGlobalDiv('vl-generic-progress');
- var matches = getRecMatchesFromAttrCode(queuedRecordsMap[recId], attrCode);
+ //var matches = getRecMatchesFromAttrCode(queuedRecordsMap[recId], attrCode);
+ var matches = queuedRecordsMap[recId].matches();
var records = [];
currentImportRecId = recId;
for(var i = 0; i < matches.length; i++)
@@ -322,16 +324,26 @@
currentMatchedRecords = recs;
vlMatchGrid.setStructure(vlMatchGridLayout);
- // build the data store or records with match information
- var dataStore = bre.toStoreData(recs, null, {virtualFields:['field_type']});
+ // build the data store of records with match information
+ var dataStore = bre.toStoreData(recs, null,
+ {virtualFields:['dest_matchpoint', 'src_matchpoint', '_id']});
+ dataStore.identifier = '_id';
+
+
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)
- item.field_type = match.field_type();
+ if(match.eg_record() == item.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();
+ }
}
}
+
// now populate the grid
vlPopulateGrid(vlMatchGrid, dataStore);
}
@@ -377,23 +389,7 @@
}
-/**
- * Given a record, an attribute definition code, and a matching record attribute,
- * this will determine if there are any import matches and build the UI to
- * represent those matches. If no matches exist, simply returns the attribute value
- */
-function buildAttrColumnUI(rec, attrCode, attr) {
- var matches = getRecMatchesFromAttrCode(rec, attrCode);
- if(matches.length > 0) { // found some matches
- return '<div class="match_div">' +
- '<a href="javascript:void(0);" onclick="vlLoadMatchUI('+
- rec.id()+',\''+attrCode+'\');">'+
- attr.attr_value() + ' ('+matches.length+')</a></div>';
- }
-
- return attr.attr_value();
-}
-
+/*
function getRecMatchesFromAttrCode(rec, attrCode) {
var matches = [];
var attr = getRecAttrFromCode(rec, attrCode);
@@ -404,7 +400,25 @@
}
return matches;
}
+*/
+function getRecAttrFromMatch(rec, match) {
+ for(var i = 0; i < rec.attributes().length; i++) {
+ var attr = rec.attributes()[i];
+ if(attr.id() == match.matched_attr())
+ return attr;
+ }
+}
+
+function getRecAttrDefFromAttr(attr, type) {
+ var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
+ for(var i = 0; i < defs.length; i++) {
+ var def = defs[i];
+ if(def.id() == attr.field())
+ return def;
+ }
+}
+
function getRecAttrFromCode(rec, attrCode) {
var defId = attrDefMap[attrCode];
var attrs = rec.attributes();
@@ -416,15 +430,22 @@
return null;
}
+function vlGetViewMatches(rowIdx) {
+ var data = this.grid.model.getRow(rowIdx);
+ if(!data) return '';
+ var rec = queuedRecordsMap[data.id];
+ if(rec.matches().length > 0)
+ return this.value.replace('RECID', data.id);
+ return '';
+}
+
function getAttrValue(rowIdx) {
var data = this.grid.model.getRow(rowIdx);
if(!data) return '';
var attrCode = this.field.split('.')[1];
var rec = queuedRecordsMap[data.id];
var attr = getRecAttrFromCode(rec, attrCode);
- if(attr)
- return buildAttrColumnUI(rec, attrCode, attr);
- return '';
+ return (attr) ? attr.attr_value() : '';
}
function vlGetDateTimeField(rowIdx) {
More information about the open-ils-commits
mailing list