Annotation of loncom/homework/caparesponse/caparesponse.pm, revision 1.116
1.3 albertel 1: # The LearningOnline Network with CAPA
2: # caparesponse definition
1.47 albertel 3: #
1.116 ! albertel 4: # $Id: caparesponse.pm,v 1.115 2003/10/14 22:53:22 albertel Exp $
1.47 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.3 albertel 28:
29: package Apache::caparesponse;
30: use strict;
1.4 albertel 31: use capa;
1.3 albertel 32:
1.50 harris41 33: BEGIN {
1.89 albertel 34: &Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse'));
1.3 albertel 35: }
36:
1.89 albertel 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();
1.22 albertel 77: }
1.89 albertel 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();
1.96 albertel 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: }
1.16 albertel 92: }
1.89 albertel 93: return $result;
1.21 albertel 94: }
95:
1.89 albertel 96: sub end_numericalresponse {
97: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
1.90 albertel 98: my $increment=1;
1.89 albertel 99: my $result = '';
100: if (!$Apache::lonxml::default_homework_loaded) {
101: &Apache::lonxml::default_homework_load($safeeval);
1.34 albertel 102: }
1.95 albertel 103: if ( $target eq 'grade' && defined($ENV{'form.submitted'})) {
1.90 albertel 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'];
1.95 albertel 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::lonxml::debug("submitted a $response<br>\n");
118: &Apache::lonxml::debug($$parstack[-1] . "\n<br>");
119:
120: if ($ENV{'form.submitted'} eq 'scantron') {
121: my $number_of_bubbles = 8;#default values for number of bubbles
122: my (@formats)=&Apache::lonxml::get_param_var('format',
123: $parstack,$safeeval);
124: my (@answers)=&Apache::lonxml::get_param_var('answer',
125: $parstack,$safeeval);
126: my @values=&make_numerical_bubbles($number_of_bubbles,$target,
127: $answers[0],$formats[0]);
128: $response=$values[$response];
129: } else {
130: $response =~ s/\\/\\\\/g;
131: $response =~ s/\'/\\\'/g;
132: }
1.115 albertel 133: $Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
1.95 albertel 134: &Apache::lonxml::debug("current $response");
135: my $expression="&caparesponse_check_list('".$response."','".
136: $$parstack[-1];
1.96 albertel 137: my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit');
1.95 albertel 138: #no way to enter units, with radio buttons
1.96 albertel 139: if ($Apache::lonhomework::type eq 'exam' ||
140: lc($hideunit) eq "yes") {
1.95 albertel 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.="');";
1.105 albertel 153: my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
154: &Apache::lonxml::debug('answer is'.join(':',@answer));
155: @{$safeeval->varglob('CAPARESPONSE_CHECK_LIST_answer')}=@answer;
156:
1.95 albertel 157: $result = &Apache::run::run($expression,$safeeval);
158: my ($awards) = split /:/ , $result;
159: ($ad) = &Apache::inputtags::finalizeawards(split /,/ , $awards);
160: &Apache::lonxml::debug("$expression");
161: &Apache::lonxml::debug("\n<br>result:$result:$Apache::lonxml::curdepth<br>\n");
162: &Apache::response::handle_previous(\%previous,$ad);
163: $Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad;
164: $result='';
1.90 albertel 165: }
1.89 albertel 166: }
167: } elsif ($target eq 'web' || $target eq 'tex') {
1.90 albertel 168: my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,
169: $safeeval);
1.89 albertel 170: my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
171: my $status = $Apache::inputtags::status['-1'];
1.114 albertel 172: if ( &Apache::response::show_answer() ) {
1.89 albertel 173: my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
174: $safeeval);
175: my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
176: $safeeval);
177: if ($target eq 'web') {
178: $result="<br />The correct answer is ";
179: }
180: for (my $i=0; $i <= $#answers; $i++) {
181: my $answer=$answers[$i];
182: my $format;
183: if ($#formats > 0) {
184: $format=$formats[$i];
185: } else {
186: $format=$formats[0];
187: }
188: my $formatted;
189: if ((defined($format)) && ($format ne '')) {
1.109 albertel 190: $format=~s/e/E/g;
1.89 albertel 191: &Apache::lonxml::debug("formatting with :$format: answer :$answer:");
192: $formatted=sprintf('%.'.$format,$answer).',';
193: } else {
194: &Apache::lonxml::debug("no format answer :$answer:");
195: $formatted="$answer,";
196: }
197: if ($target eq 'tex') {
198: $formatted='';
199: #$formatted=&Apache::lonxml::latex_special_symbols($formatted);
200: }
201: $result.=$formatted;
202: }
203: chop $result;
204: if ($target eq 'web') {
205: $result.=" $unit.<br />";
206: }
207: }
208: if ($Apache::lonhomework::type eq 'exam') {
1.90 albertel 209: my $number_of_bubbles = 8; #default values for number of bubbles
1.89 albertel 210: my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
211: $safeeval);
212: my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
213: $safeeval);
1.90 albertel 214: my @bubble_values=&make_numerical_bubbles($number_of_bubbles,
1.91 albertel 215: $target,$answers[0],
216: $formats[0]);
1.89 albertel 217: my @alphabet=('A'..'Z');
1.90 albertel 218: my $id=$Apache::inputtags::response[-1];
1.89 albertel 219: if ($target eq 'web') {
220: if ($$tagstack[-1] eq 'numericalresponse') {
221: if ($unit=~/\S/) {$result.=' (in '.$unit.')<br /><br />';}
222: $result.= '<table border="1"><tr>';
1.116 ! albertel 223: my $previous=$Apache::lonhomework::history{"resource.$Apache::inputtags::part.$id.submission"};
1.90 albertel 224: for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
1.116 ! albertel 225: my $checked='';
! 226: if ($previous eq $bubble_values[$ind]) {
! 227: $checked=" checked='on' ";
! 228: }
1.90 albertel 229: $result.='<td><input type="radio" name="HWVAL_'.$id.
1.116 ! albertel 230: '" value="'.$bubble_values[$ind].'" '.$checked
! 231: .' /><b>'.$alphabet[$ind].'</b>: '.
! 232: $bubble_values[$ind].'</td>';
1.89 albertel 233: }
234: $result.='</tr></table>';
235: } elsif ($$tagstack[-1] eq 'formularesponse') {
1.90 albertel 236: $result.= '<br /><br /><font color="red">
237: <textarea name="HWVAL_'.$id.'" rows="4" cols="50">
238: </textarea></font> <br /><br />';
1.89 albertel 239: }
240: } elsif ($target eq 'tex') {
1.107 sakharuk 241: if ((defined $unit) and ($unit=~/\S/) and ($Apache::lonhomework::type eq 'exam')) {
1.89 albertel 242: $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} ';
243: }
244: if ($$tagstack[-1] eq 'numericalresponse') {
1.90 albertel 245: my ($celllength,$number_of_tables,@table_range)=
246: &get_table_sizes($formats[0],$number_of_bubbles);
1.89 albertel 247: my $j=0;
248: my $cou=0;
249: $result.='\vskip -1 mm \noindent \begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]';
250: for (my $i=0;$i<$number_of_tables;$i++) {
251: $result.='\vskip -1 mm \noindent \begin{tabular}{';
1.90 albertel 252: for (my $ind=0;$ind<$table_range[$j];$ind++) {
1.89 albertel 253: $result.='lp{'.$celllength.' mm}';
254: }
255: $result.='}';
1.90 albertel 256: for (my $ind=$cou;$ind<$cou+$table_range[$j];$ind++) {
1.91 albertel 257: $result.='\hskip -3 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -2 mm & {\small '.$bubble_values[$ind].'} ';
1.89 albertel 258: if ($ind != $cou+$table_range[$j]-1) {$result.=' & ';}
259: }
260: $cou += $table_range[$j];
261: $j++;
262: $result.='\\\\\end{tabular}\vskip 0 mm ';
263: }
264: $result.='\end{enumerate}';
265: } else {
266: $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';
1.93 albertel 267: my $repetition = &Apache::response::repetition();
1.89 albertel 268: $result.='\begin{enumerate}';
269: for (my $i=0;$i<$repetition;$i++) {
1.93 albertel 270: $result.='\item[\textbf{'.($Apache::lonxml::counter+$i).'}.]\textit{Leave blank on scoring form}\vskip 0 mm';
1.89 albertel 271: }
1.90 albertel 272: $increment=$repetition;
1.89 albertel 273: $result.= '\end{enumerate}';
274: }
275: }
276: }
277: } elsif ($target eq 'edit') {
278: $result.='</td></tr>'.&Apache::edit::end_table;
279: } elsif ($target eq 'answer' || $target eq 'analyze') {
1.58 sakharuk 280:
1.89 albertel 281: my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
282: if ($target eq 'analyze') {
283: push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
284: $Apache::lonhomework::analyze{"$part_id.type"} = $$tagstack[-1];
285: }
286: &Apache::response::setup_params($$tagstack[-1]);
287: my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
1.58 sakharuk 288: my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
289: my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);
1.89 albertel 290: my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval);
291:
292: if ($target eq 'answer') {
293: $result.=&Apache::response::answer_header($$tagstack[-1]);
294: }
295: for(my $i=0;$i<=$#answers;$i++) {
296: my $ans=$answers[$i];
1.90 albertel 297: my $fmt=$formats[0];
298: if (@formats && $#formats) {$fmt=$formats[$i];}
1.89 albertel 299: my ($high,$low);
300: if ($Apache::inputtags::params{'tol'}) {
301: ($high,$low)=&get_tolrange($ans,$Apache::inputtags::params{'tol'});
302: }
303: my ($sighigh,$siglow);
304: if ($Apache::inputtags::params{'sig'}) {
305: ($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'});
306: }
1.102 albertel 307: if ($fmt && $$tagstack[-1] eq 'numericalresponse') {
1.112 albertel 308: $fmt=~s/e/E/g;
1.89 albertel 309: $ans = sprintf('%.'.$fmt,$ans);
310: if ($high) {
1.90 albertel 311: $high=sprintf('%.'.$fmt,$high);
312: $low =sprintf('%.'.$fmt,$low);
1.62 sakharuk 313: }
1.60 sakharuk 314: }
1.89 albertel 315: if ($target eq 'answer') {
1.102 albertel 316: if ($high && $$tagstack[-1] eq 'numericalresponse') { $ans.=' ['.$low.','.$high.']'; }
317: if ($sighigh && $$tagstack[-1] eq 'numericalresponse') {
1.101 albertel 318: if ($ENV{'form.answer_output_mode'} eq 'tex') {
1.106 sakharuk 319: $ans.= " Sig $siglow - $sighigh";
1.98 sakharuk 320: } else {
1.101 albertel 321: $ans.= " Sig <i>$siglow - $sighigh</i>";
1.98 sakharuk 322: }
323: }
1.89 albertel 324: $result.=&Apache::response::answer_part($$tagstack[-1],$ans);
325: } elsif ($target eq 'analyze') {
326: push (@{ $Apache::lonhomework::analyze{"$part_id.answer"} }, $ans);
327: if ($high) {
328: push (@{ $Apache::lonhomework::analyze{"$part_id.ans_high"} }, $high);
329: push (@{ $Apache::lonhomework::analyze{"$part_id.ans_low"} }, $low);
1.58 sakharuk 330: }
1.79 sakharuk 331: }
1.36 albertel 332: }
1.102 albertel 333: if (defined($unit) and ($unit ne '') and
334: $$tagstack[-1] eq 'numericalresponse') {
1.89 albertel 335: if ($target eq 'answer') {
1.101 albertel 336: if ($ENV{'form.answer_output_mode'} eq 'tex') {
1.98 sakharuk 337: $result.=&Apache::response::answer_part($$tagstack[-1],
1.106 sakharuk 338: " Unit: $unit ");
1.98 sakharuk 339: } else {
340: $result.=&Apache::response::answer_part($$tagstack[-1],
341: "Unit: <b>$unit</b>");
342: }
1.89 albertel 343: } elsif ($target eq 'analyze') {
1.103 albertel 344: push (@{ $Apache::lonhomework::analyze{"$part_id.unit"} }, $unit);
1.89 albertel 345: }
346: }
1.103 albertel 347: if ($type || $$tagstack[-1] eq 'stringresponse') {
1.89 albertel 348: my $string='Case Insensitive';
349: if ($type eq 'mc') {
350: $string='Multiple Choice';
351: } elsif ($type eq 'cs') {
352: $string='Case Sensitive';
353: } elsif ($type eq 'ci') {
354: $string='Case Insensitive';
355: } elsif ($type eq 'fml') {
356: $string='Formula';
357: }
358: if ($target eq 'answer') {
1.101 albertel 359: if ($ENV{'form.answer_output_mode'} eq 'tex') {
360: $result.=&Apache::response::answer_part($$tagstack[-1],
1.108 sakharuk 361: "$string");
1.101 albertel 362: } else {
363: $result.=&Apache::response::answer_part($$tagstack[-1],
364: "<b>$string</b>");
365: }
1.89 albertel 366: } elsif ($target eq 'analyze') {
1.103 albertel 367: push (@{ $Apache::lonhomework::analyze{"$part_id.str_type"} },
1.89 albertel 368: $type);
369: }
370: }
371: if ($$tagstack[-1] eq 'formularesponse' && $target eq 'answer') {
372: my $samples=&Apache::lonxml::get_param('samples',$parstack,$safeeval);
373: $result.=&Apache::response::answer_part($$tagstack[-1],$samples);
374: }
375: if ($target eq 'answer') {
376: $result.=&Apache::response::answer_footer($$tagstack[-1]);
377: }
1.69 sakharuk 378: }
1.90 albertel 379: if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
380: $target eq 'tex' || $target eq 'analyze') {
381: &Apache::lonxml::increment_counter($increment);
382: }
1.89 albertel 383: &Apache::response::end_response;
384: return $result;
1.90 albertel 385: }
386:
387: sub get_table_sizes {
388: my ($format,$number_of_bubbles)=@_;
389: my $max_val = 0;
390: if ($format=~m/^(\d+)E([^\d]*)(\d*)$/) {
391: $max_val=$1+$2+4;
392: } else {
393: $max_val=4;
394: }
395: $max_val = int(0.9*$ENV{'form.textwidth'}/(($max_val+6)*2));
396: my $celllength = 0.9*$ENV{'form.textwidth'}/$max_val-10;
397: my @table_range = ();
398: my $number_of_tables = int($number_of_bubbles/$max_val);
399: for (my $i=0;$i<$number_of_tables;$i++) {push @table_range,$max_val;}
400: if ($number_of_bubbles % $max_val != 0) {
401: $number_of_tables++;
402: push @table_range,($number_of_bubbles % $max_val);
403: }
404: return ($celllength,$number_of_tables,@table_range);
405: }
406:
407: sub format_number {
408: my ($number,$format,$target)=@_;
409: my $ans;
410: if ($format ne '') {
1.109 albertel 411: $format=~s/e/E/g;
1.90 albertel 412: $ans = sprintf('%.'.$format,$number);
413: } else {
414: my $format = '';
415: #What is the number? (integer,decimal,floating point)
416: if ($number=~/^(\d*\.?\d*)(E|e)(\d*)$/) {
1.113 sakharuk 417: $format = '3e';
1.90 albertel 418: } elsif ($number=~/^(\d*)\.(\d*)$/) {
419: $format = '4f';
420: } elsif ($number=~/^(\d*)$/) {
421: $format = 'd';
422: }
423: $ans = sprintf('%.'.$format,$number);
424: }
425: if ($target eq 'tex') {
426: if ($ans =~ m/([0-9\.\-\+]+)E([0-9\-\+]+)/ ) {
427: my $number = $1;
428: my $power = $2;
429: $power=~s/^\+//;
430: $power=~s/^(-?)0+(\d+)//;
431: $ans=$number.'$\times 10^{'.$1.$2.'}$'; #'stupidemacs
432: }
433: }
434: return $ans;
435: }
436:
437: sub make_numerical_bubbles {
1.91 albertel 438: my ($number_of_bubbles,$target,$answer,$format) =@_;
439: my @bubble_values = ();
1.90 albertel 440: my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors
441: my @powers = (1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0); #default values for powers
442: &Apache::response::setrandomnumber();
443: my $ind=&Math::Random::random_uniform_integer(1,0,$#powers);
444: my $power = $powers[$ind];
445: $ind=&Math::Random::random_uniform_integer(1,0,$#factors);
446: my $factor = $factors[$ind];
447: for ($ind=0;$ind<$number_of_bubbles;$ind++) {
1.91 albertel 448: $bubble_values[$ind] = $answer*($factor**($power-$powers[$#powers-$ind]));
449: $bubble_values[$ind] = &format_number($bubble_values[$ind],
450: $format,$target);
451:
1.90 albertel 452: }
1.91 albertel 453: return @bubble_values;
1.51 albertel 454: }
455:
456: sub get_tolrange {
1.89 albertel 457: my ($ans,$tol)=@_;
458: my ($high,$low);
459: if ($tol =~ /%$/) {
460: chop($tol);
461: my $change=$ans*($tol/100.0);
462: $high=$ans+$change;
463: $low=$ans-$change;
464: } else {
465: $high=$ans+$tol;
466: $low=$ans-$tol;
467: }
468: return ($high,$low);
1.52 albertel 469: }
470:
471: sub get_sigrange {
1.89 albertel 472: my ($sig)=@_;
473: &Apache::lonxml::debug("Got a sig of :$sig:");
474: my $sig_lbound;
475: my $sig_ubound;
476: if ($sig eq '') {
477: $sig_lbound = 0; #SIG_LB_DEFAULT
478: $sig_ubound =15; #SIG_UB_DEFAULT
479: } else {
480: ($sig_lbound,$sig_ubound) = split(/,/,$sig);
481: if (!$sig_lbound) {
482: $sig_lbound = 0; #SIG_LB_DEFAULT
483: $sig_ubound =15; #SIG_UB_DEFAULT
484: }
485: if (!$sig_ubound) { $sig_ubound=$sig_lbound; }
1.52 albertel 486: }
1.89 albertel 487: return ($sig_ubound,$sig_lbound);
1.34 albertel 488: }
489:
490: sub start_stringresponse {
1.89 albertel 491: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
492: my $result;
493: if ($target eq 'meta') {
1.104 bowersj2 494: &Apache::response::start_response($parstack,$safeeval);
1.89 albertel 495: $result=&Apache::response::meta_package_write('stringresponse');
1.104 bowersj2 496: &Apache::response::end_response();
1.89 albertel 497: } else {
498: $result.=&start_numericalresponse(@_);
499: }
500: return $result;
1.34 albertel 501: }
502:
503: sub end_stringresponse {
1.89 albertel 504: return end_numericalresponse(@_);
1.44 albertel 505: }
506:
507: sub start_formularesponse {
1.89 albertel 508: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
509: my $result;
510: if ($target eq 'meta') {
1.104 bowersj2 511: &Apache::response::start_response($parstack,$safeeval);
1.89 albertel 512: $result=&Apache::response::meta_package_write('formularesponse');
1.104 bowersj2 513: &Apache::response::end_response();
1.89 albertel 514: } else {
515: $result.=&start_numericalresponse(@_);
516: }
517: return $result;
1.44 albertel 518: }
519:
520: sub end_formularesponse {
1.89 albertel 521: return end_numericalresponse(@_);
1.3 albertel 522: }
523:
1.1 albertel 524: 1;
1.3 albertel 525: __END__
1.89 albertel 526:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>