Log Message:
-----------
Make the Prob. List. button inactive when used on an Undefined_Set
(i.e., in the Library Browser). This prevents an error page when an
instructor clicks on the button rather than going back to the Library
Browser page.
Modified Files:
--------------
webwork2/lib/WeBWorK/ContentGenerator:
Problem.pm
Added Files:
-----------
webwork2/htdocs/images:
navProbListGrey.gif
Revision Data
-------------
Index: Problem.pm
===================================================================
RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v
retrieving revision 1.215
retrieving revision 1.216
diff -Llib/WeBWorK/ContentGenerator/Problem.pm -Llib/WeBWorK/ContentGenerator/Problem.pm -u -r1.215 -r1.216
--- lib/WeBWorK/ContentGenerator/Problem.pm
+++ lib/WeBWorK/ContentGenerator/Problem.pm
@@ -698,12 +698,12 @@
})}, "Problem $problemID")
);
}
-
+
print CGI::end_ul();
#print CGI::end_li();
#print CGI::end_ul();
print CGI::end_div();
-
+
return "";
}
@@ -712,17 +712,17 @@
my $r = $self->r;
my $db = $r->db;
my $urlpath = $r->urlpath;
-
+
return "" if ( $self->{invalidSet} );
my $courseID = $urlpath->arg("courseID");
my $setID = $self->{set}->set_id if !($self->{invalidSet});
my $problemID = $self->{problem}->problem_id if !($self->{invalidProblem});
my $eUserID = $r->param("effectiveUser");
-
+
my ($prevID, $nextID);
- if (!$self->{invalidProblem}) {
+ if (!$self->{invalidProblem}) {
my @problemIDs = $db->listUserProblems($eUserID, $setID);
foreach my $id (@problemIDs) {
$prevID = $id if $id < $problemID
@@ -731,9 +731,9 @@
and (not defined $nextID or $id < $nextID);
}
}
-
+
my @links;
-
+
if ($prevID) {
my $prevPage = $urlpath->newFromModule(__PACKAGE__,
courseID => $courseID, setID => $setID, problemID => $prevID);
@@ -741,9 +741,13 @@
} else {
push @links, "Previous Problem", "", "navPrevGrey";
}
-
- push @links, "Problem List", $r->location . $urlpath->parent->path, "navProbList";
-
+
+ if (defined($setID) && $setID ne 'Undefined_Set') {
+ push @links, "Problem List", $r->location . $urlpath->parent->path, "navProbList";
+ } else {
+ push @links, "Problem List", "", "navProbListGrey";
+ }
+
if ($nextID) {
my $nextPage = $urlpath->newFromModule(__PACKAGE__,
courseID => $courseID, setID => $setID, problemID => $nextID);
@@ -751,9 +755,9 @@
} else {
push @links, "Next Problem", "", "navNextGrey";
}
-
+
my $tail = "";
-
+
$tail .= "&displayMode=".$self->{displayMode} if defined $self->{displayMode};
$tail .= "&showOldAnswers=".$self->{will}->{showOldAnswers}
if defined $self->{will}->{showOldAnswers};
@@ -766,7 +770,7 @@
# using the url arguments won't break if the set/problem are invalid
my $setID = WeBWorK::ContentGenerator::underscore2nbsp($self->r->urlpath->arg("setID"));
my $problemID = $self->r->urlpath->arg("problemID");
-
+
return "$setID: Problem $problemID";
}
|