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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 08 Nov 2003 11:11:01 -0000


albertel		Sat Nov  8 06:11:01 2003 EDT

  Modified files:              
    /loncom/publisher	lonupload.pm 
  Log:
  - xhtmlize
  
  
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.22 loncom/publisher/lonupload.pm:1.23
--- loncom/publisher/lonupload.pm:1.22	Sat Nov  8 06:04:52 2003
+++ loncom/publisher/lonupload.pm	Sat Nov  8 06:11:01 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.22 2003/11/08 11:04:52 albertel Exp $
+# $Id: lonupload.pm,v 1.23 2003/11/08 11:11:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,32 +94,34 @@
 
 	&Debug($r, "Filename for upload: $fn");
 	if (($fn) && ($fn!~/\/$/)) {
-	    $r->print('<form action=/adm/upload method=post>'.
-		      '<input type=hidden name=phase value=two>'.
-		      '<input type=hidden name=datatoken value="'.
-		      &upfile_store.'">'.
-		      '<input type=hidden name=uploaduname value="'.$uname.'">'.
-		      &mt('Store uploaded file as ')."<tt>/priv/$uname/</tt>".
-		      '<input type=text size=50 name=filename value="'.$fn.'"><br>'.
-		      '<input type=submit value="'.&mt('Store').'"></form>');
+	    $r->print('<form action="/adm/upload" method="post">'.
+		      '<input type="hidden" name="phase" value="two" />'.
+		      '<input type="hidden" name="datatoken" value="'.
+		      &upfile_store.'" />'.
+		      '<input type="hidden" name="uploaduname" value="'.$uname.
+		      '" />'.&mt('Store uploaded file as ').
+		      "<tt>/priv/$uname/</tt>".
+		      '<input type="text" size="50" name="filename" value="'.$fn.
+		      '" /><br />'.
+		      '<input type="submit" value="'.&mt('Store').'" /></form>');
 	    # Check for bad extension and warn user
 	    if ($fn=~/\.(\w+)$/ && 
 		(&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
-		$r->print('<font color=red>'.&mt('The extension on this file,').
+		$r->print('<font color="red">'.&mt('The extension on this file,').
 			  ' "'.$1.'"'.&mt(', is reserved internally by LON-CAPA.').
-			  ' <br \>'.&mt('Please change the extension.').'</font>');
+			  ' <br />'.&mt('Please change the extension.').'</font>');
 	    } elsif($fn=~/\.(\w+)$/ && 
 		    !defined(&Apache::loncommon::fileembstyle($1))) {
-		$r->print('<font color=red>'.&mt('The extension on this file,').
+		$r->print('<font color="red">'.&mt('The extension on this file,').
 			  ' "'.$1.'"'.&mt(', is not recognized by LON-CAPA.').
-			  ' <br \>'.&mt('Please change the extension.').
+			  ' <br />'.&mt('Please change the extension.').
 			  '</font>');
 	    }
 	} else {
-	    $r->print('<font color=red>'.&mt('Illegal filename.').'</font>');
+	    $r->print('<font color="red">'.&mt('Illegal filename.').'</font>');
 	}
     } else {
-	$r->print('<font color=red>'.&mt('No upload file specified.').'</font>');
+	$r->print('<font color="red">'.&mt('No upload file specified.').'</font>');
     }
 }
 
@@ -141,13 +143,13 @@
 	my $datatoken=$ENV{'form.datatoken'};
 	if (($fn) && ($datatoken)) {
 	    if ((-e $target) && ($ENV{'form.override'} ne 'Yes')) {
-		$r->print('<form action=/adm/upload method=post>'.
+		$r->print('<form action="/adm/upload" method="post">'.
 			  &mt('File').' <tt>'.$fn.'</tt> '.
 			  &mt('exists. Overwrite?').' '.
-			  '<input type=hidden name=phase value=two>'.
-			  '<input type=hidden name=filename value="'."$url".'">'.
-			  '<input type=hidden name=datatoken value="'.$datatoken.'">'.
-			  '<input type=submit name=override value="'.&mt('Yes').'"></form>');
+			  '<input type="hidden" name="phase" value="two" />'.
+			  '<input type="hidden" name="filename" value="'."$url".'" />'.
+			  '<input type="hidden" name="datatoken" value="'.$datatoken.'" />'.
+			  '<input type="submit" name="override" value="'.&mt('Yes').'" /></form>');
 	    } else {
 		my $source=$r->dir_config('lonDaemons').'/tmp/'.$datatoken.'.tmp';
 		# Check for bad extension and disallow upload
@@ -155,7 +157,7 @@
 		    (&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
 		    $r->print(&mt('File').' <tt>'.$fn.'</tt> '.
 			      &mt('could not be copied.').'<br />'.
-			      '<font color=red>'.
+			      '<font color="red">'.
 			      &mt('The extension on this file is reserved internally by LON-CAPA.').
 			      '</font>');
 		    $r->print('<p><font size=+2><a href="'.$path.'">'.
@@ -164,35 +166,35 @@
 			 !defined(&Apache::loncommon::fileembstyle($1))) {
 		    $r->print(&mt('File').' <tt>'.$fn.'</tt> '.
 			      &mt('could not be copied.').'<br />'.
-			      '<font color=red>'.
+			      '<font color="red">'.
 			      &mt('The extension on this file is not recognized by LON-CAPA.').
 			      '</font>');
-		    $r->print('<p><font size=+2><a href="'.$path.'">'.
+		    $r->print('<br /><font size="+2"><a href="'.$path.'">'.
 			      &mt('Back to Directory').'</a></font>');
 		} elsif (-d $target) {
 		    $r->print('File <tt>'.$fn.'</tt> could not be copied.<br />'.
-			      '<font color=red>'.
+			      '<font color="red">'.
 			      &mt('The target is an existing directory.').
-			      '</font>');
-		    $r->print('<p><font size=+2><a href="'.$path.'">'.
+			      '</font><br />');
+		    $r->print('<font size="+2"><a href="'.$path.'">'.
 			      &mt('Back to Directory').'</a></font>');
 		} elsif (copy($source,$target)) {
 		    chmod(0660, $target); # Set permissions to rw-rw---.
 		    $r->print(&mt('File copied.'));
-		    $r->print('<p><font size=+2><a href="'.$url.'">'.
+		    $r->print('<br /><font size="+2"><a href="'.$url.'">'.
 			      &mt('View file').'</a></font>');
-		    $r->print('<p><font size=+2><a href="'.$path.'">'.
-			      &mt('Back to Directory').'</a></font>');
+		    $r->print('<font size="+2"><a href="'.$path.'">'.
+			      &mt('Back to Directory').'</a></font><br />');
 		} else {
 		    $r->print('Failed to copy: '.$!);
-		    $r->print('<p><font size=+2><a href="'.$path.'">'.
+		    $r->print('<br /><font size="+2"><a href="'.$path.'">'.
 			      &mt('Back to Directory').'</a></font>');
 		}
 	    }
 	} else {
-	    $r->print('<font size=+1 color=red>'.
+	    $r->print('<font size="+1" color="red">'.
 		      &mt('Please use browser "Back" button and pick a filename').
-		      '</font><p>');
+		      '</font><br />>');
 	}
     } else {
 	$r->print('<font size=+1 color=red>'.