From: Mike G. v. a. <we...@ma...> - 2009-09-25 00:56:06
|
Log Message: ----------- Hide from students most of the errors created when the hardcopy version can't be TeX'd or created for some other reason. The professor still gets the errors. A value in global.conf download_hardcopy_view_errors =>"professor", adjusts who sees the hardcopy errors. global.conf.dist has been changed to include this entry. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator: Hardcopy.pm Revision Data ------------- Index: Hardcopy.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v retrieving revision 1.101 retrieving revision 1.102 diff -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -u -r1.101 -r1.102 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -173,6 +173,7 @@ # is the user allowed to request multiple sets/users at a time? my $perm_multiset = $authz->hasPermissions($userID, "download_hardcopy_multiset"); my $perm_multiuser = $authz->hasPermissions($userID, "download_hardcopy_multiuser"); + my $perm_viewhidden = $authz->hasPermissions($userID, "view_hidden_work"); my $perm_viewfromip = $authz->hasPermissions($userID, "view_ip_restricted_sets"); @@ -263,42 +264,57 @@ sub body { my ($self) = @_; - + my $userID = $self->r->param("user"); + my $perm_view_errors = $self->r->authz->hasPermissions($userID, "download_hardcopy_view_errors"); + $perm_view_errors = (defined($perm_view_errors) ) ? $perm_view_errors : 0; if (my $num = $self->get_errors) { my $final_file_url = $self->{final_file_url}; my %temp_file_map = %{$self->{temp_file_map}}; - - my $errors_str = $num > 1 ? "errors" : "error"; - print CGI::p("$num $errors_str occured while generating hardcopy:"); - - print CGI::ul(CGI::li($self->get_errors_ref)); + if($perm_view_errors) { + my $errors_str = $num > 1 ? "errors" : "error"; + print CGI::p("$num $errors_str occured while generating hardcopy:"); + + print CGI::ul(CGI::li($self->get_errors_ref)); + } if ($final_file_url) { print CGI::p( - "A hardcopy file was generated, but it may not be complete or correct: ", - CGI::a({href=>$final_file_url}, "Download Hardcopy") + "A hardcopy file was generated, but it may not be complete or correct.", + "Please check that no problems are missing and that they are all legible." , + "If not, please inform your instructor.<br />", + CGI::a({href=>$final_file_url}, "Download Hardcopy"), ); - } + } else { + print CGI::p( + "WeBWorK was unable to generate a paper copy of this homework set. Please inform your instructor. " + ); - if (%temp_file_map) { - print CGI::start_p(); - print "You can also examine the following temporary files: "; - my $first = 1; - while (my ($temp_file_name, $temp_file_url) = each %temp_file_map) { - if ($first) { - $first = 0; - } else { - print ", "; + } + if($perm_view_errors) { + if (%temp_file_map) { + print CGI::start_p(); + print "You can also examine the following temporary files: "; + my $first = 1; + while (my ($temp_file_name, $temp_file_url) = each %temp_file_map) { + if ($first) { + $first = 0; + } else { + print ", "; + } + print CGI::a({href=>$temp_file_url}, " $temp_file_name"); } - print CGI::a({href=>$temp_file_url}, " $temp_file_name"); + print CGI::end_p(); } - print CGI::end_p(); } print CGI::hr(); } - - $self->display_form(); + + # don't display the retry form if there are errors and the user doesn't have permission to view the errors. + unless ($self->get_errors and not $perm_view_errors) { + $self->display_form(); + } + ''; # return a blank } sub display_form { |