Annotation of loncom/homework/optionresponse.pm, revision 1.161

1.46      sakharuk    1: # LearningOnline Network with CAPA
1.22      albertel    2: # option list style responses
1.27      albertel    3: #
1.161   ! www         4: # $Id: optionresponse.pm,v 1.160 2010/02/05 20:54:33 www Exp $
1.27      albertel    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: #
1.154     jms        28: 
                     29: 
                     30: 
                     31: 
                     32: 
1.1       albertel   33: package Apache::optionresponse;
                     34: use strict;
1.103     albertel   35: use Apache::response();
                     36: use Apache::lonlocal;
1.125     albertel   37: use Apache::lonnet;
1.1       albertel   38: 
1.31      harris41   39: BEGIN {
1.1       albertel   40:   &Apache::lonxml::register('Apache::optionresponse',('optionresponse'));
                     41: }
                     42: 
                     43: sub start_optionresponse {
1.22      albertel   44:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                     45:   my $result='';
1.29      albertel   46:   #when in a option response use these
1.112     sakharuk   47:   &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist'));
1.22      albertel   48:   push (@Apache::lonxml::namespace,'optionresponse');
                     49:   my $id = &Apache::response::start_response($parstack,$safeeval);
1.57      albertel   50:   %Apache::hint::option=();
1.103     albertel   51:   undef(%Apache::response::foilnames);
1.22      albertel   52:   if ($target eq 'edit') {
1.153     bisitz     53:     $result.=&Apache::edit::start_table($token)
                     54:        .'<tr><td><span class="LC_nobreak">'.&mt('Multiple Option Response Question').'</span> '
                     55:        .&Apache::loncommon::help_open_topic('Option_Response_Problems')."</td>"
                     56:        .'<td><span class="LC_nobreak">'.&mt('Delete?').' '
                     57:        .&Apache::edit::deletelist($target,$token)
                     58:        .'</span></td>'
                     59:        ."<td>&nbsp;"
                     60:        .&Apache::edit::end_row()
                     61:        .&Apache::edit::start_spanning_row()
                     62:        ."\n";
1.48      albertel   63:     $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',
                     64: 				     $token,'4').
1.153     bisitz     65:         &Apache::edit::select_arg('Randomize Foil Order:','randomize',
1.48      albertel   66: 				  ['yes','no'],$token).
1.108     albertel   67:         &Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout',
1.157     raeburn    68: 				  [['horizontal','Normal list'],
                     69: 				   ['vertical','Listed in a vertical column']],$token).
1.48      albertel   70:         &Apache::edit::end_row().&Apache::edit::start_spanning_row();
1.34      albertel   71:   } elsif ($target eq 'modified') {
1.23      albertel   72:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
1.108     albertel   73: 						 $safeeval,'max','randomize',
                     74: 						 'TeXlayout');
1.22      albertel   75:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.34      albertel   76:   } elsif ($target eq 'meta') {
1.23      albertel   77:     $result=&Apache::response::meta_package_write('optionresponse');
1.34      albertel   78:   } elsif ($target eq 'analyze') {
1.93      albertel   79:     my $part_id="$Apache::inputtags::part.$id";
1.149     raeburn    80:     $Apache::lonhomework::analyze{"$part_id.type"} = 'optionresponse';
1.34      albertel   81:     push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
1.148     raeburn    82:     push (@{ $Apache::lonhomework::analyze{"$part_id.bubble_lines"} }, 1);
1.145     foxr       83: 
1.22      albertel   84:   }
                     85:   return $result;
1.1       albertel   86: }
                     87: 
                     88: sub end_optionresponse {
1.22      albertel   89:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                     90:   &Apache::response::end_response;
                     91:   pop @Apache::lonxml::namespace;
1.112     sakharuk   92:   &Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist'));
1.22      albertel   93:   my $result;
                     94:   if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
1.103     albertel   95:   undef(%Apache::response::foilnames);
1.22      albertel   96:   return $result;
1.1       albertel   97: }
                     98: 
