From 040da6f327cee732c01be888b0a93cbf947345f9 Mon Sep 17 00:00:00 2001 From: Yung Han Khoe Date: Thu, 11 Dec 2008 14:55:22 +0000 Subject: [PATCH] added tooltips to Matrix attributes --- lib/WebGUI/Asset/Wobject/Matrix.pm | 8 ++++++-- www/extras/wobject/Matrix/matrixCompareList.js | 14 ++++++++++---- www/extras/wobject/Matrix/matrixListing.js | 9 +++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index f149a36b4..910a1c573 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -664,6 +664,10 @@ sub www_compare { 'text/javascript'}); $self->session->style->setLink($self->session->url->extras('yui/build/datatable/assets/skins/sam/datatable.css'), {type =>'text/css', rel=>'stylesheet'}); + $self->session->style->setScript($self->session->url->extras('hoverhelp.js'), {type => + 'text/javascript'}); + $self->session->style->setLink($self->session->url->extras('hoverhelp.css'), + {type =>'text/css', rel=>'stylesheet'}); my $maxComparisons; if($self->session->user->isVisitor){ @@ -681,7 +685,7 @@ sub www_compare { $var->{javascript} = ""; @@ -1038,7 +1042,7 @@ sub www_getCompareListData { foreach my $category (keys %{$self->getCategories}) { push(@results,{name=>$category,fieldType=>'category'}); - my $fields = " a.name, a.fieldType, a.attributeId "; + my $fields = " a.name, a.fieldType, a.attributeId, a.description "; my $from = "from Matrix_attribute a"; my $tableCount = "b"; foreach my $listingId (@listingIds) { diff --git a/www/extras/wobject/Matrix/matrixCompareList.js b/www/extras/wobject/Matrix/matrixCompareList.js index 3c9a4295d..26d3f2bf6 100644 --- a/www/extras/wobject/Matrix/matrixCompareList.js +++ b/www/extras/wobject/Matrix/matrixCompareList.js @@ -28,7 +28,7 @@ YAHOO.util.Event.addListener(window, "load", function() { if(oRecord.getData("fieldType") == 'category'){ elCell.innerHTML = "" +sData + ""; }else{ - elCell.innerHTML = sData; + elCell.innerHTML = sData + "
" + oRecord.getData("description") +"
"; } }; @@ -52,8 +52,14 @@ YAHOO.util.Event.addListener(window, "load", function() { uri = uri+';listingId='+listingIds[i]; } + var initAttributeHoverHelp = function() { + initHoverHelp('compareList'); + } + var myDataTable = new YAHOO.widget.DataTable("compareList", myColumnDefs, this.myDataSource, {initialRequest:uri}); + myDataTable.subscribe("initEvent", initAttributeHoverHelp); + window.removeListing = function(key) { myDataTable.hideColumn(myDataTable.removeColumn(key)); @@ -83,8 +89,9 @@ YAHOO.util.Event.addListener(window, "load", function() { } var myCallback = function() { - this.set("sortedBy", null); - this.onDataReturnAppendRows.apply(this,arguments); + this.set("sortedBy", null); + this.onDataReturnAppendRows.apply(this,arguments); + initHoverHelp('compareList'); }; var callback2 = { @@ -170,7 +177,6 @@ YAHOO.util.Event.addListener(window, "load", function() { hideStickies = 0; } },this,true); - }; }); diff --git a/www/extras/wobject/Matrix/matrixListing.js b/www/extras/wobject/Matrix/matrixListing.js index 3f90aa284..f6d18ae1b 100644 --- a/www/extras/wobject/Matrix/matrixListing.js +++ b/www/extras/wobject/Matrix/matrixListing.js @@ -17,7 +17,7 @@ YAHOO.util.Event.addListener(window, "load", function() { if(oRecord.getData("fieldType") == 'category'){ elCell.innerHTML = "" +sData + ""; }else{ - elCell.innerHTML = sData; + elCell.innerHTML = sData + "
" + oRecord.getData("description") +"
"; } }; @@ -32,13 +32,18 @@ YAHOO.util.Event.addListener(window, "load", function() { this.myDataSource.connXhrMode = "queueRequests"; this.myDataSource.responseSchema = { resultsList: "ResultSet.Result", - fields: ["label","value","attributeId","fieldType","checked"] + fields: ["label","value","attributeId","fieldType","checked","description"] }; var uri = "func=getAttributes"; + var initAttributeHoverHelp = function() { + initHoverHelp('attributes'); + } + var myDataTable = new YAHOO.widget.DataTable("attributes", myColumnDefs, this.myDataSource, {initialRequest:uri}); + myDataTable.subscribe("initEvent", initAttributeHoverHelp); this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) {