Diff for /loncom/homework/optionresponse.pm between versions 1.173.2.2 and 1.174

version 1.173.2.2, 2011/11/08 19:38:05 version 1.174, 2011/03/03 21:05:35
Line 155  ENDTABLE Line 155  ENDTABLE
       splice(@options,$delopt-1,1);        splice(@options,$delopt-1,1);
       $optchanged=1;        $optchanged=1;
     }      }
     if ($env{"form.$Apache::lonxml::curdepth.options"} ne '') {      if ($env{"form.$Apache::lonxml::curdepth.options"}) {
       my $newopt = $env{"form.$Apache::lonxml::curdepth.options"};        my $newopt = $env{"form.$Apache::lonxml::curdepth.options"};
       push(@options,$newopt);        if ($options[0]) {
    push(@options,$newopt);
         } else {
    $options[0]=$newopt;
         }
       $optchanged=1;        $optchanged=1;
     }      }
     my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,      my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,
Line 209  sub end_foilgroup { Line 213  sub end_foilgroup {
     my $randomize = &Apache::lonxml::get_param('randomize',$parstack,      my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
        $safeeval,'-2');         $safeeval,'-2');
     if ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
       $result.=&displayfoils($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,$tex_option_switch,@opt);        $result.=&displayfoils($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,@opt);
       $Apache::lonxml::post_evaluate=0;        $Apache::lonxml::post_evaluate=0;
     } elsif ( $target eq 'answer') {      } elsif ( $target eq 'answer') {
       $result.=&displayanswers($max,$randomize,@opt);        $result.=&displayanswers($max,$randomize,@opt);
Line 221  sub end_foilgroup { Line 225  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') {
         my $nonlenient=0;
         my $part=$Apache::inputtags::part;
         my $lenientparm=&Apache::lonnet::EXT("resource.$part.lenient");
   
         &Apache::lonnet::logthis("Parameter ".$part." ".$lenientparm);
   
         if ($Apache::lonhomework::scantronmode) {
            $nonlenient=0;
   # Grading an exam: we are grading lenient unless told not to
            if ($lenientparm=~/^0|off|no$/i) {
               $nonlenient=1;
            }
         } else {
   # Web mode: we are non-lenient unless told to
            $nonlenient=1;
            if ($lenientparm=~/^1|on|yes$/i) {
               $nonlenient=0;
            }
         }
         &Apache::lonnet::logthis("Non-Lenient set to ".$nonlenient);
       if ( &Apache::response::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;
Line 282  sub end_foilgroup { Line 306  sub end_foilgroup {
  my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='MISSING_ANSWER';   my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='MISSING_ANSWER';
  &Apache::response::handle_previous(\%previous,$ad);   &Apache::response::handle_previous(\%previous,$ad);
     }      }
  } elsif (!$Apache::lonhomework::scantronmode) {   } elsif ($nonlenient) {
   #
   # Non-lenient mode. All right or all wrong
   #
               &Apache::lonnet::logthis("In non-lenient");
     my $ad;      my $ad;
     if ($wrong==0 && $ignored==0) {      if ($wrong==0 && $ignored==0) {
  $ad='EXACT_ANS';   $ad='EXACT_ANS';
Line 298  sub end_foilgroup { Line 326  sub end_foilgroup {
     $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;      $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
     &Apache::response::handle_previous(\%previous,$ad);      &Apache::response::handle_previous(\%previous,$ad);
  } else {   } else {
   #
   # This is lenient mode
   #
               &Apache::lonnet::logthis("This is in lenient mode ... nice");
     my $ad;      my $ad;
     if ($wrong==0 && $right==0) {      if ($wrong==0 && $right==0) {
  #nothing submitted only assign a score if we    #nothing submitted only assign a score if we 
Line 417  sub check_for_invalid { Line 449  sub check_for_invalid {
 }  }
   
 sub displayfoils {  sub displayfoils {
   my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,    my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,@opt)=@_;
       $tex_option_switch,@opt)=@_;  
   if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}    if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names = @{ $Apache::response::foilgroup{'names'} };
   my @truelist;    my @truelist;
Line 428  sub displayfoils { Line 459  sub displayfoils {
   my $displayoptionintex=1;    my $displayoptionintex=1;
   my @alphabet = ('A'..'Z');    my @alphabet = ('A'..'Z');
   my @whichopt = &whichfoils($max,$randomize);    my @whichopt = &whichfoils($max,$randomize);
   unless (($target eq 'tex') && ($tex_option_switch eq 'nochoice')) {    &check_for_invalid(\@whichopt,\@opt);
       &check_for_invalid(\@whichopt,\@opt);  
   }  
   my $part=$Apache::inputtags::part;    my $part=$Apache::inputtags::part;
   my $id=$Apache::inputtags::response[-1];    my $id=$Apache::inputtags::response[-1];
   my $break;    my $break;

Removed from v.1.173.2.2  
changed lines
  Added in v.1.174


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