[4071] | 1 | package usabcgi;
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | sub get_config_info {
|
---|
[7958] | 5 | open FILEIN, ("gsdlsite.cfg")
|
---|
| 6 | || die "ERROR: Could not open site configuration file\n";
|
---|
| 7 |
|
---|
[4071] | 8 | my $configfile;
|
---|
| 9 | while(<FILEIN>) {
|
---|
| 10 | $configfile .= $_;
|
---|
| 11 | }
|
---|
| 12 | close(FILEIN);
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | ($infotype) = @_;
|
---|
| 16 |
|
---|
[7765] | 17 | $configfile =~ /^$infotype\s+(\S+)\s*\n/m;
|
---|
[4071] | 18 | $loc=$1;
|
---|
| 19 | $loc =~ s/\"//g;
|
---|
[7958] | 20 |
|
---|
[4071] | 21 | return ($loc);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
[4084] | 24 | sub printscript {
|
---|
| 25 |
|
---|
| 26 | print "<script type=\"text/javascript\">\n";
|
---|
| 27 | print "\tfunction showaboutprivacy(url){\n";
|
---|
| 28 | print "\t\tinfowin=window.open(url,'infowin','toolbars=0, height=600, width=600')\n";
|
---|
| 29 | print "\t}\n";
|
---|
| 30 | print "</script>\n";
|
---|
| 31 | }
|
---|
| 32 |
|
---|
[4131] | 33 | sub printbanner {
|
---|
| 34 | ($title)=@_;
|
---|
| 35 | ($imageloc) = usabcgi::get_config_info("httpimg");
|
---|
| 36 | if(!($imageloc =~ "http")) {$imageloc="http://".$ENV{HTTP_HOST}.$imageloc;}
|
---|
| 37 | print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - $title</h1></td>\n";
|
---|
| 38 | print "<td align=\"right\">";
|
---|
| 39 | if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstone koru design\" title=\"Greenstone koru design\">"; }
|
---|
| 40 | print "</td>\n</tr></table>";
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[4084] | 43 | sub printaplinks {
|
---|
| 44 | print "<p class=\"sans\">\n";
|
---|
| 45 | print "<a href=\"javascript:showaboutprivacy('http://nzdl2.cs.waikato.ac.nz/dana/gsdl/about.html')\">About</a>\n • <a href=\"javascript:showaboutprivacy('http://nzdl2.cs.waikato.ac.nz/dana/gsdl/privacy.html')\">Privacy</a>\n";
|
---|
| 46 |
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | sub printstyle {
|
---|
| 50 | ($browser) = @_;
|
---|
| 51 | $browser=~/([^\/]*)\/([0-9]+\.[0-9]+)/;
|
---|
| 52 | if(($1 ne "Netscape")||($2 > 4.77)){
|
---|
| 53 | print "<style type=\"text/css\">\n";
|
---|
| 54 | print "\th1 {font-family: sans-serif; font-size: 20px}\n";
|
---|
[4088] | 55 | print "\th2 {font-family: sans-serif; font-size: 14px; font-weight: bold; color: #009966}\n";
|
---|
[4084] | 56 | print "\tp.sans {font-family: sans-serif}\n";
|
---|
[4131] | 57 | print "\ttd {vertical-align: top}\n";
|
---|
| 58 | print "\ttd.sans {font-family: sans-serif; width: 50%}\n";
|
---|
[4084] | 59 | print "</style>\n";
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[4131] | 64 | sub checkidno {
|
---|
| 65 | if((!($ENV{QUERY_STRING}=~/\d/)) || ($ENV{QUERY_STRING}=~/\D/) ) {
|
---|
| 66 | print "<h2>Each report sent has an ID number. This page needs one of those numbers to work.</h2>\n";
|
---|
| 67 | print "<br><br><p class=\"sans\"><a href=\"mailto:dmn@cs.waikato.ac.nz\">Contact us</a> with any queries about this.\n";
|
---|
| 68 | print "</body></html>\n";
|
---|
| 69 | die;
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
[4084] | 72 |
|
---|
[4131] | 73 | sub getusabreportdetails {
|
---|
| 74 | ($etcfileloc) = usabcgi::get_config_info("gsdlhome");
|
---|
| 75 | if(!($etcfileloc =~/\/$/)) {$etcfileloc.="/";}
|
---|
| 76 | $etcfileloc .= "etc/usability.txt";
|
---|
| 77 | open (FILEIN, $etcfileloc) or die "could not open usability.txt\n";
|
---|
| 78 | while(<FILEIN>){
|
---|
| 79 | $etcfile.=$_;
|
---|
| 80 | }
|
---|
| 81 | close(FILEIN);
|
---|
[4084] | 82 |
|
---|
[4131] | 83 | if(!($etcfile=~ / $ENV{QUERY_STRING}\&usabend;/)) {
|
---|
| 84 | print "<h2>Each report has an ID number. This program needs one of those ID numbers to work, and the ID number provided wasn't found.</h2>\n";
|
---|
| 85 | print "<br><br><p class=\"sans\"><a href=\"mailto:dmn@cs.waikato.ac.nz\">Contact us</a> with any queries about this.\n";
|
---|
| 86 | print "</body></html>";
|
---|
| 87 | die;
|
---|
| 88 | }
|
---|
[4084] | 89 |
|
---|
[4131] | 90 | #get the report for whjich details are to be viewed.
|
---|
| 91 | $etcfile=~/report-id := $ENV{QUERY_STRING}\&usabend\;\n/;
|
---|
| 92 | $report = $&;
|
---|
| 93 | $tmp=$';
|
---|
| 94 | $tmp=~/----------------------?/;
|
---|
| 95 | $report.=$`;
|
---|
| 96 | @pairs=split(/\&usabend\;\n/,$report);
|
---|
| 97 | foreach $pair (@pairs) {
|
---|
| 98 | ($name, $value)= split(/ := /,$pair);
|
---|
[5976] | 99 |
|
---|
[4176] | 100 | #this splits long values up for display purposes
|
---|
[5976] | 101 | @tmplist = split(/ /,$value);
|
---|
| 102 | foreach $item (@tmplist){
|
---|
| 103 | if(length $item > 60){
|
---|
| 104 | $tmp="";
|
---|
| 105 | while(length $item > 60){
|
---|
| 106 | $tmp.= substr $item, 0, 60;
|
---|
| 107 | $tmp.=" ";
|
---|
| 108 | $item = substr $item, 60;
|
---|
| 109 | }
|
---|
| 110 | $tmp.=$item;
|
---|
| 111 | $item=$tmp;
|
---|
| 112 | }
|
---|
[4176] | 113 | }
|
---|
[5976] | 114 | $value = join(' ',@tmplist);
|
---|
| 115 |
|
---|
[4131] | 116 | #this adds html tags for breaks
|
---|
| 117 | $value =~ s/\n/\<br\>\n/g;
|
---|
| 118 | $reportvals{$name}=$value;
|
---|
| 119 | }
|
---|
| 120 | return %reportvals;
|
---|
| 121 |
|
---|
| 122 | }
|
---|
| 123 |
|
---|
[4071] | 124 | 1;
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 |
|
---|
| 138 |
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 |
|
---|