Changeset 4131


Ignore:
Timestamp:
2003-04-11T17:55:03+12:00 (21 years ago)
Author:
dana
Message:

improving cgi library, functionality

Location:
trunk/gsdl/cgi-bin
Files:
3 edited

Legend:

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

    r4088 r4131  
    3535print "</head><body onLoad=\"if(parseInt(navigator.appVersion)>3)\{window.resizeTo(420,300);\}\" bgcolor=\"#FFFFFF\">\n";
    3636
    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>";
     37
     38usabcgi::printbanner("Thank You");
    4339
    4440($fileoutloc) = usabcgi::get_config_info("gsdlhome");
     
    5450
    5551usabcgi::printaplinks;
    56 print "<p>Your comments have been noted. <p>Thank you for helping us make Greenstone more usable.";
     52print "<p>Your comments have been noted. <p>Thank you for helping us make Greenstone more usable.</p>\n";
    5753print "<table width=\"400px\"><tr>\n";
    5854print "<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";
     55print "<td class=\"sans\"><a href=\"trackreport.cgi?$idno\" target=\"_blank\">Track report</a></td>";
     56print "<td align=\"right\"><form action=\"\"><button type=\"button\" onClick=\"window.close();\"><strong>Close Window</strong></button></form></td>\n";
    6157print"</tr></table>\n";
    6258
  • trunk/gsdl/cgi-bin/readresults.cgi

    r4114 r4131  
    1212print "</head><body bgcolor=\"#ffffff\">\n";
    1313
    14 ($imageloc) = usabcgi::get_config_info("httpimg");
    15 if(!($imageloc =~ "http")) {$imageloc="http://".$ENV{HTTP_HOST}.$imageloc;}
    16 
    17 print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - Report Details</h1></td>\n";
    18 print "<td align=\"right\">";
    19 if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstonekoru design\" title=\"Greenstone koru design\">"; }
    20 print "</td>\n</tr></table>";
     14usabcgi::printbanner("Report Details");
    2115usabcgi::printaplinks;
    2216 
    23 if((!($ENV{QUERY_STRING}=~/\d/)) || ($ENV{QUERY_STRING}=~/\D/) ) {
    24     print "<h2>Each report sent has an ID number.  This page needs one of those numbers to work.</h2></body></html>";
    25     die;
    26 }
     17usabcgi::checkidno;
    2718
    28 ($etcfileloc) = usabcgi::get_config_info("gsdlhome");
    29 if(!($etcfileloc =~/\/$/)) {$etcfileloc.="/";}
    30 $etcfileloc .= "etc/usability.txt";
    31 open (FILEIN, $etcfileloc) or die "could not open usability.txt\n";
    32 while(<FILEIN>){
    33     $etcfile.=$_;
    34 }   
    35 close(FILEIN);
    36 
    37 if(!($etcfile=~ /$ENV{QUERY_STRING}/)) {
    38     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>"; 
    39     die;
    40 }
    41 
    42 #get the report for whjich details are to be viewed.
    43 $etcfile=~/report-id := $ENV{QUERY_STRING}\&usabend\;\n/;
    44 $report = $&;
    45 $tmp=$';
    46 $tmp=~/----------------------?/;
    47 $report.=$`;
    48 @pairs=split(/\&usabend\;\n/,$report);
    49 foreach $pair (@pairs) {
    50     ($name, $value)= split(/ := /,$pair);
    51     #this adds html tags for breaks
    52     $value =~ s/\n/\<br\>/g;
    53     $reportvals{$name}=$value;
    54 }
    55 
    56 
    57 
     19%reportvals=usabcgi::getusabreportdetails;
    5820
    5921print "<p>Your automatically generated report ID number is: <b>$reportvals{\"report-id\"}</b>";
     
    9355
    9456foreach $key (keys(%reportvals)){
    95     $key=~/-/;
    96     print "<tr><td>$`</td><td>$'</td><td>$reportvals{$key}</td></tr>\n";
     57    if($key ne "update"){
     58    $key=~/-/;
     59    print "<tr><td>$`</td><td>$'</td><td>$reportvals{$key}</td></tr>\n";
     60    }
    9761}
    9862print "</table>\n";
     
    10670sub make_table_entry {
    10771    local ($desc, $entry) = @_;
    108     print "<tr><td class=\"sans\" width=\"50%\"><b>$desc:</b></td>";
     72    print "<tr><td class=\"sans\" width=\"50%\"><strong>$desc:</strong></td>";
    10973    print "<td>$reportvals{$entry}</td></tr>\n";
    11074    delete $reportvals{$entry};
  • trunk/gsdl/cgi-bin/usabcgi.pm

    r4113 r4131  
    2828}
    2929
     30sub printbanner {
     31    ($title)=@_;
     32    ($imageloc) = usabcgi::get_config_info("httpimg");
     33    if(!($imageloc =~ "http")) {$imageloc="http://".$ENV{HTTP_HOST}.$imageloc;}
     34    print "<table width=\"100%\"><tr>\n<td><h1>Greenstone Usability - $title</h1></td>\n";
     35    print "<td align=\"right\">";
     36    if ($imageloc) { print "<img src=\"$imageloc\/usabbanner.gif\" alt=\"Greenstone koru design\" title=\"Greenstone koru design\">"; }
     37    print "</td>\n</tr></table>";
     38}
     39
    3040sub printaplinks {
    3141    print "<p class=\"sans\">\n";
     
    4252    print "\th2 {font-family: sans-serif; font-size: 14px; font-weight: bold; color: #009966}\n";
    4353    print "\tp.sans {font-family: sans-serif}\n";
    44     print "\ttd.sans {font-family: sans-serif; width: 50%; vertical-align: top}\n";
     54    print "\ttd {vertical-align: top}\n";
     55    print "\ttd.sans {font-family: sans-serif; width: 50%}\n";
    4556    print "</style>\n";
    4657    }
     
    4859}
    4960
     61sub checkidno {
     62    if((!($ENV{QUERY_STRING}=~/\d/)) || ($ENV{QUERY_STRING}=~/\D/) ) {
     63    print "<h2>Each report sent has an ID number.  This page needs one of those numbers to work.</h2>\n";
     64    print "<br><br><p class=\"sans\"><a href=\"mailto:dmn&#064;cs.waikato.ac.nz\">Contact us</a> with any queries about this.\n";
     65    print "</body></html>\n";
     66    die;
     67    }
     68}
    5069
     70sub getusabreportdetails {
     71    ($etcfileloc) = usabcgi::get_config_info("gsdlhome");
     72    if(!($etcfileloc =~/\/$/)) {$etcfileloc.="/";}
     73    $etcfileloc .= "etc/usability.txt";
     74    open (FILEIN, $etcfileloc) or die "could not open usability.txt\n";
     75    while(<FILEIN>){
     76    $etcfile.=$_;
     77    }   
     78    close(FILEIN);
    5179
     80    if(!($etcfile=~ / $ENV{QUERY_STRING}\&usabend;/)) {
     81    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";
     82    print "<br><br><p class=\"sans\"><a href=\"mailto:dmn&#064;cs.waikato.ac.nz\">Contact us</a> with any queries about this.\n";
     83    print "</body></html>"; 
     84        die;
     85    }
     86
     87#get the report for whjich details are to be viewed.
     88    $etcfile=~/report-id := $ENV{QUERY_STRING}\&usabend\;\n/;
     89    $report = $&;
     90    $tmp=$';
     91    $tmp=~/----------------------?/;
     92    $report.=$`;
     93    @pairs=split(/\&usabend\;\n/,$report);
     94    foreach $pair (@pairs) {
     95    ($name, $value)= split(/ := /,$pair);
     96    #this adds html tags for breaks
     97    $value =~ s/\n/\<br\>\n/g;
     98    $reportvals{$name}=$value;
     99    }
     100    return %reportvals;
     101
     102}   
    52103
    531041;
Note: See TracChangeset for help on using the changeset viewer.