Changeset 3961


Ignore:
Timestamp:
2003-03-24T17:18:23+12:00 (21 years ago)
Author:
dana
Message:

tidied up code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/cgi-bin/readresults.cgi

    r3905 r3961  
    3232
    3333
    34 if($ENV{QUERY_STRING}=~/\D/) { die "invalid report ID"; }
    35 
    36 
    3734print "<html><head><title>Greenstone Usability - Report Details</title>\n";
    3835$ENV{HTTP_USER_AGENT}=~/([^\/]*)\/([0-9]+\.[0-9]+)/;
     
    4643print "</head><body>\n";
    4744
     45print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - Report Details</h1></td>\n";
     46print "<td align=\"right\">";
     47if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstonekoru design\" title=\"Greenstone koru design\">"; }
     48print "</td>\n</tr></table>";
     49 
     50if((!($ENV{QUERY_STRING}=~/\d/)) || ($ENV{QUERY_STRING}=~/\D/) ) {
     51    print "<h2>Each report sent has an ID number.  This page needs one of those numbers to work.</h2></body></html>";
     52    die;
     53}
     54
    4855open (FILEIN, $etcfileloc) or die "could not open usability.txt\n";
    4956while(<FILEIN>){
    5057    $etcfile.=$_;
     58}   
     59close(FILEIN);
     60
     61if(!($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>";
     63    die;
    5164}
    52 print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - Report Details</h1></td>\n";
    53 print "<td align=\"right\">";
    54 if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstone
    55 koru design\" title=\"Greenstone koru design\">"; }
    56 print "</td>\n</tr></table>";
    57  
    58    
    59 close(FILEIN);
     65
     66#get the report for whjich details are to be viewed.
    6067$etcfile=~/report-id := $ENV{QUERY_STRING}\n/;
    6168$report =$&;
     
    6976}
    7077
     78
     79
    7180print "<p>Your automatically generated report ID number is: <b>$reportvals{\"report-id\"}</b>";
    7281delete $reportvals{"report-id"};
     
    7584print "<table><width=\"100%\">\n";
    7685
    77 print "<tr><td class=\"sans\" width=\"50%\"><b>The URL of the page where you were having problems:</b></td><td>$reportvals{\"URL\"}</td></tr>\n";
    78 delete $reportvals{"URL"};
    79 
    80 delete $reportvals{"report-id"};
    81 print "<tr><td class=\"sans\" width=\"50%\"><b>Time you opened the usability window:</b></td><td>$reportvals{\"opentime\"}</td></tr>\n";
    82 delete $reportvals{"opentime"};
    83 
    84 print "<tr><td class=\"sans\" width=\"50%\"><b>Time you sent the usability report:</b></td><td>$reportvals{\"sendtime\"}</td></tr>\n";
    85 delete $reportvals{"sendtime"};
    86 
    87 print "<tr><td class=\"sans\" width=\"50%\"><b>Time the server received the usability report:</b></td><td>$reportvals{\"time\"}</td></tr>\n";
    88 delete $reportvals{"time"};
    89 
    90 print "<tr><td class=\"sans\" width=\"50%\"><b>Your browser as it identifies itself:</b></td><td>$reportvals{\"browser\"}</td></tr>\n";
    91 delete $reportvals{"browser"};
    92 
    93 print "<tr><td class=\"sans\" width=\"50%\"><b>Your browser as identified by the server:</b></td><td>$reportvals{\"browser-read-by-server\"}</td></tr>\n";
    94 delete $reportvals{"browser-read-by-server"};
    95 
    96 print "<tr><td class=\"sans\" width=\"50%\"><b>The IP number of your browser:</b></td><td>$reportvals{\"browser-ip-no\"}</td></tr>\n";
    97 delete $reportvals{"browser-ip-no"};
    98 
    99 print "<tr><td class=\"sans\" width=\"50%\"><b>The IP number of ther server:</b></td><td>$reportvals{\"server-ip-no\"}";
    100 delete $reportvals{"server-ip-no"};
    101 
    102 print "<tr><td class=\"sans\" width=\"50%\"><b>Your language as recorded by your web browser:</b></td><td>$reportvals{\"language\"}</td></tr>\n";
    103 delete $reportvals{"language"};
    104 
    105 print "<tr><td class=\"sans\" width=\"50%\"><b>The resolution of your screen:</b></td><td>$reportvals{\"resolution\"}</td></tr>\n";
    106 delete $reportvals{"resolution"};
    107 
    108 print "<tr><td class=\"sans\" width=\"50%\"><b>The colour of your screen (if any):</b></td><td>$reportvals{\"screencolour\"}</td></tr>\n";
    109 delete $reportvals{"screencolour"};
    110 
    111 print "<tr><td class=\"sans\" width=\"50%\"><b>The number of bits per pixel your display uses to represent colour:</b></td><td>$reportvals{\"pixeldpeth\"}</td></tr>\n";
    112 delete $reportvals{"pixeldepth"};
     86make_table_entry("The URL of the page where you were having problems","URL");
     87make_table_entry("Time you opened the usability report window","opentime");
     88make_table_entry("Time you sent the usability report","sendtime");
     89make_table_entry("Time the report was received by the server","time");
     90make_table_entry("Your browser as it identifies itself","browser");
     91make_table_entry("Your browser as the server identifies it","browser-read-by-server");
     92make_table_entry("Your browser's IP number","browser-ip-no");
     93make_table_entry("The server's IP number","server-ip-no");
     94make_table_entry("Your language as recorded by your browser","language");
     95make_table_entry("The resolution of your screen","resolution");
     96make_table_entry("The colour of your screen","screencolour");
     97make_table_entry("The number of bits per pixel your display uses to represent colour","pixeldepth");
    11398print"</table>";
    11499
    115 print "<h2>You provided us with the following information about the problem</h2>\n";
     100print "<h2>You provided us with the following extra information about the problem</h2>\n";
    116101
    117102print"<table>\n";
    118 
    119 print "<tr><td class=\"sans\" width=\"50%\"><b>How bad the problem was:</b></td><td>$reportvals{\"severity\"}</td></tr>\n";
    120 delete $reportvals{"severity"};
    121 
    122 print "<tr><td class=\"sans\" width=\"50%\"><b>What kind of problem it was:</b></td><td>$reportvals{\"probtype\"}</td></tr>\n";
    123 delete $reportvals{"probtype"};
    124 
    125 print "<tr><td class=\"sans\" width=\"50%\"><b>Other details:</b></td><td>$reportvals{\"moredetails\"}</td></tr>\n";
    126 delete $reportvals{"moredetails"};
    127 
    128 print"</table>\n";
     103make_table_entry("How bad the problem was","severity");
     104make_table_entry("What kind of problem it was","probtype");
     105make_table_entry("Other details","moredetails");
     106print "</table>\n";
    129107
    130108print "<h2>The following data was automatically collected from the form on the greenstone interface</h2>\n";
     
    141119print "</body></html>";
    142120
     121#This function takes a key into the report values interface, and a desription
     122# of what that entry means, and makes a properly formatted html table entry
     123sub make_table_entry {
     124    local ($desc, $entry) = @_;
     125    print "<tr><td class=\"sans\" width=\"50%\"><b>$desc:</b></td>";
     126    print "<td>$reportvals{$entry}</td></tr>\n";
     127    delete $reportvals{$entry};
     128}
    143129
    144130
     
    153139
    154140
     141
Note: See TracChangeset for help on using the changeset viewer.