[LON-CAPA-cvs] cvs: loncom /publisher lonupload.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 04 Aug 2003 18:22:55 -0000


www		Mon Aug  4 14:22:55 2003 EDT

  Modified files:              
    /loncom/publisher	lonupload.pm 
  Log:
  Phase 2:
  
  * returning to phase 1 could never have worked correctly; eliminated.
  
  * did not check if target was an existing directory, and changed mode of 
    parent directory to "rw-rw" overriding the "x"; put in checking.
  
  
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.18 loncom/publisher/lonupload.pm:1.19
--- loncom/publisher/lonupload.pm:1.18	Mon Aug  4 13:45:06 2003
+++ loncom/publisher/lonupload.pm	Mon Aug  4 14:22:55 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.18 2003/08/04 17:45:06 www Exp $
+# $Id: lonupload.pm,v 1.19 2003/08/04 18:22:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,6 +163,8 @@
  '<font color=red>'.
  'The extension on this file is reserved internally by LON-CAPA.'.
  '</font>');
+              $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   } elsif ($fn=~/\.(\w+)$/ && 
 		    !defined(&Apache::loncommon::fileembstyle($1))) {
 	       $r->print(
@@ -170,6 +172,16 @@
  '<font color=red>'.
  'The extension on this file is not recognized by LON-CAPA.'.
  '</font>');
+	       $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
+	   } elsif (-d $target) {
+	       $r->print(
+ 'File <tt>'.$fn.'</tt> could not be copied.<br />'.
+ '<font color=red>'.
+ 'The target is an existing directory.'.
+ '</font>');
+	       $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   } elsif (copy($source,$target)) {
 	       chmod(0660, $target); # Set permissions to rw-rw---.
 	      $r->print('File copied.');
@@ -179,17 +191,17 @@
                         '">Back to Directory</a></font>');
 	   } else {
               $r->print('Failed to copy: '.$!);
+              $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   }
        }
     } else {
        $r->print(
-   '<font size=+1 color=red>Please pick a filename</font><p>');
-       &phaseone($r,$fn,$uname,$udom);
+   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
     }
   } else {
     $r->print(
-   '<font size=+1 color=red>Please pick a filename</font><p>');
-    &phaseone($r,$fn,$uname,$udom);
+   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
   }
 }