Diff for /loncom/enrollment/Enrollment.pm between versions 1.40 and 1.43

version 1.40, 2009/03/09 01:58:52 version 1.43, 2010/08/20 21:44:59
Line 92  sub update_LC { Line 92  sub update_LC {
     open(FILE,"<$$configvars{'lonTabDir'}.'/rolesplain.tab");      open(FILE,"<$$configvars{'lonTabDir'}.'/rolesplain.tab");
     my @rolesplain = <FILE>;      my @rolesplain = <FILE>;
     close(FILE);      close(FILE);
     foreach (@rolesplain) {      foreach my $item (@rolesplain) {
         if ($_ =~ /^(st|ta|ex|ad|in|cc):([\w\s]+)$/) {          if ($_ =~ /^(st|ta|ex|ad|in|cc|co):([\w\s]+):?([\w\s]*)/) {
             $longroles{$1} = $2;              if ($courseinfo{'type'} eq 'Community') {
                   unless($1 eq 'cc') {
                       $longroles{$1} = $3;
                   }
               } else {
                   unless($1 eq 'co') { 
                       $longroles{$1} = $2;
                   }
               }
         }          }
     }      }
   
Line 540  sub create_newuser { Line 548  sub create_newuser {
                 } else {                  } else {
                     my $subject = &mt('New LON-CAPA account');                      my $subject = &mt('New LON-CAPA account');
                     my $body;                      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') {                      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') {                      } 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 {                      } else {
                         my $access_start = 'immediately';                          my $access_start = 'immediately';
                         if ($start > 0) {                          if ($start > 0) {
                             $access_start = localtime($start)                              $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);                      &Apache::lonmsg::sendemail($emailaddr,$subject,$body);
                 }                  }
Line 621  sub execute_add { Line 641  sub execute_add {
 # Get the user's e-mail address  # Get the user's e-mail address
     if ($userenv{critnotification} =~ m/%40/) {      if ($userenv{critnotification} =~ m/%40/) {
         unless ($emailenc eq $userenv{critnotification}) {          unless ($emailenc eq $userenv{critnotification}) {
             $$logmsg .= &mt('Current critical notification e-mail              $$logmsg .= &mt('Current critical notification e-mail - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',
 - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',$userenv{critnotification},$uname,$emailenc).$linefeed;                             $userenv{critnotification},$uname,$emailenc).
                           $linefeed;
         }          }
     }      }
     if ($userenv{notification} =~ m/%40/) {      if ($userenv{notification} =~ m/%40/) {
         unless ($emailenc eq $userenv{notification}) {          unless ($emailenc eq $userenv{notification}) {
             $$logmsg .= &mt('Current standard notification e-mail              $$logmsg .= &mt('Current standard notification e-mail - [_1] for [_2] is different to e-mail address in institutional classlist - [_3].',
 - [_1] for [_2] is different to e-mail address in institutional classlist - [_3]',$userenv{notification},$uname,$emailenc).$linefeed;                              $userenv{notification},$uname,$emailenc).
                           $linefeed;
         }          }
     }      }
     if ($userenv{permanentemail} =~ m/%40/) {      if ($userenv{permanentemail} =~ m/%40/) {
Line 753  sub parse_classlist { Line 775  sub parse_classlist {
                  push @state, $tagname;                   push @state, $tagname;
                  if ("@state" eq "students student") {                   if ("@state" eq "students student") {
                      $uname = $attr->{username};                       $uname = $attr->{username};
                        $$studentsref{$uname}[ $$placeref{'groupID'} ] = $groupID;
                  }                   }
             }, "tagname, attr"],              }, "tagname, attr"],
          text_h =>           text_h =>
              [sub {               [sub {
                  my ($text) = @_;                   my ($text) = @_;
                  if ("@state" eq "students student groupID") {                   if ("@state" eq "students student startdate") {
                      $$studentsref{$uname}[ $$placeref{'groupID'} ] = $groupID;  
                  } elsif ("@state" eq "students student startdate") {  
                      my $start = $text;                       my $start = $text;
                      unless ($text eq '') {                       unless ($text eq '') {
                          $start = &process_date($text);                           $start = &process_date($text);

Removed from v.1.40  
changed lines
  Added in v.1.43


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>