File:  [LON-CAPA] / loncom / homework / radiobuttonresponse.pm
Revision 1.54: download - view: text, annotated - select for diffs
Wed Oct 2 18:12:51 2002 UTC (21 years, 8 months ago) by sakharuk
Branches: MAIN
CVS tags: HEAD
Prints exams now.

    1: # The LearningOnline Network with CAPA
    2: # mutliple choice style responses
    3: #
    4: # $Id: radiobuttonresponse.pm,v 1.54 2002/10/02 18:12:51 sakharuk Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: # 2/21 Guy
   29: 
   30: package Apache::radiobuttonresponse;
   31: use strict;
   32: use HTML::Entities();
   33: 
   34: BEGIN {
   35:   &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse'));
   36: }
   37: 
   38: sub start_radiobuttonresponse {
   39:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   40:   my $result;
   41:   #when in a radiobutton response use these
   42:   &Apache::lonxml::register('Apache::radiobuttonresponse',('foilgroup','foil','conceptgroup'));
   43:   push (@Apache::lonxml::namespace,'radiobuttonresponse');
   44:   my $id = &Apache::response::start_response($parstack,$safeeval);
   45:   if ($target eq 'meta') {
   46:     $result=&Apache::response::meta_package_write('radiobuttonresponse');
   47:   } elsif ($target eq 'edit' ) {
   48:     $result.=&Apache::edit::start_table($token).
   49: 	'<tr><td>'.&Apache::lonxml::description($token)."</td><td>Delete:".
   50: 	&Apache::edit::deletelist($target,$token)
   51: 	."</td><td>&nbsp".&Apache::edit::end_row()
   52:         .&Apache::edit::start_spanning_row();
   53: 
   54:     $result.=
   55: 	&Apache::edit::text_arg('Max Number Of Shown Foils:','max',$token,'4').
   56: 	&Apache::edit::select_arg('Randomize Foil Order','randomize',
   57: 				  ['yes','no'],$token).
   58:         &Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n";
   59:   } elsif ($target eq 'modified') {
   60:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
   61: 						 $safeeval,'max','randomize');
   62:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
   63:   } elsif ($target eq 'tex') {
   64:       $result .= '\begin{enumerate}';
   65:   }
   66:   return $result;
   67: }
   68: 
   69: sub end_radiobuttonresponse {
   70:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   71:   my $result;
   72:   if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
   73:   if ($target eq 'tex') { $result .= '\end{enumerate}'; }
   74:   &Apache::response::end_response;
   75:   pop @Apache::lonxml::namespace;
   76:   &Apache::lonxml::deregister('Apache::radiobuttonresponse',('foilgroup','foil','conceptgroup'));
   77:   return $result;
   78: }
   79: 
   80: %Apache::response::foilgroup=();
   81: sub start_foilgroup {
   82:   %Apache::response::foilgroup=();
   83:   $Apache::radiobuttonresponse::conceptgroup=0;
   84:   &Apache::response::setrandomnumber();
   85:   return '';
   86: }
   87: 
   88: sub storesurvey {
   89:   if ( !defined($ENV{'form.submitted'})) { return ''; }
   90:   my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
   91:   &Apache::lonxml::debug("Here I am!:$response:");
   92:   if ( $response !~ /[0-9]+/) { return ''; }
   93:   my $id = $Apache::inputtags::response['-1'];
   94:   my @whichfoils=@{ $Apache::response::foilgroup{'names'} };
   95:   my %responsehash;
   96:   $responsehash{$whichfoils[$response]}=$response;
   97:   $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=&Apache::lonnet::hash2str(%responsehash);
   98:   $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='SUBMITTED';
   99:   &Apache::lonxml::debug("submitted a $response<br />\n");
  100:   return '';
  101: }
  102: 
  103: sub grade_response {
  104:   my ($max,$randomize)=@_;
  105:   if (!defined($ENV{'form.submitted'})) { return; }
  106:   my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
  107:   if ( $response !~ /[0-9]+/) { return; }
  108:   my $part=$Apache::inputtags::part;
  109:   my $id = $Apache::inputtags::response['-1'];
  110:   my ($answer,@whichfoils)=&whichfoils($max,$randomize);
  111:   my %responsehash;
  112:   $responsehash{$whichfoils[$response]}=$response;
  113:   my $responsestr=&Apache::lonnet::hash2str(%responsehash);
  114:   my %previous=&Apache::response::check_for_previous($responsestr,
  115: 						     $part,$id);
  116:   $Apache::lonhomework::results{"resource.$part.$id.submission"}=
  117:     $responsestr;
  118:   &Apache::lonxml::debug("submitted a $response<br />\n");
  119:   my $ad;
  120:   if ($response == $answer) {
  121:     $ad='EXACT_ANS';
  122:   } else {
  123:     $ad='INCORRECT';
  124:   }
  125:   $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
  126:   &Apache::response::handle_previous(\%previous,$ad);
  127: }
  128: 
  129: sub end_foilgroup {
  130:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  131: 
  132:   my $result;
  133:   if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex') {
  134:     my $style = $Apache::lonhomework::type;
  135:     if ( $style eq 'survey' ) {
  136:       if ($target eq 'web' || $target eq 'answer' || $target eq 'tex') {
  137: 	$result=&displayallfoils();
  138:       } elsif ( $target eq 'grade' ) {
  139: 	$result=&storesurvey();
  140:       }
  141:     } else {
  142:       my $name;
  143:       my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
  144:       my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
  145: 						 $safeeval,'-2');
  146:       if ($target eq 'web' || $target eq 'tex') {
  147: 	$result=&displayfoils($target,$max,$randomize);
  148:       } elsif ($target eq 'answer' ) {
  149: 	$result=&displayanswers($max,$randomize);
  150:       } elsif ( $target eq 'grade') {
  151: 	&grade_response($max,$randomize);
  152:       }
  153:     }
  154:   }
  155:   return $result;
  156: }
  157: 
  158: sub getfoilcounts {
  159:   my @names;
  160:   my $truecnt=0;
  161:   my $falsecnt=0;
  162:   my $name;
  163:   if ( $Apache::response::foilgroup{'names'} ) {
  164:     @names= @{ $Apache::response::foilgroup{'names'} };
  165:   }
  166:   foreach $name (@names) {
  167:     if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  168:       $truecnt++;
  169:     } elsif ($Apache::response::foilgroup{$name.'.value'} eq 'false') {
  170:       $falsecnt++;
  171:     }
  172:   }
  173:   return ($truecnt,$falsecnt);
  174: }
  175: 
  176: sub displayallfoils {
  177:   my $result;
  178:   &Apache::lonxml::debug("survey style display");
  179:   my @names = @{ $Apache::response::foilgroup{'names'} };
  180:   my $temp=0;
  181:   my $id=$Apache::inputtags::response['-1'];
  182:   my $part=$Apache::inputtags::part;
  183:   my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
  184:   my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
  185:   if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/)  || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {
  186:     foreach my $name (@names) {
  187:       if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
  188: 	$result.="<br />".$Apache::response::foilgroup{$name.'.value'};
  189: 	if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  190: 	  $result.='<b>';
  191: 	}
  192: 	$result .= $Apache::response::foilgroup{$name.'.text'};
  193: 	if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  194: 	  $result.='</b>';
  195: 	}
  196:       }
  197:     }
  198:   } else {
  199:     foreach my $name (@names) {
  200:       if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
  201: 	$result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
  202: 	if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
  203: 	$result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
  204: 	$temp++;
  205:       }
  206:     }
  207:   }
  208:   return $result;
  209: }
  210: 
  211: sub whichfoils {
  212:   my ($max,$randomize)=@_;
  213: 
  214:   my @truelist;
  215:   my @falselist;
  216:   my @whichfalse =();
  217:   my ($truecnt,$falsecnt) = &getfoilcounts();
  218:   my $count=0;
  219:   # we will add in 1 of the true statements
  220:   if (($falsecnt+1)>$max) { $count=$max } else { $count=$falsecnt+1; }
  221:   my $answer=int(&Math::Random::random_uniform() * ($count));
  222:   &Apache::lonxml::debug("Count is $count, $answer is $answer");
  223:   my @names;
  224:   if ( $Apache::response::foilgroup{'names'} ) {
  225:       @names= @{ $Apache::response::foilgroup{'names'} };
  226:   }
  227:   if (&Apache::response::showallfoils()) {
  228:       @whichfalse=@names;
  229:   } elsif ($randomize eq 'no') {
  230:       &Apache::lonxml::debug("No randomization");
  231:       my $havetrue=0;
  232:       foreach my $name (@names) {
  233: 	  if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  234: 	      if (!$havetrue ) {
  235: 		  push(@whichfalse,$name); $havetrue++; $answer=$#whichfalse;
  236: 	      }
  237: 	  } elsif ($Apache::response::foilgroup{$name.'.value'} eq 'false') {
  238: 	      push (@whichfalse,$name);
  239: 	  } elsif ($Apache::response::foilgroup{$name.'.value'} eq 'unused') {
  240: 	  } else {
  241: 	      &Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>"));
  242: 	  }
  243:       }
  244:   } else {
  245:     my $current=0;
  246:     &Apache::lonhomework::showhash(%Apache::response::foilgroup);
  247:     my (%top,%bottom);
  248:     #first find out where everyone wants to be
  249:     foreach my $name (@names) {
  250: 	$current++;
  251: 	if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  252: 	    push (@truelist,$name);
  253: 	    if ($Apache::response::foilgroup{$name.'.location'} eq 'top') {
  254: 		$top{$name}=$current;
  255: 	    } elsif ($Apache::response::foilgroup{$name.'.location'} eq 'bottom') {
  256: 		$bottom{$name}=$current;
  257: 	    }
  258: 	} elsif ($Apache::response::foilgroup{$name.'.value'} eq 'false') {
  259: 	    push (@falselist,$name);
  260: 	    if ($Apache::response::foilgroup{$name.'.location'} eq 'top') {
  261: 		$top{$name}=$current;
  262: 	    } elsif ($Apache::response::foilgroup{$name.'.location'} eq 'bottom') {
  263: 		$bottom{$name}=$current;
  264: 	    }
  265: 	} elsif ($Apache::response::foilgroup{$name.'.value'} eq 'unused') {
  266: 	} else {
  267: 	    &Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>"));
  268: 	}
  269:     }
  270:     #pick a true statement
  271:     my $whichtrue = int(&Math::Random::random_uniform() * ($#truelist+1));
  272:     &Apache::lonxml::debug("Max is $max, From $#truelist elms, picking $whichtrue");
  273:     my $numinserted;
  274:     my (@toplist, @bottomlist);
  275:     my $topcount=0;
  276:     # assign everyone to either toplist/bottomlist or whichfalse
  277:     # which false is randomized, toplist bottomlist are in order
  278:     while ((($numinserted) < $max-1) && ($#falselist > -1)) {
  279: 	&Apache::lonxml::debug("Have $#whichfalse max is $max");
  280: 	my $afalse=int(&Math::Random::random_uniform() * ($#falselist+1));
  281: 	&Apache::lonxml::debug("From $#falselist elms, picking $afalse");
  282: 	$afalse=splice(@falselist,$afalse,1);
  283: 	&Apache::lonxml::debug("Picked $afalse");
  284: 	&Apache::lonhomework::showhash(('names'=>\@names));
  285: 	&Apache::lonhomework::showhash(%top);
  286: 	if ($top{$afalse}) {
  287: 	    $toplist[$top{$afalse}]=$afalse;
  288: 	    $topcount++;
  289: 	} elsif ($bottom{$afalse}) {
  290: 	    $bottomlist[$bottom{$afalse}]=$afalse;
  291: 	} else {
  292: 	    push (@whichfalse,$afalse);
  293: 	}
  294:     }
  295:     my $truename=$truelist[$whichtrue];
  296:     my $dosplice=1;
  297:     #insert the true statement, keeping track of where it wants to be
  298:     if ($Apache::response::foilgroup{$truename.'.location'} eq 'top' ) {
  299: 	$toplist[$top{$truename}]=$truename;
  300: 	$answer=-1;
  301: 	foreach my $top (reverse(@toplist)) {
  302: 	    if ($top) { $answer++;}
  303: 	    if ($top eq $truename) { last; }
  304: 	}
  305: 	$dosplice=0;
  306:     } elsif ($Apache::response::foilgroup{$truename.'.location'} eq 'bottom') {
  307: 	$bottomlist[$bottom{$truename}]=$truename;
  308: 	$answer=-1;
  309: 	foreach my $bot (@bottomlist) {
  310: 	    if ($bot) { $answer++;}
  311: 	    if ($bot eq $truename) { last; }
  312: 	}
  313: 	$answer+=$topcount+$#whichfalse+1;
  314: 	$dosplice=0;
  315:     } else {
  316: 	if ($topcount>0) { 
  317: 	  $answer = int(&Math::Random::random_uniform() * ($#whichfalse+1))
  318: 	    + $topcount;
  319: 	}
  320:     }
  321:     #add the top items to the top, bottom items to the bottom
  322:     for (my $i=0;$i<=$#toplist;$i++) {
  323: 	if ($toplist[$i]) { unshift(@whichfalse,$toplist[$i]) }
  324:     }
  325:     for (my $i=0;$i<=$#bottomlist;$i++) {
  326: 	if ($bottomlist[$i]) { push(@whichfalse,$bottomlist[$i]) }
  327:     }
  328:     #if the true statement is randomized insert it into the list
  329:     if ($dosplice) { splice(@whichfalse,$answer,0,$truelist[$whichtrue]); }
  330:   }
  331:   &Apache::lonxml::debug("Answer is $answer");
  332:   return ($answer,@whichfalse);
  333: }
  334: 
  335: sub displayfoils {
  336:   my ($target,$max,$randomize)=@_;
  337:   my $result;
  338: 
  339:   my ($answer,@whichfoils)=&whichfoils($max,$randomize);
  340:   if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {
  341:     foreach my $name (@whichfoils) {
  342:       if ($target ne 'tex') {
  343: 	  $result.="<br />";
  344:       } else {
  345: 	  $result.='\vskip 0 mm \item ';
  346:       }
  347:       if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { 
  348: 	  if ($target ne 'tex') { $result.='Correct:<b>'; } else { $result.='Correct: ';}
  349:       } else {
  350: 	$result.='Incorrect:';
  351:       }
  352:       if ($target ne 'tex') {
  353: 	  $result.=$Apache::response::foilgroup{$name.'.text'}."</input>\n";
  354:       } else {
  355: 	  $result.=$Apache::response::foilgroup{$name.'.text'};
  356:       }
  357:       if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
  358: 	  if ($target ne 'tex') { $result.='</b>';}
  359:       }
  360:     }
  361:   } else {
  362:     my $temp=0;  
  363:     my $id=$Apache::inputtags::response['-1'];
  364:     my $part=$Apache::inputtags::part;
  365:     my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
  366:     my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
  367:     foreach my $name (@whichfoils) {
  368:       if ($target ne 'tex') {
  369: 	  $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
  370: 	  if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
  371: 	  $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
  372: 	  $result .= '<table border="1"><tr><td>A: &nbsp;&nbsp;Correct</td><td>B: &nbsp;&nbsp;Incorrect</td></tr></table>';
  373:       } else {
  374: 	  $result .= '\item '.$Apache::response::foilgroup{$name.'.text'};
  375: 	  if ($Apache::lonhomework::type eq 'exam') {
  376: 	      $result.= '\vskip 2 mm \noindent \begin{tabular}{|lr|lr|}\hline ';
  377: 	      $result.= 'A: &  Correct & B: & Incorrect';
  378: 	      $result.='\\\\\hline\end{tabular}\vskip 0 mm ';
  379: 	  }
  380:       }
  381:       $temp++;
  382:     }
  383:   }
  384:   if ($target ne 'tex') { $result.="<br />"; } else { $result.='\vskip 0 mm '; }
  385:   return $result;
  386: }
  387: 
  388: sub displayanswers {
  389:   my ($max,$randomize)=@_;
  390:   my ($answer,@whichopt) = &whichfoils($max,$randomize);
  391:   my $result=&Apache::response::answer_header('radiobuttonresponse');
  392:   foreach my $name (@whichopt) {
  393:     $result.=&Apache::response::answer_part('radiobuttonresponse',
  394: 		     $Apache::response::foilgroup{$name.'.value'})
  395:   }
  396:   $result.=&Apache::response::answer_footer('radiobuttonresponse');
  397:   return $result;
  398: }
  399: 
  400: sub start_conceptgroup {
  401:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  402:   $Apache::radiobuttonresponse::conceptgroup=1;
  403:   %Apache::response::conceptgroup=();
  404:   my $result;
  405:   if ($target eq 'edit') {
  406:     $result.=&Apache::edit::tag_start($target,$token);
  407:     $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').
  408: 	&Apache::edit::end_row().&Apache::edit::start_spanning_row();
  409:   } elsif ($target eq 'modified') {
  410:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
  411: 						 $safeeval,'concept');
  412:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
  413:   }
  414:   return $result;
  415: }
  416: 
  417: sub end_conceptgroup {
  418:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  419:   $Apache::radiobuttonresponse::conceptgroup=0;
  420:   my $result;
  421:   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer'  || $target eq 'tex') {
  422:     if (defined(@{ $Apache::response::conceptgroup{'names'} })) {
  423:       my @names = @{ $Apache::response::conceptgroup{'names'} };
  424:       my $pick=int(&Math::Random::random_uniform() * ($#names+1));
  425:       my $name=$names[$pick];
  426:       push @{ $Apache::response::foilgroup{'names'} }, $name;
  427:       $Apache::response::foilgroup{"$name.text"} =  $Apache::response::conceptgroup{"$name.text"};
  428:       $Apache::response::foilgroup{"$name.value"} = $Apache::response::conceptgroup{"$name.value"};
  429:       $Apache::response::foilgroup{"$name.location"} = $Apache::response::conceptgroup{"$name.location"};
  430:       my $concept = &Apache::lonxml::get_param('concept',$parstack,$safeeval);
  431:       $Apache::response::foilgroup{"$name.concept"} = $concept;
  432:       &Apache::lonxml::debug("Selecting $name in $concept");
  433:     }
  434:   } elsif ($target eq 'edit') {
  435:     $result=&Apache::edit::end_table();
  436:   }
  437:   return $result;
  438: }
  439: 
  440: sub insert_conceptgroup {
  441:   my $result="\n\t\t<conceptgroup concept=\"\">".&insert_foil()."\n\t\t</conceptgroup>\n";
  442:   return $result;
  443: }
  444: 
  445: sub start_foil {
  446:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  447:   my $result='';
  448:   if ($target eq 'web' || $target eq 'tex') {
  449:     &Apache::lonxml::startredirection;
  450:   } elsif ($target eq 'edit') {
  451:     $result=&Apache::edit::tag_start($target,$token);
  452:     $result.=&Apache::edit::text_arg('Name:','name',$token);
  453:     $result.=&Apache::edit::select_or_text_arg('Correct Option:','value',
  454: 				       ['unused','true','false'],$token);
  455:     my $randomize=&Apache::lonxml::get_param('randomize',$parstack,
  456: 					     $safeeval,'-3');
  457:     if ($randomize ne 'no') {
  458:       $result.=&Apache::edit::select_arg('Location:','location',
  459: 					 ['random','top','bottom'],$token);
  460:     }
  461:     $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
  462:   } elsif ($target eq 'modified') {
  463:      my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
  464: 						  'value','name','location');
  465:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
  466:   } 
  467:   return $result;
  468: }
  469: 
  470: sub end_foil {
  471:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  472:   my $text='';
  473:   if ($target eq 'web' || $target eq 'tex') { $text=&Apache::lonxml::endredirection; }
  474:   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer'  || $target eq 'tex') {
  475:     my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
  476:     if ($value ne 'unused') {
  477:       my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
  478:       my $location =&Apache::lonxml::get_param('location',$parstack,$safeeval);
  479:       if (!$name) { $name=$Apache::lonxml::curdepth; }
  480:       if ( $Apache::radiobuttonresponse::conceptgroup
  481: 	   && !&Apache::response::showallfoils() ) {
  482: 	push @{ $Apache::response::conceptgroup{'names'} }, $name;
  483: 	$Apache::response::conceptgroup{"$name.value"} = $value;
  484: 	$Apache::response::conceptgroup{"$name.text"} = $text;	
  485: 	$Apache::response::conceptgroup{"$name.location"} = $location;	
  486:       } else {
  487: 	push @{ $Apache::response::foilgroup{'names'} }, $name;
  488: 	$Apache::response::foilgroup{"$name.value"} = $value;
  489: 	$Apache::response::foilgroup{"$name.text"} = $text;
  490: 	$Apache::response::foilgroup{"$name.location"} = $location;
  491:       }
  492:     }
  493:   }
  494:   return '';
  495: }
  496: 
  497: sub insert_foil {
  498:   return '
  499: <foil name="" value="unused">
  500: <startouttext />
  501: <endouttext />
  502: </foil>';
  503: }
  504: 1;
  505: __END__
  506:  

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.