--- loncom/interface/loncreatecourse.pm 2005/11/04 21:17:18 1.82 +++ loncom/interface/loncreatecourse.pm 2006/03/21 18:34:23 1.86 @@ -1,7 +1,7 @@ # The LearningOnline Network # Create a course # -# $Id: loncreatecourse.pm,v 1.82 2005/11/04 21:17:18 albertel Exp $ +# $Id: loncreatecourse.pm,v 1.86 2006/03/21 18:34:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -159,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) { @@ -193,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 @@ -220,7 +234,7 @@ sub copydbfiles { foreach (&crsdirlist($origcrsid)) { if ($_=~/\.db$/) { unless - ($_=~/^(nohist\_|discussiontimes|classlist|versionupdate|resourcedata|\Q$origcrs_discussion\E)/) { + ($_=~/^(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/; @@ -255,7 +269,6 @@ sub print_course_creation_page { } $course_home .= "\n\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'). @@ -337,11 +350,8 @@ sub print_course_creation_page { 'rshm' => 'Resource Space Home', 'opco' => "Open Course" ); - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< - $coursebrowserjs -The LearningOnline Network with CAPA - -$bodytag +END + + my $start_page = + &Apache::loncommon::start_page('Create a New Course',$js); + my $end_page = + &Apache::loncommon::end_page(); + + $r->print(<

$lt{'cinf'}

@@ -568,8 +584,7 @@ $lt{'ndcl'}

- - +$end_page ENDDOCUMENT } @@ -607,15 +622,8 @@ sub create_course { } my $logmsg; - my $html=&Apache::lonxml::xmlbegin(); - my $bodytag=&Apache::loncommon::bodytag('Create a New Course'); - $r->print(< -The LearningOnline Network with CAPA - -$bodytag -ENDENHEAD + my $start_page=&Apache::loncommon::start_page('Create a New Course'); + $r->print($start_page); my $args = { ccuname => $ccuname, @@ -669,7 +677,7 @@ ENDENHEAD - '); + '.&Apache::loncommon::end_page()); return; } # Check the proposed home server for the course @@ -677,7 +685,7 @@ ENDENHEAD ($env{'request.role.domain'}); if (! exists($host_servers{$env{'form.course_home'}})) { $r->print(&mt('Invalid home server for course').': '. - $env{'form.course_home'}.''); + $env{'form.course_home'}.&Apache::loncommon::end_page()); return; } my ($courseid,$crsudom,$crsunum); @@ -697,7 +705,8 @@ ENDENHEAD } # Flush the course logs so reverse user roles immediately updated &Apache::lonnet::flushcourselogs(); - $r->print('

'.&mt('Roles will be active at next login').'.

'); + $r->print('

'.&mt('Roles will be active at next login').'.

'. + &Apache::loncommon::end_page()); } sub construct_course {