--- loncom/interface/londocs.pm 2005/06/26 15:42:52 1.191 +++ loncom/interface/londocs.pm 2005/07/24 19:31:00 1.194 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.191 2005/06/26 15:42:52 raeburn Exp $ +# $Id: londocs.pm,v 1.194 2005/07/24 19:31:00 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1175,7 +1175,7 @@ FOLDERINFO } sub process_file_upload { - my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase) = @_; + my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_; # upload a file, if present my $parseaction; if ($env{'form.parserflag'}) { @@ -1183,10 +1183,10 @@ sub process_file_upload { } my $phase_status; my $folder=$env{'form.folder'}; - if ($folder eq '' || $folder eq 'supplemental') { + if ($folder eq '') { $folder='default'; } - if ( ($folder=~/^$1/) || ($1 eq 'default') ) { + if ( ($folder=~/^$uploadcmd/) || ($uploadcmd eq 'default') ) { my $errtext=''; my $fatal=0; my $container='sequence'; @@ -1203,10 +1203,13 @@ sub process_file_upload { return 'failed'; } my $destination = 'docs/'; - if ($folder eq 'default') { + if ($folder =~ /^supplemental/) { + $destination = 'supplemental/'; + } + if (($folder eq 'default') || ($folder eq 'supplemental')) { $destination .= 'default/'; - } elsif ($folder =~ /^default_(\d+)$/) { - $destination .= $1.'/'; + } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) { + $destination .= $2.'/'; } # this is for a course, not a user, so set coursedoc flag # probably the only place in the system where this should be "1" @@ -1667,8 +1670,15 @@ sub verifycontent { &mt('Return to DOCS').''); } + # -------------------------------------------------------------- Check Versions +sub devalidateversioncache { + my $src=shift; + &Apache::lonnet::devalidate_cache_new('courseresversion',$env{'request.course.id'}.'_'. + &Apache::lonnet::clutter($src)); +} + sub checkversions { my $r=shift; my $html=&Apache::lonxml::xmlbegin(); @@ -1695,6 +1705,7 @@ sub checkversions { foreach (keys %hash) { if ($_=~/^ids\_(\/res\/.+)$/) { $newsetversions{$1}='mostrecent'; + &devalidateversioncache($1); } } } elsif ($env{'form.setcurrent'}) { @@ -1704,6 +1715,7 @@ sub checkversions { my $getvers=&Apache::lonnet::getversion($1); if ($getvers>0) { $newsetversions{$1}=$getvers; + &devalidateversioncache($1); } } } @@ -1714,6 +1726,7 @@ sub checkversions { my $src=$1; if (($env{$_}) && ($env{$_} ne $setversions{$src})) { $newsetversions{$src}=$env{$_}; + &devalidateversioncache($src); } } } @@ -1943,7 +1956,7 @@ sub changewarning { if (defined($env{'form.pagepath'})) { $pathvar='pagepath'; $path=&Apache::lonnet::escape($env{'form.pagepath'}); - $path.='&symb='.&Apache::lonnet::escape($env{'form.pagesymb'}); + $path.='&pagesymb='.&Apache::lonnet::escape($env{'form.pagesymb'}); } $url='/adm/coursedocs?'.$pathvar.'='.$path; } @@ -2246,7 +2259,7 @@ ENDNEWSCRIPT # Process file upload - phase one - upload and parse primary file. $upload_result = &process_file_upload(\$upload_output,$coursenum, $coursedom,\%allfiles, - \%codebase); + \%codebase,$1); if ($upload_result eq 'phasetwo') { $r->print($upload_output); }