File:
[LON-CAPA] /
loncom /
homework /
inputtags.pm
Revision
1.210:
download - view:
text,
annotated -
select for diffs
Wed Nov 1 23:24:52 2006 UTC (17 years, 9 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_2_99_0,
HEAD
- adding support for <vector> answers
<answer><value>1</value><value>2</value></answer>
requires 2 <textline>s
<answer><vector>1,2</vector></answer>
requires 1 textline
Still borken:
<answer type="unordered"><vector>1,2</vector><value>3</value></answer>
1: # The LearningOnline Network with CAPA
2: # input definitons
3: #
4: # $Id: inputtags.pm,v 1.210 2006/11/01 23:24:52 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: package Apache::inputtags;
29: use HTML::Entities();
30: use strict;
31: use Apache::loncommon;
32: use Apache::lonlocal;
33: use Apache::lonnet;
34: use lib '/home/httpd/lib/perl/';
35: use LONCAPA;
36:
37:
38: BEGIN {
39: &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline'));
40: }
41:
42: # Initializes a set of global variables used during the parse of the problem.
43: #
44: # @Apache::inputtags::input - List of current input ids.
45: # @Apache::inputtags::inputlist - List of all input ids seen this problem.
46: # @Apache::inputtags::response - List of all current resopnse ids.
47: # @Apache::inputtags::responselist - List of all response ids seen this
48: # problem.
49: # @Apache::inputtags::hint - List of all hint ids.
50: # @Apache::inputtags::hintlist - List of all hint ids seen this problem.
51: # @Apache::inputtags::previous - List describing if specific responseds
52: # have been used
53: # @Apache::inputtags::previous_version - Submission responses were used in.
54: # $Apache::inputtags::part - Current part id (valid only in
55: # <problem>)
56: # 0 if not in a part.
57: # @Apache::inputtags::partlist - List of part ids seen in the current
58: # <problem>
59: # @Apache::inputtags::status - List of problem statuses. First
60: # element is the status of the <problem>
61: # the remainder are for individual <part>s.
62: # %Apache::inputtags::params - Hash of defined parameters for the
63: # current response.
64: # @Apache::inputtags::import - List of all ids for <import> thes get
65: # join()ed and prepended.
66: # @Apache::inputtags::importlist - List of all import ids seen.
67: # $Apache::inputtags::response_with_no_part
68: # - Flag set true if we have seen a response
69: # that is not inside a <part>
70: # %Apache::inputtags::answertxt - <*response> tags store correct
71: # answer strings for display by <textline/>
72: # in this hash.
73:
74: sub initialize_inputtags {
75: @Apache::inputtags::input=();
76: @Apache::inputtags::inputlist=();
77: @Apache::inputtags::response=();
78: @Apache::inputtags::responselist=();
79: @Apache::inputtags::hint=();
80: @Apache::inputtags::hintlist=();
81: @Apache::inputtags::previous=();
82: @Apache::inputtags::previous_version=();
83: $Apache::inputtags::part='';
84: @Apache::inputtags::partlist=();
85: @Apache::inputtags::status=();
86: %Apache::inputtags::params=();
87: @Apache::inputtags::import=();
88: @Apache::inputtags::importlist=();
89: $Apache::inputtags::response_with_no_part=0;
90: %Apache::inputtags::answertxt=();
91: }
92:
93: sub check_for_duplicate_ids {
94: my %check;
95: foreach my $id (@Apache::inputtags::partlist,
96: @Apache::inputtags::responselist,
97: @Apache::inputtags::hintlist,
98: @Apache::inputtags::importlist) {
99: $check{$id}++;
100: }
101: my @duplicates;
102: foreach my $id (sort(keys(%check))) {
103: if ($check{$id} > 1) {
104: push(@duplicates,$id);
105: }
106: }
107: if (@duplicates) {
108: &Apache::lonxml::error("Duplicated ids found, problem will operate incorrectly. Duplicated ids seen: ",join(', ',@duplicates));
109: }
110: }
111:
112: sub start_input {
113: my ($parstack,$safeeval)=@_;
114: my $id = &Apache::lonxml::get_param('id',$parstack,$safeeval);
115: if ($id eq '') { $id = $Apache::lonxml::curdepth; }
116: push (@Apache::inputtags::input,$id);
117: push (@Apache::inputtags::inputlist,$id);
118: return $id;
119: }
120:
121: sub end_input {
122: pop @Apache::inputtags::input;
123: return '';
124: }
125:
126: sub addchars {
127: my ($fieldid,$addchars)=@_;
128: my $output='';
129: foreach (split(/\,/,$addchars)) {
130: $output.='<a href="javascript:void(document.forms.lonhomework.'.
131: $fieldid.'.value+=\''.$_.'\')">'.$_.'</a> ';
132: }
133: return $output;
134: }
135:
136: sub start_textfield {
137: my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
138: my $result = "";
139: my $id = &start_input($parstack,$safeeval);
140: my $resid=$Apache::inputtags::response[-1];
141: if ($target eq 'web') {
142: $Apache::lonxml::evaluate--;
143: my $partid=$Apache::inputtags::part;
144: my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"},'<>&"');
145: if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
146: my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
147: if ( $cols eq '') { $cols = 80; }
148: my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
149: if ( $rows eq '') { $rows = 16; }
150: my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
151: $result='';
152: if ($addchars) {
153: $result.=&addchars('HWVAL_'.$resid,$addchars);
154: }
155: &Apache::lonhtmlcommon::add_htmlareafields('HWVAL_'.$resid);
156: $result.= '<textarea wrap="hard" name="HWVAL_'.$resid.'" id="HWVAL_'.$resid.'" '.
157: "rows=\"$rows\" cols=\"$cols\">".$oldresponse;
158: if ($oldresponse ne '') {
159:
160: #get rid of any startup text if the user has already responded
161: &Apache::lonxml::get_all_text("/textfield",$parser,$style);
162: }
163: } else {
164: #show past answer in the essayresponse case
165: if ($oldresponse =~ /\S/
166: && &Apache::londefdef::is_inside_of($tagstack,
167: 'essayresponse') ) {
168: $result='<table class="LC_pastsubmission"><tr><td>'.
169: $oldresponse.'</td></tr></table>';
170: }
171: #get rid of any startup text
172: &Apache::lonxml::get_all_text("/textfield",$parser,$style);
173: }
174: } elsif ($target eq 'grade') {
175: my $seedtext=&Apache::lonxml::get_all_text("/textfield",$parser,
176: $style);
177: if ($seedtext eq $env{'form.HWVAL_'.$resid}) {
178: # if the seed text is still there it wasn't a real submission
179: $env{'form.HWVAL_'.$resid}='';
180: }
181: } elsif ($target eq 'edit') {
182: $result.=&Apache::edit::tag_start($target,$token);
183: $result.=&Apache::edit::text_arg('Rows:','rows',$token,4);
184: $result.=&Apache::edit::text_arg('Columns:','cols',$token,4);
185: $result.=&Apache::edit::text_arg
186: ('Click-On Texts (comma sep):','addchars',$token,10);
187: my $bodytext=&Apache::lonxml::get_all_text("/textfield",$parser,
188: $style);
189: $result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',80,2);
190: } elsif ($target eq 'modified') {
191: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
192: $safeeval,'rows','cols',
193: 'addchars');
194: if ($constructtag) {
195: $result = &Apache::edit::rebuild_tag($token);
196: } else {
197: $result=$token->[4];
198: }
199: $result.=&Apache::edit::modifiedfield("/textfield",$parser);
200: } elsif ($target eq 'tex') {
201: my $number_of_lines = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
202: my $width_of_box = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
203: if ($$tagstack[-2] eq 'essayresponse' and $Apache::lonhomework::type eq 'exam') {
204: $result = '\fbox{\fbox{\parbox{\textwidth-5mm}{';
205: for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
206: $result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';
207: } else {
208: my $TeXwidth=$width_of_box/80;
209: $result = '\vskip 1 mm \fbox{\fbox{\parbox{'.$TeXwidth.'\textwidth-5mm}{';
210: for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
211: $result.='}}}\vskip 2 mm ';
212: }
213: }
214: return $result;
215: }
216:
217: sub end_textfield {
218: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
219: my $result;
220: if ($target eq 'web') {
221: $Apache::lonxml::evaluate++;
222: if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
223: return "</textarea>";
224: }
225: } elsif ($target eq 'edit') {
226: $result=&Apache::edit::end_table();
227: }
228: &end_input;
229: return $result;
230: }
231:
232: sub exam_score_line {
233: my ($target) = @_;
234:
235: my $result;
236: if ($target eq 'tex') {
237: my $repetition = &Apache::response::repetition();
238: $result.='\begin{enumerate}';
239: if ($env{'request.state'} eq "construct" ) {$result.='\item[\strut]';}
240: foreach my $i (0..$repetition-1) {
241: $result.='\item[\textbf{'.
242: ($Apache::lonxml::counter+$i).
243: '}.]\textit{Leave blank on scoring form}\vskip 0 mm';
244: }
245: $result.= '\end{enumerate}';
246: }
247:
248: return $result;
249: }
250:
251: sub exam_box {
252: my ($target) = @_;
253: my $result;
254:
255: if ($target eq 'tex') {
256: $result .= '\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';
257: $result .= &exam_score_line($target);
258: } elsif ($target eq 'web') {
259: my $id=$Apache::inputtags::response[-1];
260: $result.= '<br /><br />
261: <textarea name="HWVAL_'.$id.'" rows="4" cols="50">
262: </textarea> <br /><br />';
263: }
264: return $result;
265: }
266:
267: sub needs_exam_box {
268: my ($tagstack) = @_;
269: my @tags = ('formularesponse',
270: 'stringresponse',
271: 'reactionresponse',
272: 'organicresponse',
273: );
274:
275: foreach my $tag (@tags) {
276: if (grep(/\Q$tag\E/,@$tagstack)) {
277: return 1;
278: }
279: }
280: return 0;
281: }
282:
283: sub start_textline {
284: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
285: my $result = "";
286: my $input_id = &start_input($parstack,$safeeval);
287: if ($target eq 'web') {
288: $Apache::lonxml::evaluate--;
289: my $partid=$Apache::inputtags::part;
290: my $id=$Apache::inputtags::response[-1];
291: if (!&Apache::response::show_answer()) {
292: my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
293: my $maxlength;
294: if ($size eq '') { $size=20; } else {
295: if ($size < 20) { $maxlength=$size; }
296: }
297: my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
298: &Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse));
299:
300: if (ref($oldresponse) eq 'ARRAY') {
301: $oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
302: }
303: $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"');
304:
305: if ($Apache::lonhomework::type ne 'exam') {
306: my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
307: $result='';
308: if ($addchars) {
309: $result.=&addchars('HWVAL_'.$id,$addchars);
310: }
311: my $readonly=&Apache::lonxml::get_param('readonly',$parstack,
312: $safeeval);
313: if (lc($readonly) eq 'yes'
314: || $Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') {
315: $readonly=' readonly="readonly" ';
316: } else {
317: $readonly='';
318: }
319: my $name = 'HWVAL_'.$id;
320: if ($Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') {
321: $name = "none";
322: }
323: $result.= '<input type="text" '.$readonly.' name="'.$name.'" value="'.
324: $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';
325: }
326: if ($Apache::lonhomework::type eq 'exam'
327: && &needs_exam_box($tagstack)) {
328: $result.=&exam_box($target);
329: }
330: } else {
331: #right or wrong don't show what was last typed in.
332: my $count = scalar(@Apache::inputtags::inputlist)-1;
333: $result='<b>'.$Apache::inputtags::answertxt{$id}[$count].'</b>';
334: #$result='';
335: }
336: } elsif ($target eq 'edit') {
337: $result=&Apache::edit::tag_start($target,$token);
338: $result.=&Apache::edit::text_arg('Size:','size',$token,'5').
339: &Apache::edit::text_arg('Click-On Texts (comma sep):',
340: 'addchars',$token,10);
341: $result.=&Apache::edit::select_arg('Readonly:','readonly',
342: ['no','yes'],$token);
343: $result.=&Apache::edit::end_row();
344: $result.=&Apache::edit::end_table();
345: } elsif ($target eq 'modified') {
346: my $constructtag=&Apache::edit::get_new_args($token,$parstack,
347: $safeeval,'size',
348: 'addchars','readonly');
349: if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
350: } elsif ($target eq 'tex'
351: && $Apache::lonhomework::type ne 'exam') {
352: my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
353: if ($size != 0) {$size=$size*2; $size.=' mm';} else {$size='40 mm';}
354: $result='\framebox['.$size.'][s]{\tiny\strut}';
355:
356: } elsif ($target eq 'tex'
357: && $Apache::lonhomework::type eq 'exam'
358: && &needs_exam_box($tagstack)) {
359: $result.=&exam_box($target);
360: }
361: return $result;
362: }
363:
364: sub end_textline {
365: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
366: if ($target eq 'web') { $Apache::lonxml::evaluate++; }
367: elsif ($target eq 'edit') { return ('','no'); }
368: &end_input();
369: return "";
370: }
371:
372: sub start_hiddenline {
373: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
374: my $result = "";
375: if ($target eq 'web') {
376: $Apache::lonxml::evaluate--;
377: if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
378: my $partid=$Apache::inputtags::part;
379: my $id=$Apache::inputtags::response[-1];
380: my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"},'<>&"');
381: if ($Apache::lonhomework::type ne 'exam') {
382: $result= '<input type="hidden" name="HWVAL_'.$id.'" value="'.
383: $oldresponse.'" />';
384: }
385: }
386: } elsif ($target eq 'edit') {
387: $result=&Apache::edit::tag_start($target,$token);
388: $result.=&Apache::edit::end_table;
389: }
390:
391: if ( ($target eq 'web' || $target eq 'tex')
392: && $Apache::lonhomework::type eq 'exam'
393: && &needs_exam_box($tagstack)) {
394: $result.=&exam_box($target);
395: }
396: return $result;
397: }
398:
399: sub end_hiddenline {
400: my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
401: if ($target eq 'web') { $Apache::lonxml::evaluate++; }
402: elsif ($target eq 'edit') { return ('','no'); }
403: return "";
404: }
405:
406: # $part -> partid
407: # $id -> responseid
408: # $uploadefiletypes -> comma seperated list of extensions allowed or * for any
409: # $which -> 'uploadedonly' -> only newly uploaded files
410: # 'portfolioonly' -> only allow files from portfolio
411: # 'both' -> allow files from either location
412: # $extratext -> additional text to go between the link and the input box
413: # returns a table row <tr>
414: sub file_selector {
415: my ($part,$id,$uploadedfiletypes,$which,$extratext)=@_;
416: if (!$uploadedfiletypes) { return ''; }
417:
418: my $jspart=$part;
419: $jspart=~s/\./_/g;
420:
421: my $result;
422:
423: $result.='<tr><td>';
424: if ($uploadedfiletypes ne '*') {
425: $result.=
426: &mt('Allowed filetypes: <b>[_1]</b>',$uploadedfiletypes).'<br />';
427: }
428: if ($which eq 'uploadonly' || $which eq 'both') {
429: $result.=&mt('Submit a file: (only one file can be uploaded)').
430: ' <br /><input type="file" size="50" name="HWFILE'.
431: $jspart.'_'.$id.'" /><br />';
432: $result .= &show_past_file_submission($part,$id);
433: }
434: if ( $which eq 'both') {
435: $result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />';
436: }
437: if ($which eq 'portfolioonly' || $which eq 'both') {
438: $result.=$extratext.'<a href='."'".'javascript:void(window.open("/adm/portfolio?mode=selectfile&fieldname=HWPORT'.$jspart.'_'.$id.'","cat","height=600,width=800,scrollbars=1,resizable=1,menubar=2,location=1"))'."'".'>'.
439: &mt('Select Portfolio Files').'</a><br />'.
440: '<input type="text" size="50" name="HWPORT'.$jspart.'_'.$id.'" value="" />'.
441: '<br />';
442: $result .= &show_past_portfile_submission($part,$id);
443:
444: }
445: $result.='</td></tr>';
446: return $result;
447: }
448:
449: sub show_past_file_submission {
450: my ($part,$id) = @_;
451: my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');
452:
453: return if (!$uploadedfile);
454:
455: my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
456: &Apache::lonxml::extlink($url);
457: &Apache::lonnet::allowuploaded('/adm/essayresponse',$url);
458: my $icon=&Apache::loncommon::icon($url);
459: my $curfile='<a href="'.$url.'"><img src="'.$icon.
460: '" border="0" />'.$uploadedfile.'</a>';
461: return &mt('Currently submitted: <tt>[_1]</tt>',$curfile);
462:
463: }
464:
465: sub show_past_portfile_submission {
466: my ($part,$id) = @_;
467: if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}!~/[^\s]/){
468: return;
469: }
470: my (@file_list,@bad_file_list);
471: foreach my $file (split(/\s*,\s*/,&unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) {
472: my (undef,undef,$domain,$user)=&Apache::lonnet::whichuser();
473: my $url="/uploaded/$domain/$user/portfolio$file";
474: my $icon=&Apache::loncommon::icon($url);
475: push(@file_list,'<a href="'.$url.'"><img src="'.$icon.
476: '" border="0" />'.$file.'</a>');
477: if (! &Apache::lonnet::stat_file($url)) {
478: &Apache::lonnet::logthis("bad file is $url");
479: push(@bad_file_list,'<a href="'.$url.'"><img src="'.$icon.
480: '" border="0" />'.$file.'</a>');
481: }
482: }
483: my $files = '<span class="LC_filename">'.
484: join('</span>, <span class="LC_filename">',@file_list).
485: '</span>';
486: my $result = &mt("Portfolio files previously selected: [_1]",$files);
487: if (@bad_file_list) {
488: my $bad_files = '<span class="LC_filename">'.
489: join('</span>, <span class="LC_filename">',@bad_file_list).
490: '</span>';
491: $result.='<br />'.&mt('<span class="LC_error">These file(s) don\'t exist:</span> [_1]',$bad_files);
492: }
493: return $result;
494:
495: }
496:
497: sub valid_award {
498: my ($award) =@_;
499: foreach my $possibleaward ('EXTRA_ANSWER','MISSING_ANSWER', 'ERROR',
500: 'NO_RESPONSE',
501: 'TOO_LONG', 'UNIT_INVALID_INSTRUCTOR',
502: 'UNIT_INVALID_STUDENT', 'UNIT_IRRECONCIBLE',
503: 'UNIT_FAIL', 'NO_UNIT',
504: 'UNIT_NOTNEEDED', 'WANTED_NUMERIC',
505: 'BAD_FORMULA', 'SIG_FAIL', 'INCORRECT',
506: 'MISORDERED_RANK', 'INVALID_FILETYPE',
507: 'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE',
508: 'APPROX_ANS', 'EXACT_ANS','COMMA_FAIL') {
509: if ($award eq $possibleaward) { return 1; }
510: }
511: return 0;
512: }
513:
514: {
515: my @awards = ('EXTRA_ANSWER', 'MISSING_ANSWER', 'ERROR', 'NO_RESPONSE',
516: 'TOO_LONG',
517: 'UNIT_INVALID_INSTRUCTOR', 'UNIT_INVALID_STUDENT',
518: 'UNIT_IRRECONCIBLE', 'UNIT_FAIL', 'NO_UNIT',
519: 'UNIT_NOTNEEDED', 'WANTED_NUMERIC', 'BAD_FORMULA',
520: 'COMMA_FAIL', 'SIG_FAIL', 'INCORRECT', 'MISORDERED_RANK',
521: 'INVALID_FILETYPE', 'DRAFT', 'SUBMITTED', 'ASSIGNED_SCORE',
522: 'APPROX_ANS', 'EXACT_ANS');
523: my $i=0;
524: my %fwd_awards = map { ($_,$i++) } @awards;
525: my $max=scalar(@awards);
526: @awards=reverse(@awards);
527: $i=0;
528: my %rev_awards = map { ($_,$i++) } @awards;
529:
530: sub finalizeawards {
531: my ($awardref,$msgref,$nameref,$reverse)=@_;
532: my $result;
533: if ($#$awardref == -1) { $result = "NO_RESPONSE"; }
534: if ($result eq '' ) {
535: my $blankcount;
536: foreach my $award (@$awardref) {
537: if ($award eq '') {
538: $result='MISSING_ANSWER';
539: $blankcount++;
540: }
541: }
542: if ($blankcount == ($#$awardref + 1)) { $result = 'NO_RESPONSE'; }
543: }
544: if (defined($result)) { return ($result); }
545:
546: # these awards are ordered from most important error through best correct
547: my $awards = (!$reverse) ? \%fwd_awards : \%rev_awards ;
548:
549: my $best = $max;
550: my $j=0;
551: my $which;
552: foreach my $award (@$awardref) {
553: if ($awards->{$award} < $best) {
554: $best = $awards->{$award};
555: $which = $j;
556: }
557: $j++;
558: }
559: if (defined($which)) {
560: if (ref($nameref)) {
561: return ($$awardref[$which],$$msgref[$which],$$nameref[$which]);
562: } else {
563: return ($$awardref[$which],$$msgref[$which]);
564: }
565: }
566: return ('ERROR',undef);
567: }
568: }
569:
570: sub decideoutput {
571: my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_;
572: my $message='';
573: my $button=0;
574: my $previousmsg;
575: my $bgcolor='orange';
576: my $added_computer_text=0;
577: my %possiblecolors =
578: ( 'correct' => '#aaffaa',
579: 'charged_try' => '#ffaaaa',
580: 'not_charged_try' => '#ffffaa',
581: 'no_grade' => '#ffffaa',
582: 'no_message' => '#ffffff',
583: );
584:
585: my $part = $Apache::inputtags::part;
586: my $handgrade =
587: ('yes' eq lc(&Apache::lonnet::EXT("resource.$part.handgrade")));
588:
589: my $computer = ($handgrade)? ''
590: : " ".&mt("Computer's answer now shown above.");
591: &Apache::lonxml::debug("handgrade has :$handgrade:");
592:
593: if ($previous) { $previousmsg=&mt('You have entered that answer before'); }
594:
595: if ($solved =~ /^correct/) {
596: $bgcolor=$possiblecolors{'correct'};
597: $message=&mt('You are correct.');
598: if ($awarded < 1 && $awarded > 0) {
599: $message=&mt('You are partially correct.');
600: $bgcolor=$possiblecolors{'not_charged_try'};
601: } elsif ($awarded < 1) {
602: $message=&mt('Incorrect.');
603: $bgcolor=$possiblecolors{'charged_try'};
604: }
605: if ($env{'request.filename'} =~
606: m|/res/lib/templates/examupload.problem$|) {
607: $message = &mt("A score has been assigned.");
608: $added_computer_text=1;
609: } else {
610: if ($target eq 'tex') {
611: $message = '\textbf{'.$message.'}';
612: } else {
613: $message = "<b>".$message."</b>";
614: $message.= $computer;
615: }
616: $added_computer_text=1;
617: unless ($env{'course.'.
618: $env{'request.course.id'}.
619: '.disable_receipt_display'} eq 'yes') {
620: $message.=(($target eq 'web')?'<br />':' ').
621: &mt('Your receipt is').' '.&Apache::lonnet::receipt($Apache::inputtags::part).
622: (($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');
623: }
624: }
625: $button=0;
626: $previousmsg='';
627: } elsif ($solved =~ /^excused/) {
628: if ($target eq 'tex') {
629: $message = ' \textbf{'.&mt('You are excused from the problem.').'} ';
630: } else {
631: $message = "<b>".&mt('You are excused from the problem.')."</b>";
632: }
633: $bgcolor=$possiblecolors{'charged_try'};
634: $button=0;
635: $previousmsg='';
636: } elsif ($award eq 'EXACT_ANS' || $award eq 'APPROX_ANS' ) {
637: if ($solved =~ /^incorrect/ || $solved eq '') {
638: $message = &mt("Incorrect").".";
639: $bgcolor=$possiblecolors{'charged_try'};
640: $button=1;
641: } else {
642: if ($target eq 'tex') {
643: $message = '\textbf{'.&mt('You are correct.').'}';
644: } else {
645: $message = "<b>".&mt('You are correct.')."</b>";
646: $message.= $computer;
647: }
648: $added_computer_text=1;
649: unless ($env{'course.'.
650: $env{'request.course.id'}.
651: '.disable_receipt_display'} eq 'yes') {
652: $message.=(($target eq 'web')?'<br />':' ').
653: 'Your receipt is '.&Apache::lonnet::receipt($Apache::inputtags::part).
654: (($target eq 'web')?&Apache::loncommon::help_open_topic('Receipt'):'');
655: }
656: $bgcolor=$possiblecolors{'correct'};
657: $button=0;
658: $previousmsg='';
659: }
660: } elsif ($award eq 'NO_RESPONSE') {
661: $message = '';
662: $bgcolor=$possiblecolors{'no_feedback'};
663: $button=1;
664: } elsif ($award eq 'EXTRA_ANSWER') {
665: $message = &mt('Some extra items were submitted.');
666: $bgcolor=$possiblecolors{'not_charged_try'};
667: $button = 1;
668: } elsif ($award eq 'MISSING_ANSWER') {
669: $message = &mt('Some items were not submitted.');
670: $bgcolor=$possiblecolors{'not_charged_try'};
671: $button = 1;
672: } elsif ($award eq 'ERROR') {
673: $message = &mt('An error occured while grading your answer.');
674: $bgcolor=$possiblecolors{'not_charged_try'};
675: $button = 1;
676: } elsif ($award eq 'TOO_LONG') {
677: $message = &mt("The submitted answer was too long.");
678: $bgcolor=$possiblecolors{'not_charged_try'};
679: $button=1;
680: } elsif ($award eq 'WANTED_NUMERIC') {
681: $message = &mt("This question expects a numeric answer.");
682: $bgcolor=$possiblecolors{'not_charged_try'};
683: $button=1;
684: } elsif ($award eq 'MISORDERED_RANK') {
685: $message = &mt('You have provided an invalid ranking');
686: if ($target ne 'tex') {
687: $message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems');
688: }
689: $bgcolor=$possiblecolors{'not_charged_try'};
690: $button=1;
691: } elsif ($award eq 'INVALID_FILETYPE') {
692: $message = &mt('Submission won\'t be graded. The type of file submitted is not allowed.');
693: $bgcolor=$possiblecolors{'not_charged_try'};
694: $button=1;
695: } elsif ($award eq 'SIG_FAIL') {
696: my ($used,$min,$max)=split(':',$awardmsg);
697: my $word;
698: if ($used < $min) { $word=&mt('more'); }
699: if ($used > $max) { $word=&mt('fewer'); }
700: $message = &mt("Submission not graded. Use [_2] digits.",$used,$word);
701: $bgcolor=$possiblecolors{'not_charged_try'};
702: $button=1;
703: } elsif ($award eq 'UNIT_INVALID_INSTRUCTOR') {
704: $message = &mt('Error in instructor specifed unit. This error has been reported to the instructor.', $awardmsg);
705: if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units');}
706: $bgcolor=$possiblecolors{'not_charged_try'};
707: $button=1;
708: } elsif ($award eq 'UNIT_INVALID_STUDENT') {
709: $message = &mt('Unable to interpret units. Computer reads units as "[_1]".',&markup_unit($awardmsg,$target));
710: if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units');}
711: $bgcolor=$possiblecolors{'not_charged_try'};
712: $button=1;
713: } elsif ($award eq 'UNIT_FAIL' || $award eq 'UNIT_IRRECONCIBLE') {
714: $message = &mt('Incompatible units. No conversion found between "[_1]" and the required units.',&markup_unit($awardmsg,$target));
715: if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units');}
716: $bgcolor=$possiblecolors{'not_charged_try'};
717: $button=1;
718: } elsif ($award eq 'UNIT_NOTNEEDED') {
719: $message = &mt('Only a number required. Computer reads units of "[_1]".',&markup_unit($awardmsg,$target));
720: $bgcolor=$possiblecolors{'not_charged_try'};
721: $button=1;
722: } elsif ($award eq 'NO_UNIT') {
723: $message = &mt("Units required").'.';
724: if ($target ne 'tex') {$message.=&Apache::loncommon::help_open_topic('Physical_Units')};
725: $bgcolor=$possiblecolors{'not_charged_try'};
726: $button=1;
727: } elsif ($award eq 'COMMA_FAIL') {
728: $message = &mt("Proper comma separation is required").'.';
729: $bgcolor=$possiblecolors{'not_charged_try'};
730: $button=1;
731: } elsif ($award eq 'BAD_FORMULA') {
732: $message = &mt("Unable to understand formula");
733: $bgcolor=$possiblecolors{'not_charged_try'};
734: $button=1;
735: } elsif ($award eq 'INCORRECT') {
736: $message = &mt("Incorrect").'.';
737: $bgcolor=$possiblecolors{'charged_try'};
738: $button=1;
739: } elsif ($award eq 'SUBMITTED') {
740: $message = &mt("Your submission has been recorded.");
741: $bgcolor=$possiblecolors{'no_grade'};
742: $button=1;
743: } elsif ($award eq 'DRAFT') {
744: $message = &mt("A draft copy has been saved.");
745: $bgcolor=$possiblecolors{'not_charged_try'};
746: $button=1;
747: } elsif ($award eq 'ASSIGNED_SCORE') {
748: $message = &mt("A score has been assigned.");
749: $bgcolor=$possiblecolors{'correct'};
750: $button=0;
751: } elsif ($award eq '') {
752: if ($handgrade && $Apache::inputtags::status[-1] eq 'SHOW_ANSWER') {
753: $message = &mt("Nothing submitted.");
754: $bgcolor=$possiblecolors{'charged_try'};
755: } else {
756: $bgcolor=$possiblecolors{'not_charged_try'};
757: }
758: $button=1;
759: } else {
760: $message = &mt("Unknown message").": $award";
761: $button=1;
762: }
763: my (undef,undef,$domain,$user)=&Apache::lonnet::whichuser();
764: foreach my $resid(@Apache::inputtags::response){
765: if ($Apache::lonhomework::history{"resource.$part.$resid.handback"}) {
766: $message.='<br />';
767: my @files = split(/\s*,\s*/,
768: $Apache::lonhomework::history{"resource.$part.$resid.handback"});
769: my $file_msg;
770: foreach my $file (@files) {
771: $file_msg.= '<br /><a href="/uploaded/'."$domain/$user".'/'.$file.'">'.$file.'</a>';
772: }
773: $message .= &mt('Returned file(s): [_1]',$file_msg);
774: }
775: }
776:
777: if (lc($Apache::lonhomework::problemstatus) eq 'no' &&
778: $Apache::inputtags::status[-1] ne 'SHOW_ANSWER') {
779: $message = &mt("Answer Submitted: Your final submission will be graded after the due date.");
780: $bgcolor=$possiblecolors{'no_grade'};
781: $button=1;
782: }
783: if ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER' &&
784: !$added_computer_text && $target ne 'tex') {
785: $message.= $computer;
786: $added_computer_text=1;
787: }
788: return ($button,$bgcolor,$message,$previousmsg);
789: }
790:
791: sub markup_unit {
792: my ($unit,$target)=@_;
793: if ($target eq 'tex') {
794: return '\texttt{'.&Apache::lonxml::latex_special_symbols($unit).'}';
795: } else {
796: return "<tt>".$unit."</tt>";
797: }
798: }
799:
800: sub removealldata {
801: my ($id)=@_;
802: foreach my $key (keys(%Apache::lonhomework::results)) {
803: if (($key =~ /^resource\.\Q$id\E\./) && ($key !~ /\.collaborators$/)) {
804: &Apache::lonxml::debug("Removing $key");
805: delete($Apache::lonhomework::results{$key});
806: }
807: }
808: }
809:
810: sub hidealldata {
811: my ($id)=@_;
812: foreach my $key (keys(%Apache::lonhomework::results)) {
813: if (($key =~ /^resource\.\Q$id\E\./) && ($key !~ /\.collaborators$/)) {
814: &Apache::lonxml::debug("Hidding $key");
815: my $newkey=$key;
816: $newkey=~s/^(resource\.\Q$id\E\.[^\.]+\.)(.*)$/${1}hidden${2}/;
817: $Apache::lonhomework::results{$newkey}=
818: $Apache::lonhomework::results{$key};
819: delete($Apache::lonhomework::results{$key});
820: }
821: }
822: }
823:
824: sub setgradedata {
825: my ($award,$msg,$id,$previously_used) = @_;
826: if ($Apache::lonhomework::scantronmode &&
827: &Apache::lonnet::validCODE($env{'form.CODE'})) {
828: $Apache::lonhomework::results{"resource.CODE"}=$env{'form.CODE'};
829: } elsif ($Apache::lonhomework::scantronmode &&
830: $env{'form.CODE'} eq '' &&
831: $Apache::lonhomework::history{"resource.CODE"} ne '') {
832: $Apache::lonhomework::results{"resource.CODE"}='';
833: }
834:
835: if (!$Apache::lonhomework::scantronmode &&
836: $Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
837: $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') {
838: $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
839: return '';
840: } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
841: /^correct/ || $Apache::lonhomework::scantronmode ||
842: lc($Apache::lonhomework::problemstatus) eq 'no') {
843: # the student doesn't already have it correct,
844: # or we are in a mode (scantron orno problem status) where a correct
845: # can become incorrect
846: # handle assignment of tries and solved status
847: my $solvemsg;
848: if ($Apache::lonhomework::scantronmode) {
849: $solvemsg='correct_by_scantron';
850: } else {
851: $solvemsg='correct_by_student';
852: }
853: if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
854: $Apache::lonhomework::results{"resource.$id.afterduedate"}='';
855: }
856: if ( $award eq 'ASSIGNED_SCORE') {
857: $Apache::lonhomework::results{"resource.$id.tries"} =
858: $Apache::lonhomework::history{"resource.$id.tries"} + 1;
859: $Apache::lonhomework::results{"resource.$id.solved"} =
860: $solvemsg;
861: my $numawards=scalar(@Apache::inputtags::response);
862: $Apache::lonhomework::results{"resource.$id.awarded"} = 0;
863: foreach my $res (@Apache::inputtags::response) {
864: $Apache::lonhomework::results{"resource.$id.awarded"}+=
865: $Apache::lonhomework::results{"resource.$id.$res.awarded"};
866: }
867: if ($numawards > 0) {
868: $Apache::lonhomework::results{"resource.$id.awarded"}/=
869: $numawards;
870: }
871: } elsif ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
872: $Apache::lonhomework::results{"resource.$id.tries"} =
873: $Apache::lonhomework::history{"resource.$id.tries"} + 1;
874: $Apache::lonhomework::results{"resource.$id.solved"} =
875: $solvemsg;
876: $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
877: } elsif ( $award eq 'INCORRECT' ) {
878: $Apache::lonhomework::results{"resource.$id.tries"} =
879: $Apache::lonhomework::history{"resource.$id.tries"} + 1;
880: if (lc($Apache::lonhomework::problemstatus) eq 'no' ||
881: $Apache::lonhomework::scantronmode) {
882: $Apache::lonhomework::results{"resource.$id.awarded"} = 0;
883: }
884: $Apache::lonhomework::results{"resource.$id.solved"} =
885: 'incorrect_attempted';
886: } elsif ( $award eq 'SUBMITTED' ) {
887: $Apache::lonhomework::results{"resource.$id.tries"} =
888: $Apache::lonhomework::history{"resource.$id.tries"} + 1;
889: $Apache::lonhomework::results{"resource.$id.solved"} =
890: 'ungraded_attempted';
891: } elsif ( $award eq 'DRAFT' ) {
892: $Apache::lonhomework::results{"resource.$id.solved"} = '';
893: } elsif ( $award eq 'NO_RESPONSE' ) {
894: #no real response so delete any data that got stored
895: &removealldata($id);
896: return '';
897: } else {
898: $Apache::lonhomework::results{"resource.$id.solved"} =
899: 'incorrect_attempted';
900: if (lc($Apache::lonhomework::problemstatus) eq 'no' ||
901: $Apache::lonhomework::scantronmode) {
902: $Apache::lonhomework::results{"resource.$id.tries"} =
903: $Apache::lonhomework::history{"resource.$id.tries"} + 1;
904: $Apache::lonhomework::results{"resource.$id.awarded"} = 0;
905: }
906: }
907: if (defined($msg)) {
908: $Apache::lonhomework::results{"resource.$id.awardmsg"} = $msg;
909: }
910: # did either of the overall awards chage? If so ignore the
911: # previous check
912: if (($Apache::lonhomework::results{"resource.$id.awarded"} eq
913: $Apache::lonhomework::history{"resource.$id.awarded"}) &&
914: ($Apache::lonhomework::results{"resource.$id.solved"} eq
915: $Apache::lonhomework::history{"resource.$id.solved"})) {
916: # check if this was a previous submission if it was delete the
917: # unneeded data and update the previously_used attribute
918: if ( $previously_used eq 'PREVIOUSLY_USED') {
919: if (lc($Apache::lonhomework::problemstatus) ne 'no') {
920: delete($Apache::lonhomework::results{"resource.$id.tries"});
921: $Apache::lonhomework::results{"resource.$id.previous"} = '1';
922: }
923: } elsif ( $previously_used eq 'PREVIOUSLY_LAST') {
924: #delete all data as they student didn't do anything, but save
925: #the list of collaborators.
926: &removealldata($id);
927: #and since they didn't do anything we were never here
928: return '';
929: } else {
930: $Apache::lonhomework::results{"resource.$id.previous"} = '0';
931: }
932: }
933: } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} =~
934: /^correct/ ) {
935: #delete all data as they student already has it correct
936: &removealldata($id);
937: #and since they didn't do anything we were never here
938: return '';
939: }
940: $Apache::lonhomework::results{"resource.$id.award"} = $award;
941: if ($award eq 'SUBMITTED') {
942: &Apache::response::add_to_gradingqueue();
943: }
944: }
945:
946: sub grade {
947: my ($target) = @_;
948: my $id = $Apache::inputtags::part;
949: my $response='';
950: if ( defined $env{'form.submitted'}) {
951: my (@awards,@msgs);
952: foreach $response (@Apache::inputtags::response) {
953: &Apache::lonxml::debug("looking for response.$id.$response.awarddetail");
954: my $value=$Apache::lonhomework::results{"resource.$id.$response.awarddetail"};
955: &Apache::lonxml::debug("keeping $value from $response for $id");
956: push (@awards,$value);
957: $value=$Apache::lonhomework::results{"resource.$id.$response.awardmsg"};
958: &Apache::lonxml::debug("got message $value from $response for $id");
959: push (@msgs,$value);
960: }
961: my ($finalaward,$msg) = &finalizeawards(\@awards,\@msgs);
962: my $previously_used;
963: if ( $#Apache::inputtags::previous eq $#awards ) {
964: my $match=0;
965: my @matches;
966: foreach my $versionar (@Apache::inputtags::previous_version) {
967: foreach my $version (@$versionar) {
968: $matches[$version]++;
969: }
970: }
971: foreach my $elem (@matches) {if ($elem eq ($#awards+1)) {$match=1;}}
972: if ($match) {
973: $previously_used = 'PREVIOUSLY_LAST';
974: foreach my $value (@Apache::inputtags::previous) {
975: if ($value eq 'PREVIOUSLY_USED' ) {
976: $previously_used = $value;
977: last;
978: }
979: }
980: }
981: }
982: &Apache::lonxml::debug("final award $finalaward, $previously_used, message $msg");
983: &setgradedata($finalaward,$msg,$id,$previously_used);
984: }
985: return '';
986: }
987:
988: sub gradestatus {
989: my ($id,$target) = @_;
990: my $showbutton = 1;
991: my $bgcolor = '';
992: my $message = '';
993: my $latemessage = '';
994: my $trystr='';
995: my $button='';
996: my $previousmsg='';
997:
998: my $status = $Apache::inputtags::status['-1'];
999: &Apache::lonxml::debug("gradestatus has :$status:");
1000: if ( $status ne 'CLOSED'
1001: && $status ne 'UNAVAILABLE'
1002: && $status ne 'INVALID_ACCESS'
1003: && $status ne 'NEEDS_CHECKIN'
1004: && $status ne 'NOT_IN_A_SLOT') {
1005: my $award = $Apache::lonhomework::history{"resource.$id.award"};
1006: my $awarded = $Apache::lonhomework::history{"resource.$id.awarded"};
1007: my $solved = $Apache::lonhomework::history{"resource.$id.solved"};
1008: my $previous = $Apache::lonhomework::history{"resource.$id.previous"};
1009: my $awardmsg = $Apache::lonhomework::history{"resource.$id.awardmsg"};
1010: &Apache::lonxml::debug("Found Award |$award|$solved|$awardmsg");
1011: if ( $award ne '' || $solved ne '' || $status eq 'SHOW_ANSWER') {
1012: &Apache::lonxml::debug('Getting message');
1013: ($showbutton,$bgcolor,$message,$previousmsg) =
1014: &decideoutput($award,$awarded,$awardmsg,$solved,$previous,
1015: $target);
1016: if ($target eq 'tex') {
1017: $message='\vskip 2 mm '.$message.' ';
1018: } else {
1019: $message="<td bgcolor=\"$bgcolor\">$message</td>";
1020: if ($previousmsg) {
1021: $previousmsg="<td bgcolor=\"#aaaaff\">$previousmsg</td>";
1022: }
1023: }
1024: }
1025: my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
1026: my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
1027: &Apache::lonxml::debug("got maxtries of :$maxtries:");
1028: #if tries are set to negative turn off the Tries/Button and messages
1029: if (defined($maxtries) && $maxtries < 0) { return ''; }
1030: if ( $tries eq '' ) { $tries = '0'; }
1031: if ( $maxtries eq '' ) { $maxtries = '2'; }
1032: if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; }
1033: my $tries_text=&mt('Tries');
1034: if ( $Apache::lonhomework::type eq 'survey' ||
1035: $Apache::lonhomework::parsing_a_task) {
1036: $tries_text=&mt('Submissions');
1037: }
1038: if ( $showbutton ) {
1039: if ($target eq 'tex') {
1040: if ($env{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $env{'form.suppress_tries'} ne 'yes') {
1041: $trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '.$tries.'/'.$maxtries.'} \vskip 2 mm ';
1042: } else {
1043: $trystr = '\vskip 0 mm ';
1044: }
1045: } else {
1046: $trystr = "<td><nobr>".$tries_text." $tries";
1047: if ($Apache::lonhomework::parsing_a_task) {
1048: } elsif($env{'request.state'} ne 'construct') {
1049: $trystr.="/$maxtries";
1050: } else {
1051: if (defined($Apache::inputtags::params{'maxtries'})) {
1052: $trystr.="/".$Apache::inputtags::params{'maxtries'};
1053: }
1054: }
1055: $trystr.="</nobr></td>";
1056: }
1057: }
1058: if ( $status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {$showbutton = 0;}
1059: if ( $showbutton ) {
1060: if ($target ne 'tex') {
1061: $button = '<input type="submit" name="submit_'.$id.'" value="'.&mt('Submit Answer').'" />';
1062: }
1063: }
1064: if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
1065: #last submissions was after due date
1066: $latemessage=&mt(' The last submission was after the Due Date ');;
1067: if ($target eq 'web') {
1068: $latemessage='<td bgcolor="#ffaaaa">'.$latemessage.'</td>';
1069: }
1070: }
1071: }
1072: my $output= $previousmsg.$latemessage.$message.$trystr;
1073: if ($output =~ /^\s*$/) {
1074: return $button;
1075: } else {
1076: if ($target eq 'tex') {
1077: return $button.' \vskip 0 mm '.$output.' ';
1078: } else {
1079: return '<table><tr><td>'.$button.'</td>'.$output.'</tr></table>';
1080: }
1081: }
1082: }
1083: 1;
1084: __END__
1085:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>