--- loncom/interface/loncreatecourse.pm 2005/02/17 08:29:42 1.76
+++ loncom/interface/loncreatecourse.pm 2006/05/15 19:11:40 1.88
@@ -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.88 2006/05/15 19:11:40 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);
}
@@ -160,6 +159,14 @@ sub copyresourcedb {
my %newdata=();
undef %newdata;
my $startdate=$data{$origcrsid.'.0.opendate'};
+ if (!$startdate) {
+ # now global start date for assements try the enrollment start
+ my %start=&Apache::lonnet::get('environment',
+ ['default_enrollment_start_date'],
+ $origcrsdata{'domain'},$origcrsdata{'num'});
+
+ $startdate = $start{'default_enrollment_start_date'};
+ }
my $today=time;
my $delta=0;
if ($startdate) {
@@ -194,7 +201,13 @@ sub copyresourcedb {
$thiskey=~s/^$origcrsid/$newcrsid/;
$newdata{$thiskey}=$data{$_};
if ($data{$_.'.type'}=~/^date_(start|end)$/) {
- $newdata{$thiskey}=$newdata{$thiskey}+$delta;
+ if ($delta > 0) {
+ $newdata{$thiskey}=$newdata{$thiskey}+$delta;
+ } else {
+ # no delta, it's unlikely we want the old dates and times
+ delete($newdata{$thiskey});
+ delete($newdata{$thiskey.'.type'});
+ }
}
}
return &Apache::lonnet::put
@@ -215,11 +228,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|gradingqueue|reviewqueue|CODEs)/) {
©db($origcrsid,$newcrsid,$_);
+ my $histfile=$_;
+ $histfile=~s/\.db$/\.hist/;
+ ©file($origcrsid,$newcrsid,$histfile);
}
}
}
@@ -238,7 +257,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 = '\n";
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
- my $bodytag=&Apache::loncommon::bodytag('Create a New Course');
my $helplink=&Apache::loncommon::help_open_topic('Create_Course',&mt('Help on Creating Courses'));
my $cloneform=&Apache::loncommon::select_dom_form
- ($ENV{'request.role.domain'},'clonedomain').
+ ($env{'request.role.domain'},'clonedomain').
&Apache::loncommon::selectcourse_link
('ccrs','clonecourse','clonedomain');
- my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($ENV{'request.role.domain'});
+ my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'});
my $starttime = time;
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
my $enroll_table = &Apache::londropadd::date_setting_table($starttime,$endtime,'create_enrolldates');
@@ -327,15 +345,13 @@ sub print_course_creation_page {
'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process",
'nech' => "Notification of enrollment changes",
'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
+ 'ndcl' => "Notification to domain coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
'irsp' => "Include retrieval of student photographs?",
'rshm' => 'Resource Space Home',
'opco' => "Open Course"
);
- my $html=&Apache::lonxml::xmlbegin();
- $r->print(<$lt{'cinf'}
@@ -524,10 +546,18 @@ $locform
$lt{'nech'}
$lt{'nccl'}
+
+$lt{'ndcl'}
+
+
$lt{'irsp'}
@@ -548,19 +578,13 @@ $lt{'nccl'}
-
-
-