[LON-CAPA-cvs] cvs: loncom /homework optionresponse.pm response.pm structuretags.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 03 May 2002 19:32:57 -0000
albertel Fri May 3 15:32:57 2002 EDT
Modified files:
/loncom/homework optionresponse.pm structuretags.pm response.pm
Log:
- implements BUG#238 - New radio button showallfoils, optionresponse shows
all foils irrespective of the max parm and any conceptgroups, rbr and
ir still need the functionality
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.38 loncom/homework/optionresponse.pm:1.39
--- loncom/homework/optionresponse.pm:1.38 Thu Apr 25 17:35:30 2002
+++ loncom/homework/optionresponse.pm Fri May 3 15:32:57 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.38 2002/04/25 21:35:30 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.39 2002/05/03 19:32:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -229,6 +229,7 @@
my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
# +1 since instructors will count from 1
my $count = $#{ $Apache::response::foilgroup{'names'} }+1;
+ if (&Apache::response::showallfoils()) { $max=$count; }
return ($count,$max);
}
@@ -238,7 +239,12 @@
my @whichopt =();
while ((($#whichopt+1) < $max) && ($#names > -1)) {
&Apache::lonxml::debug("Have $#whichopt max is $max");
- my $aopt=int(rand($#names+1));
+ my $aopt;
+ if (&Apache::response::showallfoils()) {
+ $aopt=0;
+ } else {
+ $aopt=int(rand($#names+1));
+ }
&Apache::lonxml::debug("From $#whichopt $max $#names elms, picking $aopt");
$aopt=splice(@names,$aopt,1);
&Apache::lonxml::debug("Picked $aopt");
@@ -424,7 +430,8 @@
&Apache::lonxml::debug("Got a name of :$name:");
if (!$name) { $name=$Apache::lonxml::curdepth; }
&Apache::lonxml::debug("Using a name of :$name:");
- if ( $Apache::optionresponse::conceptgroup ) {
+ if ( $Apache::optionresponse::conceptgroup
+ && !&Apache::response::showallfoils() ) {
push @{ $Apache::response::conceptgroup{'names'} }, $name;
$Apache::response::conceptgroup{"$name.value"} = $value;
$Apache::response::conceptgroup{"$name.text"} = $text;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.92 loncom/homework/structuretags.pm:1.93
--- loncom/homework/structuretags.pm:1.92 Thu Apr 25 17:38:09 2002
+++ loncom/homework/structuretags.pm Fri May 3 15:32:57 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.92 2002/04/25 21:38:09 sakharuk Exp $
+# $Id: structuretags.pm,v 1.93 2002/05/03 19:32:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -266,6 +266,9 @@
$rndseed.'" />
<input type="submit" name="changerandseed" value="Change" />
<input type="submit" name="resetdata" value="Reset Submissions" />
+ <input type="checkbox" name="showallfoils" ';
+ if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }
+ $result.= ' /> Show All Foils
<hr />';
}
# if we are viewing someone else preserve that info
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.61 loncom/homework/response.pm:1.62
--- loncom/homework/response.pm:1.61 Thu Mar 14 15:30:36 2002
+++ loncom/homework/response.pm Fri May 3 15:32:57 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.61 2002/03/14 20:30:36 albertel Exp $
+# $Id: response.pm,v 1.62 2002/05/03 19:32:57 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -451,6 +451,14 @@
return $result;
}
+sub showallfoils {
+ my $return=0;
+ if (defined($ENV{'form.showallfoils'}) &&
+ $ENV{'request.state'} eq 'construct') {
+ $return=1;
+ }
+ return $return;
+}
1;
__END__