--- loncom/interface/lonnavmaps.pm 2002/03/16 08:56:53 1.32 +++ loncom/interface/lonnavmaps.pm 2002/08/21 17:18:08 1.43 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.32 2002/03/16 08:56:53 albertel Exp $ +# $Id: lonnavmaps.pm,v 1.43 2002/08/21 17:18:08 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -338,7 +338,6 @@ sub followlinks () { sub tracetable { my ($sofar,$rid,$beenhere,$showtypes,$indent,$linkid)=@_; my $newshowtypes=$showtypes; - my $newlinkid=$linkid; my $further=$sofar; #$Apache::lonxml::debug=1; &Apache::lonxml::debug("$rid ; $linkid ; $sofar ; $beenhere ; ".$hash{'src_'.$rid}); @@ -355,9 +354,11 @@ sub tracetable { eq 'page') { $tprefix='j'; if ($indent) { $tprefix='i'.$indent.','.$tprefix; } + if ($linkid) { $tprefix='l'.$linkid.','.$tprefix; } $newshowtypes='problems'; $indent++; - $newlinkid=$rid; + #if in a .page continue to link the encompising .page + if (!$linkid) { $linkid=$rid; } } if (defined($rows[$sofar])) { $rows[$sofar].='&'.$tprefix.$rid; @@ -368,10 +369,10 @@ sub tracetable { (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) { my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}}; $sofar=&tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}}, - '&'.$frid.'&',$newshowtypes,$indent,$newlinkid); + '&'.$frid.'&',$newshowtypes,$indent,$linkid); &addresource($hash{'src_'.$frid},\$sofar,$frid,$newshowtypes, - $indent,$newlinkid); - if ($tprefix =~ /j$/) { $indent--; } + $indent,$linkid); + if ($tprefix =~ /j$/) { $indent--; $linkid=''; } } } else { &addresource($hash{'src_'.$rid},\$sofar,$rid,$showtypes, @@ -410,10 +411,10 @@ sub handler { if ($ENV{'request.course.fn'}) { $fn=$ENV{'request.course.fn'}; if (-e "$fn.db") { - if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER,0640)) && + if ((tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) && (tie(%parmhash,'GDBM_File', $ENV{'request.course.fn'}.'_parms.db', - &GDBM_READER,0640))) { + &GDBM_READER(),0640))) { $hashtied=1; } } @@ -433,8 +434,10 @@ sub handler { &Apache::loncommon::no_cache($r); $r->send_http_header; - my $firstres=$hash{'map_start_/res/'.$ENV{'request.course.uri'}}; - my $lastres=$hash{'map_finish_/res/'.$ENV{'request.course.uri'}}; + my $firstres=$hash{'map_start_'. + &Apache::lonnet::clutter($ENV{'request.course.uri'})}; + my $lastres=$hash{'map_finish_'. + &Apache::lonnet::clutter($ENV{'request.course.uri'})}; if (!(($firstres) && ($lastres))) { $r->print('Coursemap undefined.'); } else { @@ -566,16 +569,19 @@ sub handler { } } # ----------------------------------------------------------- Start Page Output - $r->print('Navigate LON-CAPA Maps'); - $r->print('print( + 'Navigate Course Map'); if (($currenturl=~/^\/res/) && ($currenturl!~/^\/res\/adm/)) { - $r->print(' onLoad="window.location.hash='."'curloc'".'"'); + $bodytagadd='onLoad="window.location.hash='."'curloc'".'"'; } - $r->print('>'. - ''. - '

Navigate Course Map

'. - "

$date

"); + $r->print(&Apache::loncommon::bodytag('Navigate Course Map','', + $bodytagadd)); + $r->print(''); + my $desc=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; + if (defined($desc)) { $r->print("

$desc

\n"); } + $r->print("

$date

\n"); $r->rflush(); $r->print(' New discussion since '. localtime($lastcheck). @@ -611,6 +617,11 @@ sub handler { my $indent;my $indentstr; my $linkid; my $rid=$colcont[$j]; + $rid=~/(\d+)\.(\d+)$/; + my $src= + &Apache::lonnet::declutter($hash{'src_'.$1.'.'.$2}); + my $symb= + &Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.$src; my $add=''; my $adde=''; my $hwk=''; @@ -621,6 +632,12 @@ sub handler { $rid=$1; $add=''; $adde=''; + if (($ENV{'user.adv'}) && + ($parmhash{$symb.'.0.parameter_randompick'})) { + $adde=' (randomly select '. + $parmhash{$symb.'.0.parameter_randompick'}. + ')'; + } } if ($rid=~/^j(.+)/) { $rid=$1; } if ($rid=~/^p(\d)(\d)\"([\w\: \(\)\/\,]*)\"(.+)/) { @@ -660,17 +677,12 @@ sub handler { $hwke=' ('.$ctext.')'; } } - if ($hash{'src_'.$rid} eq $currenturl) { + if ($rid && $hash{'src_'.$rid} eq $currenturl) { $add=$add.''. '> '; $adde= ' <'.$adde; } - my $src= - &Apache::lonnet::declutter($hash{'src_'.$rid}); - $rid=~/^(\d+)\.(\d+)$/; - my $symb= - &Apache::lonnet::declutter($hash{'map_id_'.$1}).'___'.$2.'___'.$src; if ($discussiontimes{$symb}>$lastcheck) { $adde= ''. @@ -703,9 +715,18 @@ sub handler { for(my $i=-1;$i<$indent;$i++) { $indentstr.=$is; } } if (!$linkid) { $linkid=$rid; } - $r->print($add.$indentstr. - ''.$hwk. - $hash{'title_'.$rid}.$hwke.''.$adde); + if ($hash{'randomout_'.$rid}) { + $adde=' (hidden)'.$adde; + } + $r->print($add.$indentstr); + if ($rid) { + $r->print(''. + $hwk.$hash{'title_'.$rid}.$hwke.''); + } + $r->print($adde); } $r->print(''); }