--- loncom/enrollment/Enrollment.pm 2009/03/09 01:58:52 1.40 +++ loncom/enrollment/Enrollment.pm 2009/08/19 18:43:31 1.41 @@ -1,5 +1,5 @@ # Automated Enrollment manager -# $Id: Enrollment.pm,v 1.40 2009/03/09 01:58:52 weissno Exp $ +# $Id: Enrollment.pm,v 1.41 2009/08/19 18:43:31 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -540,16 +540,28 @@ sub create_newuser { } else { my $subject = &mt('New LON-CAPA account'); my $body; + my $portalurl = 'http://'.$ENV{'SERVER_NAME'}; + my $protocol = 'http'; + my $lonhost=&Apache::lonnet::domain($udom,'primary'); + if ($lonhost ne '') { + my $ip = &Apache::lonnet::get_host_ip($lonhost); + if ($Apache::lonnet::protocol{$lonhost} eq 'https') { + $protocol = 'https'; + } + if ($ip ne '') { + $portalurl = $protocol.'://'.$ip + } + } if ($context eq 'createowner') { - $body = &mt('A user account has been created for you while creating your new course in the LON-CAPA course management and online homework system.')."\n\n".&mt('You should log-in to the system using the following credentials:')."\n".&mt('username: ').$uname."\n".&mt('password: ').$authparam."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: ').'http://'.$ENV{'SERVER_NAME'}."\n\n"; + $body = &mt('A user account has been created for you while creating your new course in the LON-CAPA course management and online homework system.')."\n\n".&mt('You should log-in to the system using the following credentials:')."\n".&mt('username: ').$uname."\n".&mt('password: ').$authparam."\n\n".&mt('The URL you should use to access the LON-CAPA system at your institution is: ').$portalurl."\n\n"; } elsif ($context eq 'createcourse') { - $body = &mt('You have been assigned the role of [_1] in a new course: [_2] - [_3] in the LON-CAPA course management and online homework system.',$$longroles{$role},$$courseinfo{'description'},$$courseinfo{'inst_code'}).' '.&mt('As you did not have an existing user account in the system, one has been created for you.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: '),'http://'.$ENV{'SERVER_NAME'}."\n\n"; + $body = &mt('You have been assigned the role of [_1] in a new course: [_2] - [_3] in the LON-CAPA course management and online homework system.',$$longroles{$role},$$courseinfo{'description'},$$courseinfo{'inst_code'}).' '.&mt('As you did not have an existing user account in the system, one has been created for you.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your institution is: ').$portalurl."\n\n"; } else { my $access_start = 'immediately'; if ($start > 0) { $access_start = localtime($start) } - $body = &mt('You have been enrolled in the LON-CAPA system at your school, because you are a registered student in a class that is using the LON-CAPA couse management and online homework system.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your school is: ').'http://'.$ENV{'SERVER_NAME'}."\n\n".&mt('When you log-in you will be able to access the LON-CAPA course for [_1] - [_2] starting [_3].',$$courseinfo{'description'},$$courseinfo{'inst_code'},$access_start)."\n"; + $body = &mt('You have been enrolled in the LON-CAPA system at your institution, because you are a registered student in a class which is using the LON-CAPA couse management and online homework system.')."\n\n".&mt("You should log-in to the system using the following credentials:\nusername: [_1]\npassword: [_2]",$uname,$authparam)."\n\n".&mt('The URL you should use to access the LON-CAPA system at your institution is: ').$portalurl."\n\n".&mt('When you log-in you will be able to access the LON-CAPA course for [_1] - [_2] starting [_3].',$$courseinfo{'description'},$$courseinfo{'inst_code'},$access_start)."\n"; } &Apache::lonmsg::sendemail($emailaddr,$subject,$body); } @@ -621,14 +633,16 @@ sub execute_add { # Get the user's e-mail address if ($userenv{critnotification} =~ m/%40/) { unless ($emailenc eq $userenv{critnotification}) { - $$logmsg .= &mt('Current critical notification e-mail -- [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',$userenv{critnotification},$uname,$emailenc).$linefeed; + $$logmsg .= &mt('Current critical notification e-mail - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].', + $userenv{critnotification},$uname,$emailenc). + $linefeed; } } if ($userenv{notification} =~ m/%40/) { unless ($emailenc eq $userenv{notification}) { - $$logmsg .= &mt('Current standard notification e-mail -- [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{notification},$uname,$emailenc).$linefeed; + $$logmsg .= &mt('Current standard notification e-mail - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].', + $userenv{notification},$uname,$emailenc). + $linefeed; } } if ($userenv{permanentemail} =~ m/%40/) {