--- loncom/automation/batchcreatecourse.pm 2006/05/23 18:34:40 1.11 +++ loncom/automation/batchcreatecourse.pm 2006/08/11 19:30:52 1.17 @@ -1,5 +1,5 @@ # -# $Id: batchcreatecourse.pm,v 1.11 2006/05/23 18:34:40 raeburn Exp $ +# $Id: batchcreatecourse.pm,v 1.17 2006/08/11 19:30:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,7 +29,6 @@ use LONCAPA::Configuration; use LONCAPA::Enrollment; use HTML::Parser; use Time::Local; -use Apache::Constants; use Apache::lonnet; use Apache::loncommon; use Apache::loncreatecourse; @@ -56,6 +55,7 @@ use strict; # # # Underwater Basket Weaving +# Course # ss05ubw101 # msul1 # msu @@ -74,6 +74,7 @@ use strict; # # # nav +# 20 # 466011437c34194msul1 # msu # @@ -154,8 +155,14 @@ use strict; # A value of 0 or blank is equivalent to an unchecked box or 'No' # response. Dates are in format YYYY:MM:DD:HH:MM:SS (:separators required) # -# firstres can be nav, syl , or blank for "Navigate Contents", Syllabus, or +# firstres can be nav, syl, or blank for "Navigate Contents", Syllabus, or # no entry respectively. +# +# crstype can be Course or Group +# +# crsquota is the total disk space permitted for course group portfolio files +# in all course groups. +# # For format of other parameters, refer to the interactive CCRS page # and view how the equivalent parameter is displayed in the web form. # @@ -166,7 +173,7 @@ use strict; # # Directory for retrieval of files listed in @$requests is: # /home/httpd/perl/tmp/addcourse/$dom/auto/pending if $context = auto -# /home/httpd/perl/tmp/addcourse/$dom/web/$udom_$uname if $context = web +# /home/httpd/perl/tmp/addcourse/$dom/web/$uname_$udom/pending if $context = web # # inputs (five) - requests - ref to array of filename(s) containing course requests # courseids - ref to hash to store LON-CAPA course ids of new courses @@ -201,7 +208,7 @@ sub create_courses { $newcoursedir .= '/pending'; } else { if ($uname && $udom) { - $newcoursedir .= '/'.$udom.'_'.$uname; + $newcoursedir .= '/'.$uname.'_'.$udom.'/pending'; } else { $logmsg = "batchcreatecourse::create_courses() called without username and/or domain of requesting Domain Coordinator"; } @@ -241,7 +248,7 @@ sub parse_coursereqs { 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'); + 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 @dateitems = ('enrollstart','enrollend','accessstart','accessend'); my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID'); my $p = HTML::Parser->new @@ -448,11 +455,13 @@ sub build_course { ccuname => $$details{$num}{'owner'}, ccdomain => $$details{$num}{'domain'}, cdescr => $$details{$num}{'title'}, + crstype => $$details{$num}{'crstype'}, curl => $$details{$num}{'topmap'}, course_domain => $cdom, course_home => $$details{$num}{'coursehome'}, nonstandard => $$details{$num}{'nonstandard'}, crscode => $$details{$num}{'coursecode'}, + crsquota => $$details{$num}{'crsquota'}, clonecourse => $$details{$num}{'clonecrs'}, clonedomain => $$details{$num}{'clonedom'}, crsid => $$details{$num}{'optional_id'}, @@ -629,7 +638,7 @@ sub process_date { if ($timestr !~ /:/) { $timestamp = ''; } else { - my @entries = split/:/,$timestr; + my @entries = split(/:/,$timestr); for (my $j=0; $j<@entries; $j++) { if ( length($entries[$j]) > 1 ) { $entries[$j] =~ s/^0//; @@ -668,9 +677,12 @@ sub process_date { $entries[2] = 29; } if ($entries[2] == 29) { - unless ($entries[0]%4 == 0) { - $entries[2] == 28; - } + if ($entries[0]%4 != 0) { + $entries[2] = 28; + } elsif ( $entries[0]%100 == 0 + && $entries[0]%400 != 0) { + $entries[2] = 28; + } } } $timestamp = timelocal($entries[5],$entries[4],$entries[3],$entries[2],$entries[1],$entries[0]);