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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 11 Jun 2007 21:29:44 -0000


albertel		Mon Jun 11 17:29:44 2007 EDT

  Modified files:              
    /loncom/interface	portfolio.pm 
  Log:
  - BUG#5290 handle uploading of files with no directories correctly
  
  
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.183 loncom/interface/portfolio.pm:1.184
--- loncom/interface/portfolio.pm:1.183	Mon Jun 11 17:27:23 2007
+++ loncom/interface/portfolio.pm	Mon Jun 11 17:29:44 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # portfolio browser
 #
-# $Id: portfolio.pm,v 1.183 2007/06/11 21:27:23 albertel Exp $
+# $Id: portfolio.pm,v 1.184 2007/06/11 21:29:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1846,11 +1846,16 @@
     my ($r,$url,$group)=@_;
     for (my $i=0; $i<$env{'form.number_embedded_items'}; $i++) {
 	next if (!exists($env{'form.embedded_item_'.$i.'.filename'}));
-	
+	my $orig_uploaded_filename = 
+	    $env{'form.embedded_item_'.$i.'.filename'};
+
 	$env{'form.embedded_orig_'.$i} = 
 	    &unescape($env{'form.embedded_orig_'.$i});
 	my ($path,$fname) = 
 	    ($env{'form.embedded_orig_'.$i} =~ m{(.*/)([^/]*)});
+	# no path, whole string is fname
+	if (!$fname) { $fname = $env{'form.embedded_orig_'.$i} };
+
 	$path = $env{'form.currentpath'}.$path;
 	$fname = &Apache::lonnet::clean_filename($fname);
 
@@ -1873,7 +1878,7 @@
 					    $port_path.$path);
 	if ($result !~ m|^/uploaded/|) {
 	    $r->print('<span class="LC_error">'.'An error occurred ('.$result.
-		      ') while trying to upload '.&display_file($path,$fname).'</span><br />');
+		      ') while trying to upload '.$orig_uploaded_filename.' for embedded element '.$env{'form.embedded_orig_'.$i}.'</span><br />');
 	    next;
 	} else {
 	    $r->print("<p> Uploaded ".