--- loncom/interface/lonnavmaps.pm 2003/06/10 20:07:58 1.198
+++ loncom/interface/lonnavmaps.pm 2003/06/17 21:04:00 1.206
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.198 2003/06/10 20:07:58 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.206 2003/06/17 21:04:00 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,7 +72,7 @@ my %statusIconMap =
$resObj->TRIES_LEFT => 'navmap.open.gif',
$resObj->INCORRECT => 'navmap.wrong.gif',
$resObj->OPEN => 'navmap.open.gif',
- $resObj->ATTEMPTED => 'navmap.open.gif',
+ $resObj->ATTEMPTED => 'navmap.ellipsis.gif',
$resObj->ANSWER_SUBMITTED => '' );
my %iconAltTags =
@@ -161,7 +161,6 @@ sub real_handler {
# Now that we've displayed some stuff to the user, init the navmap
$navmap->init();
- $r->print('
');
$r->rflush();
# Check that it's defined
@@ -244,25 +243,28 @@ sub real_handler {
}
} else {
$r->print("" .
- "Go To My First Homework Problem
");
+ "Go To My First Homework Problem ");
}
my $suppressEmptySequences = 0;
my $filterFunc = undef;
+ my $resource_no_folder_link = 0;
+
# Display only due homework.
my $showOnlyHomework = 0;
if ($ENV{QUERY_STRING} eq 'showOnlyHomework') {
$showOnlyHomework = 1;
$suppressEmptySequences = 1;
$filterFunc = sub { my $res = shift;
- return $res->completable() || $res->is_sequence();
+ return $res->completable() || $res->is_map();
};
$r->print("
Uncompleted Homework
");
$ENV{'form.filter'} = '';
$ENV{'form.condition'} = 1;
+ $resource_no_folder_link = 1;
} else {
$r->print("" .
- "Show Only Uncompleted Homework
");
+ "Show Only Uncompleted Homework ");
}
# renderer call
@@ -272,6 +274,7 @@ sub real_handler {
'suppressNavmap' => 1,
'suppressEmptySequences' => $suppressEmptySequences,
'filterFunc' => $filterFunc,
+ 'resource_no_folder_link' => $resource_no_folder_link,
'r' => $r};
my $render = render($renderArgs);
$navmap->untieHashes();
@@ -378,7 +381,7 @@ sub getDescription {
return "Excused by instructor";
}
if ($status == $res->ATTEMPTED) {
- return "Not yet graded.";
+ return "Answer submitted, not yet graded.";
}
if ($status == $res->TRIES_LEFT) {
my $tries = $res->tries($part);
@@ -552,9 +555,9 @@ Apache::lonnavmap - Subroutines to handl
The main handler generates the navigational listing for the course,
the other objects export this information in a usable fashion for
-other modules
+other modules.
-=head1 Object: render
+=head1 Subroutine: render
The navmap renderer package provides a sophisticated rendering of the
standard navigation maps interface into HTML. The provided nav map
@@ -568,7 +571,7 @@ understand then "undef, undef, undef, 1,
undef, 0" when you mostly want default behaviors.
The package provides a function called 'render', called as
-Apache::lonnavmaps::renderer->render({}).
+Apache::lonnavmaps::render({}).
=head2 Overview of Columns
@@ -576,7 +579,7 @@ The renderer will build an HTML table fo
it. The table is consists of several columns, and a row for each
resource (or possibly each part). You tell the renderer how many
columns to create and what to place in each column, optionally using
-one or more of the preparent columns, and the renderer will assemble
+one or more of the prepared columns, and the renderer will assemble
the table.
Any additional generally useful column types should be placed in the
@@ -594,7 +597,7 @@ argument hash passed to the renderer, an
be inserted into the HTML representation as it.
The pre-packaged column names are refered to by constants in the
-Apache::lonnavmaps::renderer namespace. The following currently exist:
+Apache::lonnavmaps namespace. The following currently exist:
=over 4
@@ -602,7 +605,7 @@ Apache::lonnavmaps::renderer namespace.
The general info about the resource: Link, icon for the type, etc. The
first column in the standard nav map display. This column also accepts
-the following parameter in the renderer hash:
+the following parameters in the renderer hash:
=over 4
@@ -835,8 +838,8 @@ sub render_resource {
my $linkopen = "";
my $linkclose = "";
- # Default icon: HTML page
- my $icon = "";
+ # Default icon: unknown page
+ my $icon = "";
if ($resource->is_problem()) {
if ($part eq '0' || $params->{'condensed'}) {
@@ -844,6 +847,13 @@ sub render_resource {
} else {
$icon = $params->{'indentString'};
}
+ } else {
+ my $curfext= (split (/\./,$resource->src))[-1];
+ my $embstyle = &Apache::loncommon::fileembstyle($curfext);
+ # The unless conditional that follows is a bit of overkill
+ if (!(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn')) {
+ $icon = "";
+ }
}
# Display the correct map icon to open or shut map
@@ -854,8 +864,10 @@ sub render_resource {
$nowOpen = !$nowOpen;
}
+ my $folderType = $resource->is_sequence() ? 'folder' : 'page';
+
if (!$params->{'resource_no_folder_link'}) {
- $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') . '.gif';
+ $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif';
$icon = "";
$linkopen = "";
} else {
# Don't allow users to manipulate folder
- $icon = 'navmap.folder.' . ($nowOpen ? 'closed' : 'open') .
+ $icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') .
'.nomanip.gif';
$icon = "";
@@ -919,7 +931,8 @@ sub render_resource {
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)';
}
- if (!$params->{'resource_nolink'}) {
+ if (!$params->{'resource_nolink'} && $src !~ /^\/uploaded\// &&
+ !$resource->is_sequence()) {
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText";
} else {
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText";
@@ -1293,7 +1306,7 @@ sub render {
if (ref($curRes)) {
# Parallel pre-processing: Do sequences have non-filtered-out children?
- if ($curRes->is_sequence()) {
+ if ($curRes->is_map()) {
$curRes->{DATA}->{HAS_VISIBLE_CHILDREN} = 0;
# Sequences themselves do not count as visible children,
# unless those sequences also have visible children.
@@ -1356,7 +1369,7 @@ sub render {
}
# If this is an empty sequence and we're filtering them, continue on
- if ($curRes->is_sequence() && $args->{'suppressEmptySequences'} &&
+ if ($curRes->is_map() && $args->{'suppressEmptySequences'} &&
!$curRes->{DATA}->{HAS_VISIBLE_CHILDREN}) {
next;
}
@@ -1595,14 +1608,7 @@ sub new {
return undef;
}
- # try copying into memory
- my %tmpnavhash;
- while (my ($k, $v) = each(%navmaphash)) {
- $tmpnavhash{$k} = $v;
- }
- untie %navmaphash;
-
- $self->{NAV_HASH} = \%tmpnavhash;
+ $self->{NAV_HASH} = \%navmaphash;
$self->{PARM_HASH} = \%parmhash;
$self->{INITED} = 0;
@@ -2135,7 +2141,7 @@ corresponds to where you want the iterat
navmap->finishResource(). filterHash is a hash used as a set
containing strings representing the resource IDs, defaulting to
empty. Condition is a 1 or 0 that sets what to do with the filter
-hash: If a 0, then only resource that exist IN the filterHash will be
+hash: If a 0, then only resources that exist IN the filterHash will be
recursed on. If it is a 1, only resources NOT in the filterHash will
be recursed on. Defaults to 0. forceTop is a boolean value. If it is
false (default), the iterator will only return the first level of map
@@ -2945,7 +2951,8 @@ sub is_map { my $self=shift; return defi
sub is_page {
my $self=shift;
my $src = $self->src();
- return ($src =~ /page$/);
+ return $self->navHash("is_map_", 1) &&
+ $self->navHash("map_type_" . $self->map_pc()) eq 'page';
}
sub is_problem {
my $self=shift;
@@ -2955,7 +2962,8 @@ sub is_problem {
sub is_sequence {
my $self=shift;
my $src = $self->src();
- return ($src =~ /sequence$/);
+ return $self->navHash("is_map_", 1) &&
+ $self->navHash("map_type_" . $self->map_pc()) eq 'sequence';
}
# Private method: Shells out to the parmval in the nav map, handler parts.
@@ -3030,8 +3038,6 @@ sub map_type {
return $self->navHash("map_type_$pc", 0);
}
-
-
#####
# Property queries
#####