--- db/prgsrc/db.cgi 2003/06/23 02:09:35 1.121
+++ db/prgsrc/db.cgi 2003/12/11 04:50:35 1.125
@@ -176,12 +176,12 @@ sub GetTournament {
sub fetchquestion {
my ($sth,$q,$WithTour)=@_;
if ($WithTour) {
- ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},
+ ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'},
$$q{'Number'},
$$q{'Title'}, $$q{'TourTitle'}, $$q{'FileName'},$$q{'PlayedAt'},$$q{'TourNumber'}) =
$sth->fetchrow;
} else {
- ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},
+ ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'},
$$q{'Number'})=
$sth->fetchrow;
}
@@ -203,13 +203,13 @@ sub SelectQuestions {
my $query;
if ($WithTour) {
- $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors,
+ $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors, Sources,
Questions.Number
, t2.Title, t1.Title, t2.FileName, t2.PlayedAt,t1.Number
from Questions,Tournaments as t1, Tournaments as t2
WHERE $where";
} else {
- $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors,
+ $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors, Sources,
Questions.Number from Questions
WHERE $where";
}
@@ -250,6 +250,12 @@ sub tourhref {
$res.=$a?"-a":"-q" unless $gr;
$res.=".html";
$res=~s/(\#\d+)(.*)$/$2$1/;
+ my $t=$res;
+ $t=~s/\#.*$//;
+ $res=~s/\.1// unless -e "$realHTMLDIR$t";
+ $t=$res;
+ $t=~s/\#.*$//;
+ $res=~s/\.html/-q\.html/ unless -e "$realHTMLDIR$t";
$res="$HTMLDIR$res" unless $opt_z;
return $res;
} else {
@@ -1243,8 +1249,10 @@ sub PrintField {
$value =~ s/<[\/\w]*?>//sg;
} else {
$value =~ s/^\s+/
/mg;
+ $value =~ s/(\s+)-+(\s+)/$1$2/mg;
+ $value =~ s/\s+\/ \/mg
+ if $value !~ /^\|/;
$value =~ s/^\|([^\n]*)/
$1<\/pre>/mg; - $value =~ s/\s+-+\s+/ /mg; $value =~ s/(http:\/\/\S+[^\s\)\(\,\.])/$1<\/a>/g if $header !~ /^αΧΤΟ/; # $value =~ s/(http:\/\/(?:\w+.)+[\w\\\~]+(\?[^\s.]+)?)/$1<\/a>/g if $header !~ /^αΧΤΟ/; # $value =~ s/(\s)"/$1/mg; @@ -1548,8 +1556,19 @@ sub PrintDates { next if (!$array[0]); %Tournament = &GetTournament($dbh, $array[0]); + my $textid; + if ($textid=$Tournament{'FileName'}) + { + $textid=~s/\.txt//; + } + elsif ($textid=$Tournament{'Number'}) + { + $fname=~s/\.txt//; + $textid="$fname.$textid"; + } + else {$textid=$Tournament{'Id'}}; $list .= dd(img({src=>"/icons/folder.gif", alt=>"[*]"}) . - " " . a({href=>tourhref($Tournament{'FileName'},0,1)}, + " " . a({href=>tourhref($textid,0,1)}, $Tournament{'Title'}, $Tournament{'PlayedAt'}||'')); } $sth->finish; @@ -1859,7 +1878,7 @@ MAIN: exit } - if ($tour && (!param('answers')||!param('answers')<=1)) + if ($tour && !param('qnumber') && (!param('answers')||(param('answers')<=1))) { my $n=param('tour'); $n=~s/.txt$//; @@ -2121,7 +2140,7 @@ EOT # FROM Tournaments as t1, Tournaments as t2 # WHERE t1.CreatedAt>$d AND t2.ParentId=t1.Id GROUP BY t1.Id"); my ($sth) = $dbh->prepare("SELECT t1.Id, t1.FileName, t1.Type, count(t2.Id) FROM Tournaments as t1 LEFT JOIN Tournaments as t2 - ON t2.ParentId=t1.id WHERE t1.CreatedAt>$d GROUP BY t1.Id"); + ON t2.ParentId=t1.id WHERE t1.CreatedAt>=$d GROUP BY t1.Id"); $sth->execute; my ($Id,$fname,$type,$c); while (($Id,$fname,$type,$c)=$sth->fetchrow,$Id) {