1: # LearningOnline Network with CAPA
2: # option list style responses
3: #
4: # $Id: optionresponse.pm,v 1.102 2004/02/19 21:55:54 sakharuk Exp $
5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: package Apache::optionresponse;
29: use strict;
30: use Apache::response;
31:
32: BEGIN {
33: &Apache::lonxml::register('Apache::optionresponse',('optionresponse'));
34: }
35:
36: sub start_optionresponse {
37: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
38: my $result='';
39: #when in a option response use these
40: &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
41: push (@Apache::lonxml::namespace,'optionresponse');
42: my $id = &Apache::response::start_response($parstack,$safeeval);
43: %Apache::hint::option=();
44: if ($target eq 'edit') {
45: $result.=&Apache::edit::start_table($token).
46: "<tr><td>Multiple Option Response Question ".
47: &Apache::loncommon::help_open_topic('Option_Response_Problems')."</td><td>Delete:".
48: &Apache::edit::deletelist($target,$token)
49: ."</td><td> ".
50: &Apache::edit::end_row().
51: &Apache::edit::start_spanning_row().
52: "\n";
53: $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',
54: $token,'4').
55: &Apache::edit::select_arg('Randomize Foil Order','randomize',
56: ['yes','no'],$token).
57: &Apache::edit::end_row().&Apache::edit::start_spanning_row();
58: } elsif ($target eq 'modified') {
59: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
60: $safeeval,'max','randomize');
61: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
62: } elsif ($target eq 'meta') {
63: $result=&Apache::response::meta_package_write('optionresponse');
64: } elsif ($target eq 'analyze') {
65: my $part_id="$Apache::inputtags::part.$id";
66: push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
67: }
68: return $result;
69: }
70:
71: sub end_optionresponse {
72: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
73: &Apache::response::end_response;
74: pop @Apache::lonxml::namespace;
75: &Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
76: my $result;
77: if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
78: return $result;
79: }
80:
81: %Apache::response::foilgroup=();
82: sub start_foilgroup {
83: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
84:
85: my $result='';
86: %Apache::response::foilgroup=();
87: $Apache::optionresponse::conceptgroup=0;
88: &Apache::response::setrandomnumber();
89: if ($target eq 'edit') {
90: my $optionlist="<option></option>\n";
91: my $option;
92: my @opt;
93: eval '@opt ='. &Apache::lonxml::get_param('options',$parstack,$safeeval);
94: my $count=1;
95: foreach $option (@opt) {
96: $optionlist.="<option value=\"$count\">$option</option>\n";
97: $count++;
98: }
99: my $insertlist=&Apache::edit::insertlist($target,$token);
100: $result.=&Apache::edit::start_table($token);
101: $result.= (<<ENDTABLE);
102: <tr><td>Select Options</td>
103: <td>
104: Add new Option: <input type="text" name="$Apache::lonxml::curdepth.options" />
105: </td>
106: <td>Delete an Option:
107: <select name="$Apache::lonxml::curdepth.deleteopt">$optionlist</select>
108: ENDTABLE
109: $result.= &Apache::edit::end_row();
110: $result.= &Apache::edit::start_spanning_row();
111: $result.= $insertlist.'<br />';
112: }
113: if ($target eq 'modified') {
114: my @options;
115: my $optchanged=0;
116: eval '@options ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
117: if ($ENV{"form.$Apache::lonxml::curdepth.deleteopt"}) {
118: my $delopt=$ENV{"form.$Apache::lonxml::curdepth.deleteopt"};
119: &Apache::lonxml::debug("Deleting :$delopt:");
120: splice(@options,$delopt-1,1);
121: $optchanged=1;
122: }
123: if ($ENV{"form.$Apache::lonxml::curdepth.options"}) {
124: my $newopt = $ENV{"form.$Apache::lonxml::curdepth.options"};
125: if ($options[0]) {
126: push(@options,$newopt);
127: } else {
128: $options[0]=$newopt;
129: }
130: $optchanged=1;
131: }
132: if ($optchanged) {
133: $result = "<foilgroup options=\"(";
134: foreach my $option (@options) {
135: $option=~s/\'/\\\'/g;
136: &Apache::lonxml::debug("adding option :$option:");
137: $result .="'".$option."',";
138: }
139: chop $result;
140: $result.=')">';
141: } # else nothing changed so just use the default mechanism
142: }
143: if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
144: $result .= ' \begin{enumerate} ';
145: }
146: return $result;
147: }
148:
149: sub end_foilgroup {
150: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
151:
152: my $result;
153: if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
154: $target eq 'tex' || $target eq 'analyze') {
155: my $tex_option_switch=&Apache::lonxml::get_param('texoptions',$parstack,$safeeval);
156: my $name;
157: my @opt;
158: eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
159: if ($target eq 'tex' && $tex_option_switch eq 'nochoice') {@opt=();}
160: &Apache::lonxml::debug("Options are $#opt");
161: my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
162: my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
163: $safeeval,'-2');
164: if ($target eq 'web' || $target eq 'tex') {
165: $result.=&displayfoils($target,$max,$randomize,@opt);
166: } elsif ( $target eq 'answer') {
167: $result.=&displayanswers($max,$randomize,@opt);
168: } elsif ( $target eq 'analyze') {
169: my @shown = &whichfoils($max,$randomize);
170: &Apache::response::analyze_store_foilgroup(\@shown,
171: ['text','value','location']);
172: my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
173: push (@{ $Apache::lonhomework::analyze{"$part_id.options"} },@opt);
174: } elsif ( $target eq 'grade') {
175: if ( defined $ENV{'form.submitted'}) {
176: my @whichopt = &whichfoils($max,$randomize);
177: my $temp=1;my $name;
178: my %responsehash;
179: my %grade;
180: my $right=0;
181: my $wrong=0;
182: my $ignored=0;
183: foreach $name (@whichopt) {
184: my $response=&Apache::response::getresponse($temp);
185: if ($ENV{'form.submitted'} eq 'scantron') {
186: $response = $opt[$response];
187: }
188: if ( $response =~ /[^\s]/) {
189: $responsehash{$name}=$response;
190: my $value=$Apache::response::foilgroup{$name.'.value'};
191: &Apache::lonxml::debug("submitted a $response for $value<br />\n");
192: if ($value eq $response) {
193: $grade{$name}='1'; $right++;
194: } else {
195: $grade{$name}='0'; $wrong++;
196: }
197: } else {
198: $ignored++;
199: }
200: $temp++;
201: }
202: my $part=$Apache::inputtags::part;
203: my $id = $Apache::inputtags::response['-1'];
204: my $responsestr=&Apache::lonnet::hash2str(%responsehash);
205: my $gradestr =&Apache::lonnet::hash2str(%grade);
206: my %previous=&Apache::response::check_for_previous($responsestr,
207: $part,$id);
208: &Apache::lonxml::debug("Got $right right and $wrong wrong, and $ignored were ignored");
209: $Apache::lonhomework::results{"resource.$part.$id.submission"}=
210: $responsestr;
211: $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
212:
213: if (!$Apache::lonhomework::scantronmode) {
214: my $ad;
215: if ($wrong==0 && $ignored==0) {
216: $ad='EXACT_ANS';
217: } elsif ($wrong==0 && $right==0) {
218: #nothing submitted
219: } else {
220: if ($ignored==0) {
221: $ad='INCORRECT';
222: } else {
223: $ad='MISSING_ANSWER';
224: }
225: }
226: $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
227: &Apache::response::handle_previous(\%previous,$ad);
228: } else {
229: my $ad;
230: if ($wrong==0 && $right==0) {
231: #nothing submitted
232: } else {
233: $ad='ASSIGNED_SCORE';
234: }
235: $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
236: $Apache::lonhomework::results{"resource.$part.$id.awarded"}=
237: $right/(scalar(@whichopt));
238: $Apache::lonhomework::results{"resource.$part.$id.numfoils"}=
239: scalar(@whichopt);
240: }
241: }
242: }
243: &Apache::lonxml::increment_counter(&getfoilcounts($max));
244: } elsif ($target eq 'edit') {
245: $result.=&Apache::edit::end_table();
246: }
247: if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
248: $result .= '\end{enumerate}';
249: }
250: return $result;
251: }
252:
253: sub getfoilcounts {
254: my ($max)=@_;
255: # +1 since instructors will count from 1
256: my $count = $#{ $Apache::response::foilgroup{'names'} }+1;
257: if (&Apache::response::showallfoils()) { $max=$count; }
258: if ($count>$max) { $count=$max }
259: &Apache::lonxml::debug("Count is $count from $max");
260: return $count;
261: }
262:
263: sub whichfoils {
264: my ($max,$randomize)=@_;
265: return &Apache::response::whichorder($max,$randomize,
266: &Apache::response::showallfoils(),
267: \%Apache::response::foilgroup);
268: }
269:
270: sub displayanswers {
271: my ($max,$randomize,@opt)=@_;
272: if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
273: my @names = @{ $Apache::response::foilgroup{'names'} };
274: my @whichopt = &whichfoils($max,$randomize);
275: my $result=&Apache::response::answer_header('optionresponse');
276: foreach my $name (@whichopt) {
277: $result.=&Apache::response::answer_part('optionresponse',
278: $Apache::response::foilgroup{$name.'.value'})
279: }
280: $result.=&Apache::response::answer_footer('optionresponse');
281: return $result;
282: }
283:
284: sub displayfoils {
285: my ($target,$max,$randomize,@opt)=@_;
286: if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
287: my @names = @{ $Apache::response::foilgroup{'names'} };
288: my @truelist;
289: my @falselist;
290: my $result;
291: my $name;
292: my $displayoptionintex=1;
293: my @alphabet = ('A'..'Z');
294: my @whichopt = &whichfoils($max,$randomize);
295: my $part=$Apache::inputtags::part;
296: my $id=$Apache::inputtags::response[-1];
297: my $break;
298: my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
299: if ( ($target ne 'tex') &&
300: &Apache::response::show_answer() ) {
301: my $temp=1;
302: foreach $name (@whichopt) {
303: my $text=$Apache::response::foilgroup{$name.'.text'};
304: my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
305: my $lastopt=$lastresponse{$name};
306: if ($text!~/^\s*$/) { $break='<br />'; }
307: $result.=$break;
308: if ($target eq 'web') {
309: my $value=$Apache::response::foilgroup{$name.'.value'};
310: if (!($text=~s|<drawoptionlist\s*/>|$value|)) {
311: if ($text=~/^\s*$/) {
312: $text=$value.$text;
313: } else {
314: $text=$value.': '.$text;
315: }
316: } else {
317: $text='•'.$text;
318: }
319: $result.=$text."\n";
320: }
321: if ($Apache::lonhomework::type eq 'exam') {
322: $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
323: }
324: $temp++;
325: }
326: } else {
327: my $temp=1;
328: my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
329: my $internal_counter=$Apache::lonxml::counter;
330: foreach $name (@whichopt) {
331: my $text=$Apache::response::foilgroup{$name.'.text'};
332: if ($text!~/^\s*$/) {
333: if ($target eq 'tex') {
334: $break='\vskip 0 mm ';
335: } elsif ($target eq 'web') {
336: $break='<br />';
337: }
338: }
339: my $lastopt=$lastresponse{$name};
340: my $optionlist="<option></option>\n";
341: my $option;
342: foreach $option (@opt) {
343: if ($option eq $lastopt) {
344: $optionlist.="<option selected=\"on\">$option</option>\n";
345: } else {
346: $optionlist.="<option>$option</option>\n";
347: }
348: }
349: if ($target ne 'tex') {
350: if ($Apache::lonhomework::type ne 'exam') {
351: $optionlist='<select name="HWVAL_'.
352: $Apache::inputtags::response['-1'].':'.$temp.'">'.
353: $optionlist."</select>\n";
354: } else {
355: $optionlist='<u>'.(' 'x10).'</u>';
356: }
357: if ($text=~s|<drawoptionlist\s*/>|$optionlist|) {
358: if ($Apache::lonhomework::type ne 'exam') {
359: $text='•'.$text;
360: }
361: } else {
362: if ($Apache::lonhomework::type ne 'exam') {
363: $text=$optionlist.$text;
364: }
365: }
366: $result.=$break.$text."\n";
367: if ($Apache::lonhomework::type eq 'exam') {
368: $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
369: }
370: $temp++;
371: } else {
372: my $texoptionlist='';
373: if ($displayoptionintex &&
374: $Apache::lonhomework::type ne 'exam') {
375: $texoptionlist = &optionlist_correction(@opt);
376: }
377: if ($text=~/<drawoptionlist\s*\/>/) {
378: $text=~s|<drawoptionlist\s*/>| \\makebox\[0\.3in\]\[b\]\{\\hrulefill\} |;
379: }
380:
381: if ($text=~m/\\item /) {
382: if ($Apache::lonhomework::type eq 'exam') {
383: $text=~s/\\item/\\vskip 2 mm/;
384: }
385: $result.= $texoptionlist.$text;
386: } else {
387: if ($Apache::lonhomework::type eq 'exam') {
388: $result.= $texoptionlist.' '.$text;
389: } else {
390: $result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;
391: }
392: }
393: if ($Apache::lonhomework::type eq 'exam') {
394: $result.='\vskip -1 mm\noindent\begin{enumerate}\item[\textbf{'.
395: $internal_counter.'}.]'.&bubbles(\@alphabet,\@opt).
396: '\end{enumerate} \vskip -8 mm \strut ';
397: $internal_counter++;
398: }
399: $displayoptionintex=0;
400: }
401: }
402: }
403: if ($target ne 'tex') {
404: return $result.$break;
405: } else {
406: return $result;
407: }
408: }
409:
410:
411: sub optionlist_correction {
412: my @options = @_;
413: my $texoptionlist='\\item [] Choices: ';
414: if (scalar(@options) > 0) {
415: foreach my $option (@options) {
416: $texoptionlist.='{\bf '.
417: &Apache::lonxml::latex_special_symbols($option).
418: '},';
419: }
420: chop($texoptionlist);
421: $texoptionlist.='.';
422: } else {
423: $texoptionlist='\\item [] \\vskip -5 mm';
424: }
425: return $texoptionlist;
426: }
427:
428:
429: sub webbubbles {
430: my ($ropt,$ralphabet,$temp,$lastopt)=@_;
431: my @opt=@$ropt;
432: my @alphabet=@$ralphabet;
433: my $result='';
434: my $number_of_bubbles = $#opt + 1;
435: $result.= '<table border="1"><tr>';
436: for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
437: my $checked='';
438: if ($lastopt eq $opt[$ind]) {
439: $checked=' checked="on" ';
440: }
441: $result.='<td><input type="radio" name="HWVAL_'.
442: $Apache::inputtags::response['-1'].':'.$temp.
443: '" value="'.$opt[$ind].'" '.$checked.' />'.$alphabet[$ind].': '.
444: $opt[$ind].'</td>';
445: }
446: $result.='</tr></table>';
447: return $result;
448: }
449:
450:
451: sub bubbles {
452: my ($ralphabit,$ropt) = @_;
453: my @alphabet = @$ralphabit;
454: my @opt = @$ropt;
455: my ($result,$head,$line) =('','','');
456: my $number_of_bubbles = $#opt + 1;
457: my $current_length = 0;
458: my $textwidth;
459: if ($ENV{'form.textwidth'} ne '') {
460: $ENV{'form.textwidth'}=~/(\d+)/;
461: $textwidth=$1;
462: } else {
463: $ENV{'textwidth'}=~/(\d*)\.?(\d*)/;
464: $textwidth=$1.'.'.$2;
465: }
466: for (my $ind=0;$ind<=$number_of_bubbles;$ind++) {
467: my $leftmargin;
468: $opt[$ind]=&Apache::lonxml::latex_special_symbols($opt[$ind]);
469: if ($ind==0) {$leftmargin=6;} else {$leftmargin=10;}
470: $current_length += (length($opt[$ind])+length($alphabet[$ind])+4)*2;
471: if ($current_length<($textwidth-$leftmargin) and $ind!=$number_of_bubbles) {
472: $line.='\hskip -1 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';
473: $head.='lr';
474: } else {
475: $line=~s/\&\s*$//;
476: $result.='\vskip -2 mm\noindent\begin{tabular}{'.$head.'}'.$line.'\\\\\end{tabular}';
477: $line = '\hskip -1 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';;
478: $head ='lr';
479: $current_length = (length($opt[$ind])+length($alphabet[$ind]))*2;
480: }
481:
482: }
483: return $result;
484: }
485:
486:
487: sub start_conceptgroup {
488: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
489: $Apache::optionresponse::conceptgroup=1;
490: %Apache::response::conceptgroup=();
491: my $result;
492: if ($target eq 'edit') {
493: $result.=&Apache::edit::tag_start($target,$token,"Concept Grouped Foils");
494: $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').
495: &Apache::edit::end_row().&Apache::edit::start_spanning_row();
496: }
497: if ($target eq 'modified') {
498: my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'concept');
499: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
500: }
501: return $result;
502: }
503:
504: sub end_conceptgroup {
505: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
506: $Apache::optionresponse::conceptgroup=0;
507: my $result='';
508: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
509: $target eq 'tex' || $target eq 'analyze') {
510: #if not there aren't any foils to display and thus no question
511: &Apache::response::pick_foil_for_concept($target,
512: ['value','text','location'],
513: \%Apache::hint::option,
514: $parstack,$safeeval);
515: } elsif ($target eq 'edit') {
516: $result=&Apache::edit::end_table();
517: }
518: return $result;
519: }
520:
521: sub insert_conceptgroup {
522: my $result="\n\t\t<conceptgroup concept=\"\">".&insert_foil()."\n\t\t</conceptgroup>\n";
523: return $result;
524: }
525:
526: sub start_foil {
527: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
528: my $result='';
529: if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze' ) {
530: &Apache::lonxml::startredirection;
531: } elsif ($target eq 'edit') {
532: $result=&Apache::edit::tag_start($target,$token,"Foil");
533: my $level='-2';
534: if ($$tagstack['-2'] eq 'conceptgroup') { $level = '-3'; }
535: my @opt;
536: eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval,$level);
537: $result.=&Apache::edit::text_arg('Name:','name',$token);
538: $result.= &Apache::edit::select_or_text_arg('Correct Option:','value',
539: ['unused',(@opt)],$token,'15');
540: my $randomize=&Apache::lonxml::get_param('randomize',$parstack,
541: $safeeval,'-3');
542: if ($randomize ne 'no') {
543: $result.=&Apache::edit::select_arg('Location:','location',
544: ['random','top','bottom'],$token);
545: }
546: $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
547: } elsif ($target eq 'modified') {
548: my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
549: 'value','name','location');
550: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
551: }
552: return $result;
553: }
554:
555: sub end_foil {
556: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
557: my $text ='';
558: my $result = '';
559: if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {
560: $text=&Apache::lonxml::endredirection;
561: if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') { $text = '\vspace*{-2 mm}\item '.$text; }
562: }
563: if ($target eq 'web' || $target eq 'grade' || $target eq 'answer'
564: || $target eq 'tex' || $target eq 'analyze') {
565: my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval);
566: if ($value ne 'unused') {
567: my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
568: my $location =&Apache::lonxml::get_param('location',$parstack,$safeeval);
569: &Apache::lonxml::debug("Got a name of :$name:");
570: if (!$name) { $name=$Apache::lonxml::curdepth; }
571: &Apache::lonxml::debug("Using a name of :$name:");
572: if ( $Apache::optionresponse::conceptgroup
573: && !&Apache::response::showallfoils() ) {
574: push @{ $Apache::response::conceptgroup{'names'} }, $name;
575: $Apache::response::conceptgroup{"$name.value"} = $value;
576: if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') {
577: $Apache::response::conceptgroup{"$name.text"} = '\vskip 4 mm $\triangleright$ '.$text;
578: } else {
579: $Apache::response::conceptgroup{"$name.text"} = $text;
580: }
581: $Apache::response::conceptgroup{"$name.location"} = $location;
582: } else {
583: push @{ $Apache::response::foilgroup{'names'} }, $name;
584: $Apache::response::foilgroup{"$name.value"} = $value;
585: if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') {
586: $Apache::response::foilgroup{"$name.text"} = '\vskip 5 mm $\triangleright$ '.$text;
587: } else {
588: $Apache::response::foilgroup{"$name.text"} = $text;
589: }
590: $Apache::response::foilgroup{"$name.location"} = $location;
591: }
592: }
593: }
594: if ($target eq 'edit') {
595: $result.= &Apache::edit::tag_end($target,$token,'');
596: }
597: return $result;
598: }
599:
600: sub insert_foil {
601: return '
602: <foil name="" value="unused">
603: <startouttext />
604: <endouttext />
605: </foil>';
606: }
607: 1;
608: __END__
609:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>