Module: tools Branch: master Commit: f6524a41508b0c9728111bd0b039c6fad521115c URL: http://source.winehq.org/git/tools.git/?a=commit;h=f6524a41508b0c9728111bd0b...
Author: Jeremy Newman jnewman@codeweavers.com Date: Thu Oct 25 14:16:14 2007 -0500
adding an index CGI script for the tools website
---
winetest/site | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/winetest/site b/winetest/site new file mode 100755 index 0000000..95dd829 --- /dev/null +++ b/winetest/site @@ -0,0 +1,59 @@ +#!/usr/bin/perl + +# +# WineTest Index Script +# by Jeremy Newman jnewman@codeweavers.com +# + +# load CGI object +use CGI qw(:standard); +my $q = new CGI; + +# change url based on testing vars +if ($q->param('testing')) { + + # read testing dir + opendir(DIR, "./data/"); + my @files = readdir(DIR); + closedir(DIR); + splice(@files,0,2); + @files = sort {lc($a) cmp lc($b)} @files; + + # get only dirs + my @newFiles = (); + for (my $c = 0; $c < $#files; $c++) { + if (-d "./data/".$files[$c]) { + push(@newFiles, $files[$c]); + } + } + @files = @newFiles; + + # get current pos + my $curPos = 0; + for (my $c = 0; $c < $#files; $c++) { + if ($q->param('current') eq $files[$c]) { + $curPos = $c; + } + } + + # perform redirect based on vars + if ($curPos == 0 and $q->param('testing') eq "prev") { + print "Location: http://test.winehq.org/data/%22.$files%5B$#files%5D.%22%5Cn%5Cn"; + exit(); + } elsif ($curPos == $#files and $q->param('testing') eq "next") { + print "Location: http://test.winehq.org/data/%22.$files%5B0%5D.%22%5Cn%5Cn"; + exit(); + } elsif ($q->param('testing') eq "prev" and $files[$curPos - 1]) { + print "Location: http://test.winehq.org/data/%22.$files%5B$curPos - 1]."\n\n"; + exit(); + } elsif ($q->param('testing') eq "next" and $files[$curPos + 1]) { + print "Location: http://test.winehq.org/data/%22.$files%5B$curPos + 1]."\n\n"; + exit(); + } +} + +# redirect to data dir when no vars present +print "Location: http://test.winehq.org/data/%5Cn%5Cn"; + +# done +exit();