diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm index 82e6d2ef3..eb63a433d 100644 --- a/lib/WebGUI/Asset/MatrixListing.pm +++ b/lib/WebGUI/Asset/MatrixListing.pm @@ -887,6 +887,7 @@ sub www_getAttributes { $attribute->{label} = $attribute->{name}; $attribute->{attributeId} =~ s/-/_____/g; if ($attribute->{fieldType} eq 'MatrixCompare'){ + $attribute->{compareColor} = $self->getParent->getCompareColor($attribute->{value}); $attribute->{value} = WebGUI::Form::MatrixCompare->new($self->session,$attribute)->getValueAsHtml; } if($session->scratch->get('stickied_'.$attribute->{attributeId})){ diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 910a1c573..44c50b32a 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -334,7 +334,7 @@ sub getCompareColor { elsif($value == 3){ return $self->get('compareColorFreeAddOn'); } - elsif($value == 3){ + elsif($value == 4){ return $self->get('compareColorYes'); } @@ -1034,7 +1034,8 @@ sub www_getCompareListData { $listing->incrementCounter("compares"); my $listingId_safe = $listingId; $listingId_safe =~ s/-/_____/g; - push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors"}); + push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors", + url=>$listing->getUrl}); } my $jsonOutput; diff --git a/www/extras/wobject/Matrix/matrixCompareList.js b/www/extras/wobject/Matrix/matrixCompareList.js index 26d3f2bf6..4e8a0b99b 100644 --- a/www/extras/wobject/Matrix/matrixCompareList.js +++ b/www/extras/wobject/Matrix/matrixCompareList.js @@ -81,7 +81,7 @@ YAHOO.util.Event.addListener(window, "load", function() { for (var i = 0; i < len; i++) { var c = oFullResponse.ColumnDefs[i]; - oFullResponse.ColumnDefs[i].label = oFullResponse.ColumnDefs[i].label + "" + oFullResponse.ColumnDefs[i].label = "" + oFullResponse.ColumnDefs[i].label + " " myDataTable.insertColumn(c); } } diff --git a/www/extras/wobject/Matrix/matrixListing.js b/www/extras/wobject/Matrix/matrixListing.js index f6d18ae1b..6651cafd7 100644 --- a/www/extras/wobject/Matrix/matrixListing.js +++ b/www/extras/wobject/Matrix/matrixListing.js @@ -20,11 +20,19 @@ YAHOO.util.Event.addListener(window, "load", function() { elCell.innerHTML = sData + "
" + oRecord.getData("description") +"
"; } }; - + this.formatColors = function(elCell, oRecord, oColumn, sData) { + if(oRecord.getData("fieldType") != 'category'){ + var color = oRecord.getData("compareColor"); + if(color){ + Dom.setStyle(elCell.parentNode, "background-color", color); + } + elCell.innerHTML = sData; + } + }; var myColumnDefs = [ {key:"stickied",formatter:this.formatStickied,label:""}, {key:"label",formatter:this.formatLabel,label:""}, - {key:"value",label:""} + {key:"value",label:"",formatter:this.formatColors} ]; this.myDataSource = new YAHOO.util.DataSource("?"); @@ -32,7 +40,7 @@ YAHOO.util.Event.addListener(window, "load", function() { this.myDataSource.connXhrMode = "queueRequests"; this.myDataSource.responseSchema = { resultsList: "ResultSet.Result", - fields: ["label","value","attributeId","fieldType","checked","description"] + fields: ["label","value","attributeId","fieldType","checked","description","compareColor"] }; var uri = "func=getAttributes";