matrix bug fixes

This commit is contained in:
Yung Han Khoe 2008-12-12 12:20:54 +00:00
parent 8fa164200a
commit 80d7ac6ae1
4 changed files with 16 additions and 6 deletions

View file

@ -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})){

View file

@ -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;

View file

@ -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 + "<a href='javascript:removeListing(\""+oFullResponse.ColumnDefs[i].key+"\")'><img src='/extras/toolbar/bullet/delete.gif' border='0'></a>"
oFullResponse.ColumnDefs[i].label = "<a href='"+ oFullResponse.ColumnDefs[i].url +"'>" + oFullResponse.ColumnDefs[i].label + "</a> <a href='javascript:removeListing(\""+oFullResponse.ColumnDefs[i].key+"\")'><img src='/extras/toolbar/bullet/delete.gif' border='0'></a>"
myDataTable.insertColumn(c);
}
}

View file

@ -20,11 +20,19 @@ YAHOO.util.Event.addListener(window, "load", function() {
elCell.innerHTML = sData + "<div class='wg-hoverhelp'>" + oRecord.getData("description") +"</div>";
}
};
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";