Diff for /loncom/homework/radiobuttonresponse.pm between versions 1.111 and 1.113

version 1.111, 2007/02/22 01:25:31 version 1.113, 2007/03/27 19:20:49
Line 180  sub end_foilgroup { Line 180  sub end_foilgroup {
  if ( $style eq 'survey'  && $target ne 'analyze') {   if ( $style eq 'survey'  && $target ne 'analyze') {
     if ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
  $result=&displayallfoils($direction, $target);   $result=&displayallfoils($direction, $target);
    if ($target eq 'web') {
       &setup_prior_tries_hash();
    }
     } elsif ( $target eq 'answer' ) {      } elsif ( $target eq 'answer' ) {
  $result=&displayallanswers();   $result=&displayallanswers();
     } elsif ( $target eq 'grade' ) {      } elsif ( $target eq 'grade' ) {
Line 193  sub end_foilgroup { Line 196  sub end_foilgroup {
        $safeeval,'-2');         $safeeval,'-2');
     if ($target eq 'web' || $target eq 'tex') {      if ($target eq 'web' || $target eq 'tex') {
  $result=&displayfoils($target,$max,$randomize,$direction);   $result=&displayfoils($target,$max,$randomize,$direction);
    if ($target eq 'web') {
       &setup_prior_tries_hash();
    }
     } elsif ($target eq 'answer' ) {      } elsif ($target eq 'answer' ) {
  $result=&displayanswers($max,$randomize);   $result=&displayanswers($max,$randomize);
     } elsif ( $target eq 'grade') {      } elsif ( $target eq 'grade') {
Line 231  sub getfoilcounts { Line 237  sub getfoilcounts {
     return ($truecnt,$falsecnt);      return ($truecnt,$falsecnt);
 }  }
   
   sub setup_prior_tries_hash {
       my $part=$Apache::inputtags::part;
       my $id=$Apache::inputtags::response[-1];
       foreach my $i (1..$Apache::lonhomework::history{'version'}) {
    my $key = "$i:resource.$part.$id.submission";
    next if (!exists($Apache::lonhomework::history{"$key"}));
    my %response = 
       &Apache::lonnet::str2hash($Apache::lonhomework::history{$key});
    my ($name) = keys(%response);
    $Apache::inputtags::submission_display{$key} = 
       $Apache::response::foilgroup{$name.'.text'}
       }
   }
   
 sub displayallfoils {  sub displayallfoils {
     my ($direction, $target)=@_;      my ($direction, $target)=@_;
     my $result;      my $result;
Line 290  sub displayallfoils { Line 310  sub displayallfoils {
     $i++;      $i++;
  } else {   } else {
     $result .= '<label>';      $result .= '<label>';
     $result.="<input type=\"radio\" name=\"HWVAL_$Apache::inputtags::response['-1']\" value=\"$temp\" ";      $result.="<input
                          onchange=\"javascript:setSubmittedPart('$part');\"
                          type=\"radio\"
                          name=\"HWVAL_$Apache::inputtags::response['-1']\"
                          value=\"$temp\" ";
     if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }      if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
     $result .= ' />'.$Apache::response::foilgroup{$name.'.text'}.      $result .= ' />'.$Apache::response::foilgroup{$name.'.text'}.
  '</label>';   '</label>';
Line 508  sub displayfoils { Line 532  sub displayfoils {
     }      }
     if ($target ne 'tex') {       if ($target ne 'tex') { 
                 $result.= '<label>';                  $result.= '<label>';
  $result.="<input type=\"radio\" name=\"HWVAL_$Apache::inputtags::response['-1']\" value=\"$temp\" ";   $result.=
       "<input type=\"radio\"
                               onchange=\"javascript:setSubmittedPart('$part');\"
                               name=\"HWVAL_$Apache::inputtags::response['-1']\"
                               value=\"$temp\" ";
  if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }   if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
  $result .= ' />'.$Apache::response::foilgroup{$name.'.text'}."</label>";   $result .= ' />'.$Apache::response::foilgroup{$name.'.text'}."</label>";
     } else {      } else {

Removed from v.1.111  
changed lines
  Added in v.1.113


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