Annotation of rat/lonftest.pm, revision 1.1

1.1     ! www         1: # TRASH FORM TESTER TRASH
        !             2: #
        !             3: #
        !             4: # The LearningOnline Network with CAPA
        !             5: # TeX Content Handler
        !             6: #
        !             7: # 05/29/00,05/30 Gerd Kortemeyer
        !             8: 
        !             9: package Apache::lonftest;
        !            10: 
        !            11: use strict;
        !            12: 
        !            13: use Apache::Constants qw(:common);
        !            14: 
        !            15: 
        !            16: # ================================================================ Main Handler
        !            17: 
        !            18: sub handler {
        !            19:   my $r=shift;
        !            20: 
        !            21: # ----------------------------------------------------------- Set document type
        !            22: 
        !            23:     $r->content_type('text/html');
        !            24: 
        !            25:   $r->send_http_header;
        !            26: 
        !            27:   return OK if $r->header_only;
        !            28: 
        !            29: # -------------------------------------------------------------------- This URL
        !            30: 
        !            31:   my $thisurl=$r->uri;
        !            32: 
        !            33: # --------------------------------------------------------------- Render Output
        !            34:   
        !            35:   $r->print(<<ENDSTART);
        !            36: <html>
        !            37:   <body bgcolor="#EEFFCC" test="#112233" link="#332211" vlink="#442222"
        !            38:    alink="#FF0000">
        !            39: <h1>Form Test</h1>
        !            40: ENDSTART
        !            41: 
        !            42: # ---------------------------------------------------------------- Hash Restore
        !            43: 
        !            44:     $r->print("<h2>Restored Hash</h2>");
        !            45: 
        !            46:     my %hash=&Apache::lonnet::restore();
        !            47:   map {
        !            48:       $r->print($_.' : '.$hash{$_}.'<br>');
        !            49:   } sort keys %hash;
        !            50: 
        !            51: # ------------------------------------------------------------------------ form
        !            52: 
        !            53:   $r->print(<<ENDFORM);
        !            54: <h2>Form</h2>
        !            55: <form action="$thisurl" method="post">
        !            56:     <input name="$ENV{'form.request.prefix'}store" type=hidden value='yes'>
        !            57:     <input name="$ENV{'form.request.prefix'}top" type=text size=20>
        !            58:     <input name="$ENV{'form.request.prefix'}bottom" type=text size=20>
        !            59:     <input name="$ENV{'form.request.prefix'}submit" type=submit value="Yeah!">
        !            60: </form>
        !            61: ENDFORM
        !            62: 
        !            63:   if ($ENV{'form.store'}) {
        !            64:     $r->print('<h2>New Data</h2>');
        !            65:     $r->print("top: $ENV{'form.top'}<br>bottom: $ENV{'form.bottom'}<br>");
        !            66:      $r->print('<p>Storing: '. 
        !            67:         &Apache::lonnet::store('top'    => $ENV{'form.top'},
        !            68:                                'bottom' => $ENV{'form.bottom'}));
        !            69:   }
        !            70:   $r->print('</body></html>');
        !            71:   return OK;
        !            72: }
        !            73: 
        !            74: 1;
        !            75: __END__
        !            76: 
        !            77: 
        !            78: 
        !            79: 
        !            80: 
        !            81: 
        !            82: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>