Log Message:
-----------
backport (sh002i): "Show Hints" and "Show Solutions" checkboxes.
Tags:
----
rel-2-4-dev
Modified Files:
--------------
webwork2/lib/WeBWorK/ContentGenerator/Instructor:
SetMaker.pm
webwork2/lib/WeBWorK/Utils:
Tasks.pm
Revision Data
-------------
Index: SetMaker.pm
===================================================================
RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm,v
retrieving revision 1.77.2.3
retrieving revision 1.77.2.4
diff -Llib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm -Llib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm -u -r1.77.2.3 -r1.77.2.4
--- lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm
+++ lib/WeBWorK/ContentGenerator/Instructor/SetMaker.pm
@@ -38,6 +38,8 @@
require WeBWorK::Utils::ListingDB;
+use constant SHOW_HINTS_DEFAULT => 0;
+use constant SHOW_SOLUTIONS_DEFAULT => 0;
use constant MAX_SHOW_DEFAULT => 20;
use constant NO_LOCAL_SET_STRING => 'No sets in this course yet';
use constant SELECT_SET_STRING => 'Select a Set from this Course';
@@ -314,6 +316,11 @@
CGI::popup_menu(-name=> 'max_shown',
-values=>[5,10,15,20,25,30,50,'All'],
-default=> $defaultMax);
+ # Option of whether to show hints and solutions
+ my $defaultHints = $r->param('showHints') || SHOW_HINTS_DEFAULT;
+ $result .= " ".CGI::checkbox(-name=>"showHints",-checked=>$defaultHints,-label=>"Hints");
+ my $defaultSolutions = $r->param('showSolutions') || SHOW_SOLUTIONS_DEFAULT;
+ $result .= " ".CGI::checkbox(-name=>"showSolutions",-checked=>$defaultSolutions,-label=>"Solutions");
return($result);
}
@@ -1286,6 +1293,9 @@
CGI::em("You are not authorized to access the Instructor tools.")));
}
+ my $showHints = $r->param('showHints');
+ my $showSolutions = $r->param('showSolutions');
+
########## Extract information computed in pre_header_initialize
my $first_shown = $self->{first_shown};
@@ -1295,11 +1305,17 @@
my @pg_files = @{$self->{pg_files}};
my @all_db_sets = @{$self->{all_db_sets}};
- my @pg_html=($last_shown>=$first_shown) ?
- renderProblems(r=> $r,
- user => $user,
- problem_list => [@pg_files[$first_shown..$last_shown]],
- displayMode => $r->param('mydisplayMode')) : ();
+ my @pg_html;
+ if ($last_shown >= $first_shown) {
+ @pg_html = renderProblems(
+ r=> $r,
+ user => $user,
+ problem_list => [@pg_files[$first_shown..$last_shown]],
+ displayMode => $r->param('mydisplayMode'),
+ showHints => $showHints,
+ showSolutions => $showSolutions,
+ );
+ }
my %isInSet;
my $setName = $r->param("local_sets");
Index: Tasks.pm
===================================================================
RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/Utils/Tasks.pm,v
retrieving revision 1.13.6.1
retrieving revision 1.13.6.2
diff -Llib/WeBWorK/Utils/Tasks.pm -Llib/WeBWorK/Utils/Tasks.pm -u -r1.13.6.1 -r1.13.6.2
--- lib/WeBWorK/Utils/Tasks.pm
+++ lib/WeBWorK/Utils/Tasks.pm
@@ -131,6 +131,8 @@
my $problem_seed = $args{'problem_seed'} || $r->param('problem_seed') || 0;
my $displayMode = $args{displayMode} ||
$r->param("displayMode") || $ce->{pg}->{options}->{displayMode};
+ my $showHints = $args{showHints} || 0;
+ my $showSolutions = $args{showSolutions} || 0;
my $problemNumber= $args{'problem_number'} || 1;
$ce->{pg}->{specialPGEnvironmentVars}->{problemPreamble} = {
TeX=>'',
@@ -164,8 +166,8 @@
$formFields,
{ # translation options
displayMode => $displayMode,
- showHints => 0,
- showSolutions => 0,
+ showHints => $showHints,
+ showSolutions => $showSolutions,
refreshMath2img => 0,
processAnswers => 0,
}
|