[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 08 Nov 2005 17:53:21 -0000
www Tue Nov 8 12:53:21 2005 EDT
Modified files:
/loncom/homework lonhomework.pm structuretags.pm
Log:
Analyze problem has link to sample random seed leading to that result
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.218 loncom/homework/lonhomework.pm:1.219
--- loncom/homework/lonhomework.pm:1.218 Mon Aug 29 15:28:43 2005
+++ loncom/homework/lonhomework.pm Tue Nov 8 12:53:20 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.218 2005/08/29 19:28:43 albertel Exp $
+# $Id: lonhomework.pm,v 1.219 2005/11/08 17:53:20 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -615,6 +615,7 @@
&Apache::lonxml::debug("Analyze");
my $result;
my %overall;
+ my %seedexample;
my %allparts;
my $rndseed=$env{'form.rndseed'};
&analyze_header($request);
@@ -627,9 +628,10 @@
&Apache::lonhtmlcommon::Increment_PrgWin($request,\%prog_state,
&mt('last problem'));
if (&Apache::loncommon::connection_aborted($request)) { return; }
+ my $thisseed=$i+$rndseed;
my $subresult=&Apache::lonnet::ssi($request->uri,
('grade_target' => 'analyze'),
- ('rndseed' => $i+$rndseed));
+ ('rndseed' => $thisseed));
(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
my %analyze=&Apache::lonnet::str2hash($subresult);
my @parts;
@@ -641,8 +643,13 @@
if ($analyze{$part.'.type'} eq 'numericalresponse' ||
$analyze{$part.'.type'} eq 'stringresponse' ||
$analyze{$part.'.type'} eq 'formularesponse' ) {
+ my $concatanswer=join("\0",@{ $analyze{$part.'.answer'} });
+ if (($concatanswer eq '') || ($concatanswer=~/^\@/)) {
+ @{$analyze{$part.'.answer'}}=('<font color="red">'.&mt('Error').'</font>');
+ }
push( @{ $overall{$part.'.answer'} },
[@{ $analyze{$part.'.answer'} }]);
+ $seedexample{join("\0",@{ $analyze{$part.'.answer'}})}=$thisseed;
}
}
}
@@ -652,17 +659,18 @@
foreach my $part (sort(keys(%allparts))) {
if (defined(@{ $overall{$part.'.answer'} })) {
my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] });
- $request->print('<table><tr><th colspan="'.($num_cols+1).'">'.&mt('Part').' '.$part.'</th></tr>');
+ $request->print('<table border="1"><tr><th colspan="'.($num_cols+1).'">'.&mt('Part').' '.$part.'</th></tr>');
my %frequency;
foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) {
$frequency{join("\0",@{ $answer })}++;
}
- $request->print('<tr><th colspan="'.($num_cols).'">'.&mt('Answer').'</th><th>'.&mt('Frequency').'</th></tr>');
+ $request->print('<tr><th colspan="'.($num_cols).'">'.&mt('Answer').'</th><th>'.&mt('Frequency').'<br />('
+ .&mt('click for example').')</th></tr>');
foreach my $answer (sort {(split("\0",$a))[0] <=> (split("\0",$b))[0]} (keys(%frequency))) {
- $request->print('<tr><td align="right">'.
- join('</td><td align="right">',split("\0",$answer)).
- '</td><td>('.$frequency{$answer}.
- ')</td></tr>');
+ $request->print('<tr><td>'.
+ join('</td><td>',split("\0",$answer)).
+ '</td><td><a href="'.$request->uri.'?rndseed='.$seedexample{$answer}.'">'.$frequency{$answer}.
+ '</a></td></tr>');
}
$request->print('</table>');
} else {
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.315 loncom/homework/structuretags.pm:1.316
--- loncom/homework/structuretags.pm:1.315 Fri Nov 4 10:34:32 2005
+++ loncom/homework/structuretags.pm Tue Nov 8 12:53:20 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.315 2005/11/04 15:34:32 albertel Exp $
+# $Id: structuretags.pm,v 1.316 2005/11/08 17:53:20 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -175,6 +175,8 @@
my ($symb)=&Apache::lonxml::whichuser();
if ($env{'request.state'} eq "construct" || $symb eq '' ||
$Apache::lonhomework::history{'resource.CODE'}) {
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['rndseed']);
$rndseed=$env{'form.rndseed'};
if (!$rndseed) {
$rndseed=$Apache::lonhomework::history{'rndseed'};