[open-ils-commits] r10520 - trunk/Open-ILS/web/vandelay
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 3 11:14:09 EDT 2008
Author: erickson
Date: 2008-09-03 11:14:07 -0400 (Wed, 03 Sep 2008)
New Revision: 10520
Modified:
trunk/Open-ILS/web/vandelay/vandelay.html
trunk/Open-ILS/web/vandelay/vandelay.js
Log:
added logic to find matches. centering cell data
Modified: trunk/Open-ILS/web/vandelay/vandelay.html
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-03 13:46:31 UTC (rev 10519)
+++ trunk/Open-ILS/web/vandelay/vandelay.html 2008-09-03 15:14:07 UTC (rev 10520)
@@ -93,6 +93,7 @@
var vlQueueGridLayout;
function resetVlQueueGridLayout() {
vlQueueGridLayout = [{
+ defaultCell: {styles: 'text-align: center;'},
cells : [[
{name: 'Selected', get: vlQueueGridDrawSelectBox },
{name: 'Import Time', field:'import_time', get:getDateTimeField}
Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-03 13:46:31 UTC (rev 10519)
+++ trunk/Open-ILS/web/vandelay/vandelay.js 2008-09-03 15:14:07 UTC (rev 10520)
@@ -219,17 +219,44 @@
);
}
+
+/**
+ * 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 = [];
+ for(var j = 0; j < rec.matches().length; j++) {
+ var match = rec.matches()[j];
+ if(match.field_type() == attrCode)
+ matches.push(match);
+ }
+
+ if(matches.length > 0) { // found some matches
+ var str = '<div>';
+ for(var k = 0; k < matches.length; k++) {
+ var match = matches[k];
+ str += '<div><a href="javascript:void(0);" onclick="alert('+match.eg_record()+');">' + match.eg_record()+'</a></div>';
+ }
+ str += '</div>';
+ return str;
+ }
+
+ return attr.attr_value();
+}
+
function getAttrValue(rowIdx) {
var data = this.grid.model.getRow(rowIdx);
if(!data) return '';
- var attrName = this.field.split('.')[1];
- var defId = attrMap[attrName];
+ var attrCode = this.field.split('.')[1];
+ var defId = attrMap[attrCode];
var rec = queuedRecordsMap[data.id];
var attrs = rec.attributes();
for(var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
if(attr.field() == defId)
- return attr.attr_value();
+ return buildAttrColumnUI(rec, attrCode, attr);
}
return '';
}
@@ -299,8 +326,12 @@
displayGlobalDiv('vl-generic-progress-with-total');
var records = [];
for(var id in selectableGridRecords) {
- if(dojo.byId(id).checked)
- records.push(selectableGridRecords[id]);
+ if(dojo.byId(id).checked) {
+ var recId = selectableGridRecords[id];
+ var rec = queuedRecordsMap[recId];
+ if(!rec.import_time())
+ records.push(recId);
+ }
}
fieldmapper.standardRequest(
['open-ils.vandelay', 'open-ils.vandelay.'+currentType+'_record.list.import'],
More information about the open-ils-commits
mailing list