From: Mike G. v. a. <we...@ma...> - 2005-01-29 01:40:10
|
Log Message: ----------- Fixed problem with hardcopy editing. This case had simply not been handled in the code even though it's the same behavior for hardcopy headers as it is for screen headers. This fixes bug #763 Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor: PGProblemEditor.pm Revision Data ------------- Index: PGProblemEditor.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v retrieving revision 1.51 retrieving revision 1.52 diff -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -u -r1.51 -r1.52 --- lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm +++ lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm @@ -294,7 +294,7 @@ # FIXME: even with an error we still open a new page because of the target specified in the form - # Some cases do not need a redirect revert, no fresh_edit + # Some cases do not need a redirect: revert, fresh_edit my $action = $self->{action}; return unless $action eq 'save' @@ -400,7 +400,7 @@ # redirect to ProblemSet.pm ###################################### - $file_type eq 'set_header' and do { + ($file_type eq 'set_header' or $file_type eq 'hardcopy_header' ) and do { if ($action eq 'save_as') { # redirect to myself my $sourceFilePath = $self->{problemPath}; # strip off template directory prefix @@ -485,9 +485,9 @@ my $tempFilePath = $self->{tempFilePath}; # path to the file currently being worked with (might be a .tmp file) my $inputFilePath = $self->{inputFilePath}; # path to the file for input, (might be a .tmp file) - my $protected_file = not -w $inputFilePath; + my $protected_file = (not -w $inputFilePath ) and -e $inputFilePath; #FIXME -- let's try to insure that the input file always exists, even for revert. $self->addbadmessage("Changes in this file have not yet been permanently saved.") if -r $tempFilePath; - $self->addbadmessage("This file protected! To edit this text you must first use 'Save As' to save it to another file.") if $protected_file; + $self->addbadmessage("This file |$inputFilePath| is protected! To edit this text you must first use 'Save As' to save it to another file.") if $protected_file; } @@ -951,7 +951,7 @@ ($action eq 'add_problem_to_set') and do { my $sourceFile = $editFilePath; my $targetSetName = $r->param('target_set'); - my $freeProblemID; + my $freeProblemID = WeBWorK::Utils::max($db->listGlobalProblems($setName)) + 1; $sourceFile =~ s|^$ce->{courseDirs}->{templates}/||; my $problemRecord = $self->addProblemToSet( setName => $targetSetName, |