1.44      albertel   99: %Apache::response::foilgroup=();
1.1       albertel  100: sub start_foilgroup {
1.22      albertel  101:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    102: 
                    103:   my $result='';
1.44      albertel  104:   %Apache::response::foilgroup=();
1.22      albertel  105:   $Apache::optionresponse::conceptgroup=0;
1.110     albertel  106:   &Apache::response::pushrandomnumber();
1.22      albertel  107:   if ($target eq 'edit') {
                    108:     my $optionlist="<option></option>\n";
                    109:     my $option;
                    110:     my @opt;
                    111:     eval '@opt ='. &Apache::lonxml::get_param('options',$parstack,$safeeval);
                    112:     my $count=1;
                    113:     foreach $option (@opt) {
                    114:       $optionlist.="<option value=\"$count\">$option</option>\n";
                    115:       $count++;
                    116:     }
                    117:     my $insertlist=&Apache::edit::insertlist($target,$token);
                    118:     $result.=&Apache::edit::start_table($token);
                    119:     $result.= (<<ENDTABLE);
                    120:       <tr><td>Select Options</td>
1.13      albertel  121:         <td>
                    122: 	  Add new Option: <input type="text" name="$Apache::lonxml::curdepth.options" />
                    123:         </td>
                    124:         <td>Delete an Option:
                    125: 	  <select name="$Apache::lonxml::curdepth.deleteopt">$optionlist</select>
                    126: ENDTABLE
1.132     albertel  127:     $result.= &Apache::edit::checked_arg('Print options:','texoptions',
                    128: 					 [ ['nochoice','Don\'t show option list'] ]
                    129: 					 ,$token);
1.30      matthew   130:     $result.= &Apache::edit::end_row();
                    131:     $result.= &Apache::edit::start_spanning_row();
                    132:     $result.= $insertlist.'<br />';
1.22      albertel  133:   }
                    134:   if ($target eq 'modified') {
                    135:     my @options;
                    136:     my $optchanged=0;
                    137:     eval '@options ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
1.125     albertel  138:     if ($env{"form.$Apache::lonxml::curdepth.deleteopt"}) {
                    139:       my $delopt=$env{"form.$Apache::lonxml::curdepth.deleteopt"};
1.22      albertel  140:       &Apache::lonxml::debug("Deleting :$delopt:");
                    141:       splice(@options,$delopt-1,1);
                    142:       $optchanged=1;
                    143:     }
1.125     albertel  144:     if ($env{"form.$Apache::lonxml::curdepth.options"}) {
                    145:       my $newopt = $env{"form.$Apache::lonxml::curdepth.options"};
1.22      albertel  146:       if ($options[0]) {
                    147: 	push(@options,$newopt);
                    148:       } else {
                    149: 	$options[0]=$newopt;
                    150:       }
                    151:       $optchanged=1;
                    152:     }
1.132     albertel  153:     my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,
                    154: 						 ('texoptions'));
                    155:     if ($optchanged || $rebuildtag ) {
1.22      albertel  156:       $result = "<foilgroup options=\"(";
                    157:       foreach my $option (@options) {
1.41      albertel  158: 	$option=~s/\'/\\\'/g;
1.22      albertel  159: 	&Apache::lonxml::debug("adding option :$option:");
                    160: 	$result .="'".$option."',";
                    161:       }
                    162:       chop $result;
1.132     albertel  163:       $result.=')" ';
                    164:       $result .= 'texoptions="'.$token->[2]{'texoptions'}.'" ';
                    165:       $result .= '>';
1.22      albertel  166:     } # else nothing changed so just use the default mechanism
                    167:   }
1.68      sakharuk  168:   if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
1.152     onken     169:     if($env{'form.pdfFormFields'} ne 'yes') {
1.109     albertel  170:       $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}
                    171:                    \begin{enumerate} ';
1.152     onken     172:     } else {
                    173:       $result .= "\\\\";
                    174:     }
1.42      sakharuk  175:   }
1.22      albertel  176:   return $result;
1.1       albertel  177: }
                    178: 
                    179: sub end_foilgroup {
1.22      albertel  180:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    181:   
                    182:   my $result;
1.94      albertel  183:   if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
                    184:       $target eq 'tex' || $target eq 'analyze') {
1.81      sakharuk  185:     my $tex_option_switch=&Apache::lonxml::get_param('texoptions',$parstack,$safeeval);
1.22      albertel  186:     my $name;
                    187:     my @opt;
                    188:     eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
1.126     albertel  189:     &Apache::lonxml::debug("options:".join(':',@opt));
                    190: 
1.108     albertel  191:     my $TeXlayout=&Apache::lonxml::get_param('TeXlayout',$parstack,$safeeval,
                    192: 					     -2,0);
1.161   ! www       193:     my $checkboxvalue=&Apache::lonxml::get_param('checkboxvalue',$parstack,$safeeval);
1.81      sakharuk  194:     if ($target eq 'tex' && $tex_option_switch eq 'nochoice') {@opt=();}
1.22      albertel  195:     &Apache::lonxml::debug("Options are $#opt");
1.48      albertel  196:     my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
                    197:     my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
                    198: 					       $safeeval,'-2');
1.32      sakharuk  199:     if ($target eq 'web' || $target eq 'tex') {
1.161   ! www       200:       $result.=&displayfoils($target,$max,$randomize,$TeXlayout,$checkboxvalue,@opt);
1.137     albertel  201:       $Apache::lonxml::post_evaluate=0;
1.25      albertel  202:     } elsif ( $target eq 'answer') {
1.48      albertel  203:       $result.=&displayanswers($max,$randomize,@opt);
1.136     foxr      204:       
1.34      albertel  205:     } elsif ( $target eq 'analyze') {
1.93      albertel  206: 	my @shown = &whichfoils($max,$randomize);
1.94      albertel  207: 	&Apache::response::analyze_store_foilgroup(\@shown,
                    208: 						  ['text','value','location']);
1.93      albertel  209: 	my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
                    210: 	push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt);
