#======================================================#
# EveryAuction Addon
# Misc Display Add-on With Page Breaks v1.0
#------------------------------------------------------#
# If you have them, this add-on will replace the
# following add-ons:
# View Sellers Other Auctions, View All Ending,
# View All New, and View All Hot
#======================================================#
# PiTA - Park In The Alley Software (Auction-Script.com)
#======================================================#
# Author: Splatt 02/13/99
# justguns.com auction-script.com compalley.com
#------------------------------------------------------#
# Unauthorized redistribution is prohibited!!!
# The latest version of my addons can be found at:
# www.auction-script.com/addons
#======================================================#
#------------------------------------------------------#
# Variables that need to be in your auction.cgi config section
#------------------------------------------------------#
#------------------------------------------------------#
# Page break section
# Set everything to 0 except the $entryno, set that to
# the number of lines to break the page at
#------------------------------------------------------#
$temp = 0;
$stop = 0;
$more = 0;
$thingy = 0;
$entryno = 15;
#------------------------------------------------------#
#------------------------------------------------------#
# Alternating Colors for the rows
# $odd_row_color = '#EEEEEE';
# $even_row_color = '#FFFFFF';
#------------------------------------------------------#
#------------------------------------------------------#
# View hot items
# $hotitemnum = number of bids to trigger hot item
# $hoticonpath = URL to an icon for displaying
# $hotitemnum = 10;
# $hoticonpath = "
";
#------------------------------------------------------#
#------------------------------------------------------#
# View new items
# $newdays = number of days item is considered new
# $newiconpath = URL to an icon for displaying
# $newdays = 1;
# $newiconpath = "
";
#------------------------------------------------------#
#------------------------------------------------------#
# View ending soon items
# $endhours = number of hours left in auction to be considered closing soon
# $endiconpath = URL to an icon for displaying
# $endhours = 3;
# $endiconpath="
";
#------------------------------------------------------#
#------------------------------------------------------#
# End of configuration section variables
#------------------------------------------------------#
#------------------------------------------------------#
# This goes in your auction.cgi elsif section
# elsif ($ARGV[0] eq 'disp') { &disp; }
#------------------------------------------------------#
# If you have them, it replaces:
# elsif ($ARGV[0] eq 'allnew') { &allnew; }
# elsif ($ARGV[0] eq 'allend') { &allend; }
# elsif ($ARGV[0] eq 'allhot') { &allhot; }
# elsif ($ARGV[0] eq 'viewseller') { &viewseller; }
#------------------------------------------------------#
#------------------------------------------------------#
# This goes in your footer section or wherever you have
# your menuing code
# print "New Items ";
# print "Hot Items ";
# print "Ending Soon ";
#------------------------------------------------------#
#------------------------------------------------------#
# This goes in your dispitem sub to allow users to view
# the sellers other auctions
# print " (view seller's other auctions)\n";
#------------------------------------------------------#
#------------------------------------------------------#
# This replaces subs: &allhot, &allnew, &allend, &viewseller
#------------------------------------------------------#
# Sub: Show misc displays
#------------------------------------------------------#
sub disp {
#------------------------------------------------------#
#------------------------------------------------------#
# I use the Header as a sub, this is here for reference
#------------------------------------------------------#
# if ($ARGV[1] eq 'allend') {&ShowHeader("Closing Items");}
# if ($ARGV[1] eq 'allnew') {&ShowHeader("New Items");}
# if ($ARGV[1] eq 'allhot') {&ShowHeader("Hot Items");}
# if ($ARGV[1] eq 'viewseller') {&ShowHeader("Auctions by: $ARGV[2]");}
#------------------------------------------------------#
if ($ARGV[2] eq "") { $ARGV[2] = "1"; }
print "
\n";
if ($ARGV[1] eq 'allend') { print "| Closing Items - Items with less than $endhours hours until they close | \n";}
if ($ARGV[1] eq 'allhot') { print "
| Hot Items - Items with $hotitemnum or more bids | \n"; }
if ($ARGV[1] eq 'allnew') { print "
| New Items - Items posted within $newdays day(s) | \n"; }
if ($ARGV[1] eq 'viewseller') { print "
| Auctions Offered By - $ARGV[2] | \n"; }
print "
\n";
print "\n";
print "| Item | Closes | Bids | High Bid |
\n";
$i=0;
foreach $key (sort keys %category) {
opendir THEDIR, "$basepath$key" || die "Unable to open directory: $!";
@allfiles = readdir THEDIR;
closedir THEDIR;
foreach $file (sort { int($a) <=> int($b) } @allfiles) {
if (-T "$basepath$key/$file") {
open THEFILE, "$basepath$key/$file";
($title, $reserve, $inc, $desc, $image, @bids) = ;
close THEFILE;
chomp($title, $reserve, $inc, $desc, $image, @bids);
@lastbid = split(/\[\]/,$bids[$#bids]);
$file =~ s/\.dat//;
@closetime = localtime($file);
$closetime[4]++;
$camera="";
$camera = $piciconpath if ($image);
@firstbid = split(/\[\]/,$bids[0]);
$timediff = ($file - time);
$hoticon="";
$hoticon=$hoticonpath if ($hotitemnum <= $#bids);
$newicon="";
$newicon=$newiconpath if (time<($newdays * 86400 + $firstbid[3]));
$timediff=($file - time);
$endicon="";
$endicon=$endiconpath if ($timediff < ($endhours * 3600));
$camera="";
$camera =$piciconpath if ($image);
#------------------------------------------------------#
# View Sellers Other Auctions
#------------------------------------------------------#
if ($ARGV[1] eq 'viewseller') {
if ($i % 2 == 1) {
$colortablebody=$odd_row_color; }
else { $colortablebody=$even_row_color; }
$flag=0;
foreach $bid(@bids) {
$i++ if (($firstbid[0]=~/$ARGV[2]\b/i) && ($flag==0));
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
if ($ARGV[6] eq "") {
$min = 0;
$max = $entryno;
}
if ($ARGV[6] ne "") {
$min = (($ARGV[6] - 1) * $entryno + 1);
$max = $ARGV[6] * $entryno;
}
if ($stop == 1) {
$more = 1;
break;
}
if ($temp >= $min -1 && $temp <= $max -1){
#------------------------------------------------------#
if (($firstbid[0]=~/$ARGV[2]\b/i) && ($flag==0)) {
print "| $category{$key}\: $title$hoticon$camera$newicon$endicon | $closetime[4]/$closetime[3] | $#bids | $currencysign$lastbid[2] |
\n";
$flag=1;
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
$thingy = 1;
#------------------------------------------------------#
}
}
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
#}
$somcount = $temp + 1;
$temp = $somcount;
if ($temp >= $max) {
$stop = 1;
}
#------------------------------------------------------#
}
#------------------------------------------------------#
# View All New Items
#------------------------------------------------------#
if ($ARGV[1] eq 'allnew') {
if ($i % 2 == 1) {
$colortablebody=$odd_row_color; }
else { $colortablebody=$even_row_color; }
$i++ if (time < ($newdays * 86400 + $firstbid[3]));
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
if ($ARGV[6] eq "") {
$min = 0;
$max = $entryno;
}
if ($ARGV[6] ne "") {
$min = (($ARGV[6] - 1) * $entryno + 1);
$max = $ARGV[6] * $entryno;
}
if ($stop == 1) {
$more = 1;
break;
}
if ($temp >= $min -1 && $temp <= $max -1){
#------------------------------------------------------#
if (time < ($newdays * 86400 + $firstbid[3])) {
print "| $hoticon$newicon $title$camera$endicon | $closetime[4]/$closetime[3] $closetime[2]\:";
if ($closetime[1] < 10) {
print "0$closetime[1] | $#bids | $currencysign$lastbid[2] |
\n"; }
else {
print "$closetime[1] $#bids | $currencysign$lastbid[2] | \n";
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
$thingy = 1;
#------------------------------------------------------#
}
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
#}
$somcount = $temp + 1;
$temp = $somcount;
if ($temp >= $max) {
$stop = 1;
}
#------------------------------------------------------#
}
#------------------------------------------------------#
# View All Hot Items
#------------------------------------------------------#
if ($ARGV[1] eq 'allhot') {
if ($i % 2 == 1) {
$colortablebody=$odd_row_color; }
else { $colortablebody=$even_row_color; }
$i++ if ($hotitemnum <= $#bids);
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
if ($ARGV[6] eq "") {
$min = 0;
$max = $entryno;
}
if ($ARGV[6] ne "") {
$min = (($ARGV[6] - 1) * $entryno + 1);
$max = $ARGV[6] * $entryno;
}
if ($stop == 1) {
$more = 1;
break;
}
if ($temp >= $min -1 && $temp <= $max -1){
#------------------------------------------------------#
if ($hotitemnum <= $#bids) {
print "| $hoticon$newicon $title$camera$endicon | $closetime[4]/$closetime[3] $closetime[2]\:";
if ($closetime[1] < 10) {
print "0$closetime[1] | $#bids | $currencysign$lastbid[2] |
\n"; }
else {
print "$closetime[1] $#bids | $currencysign$lastbid[2] | \n";
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
$thingy = 1;
#------------------------------------------------------#
}
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
#}
$somcount = $temp + 1;
$temp = $somcount;
if ($temp >= $max) {
$stop = 1;
}
#------------------------------------------------------#
}
#------------------------------------------------------#
# View All Ending Items
#------------------------------------------------------#
if ($ARGV[1] eq 'allend'){
if ($i % 2 == 1) {
$colortablebody=$odd_row_color; }
else { $colortablebody=$even_row_color; }
$i++ if ($timediff < ($endhours * 3600));
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
if ($ARGV[6] eq "") {
$min = 0;
$max = $entryno;
}
if ($ARGV[6] ne "") {
$min = (($ARGV[6] - 1) * $entryno + 1);
$max = $ARGV[6] * $entryno;
}
if ($stop == 1) {
$more = 1;
break;
}
if ($temp >= $min -1 && $temp <= $max -1){
#------------------------------------------------------#
if ($timediff < ($endhours * 3600)) {
print "| $hoticon$newicon $title$camera$endicon | $closetime[4]/$closetime[3] $closetime[2]\:";
if ($closetime[1] < 10) {
print "0$closetime[1] | $#bids | $currencysign$lastbid[2] |
\n";}
else {
print "$closetime[1] $#bids | $currencysign$lastbid[2] | \n";}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
$thingy = 1;
#------------------------------------------------------#
}
}
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
#}
$somcount = $temp + 1;
$temp = $somcount;
if ($temp >= $max) {
$stop = 1;
}
#------------------------------------------------------#
}
}
}
}
print "
\n";
#------------------------------------------------------#
# Page break section
#------------------------------------------------------#
if ($thingy == 0) {
print "
No items to list.
";
print "[Previous | Last Page | Next]
";
}
else {
print "
\n";
if ($ARGV[6] eq "" || $ARGV[6] == 1) {
print "
[Previous | Page 1 | ";
}
if ($ARGV[6] ne "" && $ARGV[6] != 1) {
print "[";
$tmp = $ARGV[6] - 1;
print "Previous |";
print " Page $ARGV[6] | ";
}
if ($more == 0) {
print "Next]
";
}
if ($ARGV[6] eq "" && $more == 1) {
print "Next]
";
}
if ($ARGV[6] ne "" && $more == 1) {
$tmp = $ARGV[6] + 1;
print "Next]
";
}
}
#------------------------------------------------------#
#------------------------------------------------------#
# I also use the Footer as a sub, here for reference
# &ShowFooter;
#------------------------------------------------------#
}
#------------------------------------------------------#