[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm response.pm /homework/caparesponse caparesponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 14 Oct 2002 20:37:27 -0000
This is a MIME encoded message
--albertel1034627847
Content-Type: text/plain
albertel Mon Oct 14 16:37:27 2002 EDT
Modified files:
/loncom/homework randomlabel.pm response.pm
/loncom/homework/caparesponse caparesponse.pm
Log:
- adding analyze to more tags in preperation for analyzing a problems answer distribution
--albertel1034627847
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20021014163727.txt"
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.36 loncom/homework/randomlabel.pm:1.37
--- loncom/homework/randomlabel.pm:1.36 Tue Aug 27 14:21:27 2002
+++ loncom/homework/randomlabel.pm Mon Oct 14 16:37:27 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.36 2002/08/27 18:21:27 sakharuk Exp $
+# $Id: randomlabel.pm,v 1.37 2002/10/14 20:37:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -200,8 +200,8 @@
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval);
$type =~tr/A-Z/a-z/;
- if ($target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer') {
+ if ($target eq 'web' || $target eq 'tex' ||
+ $target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
$Apache::randomlabel::groupname=$name;
$Apache::randomlabel::type=$type;
@Apache::randomlabel::xcoord = ();
@@ -249,7 +249,8 @@
my $gname = $Apache::randomlabel::groupname;
my $type = $Apache::randomlabel::type;
my $result='';
- if ($target eq 'web' || $target eq 'answer' || $target eq 'grade') {
+ if ($target eq 'web' || $target eq 'answer' || $target eq 'grade' ||
+ $target eq 'analyze') {
my @idx_arr = (0 .. $#Apache::randomlabel::label_arr);
&Apache::structuretags::shuffle(\@idx_arr);
for(0 .. $#Apache::randomlabel::label_arr) {
@@ -373,8 +374,8 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval,-2);
- if ($target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer') {
+ if ($target eq 'web' || $target eq 'tex' ||
+ $target eq 'grade' || $target eq 'answer' || $target eq 'analyze') {
my $ltext=&Apache::lonxml::get_all_text("/label",$$parser[-1]);
$ltext=&Apache::run::evaluate($ltext,$safeeval,$$parstack[-1]);
if ($type eq 'image') {
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.65 loncom/homework/response.pm:1.66
--- loncom/homework/response.pm:1.65 Tue Oct 8 14:04:04 2002
+++ loncom/homework/response.pm Mon Oct 14 16:37:27 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.65 2002/10/08 18:04:04 bowersj2 Exp $
+# $Id: response.pm,v 1.66 2002/10/14 20:37:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -245,7 +245,7 @@
my ($symb,$courseid,$domain,$name)=&Apache::lonxml::whichuser();
my $allowed=&Apache::lonnet::allowed('mgr',$courseid);
if ($allowed) {
- &Apache::response::setup_params('datasubmission');
+ &Apache::response::setup_params('dataresponse');
my $partid = $Apache::inputtags::part;
my $id = $Apache::inputtags::response['-1'];
my $response = $ENV{'form.HWVAL'.$id};
@@ -293,8 +293,8 @@
$result = &Apache::edit::rebuild_tag($token);
$result.=&Apache::edit::handle_insert();
}
- } elsif ($target eq 'grade' || $target eq 'answer' ||
- $target eq 'web' || $target eq 'tex') {
+ } elsif ($target eq 'grade' || $target eq 'answer' || $target eq 'web' ||
+ $target eq 'tex' || $target eq 'analyze' ) {
if ($ENV{'request.state'} eq 'construct') {
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
my $default = &Apache::lonxml::get_param('default',$parstack,$safeeval);
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.64 loncom/homework/caparesponse/caparesponse.pm:1.65
--- loncom/homework/caparesponse/caparesponse.pm:1.64 Fri Oct 4 02:35:28 2002
+++ loncom/homework/caparesponse/caparesponse.pm Mon Oct 14 16:37:27 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.64 2002/10/04 06:35:28 albertel Exp $
+# $Id: caparesponse.pm,v 1.65 2002/10/14 20:37:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -297,65 +297,94 @@
}
} elsif ($target eq 'edit') {
$result.='</td></tr>'.&Apache::edit::end_table;
- } elsif ($target eq 'answer') {
+ } elsif ($target eq 'answer' || $target eq 'analyze') {
- &Apache::response::setup_params($$tagstack[-1]);
- my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
- my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
- my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);
- my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval);
+ my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
+ if ($target eq 'analyze') {
+ push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
+ $Apache::lonhomework::analyze{"$part_id.type"} = $$tagstack[-1];
+ }
+ &Apache::response::setup_params($$tagstack[-1]);
+ my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
+ my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
+ my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);
+ my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval);
- $result.=&Apache::response::answer_header($$tagstack[-1]);
- for(my $i=0;$i<=$#answers;$i++) {
- my $ans=$answers[$i];
- my $fmt;
- if (@formats) {
- if ($#formats) {
- $fmt=$formats[$i];
- } else {
- $fmt=$formats[0];
- }
+ if ($target eq 'answer') {
+ $result.=&Apache::response::answer_header($$tagstack[-1]);
}
- my ($high,$low);
- if ($Apache::inputtags::params{'tol'}) {
- ($high,$low)=&get_tolrange($ans,$Apache::inputtags::params{'tol'});
- }
- my ($sighigh,$siglow);
- if ($Apache::inputtags::params{'sig'}) {
- ($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'});
+ for(my $i=0;$i<=$#answers;$i++) {
+ my $ans=$answers[$i];
+ my $fmt;
+ if (@formats) {
+ if ($#formats) {
+ $fmt=$formats[$i];
+ } else {
+ $fmt=$formats[0];
+ }
+ }
+ my ($high,$low);
+ if ($Apache::inputtags::params{'tol'}) {
+ ($high,$low)=&get_tolrange($ans,$Apache::inputtags::params{'tol'});
+ }
+ my ($sighigh,$siglow);
+ if ($Apache::inputtags::params{'sig'}) {
+ ($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'});
+ }
+ if ($fmt) {
+ $ans = sprintf('%.'.$fmt,$ans);
+ if ($high) {
+ $high = sprintf('%.'.$fmt,$high); $low = sprintf('%.'.$fmt,$low);
+ }
+ }
+ if ($target eq 'answer') {
+ if ($high) { $ans.=' ['.$low.','.$high.'] '; }
+ if ($sighigh) { $ans.= "Sig <i>$siglow - $sighigh</i>"; }
+ $result.=&Apache::response::answer_part($$tagstack[-1],$ans);
+ } elsif ($target eq 'analyze') {
+ push (@{ $Apache::lonhomework::analyze{"$part_id.answer"} },
+ $ans);
+ if ($high) {
+ push (@{ $Apache::lonhomework::analyze{"$part_id.ans_high"} }, $high);
+ push (@{ $Apache::lonhomework::analyze{"$part_id.ans_low"} }, $low);
+ }
+ }
}
- if ($fmt) {
- $ans = sprintf('%.'.$fmt,$ans);
- if ($high) {
- $high = sprintf('%.'.$fmt,$high); $low = sprintf('%.'.$fmt,$low);
- }
+ if ($unit) {
+ if ($target eq 'answer') {
+ $result.=&Apache::response::answer_part($$tagstack[-1],
+ "Unit: <b>$unit</b>");
+ } elsif ($target eq 'analyze') {
+ push (@{ $Apache::lonhomework::analyze{"$part_id.unit"} },
+ $unit);
+ }
}
- if ($high) { $ans.=' ['.$low.','.$high.'] '; }
- if ($sighigh) { $ans.= "Sig <i>$siglow - $sighigh</i>"; }
- $result.=&Apache::response::answer_part($$tagstack[-1],$ans);
- }
- if ($unit) {
- $result.=&Apache::response::answer_part($$tagstack[-1],"Unit: <b>$unit</b>");
- }
- if ($type || $token->[1] eq 'stringresponse') {
- my $string='Case Insensitive';
- if ($type eq 'mc') {
- $string='Multiple Choice';
- } elsif ($type eq 'cs') {
- $string='Case Sensitive';
- } elsif ($type eq 'ci') {
- $string='Case Insensitive';
- } elsif ($type eq 'fml') {
- $string='Formula';
+ if ($type || $token->[1] eq 'stringresponse') {
+ my $string='Case Insensitive';
+ if ($type eq 'mc') {
+ $string='Multiple Choice';
+ } elsif ($type eq 'cs') {
+ $string='Case Sensitive';
+ } elsif ($type eq 'ci') {
+ $string='Case Insensitive';
+ } elsif ($type eq 'fml') {
+ $string='Formula';
+ }
+ if ($target eq 'answer') {
+ $result.=&Apache::response::answer_part($$tagstack[-1],
+ '<b>'.$string.'</b>');
+ } elsif ($target eq 'analyze') {
+ push (@{ $Apache::lonhomework::analyze{"$part_id.type"} },
+ $type);
+ }
+ }
+ if ($$tagstack[-1] eq 'formularesponse' && $target eq 'answer') {
+ my $samples=&Apache::lonxml::get_param('samples',$parstack,$safeeval);
+ $result.=&Apache::response::answer_part($$tagstack[-1],$samples);
+ }
+ if ($target eq 'answer') {
+ $result.=&Apache::response::answer_footer($$tagstack[-1]);
}
- $result.=&Apache::response::answer_part($$tagstack[-1],
- '<b>'.$string.'</b>');
- }
- if ($$tagstack[-1] eq 'formularesponse') {
- my $samples=&Apache::lonxml::get_param('samples',$parstack,$safeeval);
- $result.=&Apache::response::answer_part($$tagstack[-1],$samples);
- }
- $result.=&Apache::response::answer_footer($$tagstack[-1]);
}
&Apache::response::end_response;
return $result;
--albertel1034627847--