added lastUpdated and version to Matrix compare screen
This commit is contained in:
parent
6061dbf1b3
commit
5edad76d21
3 changed files with 26 additions and 7 deletions
|
|
@ -1021,6 +1021,7 @@ sub www_getCompareListData {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @listingIds = @_;
|
my @listingIds = @_;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
|
my $i18n = WebGUI::International->new($session,'Asset_Matrix');
|
||||||
my (@results,@columnDefs);
|
my (@results,@columnDefs);
|
||||||
|
|
||||||
unless (scalar(@listingIds)) {
|
unless (scalar(@listingIds)) {
|
||||||
|
|
@ -1034,10 +1035,16 @@ sub www_getCompareListData {
|
||||||
$listing->incrementCounter("compares");
|
$listing->incrementCounter("compares");
|
||||||
my $listingId_safe = $listingId;
|
my $listingId_safe = $listingId;
|
||||||
$listingId_safe =~ s/-/_____/g;
|
$listingId_safe =~ s/-/_____/g;
|
||||||
push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors",
|
push(@columnDefs,{
|
||||||
url=>$listing->getUrl});
|
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;
|
my $jsonOutput;
|
||||||
$jsonOutput->{ColumnDefs} = \@columnDefs;
|
$jsonOutput->{ColumnDefs} = \@columnDefs;
|
||||||
|
|
||||||
|
|
@ -1061,10 +1068,16 @@ sub www_getCompareListData {
|
||||||
}
|
}
|
||||||
foreach my $result (@results){
|
foreach my $result (@results){
|
||||||
if($result->{fieldType} eq 'category'){
|
if($result->{fieldType} eq 'category'){
|
||||||
|
# Row starting with a category label shows the listing name in each column
|
||||||
foreach my $columnDef (@columnDefs) {
|
foreach my $columnDef (@columnDefs) {
|
||||||
$result->{$columnDef->{key}} = $columnDef->{label};
|
$result->{$columnDef->{key}} = $columnDef->{label};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif($result->{fieldType} eq 'lastUpdated'){
|
||||||
|
foreach my $columnDef (@columnDefs) {
|
||||||
|
$result->{$columnDef->{key}} = $columnDef->{lastUpdated};
|
||||||
|
}
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
foreach my $listingId (@listingIds) {
|
foreach my $listingId (@listingIds) {
|
||||||
$result->{attributeId} =~ s/-/_____/g;
|
$result->{attributeId} =~ s/-/_____/g;
|
||||||
|
|
|
||||||
|
|
@ -927,6 +927,12 @@ selectBox.</p>|
|
||||||
message => q|Compare|,
|
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' => {
|
'hide stickied button label' => {
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
message => q|Hide/show stickied|,
|
message => q|Hide/show stickied|,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
||||||
var hideStickies = 0;
|
var hideStickies = 0;
|
||||||
|
|
||||||
this.formatStickied = function(elCell, oRecord, oColumn, sData) {
|
this.formatStickied = function(elCell, oRecord, oColumn, sData) {
|
||||||
if(oRecord.getData("fieldType") != 'category'){
|
if(!(oRecord.getData("fieldType") in {'category':'','lastUpdated':''})){
|
||||||
var innerHTML = "<input type='checkBox' class='stickieCheckbox' id='" + oRecord.getData("attributeId") + "_stickied' name='" + oRecord.getData("attributeId") + "' onChange='setStickied(this)'";
|
var innerHTML = "<input type='checkBox' class='stickieCheckbox' id='" + oRecord.getData("attributeId") + "_stickied' name='" + oRecord.getData("attributeId") + "' onChange='setStickied(this)'";
|
||||||
if(typeof(oRecord.getData("checked")) != 'undefined' && oRecord.getData("checked") == 'checked'){
|
if(typeof(oRecord.getData("checked")) != 'undefined' && oRecord.getData("checked") == 'checked'){
|
||||||
innerHTML = innerHTML + " checked='checked'";
|
innerHTML = innerHTML + " checked='checked'";
|
||||||
|
|
@ -15,7 +15,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.formatColors = function(elCell, oRecord, oColumn, sData) {
|
this.formatColors = function(elCell, oRecord, oColumn, sData) {
|
||||||
if(oRecord.getData("fieldType") != 'category'){
|
if(!(oRecord.getData("fieldType") in {'category':'','lastUpdated':''})){
|
||||||
var colorField = oColumn.key + "_compareColor";
|
var colorField = oColumn.key + "_compareColor";
|
||||||
var color = oRecord.getData(colorField);
|
var color = oRecord.getData(colorField);
|
||||||
if(color){
|
if(color){
|
||||||
|
|
@ -157,7 +157,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
||||||
if(hideStickies == 0){
|
if(hideStickies == 0){
|
||||||
// hide non-selected attributes
|
// hide non-selected attributes
|
||||||
for(i=0; i<elements.length; i++){
|
for(i=0; i<elements.length; i++){
|
||||||
if(elements[i].getData('fieldType') != 'category'){
|
if(!(elements[i].getData('fieldType') in {'category':'','lastUpdated':''})){
|
||||||
var attributeId = elements[i].getData('attributeId');
|
var attributeId = elements[i].getData('attributeId');
|
||||||
var checkBox = Dom.get(attributeId+"_stickied");
|
var checkBox = Dom.get(attributeId+"_stickied");
|
||||||
if (checkBox.checked == false){
|
if (checkBox.checked == false){
|
||||||
|
|
@ -170,7 +170,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
|
||||||
}else{
|
}else{
|
||||||
// show all attributes
|
// show all attributes
|
||||||
for(i=0; i<elements.length; i++){
|
for(i=0; i<elements.length; i++){
|
||||||
if(elements[i].getData('fieldType') != 'category'){
|
if(!(elements[i].getData('fieldType') in {'category':'','lastUpdated':''})){
|
||||||
var attributeId = elements[i].getData('attributeId');
|
var attributeId = elements[i].getData('attributeId');
|
||||||
var checkBox = Dom.get(attributeId+"_stickied");
|
var checkBox = Dom.get(attributeId+"_stickied");
|
||||||
if (checkBox.checked == false){
|
if (checkBox.checked == false){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue