File:  [LON-CAPA] / rat / Attic / lonftest.pm
Revision 1.1: download - view: text, annotated - select for diffs
Mon Sep 25 20:31:33 2000 UTC (23 years, 6 months ago) by www
Branches: MAIN
CVS tags: HEAD
New test file lonftest for demo purposes only
lonpage writes symbolic links

# 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>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="$ENV{'form.request.prefix'}store" type=hidden value='yes'>
    <input name="$ENV{'form.request.prefix'}top" type=text size=20>
    <input name="$ENV{'form.request.prefix'}bottom" type=text size=20>
    <input name="$ENV{'form.request.prefix'}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>