File:  [LON-CAPA] / loncom / homework / inputtags.pm
Revision 1.6: download - view: text, annotated - select for diffs
Wed Oct 11 21:01:25 2000 UTC (23 years, 8 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- added <textarea>
- added <datasubmission> (like answergroup but should store the included
    fields in a place and with a method not yet determined)

    1: # The LearningOnline Network with CAPA
    2: # input  definitons
    3: 
    4: package Apache::inputtags;
    5: use strict;
    6: 
    7: sub BEGIN {
    8:   &Apache::lonxml::register('Apache::inputtags',('textarea','textline','answergroup','datasubmission'));
    9: }
   10: 
   11: sub initialize_inputtags {
   12:   $Apache::inputtags::curvalue=0;
   13: }
   14: 
   15: sub start_textarea {
   16:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   17:   my $result = "";
   18:   $Apache::inputtags::curvalue++;
   19:   if ($target eq 'web') {
   20:     $result= '<textarea name="'.$ENV{'form.request.prefix'}.'HWVAL'.$Apache::inputtags::curvalue.'" value="">';
   21:   }
   22:   return $result;
   23: }
   24: 
   25: sub end_textarea {
   26:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   27:   return "</textarea>";
   28: }
   29: 
   30: sub start_textline {
   31:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   32:   my $result = "";
   33:   $Apache::inputtags::curvalue++;
   34:   my $args ='';
   35:   if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
   36:   my $size = &Apache::run::run("{$args;".'return $size}',$safeeval);
   37:   if ($size eq '') { $size=20; }
   38:   if ($target eq 'web') {
   39:     $result= '<input type="text" name="'.$ENV{'form.request.prefix'}.'HWVAL'.$Apache::inputtags::curvalue.'" value="" size="'.$size.'">';
   40:   }
   41:   return $result;
   42: }
   43: 
   44: sub end_textline {
   45:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   46:   return "";
   47: }
   48: 
   49: sub start_answergroup {
   50: }
   51: 
   52: sub end_answergroup {
   53:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   54:   if ( $target == 'web' ) {
   55:     return '<input type="submit" name="'.$ENV{'form.request.prefix'}.'submit" value="Submit All Answers">';
   56:   }
   57: }
   58: 
   59: 
   60: sub start_datasubmission {
   61: }
   62: 
   63: sub end_datasubmission {
   64:   my ($target,$token,$parstack,$parser,$safeeval)=@_;
   65:   if ( $target == 'web' ) {
   66:     return '<input type="submit" name="'.$ENV{'form.request.prefix'}.'submit" value="Submit All Data">';
   67:   }
   68: }
   69: 
   70: 1;
   71: __END__
   72:  

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