--- loncom/interface/lonnavmaps.pm 2003/08/19 15:29:33 1.222
+++ loncom/interface/lonnavmaps.pm 2003/09/08 19:53:09 1.224
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.222 2003/08/19 15:29:33 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.224 2003/09/08 19:53:09 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,19 +61,14 @@ my $resObj = "Apache::lonnavmaps::resour
# Keep these mappings in sync with lonquickgrades, which uses the colors
# instead of the icons.
my %statusIconMap =
- ( $resObj->NETWORK_FAILURE => '',
- $resObj->NOTHING_SET => '',
- $resObj->CORRECT => 'navmap.correct.gif',
- $resObj->EXCUSED => 'navmap.correct.gif',
- $resObj->PAST_DUE_NO_ANSWER => 'navmap.wrong.gif',
- $resObj->PAST_DUE_ANSWER_LATER => 'navmap.wrong.gif',
- $resObj->ANSWER_OPEN => 'navmap.wrong.gif',
- $resObj->OPEN_LATER => '',
- $resObj->TRIES_LEFT => 'navmap.open.gif',
- $resObj->INCORRECT => 'navmap.wrong.gif',
- $resObj->OPEN => 'navmap.open.gif',
- $resObj->ATTEMPTED => 'navmap.ellipsis.gif',
- $resObj->ANSWER_SUBMITTED => 'navmap.ellipsis.gif' );
+ (
+ $resObj->CLOSED => '',
+ $resObj->OPEN => 'navmap.open.gif',
+ $resObj->CORRECT => 'navmap.correct.gif',
+ $resObj->INCORRECT => 'navmap.wrong.gif',
+ $resObj->ATTEMPTED => 'navmap.ellipsis.gif',
+ $resObj->ERROR => ''
+ );
my %iconAltTags =
( 'navmap.correct.gif' => 'Correct',
@@ -1036,7 +1031,8 @@ sub render_quick_status {
if ($resource->is_problem() &&
!$firstDisplayed) {
- my $icon = $statusIconMap{$resource->status($part)};
+
+ my $icon = $statusIconMap{$resource->simpleStatus($part)};
my $alt = $iconAltTags{$icon};
if ($icon) {
$result .= "
$linkopen $linkclose | \n";
@@ -3030,9 +3026,9 @@ sub symb {
my $self=shift;
(my $first, my $second) = $self->{ID} =~ /(\d+).(\d+)/;
my $symbSrc = &Apache::lonnet::declutter($self->src());
- return &Apache::lonnet::declutter(
- $self->navHash('map_id_'.$first))
+ my $symb = &Apache::lonnet::declutter($self->navHash('map_id_'.$first))
. '___' . $second . '___' . $symbSrc;
+ return &Apache::lonnet::symbclean($symb);
}
sub title {
my $self=shift;
@@ -3927,6 +3923,64 @@ sub status {
return OPEN;
}
+sub CLOSED { return 23; }
+sub ERROR { return 24; }
+
+=pod
+
+B
+
+Convenience method B provides a "simple status" for the resource.
+"Simple status" corresponds to "which icon is shown on the
+Navmaps". There are six "simple" statuses:
+
+=over 4
+
+=item * B: The problem is currently closed. (No icon shown.)
+
+=item * B: The problem is open and unattempted.
+
+=item * B: The problem is correct for any reason.
+
+=item * B: The problem is incorrect and can still be
+completed successfully.
+
+=item * B: The problem has been attempted, but the student
+does not know if they are correct. (The ellipsis icon.)
+
+=item * B: There is an error retrieving information about this
+problem.
+
+=back
+
+=cut
+
+# This hash maps the composite status to this simple status, and
+# can be used directly, if you like
+my %compositeToSimple =
+ (
+ NETWORK_FAILURE() => ERROR,
+ NOTHING_SET() => CLOSED,
+ CORRECT() => CORRECT,
+ EXCUSED() => CORRECT,
+ PAST_DUE_NO_ANSWER() => INCORRECT,
+ PAST_DUE_ANSWER_LATER() => INCORRECT,
+ ANSWER_OPEN() => INCORRECT,
+ OPEN_LATER() => CLOSED,
+ TRIES_LEFT() => OPEN,
+ INCORRECT() => INCORRECT,
+ OPEN() => OPEN,
+ ATTEMPTED() => ATTEMPTED,
+ ANSWER_SUBMITTED() => ATTEMPTED
+ );
+
+sub simpleStatus {
+ my $self = shift;
+ my $part = shift;
+ my $status = $self->status($part);
+ return $compositeToSimple{$status};
+}
+
=pod
B