| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.201 2006/06/24 19:38:00 dpvc Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.202 2006/07/08 14:07:34 gage 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. |
| … | |
… | |
| 23 | |
23 | |
| 24 | =cut |
24 | =cut |
| 25 | |
25 | |
| 26 | use strict; |
26 | use strict; |
| 27 | use warnings; |
27 | use warnings; |
| 28 | use CGI qw(-nosticky ); |
28 | #use CGI qw(-nosticky ); |
|
|
29 | use WeBWorK::CGI; |
| 29 | use File::Path qw(rmtree); |
30 | use File::Path qw(rmtree); |
| 30 | use WeBWorK::Debug; |
31 | use WeBWorK::Debug; |
| 31 | use WeBWorK::Form; |
32 | use WeBWorK::Form; |
| 32 | use WeBWorK::PG; |
33 | use WeBWorK::PG; |
| 33 | use WeBWorK::PG::ImageGenerator; |
34 | use WeBWorK::PG::ImageGenerator; |
| … | |
… | |
| 1005 | print CGI::start_form(-method=>"POST", -action=> $r->uri,-name=>"problemMainForm", onSubmit=>"submitAction()"); |
1006 | print CGI::start_form(-method=>"POST", -action=> $r->uri,-name=>"problemMainForm", onSubmit=>"submitAction()"); |
| 1006 | print $self->hidden_authen_fields; |
1007 | print $self->hidden_authen_fields; |
| 1007 | print "\n"; |
1008 | print "\n"; |
| 1008 | print CGI::start_div({class=>"problem"}); |
1009 | print CGI::start_div({class=>"problem"}); |
| 1009 | print CGI::p($pg->{body_text}); |
1010 | print CGI::p($pg->{body_text}); |
| 1010 | print CGI::p(CGI::b("Note: "), CGI::i($pg->{result}->{msg})) if $pg->{result}->{msg}; |
1011 | print CGI::p(CGI::b("Note: "). CGI::i($pg->{result}->{msg})) if $pg->{result}->{msg}; |
| 1011 | print $editorLink; # this is empty unless it is appropriate to have an editor link. |
1012 | print $editorLink; # this is empty unless it is appropriate to have an editor link. |
| 1012 | print CGI::end_div(); |
1013 | print CGI::end_div(); |
| 1013 | |
1014 | |
| 1014 | print CGI::start_p(); |
1015 | print CGI::start_p(); |
| 1015 | |
1016 | |
| … | |
… | |
| 1093 | # $setClosedMessage .= " Additional attempts will not be recorded."; |
1094 | # $setClosedMessage .= " Additional attempts will not be recorded."; |
| 1094 | # } |
1095 | # } |
| 1095 | #} |
1096 | #} |
| 1096 | unless (defined( $pg->{state}->{state_summary_msg}) and $pg->{state}->{state_summary_msg}=~/\S/) { |
1097 | unless (defined( $pg->{state}->{state_summary_msg}) and $pg->{state}->{state_summary_msg}=~/\S/) { |
| 1097 | my $notCountedMessage = ($problem->value) ? "" : "(This problem will not count towards your grade.)"; |
1098 | my $notCountedMessage = ($problem->value) ? "" : "(This problem will not count towards your grade.)"; |
| 1098 | print CGI::p( |
1099 | print CGI::p(join("", |
| 1099 | $submitAnswers ? $scoreRecordedMessage . CGI::br() : "", |
1100 | $submitAnswers ? $scoreRecordedMessage . CGI::br() : "", |
| 1100 | "You have attempted this problem $attempts $attemptsNoun.", CGI::br(), |
1101 | "You have attempted this problem $attempts $attemptsNoun.", CGI::br(), |
| 1101 | $submitAnswers ?"You received a score of ".sprintf("%.0f%%", $pg->{result}->{score} * 100)." for this attempt.".CGI::br():'', |
1102 | $submitAnswers ?"You received a score of ".sprintf("%.0f%%", $pg->{result}->{score} * 100)." for this attempt.".CGI::br():'', |
| 1102 | $problem->attempted |
1103 | $problem->attempted |
| 1103 | ? "Your overall recorded score is $lastScore. $notCountedMessage" . CGI::br() |
1104 | ? "Your overall recorded score is $lastScore. $notCountedMessage" . CGI::br() |
| 1104 | : "", |
1105 | : "", |
| 1105 | $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining." |
1106 | $setClosed ? $setClosedMessage : "You have $attemptsLeft $attemptsLeftNoun remaining." |
| 1106 | ); |
1107 | )); |
| 1107 | }else { |
1108 | }else { |
| 1108 | print CGI::p($pg->{state}->{state_summary_msg}); |
1109 | print CGI::p($pg->{state}->{state_summary_msg}); |
| 1109 | } |
1110 | } |
| 1110 | print CGI::end_div(); |
1111 | print CGI::end_div(); |
| 1111 | |
1112 | |