File:  [LON-CAPA] / rat / Attic / lonftest.pm
Revision 1.3: download - view: text, annotated - select for diffs
Mon Nov 13 18:15:54 2000 UTC (24 years ago) by www
Branches: MAIN
CVS tags: HEAD
lonpage adds form prefix

# TRASH FORM TESTER TRASH
#
#
# The LearningOnline Network with CAPA
# TeX Content Handler
#
# 05/29/00,05/30 Gerd Kortemeyer

package Apache::lonftest;

use strict;

use Apache::Constants qw(:common);


# ================================================================ Main Handler

sub handler {
  my $r=shift;

# ----------------------------------------------------------- Set document type

    $r->content_type('text/html');

  $r->send_http_header;

  return OK if $r->header_only;

# -------------------------------------------------------------------- This URL

  my $thisurl=$r->uri;

# --------------------------------------------------------------- Render Output
  
  $r->print(<<ENDSTART);
<html>
  <body bgcolor="#EEFFCC" test="#112233" link="#332211" vlink="#442222"
   alink="#FF0000">
<h1>Form Test</h1>
ENDSTART

# ---------------------------------------------------------------- Hash Restore
    $r->print("<h2>Random Seed</h2>".&Apache::lonnet::rndseed());
    $r->print("<h2>Restored Hash</h2>");

    my %hash=&Apache::lonnet::restore();
  map {
      $r->print($_.' : '.$hash{$_}.'<br>');
  } sort keys %hash;

# ------------------------------------------------------------------------ form

  $r->print(<<ENDFORM);
<h2>Form</h2>
<form action="$thisurl" method="post">
    <input name="store" type=hidden value='yes'>
    <input name="top" type=text size=20>
    <input name="bottom" type=text size=20>
    <input name="submit" type=submit value="Yeah!">
</form>
ENDFORM

  if ($ENV{'form.store'}) {
    $r->print('<h2>New Data</h2>');
    $r->print("top: $ENV{'form.top'}<br>bottom: $ENV{'form.bottom'}<br>");
     $r->print('<p>Storing: '. 
        &Apache::lonnet::store('top'    => $ENV{'form.top'},
                               'bottom' => $ENV{'form.bottom'}));
  }
  $r->print('</body></html>');
  return OK;
}

1;
__END__








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