--- loncom/interface/lonnavmaps.pm 2009/03/27 02:39:59 1.432 +++ loncom/interface/lonnavmaps.pm 2010/09/13 03:07:56 1.440.2.2 @@ -1,7 +1,8 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.432 2009/03/27 02:39:59 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.440.2.2 2010/09/13 03:07:56 raeburn Exp $ + # # Copyright Michigan State University Board of Trustees # @@ -31,7 +32,7 @@ =head1 NAME -Apache::lonnavmaps.pm +Apache::lonnavmaps - Subroutines to handle and render the navigation =head1 SYNOPSIS @@ -504,10 +505,13 @@ my %statusIconMap = $resObj->ERROR => '' ); -my %iconAltTags = - ( 'navmap.correct.gif' => 'Correct', - 'navmap.wrong.gif' => 'Incorrect', - 'navmap.open.gif' => 'Open' ); +my %iconAltTags = #texthash does not work here + ( 'navmap.correct.gif' => 'Correct', + 'navmap.wrong.gif' => 'Incorrect', + 'navmap.open.gif' => 'Open', + 'navmap.partial.gif' => 'Partially Correct', + 'navmap.ellipsis.gif' => 'Attempted', + ); # Defines a status->color mapping, null string means don't color my %colormap = @@ -597,7 +601,7 @@ sub getLinkForResource { my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); if ($map=~/\.page$/) { my $url=&Apache::lonnet::clutter($map); - $anchor=&escape($src->shown_symb()); + $anchor=&escape($res->shown_symb()); return ($url,$res->shown_symb(),$anchor); } } @@ -643,20 +647,20 @@ sub getDescription { if ($slot_status == $res->UNKNOWN) { return &mt('Reservation status unknown'); } elsif ($slot_status == $res->RESERVED) { - return &mt('Reserved - ends').' '. - timeToHumanString($slot_time,'end'); + return &mt('Reserved - ends [_1]', + timeToHumanString($slot_time,'end')); } elsif ($slot_status == $res->RESERVED_LOCATION) { - return &mt('Reserved - specific location(s) - ends').' '. - timeToHumanString($slot_time,'end'); + return &mt('Reserved - specific location(s) - ends [_1]', + timeToHumanString($slot_time,'end')); } elsif ($slot_status == $res->RESERVED_LATER) { - return &mt('Reserved - next open').' '. - timeToHumanString($slot_time,'start'); + return &mt('Reserved - next open [_1]', + timeToHumanString($slot_time,'start')); } elsif ($slot_status == $res->RESERVABLE) { - return &mt('Reservable ending').' '. - timeToHumanString($slot_time,'end'); + return &mt('Reservable ending [_1]', + timeToHumanString($slot_time,'end')); } elsif ($slot_status == $res->RESERVABLE_LATER) { - return &mt('Reservable starting').' '. - timeToHumanString($slot_time,'start'); + return &mt('Reservable starting [_1]', + timeToHumanString($slot_time,'start')); } elsif ($slot_status == $res->NOT_IN_A_SLOT) { return &mt('Reserve a time/place to work'); } elsif ($slot_status == $res->NOTRESERVABLE) { @@ -695,7 +699,11 @@ sub getDescription { return &mt("Excused by instructor"); } if ($status == $res->ATTEMPTED) { - return &mt("Answer submitted, not yet graded"); + if ($res->src() eq '/res/gci/gci/internal/submission.problem') { + return &mt('Question(s) submitted for review'); + } else { + return &mt("Answer submitted, not yet graded"); + } } if ($status == $res->TRIES_LEFT) { my $tries = $res->tries($part); @@ -715,7 +723,11 @@ sub getDescription { } } if ($status == $res->ANSWER_SUBMITTED) { - return &mt('Answer submitted'); + if ($res->src() eq '/res/gci/gci/internal/submission.problem') { + return &mt('Question(s) submitted for review'); + } else { + return &mt('Answer submitted'); + } } } @@ -880,11 +892,6 @@ sub render_resource { my $link = $params->{"resourceLink"}; # The URL part is not escaped at this point, but the symb is... - # The stuff to the left of the ? must have ' replaced by \' since - # it will be quoted with ' in the href. - - my ($left,$right) = split(/\?/, $link); - $link = $left.'?'.$right; my $src = $resource->src(); my $it = $params->{"iterator"}; @@ -1095,7 +1102,7 @@ sub render_quick_status { if ($icon) { my $location= &Apache::loncommon::lonhttpdurl("/adm/lonIcons/$icon"); - $result .= "$linkopen$alt$linkclose"; + $result .= $linkopen.''.&mt($alt).''.$linkclose; } else { $result .= " "; } @@ -1419,15 +1426,15 @@ sub render { my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); if ($navmap->{LAST_CHECK}) { $result .= - ' '.&mt('New discussion since').' '. + ' '.&mt('New discussion since').' '. strftime("%A, %b %e at %I:%M %P", localtime($navmap->{LAST_CHECK})). '  '. - ' '.&mt('New message (click to open)').'

'. + ' '.&mt('New message (click to open)').'

'. ''; } else { $result .= '  '. - ' '.&mt('Discussions').''. - '   '.&mt('New message (click to open)'). + ' '.&mt('Discussions').''. + '   '.&mt('New message (click to open)'). ''; } @@ -1529,7 +1536,6 @@ END ( $res->NETWORK_FAILURE => 1, $res->NOTHING_SET => 1, $res->CORRECT => 1 ); - my @backgroundColors = ("LC_trEven", "LC_trOdd"); # Shared variables $args->{'counter'} = 0; # counts the rows @@ -1764,7 +1770,6 @@ END # show them. foreach my $part (@parts) { $rownum ++; - my $backgroundColor = $backgroundColors[$rownum % scalar(@backgroundColors)]; $result .= &Apache::loncommon::start_data_table_row(); @@ -2380,7 +2385,7 @@ resource object. Based on the symb of the resource, get a resource object for that resource. This is one of the proper ways to get a resource object. -=item * B(map_pc): +=item * B(map_pc): Based on the map_pc of the resource, get a resource object for the given map. This is one of the proper ways to get a resource object. @@ -3874,6 +3879,12 @@ resource of the map. Returns a string with the type of the map in it. +=item *B: + +Returns a string with a comma-separated ordered list of map_pc IDs +for the hierarchy of maps containing a map, with the top level +map first, then descending to deeper levels, with the enclosing map last. + =back =cut @@ -3904,6 +3915,11 @@ sub map_type { my $pc = $self->map_pc(); return $self->navHash("map_type_$pc", 0); } +sub map_hierarchy { + my $self = shift; + my $pc = $self->map_pc(); + return $self->navHash("map_hierarchy_$pc", 0); +} ##### # Property queries