[system] / trunk / webwork2 / lib / WeBWorK / ContentGenerator / Problem.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2062 Revision 2093
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: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.124 2004/05/06 22:46:13 jj Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.125 2004/05/09 17:47:35 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.
198 $self->{redisplay} = $redisplay; 198 $self->{redisplay} = $redisplay;
199 $self->{submitAnswers} = $submitAnswers; 199 $self->{submitAnswers} = $submitAnswers;
200 $self->{checkAnswers} = $checkAnswers; 200 $self->{checkAnswers} = $checkAnswers;
201 $self->{previewAnswers} = $previewAnswers; 201 $self->{previewAnswers} = $previewAnswers;
202 $self->{formFields} = $formFields; 202 $self->{formFields} = $formFields;
203
204 # get result and send to message
205 my $success = $r->param("sucess");
206 my $failure = $r->param("failure");
207 $self->addmessage(CGI::div({class=>"ResultsWithError"}, CGI::p($failure))) if $failure;
208 $self->addmessage(CGI::div({class=>"ResultsWithoutError"}, CGI::p($success))) if $success;
203 209
204 # now that we've set all the necessary variables quit out if the set or problem is invalid 210 # now that we've set all the necessary variables quit out if the set or problem is invalid
205 return if $self->{invalidSet} || $self->{invalidProblem}; 211 return if $self->{invalidSet} || $self->{invalidProblem};
206 212
207 ##### permissions ##### 213 ##### permissions #####
651 # custom message for editor 657 # custom message for editor
652 if ($permissionLevel >= 10 and defined $editMode) { 658 if ($permissionLevel >= 10 and defined $editMode) {
653 if ($editMode eq "temporaryFile") { 659 if ($editMode eq "temporaryFile") {
654 print CGI::p(CGI::i("Editing temporary file: ", $problem->source_file)); 660 print CGI::p(CGI::i("Editing temporary file: ", $problem->source_file));
655 } elsif ($editMode eq "savedFile") { 661 } elsif ($editMode eq "savedFile") {
662 # FIXME: this is all done automatically if submitError exists.
656 if ( defined($r->param('submiterror')) and $r->param('submiterror') ) { 663 #if ( defined($r->param('submiterror')) and $r->param('submiterror') ) {
657 # FIXME The following line doesn't work because the submiterror hook has already been called. 664 # FIXME The following line doesn't work because the submiterror hook has already been called.
658 # The actions below should take place during the initialization phase. 665 # The actions below should take place during the initialization phase.
659 $self->{submiterror} .= $r->param('submiterror'); 666 # $self->{submiterror} .= $r->param('submiterror');
660 print CGI::p(CGI::div({class=>'ResultsWithError'},$self->{submiterror})); 667 # print CGI::p(CGI::div({class=>'ResultsWithError'},$self->{submiterror}));
661 } else { 668 #} else {
662 print CGI::p(CGI::div({ class=>'ResultsWithoutError'}, "Problem saved to: ", $problem->source_file)); 669 # print CGI::p(CGI::div({ class=>'ResultsWithoutError'}, "Problem saved to: ", $problem->source_file));
663 } 670 #}
664 } 671 }
665 } 672 }
666 #FIXME we need error messages here if the problem was really not saved. 673 #FIXME we need error messages here if the problem was really not saved.
667 # attempt summary 674 # attempt summary
668 #FIXME -- the following is a kludge: if showPartialCorrectAnswers is negative don't show anything. 675 #FIXME -- the following is a kludge: if showPartialCorrectAnswers is negative don't show anything.
1112 my ($permissionLevel) = @_; 1119 my ($permissionLevel) = @_;
1113 return $permissionLevel == 0; 1120 return $permissionLevel == 0;
1114} 1121}
1115 1122
1116 1123
1124# FIXME: does this even get used?
1117sub submiterror { 1125sub submiterror {
1118 my $self = shift; 1126 my $self = shift;
1119 my $submiterror = (defined($self->{submiterror}) ) ? $self->{submiterror} : ''; 1127 my $submiterror = (defined($self->{submiterror}) ) ? $self->{submiterror} : '';
1120 $submiterror; 1128 $submiterror;
1121} 1129}

Legend:
Removed from v.2062  
changed lines
  Added in v.2093

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9