Diff for /loncom/homework/optionresponse.pm between versions 1.121 and 1.125

version 1.121, 2004/10/21 06:33:37 version 1.125, 2005/04/07 06:56:22
Line 29  package Apache::optionresponse; Line 29  package Apache::optionresponse;
 use strict;  use strict;
 use Apache::response();  use Apache::response();
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::lonnet;
   
 BEGIN {  BEGIN {
   &Apache::lonxml::register('Apache::optionresponse',('optionresponse'));    &Apache::lonxml::register('Apache::optionresponse',('optionresponse'));
Line 121  ENDTABLE Line 122  ENDTABLE
     my @options;      my @options;
     my $optchanged=0;      my $optchanged=0;
     eval '@options ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);      eval '@options ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
     if ($ENV{"form.$Apache::lonxml::curdepth.deleteopt"}) {      if ($env{"form.$Apache::lonxml::curdepth.deleteopt"}) {
       my $delopt=$ENV{"form.$Apache::lonxml::curdepth.deleteopt"};        my $delopt=$env{"form.$Apache::lonxml::curdepth.deleteopt"};
       &Apache::lonxml::debug("Deleting :$delopt:");        &Apache::lonxml::debug("Deleting :$delopt:");
       splice(@options,$delopt-1,1);        splice(@options,$delopt-1,1);
       $optchanged=1;        $optchanged=1;
     }      }
     if ($ENV{"form.$Apache::lonxml::curdepth.options"}) {      if ($env{"form.$Apache::lonxml::curdepth.options"}) {
       my $newopt = $ENV{"form.$Apache::lonxml::curdepth.options"};        my $newopt = $env{"form.$Apache::lonxml::curdepth.options"};
       if ($options[0]) {        if ($options[0]) {
  push(@options,$newopt);   push(@options,$newopt);
       } else {        } else {
Line 182  sub end_foilgroup { Line 183  sub end_foilgroup {
  my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";   my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
  push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt);   push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt);
     } elsif ( $target eq 'grade') {      } elsif ( $target eq 'grade') {
       if ( defined $ENV{'form.submitted'}) {        if ( &Apache::response::submitted()) {
  my @whichopt = &whichfoils($max,$randomize);   my @whichopt = &whichfoils($max,$randomize);
  my $temp=1;my $name;   my $temp=1;my $name;
  my %responsehash;   my %responsehash;
Line 192  sub end_foilgroup { Line 193  sub end_foilgroup {
  my $ignored=0;   my $ignored=0;
  foreach $name (@whichopt) {   foreach $name (@whichopt) {
   my $response=&Apache::response::getresponse($temp);    my $response=&Apache::response::getresponse($temp);
   if ($ENV{'form.submitted'} eq 'scantron' && $response=~/\S/) {    if ($env{'form.submitted'} eq 'scantron' && $response=~/\S/) {
       $response = $opt[$response];        $response = $opt[$response];
   }    }
   if ( $response =~ /[^\s]/) {    if ( $response =~ /[^\s]/) {
Line 511  sub bubbles { Line 512  sub bubbles {
     my $number_of_bubbles = $#opt + 1;      my $number_of_bubbles = $#opt + 1;
     my $current_length = 0;      my $current_length = 0;
     my $textwidth;      my $textwidth;
     if ($ENV{'form.textwidth'} ne '') {      if ($env{'form.textwidth'} ne '') {
  $ENV{'form.textwidth'}=~/(\d+)/;   $env{'form.textwidth'}=~/(\d+)/;
  $textwidth=$1;   $textwidth=$1;
     } else {      } else {
  $ENV{'textwidth'}=~/(\d*)\.?(\d*)/;   $env{'form.textwidth'}=~/(\d*)\.?(\d*)/;
  $textwidth=$1.'.'.$2;   $textwidth=$1.'.'.$2;
     }      }
     for (my $ind=0;$ind<=$number_of_bubbles;$ind++) {      for (my $ind=0;$ind<=$number_of_bubbles;$ind++) {
Line 623  sub end_foil { Line 624  sub end_foil {
   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer'     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' 
       || $target eq 'tex' || $target eq 'analyze') {        || $target eq 'tex' || $target eq 'analyze') {
     my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);      my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
       if ($target eq 'tex' && $Apache::lonhomework::type eq 'exam') {
    $text='\vskip 5mm $\triangleright$ '.$text;
       }
     if ($value ne 'unused') {      if ($value ne 'unused') {
       my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);        my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
       &Apache::lonxml::debug("Got a name of :$name:");        &Apache::lonxml::debug("Got a name of :$name:");
       if (!$name) { $name=$Apache::lonxml::curdepth; }        if (!$name) {
     &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
     $name=$Apache::lonxml::curdepth;
         }
       &Apache::lonxml::debug("Using a name of :$name:");        &Apache::lonxml::debug("Using a name of :$name:");
       if (defined($Apache::response::foilnames{$name})) {        if (defined($Apache::response::foilnames{$name})) {
   &Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));    &Apache::lonxml::error(&mt("Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.",$name));
Line 637  sub end_foil { Line 644  sub end_foil {
    && !&Apache::response::showallfoils() ) {     && !&Apache::response::showallfoils() ) {
  push @{ $Apache::response::conceptgroup{'names'} }, $name;   push @{ $Apache::response::conceptgroup{'names'} }, $name;
  $Apache::response::conceptgroup{"$name.value"} = $value;   $Apache::response::conceptgroup{"$name.value"} = $value;
  if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') {   $Apache::response::conceptgroup{"$name.text"} = $text;
     $Apache::response::conceptgroup{"$name.text"} = '\vskip 4 mm $\triangleright$ '.$text;  
  } else {  
     $Apache::response::conceptgroup{"$name.text"} = $text;  
  }  
  $Apache::response::conceptgroup{"$name.location"} = $location;   $Apache::response::conceptgroup{"$name.location"} = $location;
       } else {        } else {
  push @{ $Apache::response::foilgroup{'names'} }, $name;   push @{ $Apache::response::foilgroup{'names'} }, $name;
  $Apache::response::foilgroup{"$name.value"} = $value;   $Apache::response::foilgroup{"$name.value"} = $value;
  if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') {   $Apache::response::foilgroup{"$name.text"} = $text;
     $Apache::response::foilgroup{"$name.text"} = '\vskip 5 mm $\triangleright$ '.$text;  
  } else {  
     $Apache::response::foilgroup{"$name.text"} = $text;  
  }  
  $Apache::response::foilgroup{"$name.location"} = $location;   $Apache::response::foilgroup{"$name.location"} = $location;
       }        }
     }      }

Removed from v.1.121  
changed lines
  Added in v.1.125


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