[LON-CAPA-cvs] cvs: loncom /automation batchcreatecourse.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 02 Jul 2008 18:44:16 -0000


raeburn		Wed Jul  2 14:44:16 2008 EDT

  Modified files:              
    /loncom/automation	batchcreatecourse.pm 
  Log:
  - default datemode and dateshift set for courses created via batch course creation and cloned from an existing course.
  - datemode and dateshift can be specified in the XML course description file.
  
  
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.26 loncom/automation/batchcreatecourse.pm:1.27
--- loncom/automation/batchcreatecourse.pm:1.26	Wed Apr 30 22:48:49 2008
+++ loncom/automation/batchcreatecourse.pm	Wed Jul  2 14:44:16 2008
@@ -1,5 +1,5 @@
 #
-# $Id: batchcreatecourse.pm,v 1.26 2008/05/01 02:48:49 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.27 2008/07/02 18:44:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,6 +76,8 @@
 # <crsquota>20</crsquota>
 # <clonecrs>466011437c34194msul1</clonecrs>
 # <clonedom>msu</clonedom>
+# <datemode>shift</datemode>
+# <dateshift>365</dateshift>
 # <showphotos></showphotos>
 # <setpolicy>1</setpolicy>
 # <setcontent>1</setcontent>
@@ -249,7 +251,7 @@
     my $xlist = 0;
     my $userkey = '';
     my $role = '';
-    my @items = ('title','optional_id','coursecode','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','showphotos','setpolicy','setcontent','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota');
+    my @items = ('title','optional_id','coursecode','coursehome','reshome','nonstandard','adds','drops','topmap','firstres','clonecrs','clonedom','datemode','dateshift','showphotos','setpolicy','setcontent','setkeys','keyauth','disresdis','disablechat','openall','notify_owner','notify_dc','crstype','crsquota');
     my @dateitems = ('enrollstart','enrollend','accessstart','accessend');
     my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID');
     my $p = HTML::Parser->new
@@ -452,6 +454,10 @@
     }
 
     if ($outcome eq 'ok') {
+        if ($$details{$num}{'datemode'} !~ /^(preserve|shift|delete)$/) {
+            $$details{$num}{'datemode'} = 'shift';
+            $$details{$num}{'dateshift'} = 365;
+        }
         my $courseargs = {
                ccuname => $$details{$num}{'owner'},
                ccdomain => $$details{$num}{'domain'},
@@ -465,6 +471,8 @@
                crsquota => $$details{$num}{'crsquota'},
                clonecourse => $$details{$num}{'clonecrs'},
                clonedomain => $$details{$num}{'clonedom'},
+               datemode => $$details{$num}{'datemode'},
+               dateshift => $$details{$num}{'dateshift'},
                crsid => $$details{$num}{'optional_id'},
                curruser => $$details{$num}{'owner'},
                crssections => $sectionstr,
@@ -491,7 +499,6 @@
                openall => $$details{$num}{'openall'},
                firstres => $firstres
                };
-
         my %host_servers = &Apache::lonnet::get_servers($cdom,'library');
         if (! exists($host_servers{$$details{$num}{'coursehome'}})) {
             $$logmsg .= &mt('Invalid home server for course').': '.$$details{$num}{'coursehome'};