From: dpvc v. a. <we...@ma...> - 2006-01-11 23:11:16
|
Log Message: ----------- Removed commented-out messages that where changed to use the shortPath() function (I had left them in to make it easier to merge with new versions using CVS, but they need not be kept now that the changes have been included in the official version). Tags: ---- rel-2-2-dev Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator/Instructor: PGProblemEditor.pm Revision Data ------------- Index: PGProblemEditor.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v retrieving revision 1.66.2.4 retrieving revision 1.66.2.5 diff -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -u -r1.66.2.4 -r1.66.2.5 --- lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm +++ lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm @@ -357,7 +357,6 @@ $self->addmessage($r->param('status_message') ||''); # record status messages carried over if this is a redirect $self->addbadmessage("Changes in this file have not yet been permanently saved.") if -r $tempFilePath; if ( not( -e $inputFilePath) ) { -## $self->addbadmessage("This file: $inputFilePath, cannot be found."); $self->addbadmessage("The file '".$self->shortPath($inputFilePath)."' cannot be found."); } elsif (not -w $inputFilePath ) { @@ -517,7 +516,6 @@ my $problemSeed = $self->{problemSeed}; my $uri = $r->uri; my $edit_level = $r->param('edit_level') || 0; -## my $file_type = $self->{file_type}; my $force_field = (defined($self->{sourceFilePath}) and $self->{sourceFilePath} ne "") ? CGI::hidden(-name=>'sourceFilePath', @@ -547,7 +545,6 @@ print CGI::p($header), -## CGI::start_form({method=>"POST", name=>"editor", action=>"$uri", target=>$target, enctype=>"application/x-www-form-urlencoded"}), CGI::start_form({method=>"POST", id=>"editor", name=>"editor", action=>"$uri", enctype=>"application/x-www-form-urlencoded"}), $self->hidden_authen_fields, @@ -571,7 +568,6 @@ CGI::textarea( -name => 'problemContents', -default => $problemContents, -rows => $rows, -columns => $columns, -override => 1, -## )," | ", ), ); @@ -591,7 +587,6 @@ my $actionForm = "${actionID}_form"; my $newWindow = ($actionID =~ m/^(view|add_problem|save)$/)? 1: 0; my $onChange = "setRadio($i,$newWindow)"; -## my $onChange = "document.userlist.action[$i].checked=true"; my %actionParams = $self->getActionParams($actionID); my $line_contents = $self->$actionForm($onChange, %actionParams); my $radio_params = {-type=>"radio", -name=>"action", -value=>$actionID}; @@ -808,7 +803,6 @@ ($file_type eq 'blank_problem') and do { $editFilePath = $ce->{webworkFiles}->{screenSnippets}->{blankProblem}; -## $self->addbadmessage("$editFilePath is blank problem template file and can not be edited directly. " $self->addbadmessage("'".$self->shortPath($editFilePath)."' is blank problem template file and can not be edited directly. " ."First use 'Save as' to make a local copy, then add the file to the current problem set, then edit the file." ); @@ -838,7 +832,6 @@ $editFilePath = $ce->{webworkFiles}->{screenSnippets}->{setHeader} if $file_type eq 'set_header'; $editFilePath = $ce->{webworkFiles}->{hardcopySnippets}->{setHeader} if $file_type eq 'hardcopy_header'; -## $self->addbadmessage("$editFilePath is the default header file and cannot be edited directly."); # $self->addbadmessage("'".$self->shortPath($editFilePath)."' is the default header file and cannot be edited directly.".CGI::br()."Any changes you make will have to be saved as another file."); #} @@ -883,14 +876,12 @@ # which is almost undoubtedly NOT desirable if (-d $editFilePath) { -## my $msg = "The file $editFilePath is a directory!"; my $msg = "The file '".$self->shortPath($editFilePath)."' is a directory!"; $self->{failure} = 1; $self->addbadmessage($msg); } if (-e $editFilePath and not -r $editFilePath) { #it's ok if the file doesn't exist, perhaps we're going to create it # with save as -## my $msg = "The file $editFilePath cannot be read!"; my $msg = "The file '".$self->shortPath($editFilePath)."' cannot be read!"; $self->{failure} = 1; $self->addbadmessage($msg); @@ -991,13 +982,10 @@ if ( not -w $ce->{courseDirs}->{templates} ) { $errorMessage = "Write permissions have not been enabled in the templates directory. No changes can be made."; } elsif ( not -w $currentDirectory ) { -## $errorMessage = "Write permissions have not been enabled in $currentDirectory. Changes must be saved to a different directory for viewing."; $errorMessage = "Write permissions have not been enabled in '".$self->shortPath($currentDirectory)."'. Changes must be saved to a different directory for viewing."; } elsif ( -e $outputFilePath and not -w $outputFilePath ) { -## $errorMessage = "Write permissions have not been enabled for $outputFilePath. Changes must be saved to another file for viewing."; $errorMessage = "Write permissions have not been enabled for '".$self->shortPath($outputFilePath)."'. Changes must be saved to another file for viewing."; } else { -## $errorMessage = "Unable to write to $outputFilePath: $writeFileErrors"; $errorMessage = "Unable to write to '".$self->shortPath($outputFilePath)."': $writeFileErrors"; } @@ -1067,14 +1055,11 @@ my $output_string = "View"; unless ($file_type eq 'course_info' || $file_type eq 'options_info') { $output_string .= join(" ", -## " problem using seed ", " using seed ", CGI::textfield(-name=>'action.view.seed',-value=>$self->{problemSeed},-onfocus=>$onChange), "and display mode ", CGI::popup_menu(-name=>'action.view.displayMode', -values=>$self->r->ce->{pg}->{displayModes}, - -default=>$self->{displayMode}, -onmousedown=>$onChange -## ), ".", - ) + -default=>$self->{displayMode}, -onmousedown=>$onChange) ); } @@ -1218,7 +1203,6 @@ }; return "" if $self->{file_type} eq 'course_info' || $self->{file_type} eq 'options_info'; return join(" ", -## "Add problem to set " , "Add to set " , CGI::popup_menu({name=>'action.add_problem.target_set', values=>\@allSetNames, default=>$setName, onmousedown=>$onChange}), " as ", @@ -1288,10 +1272,8 @@ my $setRecord = $self->r->db->getGlobalSet($targetSetName); $setRecord->set_header($sourceFilePath); if( $self->r->db->putGlobalSet($setRecord) ) { -## $self->addgoodmessage("Added $sourceFilePath to ". $targetSetName. " as new set header ") ; $self->addgoodmessage("Added '".$self->shortPath($sourceFilePath)."' to ". $targetSetName. " as new set header ") ; } else { -## $self->addbadmessage("Unable to make $sourceFilePath the set header for $targetSetName"); $self->addbadmessage("Unable to make '".$self->shortPath($sourceFilePath)."' the set header for $targetSetName"); } $self->{file_type} = 'set_header'; # change file type to set_header if it not already so @@ -1577,7 +1559,6 @@ if (defined $outputFilePath and -e $outputFilePath) { # setting $do_not_save stops saving and any redirects $do_not_save = 1; -## $self->addbadmessage(CGI::p("File $outputFilePath exists. File not saved.")); $self->addbadmessage(CGI::p("File '".$self->shortPath($outputFilePath)."' exists. File not saved. No changes have been made. You can change the file path for this problem manually from the 'Hmwk Sets Editor' page")); @@ -1590,8 +1571,6 @@ unless ($do_not_save ) { $self->saveFileChanges($outputFilePath); -## my $templatesPath = $self->r->ce->{courseDirs}->{templates}; -## $sourceFilePath =~ s|^$templatesPath/||; # make sure path relative to templates directory if ($saveMode eq 'rename' and -r $outputFilePath) { ################################################# @@ -1739,12 +1718,10 @@ # if (defined $outputFilePath and -e $outputFilePath) { # # setting $do_not_save stops saving and any redirects # $do_not_save = 1; -# ## $self->addbadmessage(CGI::p("File $outputFilePath exists. File not saved.")); # $self->addbadmessage(CGI::p("File '".$self->shortPath($outputFilePath)."' exists. # File not saved. No changes have been made. # You can change the file path for this problem manually from the 'Hmwk Sets Editor' page")); # } else { -# ## #$self->addgoodmessage("Saving to file $outputFilePath."); # #$self->addgoodmessage("Saving to file '".$self->shortPath($outputFilePath)."'."); # } # @@ -1765,7 +1742,6 @@ # my $problemRecord = $self->r->db->getGlobalProblem($setName,$problemNumber); # $problemRecord->source_file($new_file_name); # if ( $self->r->db->putGlobalProblem($problemRecord) ) { -# ## $self->addgoodmessage("The current source file for set $setName problem $problemNumber has been renamed to [TMPL]/$outputFilePath.") ; # $self->addgoodmessage("The current source file for problem $problemNumber has been renamed to '".$self->shortPath($outputFilePath)."'.") ; # } else { # $self->addbadmessage("Unable to change the source file path for set $setName, problem $problemNumber. Unknown error."); |