1.22      albertel  211:     } elsif ( $target eq 'grade') {
1.124     albertel  212:       if ( &Apache::response::submitted()) {
1.48      albertel  213: 	my @whichopt = &whichfoils($max,$randomize);
1.22      albertel  214: 	my $temp=1;my $name;
1.26      albertel  215: 	my %responsehash;
1.57      albertel  216: 	my %grade;
1.22      albertel  217: 	my $right=0;
                    218: 	my $wrong=0;
                    219: 	my $ignored=0;
                    220: 	foreach $name (@whichopt) {
1.74      albertel  221: 	  my $response=&Apache::response::getresponse($temp);
1.125     albertel  222: 	  if ($env{'form.submitted'} eq 'scantron' && $response=~/\S/) {
1.74      albertel  223: 	      $response = $opt[$response];
                    224: 	  }
1.22      albertel  225: 	  if ( $response =~ /[^\s]/) {
1.96      albertel  226: 	    $responsehash{$name}=$response;
1.22      albertel  227: 	    my $value=$Apache::response::foilgroup{$name.'.value'};
1.34      albertel  228: 	    &Apache::lonxml::debug("submitted a $response for $value<br />\n");
1.57      albertel  229: 	    if ($value eq $response) {
                    230: 		$grade{$name}='1'; $right++;
                    231: 	    } else {
                    232: 		$grade{$name}='0'; $wrong++;
                    233: 	    }
1.22      albertel  234: 	  } else {
                    235: 	    $ignored++;
                    236: 	  }
                    237: 	  $temp++;
                    238: 	}
1.28      albertel  239: 	my $part=$Apache::inputtags::part;
1.22      albertel  240: 	my $id = $Apache::inputtags::response['-1'];
1.28      albertel  241: 	my $responsestr=&Apache::lonnet::hash2str(%responsehash);
1.57      albertel  242: 	my $gradestr   =&Apache::lonnet::hash2str(%grade);
1.28      albertel  243: 	my %previous=&Apache::response::check_for_previous($responsestr,
                    244: 							   $part,$id);
1.22      albertel  245: 	&Apache::lonxml::debug("Got $right right and $wrong wrong, and $ignored were ignored");
1.75      albertel  246: 	$Apache::lonhomework::results{"resource.$part.$id.submission"}=
                    247: 	    $responsestr;
                    248: 	$Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
                    249: 	
1.121     albertel  250: 	if ($Apache::lonhomework::type eq 'survey') {
                    251: 	    if ($ignored == 0) {
                    252: 		my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='SUBMITTED';
                    253: 		&Apache::response::handle_previous(\%previous,$ad);
                    254: 	    } elsif ($wrong==0 && $right==0) {
                    255: 	    } else {
                    256: 		my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='MISSING_ANSWER';
                    257: 		&Apache::response::handle_previous(\%previous,$ad);
                    258: 	    }
                    259: 	} elsif (!$Apache::lonhomework::scantronmode) {
1.75      albertel  260: 	    my $ad;
                    261: 	    if ($wrong==0 && $ignored==0) {
                    262: 		$ad='EXACT_ANS';
                    263: 	    } elsif ($wrong==0 && $right==0) {
                    264: 		#nothing submitted
                    265: 	    } else {
                    266: 		if ($ignored==0) {
                    267: 		    $ad='INCORRECT';
                    268: 		} else {
                    269: 		    $ad='MISSING_ANSWER';
                    270: 		}
                    271: 	    }
                    272: 	    $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
                    273: 	    &Apache::response::handle_previous(\%previous,$ad);
1.22      albertel  274: 	} else {
1.75      albertel  275: 	    my $ad;
                    276: 	    if ($wrong==0 && $right==0) {
1.120     albertel  277: 		#nothing submitted only assign a score if we 
                    278: 		#need to override a previous grade
                    279: 		if (defined($Apache::lonhomework::history{"resource.$part.$id.awarddetail"})) {
                    280: 		    $ad='ASSIGNED_SCORE';
                    281: 		}
1.75      albertel  282: 	    } else {
                    283: 		$ad='ASSIGNED_SCORE';
                    284: 	    }
                    285: 	    $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
                    286: 	    $Apache::lonhomework::results{"resource.$part.$id.awarded"}=
                    287: 		$right/(scalar(@whichopt));
1.76      albertel  288: 	    $Apache::lonhomework::results{"resource.$part.$id.numfoils"}=
                    289: 		scalar(@whichopt);
1.1       albertel  290: 	}
1.22      albertel  291:       }
1.1       albertel  292:     }
1.147     foxr      293:     my $part_id     = $Apache::inputtags::part;
                    294:     my $response_id = $Apache::inputtags::response[-1];
1.146     foxr      295:     &Apache::lonxml::increment_counter(&getfoilcounts($max),
1.147     foxr      296: 				       "$part_id.$response_id");
1.146     foxr      297:     if ($target eq 'analyze') {
                    298: 	&Apache::lonhomework::set_bubble_lines();
                    299:     }
                    300: 
1.25      albertel  301:   } elsif ($target eq 'edit') {
1.22      albertel  302:     $result.=&Apache::edit::end_table();
1.74      albertel  303:   }
                    304:   if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
1.152     onken     305:     if($env{'form.pdfFormFields'} ne 'yes') {
1.74      albertel  306:       $result .= '\end{enumerate}';
1.152     onken     307:     } else {
                    308:       $result .= "\\\\";
                    309:     }
1.74      albertel  310:   }
1.110     albertel  311:   &Apache::response::poprandomnumber();
1.22      albertel  312:   return $result;
1.1       albertel  313: }
                    314: 
                    315: sub getfoilcounts {
1.48      albertel  316:   my ($max)=@_;
1.22      albertel  317:   # +1 since instructors will count from 1
                    318:   my $count = $#{ $Apache::response::foilgroup{'names'} }+1;
1.39      albertel  319:   if (&Apache::response::showallfoils()) { $max=$count; }
1.48      albertel  320:   if ($count>$max) { $count=$max } 
                    321:   &Apache::lonxml::debug("Count is $count from $max");
                    322:   return $count;
1.1       albertel  323: }
                    324: 
                    325: sub whichfoils {
1.77      albertel  326:     my ($max,$randomize)=@_;
                    327:     return &Apache::response::whichorder($max,$randomize,
                    328: 					 &Apache::response::showallfoils(),
                    329: 					 \%Apache::response::foilgroup);
1.1       albertel  330: }
                    331: 
