added lastUpdated and version to Matrix compare screen

This commit is contained in:
Yung Han Khoe 2008-12-16 14:04:30 +00:00
parent 6061dbf1b3
commit 5edad76d21
3 changed files with 26 additions and 7 deletions

View file

@ -1021,6 +1021,7 @@ sub www_getCompareListData {
my $self = shift;
my @listingIds = @_;
my $session = $self->session;
my $i18n = WebGUI::International->new($session,'Asset_Matrix');
my (@results,@columnDefs);
unless (scalar(@listingIds)) {
@ -1034,10 +1035,16 @@ 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",
url=>$listing->getUrl});
push(@columnDefs,{
key =>$listingId_safe,
label =>$listing->get('title').' '.$listing->get('version'),
formatter =>"formatColors",
url =>$listing->getUrl,
lastUpdated =>$session->datetime->epochToHuman( $listing->get('revisonDate'),"%z" ),
});
}
push(@results,{name=>$i18n->get('last updated label'),fieldType=>'lastUpdated'});
my $jsonOutput;
$jsonOutput->{ColumnDefs} = \@columnDefs;
@ -1061,10 +1068,16 @@ sub www_getCompareListData {
}
foreach my $result (@results){
if($result->{fieldType} eq 'category'){
# Row starting with a category label shows the listing name in each column
foreach my $columnDef (@columnDefs) {
$result->{$columnDef->{key}} = $columnDef->{label};
}
}
elsif($result->{fieldType} eq 'lastUpdated'){
foreach my $columnDef (@columnDefs) {
$result->{$columnDef->{key}} = $columnDef->{lastUpdated};
}
}
else{
foreach my $listingId (@listingIds) {
$result->{attributeId} =~ s/-/_____/g;

View file

@ -927,6 +927,12 @@ selectBox.</p>|
message => q|Compare|,
},
'last updated label' => {
lastUpdated => 0,
message => q|Last Updated|,
context => q|The label of the last updated field in the comparison table on the compare screen.|,
},
'hide stickied button label' => {
lastUpdated => 0,
message => q|Hide/show stickied|,