[LON-CAPA-cvs] cvs: loncom /automation batchcreatecourse.pm
raeburn
raeburn@source.lon-capa.org
Sat, 31 Oct 2009 18:04:51 -0000
raeburn Sat Oct 31 18:04:51 2009 EDT
Modified files:
/loncom/automation batchcreatecourse.pm
Log:
- Accommodate Communities.
- "co" is a possible role for Communities.
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.32 loncom/automation/batchcreatecourse.pm:1.33
--- loncom/automation/batchcreatecourse.pm:1.32 Sat Oct 31 17:54:51 2009
+++ loncom/automation/batchcreatecourse.pm Sat Oct 31 18:04:50 2009
@@ -1,5 +1,5 @@
#
-# $Id: batchcreatecourse.pm,v 1.32 2009/10/31 17:54:51 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.33 2009/10/31 18:04:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -159,7 +159,7 @@
# 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 @@
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 @@
}
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'}} = ();
@@ -321,15 +322,15 @@
$$details{$num}{'users'}{$userkey}{'emailaddr'} = $text;
$$details{$num}{'users'}{$userkey}{'emailenc'} = &Apache::lonnet::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);
}