1.25      albertel  332: sub displayanswers {
1.130     albertel  333:     my ($max,$randomize,@opt)=@_;
                    334:     if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
                    335:     my @names = @{ $Apache::response::foilgroup{'names'} };
                    336:     my @whichopt = &whichfoils($max,$randomize);
                    337:     my $result;
                    338:     if ($Apache::lonhomework::type eq 'exam') {
                    339: 	my $i = 0;
                    340: 	my %opt = map { ($_,$i++) } @opt;
                    341: 	
                    342: 	$i = 0;
                    343: 	my @alphabet = ('A'..'Z');
                    344: 	foreach my $name (@whichopt) {
                    345: 	    $result.=&Apache::response::answer_header('optionresponse',$i++);
                    346: 	    $result.=&Apache::response::answer_part('optionresponse',
                    347: 						    $alphabet[$opt{$Apache::response::foilgroup{$name.'.value'}}]);
                    348: 	    $result.=&Apache::response::answer_part('optionresponse',
                    349: 						    $Apache::response::foilgroup{$name.'.value'});
                    350: 	    $result.=&Apache::response::answer_footer('optionresponse');
                    351: 	}
                    352:     } else {
                    353: 	$result=&Apache::response::answer_header('optionresponse');
                    354: 	foreach my $name (@whichopt) {
                    355: 	    $result.=&Apache::response::answer_part('optionresponse',
                    356: 						    $Apache::response::foilgroup{$name.'.value'});
                    357: 	}
                    358: 	$result.=&Apache::response::answer_footer('optionresponse');
                    359:     }
                    360:     return $result;
1.25      albertel  361: }
                    362: 
1.160     www       363: sub check_box_opt {
1.161   ! www       364:     my ($target,$checkboxvalue,@opt)=@_;
        !           365: # Check if we are in checkbox mode: checkboxvalue specified, on web, only two options.
        !           366: # If so, return "checked" value
        !           367:     if ($#opt!=1) { return ''; }
        !           368:     if ($target ne 'web') { return ''; }
        !           369:     return $checkboxvalue;
1.160     www       370: }
                    371: 
1.106     albertel  372: sub check_for_invalid {
                    373:     my ($names,$options) = @_;
                    374:     my %bad_names;
                    375:     foreach my $name (@{ $names }) {
                    376: 	my $value=$Apache::response::foilgroup{$name.'.value'};
                    377: 	my $found=0;
                    378: 	foreach my $option (@{ $options }) {
                    379: 	    if ($value eq $option) { $found=1; }
                    380: 	}
                    381: 	if (!$found) { $bad_names{$name}=$value; }
                    382:     }
                    383:     if (%bad_names) {
                    384: 	my $error=&mt('The question can not be gotten correct, '.
                    385: 	    'the following foils in the &lt;optionresponse&gt; '.
                    386: 	    'have invalid correct options').' <br /><tt>'.
                    387: 	    join('<br />',(map { $_=&mt("[_1] with value [_2]",$_,$bad_names{$_}) } (keys(%bad_names)))).
                    388: 	    "</tt>";
                    389: 	&Apache::lonxml::error($error);
                    390:     }
                    391: }
                    392: 
1.1       albertel  393: sub displayfoils {
1.161   ! www       394:   my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,@opt)=@_;
1.67      albertel  395:   if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
1.22      albertel  396:   my @names = @{ $Apache::response::foilgroup{'names'} };
                    397:   my @truelist;
                    398:   my @falselist;
1.79      sakharuk  399:   my $result;  
1.22      albertel  400:   my $name;
1.101     albertel  401:   my $displayoptionintex=1;
1.72      sakharuk  402:   my @alphabet = ('A'..'Z');
1.48      albertel  403:   my @whichopt = &whichfoils($max,$randomize);
1.106     albertel  404:   &check_for_invalid(\@whichopt,\@opt);
1.28      albertel  405:   my $part=$Apache::inputtags::part;
                    406:   my $id=$Apache::inputtags::response[-1];
1.62      albertel  407:   my $break;
1.65      albertel  408:   my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
1.86      albertel  409:   if ( ($target ne 'tex') &&
                    410:        &Apache::response::show_answer() ) {
1.90      albertel  411:     my $temp=1;
1.22      albertel  412:     foreach $name (@whichopt) {
1.62      albertel  413: 	my $text=$Apache::response::foilgroup{$name.'.text'};
1.90      albertel  414: 	my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
                    415: 	my $lastopt=$lastresponse{$name};
1.101     albertel  416: 	if ($text!~/^\s*$/) { $break='<br />'; }
1.62      albertel  417: 	$result.=$break;
1.113     sakharuk  418: 	if ($target eq 'web') {
1.62      albertel  419: 	    my $value=$Apache::response::foilgroup{$name.'.value'};
                    420: 	    if (!($text=~s|<drawoptionlist\s*/>|$value|)) {
                    421: 		if ($text=~/^\s*$/) {
                    422: 		    $text=$value.$text;
                    423: 		} else {
1.127     albertel  424: 		    $text='<b>'.$value.':</b> '.$text;
1.62      albertel  425: 		}
1.95      albertel  426: 	    } else {
                    427: 		$text='&#149;'.$text;
1.62      albertel  428: 	    }
                    429: 	    $result.=$text."\n";
1.112     sakharuk  430: 	}
1.58      sakharuk  431:       if ($Apache::lonhomework::type eq 'exam') {
1.90      albertel  432: 	  $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
1.58      sakharuk  433:       }
1.90      albertel  434:       $temp++;
1.22      albertel  435:     }
                    436:   } else {
                    437:     my $temp=1;
1.28      albertel  438:     my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
1.79      sakharuk  439:     my $internal_counter=$Apache::lonxml::counter;
1.161   ! www       440:     my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);
1.160     www       441:     if ($checkboxopt) {
                    442:        $result.='<br />'.&mt('Choices: ').'<b>'.$opt[0].','.$opt[1].'</b>. '.
                    443:                 &mt('Select all that are <b>[_1]</b>.',$checkboxopt);
                    444:     }
1.22      albertel  445:     foreach $name (@whichopt) {
1.62      albertel  446:       my $text=$Apache::response::foilgroup{$name.'.text'};
                    447:       if ($text!~/^\s*$/) {
                    448: 	  if ($target eq 'tex') {
                    449: 	      $break='\vskip 0 mm ';
                    450: 	  } elsif ($target eq 'web') {
                    451: 	      $break='<br />';
                    452: 	  }
                    453:       }
1.28      albertel  454:       my $lastopt=$lastresponse{$name};
                    455:       my $optionlist="<option></option>\n";
1.152     onken     456: 
1.158     onken     457:       if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes'
                    458:          && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
1.152     onken     459:           my $fieldname = $env{'request.symb'}.'&part_'.$Apache::inputtags::part.'&optionresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp;
                    460:           $optionlist =  &Apache::lonxml::print_pdf_start_combobox($fieldname);
                    461:       }
                    462: 
1.126     albertel  463:       foreach my $option (@opt) {
                    464: 	  my $escopt=&HTML::Entities::encode($option,'\'"&<>');
1.152     onken     465:           if ($option eq $lastopt) {
1.158     onken     466:               if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                    467:                   && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
1.152     onken     468:                   $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
                    469:               } else {
                    470:                   $optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";
                    471:               }
                    472:           } else {
1.158     onken     473:               if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                    474:                   && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
1.152     onken     475:                   $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
                    476:               } else {
                    477:                   $optionlist.="<option value='".$escopt."'>$option</option>\n";
                    478:               }
                    479:           }
