From: Mike G. v. a. <act...@de...> - 2004-12-17 17:17:13
|
Log Message: ----------- Added code to display {status_message} when call is redirected from PGProblemEditor.pm If course_info.txt does not exist as a file create it (using `echo "">course_info.txt`) Hope that's not too dangerous, but I didn't feel like opening the file :-) This keeps unnecessary warnings from occuring later when a user would be warned that the course_info.txt file didn't exist. Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator: ProblemSets.pm Revision Data ------------- Index: ProblemSets.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/ProblemSets.pm,v retrieving revision 1.57 retrieving revision 1.58 diff -Llib/WeBWorK/ContentGenerator/ProblemSets.pm -Llib/WeBWorK/ContentGenerator/ProblemSets.pm -u -r1.57 -r1.58 --- lib/WeBWorK/ContentGenerator/ProblemSets.pm +++ lib/WeBWorK/ContentGenerator/ProblemSets.pm @@ -61,8 +61,12 @@ } else { print CGI::p(CGI::b("Course Info")); } - - if (-f $course_info_path) { + unless (-e $course_info_path) { # FIXME + `echo "" >$course_info_path`; # we seem to need to have this file + # around to prevent + # spurious errors when editing it. + } + if (-f $course_info_path) { #check that it's a plain file my $text = eval { readFile($course_info_path) }; if ($@) { print CGI::div({class=>"ResultsWithError"}, @@ -83,6 +87,26 @@ $name = lc('course home') unless defined($name); $name =~ s/\s/_/g; $self->helpMacro($name); +} +sub initialize { + + + +# get result and send to message + my ($self) = @_; + my $r = $self->r; + my $authz = $r->authz; + my $urlpath = $r->urlpath; + + my $user = $r->param("user"); + my $effectiveUser = $r->param("effectiveUser"); + if ($authz->hasPermissions($user, "access_instructor_tools")) { + # get result and send to message + my $status_message = $r->param("status_message"); + $self->addmessage(CGI::p("$status_message")) if $status_message; + + + } } sub body { my ($self) = @_; |