From 5edad76d213f8e91a0fd94d68c2eb89f3715a2fd Mon Sep 17 00:00:00 2001
From: Yung Han Khoe
Date: Tue, 16 Dec 2008 14:04:30 +0000
Subject: [PATCH] added lastUpdated and version to Matrix compare screen
---
lib/WebGUI/Asset/Wobject/Matrix.pm | 19 ++++++++++++++++---
lib/WebGUI/i18n/English/Asset_Matrix.pm | 6 ++++++
.../wobject/Matrix/matrixCompareList.js | 8 ++++----
3 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm
index 5f91f39b8..3ce50f37e 100644
--- a/lib/WebGUI/Asset/Wobject/Matrix.pm
+++ b/lib/WebGUI/Asset/Wobject/Matrix.pm
@@ -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;
diff --git a/lib/WebGUI/i18n/English/Asset_Matrix.pm b/lib/WebGUI/i18n/English/Asset_Matrix.pm
index d21fc620e..0d3bfed79 100644
--- a/lib/WebGUI/i18n/English/Asset_Matrix.pm
+++ b/lib/WebGUI/i18n/English/Asset_Matrix.pm
@@ -927,6 +927,12 @@ selectBox.
|
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|,
diff --git a/www/extras/wobject/Matrix/matrixCompareList.js b/www/extras/wobject/Matrix/matrixCompareList.js
index 4dd36e044..f6303a9c1 100644
--- a/www/extras/wobject/Matrix/matrixCompareList.js
+++ b/www/extras/wobject/Matrix/matrixCompareList.js
@@ -4,7 +4,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
var hideStickies = 0;
this.formatStickied = function(elCell, oRecord, oColumn, sData) {
- if(oRecord.getData("fieldType") != 'category'){
+ if(!(oRecord.getData("fieldType") in {'category':'','lastUpdated':''})){
var innerHTML = "