From: Mike G. v. a. <we...@ma...> - 2005-06-29 02:48:58
|
Log Message: ----------- Fixed a problem with showing answers when printing hardcopy (no idea why this wasn't reported earlier). The CGI::checkboxes use "on" and nothing to denote whether a checkbox is checked. We expect 1 or 0 (or undef). Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: Hardcopy.pm Revision Data ------------- Index: Hardcopy.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v retrieving revision 1.53 retrieving revision 1.54 diff -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -u -r1.53 -r1.54 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -780,14 +780,15 @@ return $msg; } # figure out if we're allowed to get solutions and call PG->new accordingly. - my $showCorrectAnswers = $r->param("showCorrectAnswers") || 0; - my $showHints = $r->param("showHints") || 0; - my $showSolutions = $r->param("showSolutions") || 0; + my $showCorrectAnswers = $r->param("showCorrectAnswers") || 0; + my $showHints = $r->param("showHints") || 0; + my $showSolutions = $r->param("showSolutions") || 0; unless ($authz->hasPermissions($userID, "view_answers") or time > $set->answer_date) { $showCorrectAnswers = 0; $showSolutions = 0; } - + ##FIXME -- there can be a problem if the $siteDefaults{timezone} is not defined? Why is this? + # why does it only occur with hardcopy? my $pg = WeBWorK::PG->new( $ce, $effectiveUser, @@ -798,9 +799,9 @@ {}, # no form fields! { # translation options displayMode => "tex", - showHints => $showHints, - showSolutions => $showSolutions, - processAnswers => $showCorrectAnswers, + showHints => ($showHints)? 1:0, # insure that this value is numeric + showSolutions => ($showSolutions)? 1:0, + processAnswers => ($showCorrectAnswers)? 1:0, }, ); |