Diff for /loncom/homework/radiobuttonresponse.pm between versions 1.94 and 1.99

version 1.94, 2004/10/04 17:41:01 version 1.99, 2005/01/31 22:00:40
Line 114  sub start_foilgroup { Line 114  sub start_foilgroup {
 }  }
   
 sub storesurvey {  sub storesurvey {
     if ( !defined($ENV{'form.submitted'})) { return ''; }      if ( !&Apache::response::submitted() ) { return ''; }
     my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1']};      my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1']};
     &Apache::lonxml::debug("Here I am!:$response:");      &Apache::lonxml::debug("Here I am!:$response:");
     if ( $response !~ /[0-9]+/) { return ''; }      if ( $response !~ /[0-9]+/) { return ''; }
       my $part = $Apache::inputtags::part;
     my $id = $Apache::inputtags::response['-1'];      my $id = $Apache::inputtags::response['-1'];
     my @whichfoils=@{ $Apache::response::foilgroup{'names'} };      my @whichfoils=@{ $Apache::response::foilgroup{'names'} };
     my %responsehash;      my %responsehash;
     $responsehash{$whichfoils[$response]}=$response;      $responsehash{$whichfoils[$response]}=$response;
     $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=&Apache::lonnet::hash2str(%responsehash);      my $responsestr=&Apache::lonnet::hash2str(%responsehash);
     $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='SUBMITTED';      $Apache::lonhomework::results{"resource.$part.$id.submission"}=
    $responsestr;
       my %previous=&Apache::response::check_for_previous($responsestr,$part,$id);
       my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='SUBMITTED';
       &Apache::response::handle_previous(\%previous,$ad);
     &Apache::lonxml::debug("submitted a $response<br />\n");      &Apache::lonxml::debug("submitted a $response<br />\n");
     return '';      return '';
 }  }
Line 132  sub grade_response { Line 137  sub grade_response {
     my ($max,$randomize)=@_;      my ($max,$randomize)=@_;
     #keep the random numbers the same must always call this      #keep the random numbers the same must always call this
     my ($answer,@whichfoils)=&whichfoils($max,$randomize);      my ($answer,@whichfoils)=&whichfoils($max,$randomize);
     if (!defined($ENV{'form.submitted'})) { return; }      if ( !&Apache::response::submitted() ) { return; }
     my $response;      my $response;
     if ($ENV{'form.submitted'} eq 'scantron') {      if ($ENV{'form.submitted'} eq 'scantron') {
  $response=&Apache::response::getresponse();   $response=&Apache::response::getresponse();
Line 307  sub whichfoils { Line 312  sub whichfoils {
  &Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>",'<>&"'));   &Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>",'<>&"'));
     }      }
  }   }
    if (!$havetrue && $Apache::lonhomework::type ne 'survey') {
       &Apache::lonxml::error("There are no true statements available.<br />");
    }
     } else {      } else {
  my $current=0;   my $current=0;
  &Apache::lonhomework::showhash(%Apache::response::foilgroup);   &Apache::lonhomework::showhash(%Apache::response::foilgroup);
Line 562  sub start_foil { Line 570  sub start_foil {
     my $result='';      my $result='';
     if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {      if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::startredirection;   &Apache::lonxml::startredirection;
    if ($target eq 'analyze') {
       &Apache::response::check_if_computed($token,$parstack,$safeeval,'value');
    }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result=&Apache::edit::tag_start($target,$token);   $result=&Apache::edit::tag_start($target,$token);
  $result.=&Apache::edit::text_arg('Name:','name',$token);   $result.=&Apache::edit::text_arg('Name:','name',$token);
Line 595  sub end_foil { Line 606  sub end_foil {
  my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);   my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
  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);
     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;
       }
     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));
     }      }

Removed from v.1.94  
changed lines
  Added in v.1.99


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