Changeset 4073
- Timestamp:
- 2003-04-02T00:10:06+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/cgi-bin/readresults.cgi
r3961 r4073 1 1 #!/usr/bin/perl 2 2 3 use usabcgi; 4 3 5 print "Content-type:text/html\n\n"; 4 5 open(FILEIN, "gsdlsite.cfg") or die "Could not open site configuration file\n";6 @config=<FILEIN>;7 close(FILEIN);8 9 foreach $line (@config)10 {11 if($line=~/(gsdlhome)\s+(\S+)/)12 {13 $etcfileloc=$2;14 $etcfileloc =~ s/\"//g;15 if(!($etcfileloc=~ /\/$/)) {$etcfileloc.="/"; }16 $etcfileloc.= "etc/usability.txt";17 }18 elsif($line=~/(httpimg)\s+(\S+)/)19 {20 $imageloc =$2;21 if(!($2=~/http/)){22 $imageloc="http://".$ENV{HTTP_HOST}."\/".$2;23 }24 }25 26 }27 28 if(!($etcfileloc=~/etc\/usability\.txt/))29 {30 die "Could not open log file etc/usability.txt\n";31 }32 6 33 7 … … 37 11 print "<style type=\"text/css\">\n"; 38 12 print "\th1 \{font-family: sans-serif; font-size: 20px}\n"; 39 print "\th2 \{font-family: sans-serif; font-size: 14px; color: #009966\}\n"; 40 print "\ttd.sans {font-family:sans-serif; width: 50% }\n";13 print "\th2 \{font-family: sans-serif; font-size: 14px; color: #009966\}\n"; 14 print "\ttd.sans {font-family:sans-serif; width: 50%; vertical-align:top}\n"; 41 15 print "</style>\n" 42 16 } 43 17 print "</head><body>\n"; 18 19 ($imageloc) = usabcgi::get_config_info("httpimg"); 20 if(!($imageloc =~ "http")) {$imageloc="http://".$ENV{HTTP_HOST}.$imageloc;} 44 21 45 22 print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - Report Details</h1></td>\n"; … … 53 30 } 54 31 32 ($etcfileloc) = usabcgi::get_config_info("gsdlhome"); 33 if(!($etcfileloc =~/\/$/)) {$etcfileloc.="/";} 34 $etcfileloc .= "etc/usability.txt"; 55 35 open (FILEIN, $etcfileloc) or die "could not open usability.txt\n"; 56 36 while(<FILEIN>){ … … 60 40 61 41 if(!($etcfile=~ /$ENV{QUERY_STRING}/)) { 62 print "<h2>Each report sent has an ID number. This program needs one of those ID numbers to work, and the ID number provided wans't found</h2></body></html>"; 42 print "<h2>Each report sent has an ID number. This program needs one of those ID numbers to work, and the ID number provided wans't found</h2></body></html>"; 63 43 die; 64 44 } 65 45 66 46 #get the report for whjich details are to be viewed. 67 $etcfile=~/report-id := $ENV{QUERY_STRING}\ n/;68 $report = $&;47 $etcfile=~/report-id := $ENV{QUERY_STRING}\&usabend\;\n/; 48 $report = $&; 69 49 $tmp=$'; 70 $tmp=~/---------------------- /;50 $tmp=~/----------------------?/; 71 51 $report.=$`; 72 @pairs=split(/\ n/,$report);52 @pairs=split(/\&usabend\;\n/,$report); 73 53 foreach $pair (@pairs) { 74 54 ($name, $value)= split(/ := /,$pair); 55 #this adds html tags for breaks 56 $value =~ s/\n/\<br\>/g; 75 57 $reportvals{$name}=$value; 76 58 } 59 77 60 78 61 … … 126 109 print "<td>$reportvals{$entry}</td></tr>\n"; 127 110 delete $reportvals{$entry}; 111 128 112 } 129 113
Note:
See TracChangeset
for help on using the changeset viewer.