[LON-CAPA-cvs] cvs: loncom /interface loncreatecourse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 16 Jan 2006 23:11:52 -0000
albertel Mon Jan 16 18:11:52 2006 EDT
Modified files:
/loncom/interface loncreatecourse.pm
Log:
- dates didn't shift when cloned if there wasn't a global iopendate set.
- delete dates if no global start time is found
- try the 'default_nerollemtn_start_time' as a possbile global start
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.84 loncom/interface/loncreatecourse.pm:1.85
--- loncom/interface/loncreatecourse.pm:1.84 Tue Nov 15 15:17:00 2005
+++ loncom/interface/loncreatecourse.pm Mon Jan 16 18:11:50 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Create a course
#
-# $Id: loncreatecourse.pm,v 1.84 2005/11/15 20:17:00 albertel Exp $
+# $Id: loncreatecourse.pm,v 1.85 2006/01/16 23:11:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -159,6 +159,14 @@
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 @@
$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