| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader$ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.183 2005/08/25 17:02:28 glarose Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 175 | sub between { my $t = time; return $t > $_[0] && $t < $_[1] } |
175 | sub between { my $t = time; return $t > $_[0] && $t < $_[1] } |
| 176 | |
176 | |
| 177 | # Reset the default in some cases |
177 | # Reset the default in some cases |
| 178 | sub set_showOldAnswers_default { |
178 | sub set_showOldAnswers_default { |
| 179 | my ($self, $ce, $userName, $authz, $set) = @_; |
179 | my ($self, $ce, $userName, $authz, $set) = @_; |
|
|
180 | # these people always use the system/course default, so don't |
|
|
181 | # override the value of ...->{showOldAnswers} |
|
|
182 | return if $authz->hasPermissions($userName, "can_always_use_show_old_answers_default"); |
| 180 | # this person should always default to 0 |
183 | # this person should always default to 0 |
| 181 | $ce->{pg}->{options}->{showOldAnswers} = 0 |
184 | $ce->{pg}->{options}->{showOldAnswers} = 0 |
| 182 | unless ($authz->hasPermissions($userName, "can_show_old_answers_by_default")); |
185 | unless ($authz->hasPermissions($userName, "can_show_old_answers_by_default")); |
| 183 | # we are after the due date, so default to not showing it |
186 | # we are after the due date, so default to not showing it |
| 184 | $ce->{pg}->{options}->{showOldAnswers} = 0 if $set->{due_date} && after($set->{due_date}); |
187 | $ce->{pg}->{options}->{showOldAnswers} = 0 if $set->{due_date} && after($set->{due_date}); |