1 | #!/usr/bin/perl
|
---|
2 |
|
---|
3 | use usabcgi;
|
---|
4 |
|
---|
5 | print "Content-type:text/html\n\n";
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | $idno=$ENV{REMOTE_ADDR};
|
---|
11 | $idno =~ s/\.//g;
|
---|
12 | $idno =~ tr/0123456789/1357902468/;
|
---|
13 | $idno .= time;
|
---|
14 |
|
---|
15 | print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
|
---|
16 | print "<html>\n<head>\n<title>Greenstone Usability Thank you!</title>\n";
|
---|
17 | print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
|
---|
18 |
|
---|
19 | usabcgi::printstyle($ENV{HTTP_USER_AGENT});
|
---|
20 | usabcgi::printscript;
|
---|
21 | #print "timeleft=21;\n";
|
---|
22 | #print "function timerdisplay(){\n";
|
---|
23 | #print "\tif(eval(document.getElementById != undefined )){\n";
|
---|
24 | #print "\t\tif(parseInt(timeleft)>0){\n";
|
---|
25 | #print "\t\t\ttimeleft-=1;\n";
|
---|
26 | #print "\t\t\ttimeforscreen = timeleft+\' second\';\n";
|
---|
27 | #print "\t\t\tif(timeleft>1)\{ timeforscreen += \'s\';\}\n";
|
---|
28 | #print "\t\t\t\tdocument.getElementById(\'timer\').firstChild.nodeValue=timeforscreen;\n";
|
---|
29 | #print "\t\t\t\tsetTimeout(\'timerdisplay()\',1000);\n";
|
---|
30 | #print "\t\t}\n";
|
---|
31 | #print "\t}\n";
|
---|
32 | #print "}\n";
|
---|
33 | #print "\n";
|
---|
34 |
|
---|
35 | print "</head><body onLoad=\"if(parseInt(navigator.appVersion)>3)\{window.resizeTo(420,300);\}\" bgcolor=\"#FFFFFF\">\n";
|
---|
36 |
|
---|
37 | ($imageloc) = usabcgi::get_config_info("httpimg");
|
---|
38 | if(!($imageloc =~ "http")) {$imageloc="http://".$ENV{HTTP_HOST}.$imageloc;}
|
---|
39 | print "<table width=\"400px\"><tr>\n<td><h1>Greenstone Usability - Thank you</h1></td>\n";
|
---|
40 | print "<td align=\"right\">";
|
---|
41 | if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstone koru design\" title=\"Greenstone koru design\">"; }
|
---|
42 | print "</td>\n</tr></table>";
|
---|
43 |
|
---|
44 | ($fileoutloc) = usabcgi::get_config_info("gsdlhome");
|
---|
45 | if(!($fileoutloc =~/\/$/)) {$fileoutloc.="/";}
|
---|
46 | $fileoutloc .= "etc/usability.txt";
|
---|
47 |
|
---|
48 | if(!(-e $fileoutloc)){
|
---|
49 | open FILEOUT, (">>$fileoutloc");
|
---|
50 | }
|
---|
51 | else {
|
---|
52 | open FILEOUT, (">$fileoutloc");
|
---|
53 | }
|
---|
54 |
|
---|
55 | usabcgi::printaplinks;
|
---|
56 | print "<p>Your comments have been noted. <p>Thank you for helping us make Greenstone more usable.";
|
---|
57 | print "<table width=\"400px\"><tr>\n";
|
---|
58 | print "<td class=\"sans\"><a href=\"readresults.cgi?$idno\" target=\"_blank\">View report details</a></td>\n";
|
---|
59 | print "<td class=\"sans\"><a href=\"http://nzdl2.cs.waikato.ac.nz/dana/gsdl/test.html\" target=\"_blank\">Track report</a></td>";
|
---|
60 | print "<td align=\"right\"><form action=\"\"><button type=\"button\" onClick=\"window.close();\"><b>Close Window</b></button></form></td>\n";
|
---|
61 | print"</tr></table>\n";
|
---|
62 |
|
---|
63 |
|
---|
64 | #print "<h2>Your report ID number is: $idno</h2>";
|
---|
65 | #print "<p>The information has now been sent, thank-you. The information sent is displayed below. This window will close automatically after <span id=\"timer\">20 seconds</span>.";
|
---|
66 | read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
|
---|
67 | @pairs=split(/&/,$buffer);
|
---|
68 |
|
---|
69 | foreach $pair (@pairs) {
|
---|
70 | ($name, $value) = split(/=/,$pair);
|
---|
71 | $value=~ tr/+/ /;
|
---|
72 | $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
|
---|
73 | $FORM{$name} = $value;
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | if (-e $fileoutloc){
|
---|
79 | open FILEOUT, (">>$fileoutloc");
|
---|
80 | }
|
---|
81 | else { open FILEOUT, (">$fileoutloc") or print "cannot open file $fileoutloc\n"; }
|
---|
82 | #print FILEOUT "-------------------------------------\n";
|
---|
83 | print FILEOUT "report-id := $idno\&usabend;\n";
|
---|
84 | foreach $key (keys(%FORM)) {
|
---|
85 | if($key eq "URL") {
|
---|
86 | $url = $FORM{$key};
|
---|
87 | $url =~s/\&/\&\;/g;
|
---|
88 | }
|
---|
89 | print FILEOUT "$key := $FORM{$key}\&usabend;\n";
|
---|
90 | }
|
---|
91 | print FILEOUT "browser-read-by-server := $ENV{HTTP_USER_AGENT}\&usabend;\n";
|
---|
92 | print FILEOUT "browser-ip-no := $ENV{REMOTE_ADDR}\&usabend;\n";
|
---|
93 | print FILEOUT "server-ip-no := $ENV{SERVER_ADDR}\&usabend;\n";
|
---|
94 | print FILEOUT "time := ".scalar(localtime(time))."\&usabend;\n";
|
---|
95 | print FILEOUT "----------------------------------------------\n";
|
---|
96 | close (FILEOUT);
|
---|
97 |
|
---|
98 |
|
---|
99 | print"</body></html>\n";
|
---|
100 |
|
---|