1.28      albertel  480:       }
1.32      sakharuk  481:       if ($target ne 'tex') {
1.72      sakharuk  482: 	  if ($Apache::lonhomework::type ne 'exam') {
1.159     www       483: # we are on the web, this is not an exam, and the problem can be answered
                    484:               if ($checkboxopt) {
                    485: # generate checkboxes
                    486:                   my $fieldname=$Apache::inputtags::response['-1'].':'.$temp;
                    487:                   my $altopt=$opt[0];
                    488:                   if ($opt[0] eq $checkboxopt) {
                    489:                      $altopt=$opt[1];
                    490:                   }
                    491:                   my $defopt=$lastopt;
                    492:                   unless ($defopt) { $defopt=$altopt; }
                    493:                   my $escdefopt=&HTML::Entities::encode($defopt,'\'"&<>');
                    494:                   my $esccheckboxopt=&HTML::Entities::encode($checkboxopt,'\'"&<>');
                    495:                   my $escaltopt=&HTML::Entities::encode($altopt,'\'"&<>');
                    496: # checkboxopt is how the box is labelled
                    497: # altopt is the alternative option
                    498: # lastopt is what the user submitted before
                    499: # defopt is what the field is going to start out with: either previous choice or altopt
                    500: # fieldname is this input field's name after HWVAL_
                    501:                   $optionlist='<input type="hidden" name="HWVAL_'.$fieldname.'" value="'.$escdefopt.'" />'.
1.160     www       502:                   '<input type="checkbox" name="HWCHK_'.$fieldname.'" onclick="javascript:if (this.form.elements[\'HWCHK_'.
                    503:                   $fieldname.'\'].checked) { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$esccheckboxopt.'\'; } else { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$escaltopt.'\'; };setSubmittedPart(\''.$part.'\');"'.($defopt eq $checkboxopt?' checked="checked"':'')." />\n";
1.159     www       504:               } else {
                    505: # classic selection list
                    506: 	          $optionlist='<select onchange="javascript:setSubmittedPart(\''.
1.139     albertel  507: 		  $part.'\');" name="HWVAL_'.
1.101     albertel  508: 		  $Apache::inputtags::response['-1'].':'.$temp.'">'.
1.59      albertel  509: 		  $optionlist."</select>\n";
1.159     www       510:               }
1.101     albertel  511: 	  } else {
                    512: 	      $optionlist='<u>'.('&nbsp;'x10).'</u>';
1.72      sakharuk  513: 	  }
1.101     albertel  514: 	  if ($text=~s|<drawoptionlist\s*/>|$optionlist|) {
                    515: 	      if ($Apache::lonhomework::type ne 'exam') {
                    516: 		  $text='&#149;'.$text;
                    517: 	      }
1.95      albertel  518: 	  } else {
1.101     albertel  519: 	      if ($Apache::lonhomework::type ne 'exam') {
                    520: 		  $text=$optionlist.$text;
                    521: 	      }
1.59      albertel  522: 	  }
1.62      albertel  523: 	  $result.=$break.$text."\n";
1.49      sakharuk  524: 	  if ($Apache::lonhomework::type eq 'exam') {
1.101     albertel  525: 	      $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
1.49      sakharuk  526: 	  }
1.32      sakharuk  527: 	  $temp++;
                    528:       } else {
1.101     albertel  529: 	  my $texoptionlist='';
                    530: 	  if ($displayoptionintex &&
                    531: 	      $Apache::lonhomework::type ne 'exam') {
1.107     sakharuk  532: 	      $texoptionlist = &optionlist_correction($TeXlayout,@opt);
1.101     albertel  533: 	  }
                    534: 	  if ($text=~/<drawoptionlist\s*\/>/) {
1.136     foxr      535: 	      $text=~s|<drawoptionlist\s*\/>| \\makebox\[0\.3in\]\[b\]\{\\hrulefill\} |g;
1.101     albertel  536: 	  }
                    537: 
                    538: 	  if ($text=~m/\\item /) {
1.50      sakharuk  539: 	      if ($Apache::lonhomework::type eq 'exam') {
1.101     albertel  540: 	          $text=~s/\\item/\\vskip 2 mm/;
1.152     onken     541: 	      } elsif ($env{'form.pdfFormFields'} ne 'yes') {
                    542:                   $result.= $texoptionlist.$text;
                    543:               }
                    544:           } else {
1.101     albertel  545: 	      if ($Apache::lonhomework::type eq 'exam') {
                    546: 		  $result.= $texoptionlist.'  '.$text;
1.152     onken     547: 	      } elsif ($env{'form.pdfFormFields'} ne 'yes') {
                    548: 		  if ($text=~/\S/) {
                    549:                       $result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;
                    550:                   } else {
                    551:                       $result.= $texoptionlist;
                    552:                   }
1.50      sakharuk  553: 	      }
1.32      sakharuk  554: 	  }
1.101     albertel  555: 	  if ($Apache::lonhomework::type eq 'exam') {
                    556: 	      $result.='\vskip -1 mm\noindent\begin{enumerate}\item[\textbf{'.
                    557: 		  $internal_counter.'}.]'.&bubbles(\@alphabet,\@opt).
                    558: 		  '\end{enumerate} \vskip -8 mm \strut ';
                    559: 	      $internal_counter++;
                    560: 	  }
1.158     onken     561:           if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                    562:               && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
                    563:               $text =~ s/\\item//m;
1.152     onken     564:               $result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';
                    565:               $temp++;
                    566:           }
