| 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: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.154 2004/07/12 22:15:57 sh002i Exp $ |
4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.155 2004/07/12 23:38:52 sh002i 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. |
| … | |
… | |
| 132 | if ($max_attempts == -1 or $attempts_used < $max_attempts) { |
132 | if ($max_attempts == -1 or $attempts_used < $max_attempts) { |
| 133 | return $authz->hasPermissions($User->user_id, "record_answers_after_open_date_with_attempts"); |
133 | return $authz->hasPermissions($User->user_id, "record_answers_after_open_date_with_attempts"); |
| 134 | } else { |
134 | } else { |
| 135 | return $authz->hasPermissions($User->user_id, "record_answers_after_open_date_without_attempts"); |
135 | return $authz->hasPermissions($User->user_id, "record_answers_after_open_date_without_attempts"); |
| 136 | } |
136 | } |
| 137 | } elsif (between($Set->due_date, $Set->close_date)) { |
137 | } elsif (between($Set->due_date, $Set->answer_date)) { |
| 138 | return $authz->hasPermissions($User->user_id, "record_answers_after_due_date"); |
138 | return $authz->hasPermissions($User->user_id, "record_answers_after_due_date"); |
| 139 | } elsif (after($Set->close_date)) { |
139 | } elsif (after($Set->answer_date)) { |
| 140 | return $authz->hasPermissions($User->user_id, "record_answers_after_answer_date"); |
140 | return $authz->hasPermissions($User->user_id, "record_answers_after_answer_date"); |
| 141 | } |
141 | } |
| 142 | } |
142 | } |
| 143 | |
143 | |
| 144 | sub can_checkAnswers { |
144 | sub can_checkAnswers { |
| … | |
… | |
| 153 | if ($max_attempts == -1 or $attempts_used < $max_attempts) { |
153 | if ($max_attempts == -1 or $attempts_used < $max_attempts) { |
| 154 | return $authz->hasPermissions($User->user_id, "check_answers_after_open_date_with_attempts"); |
154 | return $authz->hasPermissions($User->user_id, "check_answers_after_open_date_with_attempts"); |
| 155 | } else { |
155 | } else { |
| 156 | return $authz->hasPermissions($User->user_id, "check_answers_after_open_date_without_attempts"); |
156 | return $authz->hasPermissions($User->user_id, "check_answers_after_open_date_without_attempts"); |
| 157 | } |
157 | } |
| 158 | } elsif (between($Set->due_date, $Set->close_date)) { |
158 | } elsif (between($Set->due_date, $Set->answer_date)) { |
| 159 | return $authz->hasPermissions($User->user_id, "check_answers_after_due_date"); |
159 | return $authz->hasPermissions($User->user_id, "check_answers_after_due_date"); |
| 160 | } elsif (after($Set->close_date)) { |
160 | } elsif (after($Set->answer_date)) { |
| 161 | return $authz->hasPermissions($User->user_id, "check_answers_after_answer_date"); |
161 | return $authz->hasPermissions($User->user_id, "check_answers_after_answer_date"); |
| 162 | } |
162 | } |
| 163 | } |
163 | } |
| 164 | |
164 | |
| 165 | # Helper functions for calculating times |
165 | # Helper functions for calculating times |