Log Message:
-----------
Fixed error in PGProblemEditor.pm that prevented you from adding new problem in
a set. Added comment to ProblemSetDetail.pm
Modified Files:
--------------
webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor:
PGProblemEditor.pm
ProblemSetDetail.pm
Revision Data
-------------
Index: ProblemSetDetail.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -Llib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm -u -r1.17 -r1.18
--- lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
+++ lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
@@ -1199,8 +1199,6 @@
]));
}
- my $editNewProblemPage = $urlpath->new(type => 'instructor_problem_editor_withset_withproblem', args => { courseID => $courseID, setID => $setID, problemID =>'new_problem' });
- my $editNewProblemLink = $self->systemLink($editNewProblemPage, params => { make_local_copy => 1, file_type => 'blank_problem' });
# print final lines
print CGI::end_table();
@@ -1211,7 +1209,6 @@
CGI::br();
print CGI::input({type=>"submit", name=>"submit_changes", value=>"Save Changes"});
print CGI::input({type=>"submit", name=>"handle_numbers", value=>"Reorder problems only"}) . "(Any unsaved changes will be lost.)";
- print CGI::p( CGI::a({href=>$editNewProblemLink},'Create'). 'a new blank problem');
print CGI::p(<<HERE);
Any time problem numbers are intentionally changed, the problems will
always be renumbered consecutively, starting from one. When deleting
@@ -1225,6 +1222,11 @@
} else {
print CGI::p(CGI::b("This set doesn't contain any problems yet."));
}
+ # always allow one to add a new problem.
+ my $editNewProblemPage = $urlpath->new(type => 'instructor_problem_editor_withset_withproblem', args => { courseID => $courseID, setID => $setID, problemID =>'new_problem' });
+ my $editNewProblemLink = $self->systemLink($editNewProblemPage, params => { make_local_copy => 1, file_type => 'blank_problem' });
+
+ print CGI::p( CGI::a({href=>$editNewProblemLink},'Create'). 'a new blank problem');
print CGI::end_form();
Index: PGProblemEditor.pm
===================================================================
RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -Llib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm -u -r1.52 -r1.53
--- lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm
+++ lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm
@@ -31,6 +31,7 @@
use Apache::Constants qw(:common REDIRECT);
use HTML::Entities;
use URI::Escape;
+use WeBWorK::Utils;
use WeBWorK::Utils::Tasks qw(fake_set fake_problem);
###########################################################
@@ -42,6 +43,7 @@
# The course information and problems are located in the course templates directory.
# Course information has the name defined by courseFiles->{course_info}
#
+# Only files under the template directory ( or linked to this location) can be edited.
#
# editMode = temporaryFile (view the temp file defined by course_info.txt.user_name.tmp
# instead of the file course_info.txt)
@@ -345,7 +347,8 @@
my $targetSetName = $r->param('target_set');
my $problemPage = $urlpath->newFromModule("WeBWorK::ContentGenerator::Problem",
- courseID => $courseName, setID => $targetSetName, problemID => scalar($r->db->listGlobalProblems($targetSetName))
+ courseID => $courseName, setID => $targetSetName,
+ problemID => WeBWorK::Utils::max( $r->db->listGlobalProblems($targetSetName))
);
$viewURL = $self->systemLink($problemPage,
params => {
@@ -951,7 +954,7 @@
($action eq 'add_problem_to_set') and do {
my $sourceFile = $editFilePath;
my $targetSetName = $r->param('target_set');
- my $freeProblemID = WeBWorK::Utils::max($db->listGlobalProblems($setName)) + 1;
+ my $freeProblemID = WeBWorK::Utils::max($db->listGlobalProblems($targetSetName)) + 1;
$sourceFile =~ s|^$ce->{courseDirs}->{templates}/||;
my $problemRecord = $self->addProblemToSet(
setName => $targetSetName,
|