--- loncom/interface/londocs.pm 2005/06/05 07:10:32 1.177 +++ loncom/interface/londocs.pm 2005/06/08 18:49:38 1.179 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.177 2005/06/05 07:10:32 albertel Exp $ +# $Id: londocs.pm,v 1.179 2005/06/08 18:49:38 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -852,7 +852,7 @@ sub group_import { } } if ($url) { - my $idx = $#Apache::lonratedt::resources + 1; + my $idx = &Apache::lonratedt::getresidx($url); $Apache::lonratedt::order[$#Apache::lonratedt::order+1]=$idx; my $ext = 'false'; if ($url=~/^http:\/\//) { $ext = 'true'; } @@ -914,8 +914,10 @@ sub editor { ($errtext,$fatal)= &mapread($coursenum,$coursedom,$folder.'.'.$container); if ($#Apache::lonratedt::order<1) { - $Apache::lonratedt::order[0]=1; - $Apache::lonratedt::resources[1]=''; + my $idx=&Apache::lonratedt::getresidx(); + if ($idx<=0) { $idx=1; } + $Apache::lonratedt::order[0]=$idx; + $Apache::lonratedt::resources[$idx]=''; } if (defined($env{'form.markcopy'})) { # Mark for copying @@ -1018,7 +1020,7 @@ sub editor { if ($url=~/^http\:\/\//) { $ext='true'; } $url=~s/\:/\:/g; # Now insert the URL at the bottom - my $newidx=1+$#Apache::lonratedt::resources; + my $newidx=&Apache::lonratedt::getresidx($url); $Apache::lonratedt::resources[$newidx]= $title.':'.$url.':'.$ext.':normal:res'; $Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; @@ -1068,6 +1070,7 @@ sub editor { if ($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) { &Apache::lonnet::removeuploadedurl($url); } + &Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { $Apache::lonratedt::order[$i]= $Apache::lonratedt::order[$i+1]; @@ -1075,6 +1078,7 @@ sub editor { $#Apache::lonratedt::order--; } elsif ($cmd eq 'cut') { my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); + &Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { $Apache::lonratedt::order[$i]= $Apache::lonratedt::order[$i+1];