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

www lon-capa-cvs@mail.lon-capa.org
Tue, 09 Sep 2003 17:26:03 -0000


www		Tue Sep  9 13:26:03 2003 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm 
  Log:
  When generating new cloned sequences, it is a nice idea to also use them.
  
  
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.36 loncom/interface/loncreatecourse.pm:1.37
--- loncom/interface/loncreatecourse.pm:1.36	Mon Sep  8 17:55:46 2003
+++ loncom/interface/loncreatecourse.pm	Tue Sep  9 13:26:03 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.36 2003/09/08 21:55:46 www Exp $
+# $Id: loncreatecourse.pm,v 1.37 2003/09/09 17:26:03 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -175,6 +175,18 @@
 	    delete $data{$_};
 	}
     }
+# adjust symbs
+    my $pattern='uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/';
+    $pattern=~s/(\W)/\\$1/gs;
+    my $new=    'uploaded/'. $newcrsdata{'domain'}.'/'. $newcrsdata{'num'}.'/';
+    foreach (keys %data) {
+	if ($_=~/$pattern/) {
+	    my $newkey=$_;
+	    $newkey=~s/$pattern/$new/;
+	    $data{$newkey}=$data{$_};
+	    delete $data{$_};
+	}
+    }
 # adjust dates
     foreach (keys %data) {
 	my $thiskey=$_;
@@ -421,10 +433,14 @@
 	} else {
 	    $r->print(
     '<br /><font color="green">Cloning course from '.$clonehome.'</font>');
+	    my %oldcenv=&Apache::lonnet::dump('environment',$crsudom,$crsunum);
 # Copy all files
 	    &copycoursefiles($cloneid,$courseid);
+# Restore URL
+	    $cenv{'url'}=$oldcenv{'url'};
 # Restore title
-	    $cenv{'description'}=$cdescr;
+	    $cenv{'description'}=$oldcenv{'description'};
+# Mark as cloned
 	    $cenv{'clonedfrom'}=$cloneid;
 	}
     }