Annotation of loncom/homework/response.pm, revision 1.11
1.1 albertel 1: # The LearningOnline Network with CAPA
2: # various response type definitons response definition
3:
1.7 www 4: # 11/23,11/24,11/28 Gerd Kortemeyer
1.5 www 5:
1.1 albertel 6: package Apache::response;
7: use strict;
8:
9: sub BEGIN {
1.3 albertel 10: &Apache::lonxml::register('Apache::response',('responseparam','caparesponse'));
1.1 albertel 11: }
12:
1.7 www 13: sub meta_parameter_write {
1.10 www 14: my ($name,$type,$default,$display)=@_;
15: return '<parameter part="'.$Apache::inputtags::part.
1.7 www 16: '" name="'.$name.
17: '" type="'.$type.
18: '" default="'.$default.
1.10 www 19: '" display="'.$display.
20: ' [Part: '.$Apache::inputtags::part.']"></parameter>'
1.7 www 21: ."\n";
22: }
23:
24: sub meta_stores_write {
1.10 www 25: my ($name,$type,$display)=@_;
26: return '<stores part="'.$Apache::inputtags::part.
1.7 www 27: '" name="'.$name.
28: '" type="'.$type.
1.10 www 29: '" display="'.$display.
30: ' [Part: '.$Apache::inputtags::part.']"></stores>'
1.7 www 31: ."\n";
32: }
33:
34: sub mandatory_part_meta {
35: #
36: # Autogenerate metadata for mandatory
37: # input (from RAT or lonparmset) and
38: # output (to lonspreadsheet)
39: # of each part
40: #
41: return
1.10 www 42: &meta_parameter_write('opendate','date_start','',
1.7 www 43: 'Opening Date').
1.10 www 44: &meta_parameter_write('duedate','date_end','',
1.7 www 45: 'Due Date').
1.10 www 46: &meta_parameter_write('answerdate','date_start','',
1.7 www 47: 'Show Answer Date').
1.10 www 48: &meta_parameter_write('weight','int_zeropos','',
1.7 www 49: 'Available Points').
1.10 www 50: &meta_parameter_write('maxtries','int_pos','',
1.7 www 51: 'Maximum Number of Tries').
52:
1.10 www 53: &meta_stores_write('solved','string',
1.7 www 54: 'Problem Status').
1.10 www 55: &meta_stores_write('tries','int_zeropos',
1.7 www 56: 'Number of Unsuccessful Tries').
1.10 www 57: &meta_stores_write('awarded','float',
1.7 www 58: 'Partial Credit Factor');
59: #
60: # Note: responseid-specific data 'submission' and 'awarddetail'
61: # not available to spreadsheet -> skip here
62: #
63: }
64:
1.1 albertel 65: sub start_caparesponse {
66: require Apache::caparesponse;
67: import Apache::caparesponse;
68: my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
1.2 albertel 69: # print "\n<br>\nsimple caparesponse\n";
1.1 albertel 70: Apache::caparesponse::start_caparesponse($target,$token,$parstack,$parser,$safeeval,$style);;
1.2 albertel 71: return "";
1.3 albertel 72: }
73:
74: sub start_responseparam {
75: my ($target,$token,$parstack,$parser,$safeeval)=@_;
1.8 albertel 76: if ($target ne 'meta') {
77: my $args='';
78: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
79: my $default = &Apache::run::run("{$args;".'return $default}',$safeeval);
80: my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
1.9 albertel 81: &Apache::lonxml::debug("looking for resource.$Apache::inputtags::part.$name");
82: my $value = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.$name");
1.8 albertel 83: &Apache::lonxml::debug("$name has value :$value: and default :$default:");
1.11 ! albertel 84: if ($value eq '') {
! 85: &Apache::lonxml::debug("defaullting");
1.8 albertel 86: $Apache::inputtags::params{$name}=$default;
87: } else {
1.11 ! albertel 88: &Apache::lonxml::debug("using value");
1.8 albertel 89: $Apache::inputtags::params{$name}=$value;
90: }
91: return '';
1.3 albertel 92: } else {
1.10 www 93: return &meta_parameter_write($token->[2]->{'name'},
1.8 albertel 94: $token->[2]->{'type'},
95: $token->[2]->{'default'},
96: $token->[2]->{'description'});
1.3 albertel 97: }
98: }
99:
100: sub end_responseparam {
1.1 albertel 101: }
1.2 albertel 102:
1.1 albertel 103: 1;
104: __END__
105:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>