| 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/Instructor/PGProblemEditor.pm,v 1.48 2004/09/21 20:07:48 toenail Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v 1.49 2004/12/17 17:08:37 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. |
| … | |
… | |
| 321 | REDIRECT_CASES: { |
321 | REDIRECT_CASES: { |
| 322 | ($file_type eq 'problem' or $file_type eq 'source_path_for_problem_file' or $file_type eq 'blank_problem') and do { |
322 | ($file_type eq 'problem' or $file_type eq 'source_path_for_problem_file' or $file_type eq 'blank_problem') and do { |
| 323 | my $sourceFilePath = $self->{problemPath}; |
323 | my $sourceFilePath = $self->{problemPath}; |
| 324 | # strip off template directory prefix |
324 | # strip off template directory prefix |
| 325 | $sourceFilePath =~ s|^$ce->{courseDirs}->{templates}/||; |
325 | $sourceFilePath =~ s|^$ce->{courseDirs}->{templates}/||; |
| 326 | warn "setting sourceFilePath to $sourceFilePath"; |
|
|
| 327 | if ($action eq 'save_as') { # redirect to myself |
326 | if ($action eq 'save_as') { # redirect to myself |
| 328 | my $edit_level = $r->param("edit_level") || 0; |
327 | my $edit_level = $r->param("edit_level") || 0; |
| 329 | $edit_level++; |
328 | $edit_level++; |
| 330 | |
329 | |
| 331 | my $problemPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", |
330 | my $problemPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Instructor::PGProblemEditor", |
| … | |
… | |
| 535 | my $user = $r->param('user'); |
534 | my $user = $r->param('user'); |
| 536 | my $make_local_copy = $r->param('make_local_copy'); |
535 | my $make_local_copy = $r->param('make_local_copy'); |
| 537 | |
536 | |
| 538 | # Check permissions |
537 | # Check permissions |
| 539 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to access the Instructor tools.") |
538 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to access the Instructor tools.") |
| 540 | unless $authz->hasPermissions($r->param("user"), "access_instructor_tools"); |
539 | unless $authz->hasPermissions($user, "access_instructor_tools"); |
| 541 | |
540 | |
| 542 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to modify problems.") |
541 | return CGI::div({class=>"ResultsWithError"}, "You are not authorized to modify problems.") |
| 543 | unless $authz->hasPermissions($r->param("user"), "modify_student_data"); |
542 | unless $authz->hasPermissions($user, "modify_student_data"); |
| 544 | |
543 | |
| 545 | |
544 | |
| 546 | # Gathering info |
545 | # Gathering info |
| 547 | my $editFilePath = $self->{editFilePath}; # path to the permanent file to be edited |
546 | my $editFilePath = $self->{editFilePath}; # path to the permanent file to be edited |
| 548 | my $tempFilePath = $self->{tempFilePath}; # path to the file currently being worked with (might be a .tmp file) |
547 | my $tempFilePath = $self->{tempFilePath}; # path to the file currently being worked with (might be a .tmp file) |