Diff for /loncom/homework/imageresponse.pm between versions 1.27 and 1.30

version 1.27, 2003/05/06 11:54:08 version 1.30, 2003/06/09 22:31:56
Line 51  sub start_imageresponse { Line 51  sub start_imageresponse {
 }  }
   
 sub end_imageresponse {  sub end_imageresponse {
   &Apache::response::end_response;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   pop @Apache::lonxml::namespace;      &Apache::response::end_response;
   &Apache::lonxml::deregister('Apache::imageresponse',('foilgroup','foil','text','image','rectangle','conceptgroup'));      pop @Apache::lonxml::namespace;
   return '';      &Apache::lonxml::deregister('Apache::imageresponse',('foilgroup','foil','text','image','rectangle','conceptgroup'));
       my $result;
       if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
       return $result;
 }  }
   
 %Apache::response::foilgroup=();  %Apache::response::foilgroup=();
Line 103  sub displayfoils { Line 106  sub displayfoils {
   my $temp=1;    my $temp=1;
   foreach $name (@whichopt) {    foreach $name (@whichopt) {
     $result.=$Apache::response::foilgroup{"$name.text"};      $result.=$Apache::response::foilgroup{"$name.text"};
       &Apache::lonxml::debug("Text is $result");
     if ($target eq 'tex') {$result.="\\vskip 0 mm \n";} else {$result.="<br />\n";}      if ($target eq 'tex') {$result.="\\vskip 0 mm \n";} else {$result.="<br />\n";}
     my $image=$Apache::response::foilgroup{"$name.image"};      my $image=$Apache::response::foilgroup{"$name.image"};
       &Apache::lonxml::debug("image is $image");
     if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ ) {      if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ ) {
       if ($target eq 'tex') {        if ($target eq 'tex') {
  $result.=$Apache::response::foilgroup{"$name.image"}."\\vskip 0 mm \n";   $result.=$Apache::response::foilgroup{"$name.image"}."\\vskip 0 mm \n";
Line 134  sub gradefoils { Line 139  sub gradefoils {
     $x=$ENV{"form.HWVAL_$id:$temp.x"};      $x=$ENV{"form.HWVAL_$id:$temp.x"};
     $y=$ENV{"form.HWVAL_$id:$temp.y"};      $y=$ENV{"form.HWVAL_$id:$temp.y"};
     &Apache::lonxml::debug("Got a x of $x and a y of $y for $name");      &Apache::lonxml::debug("Got a x of $x and a y of $y for $name");
     if (defined(@{ $Apache::response::foilgroup{"$name.area"} })) {      if (defined($x) && defined($y) &&
    defined(@{ $Apache::response::foilgroup{"$name.area"} })) {
       my @areas = @{ $Apache::response::foilgroup{"$name.area"} };        my @areas = @{ $Apache::response::foilgroup{"$name.area"} };
       my $grade="INCORRECT";        my $grade="INCORRECT";
       foreach my $area (@areas) {        foreach my $area (@areas) {
Line 170  sub end_foilgroup { Line 176  sub end_foilgroup {
     if ($count>$max) { $count=$max }      if ($count>$max) { $count=$max }
     &Apache::lonxml::debug("Count is $count from $max");      &Apache::lonxml::debug("Count is $count from $max");
     @whichopt = &whichfoils($max);      @whichopt = &whichfoils($max);
   } elsif ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
     $result=&displayfoils($target,@whichopt);   $result=&displayfoils($target,@whichopt);
   } elsif ($target eq 'grade') {      } elsif ($target eq 'grade') {
     if ( defined $ENV{'form.submitted'}) {   if ( defined $ENV{'form.submitted'}) { &gradefoils(@whichopt); }
       &gradefoils(@whichopt);      } 
     }  
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
       $result=&Apache::edit::end_table();        $result=&Apache::edit::end_table();
   }    }

Removed from v.1.27  
changed lines
  Added in v.1.30


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