--- loncom/interface/lonnavmaps.pm 2005/09/29 17:14:14 1.341 +++ loncom/interface/lonnavmaps.pm 2005/11/08 12:01:42 1.346 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.341 2005/09/29 17:14:14 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.346 2005/11/08 12:01:42 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -603,7 +603,8 @@ sub advancedUser { # Very, very, very, VERY English-only... goodness help a localizer on # this func... sub timeToHumanString { - my ($time,$type) = @_; + my ($time,$type,$format) = @_; + # zero, '0' and blank are bad times if (!$time) { return &mt('never'); @@ -674,8 +675,16 @@ sub timeToHumanString { return "$prefix$hourString$minuteString$tense"; } + # If there's a caller supplied format, use it. + + if($format ne '') { + my $timeStr = strftime($format, localtime($time)); + return $timeStr; + } + # Less then 5 days away, display day of the week and # HH:MM + if ( $delta < $day * 5 ) { my $timeStr = strftime("%A, %b %e at %I:%M %P", localtime($time)); $timeStr =~ s/12:00 am/00:00/; @@ -690,7 +699,6 @@ sub timeToHumanString { } elsif ($type eq 'end') { $conjunction='by'; } - &Apache::lonnet::logthis("

$conjunction $type

"); # Is it this year? if ( $time[5] == $now[5]) { # Return on Month Day, HH:MM meridian @@ -1134,6 +1142,9 @@ sub render_resource { if ($resource->randomout()) { $nonLinkedText .= ' (hidden) '; } + if (!$resource->condval()) { + $nonLinkedText .= ' (conditionally hidden) '; + } # We're done preparing and finally ready to start the rendering my $result = ""; @@ -1156,7 +1167,7 @@ sub render_resource { # Is this the current resource? if (!$params->{'displayedHereMarker'} && $resource->symb() eq $params->{'here'} ) { - $curMarkerBegin = '> '; + $curMarkerBegin = '>'; $curMarkerEnd = '<'; $params->{'displayedHereMarker'} = 1; } @@ -1845,10 +1856,6 @@ END $args->{'multipart'} = $curRes->multipart(); if ($condenseParts) { # do the condensation - if (!$curRes->opendate("0")) { - @parts = (); - $args->{'condensed'} = 1; - } if (!$args->{'condensed'}) { # Decide whether to condense based on similarity my $status = $curRes->status($parts[0]); @@ -3582,7 +3589,19 @@ sub condition { my $condition=&Apache::lonnet::directcondval($condid); return $condition; } - +sub condval { + my $self=shift; + my $uri=&Apache::lonnet::deversion(&Apache::lonnet::declutter($self->src())); + my ($pathname,$filename)=($uri=~m|(.*)/([^/]*)|); + $pathname=~s/^adm\/wrapper\///; + + my $match=($env{'acc.res.'.$env{'request.course.id'}.'.'.$pathname}=~ + /\&\Q$filename\E\:([\d\|]+)\&/); + if ($match) { + return &Apache::lonnet::condval($1); + } + return 0; +} sub compTitle { my $self = shift; my $title = $self->title(); @@ -4568,6 +4587,13 @@ sub status { return CORRECT; } + # If it's WRONG... and not open + if ( ($completionStatus == INCORRECT || + $completionStatus == INCORRECT_BY_OVERRIDE) + && (!$self->opendate($part) || $self->opendate($part) > time()) ) { + return INCORRECT; + } + if ($completionStatus == ATTEMPTED) { return ATTEMPTED; } @@ -4773,7 +4799,7 @@ sub getNext { my $to = $self->to(); foreach my $branch ( split(/,/, $to) ) { my $choice = $self->{NAV_MAP}->getById($branch); - if (!$choice->condition()) { next; } + #if (!$choice->condition()) { next; } my $next = $choice->goesto(); $next = $self->{NAV_MAP}->getById($next);