1.101     albertel  567: 	  $displayoptionintex=0;
1.62      albertel  568:       }
1.1       albertel  569:     }
1.62      albertel  570:   }
1.138     albertel  571: 
                    572:   if ($target eq 'web') {
1.143     albertel  573:       &Apache::response::setup_prior_tries_hash(\&Apache::rankresponse::format_prior_answer,
                    574: 						[\@whichopt,
                    575: 						 'submissiongrading']);
1.138     albertel  576:   }
                    577: 
1.32      sakharuk  578:   if ($target ne 'tex') {
1.62      albertel  579:       return $result.$break;
                    580:   } else {
1.32      sakharuk  581:       return $result;
1.22      albertel  582:   }
1.50      sakharuk  583: }
                    584: 
                    585: 
                    586: sub optionlist_correction {
1.107     sakharuk  587:     my ($TeXlayout,@options) = @_;
1.150     bisitz    588:     my $texoptionlist='\\item [] '.&mt('Choices:').' ';
1.107     sakharuk  589:     if ($TeXlayout eq 'vertical') {$texoptionlist='\\item []';}
1.101     albertel  590:     if (scalar(@options) > 0) {
                    591: 	foreach my $option (@options) {
                    592: 	    $texoptionlist.='{\bf '.
1.135     albertel  593: 		&Apache::lonxml::latex_special_symbols($option).
1.107     sakharuk  594: 		'}';
                    595: 	    if ($TeXlayout eq 'vertical') {
                    596: 		$texoptionlist.=' \vskip 0 mm ',
                    597: 	    } else {
1.115     sakharuk  598: 		$texoptionlist.=', ';
1.107     sakharuk  599: 	    }
1.101     albertel  600: 	}
1.116     albertel  601: 	$texoptionlist=~s/, $//;
1.107     sakharuk  602: 	if ($TeXlayout ne 'vertical') {$texoptionlist.='.';}
1.80      sakharuk  603:     } else {
1.107     sakharuk  604: 	if ($TeXlayout ne 'vertical') {$texoptionlist='\\item [] \\vskip -5 mm';}
1.80      sakharuk  605:     }
1.50      sakharuk  606:     return $texoptionlist;
1.58      sakharuk  607: }
                    608: 
                    609: 
                    610: sub webbubbles {
1.90      albertel  611:     my ($ropt,$ralphabet,$temp,$lastopt)=@_;
1.58      sakharuk  612:     my @opt=@$ropt; 
                    613:     my @alphabet=@$ralphabet;
                    614:     my $result='';
1.90      albertel  615:     my $number_of_bubbles = $#opt + 1;
                    616:     $result.= '<table border="1"><tr>';
                    617:     for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
                    618: 	my $checked='';
                    619: 	if ($lastopt eq $opt[$ind]) {
                    620: 	    $checked=' checked="on" ';
1.58      sakharuk  621: 	}
1.90      albertel  622: 	$result.='<td><input type="radio" name="HWVAL_'.
                    623: 	    $Apache::inputtags::response['-1'].':'.$temp.
1.111     albertel  624: 	    '" value="'.$opt[$ind].'" '.$checked.' />';
                    625: 	if ($alphabet[$ind]) {
                    626: 	    $result.=$alphabet[$ind].': ';
                    627: 	}
                    628: 	$result.=$opt[$ind].'</td>';
1.90      albertel  629:     }
                    630:     $result.='</tr></table>';
                    631:     return $result;
