--- loncom/interface/londocs.pm 2007/06/13 23:44:10 1.276 +++ loncom/interface/londocs.pm 2007/06/15 19:12:56 1.277 @@ -1,7 +1,7 @@ # The LearningOnline Network # Documents # -# $Id: londocs.pm,v 1.276 2007/06/13 23:44:10 albertel Exp $ +# $Id: londocs.pm,v 1.277 2007/06/15 19:12:56 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -904,15 +904,16 @@ sub store_template { # Imports the given (name, url) resources into the course # coursenum, coursedom, and folder must precede the list sub group_import { - my $coursenum = shift; - my $coursedom = shift; - my $folder = shift; - my $container = shift; - my $caller = shift; - while (@_) { - my $name = shift; - my $url = shift; - if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs')) { + my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; + + while (@files) { + my $name = shift(@files); + my $url = shift(@files); + #FIXME check if file exists before overwriting, might be restoring it + if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) + && ($caller eq 'londocs') + && (!&Apache::lonnet::stat_file($url))) { + my $errtext = ''; my $fatal = 0; my $newmapstr = ''."\n".