File:  [LON-CAPA] / loncom / homework / caparesponse / caparesponse.pm
Revision 1.97: download - view: text, annotated - select for diffs
Fri May 9 22:24:05 2003 UTC (21 years ago) by albertel
Branches: MAIN
CVS tags: HEAD
- some of BUG#628, also needed for online exams, disable feedback to students about whether they are correct or not.

    1: # The LearningOnline Network with CAPA
    2: # caparesponse definition
    3: #
    4: # $Id: caparesponse.pm,v 1.97 2003/05/09 22:24:05 albertel 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: 
   29: package Apache::caparesponse;
   30: use strict;
   31: use capa;
   32: 
   33: BEGIN {
   34:     &Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse'));
   35: }
   36: 
   37: sub start_numericalresponse {
   38:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   39:     my $id = &Apache::response::start_response($parstack,$safeeval);
   40:     my $result;
   41:     if ($target eq 'edit') {
   42: 	$result.=&Apache::edit::tag_start($target,$token);
   43: 	$result.=&Apache::edit::text_arg('Answer:','answer',$token);
   44: 	if ($token->[1] eq 'numericalresponse') {
   45: 	    $result.=&Apache::edit::text_arg('Unit:','unit',$token,5).
   46: 		&Apache::loncommon::help_open_topic('Physical_Units');
   47: 	    $result.=&Apache::edit::text_arg('Format:','format',$token,4).
   48: 		&Apache::loncommon::help_open_topic('Numerical_Response_Format');
   49: 	} elsif ($token->[1] eq 'stringresponse') {
   50: 	    $result.=&Apache::edit::select_arg('Type:','type',
   51: 			 [['cs','Case Sensitive'],['ci','Case Insensitive'],
   52: 			  ['mc','Case Insensitive, Any Order']],$token);
   53: 	} elsif ($token->[1] eq 'formularesponse') {
   54: 	    $result.=&Apache::edit::text_arg('Sample Points:','samples',
   55: 					     $token,40).
   56: 	      &Apache::loncommon::help_open_topic('Formula_Response_Sampling');
   57: 	}
   58: 	$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
   59:     } elsif ($target eq 'modified') {
   60: 	my $constructtag;
   61: 	if ($token->[1] eq 'numericalresponse') {
   62: 	    $constructtag=&Apache::edit::get_new_args($token,$parstack,
   63: 						      $safeeval,'answer',
   64: 						      'unit','format');
   65: 	} elsif ($token->[1] eq 'stringresponse') {
   66: 	    $constructtag=&Apache::edit::get_new_args($token,$parstack,
   67: 						      $safeeval,'answer',
   68: 						      'type');
   69: 	} elsif ($token->[1] eq 'formularesponse') {
   70: 	    $constructtag=&Apache::edit::get_new_args($token,$parstack,
   71: 						      $safeeval,'answer',
   72: 						      'samples');
   73: 	}
   74: 	if ($constructtag) {
   75: 	    $result = &Apache::edit::rebuild_tag($token);
   76: 	    $result.=&Apache::edit::handle_insert();
   77: 	}
   78:     } elsif ($target eq 'meta') {
   79: 	$result=&Apache::response::meta_package_write('numericalresponse');
   80:     } elsif ($target eq 'answer' || $target eq 'grade') {
   81: 	&Apache::response::reset_params();
   82:     } elsif ($target eq 'web') {
   83: 	my $partid = $Apache::inputtags::part;
   84: 	my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit');
   85: 	&Apache::lonxml::debug("Got unit $hideunit for $partid $id");
   86: 	#no way to enter units, with radio buttons
   87: 	if (lc($hideunit) eq "yes") {
   88: 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
   89: 						    $safeeval);
   90: 	    if ($unit =~ /\S/) { $result.=" (in $unit) "; }
   91: 	}
   92:     }
   93:     return $result;
   94: }
   95: 
   96: sub end_numericalresponse {
   97:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   98:     my $increment=1;
   99:     my $result = '';
  100:     if (!$Apache::lonxml::default_homework_loaded) {
  101: 	&Apache::lonxml::default_homework_load($safeeval);
  102:     }
  103:     if ( $target eq 'grade' && defined($ENV{'form.submitted'})) {
  104: 	&Apache::response::setup_params($$tagstack[-1]);
  105: 	$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
  106: 	my $partid = $Apache::inputtags::part;
  107: 	my $id = $Apache::inputtags::response['-1'];
  108: 	if ($Apache::lonhomework::type eq 'exam' && 
  109: 	    ($$tagstack[-1] eq 'formularesponse' ||
  110: 	     $$tagstack[-1] eq 'stringresponse')) {
  111: 	    $increment=&Apache::response::scored_response($partid,$id);
  112: 	} else {
  113: 	    my $response = &Apache::response::getresponse();
  114: 	    if ( $response =~ /[^\s]/) {
  115: 		my $ad;
  116: 		my %previous = &Apache::response::check_for_previous($response,$partid,$id);
  117: 		$Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
  118: 		&Apache::lonxml::debug("submitted a $response<br>\n");
  119: 		&Apache::lonxml::debug($$parstack[-1] . "\n<br>");
  120: 		
  121: 		if ($ENV{'form.submitted'} eq 'scantron') {
  122: 		    my $number_of_bubbles = 8;#default values for number of bubbles
  123: 		    my (@formats)=&Apache::lonxml::get_param_var('format',
  124: 								 $parstack,$safeeval);
  125: 		    my (@answers)=&Apache::lonxml::get_param_var('answer',
  126: 								 $parstack,$safeeval);
  127: 		    my @values=&make_numerical_bubbles($number_of_bubbles,$target,
  128: 						       $answers[0],$formats[0]);
  129: 		    $response=$values[$response];
  130: 		} else {
  131: 		    $response =~ s/\\/\\\\/g;
  132: 		    $response =~ s/\'/\\\'/g;
  133: 		}
  134: 		&Apache::lonxml::debug("current $response");
  135: 		my $expression="&caparesponse_check_list('".$response."','".
  136: 		    $$parstack[-1];
  137: 		my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit');
  138: 		#no way to enter units, with radio buttons
  139: 		if ($Apache::lonhomework::type eq 'exam' ||
  140: 		    lc($hideunit) eq "yes") {
  141: 		    $expression.=';my $unit=undef;';
  142: 		}
  143: 		foreach my $key (keys(%Apache::inputtags::params)) {
  144: 		    $expression.= ';my $'. #'
  145: 			$key.'="'.$Apache::inputtags::params{$key}.'"';
  146: 		}
  147: 		if ($$tagstack[-1] eq 'formularesponse') {
  148: 		    $expression.=';my $type="fml";';
  149: 		} elsif ($$tagstack[-1] eq 'numericalresponse') {
  150: 		    $expression.=';my $type="float";';
  151: 		}
  152: 		$expression.="');";
  153: 		$result = &Apache::run::run($expression,$safeeval);
  154: 		my ($awards) = split /:/ , $result;
  155: 		($ad) = &Apache::inputtags::finalizeawards(split /,/ , $awards);
  156: 		&Apache::lonxml::debug("$expression");
  157: 		&Apache::lonxml::debug("\n<br>result:$result:$Apache::lonxml::curdepth<br>\n");
  158: 		&Apache::response::handle_previous(\%previous,$ad);
  159: 		$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad;
  160: 		$result='';
  161: 	    }
  162: 	}
  163:     } elsif ($target eq 'web' || $target eq 'tex') {
  164: 	my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,
  165: 						     $safeeval);
  166: 	my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
  167: 	my $status = $Apache::inputtags::status['-1'];
  168: 	if (   ($award =~ /^correct/
  169:                 && lc($Apache::lonhomework::problemstatus) ne 'no')
  170:              || $status eq "SHOW_ANSWER"
  171:              || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
  172: 	    my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
  173: 							 $safeeval);
  174: 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
  175: 						    $safeeval);
  176: 	    if ($target eq 'web') {
  177: 		$result="<br />The correct answer is ";
  178: 	    } elsif ($target eq 'tex') {
  179: 		if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
  180: 		    $result='\vskip 0 mm The correct answer is \\texttt{ ';
  181: 		}
  182: 	    }
  183: 	    for (my $i=0; $i <= $#answers; $i++) {
  184: 		my $answer=$answers[$i];
  185: 		my $format;
  186: 		if ($#formats > 0) {
  187: 		    $format=$formats[$i];
  188: 		} else {
  189: 		    $format=$formats[0];
  190: 		}
  191: 		my $formatted;
  192: 		if ((defined($format)) && ($format ne '')) {
  193: 		    &Apache::lonxml::debug("formatting with :$format: answer :$answer:");
  194: 		    $formatted=sprintf('%.'.$format,$answer).',';
  195: 		} else {
  196: 		    &Apache::lonxml::debug("no format answer :$answer:");
  197: 		    $formatted="$answer,";
  198: 		}
  199: 		if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
  200: 		    $result.=$formatted;
  201: 		}
  202: 		if ($target eq 'tex') {
  203: 		    $formatted='';
  204: 		    #$formatted=&Apache::lonxml::latex_special_symbols($formatted);
  205: 		}
  206: 		$result.=$formatted;
  207: 	    }
  208: 	    chop $result;
  209: 	    if ($target eq 'web') {
  210: 		$result.=" $unit.<br />";
  211: 	    } elsif ($target eq 'tex') {		
  212: 		if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
  213: 		    $result.=&Apache::lonxml::latex_special_symbols($unit);
  214: 		    $result.="}. \\vskip 0 mm ";
  215: 		}
  216: 	    }
  217: 	}
  218: 	if ($Apache::lonhomework::type eq 'exam') {
  219: 	    my $number_of_bubbles = 8; #default values for number of bubbles
  220: 	    my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
  221: 							 $safeeval);
  222: 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
  223: 						    $safeeval);
  224: 	    my @bubble_values=&make_numerical_bubbles($number_of_bubbles,
  225: 						      $target,$answers[0],
  226: 						      $formats[0]);
  227: 	    my @alphabet=('A'..'Z');
  228: 	    my $id=$Apache::inputtags::response[-1];
  229: 	    if ($target eq 'web') {
  230: 		if ($$tagstack[-1] eq 'numericalresponse') {
  231: 		    if ($unit=~/\S/) {$result.=' (in '.$unit.')<br /><br />';}
  232: 		    $result.= '<table border="1"><tr>';
  233: 		    for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
  234: 			$result.='<td><input type="radio" name="HWVAL_'.$id.
  235: 			    '" value="'.$bubble_values[$ind].'"><b>'.
  236: 				$alphabet[$ind].'</b>: '.
  237: 				    $bubble_values[$ind].'</td>';
  238: 		    }
  239: 		    $result.='</tr></table>';
  240: 		} elsif ($$tagstack[-1] eq 'formularesponse') {
  241: 		    $result.= '<br /><br /><font color="red">
  242:                            <textarea name="HWVAL_'.$id.'" rows="4" cols="50">
  243:                            </textarea></font> <br /><br />';
  244: 		}
  245: 	    } elsif ($target eq 'tex') {
  246: 		if (defined $unit and $Apache::lonhomework::type eq 'exam') {
  247: 		    $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} ';
  248: 		}
  249: 		if ($$tagstack[-1] eq 'numericalresponse') {
  250: 		    my ($celllength,$number_of_tables,@table_range)=
  251: 			&get_table_sizes($formats[0],$number_of_bubbles);
  252: 		    my $j=0;
  253: 		    my $cou=0;
  254: 		    $result.='\vskip -1 mm \noindent \begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]';
  255: 		    for (my $i=0;$i<$number_of_tables;$i++) {
  256: 			$result.='\vskip -1 mm \noindent \begin{tabular}{';
  257: 			for (my $ind=0;$ind<$table_range[$j];$ind++) {
  258: 			    $result.='lp{'.$celllength.' mm}';
  259: 			}
  260: 			$result.='}';
  261: 			for (my $ind=$cou;$ind<$cou+$table_range[$j];$ind++) {
  262: 			    $result.='\hskip -3 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -2 mm & {\small '.$bubble_values[$ind].'} ';
  263: 			    if ($ind != $cou+$table_range[$j]-1) {$result.=' & ';}
  264: 			}
  265: 			$cou += $table_range[$j];
  266: 			$j++;
  267: 			$result.='\\\\\end{tabular}\vskip 0 mm ';
  268: 		    }
  269: 		    $result.='\end{enumerate}';
  270: 		} else {
  271: 		    $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';
  272: 		    my $repetition = &Apache::response::repetition();
  273: 		    $result.='\begin{enumerate}';
  274: 		    for (my $i=0;$i<$repetition;$i++) {
  275: 			$result.='\item[\textbf{'.($Apache::lonxml::counter+$i).'}.]\textit{Leave blank on scoring form}\vskip 0 mm';
  276: 		    }
  277: 		    $increment=$repetition;
  278: 		    $result.= '\end{enumerate}';
  279: 		}
  280: 	    }
  281: 	}
  282:     } elsif ($target eq 'edit') {
  283: 	$result.='</td></tr>'.&Apache::edit::end_table;
  284:     } elsif ($target eq 'answer' || $target eq 'analyze') {
  285: 	
  286: 	my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
  287: 	if ($target eq 'analyze') {
  288: 	    push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
  289: 	    $Apache::lonhomework::analyze{"$part_id.type"} = $$tagstack[-1];
  290: 	}
  291: 	&Apache::response::setup_params($$tagstack[-1]);
  292: 	my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
  293: 	my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
  294: 	my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);
  295: 	my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval);
  296: 	
  297: 	if ($target eq 'answer') {
  298: 	    $result.=&Apache::response::answer_header($$tagstack[-1]);
  299: 	}
  300: 	for(my $i=0;$i<=$#answers;$i++) {
  301: 	    my $ans=$answers[$i];
  302: 	    my $fmt=$formats[0];
  303: 	    if (@formats && $#formats) {$fmt=$formats[$i];}
  304: 	    my ($high,$low);
  305: 	    if ($Apache::inputtags::params{'tol'}) {
  306: 		($high,$low)=&get_tolrange($ans,$Apache::inputtags::params{'tol'});
  307: 	    }
  308: 	    my ($sighigh,$siglow);
  309: 	    if ($Apache::inputtags::params{'sig'}) {
  310: 		($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'});
  311: 	    }
  312: 	    if ($fmt) {
  313: 		$ans = sprintf('%.'.$fmt,$ans);
  314: 		if ($high) {
  315: 		    $high=sprintf('%.'.$fmt,$high);
  316: 		    $low =sprintf('%.'.$fmt,$low);
  317: 		}
  318: 	    }
  319: 	    if ($target eq 'answer') {
  320: 		if ($high) { $ans.=' ['.$low.','.$high.']'; }
  321: 		if ($sighigh) { $ans.= " Sig <i>$siglow - $sighigh</i>"; }
  322: 		$result.=&Apache::response::answer_part($$tagstack[-1],$ans);
  323: 	    } elsif ($target eq 'analyze') {
  324: 		push (@{ $Apache::lonhomework::analyze{"$part_id.answer"} }, $ans);
  325: 		if ($high) {
  326: 		    push (@{ $Apache::lonhomework::analyze{"$part_id.ans_high"} }, $high);
  327: 		    push (@{ $Apache::lonhomework::analyze{"$part_id.ans_low"} }, $low);
  328: 		}
  329: 	    }
  330: 	}
  331: 	if ($unit) {
  332: 	    if ($target eq 'answer') {
  333: 		$result.=&Apache::response::answer_part($$tagstack[-1],
  334: 							"Unit: <b>$unit</b>");
  335: 	    } elsif ($target eq 'analyze') {
  336: 		push (@{ $Apache::lonhomework::analyze{"$part_id.unit"} },
  337: 		      $unit);
  338: 	    }
  339: 	}
  340: 	if ($type || $token->[1] eq 'stringresponse') {
  341: 	    my $string='Case Insensitive';
  342: 	    if ($type eq 'mc') {
  343: 		$string='Multiple Choice';
  344: 	    } elsif ($type eq 'cs') {
  345: 		$string='Case Sensitive';
  346: 	    } elsif ($type eq 'ci') {
  347: 		$string='Case Insensitive';
  348: 	    } elsif ($type eq 'fml') {
  349: 		$string='Formula';
  350: 	    }
  351: 	    if ($target eq 'answer') {
  352: 		$result.=&Apache::response::answer_part($$tagstack[-1],
  353: 							'<b>'.$string.'</b>');
  354: 	    } elsif ($target eq 'analyze') {
  355: 		push (@{ $Apache::lonhomework::analyze{"$part_id.type"} },
  356: 		      $type);
  357: 	    }
  358: 	}
  359: 	if ($$tagstack[-1] eq 'formularesponse' && $target eq 'answer') {
  360: 	    my $samples=&Apache::lonxml::get_param('samples',$parstack,$safeeval);
  361: 	    $result.=&Apache::response::answer_part($$tagstack[-1],$samples);
  362: 	}
  363: 	if ($target eq 'answer') {
  364: 	    $result.=&Apache::response::answer_footer($$tagstack[-1]);
  365: 	}
  366:     }
  367:     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
  368: 	$target eq 'tex' || $target eq 'analyze') {
  369: 	&Apache::lonxml::increment_counter($increment);
  370:     }
  371:     &Apache::response::end_response;
  372:     return $result;
  373: }
  374: 
  375: sub get_table_sizes {
  376:     my ($format,$number_of_bubbles)=@_;
  377:     my $max_val = 0;
  378:     if ($format=~m/^(\d+)E([^\d]*)(\d*)$/) {
  379: 	$max_val=$1+$2+4;
  380:     } else {
  381: 	$max_val=4;
  382:     }
  383:     $max_val = int(0.9*$ENV{'form.textwidth'}/(($max_val+6)*2));
  384:     my $celllength = 0.9*$ENV{'form.textwidth'}/$max_val-10;
  385:     my @table_range = ();
  386:     my $number_of_tables = int($number_of_bubbles/$max_val);
  387:     for (my $i=0;$i<$number_of_tables;$i++) {push @table_range,$max_val;}
  388:     if ($number_of_bubbles % $max_val != 0) {
  389: 	$number_of_tables++;
  390: 	push @table_range,($number_of_bubbles % $max_val);
  391:     }
  392:     return ($celllength,$number_of_tables,@table_range);
  393: }
  394: 
  395: sub format_number {
  396:     my ($number,$format,$target)=@_;
  397:     my $ans;
  398:     if ($format ne '') {
  399: 	$ans = sprintf('%.'.$format,$number);
  400:     } else {
  401: 	my $format = '';
  402: 	#What is the number? (integer,decimal,floating point)
  403: 	if ($number=~/^(\d*\.?\d*)(E|e)(\d*)$/) {
  404: 	    $format = 'e'.$2;
  405: 	} elsif ($number=~/^(\d*)\.(\d*)$/) {
  406: 	    $format = '4f';
  407: 	} elsif ($number=~/^(\d*)$/) {
  408: 	    $format = 'd';
  409: 	}
  410: 	$ans = sprintf('%.'.$format,$number);
  411:     }
  412:     if ($target eq 'tex') {
  413: 	if ($ans =~ m/([0-9\.\-\+]+)E([0-9\-\+]+)/ ) {
  414: 	    my $number = $1;
  415: 	    my $power = $2;
  416: 	    $power=~s/^\+//;
  417: 	    $power=~s/^(-?)0+(\d+)//;
  418: 	    $ans=$number.'$\times 10^{'.$1.$2.'}$'; #'stupidemacs
  419: 	}
  420:     }
  421:     return $ans;
  422: }
  423: 
  424: sub make_numerical_bubbles {
  425:     my ($number_of_bubbles,$target,$answer,$format) =@_;
  426:     my @bubble_values = ();
  427:     my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors
  428:     my @powers = (1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0); #default values for powers
  429:     &Apache::response::setrandomnumber();
  430:     my $ind=&Math::Random::random_uniform_integer(1,0,$#powers);
  431:     my $power = $powers[$ind];
  432:     $ind=&Math::Random::random_uniform_integer(1,0,$#factors);
  433:     my $factor = $factors[$ind];
  434:     for ($ind=0;$ind<$number_of_bubbles;$ind++) {
  435: 	$bubble_values[$ind] = $answer*($factor**($power-$powers[$#powers-$ind]));
  436: 	$bubble_values[$ind] = &format_number($bubble_values[$ind],
  437: 					       $format,$target);
  438: 
  439:     }
  440:     return @bubble_values;
  441: }
  442: 
  443: sub get_tolrange {
  444:     my ($ans,$tol)=@_;
  445:     my ($high,$low);
  446:     if ($tol =~ /%$/) {
  447: 	chop($tol);
  448: 	my $change=$ans*($tol/100.0);
  449: 	$high=$ans+$change;
  450: 	$low=$ans-$change;
  451:     } else {
  452: 	$high=$ans+$tol;
  453: 	$low=$ans-$tol;
  454:     }
  455:     return ($high,$low);
  456: }
  457: 
  458: sub get_sigrange {
  459:     my ($sig)=@_;
  460:     &Apache::lonxml::debug("Got a sig of :$sig:");
  461:     my $sig_lbound;
  462:     my $sig_ubound;
  463:     if ($sig eq '') {
  464: 	$sig_lbound = 0; #SIG_LB_DEFAULT
  465: 	$sig_ubound =15; #SIG_UB_DEFAULT
  466:     } else {
  467: 	($sig_lbound,$sig_ubound) = split(/,/,$sig);
  468: 	if (!$sig_lbound) {
  469: 	    $sig_lbound = 0; #SIG_LB_DEFAULT
  470: 	    $sig_ubound =15; #SIG_UB_DEFAULT
  471: 	}
  472: 	if (!$sig_ubound) { $sig_ubound=$sig_lbound; }
  473:     }
  474:     return ($sig_ubound,$sig_lbound);
  475: }
  476: 
  477: sub start_stringresponse {
  478:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  479:     my $result;
  480:     if ($target eq 'meta') {
  481: 	$result=&Apache::response::meta_package_write('stringresponse');
  482:     } else {
  483: 	$result.=&start_numericalresponse(@_);
  484:     }
  485:     return $result;
  486: }
  487: 
  488: sub end_stringresponse {
  489:     return end_numericalresponse(@_);
  490: }
  491: 
  492: sub start_formularesponse {
  493:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
  494:     my $result;
  495:     if ($target eq 'meta') {
  496: 	$result=&Apache::response::meta_package_write('formularesponse');
  497:     } else {
  498: 	$result.=&start_numericalresponse(@_);
  499:     }
  500:     return $result;
  501: }
  502: 
  503: sub end_formularesponse {
  504:     return end_numericalresponse(@_);
  505: }
  506: 
  507: 1;
  508: __END__
  509: 

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