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

www lon-capa-cvs@mail.lon-capa.org
Mon, 06 Mar 2006 17:15:31 -0000


www		Mon Mar  6 12:15:31 2006 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  Bug #1591: inform user if no map was specified for loading
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.222 loncom/interface/londocs.pm:1.223
--- loncom/interface/londocs.pm:1.222	Fri Feb 24 17:52:41 2006
+++ loncom/interface/londocs.pm	Mon Mar  6 12:15:29 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.222 2006/02/24 22:52:41 albertel Exp $
+# $Id: londocs.pm,v 1.223 2006/03/06 17:15:29 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1190,22 +1190,25 @@
 		}
             }
 # Loading a complete map
-	   if (($env{'form.importmap'}) && ($env{'form.loadmap'})) {
-	       foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) {
-		   my ($title,$url,$ext,$type)=split(/\:/,$_);
-                   my $idx=&Apache::lonratedt::getresidx($url);
-                   $Apache::lonratedt::resources[$idx]=$_;
-                   $Apache::lonratedt::order
-		       [$#Apache::lonratedt::order+1]=$idx;
-	       }
-
+	   if ($env{'form.loadmap'}) {
+               if ($env{'form.importmap'}=~/\w/) {
+	          foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) {
+		      my ($title,$url,$ext,$type)=split(/\:/,$_);
+                      my $idx=&Apache::lonratedt::getresidx($url);
+                      $Apache::lonratedt::resources[$idx]=$_;
+                      $Apache::lonratedt::order
+		          [$#Apache::lonratedt::order+1]=$idx;
+	          }
 # Store the changed version
-	       ($errtext,$fatal)=&storemap($coursenum,$coursedom,
+  	          ($errtext,$fatal)=&storemap($coursenum,$coursedom,
 					   $folder.'.'.$container);
-	       if ($fatal) {
-		   $r->print('<p><font color="red">'.$errtext.'</font></p>');
-		   return;
-	       }
+	          if ($fatal) {
+		      $r->print('<p><font color="red">'.$errtext.'</font></p>');
+		      return;
+	          }
+               } else {
+                   $r->print('<p><font color="red">'.&mt('No map selected.').'</font></p>');
+               }
            }
        }
 # ---------------------------------------------------------------- End commands