[LON-CAPA-cvs] cvs: rat / lonratedt.pm

www lon-capa-cvs@mail.lon-capa.org
Wed, 08 Jun 2005 15:44:52 -0000


www		Wed Jun  8 11:44:52 2005 EDT

  Modified files:              
    /rat	lonratedt.pm 
  Log:
  Remember zombies when fully reading a map
  Forget zombies when just generating a listing
  
  
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.66 rat/lonratedt.pm:1.67
--- rat/lonratedt.pm:1.66	Thu Apr  7 03:34:52 2005
+++ rat/lonratedt.pm	Wed Jun  8 11:44:51 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Edit Handler for RAT Maps
 #
-# $Id: lonratedt.pm,v 1.66 2005/04/07 07:34:52 albertel Exp $
+# $Id: lonratedt.pm,v 1.67 2005/06/08 15:44:51 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -173,7 +173,7 @@
 use Apache::lonlocal;
 use File::Copy;
 
-use vars qw(@order @resources @resparms);
+use vars qw(@order @resources @resparms @zombies %revzombies);
 
 
 # Mapread read maps into global arrays @links and @resources, determines status
@@ -188,9 +188,14 @@
     undef @resources;
     undef @order;
     undef @resparms;
+    undef @zombies;
+    undef %revzombies;
+
     @resources=('');
     @order=();
     @resparms=();
+    @zombies=();
+    %revzombies=();
 
     my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
     if ($errtext) { return ($errtext,2); }
@@ -199,7 +204,13 @@
     foreach (split(/\<\&\>/,$outtext)) {
 	my ($command,$number,$content)=split(/\<\:\>/,$_);
         if ($command eq 'objcont') {
-	    $resources[$number]=$content;
+	    my ($title,$src,$ext,$type)=split(/\:/,$content);
+	    if ($type ne 'zombie') {
+		$resources[$number]=$content;
+	    } else {
+		$zombies[$number]=$content;
+		$revzombies{$src}=$number;
+	    }
         }
         if ($command eq 'objlinks') {
             $links[$number]=$content;
@@ -296,7 +307,10 @@
     foreach (split(/\<\&\>/,$outtext)) {
 	my ($command,$number,$content)=split(/\<\:\>/,$_);
         if ($command eq 'objcont') {
-	    $theseres[$number]=$content;
+	    my ($title,$src,$ext,$type)=split(/\:/,$content);
+	    unless ($type eq 'zombie') {
+		$theseres[$number]=$content;
+	    }
         }
         if ($command eq 'objlinks') {
             $links[$number]=$content;