--- loncom/interface/lonnavmaps.pm 2003/06/10 18:42:18 1.196 +++ loncom/interface/lonnavmaps.pm 2003/06/14 00:11:12 1.204 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.196 2003/06/10 18:42:18 bowersj2 Exp $ +# $Id: lonnavmaps.pm,v 1.204 2003/06/14 00:11:12 albertel 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 = @@ -249,17 +249,20 @@ sub real_handler { 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
"); @@ -272,6 +275,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 +382,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); @@ -835,8 +839,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 +848,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 @@ -919,7 +930,8 @@ sub render_resource { $nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; } - if (!$params->{'resource_nolink'}) { + if (!$params->{'resource_nolink'} && $src !~ /^\/uploaded\// && + !$resource->is_map()) { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; } else { $result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText"; @@ -966,6 +978,10 @@ sub render_communication_status { } } + if ($params->{'multipart'} && $part != '0') { + $discussionHTML = $feedbackHTML = $errorHTML = ''; + } + return "$discussionHTML$feedbackHTML$errorHTML "; } @@ -1289,7 +1305,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. @@ -1352,7 +1368,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; } @@ -1411,8 +1427,13 @@ sub render { @parts = ($parts[0]); $args->{'condensed'} = 1; } - } + # Multipart problem with one part: always "condense" (happens + # to match the desirable behavior) + if ($curRes->countParts() == 1) { + @parts = ($parts[0]); + $args->{'condensed'} = 1; + } } } @@ -1586,14 +1607,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;