1.50      sakharuk  632: }
                    633: 
                    634: 
                    635: sub bubbles {
1.140     foxr      636:     my ($ralphabet,$ropt,$response, $max_width) = @_;
1.119     albertel  637:     my @alphabet = @$ralphabet;
1.50      sakharuk  638:     my @opt = @$ropt;
1.51      sakharuk  639:     my ($result,$head,$line) =('','','');
1.50      sakharuk  640:     my $number_of_bubbles = $#opt + 1;
1.51      sakharuk  641:     my $current_length = 0;
1.100     sakharuk  642:     my $textwidth;
1.141     albertel  643:     if (defined($max_width)) {
1.140     foxr      644: 	$textwidth=$max_width;
1.141     albertel  645: 	&Apache::lonxml::debug("Max width passed in: $max_width");
                    646:     } elsif ($env{'form.textwidth'} ne '') {
1.125     albertel  647: 	$env{'form.textwidth'}=~/(\d+)/;
1.100     sakharuk  648: 	$textwidth=$1;
1.141     albertel  649: 	&Apache::lonxml::debug("Max width from form: $textwidth");
1.100     sakharuk  650:     } else {
1.125     albertel  651: 	$env{'form.textwidth'}=~/(\d*)\.?(\d*)/;
1.102     sakharuk  652: 	$textwidth=$1.'.'.$2;
1.141     albertel  653: 	&Apache::lonxml::debug("Max width defaults? $textwidth");
1.100     sakharuk  654:     }
1.141     albertel  655:     &Apache::lonxml::debug("Final maxwidth: $textwidth");
1.51      sakharuk  656:     for (my $ind=0;$ind<=$number_of_bubbles;$ind++) {
1.99      sakharuk  657: 	my $leftmargin;
1.101     albertel  658: 	$opt[$ind]=&Apache::lonxml::latex_special_symbols($opt[$ind]);
1.119     albertel  659: 	if ($response eq 'rankresponse') {$opt[$ind]='Rank '.$opt[$ind];}
1.99      sakharuk  660: 	if ($ind==0) {$leftmargin=6;} else {$leftmargin=10;}
1.140     foxr      661: 
1.102     sakharuk  662: 	$current_length += (length($opt[$ind])+length($alphabet[$ind])+4)*2;
1.99      sakharuk  663: 	if ($current_length<($textwidth-$leftmargin) and $ind!=$number_of_bubbles) {
1.51      sakharuk  664: 	    $line.='\hskip -1 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';
                    665: 	    $head.='lr';
                    666: 	} else {
                    667: 	    $line=~s/\&\s*$//;
1.131     albertel  668: 	    $result.='\vskip -2 mm\noindent\setlength{\tabcolsep}{2 mm}\begin{tabular}{'.$head.'}'.$line.'\\\\\end{tabular}\vskip 0 mm';
1.51      sakharuk  669: 	    $line = '\hskip -1 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';;
                    670: 	    $head ='lr';
                    671: 	    $current_length = (length($opt[$ind])+length($alphabet[$ind]))*2;
                    672: 	}
                    673: 
1.50      sakharuk  674:     }
                    675:     return $result;
1.1       albertel  676: }
                    677: 
1.22      albertel  678: 
1.2       albertel  679: sub start_conceptgroup {
1.22      albertel  680:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    681:   $Apache::optionresponse::conceptgroup=1;
1.44      albertel  682:   %Apache::response::conceptgroup=();
1.22      albertel  683:   my $result;
                    684:   if ($target eq 'edit') {
                    685:     $result.=&Apache::edit::tag_start($target,$token,"Concept Grouped Foils");
1.30      matthew   686:     $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').
                    687:         &Apache::edit::end_row().&Apache::edit::start_spanning_row();
1.22      albertel  688:   }
                    689:   if ($target eq 'modified') {
                    690:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'concept');
                    691:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
                    692:   }
                    693:   return $result;
1.2       albertel  694: }
                    695: 
                    696: sub end_conceptgroup {
1.22      albertel  697:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    698:   $Apache::optionresponse::conceptgroup=0;
                    699:   my $result='';
1.93      albertel  700:   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
                    701:       $target eq 'tex' || $target eq 'analyze') {
1.22      albertel  702:     #if not there aren't any foils to display and thus no question
1.93      albertel  703:       &Apache::response::pick_foil_for_concept($target,
                    704: 					       ['value','text','location'],
                    705: 					       \%Apache::hint::option,
                    706: 					       $parstack,$safeeval);
1.34      albertel  707:   } elsif ($target eq 'edit') {
1.22      albertel  708:     $result=&Apache::edit::end_table();
                    709:   }
                    710:   return $result;
1.2       albertel  711: }
                    712: 
1.16      albertel  713: sub insert_conceptgroup {
1.22      albertel  714:   my $result="\n\t\t<conceptgroup concept=\"\">".&insert_foil()."\n\t\t</conceptgroup>\n";
                    715:   return $result;
1.16      albertel  716: }
                    717: 
1.1       albertel  718: sub start_foil {
1.22      albertel  719:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    720:   my $result='';
1.34      albertel  721:   if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze' ) {
1.105     albertel  722:       &Apache::lonxml::startredirection;
                    723:       if ($target eq 'analyze') {
                    724: 	  &Apache::response::check_if_computed($token,$parstack,$safeeval,'value');
                    725:       }
1.25      albertel  726:   } elsif ($target eq 'edit') {
1.22      albertel  727:     $result=&Apache::edit::tag_start($target,$token,"Foil");
                    728:     my $level='-2';
                    729:     if ($$tagstack['-2'] eq 'conceptgroup') { $level = '-3'; }
                    730:     my @opt;
                    731:     eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval,$level);
                    732:     $result.=&Apache::edit::text_arg('Name:','name',$token);
1.48      albertel  733:     $result.= &Apache::edit::select_or_text_arg('Correct Option:','value',
                    734: 					       ['unused',(@opt)],$token,'15');
                    735:     my $randomize=&Apache::lonxml::get_param('randomize',$parstack,
                    736: 					     $safeeval,'-3');
                    737:     if ($randomize ne 'no') {
                    738: 	$result.=&Apache::edit::select_arg('Location:','location',
                    739: 					   ['random','top','bottom'],$token);
                    740:     }
1.30      matthew   741:     $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
1.25      albertel  742:   } elsif ($target eq 'modified') {
1.48      albertel  743:     my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
                    744: 						 'value','name','location');
