--- loncom/interface/lonnavmaps.pm 2001/01/30 19:31:32 1.10 +++ loncom/interface/lonnavmaps.pm 2001/02/08 21:47:44 1.14 @@ -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 Gerd Kortemeyer package Apache::lonnavmaps; @@ -154,9 +154,31 @@ sub astatus { my $symb=&Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'. &Apache::lonnet::declutter($hash{'src_'.$rid}); my $duedate=&parmval('0.duedate',$symb); - if ($duedate) { - $ctext.='Due: '.localtime($duedate); + 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); + if ($now<$opendate) { + $tcode=1; + $ctext='Open: '.localtime($opendate); + } + if ($duedate-$now<86400) { + $tcode=4; + $ctext='Due: '.localtime($duedate); + } + } else { + $tcode=3; + if ($now<$answerdate) { + $ctext='Answer: '.localtime($duedate); + } } + } else { + $tcode=1; + } my $answer=&Apache::lonnet::reply( "restore:$ENV{'user.domain'}:$ENV{'user.name'}:". $ENV{'request.course.id'}.':'. @@ -191,7 +213,8 @@ sub astatus { } elsif ($returnhash{$_} eq 'incorrect_attempted') { $code=2; $ctext.= - $returnhash{'resource.'.$part.'.tries'}.' attempt(s)'; + $returnhash{'resource.'.$part.'.tries'}.'/'. + &parmval($part.'.maxtries',$symb).' tries'; } elsif ($returnhash{$_} eq 'incorrect_by_override') { $code=2; $ctext.='override'; @@ -202,7 +225,7 @@ sub astatus { } } keys %returnhash; } - return 'p'.$code.'"'.$ctext.'"'; + return 'p'.$code.$tcode.'"'.$ctext.'"'; } # ------------------------------------------------------------ Build page table @@ -414,6 +437,10 @@ sub handler { # ------------------------------------------------------------------ Build page + my $currenturl=$ENV{'form.postdata'}; + $currenturl=~s/^http\:\/\///; + $currenturl=~s/^[^\/]+//; + # ---------------------------------------------------------------- Send headers $r->content_type('text/html'); @@ -421,13 +448,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"); @@ -441,13 +492,30 @@ sub handler { my $hwke=''; if ($rid=~/^h(.+)/) { $rid=$1; - $add=''; } - if ($rid=~/^p(\d)\"([\w\: \(\)\,]*)\"(.+)/) { + if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) { my $code=$1; - my $ctext=$2; - $rid=$3; + my $tcode=$2; + my $ctext=$3; + $rid=$4; + if ($tcode eq '1') { + $add=''; + } + } $hwk=''; $hwke=''; if ($code eq '1') { @@ -462,6 +530,12 @@ sub handler { $hwke=' ('.$ctext.')'; } } + if ($hash{'src_'.$rid} eq $currenturl) { + $add=$add.''. + '-> '; + $adde= + ' <-'.$adde; + } $r->print($add.''.$hwk. $hash{'title_'.$rid}.$hwke.''.$adde); @@ -470,7 +544,6 @@ sub handler { } } $r->print("\n
'; + $add= + ''; $adde=''; + } + if ($code eq '3') { + $add=''; + } else { + $add=''; + if ($tcode eq '2') { + $add=''; + } + if ($tcode eq '4') { + $add=''; + $adde='
"); - $r->print(''); # -------------------------------------------------------------------- End page }