--- loncom/publisher/lonupload.pm 2004/03/31 05:24:00 1.26 +++ loncom/publisher/lonupload.pm 2004/12/07 22:11:02 1.28 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.26 2004/03/31 05:24:00 albertel Exp $ +# $Id: lonupload.pm,v 1.28 2004/12/07 22:11:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -100,7 +100,7 @@ sub phaseone { &Debug($r, "Filename for upload: $fn"); if (($fn) && ($fn!~/\/$/)) { - $r->print('
'. + $r->print(''. ''. ''. @@ -180,6 +180,8 @@ sub phasetwo { '
'); } else { my $source=$r->dir_config('lonDaemons').'/tmp/'.$datatoken.'.tmp'; + my $dirpath=$path.'/'; + $dirpath=~s/\/+/\//g; # Check for bad extension and disallow upload if ($fn=~/\.(\w+)$/ && (&Apache::loncommon::fileembstyle($1) eq 'hdn')) { @@ -188,7 +190,7 @@ sub phasetwo { ''. &mt('The extension on this file is reserved internally by LON-CAPA.'). ''); - $r->print('
'. + $r->print('
'. &mt('Back to Directory').''); } elsif ($fn=~/\.(\w+)$/ && !defined(&Apache::loncommon::fileembstyle($1))) { @@ -197,14 +199,14 @@ sub phasetwo { ''. &mt('The extension on this file is not recognized by LON-CAPA.'). ''); - $r->print('
'. + $r->print('
'. &mt('Back to Directory').''); } elsif (-d $target) { $r->print('File '.$fn.' could not be copied.
'. ''. &mt('The target is an existing directory.'). '
'); - $r->print(''. + $r->print(''. &mt('Back to Directory').''); } elsif (copy($source,$target)) { chmod(0660, $target); # Set permissions to rw-rw---. @@ -215,7 +217,7 @@ sub phasetwo { $r->print(&mt('File copied.')); $r->print('
'. &mt('View file').''); - $r->print('
'. + $r->print('
'. &mt('Back to Directory').'
'); } } else { @@ -256,17 +258,17 @@ sub handler { unless ($ENV{'form.phase'} eq 'two') { $javascript = qq| function verifyForm() { - var mode = document.forms[0].filetype.options[document.forms[0].filetype.selectedIndex].value + var mode = document.fileupload.filetype.options[document.fileupload.filetype.selectedIndex].value if (mode == "testbank") { - document.forms[0].action = "/adm/testbank"; + document.fileupload.action = "/adm/testbank"; } if (mode == "imsimport") { - document.forms[0].action = "/adm/imsimport"; + document.fileupload.action = "/adm/imsimport"; } if (mode == "standard") { - document.forms[0].action = "/adm/upload"; + document.fileupload.action = "/adm/upload"; } - document.forms[0].submit(); + document.fileupload.submit(); } function testbankWin() {