--- loncom/interface/lonnavmaps.pm 2001/01/30 20:04:54 1.11 +++ loncom/interface/lonnavmaps.pm 2001/09/21 19:56:45 1.15 @@ -9,7 +9,7 @@ # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23, # 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer) # -# 3/1/1,6/1,17/1,29/1,30/1 Gerd Kortemeyer +# 3/1/1,6/1,17/1,29/1,30/1,2/8,9/21 Gerd Kortemeyer package Apache::lonnavmaps; @@ -153,11 +153,25 @@ sub astatus { $rid=~/(\d+)\.(\d+)/; my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. &Apache::lonnet::declutter($hash{'src_'.$rid}); + + my %duedate=(); + my %opendate=(); + my %answerdate=(); + map { + if ($_=~/^parameter\_(.*)\_opendate$/) { + my $part=$1; + $duedate{$part}=&parmval($part.'.duedate',$symb); + $opendate{$part}=&parmval($part.'.opendate',$symb); + $answerdate{$part}=&parmval($part.'.answerdate',$symb); + } + } sort split(/\,/,&Apache::lonnet::metadata($hash{'src_'.$rid},'keys')); + my $duedate=&parmval('0.duedate',$symb); my $opendate=&parmval('0.opendate',$symb); my $answerdate=&parmval('0.answerdate',$symb); my $now=time; my $tcode=0; + if ($opendate) { if ($now<$duedate) { $tcode=2; $ctext='Due: '.localtime($duedate); @@ -175,6 +189,9 @@ sub astatus { $ctext='Answer: '.localtime($duedate); } } + } else { + $tcode=1; + } my $answer=&Apache::lonnet::reply( "restore:$ENV{'user.domain'}:$ENV{'user.name'}:". $ENV{'request.course.id'}.':'. @@ -433,6 +450,10 @@ sub handler { # ------------------------------------------------------------------ Build page + my $currenturl=$ENV{'form.postdata'}; + $currenturl=~s/^http\:\/\///; + $currenturl=~s/^[^\/]+//; + # ---------------------------------------------------------------- Send headers $r->content_type('text/html'); @@ -440,13 +461,37 @@ sub handler { $r->print( 'Navigate LON-CAPA Maps'); - $r->print(''. - ''. + $r->print('print(' onLoad="window.location.hash='. + "'curloc'".'"'); + } + $r->print('>'. ''. '

Navigate Course Map

'); - $r->rflush(); + $r->rflush(); + if (($currenturl=~/^\/res/) && + ($currenturl!~/^\/res\/adm/)) { + $r->print('Current Location

'); + } +# ----------------------------------------------------- The little content list + for ($i=0;$i<=$#rows;$i++) { + if ($rows[$i]) { + my @colcont=split(/\&/,$rows[$i]); + my $avespan=$lcm/($#colcont+1); + for ($j=0;$j<=$#colcont;$j++) { + my $rid=$colcont[$j]; + if ($rid=~/^h(.+)/) { + $rid=$1; + $r->print( + '   '.$hash{'title_'.$rid}.'
'); + } + } + } + } # ----------------------------------------------------------------- Start table - $r->print(''); + $r->print('
'); for ($i=0;$i<=$#rows;$i++) { if ($rows[$i]) { $r->print("\n"); @@ -460,7 +505,8 @@ sub handler { my $hwke=''; if ($rid=~/^h(.+)/) { $rid=$1; - $add=''; } if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) { @@ -497,6 +543,12 @@ sub handler { $hwke=' ('.$ctext.')'; } } + if ($hash{'src_'.$rid} eq $currenturl) { + $add=$add.''. + '-> '; + $adde= + ' <-'.$adde; + } $r->print($add.''.$hwk. $hash{'title_'.$rid}.$hwke.''.$adde); @@ -505,7 +557,6 @@ sub handler { } } $r->print("\n
'; + $add= + ''; $adde='
"); - $r->print(''); # -------------------------------------------------------------------- End page }