version 1.15, 2005/11/07 15:43:22
|
version 1.23, 2007/01/01 19:19:58
|
Line 33
|
Line 33
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncoursedata; |
use Apache::loncoursedata; |
use Apache::lonmsg; |
use Apache::lonmsg; |
|
use Apache::longroup; |
|
use Apache::loncommon; |
use HTML::Entities; |
use HTML::Entities; |
|
|
# Determine the library server's domain and hostID |
# Determine the library server's domain and hostID |
Line 50
|
Line 52
|
if (! &localenroll::run($dom)) { next; } |
if (! &localenroll::run($dom)) { next; } |
$env{'user.domain'} = $dom; |
$env{'user.domain'} = $dom; |
# Determine the courses |
# Determine the courses |
my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@hostids); |
my %courses = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.',1,\@hostids,'Course'); |
my %affiliates = (); |
my %affiliates = (); |
my %enrollvar = (); |
my %enrollvar = (); |
my %reply = (); |
my %reply = (); |
Line 136
|
Line 138
|
if ($changecount > 0) { |
if ($changecount > 0) { |
unless ($enrollvar{$crs}{notifylist} eq '') { |
unless ($enrollvar{$crs}{notifylist} eq '') { |
# Send message about enrollment changes to notifylist. |
# Send message about enrollment changes to notifylist. |
# Set $env{'user.name'}, $env{'user.home'} for use by logging in lonmsg |
# Set $env{'user.name'}, $env{'user.domain'}, $env{'user.home'} |
|
# for use by logging in lonmsg |
unless ( ($enrollvar{$crs}{'courseowner'} eq '') || (!defined($enrollvar{$crs}{'courseowner'}) ) ) { |
unless ( ($enrollvar{$crs}{'courseowner'} eq '') || (!defined($enrollvar{$crs}{'courseowner'}) ) ) { |
$env{'user.name'} = $enrollvar{$crs}{'courseowner'}; |
if ($enrollvar{$crs}{'courseowner'} =~ /:/) { |
$env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$dom); |
($env{'user.name'},$env{'user.domain'}) = split(/:/,$enrollvar{$crs}{'courseowner'}); |
|
} else { |
|
$env{'user.name'} = $enrollvar{$crs}{'courseowner'}; |
|
$env{'user.domain'} = $dom; |
|
} |
|
$env{'user.home'} = &Apache::lonnet::homeserver($env{'user.name'},$env{'user.domain'}); |
|
|
my $subject = "Student enrollment changes in $enrollvar{$crs}{coursecode}"; |
my $subject = "Student enrollment changes in $enrollvar{$crs}{coursecode}"; |
my $message = "The following $changecount change(s) occurred in $enrollvar{$crs}{description} - $enrollvar{$crs}{coursecode} as a result of the automated classlist update:\n\n".$response; |
my $message = "The following $changecount change(s) occurred in $enrollvar{$crs}{description} - $enrollvar{$crs}{coursecode} as a result of the automated classlist update:\n\n".$response; |
Line 153
|
Line 161
|
$to_notify[0] = $enrollvar{$crs}{notifylist}; |
$to_notify[0] = $enrollvar{$crs}{notifylist}; |
} |
} |
foreach my $cc (@to_notify) { |
foreach my $cc (@to_notify) { |
my ($ccname,$ccdom) = split/@/,$cc; |
my ($ccname,$ccdom); |
|
if ($cc =~ /:/) { |
|
($ccname,$ccdom) = split(/:/,$cc); |
|
} elsif ($cc =~ /\@/) { |
|
($ccname,$ccdom) = split(/\@/,$cc); |
|
} |
my $status = &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message); |
my $status = &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message); |
} |
} |
if ( ($enrollvar{$crs}{notifylist} eq '') && ($newusermsg ne '') ) { |
if ( ($enrollvar{$crs}{notifylist} eq '') && ($newusermsg ne '') ) { |
my $subject = "New user accounts in $enrollvar{$crs}{'coursecode'}"; |
my $subject = "New user accounts in $enrollvar{$crs}{'coursecode'}"; |
my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$dom,$subject,$newusermsg); |
my $status = &Apache::lonmsg::user_normal_msg($env{'user.name'},$env{'user.domain'},$subject,$newusermsg); |
} |
} |
delete($env{'user.name'}); |
delete($env{'user.name'}); |
delete($env{'user.home'}); |
delete($env{'user.home'}); |
|
$env{'user.domain'} = $dom; |
} |
} |
} |
} |
} |
} |