Diff for /loncom/enrollment/Enrollment.pm between versions 1.28 and 1.32

version 1.28, 2006/02/07 05:08:21 version 1.32, 2006/08/11 21:55:15
Line 27  package LONCAPA::Enrollment; Line 27  package LONCAPA::Enrollment;
   
 use Apache::loncoursedata;  use Apache::loncoursedata;
 use Apache::lonnet;  use Apache::lonnet;
   use Apache::loncommon();
 use Apache::lonmsg;  use Apache::lonmsg;
 use Apache::lonlocal;  use Apache::lonlocal;
 use HTML::Entities;  use HTML::Entities;
Line 326  sub update_LC { Line 327  sub update_LC {
                     } else {                      } else {
                         &execute_add($context,'newstudent',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);                          &execute_add($context,'newstudent',$uname,$dom,$auth,$authparam,$first,$middle,$last,$gene,$pid,$usec,$end,$start,$emailenc,$cid,\$addresult,\$enrollcount,$linefeed,$logmsg);
                     }                      }
                     if ($courseinfo{'showphotos'}) {                      if ($courseinfo{'showphoto'}) {
                         my ($result,$resulttype) =                           my ($result,$resulttype) = 
                            &Apache::lonnet::auto_checkphotos($uname,$dom,$pid);                             &Apache::lonnet::auto_checkphotos($uname,$dom,$pid);
                         if ($resulttype) {                          if ($resulttype) {
Line 337  sub update_LC { Line 338  sub update_LC {
             }              }
         }          }
     }      }
     if ($courseinfo{'showphotos'}) {      if ($courseinfo{'showphoto'}) {
         if (keys(%{$phototypes})>0) {          if (keys(%{$phototypes})>0) {
             my %lt = &photo_response_types();              my %lt = &photo_response_types();
             foreach my $type (sort(keys(%{$phototypes}))) {              foreach my $type (sort(keys(%{$phototypes}))) {
Line 345  sub update_LC { Line 346  sub update_LC {
                 if ($numphoto > 0) {                  if ($numphoto > 0) {
                     if ($context eq 'updatenow') {                      if ($context eq 'updatenow') {
                         $photoresult .=  '<br /><b>'.                          $photoresult .=  '<br /><b>'.
                                    &mt('For [_1] students, photos ',$numphoto).      &mt('For [_1] students, photos ',$numphoto).
                                                      $lt{$type}.'</b><ul><li>';      $lt{$type}.'</b><ul><li>';
                     } else {                      } else {
                         $photoresult .=  "\nFor $numphoto students, photos ".                          $photoresult .=  "\nFor $numphoto students, photos ".
                                                                $lt{$type}."\n";      $lt{$type}."\n";
                     }                      }
                     foreach my $user (@{$$phototypes{$type}}) {                       foreach my $user (@{$$phototypes{$type}}) { 
                         $photoresult .= $user.$linefeed;                          $photoresult .= $user.$linefeed;
                     }                      }
                     if ($context eq 'updatenow') {                      if ($context eq 'updatenow') {
                         $photoresult = substr($photoresult,0,                          $photoresult = substr($photoresult,0,
                                                   rindex($photoresult,"<li>"));        rindex($photoresult,"<li>"));
                         $photoresult .= '</ul><br />';                          $photoresult .= '</ul><br />';
                     } else {                      } else {
                         $photoresult .= "\n";                          $photoresult .= "\n";
Line 404  sub update_LC { Line 405  sub update_LC {
         if ($context eq "updatenow") {          if ($context eq "updatenow") {
             $addresult = substr($addresult,0,rindex($addresult,"<li>"));              $addresult = substr($addresult,0,rindex($addresult,"<li>"));
             $addresult = "The following $enrollcount student(s) was/were added to this LON-CAPA course:<br/><ul><li>".$addresult."</ul><br/><br/>";              $addresult = "The following $enrollcount student(s) was/were added to this LON-CAPA course:<br/><ul><li>".$addresult."</ul><br/><br/>";
             if ($courseinfo{'showphotos'}) {  
   
             }  
         } else {          } else {
             $addresult = "The following $enrollcount student(s) was/were added to this LON-CAPA course:\n\n".$addresult."\n\n";              $addresult = "The following $enrollcount student(s) was/were added to this LON-CAPA course:\n\n".$addresult."\n\n";
         }          }
Line 505  sub create_newuser { Line 503  sub create_newuser {
         if ($context eq 'createowner' || $context eq 'createcourse') {          if ($context eq 'createowner' || $context eq 'createcourse') {
             my $result = &Apache::lonnet::modifyuser($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,'1',undef,$emailaddr);              my $result = &Apache::lonnet::modifyuser($udom,$uname,$pid,$auth,$authparam,$first,$middle,$last,$gene,'1',undef,$emailaddr);
             if ($result eq 'ok' && $context eq 'createcourse') {              if ($result eq 'ok' && $context eq 'createcourse') {
                 $outcome = &Apache::loncreateuser::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec);                  $outcome = &Apache::loncommon::commit_standardrole($udom,$uname,$userurl,$role,$start,$end,$cdom,$crs,$usec);
                 unless ($outcome =~ /^Error:/) {                  unless ($outcome =~ /^Error:/) {
                     $outcome = 'ok';                      $outcome = 'ok';
                 }                  }
Line 829  sub get_courseinfo { Line 827  sub get_courseinfo {
     my ($dom,$crs,$courseinfo) = @_;      my ($dom,$crs,$courseinfo) = @_;
     my $owner;      my $owner;
     if (defined($dom) && defined($crs)) {      if (defined($dom) && defined($crs)) {
         my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.showphotos','description'],$dom,$crs);          my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.showphoto','description'],$dom,$crs);
         if ( defined($settings{'internal.coursecode'}) ) {          if ( defined($settings{'internal.coursecode'}) ) {
             $$courseinfo{'inst_code'} = $settings{'internal.coursecode'};              $$courseinfo{'inst_code'} = $settings{'internal.coursecode'};
         }          }
         if ( defined($settings{'description'}) ) {          if ( defined($settings{'description'}) ) {
             $$courseinfo{'description'} = $settings{'description'};              $$courseinfo{'description'} = $settings{'description'};
         }          }
         if ( defined($settings{'internal.showphotos'}) ) {          if ( defined($settings{'internal.showphoto'}) ) {
             $$courseinfo{'showphotos'} = $settings{'internal.showphotos'};              $$courseinfo{'showphoto'} = $settings{'internal.showphoto'};
         }          }
     }      }
     return;      return;
Line 856  sub CL_startdate { return 9; } Line 854  sub CL_startdate { return 9; }
 sub CL_studentID { return 10; }  sub CL_studentID { return 10; }
   
 sub photo_response_types {  sub photo_response_types {
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash(
                       'same' => 'remained unchanged',                        'same' => 'remained unchanged',
                       'update' => 'were updated',                        'update' => 'were updated',
                       'new' => 'were added',                        'new' => 'were added',
Line 864  sub photo_response_types { Line 862  sub photo_response_types {
                       'error' => 'were not imported because an error occurred',                        'error' => 'were not imported because an error occurred',
                       'nouser' => 'were for users without accounts',                        'nouser' => 'were for users without accounts',
                       'noid' => 'were for users without student IDs',                        'noid' => 'were for users without student IDs',
     );   );
     return %lt;      return %lt;
 }  }
   

Removed from v.1.28  
changed lines
  Added in v.1.32


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