Changeset 495


Ignore:
Timestamp:
09/23/10 22:44:04 (14 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Converted main.cgi "invalid action" into template. See #3.
"Cleaned up" error messages for an invalid action, removed call to printAndExit(). See #15, #26.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/main.cgi

    r493 r495  
    8787}
    8888
    89 my $page = HTML::Template->new(filename => "$webvar{action}.tmpl");
     89my $page;
     90if (-e "$ENV{HTML_TEMPLATE_ROOT}/admin/$webvar{action}.tmpl") {
     91  $page = HTML::Template->new(filename => "$webvar{action}.tmpl");
     92} else {
     93  $page = HTML::Template->new(filename => "dunno.tmpl");
     94}
    9095
    9196if($webvar{action} eq 'index') {
     
    164169}
    165170
    166 # Default is an error.  It shouldn't be possible to easily get here.
    167 # The only way I can think of offhand is to just call main.cgi bare-
    168 # which is not in any way guaranteed to provide anything useful.
     171# Default is an error.  It shouldn't be possible to get here unless you're
     172# randomly feeding in values for webvar{action}.
    169173else {
    170174  my $rnd = rand 500;
    171175  my $boing = sprintf("%.2f", rand 500);
    172   my @excuses = ("Aether cloudy.  Ask again later.","The gods are unhappy with your sacrifice.",
    173         "Because one of it's legs are both the same", "*wibble*",
    174         "Hey! Stop pushing my buttons!", "I ain't done nuttin'", "9",
    175         "8", "9", "10", "11", "12", "13", "14", "15", "16", "17");
    176   printAndExit("Error $boing:  ".$excuses[$rnd/30.0]);
     176  my @excuses = (
     177        "Aether cloudy.  Ask again later about $webvar{action}.",
     178        "The gods are unhappy with your sacrificial $webvar{action}.",
     179        "Because one of $webvar{action}'s legs are both the same",
     180        "<b>wibble</b><br>Can't $webvar{action}, the grue will get me!<br>Can't $webvar{action}, the grue will get me!",
     181        "Hey, man, you've had your free $webvar{action}.  Next one's gonna...  <i>cost</i>....",
     182        "I ain't done $webvar{action}",
     183        "Oooo, look!  A flying $webvar{action}!",
     184        "$webvar{action} too evil, avoiding.",
     185        "Rocks fall, $webvar{action} dies.",
     186        "Bit bucket must be emptied before I can $webvar{action}..."
     187        );
     188  $page->param(dunno => $excuses[$rnd/50.0]);
    177189}
    178190## Finally! Done with that NASTY "case" emulation!
Note: See TracChangeset for help on using the changeset viewer.