--- loncom/interface/loncreatecourse.pm 2005/02/17 08:29:42 1.76 +++ loncom/interface/loncreatecourse.pm 2005/11/15 20:17:00 1.84 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.76 2005/02/17 08:29:42 albertel Exp $ +# $Id: loncreatecourse.pm,v 1.84 2005/11/15 20:17:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,11 +86,10 @@ sub readfile { # ============================================================ Write a userfile sub writefile { - (my $courseid, my $which,$ENV{'form.output'})=@_; + (my $courseid, my $which,$env{'form.output'})=@_; my %crsdata=&Apache::lonnet::coursedescription($courseid); return &Apache::lonnet::finishuserfileupload( $crsdata{'num'},$crsdata{'domain'}, - $crsdata{'home'}, 'output',$which); } @@ -215,11 +214,17 @@ sub copyuserfiles { sub copydbfiles { my ($origcrsid,$newcrsid)=@_; + + my ($origcrs_discussion) = ($origcrsid=~m|^/(.*)|); + $origcrs_discussion=~s|/|_|g; foreach (&crsdirlist($origcrsid)) { if ($_=~/\.db$/) { unless - ($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata)/) { + ($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata|\Q$origcrs_discussion\E|slots|slot_reservations|(grading|review)queue|CODEs)/) { ©db($origcrsid,$newcrsid,$_); + my $histfile=$_; + $histfile=~s/\.db$/\.hist/; + ©file($origcrsid,$newcrsid,$histfile); } } } @@ -238,7 +243,7 @@ sub copycoursefiles { sub print_course_creation_page { my $r=shift; - my $defdom=$ENV{'request.role.domain'}; + my $defdom=$env{'request.role.domain'}; my %host_servers = &Apache::loncommon::get_library_servers($defdom); my $course_home = '
$lt{'irsp'}
@@ -548,11 +562,6 @@ $lt{'nccl'}
-
-
@@ -568,8 +577,8 @@ ENDDOCUMENT sub create_course { my $r=shift; - my $ccuname=$ENV{'form.ccuname'}; - my $ccdomain=$ENV{'form.ccdomain'}; + my $ccuname=$env{'form.ccuname'}; + my $ccdomain=$env{'form.ccdomain'}; $ccuname=~s/\W//g; $ccdomain=~s/\W//g; @@ -581,19 +590,19 @@ sub create_course { my $autharg; my $authtype; - if ($ENV{'form.login'} eq 'krb') { + if ($env{'form.login'} eq 'krb') { $authtype = 'krb'; - $authtype .=$ENV{'form.krbver'}; - $autharg = $ENV{'form.krbarg'}; - } elsif ($ENV{'form.login'} eq 'int') { + $authtype .=$env{'form.krbver'}; + $autharg = $env{'form.krbarg'}; + } elsif ($env{'form.login'} eq 'int') { $authtype ='internal'; - if ((defined($ENV{'form.intarg'})) && ($ENV{'form.intarg'})) { - $autharg = $ENV{'form.intarg'}; + if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) { + $autharg = $env{'form.intarg'}; } - } elsif ($ENV{'form.login'} eq 'loc') { + } elsif ($env{'form.login'} eq 'loc') { $authtype = 'localauth'; - if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) { - $autharg = $ENV{'form.locarg'}; + if ((defined($env{'form.locarg'})) && ($env{'form.locarg'})) { + $autharg = $env{'form.locarg'}; } } @@ -611,38 +620,39 @@ ENDENHEAD my $args = { ccuname => $ccuname, ccdomain => $ccdomain, - cdescr => $ENV{'form.title'}, - curl => $ENV{'form.topmap'}, - course_domain => $ENV{'request.role.domain'}, - course_home => $ENV{'form.course_home'}, - nonstandard => $ENV{'form.nonstandard'}, - crscode => $ENV{'form.crscode'}, - clonecourse => $ENV{'form.clonecourse'}, - clonedomain => $ENV{'form.clonedomain'}, - crsid => $ENV{'form.crsid'}, - curruser => $ENV{'user.name'}, - crssections => $ENV{'form.crssections'}, - crsxlist => $ENV{'form.crsxlist'}, - autoadds => $ENV{'form.autoadds'}, - autodrops => $ENV{'form.autodrops'}, - notify => $ENV{'form.notify'}, - no_end_date => $ENV{'form.no_end_date'}, - showphotos => $ENV{'form.showphotos'}, + cdescr => $env{'form.title'}, + curl => $env{'form.topmap'}, + course_domain => $env{'request.role.domain'}, + course_home => $env{'form.course_home'}, + nonstandard => $env{'form.nonstandard'}, + crscode => $env{'form.crscode'}, + clonecourse => $env{'form.clonecourse'}, + clonedomain => $env{'form.clonedomain'}, + crsid => $env{'form.crsid'}, + curruser => $env{'user.name'}, + crssections => $env{'form.crssections'}, + crsxlist => $env{'form.crsxlist'}, + autoadds => $env{'form.autoadds'}, + autodrops => $env{'form.autodrops'}, + notify_owner => $env{'form.notify_owner'}, + notify_dc => $env{'form.notify_dc'}, + no_end_date => $env{'form.no_end_date'}, + showphotos => $env{'form.showphotos'}, authtype => $authtype, autharg => $autharg, enrollstart => $enrollstart, enrollend => $enrollend, startaccess => $startaccess, endaccess => $endaccess, - setpolicy => $ENV{'form.setpolicy'}, - setcontent => $ENV{'form.setcontent'}, - reshome => $ENV{'form.reshome'}, - setkeys => $ENV{'form.setkeys'}, - keyauth => $ENV{'form.keyauth'}, - disresdis => $ENV{'form.disresdis'}, - disablechat => $ENV{'form.disablechat'}, - openall => $ENV{'form.openall'}, - firstres => $ENV{'form.firstres'} + setpolicy => $env{'form.setpolicy'}, + setcontent => $env{'form.setcontent'}, + reshome => $env{'form.reshome'}, + setkeys => $env{'form.setkeys'}, + keyauth => $env{'form.keyauth'}, + disresdis => $env{'form.disresdis'}, + disablechat => $env{'form.disablechat'}, + openall => $env{'form.openall'}, + firstres => $env{'form.firstres'} }; # @@ -664,33 +674,24 @@ ENDENHEAD } # Check the proposed home server for the course my %host_servers = &Apache::loncommon::get_library_servers - ($ENV{'request.role.domain'}); - if (! exists($host_servers{$ENV{'form.course_home'}})) { + ($env{'request.role.domain'}); + if (! exists($host_servers{$env{'form.course_home'}})) { $r->print(&mt('Invalid home server for course').': '. - $ENV{'form.course_home'}.'