1.22      albertel  745:     if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
1.32      sakharuk  746:   } 
1.22      albertel  747:   return $result;
1.1       albertel  748: }
                    749: 
                    750: sub end_foil {
1.22      albertel  751:   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
                    752:   my $text ='';
                    753:   my $result = '';
1.88      albertel  754:   if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { 
1.48      albertel  755:       $text=&Apache::lonxml::endredirection;
1.114     sakharuk  756:       if ($target eq 'tex') {$text=~s/\\strut\s*\\\\\s*\\strut/\\vskip 0 mm/;}
1.107     sakharuk  757:       if (($target eq 'tex') and ($Apache::lonhomework::type ne 'exam') and ($text=~/\S/)) {$text = '\vspace*{-2 mm}\item '.$text;} 
1.32      sakharuk  758:   }
                    759:   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' 
1.34      albertel  760:       || $target eq 'tex' || $target eq 'analyze') {
1.22      albertel  761:     my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
1.122     albertel  762:     if ($target eq 'tex' && $Apache::lonhomework::type eq 'exam') {
                    763: 	$text='\vskip 5mm $\triangleright$ '.$text;
                    764:     }
1.22      albertel  765:     if ($value ne 'unused') {
                    766:       my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
                    767:       &Apache::lonxml::debug("Got a name of :$name:");
1.129     albertel  768:       if ($name eq "") {
1.151     bisitz    769: 	  &Apache::lonxml::warning(&mt('Foils without names exist. This can cause problems to malfunction.'));
1.123     albertel  770: 	  $name=$Apache::lonxml::curdepth;
                    771:       }
1.22      albertel  772:       &Apache::lonxml::debug("Using a name of :$name:");
1.103     albertel  773:       if (defined($Apache::response::foilnames{$name})) {
1.151     bisitz    774: 	  &Apache::lonxml::error(&mt("Foil name [_1] appears more than once. Foil names need to be unique.",'<b><tt>'.$name.'</tt></b>'));
1.103     albertel  775:       }
1.104     albertel  776:       $Apache::response::foilnames{$name}++;
1.103     albertel  777:       my $location =&Apache::lonxml::get_param('location',$parstack,$safeeval);
1.39      albertel  778:       if ( $Apache::optionresponse::conceptgroup
                    779: 	   && !&Apache::response::showallfoils() ) {
1.22      albertel  780: 	push @{ $Apache::response::conceptgroup{'names'} }, $name;
                    781: 	$Apache::response::conceptgroup{"$name.value"} = $value;
1.122     albertel  782: 	$Apache::response::conceptgroup{"$name.text"} = $text;
1.48      albertel  783: 	$Apache::response::conceptgroup{"$name.location"} = $location;
1.22      albertel  784:       } else {
                    785: 	push @{ $Apache::response::foilgroup{'names'} }, $name;
1.48      albertel  786: 	$Apache::response::foilgroup{"$name.value"} = $value;
1.122     albertel  787: 	$Apache::response::foilgroup{"$name.text"} = $text;
1.48      albertel  788: 	$Apache::response::foilgroup{"$name.location"} = $location;
1.22      albertel  789:       }
                    790:     }
                    791:   }
                    792:   if ($target eq 'edit') {
                    793:     $result.= &Apache::edit::tag_end($target,$token,'');
                    794:   }
                    795:   return $result;
1.1       albertel  796: }
                    797: 
1.112     sakharuk  798: sub start_drawoptionlist {
                    799:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.144     albertel  800:     if ($target !~ /^(?:meta|answer|modified|edit)$/) {
1.117     albertel  801: 	return $token->[4];
                    802:     }
1.112     sakharuk  803: }
                    804: 
                    805: sub end_drawoptionlist {
                    806:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.144     albertel  807:     if ($target !~ /^(?:meta|answer|modified|edit)$/) {
1.117     albertel  808: 	return $token->[2];
                    809:     }
1.112     sakharuk  810: }
                    811: 
1.7       albertel  812: sub insert_foil {
1.144     albertel  813:     return '
1.15      albertel  814: <foil name="" value="unused">
1.14      albertel  815: <startouttext />
                    816: <endouttext />
1.7       albertel  817: </foil>';
                    818: }
1.144     albertel  819: 
                    820: sub insert_drawoptionlist {
                    821:     return '<drawoptionlist />';
                    822: }
1.1       albertel  823: 1;
                    824: __END__
                    825:  
1.156     jms       826: =head1 NAME
                    827: 
                    828: Apache::optionresponse.pm;
                    829: 
                    830: =head1 SYNOPSIS
                    831: 
                    832: Handles tags associated with showing a list of
                    833: options.
                    834: 
                    835: This is part of the LearningOnline Network with CAPA project
                    836: described at http://www.lon-capa.org.
                    837: 
                    838: =head1 HANDLER SUBROUTINE
                    839: 
                    840: start_optionresponse()
                    841: 
                    842: =head1 OTHER SUBROUTINES
                    843: 
                    844: =over
                    845: 
                    846: =item end_optionresponse()
                    847: 
                    848: =item start_foilgroup()
                    849: 
                    850: =item end_foilgroup()
                    851: 
                    852: =item getfoilcounts()
                    853: 
                    854: =item displayanswers()
                    855: 
                    856: =item check_for_invalid()
                    857: 
                    858: =item displayfoils()
                    859: 
                    860: =item optionlist_correction()
                    861: 
                    862: =item webbubbles()
                    863: 
                    864: =item bubbles()
                    865: 
                    866: =item start_conceptgroup()
                    867: 
                    868: =item end_conceptgroup()
                    869: 
                    870: =item insert_conceptgroup()
                    871: 
                    872: =item start_foil()
                    873: 
                    874: =item end_foil()
                    875: 
                    876: =item start_drawoptionlist()
                    877: 
                    878: =item end_drawoptionlist()
                    879: 
                    880: =item insert_foil()
                    881: 
                    882: =item insert_drawoptionlist()
                    883: 
                    884: =back
                    885: 
1.157     raeburn   886: =cut

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