[LON-CAPA-cvs] cvs: rat / lonratedt.pm lonuserstate.pm loncom/interface londocs.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 08 Jun 2005 18:49:39 -0000


www		Wed Jun  8 14:49:39 2005 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /rat	lonratedt.pm lonuserstate.pm 
  Log:
  Bug #882: ID management, get old idx back
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.178 loncom/interface/londocs.pm:1.179
--- loncom/interface/londocs.pm:1.178	Wed Jun  8 13:42:01 2005
+++ loncom/interface/londocs.pm	Wed Jun  8 14:49:38 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.178 2005/06/08 17:42:01 www Exp $
+# $Id: londocs.pm,v 1.179 2005/06/08 18:49:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1020,7 +1020,7 @@
 		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;
@@ -1070,6 +1070,7 @@
 		    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];
@@ -1077,6 +1078,7 @@
                     $#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];
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.70 rat/lonratedt.pm:1.71
--- rat/lonratedt.pm:1.70	Wed Jun  8 13:42:01 2005
+++ rat/lonratedt.pm	Wed Jun  8 14:49:38 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.70 2005/06/08 17:42:01 www Exp $
+# $Id: lonratedt.pm,v 1.71 2005/06/08 18:49:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,7 +33,7 @@
 
 =head1 NAME
 
-Apache::lonratedt: advanced resource assembly tool
+Apache::lonratedt: simple resource assembly tool
 
 =head1 SYNOPSIS
 
@@ -462,6 +462,14 @@
     return $max;
 }
 
+# --------------------------------------------------------------- Make a zombie
+
+sub makezombie {
+    my $idx=shift;
+    my ($name,$url,$ext)=split(/\:/,$resources[$idx]);
+    $zombies[$idx]=$name.':'.$url.':'.$ext.':zombie';
+}
+
 # ----------------------------------------------------------- Paste into target
 # modifies @order, @resources
 
@@ -913,7 +921,11 @@
                foreach (@targetselect) {
 		   if ($_-1==$i) { $include=0; }
                }
-               if ($include) { $neworder[$#neworder+1]=$order[$i]; }
+               if ($include) { 
+		   $neworder[$#neworder+1]=$order[$i]; 
+	       } else {
+		   &makezombie($order[$i]);
+	       }
            }
            @order=@neworder;
            &storemap(&Apache::lonnet::filelocation('',$url));      
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.91 rat/lonuserstate.pm:1.92
--- rat/lonuserstate.pm:1.91	Fri May  6 15:11:49 2005
+++ rat/lonuserstate.pm	Wed Jun  8 14:49:38 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.91 2005/05/06 19:11:49 albertel Exp $
+# $Id: lonuserstate.pm,v 1.92 2005/06/08 18:49:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -138,7 +138,7 @@
 	    if ($token->[0] eq 'S') {
                 if ($token->[1] eq 'resource') {
 # -------------------------------------------------------------------- Resource
-
+                    if ($token->[2]->{'type'} eq 'zombie') { next; }
                     my $rid=$lpc.'.'.$token->[2]->{'id'};
 
                     $hash{'kind_'.$rid}='res';