--- loncom/automation/batchcreatecourse.pm 2009/10/31 17:54:51 1.32 +++ loncom/automation/batchcreatecourse.pm 2010/01/30 15:47:01 1.34 @@ -1,5 +1,5 @@ # -# $Id: batchcreatecourse.pm,v 1.32 2009/10/31 17:54:51 raeburn Exp $ +# $Id: batchcreatecourse.pm,v 1.34 2010/01/30 15:47:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -159,7 +159,7 @@ use strict; # firstres can be nav, syl, or blank for "Navigate Contents", Syllabus, or # no entry respectively. # -# crstype can be Course or Group +# crstype can be Course or Community # # crsquota is the total disk space permitted for course group portfolio files # in all course groups. @@ -254,6 +254,7 @@ sub parse_coursereqs { my $userkey = ''; my $role = ''; 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 @possroles = qw(st ad ep ta in cc co); my @dateitems = ('enrollstart','enrollend','accessstart','accessend'); my @useritems = ('autharg','authtype','firstname','generation','lastname','middlename','studentID'); my $p = HTML::Parser->new @@ -273,7 +274,7 @@ sub parse_coursereqs { } if ("@state" eq "class users user roles role") { $role = $attr->{id}; - if ($role =~ /^(st|ad|ep|ta|in|cc)$/) { + if (grep(/^\Q$role\E$/,@possroles)) { push(@{$$details{$num}{'users'}{$userkey}{'roles'}}, $role); %{$$details{$num}{'users'}{$userkey}{$role}} = (); @{$$details{$num}{'users'}{$userkey}{$role}{'usec'}} = (); @@ -319,17 +320,17 @@ sub parse_coursereqs { @{$$details{$num}{'users'}{$userkey}{'roles'}} = (); } elsif ("@state" eq "class users user email") { $$details{$num}{'users'}{$userkey}{'emailaddr'} = $text; - $$details{$num}{'users'}{$userkey}{'emailenc'} = &Apache::lonnet::escape($text); + $$details{$num}{'users'}{$userkey}{'emailenc'} = &LONCAPA:escape($text); } elsif ("@state" eq "class users user roles role start") { - if ($role =~ /^(st|ad|ep|ta|in|cc)$/) { + if (grep(/^\Q$role\E$/,@possroles)) { $$details{$num}{'users'}{$userkey}{$role}{'start'} = &process_date($text); } } elsif ("@state" eq "class users user roles role end") { - if ($role =~ /^(st|ad|ep|ta|in|cc)$/) { + if (grep(/^\Q$role\E$/,@possroles)) { $$details{$num}{'users'}{$userkey}{$role}{'end'} = &process_date($text); } } elsif ("@state" eq "class users user roles role usec") { - if ($role =~ /^(st|ad|ep|ta|in|cc)$/) { + if (grep(/^\Q$role\E$/,@possroles)) { unless ($text eq '') { push(@{$$details{$num}{'users'}{$userkey}{$role}{'usec'}},$text); }