[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 15 Jun 2007 19:12:57 -0000


albertel		Fri Jun 15 15:12:57 2007 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - BUG#5294 - don't overwrite the sequence if it already exists
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.276 loncom/interface/londocs.pm:1.277
--- loncom/interface/londocs.pm:1.276	Wed Jun 13 19:44:10 2007
+++ loncom/interface/londocs.pm	Fri Jun 15 15:12:56 2007
@@ -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 @@
 # 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 = '<map>'."\n".