Diff for /loncom/interface/lonpopulate.pm between versions 1.25 and 1.31

version 1.25, 2005/09/14 21:25:52 version 1.31, 2005/11/04 21:34:05
Line 485  ENDTWO Line 485  ENDTWO
                   </form>                    </form>
 ENDTWO  ENDTWO
   } elsif ($action eq "notify") {    } elsif ($action eq "notify") {
       my @notified = ();        my $notifycount = 0;
       if ($enrollvar{notifylist} =~ m/,/) {        my @notified = split(/,/,$enrollvar{notifylist});
           @notified = split/,/,$enrollvar{notifylist};  
       } else {  
           @notified = $enrollvar{notifylist};  
       }  
       my $notifycount = 0;        my $notifycount = 0;
       foreach  (@notified) {        foreach  (@notified) {
         unless ($_ eq '') { $notifycount ++; }     unless ($_ eq '') { $notifycount ++; } 
       }        }
       my $noteset = '';        my $noteset = '';
       if ($notifycount) {        if ($notifycount) {
Line 540  ENDTWO Line 536  ENDTWO
           my @roleinfo = split/:/,$_;            my @roleinfo = split/:/,$_;
           if ($roleinfo[0] eq 'cc')  {            if ($roleinfo[0] eq 'cc')  {
               unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) {                unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) {
                   my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc');                    my $active_cc = &Apache::loncommon::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc');
                   if ($active_cc eq 'ok') {                    if ($active_cc eq 'active') {
                       push @ccs, "$roleinfo[1]\@$roleinfo[2]";                        push @ccs, "$roleinfo[1]\@$roleinfo[2]";
                       $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]);                        $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]);
                       if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) {                        if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) {
Line 638  ENDTWO Line 634  ENDTWO
           </form>            </form>
       ");        ");
   } elsif ($action eq "crosslist") {    } elsif ($action eq "crosslist") {
       my @xlists = ();        my @xlists;
       if ($enrollvar{crosslistings} =~ m/,/) {        if ($enrollvar{crosslistings} ne '') {
           @xlists = split/,/,$enrollvar{crosslistings};    @xlists = split(/,/,$enrollvar{crosslistings});
       } elsif ($enrollvar{crosslistings} ne '') {  
           $xlists[0] = $enrollvar{crosslistings};  
       }        }
       my $cross_str = @xlists;        my $cross_str = @xlists;
       $r->print("        $r->print("
Line 671  ENDTWO Line 665  ENDTWO
           for (my $i=0; $i<@xlists; $i++) {            for (my $i=0; $i<@xlists; $i++) {
               my $xl = '&nbsp;';                my $xl = '&nbsp;';
               my $gp = '&nbsp;';                my $gp = '&nbsp;';
               if ($xlists[$i] =~ /(\w+):?(.*)$/) {                if ($xlists[$i] =~ /^([^:]+):?(.*)$/) {
                   $xl = $1;                    $xl = $1;
                   $gp = $2;                    $gp = $2;
               }                               }               
Line 723  ENDTWO Line 717  ENDTWO
   } elsif ($action eq "sections") {    } elsif ($action eq "sections") {
       my @sections = ();        my @sections = ();
       @sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode});        @sections = &Apache::lonnet::auto_get_sections($crs,$dom,$enrollvar{coursecode});
       my @storedsections = ();        my @storedsections = split(/,/,$enrollvar{sectionnums});
       my @currsections = ();        my @currsections = ();
       my %sec_id = ();        my %sec_id = ();
       if ($enrollvar{sectionnums} =~ m/,/) {  
           @storedsections = split/,/,$enrollvar{sectionnums};  
       } else {  
           $storedsections[0] = $enrollvar{sectionnums};  
       }  
       foreach (@storedsections) {        foreach (@storedsections) {
           if ($_ =~ m/^(\w+):(\w*)$/) {            if ($_ =~ m/^(\w+):(\w*)$/) {
               push @currsections, $1;                push @currsections, $1;
Line 1488  sub print_notify_response { Line 1477  sub print_notify_response {
     my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs);      my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs);
     my $notifylist = $settings{'internal.notifylist'};      my $notifylist = $settings{'internal.notifylist'};
     my $coursecode = $settings{'internal.coursecode'};      my $coursecode = $settings{'internal.coursecode'};
     my @currpeople = ();      my @currpeople = split(/,/,$notifylist);
     my $notify = 0;      my $notify = 0;
     my @people = ();      my @people = ();
     my $peoplestr = "";      my $peoplestr = "";
     my $response = "";      my $response = "";
     my $noprocess = 0;      my $noprocess = 0;
   
     if ($notifylist =~ m/,/) {  
  @currpeople = split/,/,$notifylist;  
     } else {  
  $currpeople[0] = $notifylist;  
     }  
     my $currcount = 0;      my $currcount = 0;
     foreach  (@currpeople) {      foreach  (@currpeople) {
  unless ($_ eq '') { $currcount ++; }    unless ($_ eq '') { $currcount ++; } 
Line 1574  sub print_crosslistings_menu () { Line 1558  sub print_crosslistings_menu () {
     my $xliststr = '';      my $xliststr = '';
     my $response = '';      my $response = '';
     my $coursecode = $settings{'internal.coursecode'};      my $coursecode = $settings{'internal.coursecode'};
     if ($settings{'internal.crosslistings'} =~ m/,/) {      if ($settings{'internal.crosslistings'} ne '') {
  @currxlists = split/,/,$settings{'internal.crosslistings'};   @currxlists = split(/,/,$settings{'internal.crosslistings'});
     } elsif ($settings{'internal.crosslistings'} ne '') {  
  $currxlists[0] = $settings{'internal.crosslistings'};  
     }      }
   
     if (@currxlists > 0) {      if (@currxlists > 0) {
Line 1600  sub print_crosslistings_menu () { Line 1582  sub print_crosslistings_menu () {
  }   }
     }      }
   
     if ($crosscount > 1) {      $xliststr = join(",",@xlists);
  $xliststr = join(",",@xlists);  
     } else {  
  $xliststr = $xlists[0];  
     }  
     my %cenv = ('internal.crosslistings' => $xliststr);      my %cenv = ('internal.crosslistings' => $xliststr);
     my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);      my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
     if ($reply !~ /^ok$/) {      if ($reply !~ /^ok$/) {
Line 1682  sub print_crosslistings_response () { Line 1661  sub print_crosslistings_response () {
     my $warning = '';      my $warning = '';
     my $warn_prefix = '';      my $warn_prefix = '';
   
     if ($xliststr =~ m/,/) {      if ($xliststr ne '') {
  @allxlists = split/,/,$xliststr;   @allxlists = split(/,/,$xliststr);
     } else {  
  unless ($xliststr eq '') { $allxlists[0] = $xliststr; }  
     }      }
   
     if ( exists($env{'form.numcross'}) ) {      if ( exists($env{'form.numcross'}) ) {
Line 1717  sub print_crosslistings_response () { Line 1694  sub print_crosslistings_response () {
           
     if (@xlists > 0 ) {      if (@xlists > 0 ) {
  unless ($xliststr eq '') { $xliststr .= ","; }   unless ($xliststr eq '') { $xliststr .= ","; }
  if (@xlists > 1) {   $xliststr .= join(",",@xlists);
     $xliststr .= join(",",@xlists);  
  } else {  
     $xliststr .= $xlists[0];  
  }  
  my %cenv = ('internal.crosslistings' => $xliststr);   my %cenv = ('internal.crosslistings' => $xliststr);
  my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
  if ($reply !~ /^ok$/) {   if ($reply !~ /^ok$/) {
Line 1736  sub print_crosslistings_response () { Line 1710  sub print_crosslistings_response () {
  }   }
     } else {      } else {
  if ($xliststr =~ m/:/) {   if ($xliststr =~ m/:/) {
     my @oldxlists = ();      my @oldxlists = (split/,/,$xliststr);
     if ($xliststr =~ m/,/) {  
  @oldxlists = split/,/,$xliststr;  
     } else {  
  $oldxlists[0] = $xliststr;  
     }  
     $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n";      $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n";
     foreach (@oldxlists) {      foreach (@oldxlists) {
  my ($xlist,$gp) = split/:/,$_;   my ($xlist,$gp) = split/:/,$_;
Line 1796  sub print_sections_menu () { Line 1765  sub print_sections_menu () {
     my $warn_prefix = "";      my $warn_prefix = "";
     my $coursecode = $settings{'internal.coursecode'};      my $coursecode = $settings{'internal.coursecode'};
     my $owner = $settings{'internal.courseowner'};      my $owner = $settings{'internal.courseowner'};
     if ($settings{'internal.sectionnums'} =~ m/,/) {      if ($settings{'internal.sectionnums'} ne '') {
  @currsections = split/,/,$settings{'internal.sectionnums'};   @currsections = split(/,/,$settings{'internal.sectionnums'});
     } elsif ($settings{'internal.sectionnums'} ne '') {  
  $currsections[0] = $settings{'internal.sectionnums'};  
     }      }
           
     if ( exists($env{'form.secshow'}) ) {      if ( exists($env{'form.secshow'}) ) {
Line 1866  sub print_sections_menu () { Line 1833  sub print_sections_menu () {
  }   }
     }      }
           
     if ($seccount > 1) {      $secstr = join(",",@sections);
  $secstr = join(",",@sections);  
     } else {  
  $secstr = $sections[0];  
     }  
     my %cenv = ('internal.sectionnums' => $secstr);      my %cenv = ('internal.sectionnums' => $secstr);
     my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);      my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
     if ($reply !~ /^ok$/) {      if ($reply !~ /^ok$/) {
Line 1980  sub print_sections_response () { Line 1944  sub print_sections_response () {
     my $putreply = '';      my $putreply = '';
     my $warning = '';      my $warning = '';
     my $warn_prefix = '';      my $warn_prefix = '';
     if ($secstr =~ m/,/) {      if ($secstr ne '') {
  @allsections = split/,/,$secstr;   @allsections = split(/,/,$secstr);
     } else {  
  unless ($secstr eq '') { $allsections[0] = $secstr; }  
     }      }
           
     if ( exists($env{'form.numsec'}) ) {      if ( exists($env{'form.numsec'}) ) {
Line 2016  sub print_sections_response () { Line 1978  sub print_sections_response () {
           
     if (@sections > 0 ) {      if (@sections > 0 ) {
  unless ($secstr eq '') { $secstr .= ","; }    unless ($secstr eq '') { $secstr .= ","; } 
  if (@sections > 1) {   $secstr .= join(",",@sections);
     $secstr .= join(",",@sections);  
  } else {  
     $secstr .= $sections[0];  
  }  
  my %cenv = ('internal.sectionnums' => $secstr);   my %cenv = ('internal.sectionnums' => $secstr);
  $putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);   $putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
  if ($putreply !~ /^ok$/) {   if ($putreply !~ /^ok$/) {
Line 2137  sub print_update_result () { Line 2095  sub print_update_result () {
  my @currsections = ();   my @currsections = ();
  my @currxlists = ();   my @currxlists = ();
   
  if ($settings{'internal.sectionnums'} =~ m/,/) {   if ($settings{'internal.sectionnums'} ne '') {
     @currsections = split/,/,$settings{'internal.sectionnums'};      @currsections = split(/,/,$settings{'internal.sectionnums'});
  } elsif ($settings{'internal.sectionnums'} ne '') {  
     $currsections[0] = $settings{'internal.sectionnums'};  
  }   }
   
  if ($settings{'internal.crosslistings'} =~ m/,/) {   if ($settings{'internal.crosslistings'} ne '') {
     @currxlists = split/,/,$settings{'internal.crosslistings'};      @currxlists = split(/,/,$settings{'internal.crosslistings'});
  } elsif ($settings{'internal.crosslistings'} ne '') {  
     $currxlists[0] = $settings{'internal.crosslistings'};  
  }   }
   
  if (@currxlists > 0) {   if (@currxlists > 0) {
Line 2222  sub print_viewclass_response { Line 2176  sub print_viewclass_response {
     my %otherdom = ();      my %otherdom = ();
     my %lockchg = ();      my %lockchg = ();
     my %nolockchg = ();      my %nolockchg = ();
     my $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);      my $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
     my $endidx = &Apache::loncoursedata::CL_END;      my $endidx = &Apache::loncoursedata::CL_END;
     my $startidx = &Apache::loncoursedata::CL_START;      my $startidx = &Apache::loncoursedata::CL_START;
     my $ididx=&Apache::loncoursedata::CL_ID;      my $ididx=&Apache::loncoursedata::CL_ID;
Line 2304  sub print_viewclass_response { Line 2258  sub print_viewclass_response {
     }      }
     if ($chgtotal > 0) {      if ($chgtotal > 0) {
         $response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n";          $response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n";
         $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);          $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($chgok > 0) {          if ($chgok > 0) {
             $response .= "The following $chgok changes were successful:<br />";              $response .= "The following $chgok changes were successful:<br />";
             $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);              $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
Line 2321  sub print_viewclass_response { Line 2275  sub print_viewclass_response {
     }      }
     if ($locktotal > 0) {      if ($locktotal > 0) {
         $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";          $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";
         $classlist = &Apache::loncoursedata::get_classlist($cid,$dom,$crs);          $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($lockok > 0) {          if ($lockok > 0) {
             $response .= "The following $lockok changes were successful:<br />";              $response .= "The following $lockok changes were successful:<br />";
             $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);              $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);

Removed from v.1.25  
changed lines
  Added in v.1.31


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