--- rat/lonratedt.pm 2002/12/06 12:58:11 1.42 +++ rat/lonratedt.pm 2003/04/07 20:47:06 1.44 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Edit Handler for RAT Maps # -# $Id: lonratedt.pm,v 1.42 2002/12/06 12:58:11 www Exp $ +# $Id: lonratedt.pm,v 1.44 2003/04/07 20:47:06 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -318,17 +318,38 @@ sub pastetarget { # modifies @resources sub startfinish { +# Remove all start and finish foreach (@order) { my ($name,$url,$ext)=split(/\:/,$resources[$_]); if ($url=~/http\&colon\:\/\//) { $ext='true'; } $resources[$_]=$name.':'.$url.':'.$ext.':normal:res'; } +# Garbage collection + my $stillchange=1; + while (($#order>1) && ($stillchange)) { + $stillchange=0; + for (my $i=0;$i<=$#order;$i++) { + my ($name,$url,$ext)=split(/\:/,$resources[$order[$i]]); + unless ($url) { +# Take out empty resource + for (my $j=$i+1;$j<=$#order;$j++) { + $order[$j-1]=$order[$j]; + } + $#order--; + $stillchange=1; + last; + } + } + } +# Put in a start resource my ($name,$url,$ext)=split(/\:/,$resources[$order[0]]); $resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res'; +# Make sure this has at least start and finish if ($#order==0) { $resources[$#resources+1]='::false'; $order[1]=$#resources; } +# Make the last one a finish resource ($name,$url,$ext)=split(/\:/,$resources[$order[$#order]]); $resources[$order[$#order]]=$name.':'.$url.':'.$ext.':finish:res'; } @@ -892,6 +913,9 @@ sub viewmap { } my $idx=0; $r->print('

'.$url.'

'); + if ($adv) { + $r->print('

Map contents are not shown in order.


'); + } foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) { if (defined($_)) { $idx++;