Diff for /loncom/homework/optionresponse.pm between versions 1.1 and 1.4

version 1.1, 2001/01/19 21:44:51 version 1.4, 2001/02/22 00:49:03
Line 1 Line 1
 # The LearningOnline Network with CAPA  # The LearningOnline Network with CAPA
 # option list style responses  # option list style responses
   # 2/21 Guy
 package Apache::optionresponse;  package Apache::optionresponse;
 use strict;  use strict;
   
Line 11  sub BEGIN { Line 11  sub BEGIN {
 sub start_optionresponse {  sub start_optionresponse {
   my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;    my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
   #when in a radiobutton response use these    #when in a radiobutton response use these
   &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil'));    &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
   my $id = &Apache::response::start_response($parstack,$safeeval);    my $id = &Apache::response::start_response($parstack,$safeeval);
   return '';    return '';
 }  }
Line 64  sub end_foilgroup { Line 64  sub end_foilgroup {
   my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"};    my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"};
   $allresponse.="$response:";    $allresponse.="$response:";
   if ( $response =~ /[^\s]/) {    if ( $response =~ /[^\s]/) {
     &Apache::lonxml::debug("submitted a $response<br>\n");      &Apache::lonxml::debug("submitted a $response<br />\n");
     my $value=$Apache::response::foilgroup{$name.'.value'};      my $value=$Apache::response::foilgroup{$name.'.value'};
     if ($value eq $response) {$right++;} else {$wrong++;}      if ($value eq $response) {$right++;} else {$wrong++;}
   }    }
Line 137  sub displayfoils { Line 137  sub displayfoils {
   return $result."<br />";    return $result."<br />";
 }  }
   
   sub start_conceptgroup {
   }
   
   sub end_conceptgroup {
   }
   
 sub start_foil {  sub start_foil {
   $Apache::lonxml::redirection--;    my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
     if ($target eq 'web') { &Apache::lonxml::startredirection; }
   return '';    return '';
 }  }
   
 sub end_foil {  sub end_foil {
   my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;    my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
     my $text ='';
     if ($target eq 'web') { $text=&Apache::lonxml::endredirection; }
   if ($target eq 'web' || $target eq 'grade') {    if ($target eq 'web' || $target eq 'grade') {
     my $args ='';      my $args ='';
     if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }      if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
Line 152  sub end_foil { Line 161  sub end_foil {
       my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);        my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
       push @{ $Apache::response::foilgroup{'names'} }, $name;        push @{ $Apache::response::foilgroup{'names'} }, $name;
       $Apache::response::foilgroup{"$name.value"} = $value;        $Apache::response::foilgroup{"$name.value"} = $value;
       $Apache::response::foilgroup{"$name.text"} = $Apache::lonxml::outputstack;        $Apache::response::foilgroup{"$name.text"} = $text;
     }      }
   }    }
     
   $Apache::lonxml::redirection++;  
   if ($Apache::lonxml::redirection == 1) {   
     $Apache::lonxml::outputstack='';   
   }  
   return '';    return '';
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.4


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