diff --git a/lib/WebGUI/Asset/MatrixListing.pm b/lib/WebGUI/Asset/MatrixListing.pm
index 3a090ed22..730a86086 100644
--- a/lib/WebGUI/Asset/MatrixListing.pm
+++ b/lib/WebGUI/Asset/MatrixListing.pm
@@ -18,7 +18,6 @@ use strict;
use Tie::IxHash;
use Class::C3;
use base qw(WebGUI::AssetAspect::Comments WebGUI::Asset);
-#use base 'WebGUI::Asset';
use WebGUI::Utility;
@@ -81,15 +80,6 @@ sub definition {
tie %properties, 'Tie::IxHash';
my $i18n = WebGUI::International->new($session, "Asset_MatrixListing");
%properties = (
-# templateId => {
-# tab =>"display",
-# fieldType =>"template",
-# defaultValue =>'MatrixListingTmpl00001',
-# noFormPost =>0,
-# namespace =>"MatrixListing",
-# hoverHelp =>$i18n->get('template description'),
-# label =>$i18n->get('template label')
-# },
screenshots => {
tab =>"properties",
fieldType =>"image",
@@ -236,11 +226,9 @@ sub getEditForm {
my $session = $self->session;
my $db = $session->db;
my $matrixId = $self->getParent->getId;
- my $tabform = $self->next::method();#SUPER::getEditForm();
+ my $tabform = $self->next::method();
my $i18n = WebGUI::International->new($session, 'Asset_MatrixListing');
- #$self->session->style->setScript($self->session->url->extras('FileUploadControl.js'), {type =>'text/javascript'});
-
foreach my $category (keys %{$self->getParent->getCategories}) {
$tabform->getTab('properties')->raw('
| '.$category.' |
');
my $attributes;
@@ -262,23 +250,6 @@ sub getEditForm {
}
}
return $tabform;
-=cut
- $tabform->hidden({
- name=>"returnUrl",
- value=>$self->session->form->get("returnUrl")
- });
- if ($self->getValue("namespace") eq "") {
- my $namespaces = $self->session->dbSlave->buildHashRef("select distinct(namespace) from template order by
-namespace");
- $tabform->getTab("properties")->combo(
- -name=>"namespace",
- -options=>$namespaces,
- -label=>$i18n->get('namespace'),
- -hoverHelp=>$i18n->get('namespace description'),
- -value=>[$self->session->form->get("namespace")]
- );
- }
-=cut
}
#-------------------------------------------------------------------
@@ -293,13 +264,6 @@ sub hasRated {
my $self = shift;
my $session = $self->session;
-=cut
- return 1 unless ($self->session->user->isInGroup($self->get("groupToRate")));
-
- my $ratingTimeout = $self->session->user->isInGroup($self->get("privilegedGroup")) ?
-$self->get("ratingTimeoutPrivileged") : $self->get("ratingTimeout");
-=cut
-
my $hasRated = $self->session->db->quickScalar("select count(*) from MatrixListing_rating where
((userId=? and userId<>'1') or (userId='1' and ipAddress=?)) and listingId=?",
[$session->user->userId,$session->env->get("HTTP_X_FORWARDED_FOR"),$self->getId]);
@@ -325,9 +289,7 @@ sub incrementCounter {
my $counter = shift;
my $currentIp = $self->session->env->get("HTTP_X_FORWARDED_FOR");
- #print "current ip: ".$currentIp."
";
- #print "dsfsdf lastIp : ".$self->get($counter."LastIp")."
";
unless ($self->get($counter."LastIp") eq $currentIp) {
$self->update({
$counter."LastIp" => $currentIp,
@@ -381,7 +343,7 @@ sub processPropertiesFromFormPost {
my $session = $self->session;
my $score = 0;
- $self->next::method(@_);#SUPER::processPropertiesFromFormPost;
+ $self->next::method(@_);
my $attributes = $session->db->read("select * from Matrix_attribute where assetId = ?",[$self->getParent->getId]);
while (my $attribute = $attributes->hashRef) {
@@ -533,9 +495,6 @@ sub view {
if ($attribute->{fieldType} eq 'MatrixCompare'){
$attribute->{value} = WebGUI::Form::MatrixCompare->new($self->session,$attribute)->getValueAsHtml;
}
- #$attribute->{value} = $attribute->{description};
- #$tabform->getTab("properties")->dynamicField(%{$attribute});
- #my $categoryLoopName = $self->session->url->urlize($category)."_loop";
push(@attribute_loop,$attribute);
}
$var->{$categoryLoopName} = \@attribute_loop;
@@ -551,9 +510,7 @@ sub view {
my $file = WebGUI::Form::File->new($self->session,{ value=>$var->{screenshots} });
my $storage = $file->getStorageLocation;
my @files = @{ $storage->getFiles } if (defined $storage);
- if (scalar(@files)) {
- #$var->{screenshots} = $file->getFilePreview($storage);
- }
+
$var->{screenshots} = qq|
@@ -951,80 +908,6 @@ sub www_view {
return $self->view;
}
-#-------------------------------------------------------------------
-# Everything below here is to make it easier to install your custom
-# asset, but has nothing to do with assets in general
-#-------------------------------------------------------------------
-# cd /data/WebGUI/lib
-# perl -MWebGUI::Asset::MatrixListing -e install www.example.com.conf [ /path/to/WebGUI ]
-# - or -
-# perl -MWebGUI::Asset::MatrixListing -e uninstall www.example.com.conf [ /path/to/WebGUI ]
-#-------------------------------------------------------------------
-
-
-use base 'Exporter';
-our @EXPORT = qw(install uninstall);
-use WebGUI::Session;
-
-#-------------------------------------------------------------------
-sub install {
- my $config = $ARGV[0];
- my $home = $ARGV[1] || "/data/WebGUI";
- die "usage: perl -MWebGUI::Asset::MatrixListing -e install www.example.com.conf\n" unless ($home && $config);
- print "Installing asset.\n";
- my $session = WebGUI::Session->open($home, $config);
- $session->config->addToArray("assets","WebGUI::Asset::MatrixListing");
- $session->db->write("create table MatrixListing (
- assetId char(22) binary not null,
- revisionDate bigint not null,
- screenshots char(22),
- description text,
- version char(255),
- views int(11),
- compares int(11),
- clicks int(11),
- viewsLastIp char(255),
- comparesLastIp char(255),
- clicksLastIp char(255),
- lastUpdated int(11),
- maintainer char(22),
- manufacturerName char(255),
- manufacturerURL char(255),
- productURL char(255),
- score int(11),
- primary key (assetId, revisionDate)
- )");
- $session->db->write("create table MatrixListing_attribute (
- matrixId char(22) not null,
- matrixListingId char(22) not null,
- attributeId char(22) not null,
- value char(255),
- primary key (matrixId, matrixListingId, attributeId)
- )");
- $session->var->end;
- $session->close;
- print "Done. Please restart Apache.\n";
-}
-
-#-------------------------------------------------------------------
-sub uninstall {
- my $config = $ARGV[0];
- my $home = $ARGV[1] || "/data/WebGUI";
- die "usage: perl -MWebGUI::Asset::MatrixListing -e uninstall www.example.com.conf\n" unless ($home && $config);
- print "Uninstalling asset.\n";
- my $session = WebGUI::Session->open($home, $config);
- $session->config->deleteFromArray("assets","WebGUI::Asset::MatrixListing");
- my $rs = $session->db->read("select assetId from asset where className='WebGUI::Asset::MatrixListing'");
- while (my ($id) = $rs->array) {
- my $asset = WebGUI::Asset->new($session, $id, "WebGUI::Asset::MatrixListing");
- $asset->purge if defined $asset;
- }
- $session->db->write("drop table MatrixListing");
- $session->var->end;
- $session->close;
- print "Done. Please restart Apache.\n";
-}
-
1;
diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm
index 7d118379d..a66933441 100644
--- a/lib/WebGUI/Asset/Wobject/Matrix.pm
+++ b/lib/WebGUI/Asset/Wobject/Matrix.pm
@@ -69,17 +69,15 @@ sub definition {
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
- templateId =>{
- fieldType =>"template",
- defaultValue =>'matrixtmpl000000000001',
- tab =>"display",
- #www_editSave will ignore anyone's attempts to update this field if this is set to 1
- noFormPost =>0,
- #This is an option specific to the template fieldType.
- namespace =>"Matrix",
- hoverHelp =>$i18n->get('template description'),
- label =>$i18n->get('template label'),
- },
+ templateId =>{
+ fieldType =>"template",
+ defaultValue =>'matrixtmpl000000000001',
+ tab =>"display",
+ noFormPost =>0,
+ namespace =>"Matrix",
+ hoverHelp =>$i18n->get('template description'),
+ label =>$i18n->get('template label'),
+ },
searchTemplateId=>{
defaultValue =>"matrixtmpl000000000005",
fieldType =>"template",
@@ -96,14 +94,6 @@ sub definition {
hoverHelp =>$i18n->get('detail template description'),
label =>$i18n->get('detail template label'),
},
-# ratingDetailTemplateId=>{
-# defaultValue =>"matrixtmpl000000000004",
-# fieldType =>"template",
-# tab =>"display",
-# namespace =>"Matrix/RatingDetail",
-# hoverHelp =>$i18n->get('rating detail template description'),
-# label =>$i18n->get('rating detail template label'),
-# },
compareTemplateId=>{
defaultValue =>"matrixtmpl000000000002",
fieldType =>"template",
@@ -361,56 +351,14 @@ An array of listingIds that should be selected in the compare form.
sub getCompareForm {
my $self = shift;
-=cut
- my @selectedListingIds = @_;
-
- my (%options, @listings);
- tie %options, 'Tie::IxHash';
-
- my $sortDirection = " asc";
- if ( WebGUI::Utility::isIn($self->get('defaultSort'),qw(revisionDate score)) ){
- $sortDirection = " desc";
- }
- @listings = @{ $self->getLineage(['descendants'], {
- includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
- joinClass => "WebGUI::Asset::MatrixListing",
- orderByClause => $self->get('defaultSort').$sortDirection,
- returnObjects => 1,
- }) };
- # Create an options hash based on the ordered array of listings.
- foreach my $listing (@listings){
- $options{$listing->getId} = ''.$listing->get('title').'';
- }
-
- my $maxComparisons;
- if($self->session->user->isVisitor){
- $maxComparisons = $self->get('maxComparisons');
- }
- else{
- $maxComparisons = $self->get('maxComparisonsPrivileged');
- }
-=cut
my $form = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl,extras=>'name="doCompare"'})
-# .WebGUI::Form::submit($self->session, {
-# value=>"compare"
-# })
-# ."
"
."
"
.WebGUI::Form::hidden($self->session, {
name=>"func",
value=>"compare"
})
.' '
-# .WebGUI::Form::checkList($self->session, {
-# name=>"listingId",
-# vertical=>1,
-# value=>\@selectedListingIds,
-# options=>\%options,
-# })
."
"
-# .WebGUI::Form::submit($self->session,{
-# value=>"compare"
-# })
.WebGUI::Form::formFooter($self->session);
my $maxComparisons;
@@ -439,13 +387,6 @@ returns the tabform object that will be used in generating the edit page for Mat
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
-=cut
- $tabform->getTab("display")->template(
- -value=>$self->getValue("templateId"),
- -label=>WebGUI::International::get("template_label","Asset_Matrix"),
- -namespace=>"Matrix"
- );
-=cut
return $tabform;
}
@@ -563,21 +504,6 @@ sub view {
$var->{bestClicks_name} = $bestClicks_listing->get('title');
$var->{bestClicks_sortButton} = "
";
-=cut
- # Get the MatrixListing that was last updated as an object using getLineage.
-
- my ($bestUpdated_listing) = @{ $self->getLineage(['descendants'], {
- includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
- orderByClause => "revisionDate desc",
- limit => 1,
- returnObjects => 1,
- }) };
- $var->{bestUpdated_url} = $bestUpdated_listing->getUrl;
- $var->{bestUpdated_date} = $session->datetime->epochToHuman( $bestUpdated_listing->get('revisionDate') );
- $var->{bestUpdated_name} = $bestUpdated_listing->get('title');
- $var->{bestUpdated_sortButton} = "
";
-=cut
-
# Get the 5 MatrixListings that were last updated as objects using getLineage.
my @lastUpdatedListings = @{ $self->getLineage(['descendants'], {
@@ -678,9 +604,6 @@ assetData.revisionDate
group by asset.assetId",
[$self->getId]);
- #This is an example of debugging code to help you diagnose problems.
- #WebGUI::ErrorHandler::warn($self->get("templateId"));
-
return $self->processTemplate($var, undef, $self->{_viewTemplate});
}
@@ -698,7 +621,7 @@ sub www_compare {
my $var = $self->get;
my @listingIds = @_;
my @columnKeys;
- #my @listingIds = ['AwioUvaZXmAEaFw20t-x3Q', 'CWNjAHcmh0pEF6WJooomJA'];
+
unless (scalar(@listingIds)) {
@listingIds = $self->session->form->checkList("listingId");
}
@@ -774,24 +697,6 @@ sub www_deleteAttribute {
#-------------------------------------------------------------------
-=head2 www_edit ( )
-
-Web facing method which is the default edit page. This method is entirely
-optional. Take it out unless you specifically want to set a submenu in your
-adminConsole views.
-
-=cut
-
-#sub www_edit {
-# my $self = shift;
-# return $self->session->privilege->insufficient() unless $self->canEdit;
-# return $self->session->privilege->locked() unless $self->canEditIfLocked;
-# my $i18n = WebGUI::International->new($self->session, "Asset_Matrix");
-# return $self->getAdminConsole->render($self->getEditForm->print, $i18n->get("edit title"));
-#}
-
-#-------------------------------------------------------------------
-
=head2 www_editAttribute ( )
Shows a form to edit or add an attribute.
@@ -893,20 +798,7 @@ sub www_editAttribute {
."\n";
$form->raw($html);
-=cut
- $form->text(
- -name =>"defaultValue",
- -value =>$attribute->{defaultValue},
- -label =>$i18n->get('attribute defaultValue label'),
- -hoverHelp =>$i18n->get('attribute defaultValue description'),
- );
- $form->textarea(
- -name =>"options",
- -value =>$attribute->{options},
- -label =>$i18n->get('attribute options label'),
- -hoverHelp =>$i18n->get('attribute options description'),
- );
-=cut
+
$form->selectBox(
-name =>"category",
-value =>[$attribute->{category}],
@@ -993,14 +885,7 @@ sub www_getCompareFormData {
my @listingIds = $self->session->form->checkList("listingId");
$self->session->http->setMimeType("application/json");
-=cut
- my @listings = @{ $self->getLineage(['descendants'], {
- includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
- joinClass => "WebGUI::Asset::MatrixListing",
- orderByClause => $self->get('defaultSort').$sortDirection,
- returnObjects => 1,
- }) };
-=cut
+
my $sql = "
select
assetData.title,
@@ -1034,9 +919,7 @@ assetData.revisionDate
@results = @{ $session->db->buildArrayRefOfHashRefs($sql,[$self->getId]) };
foreach my $result (@results){
- #$result->{checked} = '';
if($form->process("search")){
- #my $listing = WebGUI::Asset::MatrixListing->new($session,$result->{assetId});
$self->session->errorHandler->warn("checking listing: ".$result->{title});
foreach my $param ($form->param) {
if($param =~ m/^search_/){
@@ -1061,7 +944,7 @@ assetData.revisionDate
$self->session->errorHandler->warn("--Checked--");
$result->{checked} = 'checked';
}
- }
+ }
}
}
else{
@@ -1079,21 +962,7 @@ assetData.revisionDate
}
$result->{checkBox} .= " onChange='javascript:compareFormButton()' class='compareCheckBox'>";
}
-=cut
-push(@results,{
- Title=>$data->{title},
- Views=>$data->{views},
- Compares=>$data->{compares},
- Clicks=>$data->{clicks}
- });
-=cut
- # Create an options hash based on the orderd array of listings.
-=cut
- foreach my $listing (@listings){
- push(@results,{Title=>$listing->get('title'),Phone=>'123'})
- #$options{$listing->getId} = ''.$listing->get('title').'';
- }
-=cut
+
my $jsonOutput;
$jsonOutput->{ResultSet} = {Result=>\@results};
@@ -1232,8 +1101,6 @@ sub www_search {
{type =>'text/javascript'});
$self->session->style->setScript($self->session->url->extras('yui/build/button/button-min.js'),
{type =>'text/javascript'});
-# $self->session->style->setScript($self->session->url->extras('wobject/Matrix/matrixCompareList.js'), {type =>
-# 'text/javascript'});
$self->session->style->setScript($self->session->url->extras('wobject/Matrix/matrixSearch.js'), {type =>
'text/javascript'});
$self->session->style->setLink($self->session->url->extras('yui/build/datatable/assets/skins/sam/datatable.css'),
@@ -1266,83 +1133,6 @@ sub www_search {
return $self->processStyle($self->processTemplate($var,$self->get("searchTemplateId")));
}
-#-------------------------------------------------------------------
-# Everything below here is to make it easier to install your custom
-# wobject, but has nothing to do with wobjects in general
-#-------------------------------------------------------------------
-# cd /data/WebGUI/lib
-# perl -MWebGUI::Asset::Wobject::Matrix -e install www.example.com.conf [ /path/to/WebGUI ]
-# - or -
-# perl -MWebGUI::Asset::Wobject::Matrix -e uninstall www.example.com.conf [ /path/to/WebGUI ]
-#-------------------------------------------------------------------
-
-
-use base 'Exporter';
-our @EXPORT = qw(install uninstall);
-use WebGUI::Session;
-
-#-------------------------------------------------------------------
-sub install {
- my $config = $ARGV[0];
- my $home = $ARGV[1] || "/data/WebGUI";
- die "usage: perl -MWebGUI::Asset::Wobject::Matrix -e install www.example.com.conf\n" unless ($home && $config);
- print "Installing asset.\n";
- my $session = WebGUI::Session->open($home, $config);
- $session->config->addToArray("assets","WebGUI::Asset::Wobject::Matrix");
- $session->db->write("create table Matrix (
- assetId varchar(22) binary not null,
- revisionDate bigint not null,
- templateId varchar(22) not null,
- searchTemplateId varchar(22) not null,
- compareTemplateId varchar(22) not null,
- detailTemplateId varchar(22) not null,
- maxComparisons int(11) not null default 10,
- maxComparisonsPrivileged int(11) not null default 25,
- defaultSort varchar(22) not null default 'score',
- categories text,
- compareColorNo varchar(22) not null default '#ffaaaa',
- compareColorLimited varchar(22) not null default '#ffffaa',
- compareColorCostsExtra varchar(22) not null default '#ffffaa',
- compareColorFreeAddOn varchar(22) not null default '#ffffaa',
- compareColorYes varchar(22) not null default '#aaffaa',
- submissionApprovalWorkflowId varchar(22) not null,
- ratingsDuration int(11) not null default 7776000,
- primary key (assetId, revisionDate)
- )");
- $session->db->write("create table Matrix_attribute (
- assetId char(22) binary not null,
- attributeId char(22) binary not null,
- name char(255) not null,
- description text,
- fieldType char(255) not null default 'MatrixCompare',
- category char(22) not null,
- options text,
- defaultValue char(255),
- primary key (attributeId)
- )");
- $session->var->end;
- $session->close;
- print "Done. Please restart Apache.\n";
-}
-
-#-------------------------------------------------------------------
-sub uninstall {
- my $config = $ARGV[0];
- my $home = $ARGV[1] || "/data/WebGUI";
- die "usage: perl -MWebGUI::Asset::Wobject::Matrix -e uninstall www.example.com.conf\n" unless ($home && $config);
- print "Uninstalling asset.\n";
- my $session = WebGUI::Session->open($home, $config);
- $session->config->deleteFromArray("assets","WebGUI::Asset::Wobject::Matrix");
- my $rs = $session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::Matrix'");
- while (my ($id) = $rs->array) {
- my $asset = WebGUI::Asset->new($session, $id, "WebGUI::Asset::Wobject::Matrix");
- $asset->purge if defined $asset;
- }
- $session->db->write("drop table Matrix");
- $session->var->end;
- $session->close;
- print "Done. Please restart Apache.\n";
-}
1;
diff --git a/www/extras/wobject/Matrix/matrix.js b/www/extras/wobject/Matrix/matrix.js
index bd85203d5..f31787aea 100644
--- a/www/extras/wobject/Matrix/matrix.js
+++ b/www/extras/wobject/Matrix/matrix.js
@@ -1,22 +1,11 @@
-var myCompareTable;
-
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.XHR_JSON = new function() {
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
elCell.innerHTML = "" + sData + "";
};
- this.formatCheckBox = function(elCell, oRecord, oColumn, sData) {
- var innerHTML = "";
- elCell.innerHTML = innerHTML;
- };
-
var myColumnDefs = [
- {key:"checkBox",label:"",sortable:false},//,formatter:this.formatCheckBox
+ {key:"checkBox",label:"",sortable:false},
{key:"title", label:"Name", sortable:true, formatter:this.formatUrl},
{key:"views", sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC}},
{key:"clicks", sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC}},
@@ -42,13 +31,11 @@ YAHOO.util.Event.addListener(window, "load", function() {
this.myDataTable = new YAHOO.widget.DataTable("compareForm", myColumnDefs,
this.myDataSource, {initialRequest:uri});
- //var oColumn = this.myDataTable.getColumn(3);
this.myDataTable.hideColumn(this.myDataTable.getColumn(2));
this.myDataTable.hideColumn(this.myDataTable.getColumn(3));
this.myDataTable.hideColumn(this.myDataTable.getColumn(4));
this.myDataTable.hideColumn(this.myDataTable.getColumn(5));
-
var btnSortByViews = new YAHOO.widget.Button("sortByViews");
btnSortByViews.on("click", function(e) {
this.myDataTable.sortColumn(this.myDataTable.getColumn(2));
@@ -73,18 +60,9 @@ YAHOO.util.Event.addListener(window, "load", function() {
this.set("sortedBy", null);
this.onDataReturnAppendRows.apply(this,arguments);
};
-
-
-
- //var compareCheckBoxes = YAHOO.util.Dom.getElementsByClassName('compareCheckBox');
- //for (var i = compareCheckBoxes.length; i--; ) {
- // alert('bla');
- // compareCheckBoxes[i].onchange = compareFormButton;
- //}
var btnCompare = new YAHOO.widget.Button("compare",{disabled:true,id:"compareButton"});
btnCompare.on("click", function(e) {
- alert('bla');
window.document.forms['doCompare'].submit();
},this,true);
@@ -105,38 +83,3 @@ YAHOO.util.Event.addListener(window, "load", function() {
};
});
-// function compareFormButton () {
-// var compareCheckBoxes = YAHOO.util.Dom.getElementsByClassName('compareCheckBox','input');
- //alert(compareCheckBoxes.length);
-// var checked = 0;
-// for (var i = compareCheckBoxes.length; i--; ) {
-// if(compareCheckBoxes[i].checked){
-// checked++;
-// }
-// }
- //alert(checked);
-// }
-
-//function sort() {
-// myCompareTable.sortColumn()
-// var oColumn = myCompareTable.getColumn(3);
-// myCompareTable.hideColumn(oColumn);
-//}
-
-function bla() {
- var callback1 = {
- success : myCallback,
- failure : myCallback,
- scope : this.myDataTable
- };
- this.myDataSource.sendRequest("func=getCompareFormData",
- callback1);
-
- var callback2 = {
- success : myCallback,
- failure : myCallback,
- scope : this.myDataTable
- };
- this.myDataSource.sendRequest("func=getCompareFormData",
- callback2);
-}
\ No newline at end of file
diff --git a/www/extras/wobject/Matrix/matrixCompareList.js b/www/extras/wobject/Matrix/matrixCompareList.js
index 2db979d74..e51305daf 100644
--- a/www/extras/wobject/Matrix/matrixCompareList.js
+++ b/www/extras/wobject/Matrix/matrixCompareList.js
@@ -1,5 +1,3 @@
-//var myCompareTable;
-
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.XHR_JSON = new function() {
var Dom = YAHOO.util.Dom;
@@ -30,7 +28,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
this.myDataSource.connXhrMode = "queueRequests";
this.myDataSource.responseSchema = {
resultsList: "ResultSet.Result",
- fields: columnKeys //["name","AwioUvaZXmAEaFw20tx3Q","CWNjAHcmh0pEF6WJooomJA"]
+ fields: columnKeys
};
var uri = "func=getCompareListData";
@@ -41,16 +39,6 @@ YAHOO.util.Event.addListener(window, "load", function() {
var myDataTable = new YAHOO.widget.DataTable("compareList", myColumnDefs,
this.myDataSource, {initialRequest:uri});
- //var oColumn = this.myDataTable.getColumn(3);
- //this.myDataTable.hideColumn(oColumn);
-
-
- //var btnAddRows = new YAHOO.widget.Button("hidecolumn");
- //btnAddRows.on("click", function(e) {
-
- //var oColumn = this.myDataTable.getColumn(3);
- // this.myDataTable.sortColumn(oColumn);
- //},this,true);
this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) {
myDataTable.getRecordSet().reset();
@@ -79,11 +67,8 @@ YAHOO.util.Event.addListener(window, "load", function() {
};
var myCallback2 = function() {
- //this.getRecordSet().reset();
- this.set("sortedBy", null);
+ this.set("sortedBy", null);
this.onDataReturnAppendRows.apply(this,arguments);
-
- //this.getRecordSet().reset();
};
@@ -107,8 +92,6 @@ YAHOO.util.Event.addListener(window, "load", function() {
this.myDataSource.sendRequest(uri,callback2);
},this,true);
- //btnCompare.set("disabled",true);
- //alert(btnCompare.get("disabled"));
window.compareFormButton = function() {
var compareCheckBoxes = YAHOO.util.Dom.getElementsByClassName('compareCheckBox','input');
var checked = 0;
@@ -117,7 +100,6 @@ YAHOO.util.Event.addListener(window, "load", function() {
checked++;
}
}
- //alert(maxComparisons);
if (checked > 1 && checked < maxComparisons){
btnCompare.set("disabled",false);
}else{
@@ -151,23 +133,8 @@ YAHOO.util.Event.addListener(window, "load", function() {
}
hideStickies = 0;
}
-
-// var elements = Dom.getElementsByClassName('yui-dt-even yui-dt-first', 'tr');
-// for(i=0; i" + sData + "";
};
- this.formatCheckBox = function(elCell, oRecord, oColumn, sData) {
- var innerHTML = "";
- elCell.innerHTML = innerHTML;
- };
-
var myColumnDefs = [
- {key:"checkBox",label:""},//,sortable:false,formatter:this.formatCheckBox
+ {key:"checkBox",label:""},
{key:"title", label:"Name", sortable:true, formatter:this.formatUrl},
{key:"views", sortable:true},
{key:"clicks", sortable:true},
@@ -29,10 +15,10 @@ YAHOO.util.Event.addListener(window, "load", function() {
];
var uri = "func=getCompareFormData";
- if(typeof(listingIds) != 'undefined'){
- for (var i = 0; i < listingIds.length; i++) {
- uri = uri+';listingId='+listingIds[i];
- }
+ if(typeof(listingIds) != 'undefined'){
+ for (var i = 0; i < listingIds.length; i++) {
+ uri = uri+';listingId='+listingIds[i];
+ }
}
this.myDataSource = new YAHOO.util.DataSource("?");
@@ -43,21 +29,15 @@ YAHOO.util.Event.addListener(window, "load", function() {
fields: ["title","views","clicks","compares","checkBox","checked","url"]
};
-
var myDataTable = new YAHOO.widget.DataTable("compareForm", myColumnDefs,
this.myDataSource, {initialRequest:uri});
this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) {
-
myDataTable.getRecordSet().reset();
return oFullResponse;
}
var myDataSource = this.myDataSource;
- //var oColumn = myDataTable.getColumn(3);
- //myDataTable.hideColumn(oColumn);
-
-
var myCallback = function() {
myDataTable.getRecordSet().reset();
this.set("sortedBy", null);
@@ -108,15 +88,12 @@ YAHOO.util.Event.addListener(window, "load", function() {
checked++;
}
}
- alert(checked);
if (checked > 1 && checked < maxComparisons){
btnCompare.set("disabled",false);
}else{
btnCompare.set("disabled",true);
}
}
-
-
};
});