Changeset 449


Ignore:
Timestamp:
Jul 27, 2010, 5:06:18 PM (11 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Remove printFooter from CommonWeb?.pm
Add HTML::Template to main.cgi, admin.cgi, and search.cgi
Convert footer.inc to templates/footer.tmpl, and normalize
output for three scripts above
See #3.

Location:
branches/htmlform/cgi-bin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/CommonWeb.pm

    r447 r449  
    1616$VERSION     = 1.00;
    1717@ISA         = qw(Exporter);
    18 @EXPORT_OK      = qw(&printFooter &printHeader &printError &printAndExit &desanitize &cleanInput &desanitize);
     18@EXPORT_OK      = qw( &printHeader &printError &printAndExit &desanitize &cleanInput &desanitize);
    1919
    2020@EXPORT      = (); #export nothing by default
    21 %EXPORT_TAGS = ( ALL => [qw( &printFooter &printHeader &printError
     21%EXPORT_TAGS = ( ALL => [qw( &printHeader &printError
    2222                                &printAndExit &desanitize &cleanInput )],
    23                  lean    => [qw( &printFooter &printHeader &printError
     23                 lean    => [qw( &printHeader &printError
    2424                                &printAndExit &cleanInput )]
    2525                );
     
    4747}
    4848
    49 sub printFooter
    50 {
    51   open FILE, "../footer.inc"
    52         or croak $!;
    53   while (<FILE>)
    54   {
    55     print;
    56   }
    57   close FILE;
    58 }
    59 
    6049sub printError($)
    6150{
     
    7665        </center>
    7766        );
    78         printFooter();
     67        print "<br>would print footer but already dun gone and shot($self->foot)\n";
    7968        exit(0);
    8069}
  • branches/htmlform/cgi-bin/IPDB.pm

    r448 r449  
    121121    $IPDBacl{$data[0]} = $data[1];
    122122  }
     123
     124##fixme:  initialize HTML::Template env var for template path
     125# something like $self->path().'/templates' ?
     126#  $ENV{HTML_TEMPLATE_ROOT} = 'foo/bar';
    123127
    124128  return (1,"OK");
  • branches/htmlform/cgi-bin/admin.cgi

    r447 r449  
    1616use CGI::Carp qw(fatalsToBrowser);
    1717use CGI::Simple;
     18use HTML::Template;
    1819use DBI;
    1920use CommonWeb qw(:ALL);
     
    5152}
    5253initIPDBGlobals($ip_dbh);
     54
     55##fixme - need to autofill this somehow
     56$ENV{HTML_TEMPLATE_ROOT} = '/home/kdeugau/dev/ipdb/trunk/templates';
    5357
    5458if ($IPDBacl{$authuser} !~ /A/) {
     
    660664print qq(<hr><a href="/ip/">Back</a> to main interface</a>\n);
    661665
    662 printFooter;
     666# We print the footer here, so we don't have to do it elsewhere.
     667my $footer = HTML::Template->new(filename => "footer.tmpl");
     668# we're already in the admin tools, no need to provide a bottom link.  maybe.
     669#$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
     670
     671print $footer->output;
    663672
    664673$ip_dbh->disconnect;
  • branches/htmlform/cgi-bin/main.cgi

    r448 r449  
    1313use CGI::Carp qw(fatalsToBrowser);
    1414use CGI::Simple;
     15use HTML::Template;
    1516use DBI;
    1617use CommonWeb qw(:ALL);
     
    4950}
    5051initIPDBGlobals($ip_dbh);
     52
     53# Set up some globals
     54##fixme - need to autofill this somehow
     55$ENV{HTML_TEMPLATE_ROOT} = '/home/kdeugau/dev/ipdb/trunk/templates';
    5156
    5257# Headerize!  Make sure we replace the $$EXTRA0$$ bit as needed.
     
    173178finish($ip_dbh);
    174179
    175 print qq(<div align=right style="position: absolute; right: 30px;">).
    176         qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
    177         if $IPDBacl{$authuser} =~ /A/;
     180#print qq(<div align=right style="position: absolute; right: 30px;">).
     181#       qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
     182#       if $IPDBacl{$authuser} =~ /A/;
    178183
    179184# We print the footer here, so we don't have to do it elsewhere.
    180 printFooter;
     185my $footer = HTML::Template->new(filename => "footer.tmpl");
     186# include the admin tools link in the output?
     187$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
     188
     189print $footer->output;
     190
    181191# Just in case something waaaayyy down isn't in place
    182192# properly... we exit explicitly.
     
    11811191    # Relatively simple SQL transaction here.
    11821192    my $sql;
    1183 ##fixme:  SQL parameters (#34)
    1184 # need to make sure we log roughly the same info
    11851193    if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) {
    11861194      $sql = "update poolips set custid='$webvar{custid}',notes='$webvar{notes}',".
     
    14131421
    14141422
     1423# going, going, gone... this sub to be removed Any Day Real Soon Now(TM)
    14151424sub exitError {
    14161425  my $errStr = $_[0];
     
    14201429</center>
    14211430);
    1422   printFooter();
     1431
     1432  # We print the footer here, so we don't have to do it elsewhere.
     1433  my $footer = HTML::Template->new(filename => "footer.tmpl");
     1434  # include the admin tools link in the output?
     1435  $footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
     1436
     1437  print $footer->output;
     1438
    14231439  exit;
    14241440} # errorExit
  • branches/htmlform/cgi-bin/search.cgi

    r447 r449  
    1515use CGI::Carp qw(fatalsToBrowser);
    1616use CGI::Simple;
     17use HTML::Template;
    1718use DBI;
    1819use CommonWeb qw(:ALL);
     
    5354# Global variables
    5455my $RESULTS_PER_PAGE = 25;
     56##fixme - need to autofill this somehow
     57$ENV{HTML_TEMPLATE_ROOT} = '/home/kdeugau/dev/ipdb/trunk/templates';
    5558
    5659# Set up the CGI object...
     
    298301# Shut down and clean up.
    299302finish($ip_dbh);
    300 printFooter;
     303
     304# We print the footer here, so we don't have to do it elsewhere.
     305my $footer = HTML::Template->new(filename => "footer.tmpl");
     306# include the admin tools link in the output?
     307$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
     308
     309print $footer->output;
     310
    301311# We shouldn't need to directly execute any code below here;  it's all subroutines.
    302312exit 0;
Note: See TracChangeset for help on using the changeset viewer.