Annotation of loncom/interface/lonpopulate.pm, revision 1.8

1.4       albertel    1: # automated enrollment configuration handler
1.8     ! raeburn     2: # $Id: lonpopulate.pm,v 1.7 2003/12/15 07:55:59 raeburn Exp $
1.4       albertel    3: #
                      4: # Copyright Michigan State University Board of Trustees
                      5: #
                      6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      7: #
                      8: # LON-CAPA is free software; you can redistribute it and/or modify
                      9: # it under the terms of the GNU General Public License as published by
                     10: # the Free Software Foundation; either version 2 of the License, or
                     11: # (at your option) any later version.
                     12: #
                     13: # LON-CAPA is distributed in the hope that it will be useful,
                     14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     16: # GNU General Public License for more details.
                     17: #
                     18: # You should have received a copy of the GNU General Public License
                     19: # along with LON-CAPA; if not, write to the Free Software
                     20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     21: #
                     22: # /home/httpd/html/adm/gpl.txt
                     23: #
                     24: # http://www.lon-capa.org/
                     25: #
1.1       raeburn    26: package Apache::lonpopulate;
                     27: 
                     28: use strict;
                     29: use lib qw(/home/httpd/lib/perl);
1.7       raeburn    30: use Apache::lonnet;
                     31: use Apache::loncommon;
                     32: use Apache::lonhtmlcommon;
1.3       albertel   33: use Apache::lonlocal;
1.1       raeburn    34: use Apache::Constants qw(:common :http REDIRECT);
                     35: use Time::Local;
1.7       raeburn    36: use LONCAPA::Enrollment;
1.1       raeburn    37: use localenroll;
                     38: 
                     39: ###############################################################
                     40: sub header {
                     41:     my $bodytag=&Apache::loncommon::bodytag('Classlist Manager');
                     42:     return(<<ENDHEAD);
                     43: <html>
                     44: <head>
                     45: <title>LON-CAPA Classlist Manager</title>
                     46: </head>
                     47: $bodytag
                     48: ENDHEAD
                     49: }
                     50: 
                     51: ###############################################################
                     52: 
                     53: sub choose_header {
                     54:     my $bodytag=&Apache::loncommon::bodytag('Classlist Manager');
                     55:     my $scripttag = qq|
                     56: <script language='javascript' type='text/javascript'>
                     57: <!--
                     58: function process(calling) {
                     59:  var checker = 1
                     60:  var rad1 = 0
                     61:  var rad2 = 0
                     62:  var formName = document.forms.enter
                     63:  formName.action.value = calling
                     64:  if (calling == "chgsettings") {
                     65:    for (var j=0; j<formName.autoadds.length; j++) {
                     66:        if (formName.autoadds[j].checked) {
                     67:            rad1 = 1
                     68:        }
                     69:    }
                     70:    for (var k=0; k<formName.autodrops.length; k++) {
                     71:        if (formName.autodrops[k].checked) {
                     72:            rad2 = 1
                     73:        }
                     74:    }
                     75:    if (rad1 == 0) {
                     76:        alert("You must check either 'Enable' or 'Disable' for nightly additions based on classlist changes")
                     77:        checker = 0
                     78:    }
                     79:    if (rad2 == 0) {
                     80:        alert("You must check either 'Enable' or 'Disable' for nightly removals based on classlist changes")
                     81:        checker = 0
                     82:    }
                     83:  }
                     84:  if (calling == "updatenow") {
                     85:      var enrolldis
                     86:      var unenrolldis
                     87:      for (var j=0; j<formName.updateadds.length; j++) {
                     88:          if (formName.updateadds[j].value == 0) {
                     89:              enrolldis = j
                     90:          }
                     91:          if (formName.updateadds[j].checked) {
                     92:              rad1 = 1
                     93:          }
                     94:      }
                     95:      for (var k=0; k<formName.updatedrops.length; k++) {
                     96:          if (formName.updatedrops[k].value == 0) {
                     97:              unenrolldis = k 
                     98:          }
                     99:          if (formName.updatedrops[k].checked) {
                    100:              rad2 = 1
                    101:          }
                    102:      }
                    103:      if (rad1 == 0) {
                    104:          alert("You must check either 'Enable' or 'Disable' for nightly additions based on classlist changes")
                    105:          checker = 0
                    106:      }
                    107:      if (rad2 == 0) {
                    108:          alert("You must check either 'Enable' or 'Disable' for nightly removals based on classlist changes")
                    109:          checker = 0
                    110:      }
                    111:      if (formName.updatedrops[unenrolldis].checked && formName.updateadds[enrolldis].checked ) {
                    112:          alert("You have checked 'Disable' for both addition and removal of students\\n in the Registrar's classlist but not in your LON-CAPA course.  \\nHence there is no update to carry out")
                    113:          checker = 0
                    114:      }
                    115:  }
                    116:  if (checker == 1) {  
                    117:      formName.submit();
                    118:  }
                    119: }
                    120: // End hiding -->
                    121: </script>
                    122: |;
                    123:     return(<<ENDHEAD);
                    124: <html>
                    125: <head>
                    126: <title>LON-CAPA Classlist Manager</title>
                    127: $scripttag
                    128: $bodytag
                    129: ENDHEAD
                    130: }
                    131: 
                    132: sub print_mainbox {
                    133:     my ($r,$tasklongref,$realm,$reply) = @_;
                    134:     my $action = "information";
                    135:     if ( exists($ENV{'form.action'}) ) {
                    136:         $action = $ENV{'form.action'};
                    137:     }
                    138:     my $page = '';
                    139:     if ($action eq "information") {
                    140:         $page = "<b>Automated Enrollment</b>";
                    141:     } else {
                    142:         $page =  '<a href="/adm/populate">Automated Enrollment</a>';
                    143:         if ($reply) {
                    144:             if ($action eq "newcross") {
                    145:                 $action = "crosslist";
                    146:             } elsif ($action eq "newsections") {
                    147:                 $action = "sections"; 
                    148:             }
                    149:             $page .= "-&gt; <a href=\"/adm/populate?action=$action\">".$$tasklongref{$action}."</a> -&gt; <b>result</b>";
                    150:         } else {
                    151:             $page .=  " -&gt; <b>".$$tasklongref{$action}."</b>"; 
                    152:         }
                    153:     }
                    154:     $r->print(<<ENDTHIS);
                    155: <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    156:  <tr>
                    157:   <td bgcolor="#CCCCFF"> 
                    158:    <font size="2"><a href="/adm/menu">$realm</a> -&gt; <a href="/adm/dropadd">Enrollment Manager</a> -&gt; $page</font><br/>
                    159:   </td>
                    160:   <td align="right" bgcolor="#CCCCFF" valign="top">
                    161:    <font size="+1">Automated Enrollment Manager&nbsp;</font>
                    162:   </td>
                    163:  </tr>
                    164: </table>
                    165: <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    166:  <tr>
                    167: ENDTHIS
                    168: }
                    169: 
                    170: sub print_navmenu {
                    171:     my ($r,$tasksref,$tasklongref) = @_;
                    172:     my $action = "information";
                    173:     if (exists($ENV{'form.action'}) ) {
                    174:         $action = $ENV{'form.action'};
                    175:     }
                    176:     $r->print(<<ENDONE);
                    177:   <td width="10" valign="top" bgcolor="#DDFFFF">&nbsp;</td>
                    178:   <td width="20%" valign="top" bgcolor="#DDFFFF">
                    179:    <br/>
                    180: ENDONE
                    181:     foreach my $task (@{$tasksref}) {
                    182:         if ($task eq $action) {
                    183:             $r->print(" 
                    184:    <p>
                    185:    <font color=\"#999999\">
                    186:     <b>$$tasklongref{$task}</b><br/>
                    187:    </font>
                    188:    </p>"); 
                    189:         } else {
                    190:             $r->print("
                    191:    <p>
                    192:    <font color=\"#004263\">
                    193:     <b><a href=\"/adm/populate?action=$task\">$$tasklongref{$task}</a></b><br/>
                    194:    </font> 
                    195:    </p>");
                    196: 
                    197:         }
                    198:     }
                    199:     $r->print("
                    200:   <p>&nbsp;</p>
                    201:   </td>
                    202:   <td width=\"10\" valign=\"top\" bgcolor=\"#CCCCFF\">&nbsp;</td>
                    203:   <td width=\"10\" valign=\"top\" bgcolor=\"#FFFFFF\">&nbsp;</td>
                    204:   <td bgcolor=\"#ffffff\" valign=\"top\">");
                    205: }
                    206: 
                    207: ###############################################################
                    208: 
                    209: sub print_main_frame {
                    210:   my ($r,$realm,$dom,$crs,$tasktitleref) = @_;
                    211:   my $action = "information";
                    212:   if (exists($ENV{'form.action'}) ) {
                    213:       $action = $ENV{'form.action'};
                    214:   }
                    215: 
                    216: # Get course settings
                    217:   my %enrollvar;
                    218:   my @bgcolors=("#eeeeee","#cccccc");
                    219:   my %settings = &Apache::lonnet::dump('environment',$dom,$crs);
                    220:   foreach my $item (keys %settings) {
                    221:       if ($item =~ m/^internal\.(.+)$/) {
                    222:           $enrollvar{$1} = $settings{$item};
                    223:       }
                    224:   }
                    225: 
                    226:   if ($action eq "information") {
                    227:       $r->print(<<ENDONE);
1.2       raeburn   228:           <br/><table border='0' width='100%'>
1.1       raeburn   229:             <tr>
                    230:               <td>&nbsp;</td>
                    231:               <td><b>Use the menu on the left to choose an enrollment management task.</b><br/><br/></td>
                    232:             <tr>
                    233:               <td>&nbsp;</td>
                    234:               <td>Use <i>"Automated adds/drops"</i> to enable or disable automatic nightly adds or drops in your LON-CAPA course based on instututional enrollment information.</td>
                    235:             </tr>
                    236:             <tr>
                    237:               <td>&nbsp;</td>
                    238:               <td>Use <i>"Change enrollment dates"</i> to change the date of first automated enrollment and/or the date of last automated enrollment for registered students.</td>
                    239:             </tr>
                    240:             <tr>
                    241:               <td>&nbsp;</td>
                    242:               <td>Use <i>"Notification of changes"</i> to enable or disable notification of enrollment changes and to add or remove course coordinators from the recipient list.</td>
                    243:             </tr>
                    244:             <tr>
                    245:               <td>&nbsp;</td>
                    246:               <td>Use <i>"Change crosslisting"</i> to include or exclude enrollment from crosslisted classes.</td>
                    247:             </tr>
                    248:             <tr>
                    249:               <td>&nbsp;</td>
                    250:               <td>Use <i>"Section settings"</i> to make changes to the choice of sections included for enrollment in your LON-CAPA course.</td>
                    251:             </tr>
                    252:               <td>&nbsp;</td>
1.2       raeburn   253:               <td>Use <i>"Student photos"</i> to enable or disable automatic upload of student photos to your course.</td>
1.1       raeburn   254:             </tr>
                    255:             <tr>
                    256:               <td>&nbsp;</td>
                    257:               <td>Use <i>"Update roster now"</i> to add and/or drop students from your course based on the <b>most current</b> institutional classlist information.</td>
                    258:             </tr>
                    259:             <tr>
                    260:              <td colspan='2'>&nbsp;</td>
                    261:             </tr>
                    262:             <tr>
                    263:              <td>&nbsp;</td>
                    264:              <td><b>Note: if automated adds and/or drops are enabled, the nightly enrollment update will ONLY occur once the first enrollment date has been reached.</b></td>
                    265:             </tr>
                    266:           </table>
                    267: ENDONE
                    268:   } elsif ($action eq "chgsettings") {
                    269:       my @autosets = ("OFF","ON");
                    270:       $r->print(<<ENDTWO);
                    271:                   <form name="enter" method="post"><br/>
                    272: 		  <table width="100%" border="0" cellpadding="2" cellspacing="2">
                    273: 		   <tr>
                    274: 		    <td align="left"><b>$$tasktitleref{$action}</b><br/>
                    275: 		       Currently: Nightly adds: <i>$autosets[$enrollvar{autoadds}]</i>, Nightly drops: <i>$autosets[$enrollvar{autodrops}]</i>
                    276: 		    </td>
                    277:                    </tr>
                    278: 		  </table>
                    279: 		  <table width="100%" border="0" cellpadding="3" cellspacing="3">
                    280: 		    <tr>
                    281: 		     <td>
                    282: 		         Additions based on classlist changes:&nbsp;&nbsp;
                    283: ENDTWO
                    284:       if ($enrollvar{autoadds}) {
                    285:           $r->print("
                    286: 			    <input type=\"radio\" name=\"autoadds\" value=\"1\" checked=\"true\" />&nbsp;Enable&nbsp;&nbsp;&nbsp;
                    287: 			    <input type=\"radio\" name=\"autoadds\" value=\"0\" />&nbsp;Disable
                    288:          ");
                    289:       } else {
                    290:           $r->print("
                    291:                             <input type=\"radio\" name=\"autoadds\" value=\"1\" />&nbsp;Enable&nbsp;&nbsp;&nbsp;
                    292:                             <input type=\"radio\" name=\"autoadds\" value=\"0\" checked=\"true\" />&nbsp;Disable
                    293:          ");
                    294:       }
                    295:       $r->print("
                    296:               </td>
                    297:              </tr>
                    298:              <tr>
                    299:               <td>
                    300:  	       Removals based on classlist changes:&nbsp;&nbsp;");
                    301:       if ($enrollvar{autodrops}) {
                    302:           $r->print("
                    303:                 <input type=\"radio\" name=\"autodrops\" value=\"1\" checked=\"true\" />&nbsp;Enable&nbsp;&nbsp;&nbsp;
                    304:                 <input type=\"radio\" name=\"autodrops\" value=\"0\" />&nbsp;Disable");
                    305:       } else {
                    306:           $r->print("
                    307:                 <input type=\"radio\" name=\"autodrops\" value=\"1\" />&nbsp;Enable&nbsp;&nbsp;&nbsp;
                    308:                 <input type=\"radio\" name=\"autodrops\" value=\"0\" checked=\"true\" />&nbsp;Disable");
                    309:       }
                    310:       $r->print("
                    311:               </td>
                    312:              </tr>
                    313:              <tr>
                    314:               <td>
                    315:                <font color=\"#888888\">
                    316: Note: Any students added manually by course coordinators using the Enrollment Manager will be unaffected by the nightly removal process if you choose to enable it.
                    317:                </font>
                    318:               </td>
                    319:              </tr>
                    320:              <tr>
                    321:               <td align=\"right\">
                    322:                <input type=\"button\" name=\"chgsettings\" value=\"Go\" onClick=\"process('chgsettings')\" />
                    323: 	      </td>
                    324:              </tr>
                    325: 	    </table>
                    326:             <input type=\"hidden\" name=\"action\" value=\"$action\">
                    327:             <input type=\"hidden\" name=\"state\" value=\"process\">
                    328:             </form>
                    329:       ");
                    330:   } elsif ($action eq "setdates") {
                    331:       my ($start_table,$end_table) = &date_setting_table($enrollvar{autostart},$enrollvar{autoend});
                    332:       my $oldstartshow = localtime($enrollvar{autostart});
                    333:       my $oldendshow = localtime($enrollvar{autoend});
                    334:       if ($enrollvar{autoend} == 0) {
                    335:           $oldendshow = "No ending date";
                    336:       }
                    337:       $r->print(<<ENDTWO);
                    338:                   <form name="enter" method="post"><br/>              
                    339:                   <table width="100%" border="0" cellpadding="2" cellspacing="2">
                    340: 	           <tr>
                    341: 	            <td align="left"><b>$$tasktitleref{$action}</b><br/>
                    342: 	             Currently: First enrollment: <i>$oldstartshow</i>, Last enrollment: <i>$oldendshow</i>
                    343: 	            </td>
                    344:                    </tr>
                    345: 	          </table>
                    346:                   <table width="100%" border="0" cellpadding="3" cellspacing="3">
                    347:                    <tr>
                    348:                     <td align="left" colspan="2">
                    349:                      <table border="0" cellspacing="0" cellpadding="2">
                    350:                       <tr>
                    351:                        <td colspan="3">
                    352:                         <i>Set date of first automated enrollment for registered students</i>
                    353:                        </td>
                    354:                       </tr>
                    355:                       <tr>
                    356:                        <td>$start_table
                    357:                        </td>
                    358:                       </tr>
                    359:                      </table>
                    360:                     </td>
                    361:                    </tr>
                    362:                    <tr>
                    363:                     <td colspan="2"><font color="#888888">If automated adds and/or drops are enabled, then your class roster will be automatically updated nightly, once the first enrollment date has been reached. Prior to this date, the class roster will only contain students you have added directly using the standard LON-CAPA enrollment tools</font></td>
                    364:                    </tr>
                    365:                    <tr>
                    366:                     <td align="left" colspan="2">
                    367:                      <table border="0' cellspacing="0" cellpadding="2">
                    368:                       <tr>
                    369:                        <td colspan="3">
                    370:                         <i>Set date of last automated enrollment for registered students</i>
                    371:                        </td>
                    372:                       </tr>
                    373:                       <tr>
                    374:                        <td>$end_table
                    375:                        </td>
                    376:                       </tr>
                    377:                      </table>
                    378:                     </td>
                    379:                    </tr>
                    380:                    <tr>
                    381:                     <td colspan="2"><font color="#888888">If automated adds and/or drops are enabled, then your class roster will be automatically updated nightly, until the last enrollment date has been reached.</font></td>
                    382:                    </tr>
                    383:                   </table>
                    384:                   <table width="100%">
                    385:                    <tr>
                    386:                     <td align="right">
                    387:                       <input type="button" name="setdates" value="Go" onClick="process('setdates')" />
                    388:                     </td>
                    389: 	           </tr>
                    390:                   </table>
                    391:                   <input type=\"hidden\" name=\"action\" value=\"$action\">
                    392:                   <input type=\"hidden\" name=\"state\" value=\"process\">
                    393:                   </form>
                    394: ENDTWO
                    395:   } elsif ($action eq "notify") {
                    396:       my @notified = ();
                    397:       if ($enrollvar{notifylist} =~ m/,/) {
                    398:           @notified = split/,/,$enrollvar{notifylist};
                    399:       } else {
                    400:           @notified = $enrollvar{notifylist};
                    401:       }
                    402:       my $notifycount = 0;
                    403:       foreach  (@notified) {
                    404:         unless ($_ eq '') { $notifycount ++; } 
                    405:       }
                    406:       my $noteset = '';
                    407:       if ($notifycount) {
                    408:           $noteset = "ON";
                    409:       } else {
                    410:           $noteset = "OFF";
                    411:       }
                    412:     
                    413:       $r->print("
                    414:                   <form name=\"enter\" method=\"post\"><br/>
                    415:                    <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">
                    416:                     <tr>
                    417:                      <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
                    418:                       Currently: Notification: $noteset
                    419:                      </td>
                    420:                     </tr>
                    421:                    </table>
                    422:                    <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    423:                     <tr>
                    424:                      <td>
                    425:                       Notification of LON-CAPA course roster changes resulting from nightly automated enrollment process?
                    426:       ");
                    427:       if ($notifycount) {
                    428:           $r->print("
                    429:                         <input type=\"radio\" name=\"notify\" value=\"1\" checked=\"true\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;
                    430:                         <input type=\"radio\" name=\"notify\" value=\"0\" />&nbsp;No
                    431:           ");
                    432:       } else {
                    433:           $r->print("
                    434:                         <input type=\"radio\" name=\"notify\" value=\"1\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;
                    435:                         <input type=\"radio\" name=\"notify\" value=\"0\" checked=\"true\" />&nbsp;No
                    436:           ");
                    437:       }
                    438:       $r->print("
                    439:               </td>
                    440:              </tr>
                    441:       ");
1.7       raeburn   442:       my @coursepersonnel = &Apache::lonnet::getkeys('nohist_userroles',$dom,$crs);
                    443:       my @ccs = ();
                    444:       my @oldccs = ();
                    445:       my %pname = ();
                    446:       my %notifystate = ();
                    447:       foreach (@coursepersonnel) {
                    448:           my @roleinfo = split/:/,$_;
                    449:           if ($roleinfo[0] eq 'cc')  {
                    450:               unless (grep/^$roleinfo[1]\@$roleinfo[2]/,@ccs) {
                    451:                   my $active_cc = &LONCAPA::Enrollment::check_user_status($roleinfo[2],$roleinfo[1],$dom,$crs,'cc');
                    452:                   if ($active_cc eq 'ok') {
                    453:                       push @ccs, "$roleinfo[1]\@$roleinfo[2]";
                    454:                       $pname{"$roleinfo[1]\@$roleinfo[2]"} = &Apache::loncommon::plainname($roleinfo[1],$roleinfo[2]);
                    455:                       if (grep/^$roleinfo[1]\@$roleinfo[2]$/,@notified) {
                    456:                           $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 1;
                    457:                       } else {
                    458:                           $notifystate{"$roleinfo[1]\@$roleinfo[2]"} = 0;
                    459:                       }
1.1       raeburn   460:                   } else {
1.7       raeburn   461:                       push @oldccs, "$roleinfo[1]\@$roleinfo[2]";
1.1       raeburn   462:                   }
                    463:               }
                    464:           }
                    465:       }
1.7       raeburn   466:       if ($notifycount > 0) {
                    467:           foreach my $person (@notified) {
                    468:               unless ( (grep/^$person$/,@ccs) || ($person eq '') || (grep/^$person$/,@oldccs) ) {
                    469:                   push @ccs, $person;
                    470:                   my ($puname,$pdom) = split/\@/,$person;
                    471:                   $pname{$person} =  &Apache::loncommon::plainname($puname,$pdom);
                    472:                   $notifystate{$person} = 1;
                    473:               }
                    474:           }
                    475:       }
                    476:       my $viewer = $ENV{'user.name'}.'@'.$ENV{'user.domain'};
                    477:       unless ( (grep/^$viewer$/,@ccs) || ($viewer eq '') )  {
                    478:           push @ccs,$viewer;
                    479:           $pname{$viewer} =  &Apache::loncommon::plainname($ENV{'user.name'},$ENV{'user.domain'});
                    480:           $notifystate{$viewer} = 0;
                    481:       }
                    482: 
                    483:       my $notifyshow = @ccs;
                    484: 
                    485:       if (@ccs > 0) {
                    486:           @ccs = sort @ccs;
1.1       raeburn   487:           $r->print("
                    488:              <tr>
1.7       raeburn   489:                <td>The table below contains a list of course coordinators in this course. Uncheck the 'Notification?' checkbox for each person who is to be removed from the list of recipients who are currently informed of roster changes whenever any adds or drops occur during the nightly enrollment check. To include individuals who are not currently recipients, simply check the 'Notification?' checkbox. Click 'Go' to store your changes.
1.1       raeburn   490:               </td>
                    491:              </tr>
                    492:              <tr>
                    493:               <td>
1.7       raeburn   494:                <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    495:                 <tr bgcolor=\"#CCCCFF\">
                    496:                  <td><b>Name</b></td>
                    497:                  <td><b>username</b></td>
                    498:                  <td><b>Current status</b></td>
                    499:                  <td><b>Notification?</b></td>
                    500:                 </tr>
                    501:           ");
                    502:           for (my $i=0; $i<@ccs; $i++) {
                    503:               my $colflag = $i%2;
                    504:               $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
                    505:                  <td>$pname{$ccs[$i]}</td>
                    506:                  <td><input type=\"hidden\" name=\"notifyname_$i\" value=\"$ccs[$i]\" />$ccs[$i]</td>
                    507:                  <td>
                    508:               ");
                    509:               if ($notifystate{$ccs[$i]} == 1) {
                    510:                   $r->print("Notification active");
                    511:               } else {
                    512:                   $r->print("Notification inactive");
                    513:               }
                    514:               if ($notifystate{$ccs[$i]} == 1) {
                    515:                   $r->print("</td><td><input type=\"checkbox\" name=\"note_$i\" checked=\"true\" /></td></tr>");
                    516:               } else {
                    517:                   $r->print("</td><td><input type=\"checkbox\" name=\"note_$i\" /></td></tr>");
                    518:               }
                    519:           }
                    520:           $r->print("
                    521:                </table>
                    522:                <br/>
                    523:                <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
                    524:                 <tr>
                    525:                  <td align=\"right\">
                    526:                   <input type=\"button\" name=\"notifyset\" value=\"Go\" onClick=\"process('notify')\" />
                    527:                  </td>
                    528:                 </tr>
                    529:                </table>
                    530:               </td>
                    531:              </tr>
1.1       raeburn   532:           ");
1.7       raeburn   533:       } else {
1.1       raeburn   534:           $r->print("
1.7       raeburn   535:              <tr>
                    536:               <td>
                    537:              No course coordinators found.
1.1       raeburn   538:             </td>
1.7       raeburn   539:            </tr>");
1.1       raeburn   540:       }
                    541:       $r->print("
1.7       raeburn   542:           </table>
                    543:           <input type=\"hidden\" name=\"notifyshow\" value=\"$notifyshow\">
                    544:           <input type=\"hidden\" name=\"action\" value=\"$action\">
                    545:           <input type=\"hidden\" name=\"state\" value=\"process\">
                    546:           </form>
1.1       raeburn   547:       ");
                    548:   } elsif ($action eq "crosslist") {
                    549:       my @xlists = ();
                    550:       if ($enrollvar{crosslistings} =~ m/,/) {
                    551:           @xlists = split/,/,$enrollvar{crosslistings};
                    552:       } elsif ($enrollvar{crosslistings} ne '') {
                    553:           $xlists[0] = $enrollvar{crosslistings};
                    554:       }
                    555:       my $cross_str = @xlists;
                    556:       $r->print("
                    557:             <form name=\"enter\" method=\"post\"><br/>
                    558:             <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
                    559:              <tr>
                    560:               <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
                    561:       ");
                    562:       if ($cross_str > 0) {
                    563:           $r->print("
1.7       raeburn   564:                 Currently, this LON-CAPA course is crosslisted with $cross_str course section(s).  Students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.  For each crosslisting, leave the checkbox checked if you want registered students in that course to be included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise uncheck it. If you wish to change the section/group ID assigned in your LON-CAPA course for a crosslisted course, enter the new section/group ID in the appropriate textbox. The LON-CAPA section/group ID can be left (or set to) empty, if you do not wish to tie a section/group ID to this crosslisting. If you wish to add new crosslisted courses, enter the number of new courses to add in the textbox at the bottom of the page. You will provide information about each of the new crosslistings on a subsequent page.  Click 'Go' to store your changes.
1.1       raeburn   565:               </td>
                    566:              </tr>
                    567:             </table>
                    568:             <br/>
                    569:             <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    570:              <tr>
                    571:               <td>
                    572:                <table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">
                    573:                 <tr bgcolor=\"#CCCCFF\" align=\"left\">
                    574:                  <td><b>Enrollment?</b></td>
                    575:                  <td><b>Crosslisted course</b></td>
                    576:                  <td><b>LON-CAPA section/groupID</b></td>
                    577:                 </tr>
                    578:           ");
                    579:           for (my $i=0; $i<@xlists; $i++) {
                    580:               my $xl = '&nbsp;';
                    581:               my $gp = '&nbsp;';
                    582:               if ($xlists[$i] =~ /(\w+):(.+)$/) {
                    583:                   $xl = $1;
                    584:                   $gp = $2;
                    585:               }               
                    586:               my $colflag = $i%2;
                    587:               $r->print("
                    588:                 <tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
                    589:                  <td><input type=\"checkbox\" name=\"cross_$i\" checked=\"true\"/></td>
                    590:                  <td>$xl</td>
                    591:                  <td><input type =\"text\" size=\"10\" name=\"gp_$i\" value=\"$gp\"></td>
                    592:                 </tr> 
                    593:               ");
                    594:           }
                    595:           $r->print("  </table>
                    596:               </td>
                    597:              </tr>
                    598:             </table>
                    599:           ");
                    600:       }
                    601:       else {
                    602:           $r->print("
                    603:                 Currently no crosslisted courses are recorded for $enrollvar{coursecode}.
                    604:               </td>
                    605:              </tr>
                    606:             </table>
                    607:           ");
                    608:       }
                    609:       $r->print("   
                    610:             <br/>
                    611:             <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    612:              <tr>
                    613:               <td align=\"left\">
                    614:                <b>Add new crosslistings.</b><br/>
                    615:                Number of new crosslistings to add:&nbsp;&nbsp;<input type=\"text\" size=\"2\" name=\"numcross\" value=\"0\" />
                    616:               </td>
                    617:              </tr>
                    618:             </table>
                    619:             <br/>
                    620:             <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
                    621:              <tr>
                    622:               <td align=\"right\">
                    623:                <input type=\"button\" name=\"crosslist\" value=\"Go\" onClick=\"process('crosslist')\" />
                    624:               </td>
                    625:              </tr>
                    626:             </table>
                    627:             <input type=\"hidden\" name=\"action\" value=\"$action\">
                    628:             <input type=\"hidden\" name=\"state\" value=\"process\">
                    629:             </form> 
                    630:       ");
                    631:   } elsif ($action eq "sections") {
                    632:       my @sections = &localenroll::get_sections($enrollvar{coursecode});
                    633:       my @storedsections = ();
                    634:       my @currsections = ();
                    635:       my %sec_id = ();
                    636:       if ($enrollvar{sectionnums} =~ m/,/) {
                    637:           @storedsections = split/,/,$enrollvar{sectionnums};
                    638:       } else {
                    639:           $storedsections[0] = $enrollvar{sectionnums};
                    640:       }
                    641:       foreach (@storedsections) {
                    642:           if ($_ =~ m/^(\w+):(\w*)$/) {
                    643:               push @currsections, $1;
                    644:               $sec_id{$1} = $2;
                    645:           }
                    646:       }
                    647:       if (@sections > 0) {
1.8     ! raeburn   648:           my $secshow = @sections;
        !           649:           $r->print("
1.1       raeburn   650:             <form name=\"enter\" method=\"post\"><br/>
                    651:             <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    652:              <tr>
                    653:               <td align=\"left\">
                    654:                <b>$$tasktitleref{$action}</b><br/>
                    655:                Your institution's course catalog includes $secshow sections for course code: $enrollvar{coursecode}.
                    656:               </td>
                    657:              </tr>
                    658:              <tr>
1.5       raeburn   659:               <td>For each section, check the checkbox if you want registered students in that section to be included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise uncheck it. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/group textbox and enter the new value. The LON-CAPA section/group ID can be left (or set to) empty, if you do not wish to tie a section/group ID to this section. To add a new section, check the 'Enrollment in this course?' checkbox, and enter the desired LON-CAPA section/groupID in the appropriate textbox. Click 'Go' to store
                    660: your changes.</td>
1.1       raeburn   661:              </tr>
                    662:             </table>
                    663:             <br/>
1.7       raeburn   664:             <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    665:              <tr bgcolor=\"#CCCCFF\">
                    666:               <td><b>Section</b></td>
                    667:               <td><b>Current status</b></td>              
                    668:               <td><b>LON-CAPA section/group ID</b></td>
                    669:               <td><b>Enrollment in this course?</b></td>
                    670:              </tr>
1.8     ! raeburn   671:           ");
        !           672:           for (my $i=0; $i<@sections; $i++) {
        !           673:               my $colflag = $i%2;
        !           674:               my $shrflag = 0;
        !           675:               $r->print("<tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
1.5       raeburn   676:                    <td>$sections[$i]<input type=\"hidden\" name=\"secnum_$i\" value=\"$sections[$i]\" /></td>
1.1       raeburn   677:                    <td>
1.8     ! raeburn   678:               ");
        !           679:               if (grep/^$sections[$i]$/,@currsections) {
        !           680:                   $r->print("Enrollment active");
        !           681:                   $shrflag = 1;
        !           682:               } else {
        !           683:                   $r->print("Enrollment inactive");
        !           684:               }
        !           685:               if ($shrflag) {
        !           686:                   $r->print("</td><td><input type=\"text\" size=\"10\" name=\"loncapasec_$i\" value=\"$sec_id{$sections[$i]}\"></td><td><input type=\"checkbox\" name=\"sec_$i\" checked=\"true\" /></td></tr>"); 
        !           687:               } else {
        !           688:                   $r->print("</td><td><input type=\"text\" size=\"10\" name=\"loncapasec_$i\" value=\"\"><td><input type=\"checkbox\" name=\"sec_$i\" /></td></tr>");
1.1       raeburn   689:               }
1.8     ! raeburn   690:           }
        !           691:           $r->print("
1.7       raeburn   692:             </table>
                    693:             <br/>
                    694:             <table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">
                    695:              <tr> 
                    696:               <td align=\"right\">
                    697:                <input type=\"hidden\" name=\"secshow\" value=\"$secshow\" />
                    698:                <input type=\"button\" name=\"sections\" value=\"Go\" onClick=\"process('sections')\" />
                    699:               </td>
                    700:              </tr>
                    701:             </table>
                    702:             <input type=\"hidden\" name=\"action\" value=\"$action\">
                    703:             <input type=\"hidden\" name=\"state\" value=\"process\">
                    704:             </form>
1.8     ! raeburn   705:           ");
1.1       raeburn   706:       } else {
                    707:           $r->print("
                    708:             <form name=\"enter\" method=\"post\"><br/>
                    709:             <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
                    710:              <tr>
                    711:               <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
                    712:           ");
                    713:           if (@currsections) {
                    714:               my $secshow = @currsections;
                    715:               $r->print("
1.7       raeburn   716:                 Currently, this LON-CAPA course incorporates enrollment from $secshow sections.  Students enrolling in any of these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update. For each section, uncheck the checkbox if you want registered students in that section to cease being included in the student roster for LON-CAPA course: <b>$realm ($enrollvar{coursecode})</b>; otherwise leave it checked. If you want to change the section/group designation used for this section in LON-CAPA, delete the current value in the LON-CAPA section/groupID textbox and enter the new value.  If you wish to add new course section, enter the number of new sections to add in the textbox at the bottom of the page. You will provide information about each of the new sections on a subsequent page. Click 'Go' to store your changes.
1.1       raeburn   717:               </td>
                    718:              </tr>
                    719:             </table>
                    720:             <br/>
                    721:             <table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    722:              <tr>
                    723:               <td>
                    724:                <table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">
                    725:                 <tr bgcolor=\"#CCCCFF\">
                    726:                  <td><b>Enrollment?</b></td>
                    727:                  <td><b>Section</b></td>
                    728:                  <td><b>LON-CAPA section/groupID</b></td>
                    729:                 </tr>
                    730:               ");
                    731:               for (my $j=0; $j<@currsections; $j++) {
                    732:                   my $colflag = $j%2;
                    733:                   $r->print("
                    734:                 <tr bgcolor=\"$bgcolors[$colflag]\" align=\"left\">
                    735:                  <td><input type=\"checkbox\" name=\"sec_$j\" checked=\"true\"/></td>
                    736:                  <td>$currsections[$j]</td>
                    737:                  <td><input type=\"text\" name=\"secgp_$j\" size=\"10\" value=\"$sec_id{$currsections[$j]}\"></td>
                    738:                 </tr> 
                    739:                   ");
                    740:               }
                    741:               $r->print("  </table>
                    742:               </td>
                    743:              </tr>
                    744:             </table>
                    745:               ");
                    746:           } else {
                    747:               $r->print("
                    748:                 Currently no sections of $realm ($enrollvar{coursecode}) are contributing enrollment to the LON-CAPA class roster.
                    749:               </td>
                    750:              </tr>
                    751:             </table>
                    752:               ");
                    753:           }
                    754:           $r->print("   
                    755:             <br/>
                    756:             <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    757:              <tr>
                    758:               <td align=\"left\">
                    759:                <b>Add enrollment from additional sections.</b><br/>
                    760:                Number of new sections to add:&nbsp;&nbsp;<input type=\"text\" size=\"2\" name=\"numsec\" value=\"0\" />
                    761:               </td>
                    762:              </tr>
                    763:             </table>
                    764:             <br/>
                    765:             <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
                    766:              <tr>
                    767:               <td align=\"right\">
                    768:                <input type=\"button\" name=\"sections\" value=\"Go\" onClick=\"process('sections')\" />
                    769:               </td>
                    770:              </tr>
                    771:             </table>
                    772:             <input type=\"hidden\" name=\"action\" value=\"$action\">
                    773:             <input type=\"hidden\" name=\"state\" value=\"process\">
                    774:             </form> 
                    775:           ");
                    776:       }
                    777:   } elsif ($action eq "photos") {
                    778:       my @photosets = ("OFF","ON");
                    779:       $r->print("
                    780:                   <form name=\"enter\" method=\"post\"><br/>
                    781:                   <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
                    782:                    <tr>
                    783:                     <td align=\"left\"><b>$$tasktitleref{$action}</b><br/>
                    784:                        Currently: Student photo import:  <i>$photosets[$enrollvar{showphotos}]</i>
                    785:                     </td>
                    786:                    </tr>
                    787:                   </table>
                    788:                   <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    789:                     <tr>
                    790:                      <td>
                    791:                          Automatic import of student photos from institutional data repository:&nbsp;&nbsp;
                    792: 
                    793:       ");
                    794:       if ($enrollvar{showphotos}) {
                    795:           $r->print("
                    796:                         <input type=\"radio\" name=\"showphotos\" value=\"1\" checked=\"true\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;
                    797:                         <input type=\"radio\" name=\"showphotos\" value=\"0\" />&nbsp;No
                    798:           ");
                    799:       } else {
                    800:           $r->print("
                    801:                         <input type=\"radio\" name=\"showphotos\" value=\"1\" />&nbsp;Yes&nbsp;&nbsp;&nbsp;
                    802:                         <input type=\"radio\" name=\"showphotos\" value=\"0\" checked=\"true\" />&nbsp;No
                    803:           ");
                    804:       }
                    805:       $r->print("
                    806:                      </td>
                    807:                     </tr>
                    808:                     <tr>
                    809:                      <td>
                    810:                       <font color=\"#888888\">
                    811: Note: if you enable automatic import of student photos, your course will automatically have access to photos stored by your institution for all officially registered students, via a conduit established by your LON-CAPA domain coordinator.  
                    812:                       </font>
                    813:                      </td>
                    814:                     </tr>
                    815:                     <tr>
                    816:                      </td>&nbsp;</td>
                    817:                     </tr>
                    818:                     <tr>
                    819:                      <td align=\"right\">
                    820:                       <input type=\"button\" name=\"showphotos\" value=\"Go\" onClick=\"process('photos')\">
                    821:                      </td>
                    822:                     </tr>
                    823:                    </table>
                    824:                    <input type=\"hidden\" name=\"action\" value=\"$action\">
                    825:                    <input type=\"hidden\" name=\"state\" value=\"process\">
                    826:                    </form>
                    827:       ");
                    828:   } elsif ($action eq "updatenow") {
                    829:       $r->print("
                    830:                    <form name=\"enter\" method=\"post\"><br/>
                    831: 		   <table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
                    832: 		    <tr>
                    833: 		     <td align=\"left\"><b>$$tasktitleref{$action}</b>
                    834: 		     </td>
                    835:                     </tr>
                    836: 		   </table>
                    837: 		   <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\">
                    838: 		    <tr>
                    839: 		     <td>
                    840: 	              Add any students currently included in institutional classlist(s) but not enrolled in your LON-CAPA course. 
                    841: 		      <input type=\"radio\" name=\"updateadds\" value=\"1\">&nbsp;Yes&nbsp;
                    842: 		      <input type=\"radio\" name=\"updateadds\" value=\"0\">&nbsp;No&nbsp;
                    843:                      </td>
                    844:                     </tr>
                    845:                     <tr>
                    846:                      <td>
                    847:  	              Expire students previously added by nightly enrollment process, but no longer listed in institutional  classlist(s).                  
                    848:                 <input type=\"radio\" name=\"updatedrops\" value=\"1\">&nbsp;Yes&nbsp;
                    849:                 <input type=\"radio\" name=\"updatedrops\" value=\"0\">&nbsp;No&nbsp;<br/>
                    850:               </td>
                    851:              </tr>
                    852:              <tr>
                    853:               <td>
                    854:                <font color=\"#888888\">
                    855: Note: Any students previously added manually by course coordinator(s) using either 'Upload classlist CSV file' or 'Enroll a single user' will be unaffected by the removal process.
                    856:                </font>
                    857:               </td>
                    858:              </tr>
                    859:              <tr>
                    860:               <td align=\"right\">
                    861:                <input type=\"button\" name=\"updatenow\" value=\"Go\" onClick=\"process('updatenow')\">
                    862:               </td>
                    863:              </tr>
                    864: 	    </table>
                    865:             <input type=\"hidden\" name=\"action\" value=\"$action\">
                    866:             <input type=\"hidden\" name=\"state\" value=\"process\">
                    867:             </form>
                    868:       ");
                    869:   }
                    870: }
                    871: 
                    872: ###############################################################
                    873: sub print_doc_base {
                    874:   my $r = shift;
                    875:   $r->print(<<ENDBASE);
                    876:   </td>
                    877:  </tr>
                    878: </table>
                    879: <br/>
                    880: </body>
                    881: </html> 
                    882: ENDBASE
                    883: }
                    884:  
                    885: ###################################################################
                    886: sub print_chgsettings_response {
                    887:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                    888:   my %settings = &Apache::lonnet::get('environment',['internal.autoadds','internal.autodrops'],$dom,$crs);
                    889:   my $curradds = $settings{'internal.autoadds'};
                    890:   my $currdrops = $settings{'internal.autodrops'};
                    891:   my $autoadds = '';
                    892:   my $autodrops = '';
                    893: 
                    894:   if ( exists($ENV{'form.autoadds'}) ) {
                    895:       $autoadds=$ENV{'form.autoadds'};
                    896:   }
                    897:   if ( exists($ENV{'form.autodrops'}) ) {
                    898:       $autodrops=$ENV{'form.autodrops'};
                    899:   }
                    900: 
                    901:   my $response = "";
                    902:   my %cenv = ('internal.autoadds' => $autoadds,
                    903:               'internal.autodrops' => $autodrops);
                    904:   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                    905:   if ($reply !~ /^ok$/) {
                    906:        $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
                    907:   } else {
                    908:       if ($autoadds) {
                    909:           if ($curradds) {
                    910:               $response = "Nightly additions based on classlist changes still <b>enabled</b><br/>";
                    911:           } else {
                    912:               $response = "Nightly additions based on classlist changes now <b>enabled</b><br/>";
                    913:           } 
                    914:       } else {
                    915:           if ($curradds) {
                    916:               $response = "Nightly additions based on classlist changes now <b>disabled</b><br/>";
                    917:           } else {
                    918:               $response = "Nightly additions based on classlist changes still <b>disabled</b><br/>";
                    919:           }
                    920:       }
                    921:       if ($autodrops) {
                    922:           if ($currdrops) {
                    923:               $response .= "Nightly removals based on classlist changes still <b>enabled</b><br>";
                    924:           } else {
                    925:               $response .= "Nightly removals based on classlist changes now <b>enabled</b><br/>";
                    926:           }
                    927:       } else {
                    928:           if ($currdrops) {
                    929:               $response .= "Nightly removals based on classlist changes now <b>disabled</b><br>";
                    930:           } else {
                    931:               $response .= "Nightly removals based on classlist changes still <b>disabled</b>";
                    932:           }
                    933:       }
                    934:   }
                    935:   &print_reply($r,$response,$$tasktitleref{$action});
                    936:   return;
                    937: }
                    938: 
                    939: sub print_setdates_response {
                    940:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                    941:   my %settings = &Apache::lonnet::get('environment',['internal.autostart','internal.autoend'],$dom,$crs);
                    942:   my $currstart = $settings{'internal.autostart'};
                    943:   my $currend = $settings{'internal.autoend'};
                    944:   my $response = '';
                    945:   my ($autostart,$autoend) = &get_dates_from_form();
                    946:   my $showstart = localtime($autostart);
                    947:   my $showend = '';
                    948:   if ($autoend) {
                    949:       $showend = localtime($autoend);
                    950:   } else {
                    951:       $showend = "'No end date'";
                    952:   } 
                    953: 
                    954:   my %cenv = ('internal.autostart' => $autostart,
                    955:               'internal.autoend' => $autoend);
                    956:   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                    957:   if ($reply !~ /^ok$/) {
                    958:        $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
                    959:   } else {
                    960:       if ($currstart == $autostart) {
                    961:           $response = "The first date for automated enrollment has been left unchanged as $showstart.<br/>";
                    962:       } else {
                    963:           $response = "The first date for automated enrollment has been changed to $showstart.<br/>";
                    964:       } 
                    965:       if ($currend == $autoend) {
                    966:           $response .= "The last date for automated enrollment has been left unchanged as $showend.<br/>";
                    967:       } else {
                    968:           $response .= "The last date for enrollment has been left unchanged as $showend.<br/>";
                    969:       }
                    970:  
                    971: # Generate message in case where old first access date was later than today, but new first access date is now today or earlier.
                    972: 
                    973:       my $rosterupdated = 0;
                    974:       my $firstaccess = "";
                    975:       my $nextupdate = "";
                    976:       my $lastupdate = "";
                    977: 
                    978:       my $nowstamp = time;
                    979:       my @date_list=localtime(time);
                    980:       my $cur_year = $date_list[5];
                    981:       my $curday = $date_list[3];
                    982:       my $curmonth = $date_list[4];
                    983:       my $lastmidnt = timelocal(0,0,0,$date_list[3],$date_list[4],$date_list[5]);
                    984:       my $nextmidnt = 86400 + $lastmidnt;
                    985: 
                    986:       my $todayupdate = timelocal(0,40,4,$date_list[3],$date_list[4],$date_list[5]);
                    987:       my $lastupdate = $todayupdate - 86400;
                    988:       if ($nowstamp < $todayupdate) {
                    989:           $nextupdate = "today";
                    990:       } else {
                    991:           $nextupdate = "tomorrow";
                    992:       }
                    993:       if ($currstart < $lastupdate) {
                    994:           $rosterupdated = 1;
                    995:       }
                    996:       if ($autostart < $nextmidnt ) {
                    997:           if ( $autostart >= $lastmidnt) {
                    998:               $firstaccess = "today";
                    999:           } else {
                   1000:               $firstaccess = "a date prior to today";
                   1001:           }
                   1002:           if (($nowstamp >= $autostart) && ($rosterupdated == 0)) {
                   1003:               $response .= qq|<br>Although you have now set the first enrollment date to $firstaccess, automatic enrollment will <b>not</b> occur until the next automatic enrollment update occurs for all LON-CAPA courses at 4.40 am $nextupdate. If you wish to grant immediate course access for registered students included in the institutional classlist for this class, please visit the <a href="/adm/populate?action=updatenow">roster update page</a>.<br>|;
                   1004:           }
                   1005:       }
                   1006:   }
                   1007:   &print_reply($r,$response,$$tasktitleref{$action});
                   1008:   return;
                   1009: }
                   1010: 
                   1011: sub print_notify_response {
                   1012:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                   1013: 
                   1014: # Get current settings
                   1015:   my %settings = &Apache::lonnet::get('environment',['internal.notifylist','internal.coursecode'],$dom,$crs);
                   1016:   my $notifylist = $settings{'internal.notifylist'};
                   1017:   my $coursecode = $settings{'internal.coursecode'};
                   1018:   my @currpeople = ();
                   1019:   my $notify = 0;
                   1020:   my @people = ();
1.7       raeburn  1021:   my $peoplestr = "";
                   1022:   my $response = "";
                   1023:   my $noprocess = 0;
1.1       raeburn  1024: 
                   1025:   if ($notifylist =~ m/,/) {
                   1026:       @currpeople = split/,/,$notifylist;
                   1027:   } else {
1.7       raeburn  1028:       $currpeople[0] = $notifylist;
1.1       raeburn  1029:   }
                   1030:   my $currcount = 0;
                   1031:   foreach  (@currpeople) {
                   1032:       unless ($_ eq '') { $currcount ++; } 
                   1033:   }
                   1034: 
                   1035:   if ( exists($ENV{'form.notify'}) ) {
                   1036:       $notify=$ENV{'form.notify'};
                   1037:   }
1.7       raeburn  1038:   if ( exists($ENV{'form.notifyshow'}) ) {
                   1039:       my $notifyshow = $ENV{'form.notifyshow'};
                   1040:       for (my $i=0; $i<$notifyshow; $i++) {
                   1041:           if ( exists($ENV{"form.note_$i"}) ) {
                   1042:               if ( exists($ENV{"form.notifyname_$i"}) ) {
                   1043:                   unless ( $ENV{"form.notifyname_$i"} eq '' ) {
                   1044:                       push @people, $ENV{"form.notifyname_$i"};
                   1045:                   }
                   1046:               }
                   1047:           }
                   1048:       }
                   1049:       if ($notify) { $peoplestr = join(",",@people); }
1.1       raeburn  1050:   } else {
                   1051:       if ($notify) {
1.7       raeburn  1052:           if ($currcount) {
                   1053:               $response = "There was a problem retrieving the updated list of recipients of notification messages. The notification settings for this course have been left unchanged.<br/>.";
                   1054:               $peoplestr = $notifylist;
                   1055:               @people = @currpeople;
                   1056:               $noprocess = 1;
                   1057:           }
                   1058:       }
                   1059:   }
                   1060:   unless ($noprocess == 1) {
                   1061:       my %cenv = ('internal.notifylist' => $peoplestr);
                   1062:       my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                   1063:       if ($reply !~ /^ok$/) {
                   1064:            $response = "There was a problem processing your requested changes. The notification settings for this course have been left unchanged.<br/>";
                   1065:       } else {
                   1066:           if ($notify) {
                   1067:               if (@people) {
                   1068:                   if ($currcount) {
                   1069:                       $response .= "Notification of enrollment changes still <b>enabled</b><br/>";
                   1070:                   } else {
                   1071:                       $response .= "Notification of enrollment changes now <b>enabled</b><br/>";
                   1072:                   }
                   1073:                   $response .= "<br/>The following will receive notification if there are any changes in enrollment in LON-CAPA course: $realm ($coursecode) as a result of the nightly enrollment check: <br/><ul>\n";
                   1074:                   foreach my $person (@people) {
                   1075:                       $response .= "<li>$person</li>\n";
                   1076:                   }
                   1077:                   $response .= "</ul>\n";
                   1078:               } else {
                   1079:                   $response = "Notification of enrollment changes was <b> not enabled</b> as no course coordinators were selected as recipients.<br/>";
                   1080:               }
                   1081:           } else {
1.1       raeburn  1082:               if ($currcount) {
1.7       raeburn  1083:                   $response = "Notification of enrollment changes now <b>disabled</b><br/>";
1.1       raeburn  1084:               } else {
1.7       raeburn  1085:                   $response = "Notification of enrollment changes still <b>disabled</b><br/>";
1.1       raeburn  1086:               }
                   1087:           }
                   1088:       }
                   1089:   }
                   1090:   &print_reply($r,$response,$$tasktitleref{$action});
                   1091:   return;
                   1092: }
                   1093: 
                   1094: sub print_crosslistings_menu () {
                   1095:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                   1096:   my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode'],$dom,$crs);
                   1097:   my @currxlists = ();
                   1098:   my @xlists = ();
                   1099:   my $crosscount = 0;
                   1100:   my $removecount = 0;
                   1101:   my $xliststr = '';
                   1102:   my $response = '';
                   1103:   my $coursecode = $settings{'internal.coursecode'};
                   1104:   if ($settings{'internal.crosslistings'} =~ m/,/) {
                   1105:       @currxlists = split/,/,$settings{'internal.crosslistings'};
                   1106:   } elsif ($settings{'internal.crosslistings'} ne '') {
                   1107:       $currxlists[0] = $settings{'internal.crosslistings'};
                   1108:   }
                   1109: 
                   1110:   if (@currxlists > 0) {
                   1111:       for (my $i=0; $i<@currxlists; $i++) {
                   1112:           my $xlist = "cross_".$i;
                   1113:           my $gp = "gp_".$i;
                   1114:           if ( exists($ENV{"form.$xlist"}) ) {
                   1115:               my $xlistentry = '';
                   1116:               if ($currxlists[$i] =~ m/^(\w+:)/) {
                   1117:                   $xlistentry = $1;
                   1118:               }
                   1119:               if ( exists($ENV{"form.$gp"}) ) {
                   1120:                   $xlistentry .= $ENV{"form.$gp"};
                   1121:               }
                   1122:               push @xlists,$xlistentry;
                   1123:               $crosscount ++;
                   1124:           } else {
                   1125:               $removecount ++;
                   1126:           }
                   1127:       }
                   1128:   }
                   1129: 
                   1130:   if ($crosscount > 1) {
                   1131:       $xliststr = join(",",@xlists);
                   1132:   } else {
                   1133:       $xliststr = $xlists[0];
                   1134:   }
                   1135:   my %cenv = ('internal.crosslistings' => $xliststr);
                   1136:   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                   1137:   if ($reply !~ /^ok$/) {
                   1138:       $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
                   1139:   } else {
                   1140:       if ($removecount > 0) {
1.5       raeburn  1141:           $response = "A total of $removecount courses are no longer crosslisted with LON-CAPA course: $realm ($coursecode).<br/><br/>";
1.1       raeburn  1142:       }
                   1143:       if ($crosscount > 0) {
                   1144:           $response .=  "The $crosscount courses listed below remain crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
                   1145:           foreach (@xlists) {
                   1146:               my ($xlist,$gp) = split/:/,$_;
                   1147:               $response .= "<li>$xlist - ID: $gp</li>\n";
                   1148:           }
                   1149:           $response .= "</ul><br/>\n";
                   1150:       }
                   1151:   }
                   1152:   if ( exists($ENV{'form.numcross'}) ) {
                   1153:       my $numcross = $ENV{'form.numcross'};
                   1154:       if ($numcross > 0) {
                   1155:           my @bgcolors=("#eeeeee","#cccccc");
                   1156:           $response .= qq(
                   1157:            You indicated that you wish to add an additional $numcross crosslisting(s).  For each new crosslisting enter the insititutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in the crosslisted course section. The LON-CAPA section/group ID can be left blank, if you do not wish to tie a section/group ID to this crosslisting.  The institutional course section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course codes (and section numbers) to your institution's student information system.<br/><br/>
                   1158:            <form name="enter" method="post">
                   1159:            <table border="0" cellpadding="2" cellspacing="2" width="100%">
                   1160:              <tr>
                   1161:               <td>
                   1162:                <table border="0" cellspacing="3" cellpadding="3">
                   1163:                 <tr bgcolor="#CCCCFF" align="left">
                   1164:                  <td><b>Crosslisting</b></td>
                   1165:                  <td><b>LON-CAPA section/groupID</b></td>
                   1166:                 </tr>
                   1167:           );
                   1168:           for (my $i=0; $i<$numcross; $i++) {
                   1169:               my $colflag = $i%2;
                   1170:               $response .= qq(
                   1171:                 <tr bgcolor="$bgcolors[$colflag]" align="left">
                   1172:                  <td><input type="text" size="15" name="newcross_$i" /></td>
                   1173:                  <td><input type="text" size="10" name="newgroupid_$i" /></td>
                   1174:                 </tr>
                   1175:               );
                   1176:           }
                   1177:           $response .= qq(  </table>
                   1178:               </td>
                   1179:              </tr>
                   1180:              <tr>
                   1181:               <td align="right">
                   1182:                <input type="button" name="newcross" value="Go" onClick="process('newcross')" />
                   1183:               </td>
                   1184:              </tr>
                   1185:             </table>
                   1186:             <input type=\"hidden\" name=\"numcross\" value=\"$numcross\">
                   1187:             <input type=\"hidden\" name=\"action\" value=\"newcross\">
                   1188:             <input type=\"hidden\" name=\"state\" value=\"process\">
                   1189:             </form>
                   1190:           );
                   1191:       }
                   1192:   }
                   1193:   &print_reply($r,$response,$$tasktitleref{$action});
                   1194:   return;
                   1195: }
                   1196: 
                   1197: sub print_crosslistings_response () {
                   1198:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1.5       raeburn  1199:   my %settings = &Apache::lonnet::get('environment',['internal.crosslistings','internal.coursecode','internal.courseowner'],$dom,$crs);
1.1       raeburn  1200:   my @currxlists = ();
                   1201:   my @xlists = ();
                   1202:   my @allxlists = ();
1.5       raeburn  1203:   my @badxlists = ();
                   1204:   my @badowner = ();
1.1       raeburn  1205:   my $numcross = 0;
                   1206:   my $xliststr =  $settings{'internal.crosslistings'};
                   1207:   my $coursecode = $settings{'internal.coursecode'};
1.5       raeburn  1208:   my $owner = $settings{'internal.courseowner'};
1.1       raeburn  1209:   my $response = '';
                   1210: 
                   1211:   if ($xliststr =~ m/,/) {
                   1212:       @allxlists = split/,/,$xliststr;
                   1213:   } else {
                   1214:       unless ($xliststr eq '') { $allxlists[0] = $xliststr; }
                   1215:   }
                   1216: 
                   1217:   if ( exists($ENV{'form.numcross'}) ) {
                   1218:       $numcross = $ENV{'form.numcross'};
                   1219:   }
                   1220: 
                   1221:   if ($numcross > 0) {
                   1222:       for (my $i=0; $i<$numcross; $i++) {
                   1223:           my $xl = "newcross_".$i;
                   1224:           my $gp = "newgroupid_".$i;
                   1225:           if ( exists($ENV{"form.$xl"}) ) {
1.5       raeburn  1226:               my $coursecheck = &localenroll::validate_courseID($ENV{"form.$xl"});
                   1227:               if ($coursecheck eq 'ok') {
                   1228:                   my $addcheck = &localenroll::new_course($ENV{"form.$xl"},$owner);
                   1229:                   if ($addcheck eq 'ok') {
                   1230:                      push @xlists,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
                   1231:                   } else {
                   1232:                      push @badowner,$ENV{"form.$xl"}.":".$ENV{"form.$gp"};
                   1233:                   } 
                   1234:               } else {
1.6       raeburn  1235:                   push @badxlists, $ENV{"form.$xl"}.":".$ENV{"form.$gp"}.":".$coursecheck;
1.5       raeburn  1236:               }
1.1       raeburn  1237:           }
                   1238:       }
                   1239:       push @allxlists, @xlists;
                   1240:   }
                   1241: 
                   1242:   if (@xlists > 0 ) {
                   1243:       unless ($xliststr eq '') { $xliststr .= ","; }
                   1244:       if (@xlists > 1) {
                   1245:           $xliststr .= join(",",@xlists);
                   1246:       } else {
                   1247:           $xliststr .= $xlists[0];
                   1248:       }
                   1249:       my %cenv = ('internal.crosslistings' => $xliststr);
                   1250:       my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                   1251:       if ($reply !~ /^ok$/) {
1.6       raeburn  1252:           $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>";
1.1       raeburn  1253:       } else {
                   1254:           $response = "The courses listed below are now crosslisted with this LON-CAPA course, and students enrolling in these course sections will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
1.6       raeburn  1255:           foreach (@allxlists) {
                   1256:               my ($xlist,$gp) = split/:/,$_;
                   1257:               $response .= "<li>$xlist - ID: $gp</li>\n";
                   1258:           }
                   1259:           $response .= "</ul><br/><br/>\n";
                   1260:       }
                   1261:   } else {
                   1262:       if ($xliststr =~ m/:/) {
                   1263:           my @oldxlists = ();
                   1264:           if ($xliststr =~ m/,/) {
                   1265:               @oldxlists = split/,/,$xliststr;
                   1266:           } else {
                   1267:               $oldxlists[0] = $xliststr;
                   1268:           }
                   1269:           $response .= "Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.<br/><ul>\n";
                   1270:           foreach (@oldxlists) {
                   1271:               my ($xlist,$gp) = split/:/,$_;
                   1272:               $response .= "<li>$xlist - ID: $gp</li>\n";
                   1273:           }
                   1274:           $response .= "</ul><br/><br/>\n";
1.1       raeburn  1275:       }
                   1276:   }
1.5       raeburn  1277:   if (@badxlists > 0) {
                   1278:       $response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because they are not valid courses according to your institution's official schedule of classes and sections.<br/><ul>\n";
                   1279:       foreach (@badxlists) {
1.6       raeburn  1280:           my ($xlist,$gp,$prob) = split/:/,$_;
                   1281:           $response .= "<li>$xlist - ID: $gp - Error: $prob</li>\n";
1.5       raeburn  1282:       }
                   1283:       $response .= "</ul><br/><br/>\n";
                   1284:   }
                   1285: 
                   1286:   if (@badowner > 0) {
                   1287:       $response .= "The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n";
                   1288:       foreach (@badowner) {
                   1289:           my ($xlist,$gp) = split/:/,$_;
                   1290:           $response .= "<li>$xlist - ID: $gp</li>\n";
                   1291:       }
                   1292:       $response .= "</ul><br/><br/>\n";
                   1293:   }
1.1       raeburn  1294: 
                   1295:   &print_reply($r,$response,$$tasktitleref{$action});
                   1296:   return;
                   1297: }
                   1298: 
                   1299: sub print_sections_menu () {
                   1300:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1.8     ! raeburn  1301:   my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
1.1       raeburn  1302:   my @currsections = ();
                   1303:   my @sections = ();
1.8     ! raeburn  1304:   my @badowner = ();
        !          1305:   my @badsections = ();
1.1       raeburn  1306:   my $seccount = 0;
                   1307:   my $removecount = 0;
1.6       raeburn  1308:   my $addcount = 0;
1.1       raeburn  1309:   my $secstr = '';
                   1310:   my $response = '';
                   1311:   my $coursecode = $settings{'internal.coursecode'};
1.8     ! raeburn  1312:   my $owner = $settings{'internal.courseowner'};
1.1       raeburn  1313:   if ($settings{'internal.sectionnums'} =~ m/,/) {
                   1314:       @currsections = split/,/,$settings{'internal.sectionnums'};
                   1315:   } elsif ($settings{'internal.sectionnums'} ne '') {
                   1316:       $currsections[0] = $settings{'internal.sectionnums'};
                   1317:   }
1.6       raeburn  1318: 
                   1319:   if ( exists($ENV{'form.secshow'}) ) {
1.8     ! raeburn  1320:       for (my $i=0; $i<$ENV{'form.secshow'}; $i++) {
        !          1321:           my $gp = "loncapasec_".$i;
        !          1322:           my $secnum = "secnum_".$i;
        !          1323:           my $sec = "sec_".$i;
        !          1324:           if ( exists( $ENV{"form.$sec"} ) ) {
        !          1325:               my $secentry;
        !          1326:               if ( exists( $ENV{"form.$secnum"} ) ) { 
        !          1327:                   $secentry = $ENV{"form.$secnum"}.':';
        !          1328:               }
        !          1329:               if ( exists( $ENV{"form.$gp"} ) ) {
        !          1330:                   $secentry .= $ENV{"form.$gp"};
        !          1331:               }
        !          1332:               if ( grep/^$ENV{"form.$secnum"}:/,@currsections) {
        !          1333:                   push @sections, $secentry;
        !          1334:                   $seccount ++;
        !          1335:               } else {
        !          1336:                   my $newsec = $coursecode.$ENV{"form.$secnum"};
        !          1337:                   my $coursecheck = &localenroll::validate_courseID($newsec);
        !          1338:                   if ($coursecheck eq 'ok') {
        !          1339:                       my $addcheck = &localenroll::new_course($newsec,$owner);
        !          1340:                       if ($addcheck eq 'ok') {
        !          1341:                           push @sections,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"};
        !          1342:                           $seccount ++;
        !          1343:                           $addcount ++;
        !          1344:                       } else {
        !          1345:                           push @badowner,$ENV{"form.$secnum"}.":".$ENV{"form.$gp"};
        !          1346:                       }
        !          1347:                   } else {
        !          1348:                       push @badsections, $ENV{"form.$secnum"}.":".$ENV{"form.$gp"}.":".$coursecheck;
        !          1349:                   }
        !          1350:               }
        !          1351:           }
        !          1352:       }
        !          1353:       if (@currsections > 0) {
        !          1354:           for (my $i=0; $i<@currsections; $i++) {
        !          1355:               if ($currsections[$i] =~ m/^(\w+:)/ ) {
        !          1356:                   my $oldsec  = $1;
        !          1357:                   unless (grep/^$oldsec/,@sections) {
        !          1358:                       $removecount ++;
        !          1359:                   }
        !          1360:               }
        !          1361:           }
        !          1362:       }
1.6       raeburn  1363:   } elsif (@currsections > 0) {
1.1       raeburn  1364:       for (my $i=0; $i<@currsections; $i++) {
                   1365:           my $sec = "sec_".$i;
                   1366:           my $gp = "secgp_".$i;
                   1367:           if ( exists($ENV{"form.$sec"}) ) {
                   1368:               my $secentry = '';
1.6       raeburn  1369:               if ($currsections[$i] =~ m/^(\w+:)/ ) {
1.1       raeburn  1370:                   $secentry = $1;
                   1371:               }
                   1372:               if ( exists($ENV{"form.$gp"}) ) {
                   1373:                   $secentry .= $ENV{"form.$gp"};
                   1374:               }
                   1375:               push @sections,$secentry;
                   1376:               $seccount ++;
                   1377:           } else {
                   1378:               $removecount ++;
                   1379:           }
                   1380:       }
                   1381:   }
                   1382:                                                                                                      
                   1383:   if ($seccount > 1) {
                   1384:       $secstr = join(",",@sections);
                   1385:   } else {
                   1386:       $secstr = $sections[0];
                   1387:   }
                   1388:   my %cenv = ('internal.sectionnums' => $secstr);
                   1389:   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                   1390:   if ($reply !~ /^ok$/) {
                   1391:        $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>";
                   1392:   } else {
                   1393:       if ($removecount > 0) {
                   1394:           $response = "A total of $removecount sections have been removed from the list of sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>";
                   1395:       }
1.6       raeburn  1396:       if ($addcount > 0) {
                   1397:           $response .= "A total of $addcount sections have been added to the list of
                   1398: sections which contribute to enrollment in LON-CAPA course: $realm ($coursecode).<br/><br/>";
                   1399:       }
1.1       raeburn  1400:       if ($seccount > 0) { 
1.6       raeburn  1401:           $response .= "Students enrolling in the $seccount section(s) listed below will be automatically added to the class roster for the course, if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
1.1       raeburn  1402:           foreach (@sections) {
                   1403:               my ($sec,$gp) = split/:/,$_;
                   1404:               $response .= "<li>$sec  - ID: $gp</li>\n";
                   1405:           }
                   1406:           $response .= "</ul><br/>\n";
                   1407:       }
                   1408:   }
                   1409: 
1.8     ! raeburn  1410:   if (@badsections > 0) {
        !          1411:       $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n";
        !          1412:       foreach (@badsections) {
        !          1413:           my ($secnum,$gp,$prob) = split/:/,$_;
        !          1414:           $response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n";
        !          1415:       }
        !          1416:       $response .= "</ul><br/><br/>\n";
        !          1417:   }
        !          1418: 
        !          1419:   if (@badowner > 0) {
        !          1420:       $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n";
        !          1421:       foreach (@badowner) {
        !          1422:           my ($secnum,$gp) = split/:/,$_;
        !          1423:           $response .= "<li>$secnum - ID: $gp</li>\n";
        !          1424:       }
        !          1425:       $response .= "</ul><br/><br/>\n";
        !          1426:   }
        !          1427: 
1.1       raeburn  1428:   if ( exists($ENV{'form.numsec'}) ) {
                   1429:       my $numsec = $ENV{'form.numsec'};
                   1430:       if ($numsec > 0) {
                   1431:           my @bgcolors=("#eeeeee","#cccccc");
                   1432:           $response .= qq(
                   1433:            You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional $numsec section(s).  For each new section enter the insititutional section code (e.g., 004), and the LON-CAPA section/group ID you wish to assign to students who will be enrolled in your LON-CAPA class as a result of their registration in this particular section. The LON-CAPA section/group ID can be left blank, if you do not wish to designate a section/group ID for this course section.  The institutional section code should only contain letters and/or numbers, and must be consistent with the scheme adopted by your Domain Coordinator to map course section numbers to your institution's student information system.<br/><br/> 
                   1434:            <form name="enter" method="post">
                   1435:            <table border="0" cellpadding="2" cellspacing="2" width="100%">
                   1436:              <tr>
                   1437:               <td>
                   1438:                <table border="0" cellspacing="3" cellpadding="3">
                   1439:                 <tr bgcolor="#CCCCFF" align="left">
                   1440:                  <td><b>Section number</b></td>
                   1441:                  <td><b>LON-CAPA section/groupID</b></td>
                   1442:                 </tr>
                   1443:           );
                   1444:           for (my $i=0; $i<$numsec; $i++) {
                   1445:               my $colflag = $i%2;
                   1446:               $response .= qq(
                   1447:                 <tr bgcolor="$bgcolors[$colflag]" align="left">
                   1448:                  <td><input type="text" size="15" name="newsec_$i" /></td>
                   1449:                  <td><input type="text" size="10" name="newsecgp_$i" /></td>
                   1450:                 </tr>
                   1451:               );
                   1452:           }
                   1453:           $response .= qq(  </table>
                   1454:               </td>
                   1455:              </tr>
                   1456:              <tr>
                   1457:               <td align="right">
                   1458:                <input type="button" name="newsections" value="Go" onClick="process('newsections')" />
                   1459:               </td>
                   1460:              </tr>
                   1461:             </table>
                   1462:             <input type=\"hidden\" name=\"numsec\" value=\"$numsec\">
                   1463:             <input type=\"hidden\" name=\"action\" value=\"newsections\">
                   1464:             <input type=\"hidden\" name=\"state\" value=\"process\">
                   1465:             </form>
                   1466:           );
                   1467:       }
                   1468:   }
                   1469:   &print_reply($r,$response,$$tasktitleref{$action});
                   1470:   return;
                   1471: }
                   1472: 
                   1473: sub print_sections_response () {
                   1474:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
1.8     ! raeburn  1475:   my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.coursecode','internal.courseowner'],$dom,$crs);
1.1       raeburn  1476:   my @currsections = ();
                   1477:   my @sections = ();
                   1478:   my @allsections = ();
1.8     ! raeburn  1479:   my @badowner = ();
        !          1480:   my @badsections = ();
1.1       raeburn  1481:   my $numsec = 0;
                   1482:   my $secstr =  $settings{'internal.sectionnums'};
                   1483:   my $coursecode = $settings{'internal.coursecode'};
1.8     ! raeburn  1484:   my $owner = $settings{'internal.courseowner'};
1.1       raeburn  1485:   my $response = '';
1.8     ! raeburn  1486:   my $putreply = '';
1.1       raeburn  1487:   if ($secstr =~ m/,/) {
                   1488:       @allsections = split/,/,$secstr;
                   1489:   } else {
                   1490:       unless ($secstr eq '') { $allsections[0] = $secstr; }
                   1491:   }
                   1492: 
                   1493:   if ( exists($ENV{'form.numsec'}) ) {
                   1494:       $numsec = $ENV{'form.numsec'};
                   1495:   }
1.8     ! raeburn  1496: 
1.1       raeburn  1497:   if ($numsec > 0) {
                   1498:       for (my $i=0; $i<$numsec; $i++) {
                   1499:           my $sec = "newsec_".$i;
                   1500:           my $gp = "newsecgp_".$i;
                   1501:           if ( exists($ENV{"form.$sec"}) ) {
1.8     ! raeburn  1502:               unless ( (grep/^$ENV{"form.$sec"}:/,@allsections) || (grep/^$ENV{"form.$sec"}:/,@sections) ) {
        !          1503:                   my $newsec = $coursecode.$ENV{"form.$sec"};
        !          1504:                   my $coursecheck = &localenroll::validate_courseID($newsec);
        !          1505:                   if ($coursecheck eq 'ok') {
        !          1506:                       my $addcheck = &localenroll::new_course($newsec,$owner);
        !          1507:                       if ($addcheck eq 'ok') {
        !          1508:                           push @sections,$ENV{"form.$sec"}.":".$ENV{"form.$gp"};
        !          1509:                       } else {
        !          1510:                           push @badowner,$ENV{"form.$sec"}.":".$ENV{"form.$gp"};
        !          1511:                       }
        !          1512:                   } else {
        !          1513:                       push @badsections, $ENV{"form.$sec"}.":".$ENV{"form.$gp"}.":".$coursecheck;
        !          1514:                   }
        !          1515:               }
1.1       raeburn  1516:           }
                   1517:       }
                   1518:       push @allsections, @sections;
                   1519:   }
1.8     ! raeburn  1520: 
1.1       raeburn  1521:   if (@sections > 0 ) {
                   1522:       unless ($secstr eq '') { $secstr .= ","; } 
                   1523:       if (@sections > 1) {
                   1524:           $secstr .= join(",",@sections);
                   1525:       } else {
                   1526:           $secstr .= $sections[0];
                   1527:       }
                   1528:       my %cenv = ('internal.sectionnums' => $secstr);
1.8     ! raeburn  1529:       $putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
        !          1530:       if ($putreply !~ /^ok$/) {
        !          1531:           $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/><br/>";
        !          1532:       }
        !          1533:   }
        !          1534: 
        !          1535:   if ($putreply =~ /^ok/) {
        !          1536:       $response = "Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course $realm ($coursecode), if you have chosen to enable a nightly automated enrollment update.<br/><ul>\n";
        !          1537:       foreach (@allsections) {
        !          1538:           my ($sec,$gp) = split/:/,$_;
        !          1539:           $response .= "<li>$sec - ID: $gp</li>\n";
        !          1540:       }
        !          1541:       $response .= "</ul><br/><br/>\n";
        !          1542:   }
        !          1543: 
        !          1544:   if (@badsections > 0) {
        !          1545:       $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because they are not valid section numbers according to your institution's official schedule of classes and sections.<br/><ul>\n";
        !          1546:       foreach (@badsections) {
        !          1547:           my ($secnum,$gp,$prob) = split/:/,$_;
        !          1548:           $response .= "<li>$secnum - ID: $gp - Error: $prob</li>\n";
1.1       raeburn  1549:       }
1.8     ! raeburn  1550:       $response .= "</ul><br/><br/>\n";
1.1       raeburn  1551:   }
1.8     ! raeburn  1552: 
        !          1553:   if (@badowner > 0) {
        !          1554:       $response .= "The sections listed below could not be included in the sections for this LON-CAPA course, because the owner of this course - $owner - does not have rights to view enrollment in those classes as determined by your instititution's policies on access to official classlists.<br/><ul>\n";
        !          1555:       foreach (@badowner) {
        !          1556:           my ($secnum,$gp) = split/:/,$_;
        !          1557:           $response .= "<li>$secnum - ID: $gp</li>\n";
        !          1558:       }
        !          1559:       $response .= "</ul><br/><br/>\n";
1.1       raeburn  1560:   }
1.8     ! raeburn  1561: 
1.1       raeburn  1562:   &print_reply($r,$response,$$tasktitleref{$action});
                   1563:   return;
                   1564: }
                   1565: 
                   1566: sub print_photos_response () {
                   1567:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                   1568:   my %settings = &Apache::lonnet::get('environment',['internal.showphotos'],$dom,$crs);
                   1569:   my $currphotos = $settings{'internal.showphotos'};
                   1570:   my $showphotos = '';
                   1571:   if ( exists($ENV{'form.showphotos'}) ) {
                   1572:       $showphotos=$ENV{'form.showphotos'};
                   1573:   }
1.8     ! raeburn  1574: 
1.1       raeburn  1575:   my $response = "";
                   1576:   my %cenv = ('internal.showphotos' => $showphotos);
                   1577:   my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
                   1578:   if ($reply !~ /^ok$/) {
                   1579:       $response = "There was a problem processing your requested change. The student photo import setting for this course has been left unchanged.<br/>";
                   1580:   } else {
                   1581:       if ($showphotos) {
                   1582:           if ($currphotos) {
                   1583:               $response = "Retrieval of student photos is still <b>enabled</b><br/>";
                   1584:           } else {
                   1585:               $response = "Retrieval of student photos in now <b>enabled</b><br/>";
                   1586:           }
                   1587:       } else {
                   1588:           if ($currphotos) {
                   1589:               $response = "Retrieval of student photos is now <b>disabled</b><br/>";
                   1590:           } else {
                   1591:               $response = "Retrieval of student photos is still <b>disabled</b><br/>";
                   1592:           }
                   1593:       }
                   1594:   }
                   1595:   &print_reply($r,$response,$$tasktitleref{$action});
                   1596:   return;
                   1597: }
                   1598: 
                   1599: sub print_update_result () {
                   1600:   my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
                   1601:   my $response = '';
                   1602:   my $updateadds = 0;
                   1603:   my $updatedrops = 0;
                   1604:   my $changecount = 0;
                   1605:   my %affiliates = ();
                   1606:   my %reply = ();
                   1607:   my @allcourses = ();
                   1608:   my %LC_code = ();
                   1609:   my $logmsg = '';
1.5       raeburn  1610:   my $newusermsg = '';
1.1       raeburn  1611: 
                   1612:   my %settings = &Apache::lonnet::get('environment',['internal.coursecode','internal.sectionnums','internal.crosslistings','internal.authtype','internal.autharg','internal.autostart','internal.autoend'],$dom,$crs);
                   1613:   my $coursecode = $settings{'internal.coursecode'};
                   1614:   my $authtype = $settings{'internal.authtype'};
                   1615:   my $autharg = $settings{'internal.autharg'};
                   1616:   my $autostart = $settings{'internal.autostart'};
                   1617:   my $autoend = $settings{'internal.autoend'};
                   1618:  
                   1619:   if ( exists($ENV{'form.updateadds'}) ) {
                   1620:       $updateadds = $ENV{'form.updateadds'};
                   1621:   }
                   1622:   if ( exists($ENV{'form.updatedrops'}) ) {
                   1623:       $updatedrops = $ENV{'form.updatedrops'};
                   1624:   }
                   1625:   if (!$updateadds && !$updatedrops) {
                   1626:       $response = "An update of the class roster has not been carried out because you indicated that you wanted to neither add new students, nor expire dropped students based on a comparison between the institutional class lists for the course sections and crosslisted courses that contribure enrollment to this LON-CAPA course.";
                   1627:   } elsif ($coursecode eq '') {
                   1628:       $response = "There was a problem retrieving the course code for this LON-CAPA course.  An update of the class roster has not been carried out, and enrollment remains unchanged";
                   1629:   } else {
                   1630: # Get complete list of course sections to update
                   1631:       my @currsections = ();
                   1632:       my @currxlists = ();
                   1633: 
                   1634:       if ($settings{'internal.sectionnums'} =~ m/,/) {
                   1635:           @currsections = split/,/,$settings{'internal.sectionnums'};
                   1636:       } elsif ($settings{'internal.sectionnums'} ne '') {
                   1637:           $currsections[0] = $settings{'internal.sectionnums'};
                   1638:       }
                   1639: 
                   1640:       if ($settings{'internal.crosslistings'} =~ m/,/) {
                   1641:           @currxlists = split/,/,$settings{'internal.crosslistings'};
                   1642:       } elsif ($settings{'internal.crosslistings'} ne '') {
                   1643:           $currxlists[0] = $settings{'internal.crosslistings'};
                   1644:       }
                   1645:                                                                                                      
                   1646:       if (@currxlists > 0) {
                   1647:           foreach (@currxlists) {
                   1648:               if (m/^(\w+):(\w*)$/) {
                   1649:                   unless (grep/^$1$/,@allcourses) { 
                   1650:                       push @allcourses,$1;
                   1651:                       $LC_code{$1} = $2; 
                   1652:                   }
                   1653:               }
                   1654:           }
                   1655:       }
                   1656: 
                   1657:       if (@currsections > 0) {
                   1658:           foreach (@currsections) {
                   1659:               if (m/^(\w+):(\w*)$/) {
                   1660:                   my $sec = $coursecode.$1;
                   1661:                   my $gp = $2;
                   1662:                   unless (grep/^$sec$/,@allcourses) { 
                   1663:                       push @allcourses,$sec;
                   1664:                       $LC_code{$sec} = $gp; 
                   1665:                   }
                   1666:               }
                   1667:           }
                   1668:       }
                   1669: 
                   1670:       if (@allcourses > 0) {
                   1671:           @{$affiliates{$crs}} = @allcourses;
                   1672:           &localenroll::fetch_enrollment($dom,\%affiliates,\%reply);
                   1673:           if ($reply{$crs} > 0) {
1.5       raeburn  1674:               ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$autostart,$autoend,$authtype,$autharg,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow");
1.1       raeburn  1675:           } else {
                   1676:               $response = "There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course. No updates have been carried out, and the roster remains unchanged.";
                   1677:           }  
                   1678:       } else {
                   1679:           $response = "There are currently no course sections or crosslisted courses designated as contributors to enrollment in this LON-CAPA course. As a result a student roster update has not been carried out for $realm ($coursecode)";
                   1680:       }
                   1681:   }
                   1682:   unless ($logmsg eq '') {
                   1683:       my $loglength = length($logmsg);
                   1684:       $logmsg = substr($logmsg,0,$loglength-4);
                   1685:       $logmsg = "<br/><br/>The following messages were generated by the roster update process: <br/><ul><li>".$logmsg."</ul><br/>";
                   1686:   }
1.5       raeburn  1687:   unless ($newusermsg eq '') {
                   1688:       $newusermsg = substr( $newusermsg,0,rindex($newusermsg,'<li>') );
                   1689:       $newusermsg = "<br/><br/>The following new system user(s) who was/were created will be using internal authentication with an initial randomly generated password. A valid e-mail address was not available for this/these user(s) so LON-CAPA account credentials could not be sent via e-mail.<br/><ul><li>".$newusermsg."</ul><br/>";
                   1690:   }
                   1691:   $response .= $logmsg.$newusermsg;
1.1       raeburn  1692:   &print_reply($r,$response,$$tasktitleref{$action});
                   1693:   return;
                   1694: }
                   1695: 
                   1696: sub print_reply () {
                   1697:   my ($r,$response,$caller) = @_;
                   1698:   $r->print("
                   1699:             <br/><table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">
                   1700:              <tr>
                   1701:               <tr align=\"left\"><b>$caller</b> - result<br/><br/>$response</td>
                   1702:               </td>
                   1703:              </tr>
                   1704:             </table>
                   1705:   ");
                   1706:   return;
                   1707: }
                   1708: 
                   1709: sub setup_date_selectors {
                   1710:     my ($starttime,$endtime) = @_;
                   1711:     if ($endtime == 0) {
                   1712:         $endtime = 1999915200;
                   1713:     }
                   1714:     if (! defined($starttime)) {
                   1715:         $starttime = time;
                   1716:         if (exists($ENV{'course.'.$ENV{'request.course.id'}.
                   1717:                             '.default_enrollment_start_date'})) {
                   1718:             $starttime = $ENV{'course.'.$ENV{'request.course.id'}.
                   1719:                                   '.default_enrollment_start_date'};
                   1720:         }
                   1721:     }
                   1722:     if (! defined($endtime)) {
                   1723:         $endtime = time+(6*30*24*60*60); # 6 months from now, approx
                   1724:         if (exists($ENV{'course.'.$ENV{'request.course.id'}.
                   1725:                             '.default_enrollment_end_date'})) {
                   1726:             $endtime = $ENV{'course.'.$ENV{'request.course.id'}.
                   1727:                                 '.default_enrollment_end_date'};
                   1728:         }
                   1729:     }
                   1730:     my $startdateform = &Apache::lonhtmlcommon::date_setter('enter',
                   1731:                                                             'startdate',
                   1732:                                                             $starttime);
                   1733:     my $enddateform = &Apache::lonhtmlcommon::date_setter('enter',
                   1734:                                                           'enddate',
                   1735:                                                           $endtime);
                   1736:     return ($startdateform,$enddateform);
                   1737: }
                   1738: 
                   1739: sub get_dates_from_form {
                   1740:     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');
                   1741:     my $enddate   = &Apache::lonhtmlcommon::get_date_from_form('enddate');
                   1742:     if ( exists ($ENV{'form.no_end_date'}) ) {
                   1743:         $enddate = 0;
                   1744:     }
                   1745:     return ($startdate,$enddate);
                   1746: }
                   1747: 
                   1748: sub date_setting_table {
                   1749:     my ($starttime,$endtime) = @_;
                   1750:     my ($startform,$endform) = &setup_date_selectors($starttime,$endtime);
                   1751:     my $perpetual = '<nobr><input type="checkbox" name="no_end_date"';
                   1752:     if (defined($endtime) && $endtime == 0) {
                   1753:         $perpetual .= ' checked';
                   1754:     }
                   1755:     $perpetual.= ' />'.' no ending date</nobr>';
                   1756:     my $start_table = '';
                   1757:     $start_table .= "<table>\n";
                   1758:     $start_table .= '<tr><td align="right">Starting Date</td>'.
                   1759:         '<td>'.$startform.'</td>'.
                   1760:         '<td>&nbsp;</td>'."</tr>\n";
                   1761:     $start_table .= "</table>";
                   1762:     my $end_table = '';
                   1763:     $end_table .= "<table>\n";
                   1764:     $end_table .= '<tr><td align="right">Ending Date</td>'.
                   1765:         '<td>'.$endform.'</td>'.
                   1766:         '<td>'.$perpetual.'</td>'."</tr>\n";
                   1767:     $end_table .= "</table>\n";
                   1768:     return ($start_table, $end_table);
                   1769: }
                   1770: 
                   1771: ###################################################################
                   1772: sub handler {
                   1773:     my $r = shift;
                   1774:     if ($r->header_only) {
                   1775:         $r->content_type('text/html');
                   1776:         $r->send_http_header;
                   1777:         return OK;
                   1778:     }
                   1779:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','state']);
                   1780:     #  Needs to be in a course
                   1781:     if (! (($ENV{'request.course.fn'}) &&  (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'})))) {
                   1782:         # Not in a course, or not allowed to modify parms
                   1783:         $ENV{'user.error.msg'}="/adm/populate:cst:0:0:Cannot drop or add students";
                   1784:         return HTTP_NOT_ACCEPTABLE; 
                   1785:     }
                   1786:     # Start page
                   1787:     $r->content_type('text/html');
                   1788:     $r->send_http_header;
                   1789: 
                   1790:     my @tasks = ("information","chgsettings","setdates","notify","crosslist","sections","photos","updatenow");
                   1791:                                                                                  
                   1792:     my %tasklong = (
                   1793:                information => "Task information",
                   1794:                chgsettings => "Automated adds/drops",
                   1795:                setdates => "Change enrollment dates",
                   1796:                notify => "Notification of changes",
                   1797:                crosslist => "Change crosslistings",
                   1798:                sections => "Section settings",
                   1799:                photos => "Student photos",
                   1800:                updatenow => "Update roster now",
                   1801:                newcross => "Add crosslistings",
                   1802:                newsections => "Add sections"
                   1803:     );
                   1804:                                                                                  
                   1805:     my %tasktitle = (
                   1806:                chgsettings => "Changes to nightly automated enrollments",
                   1807:                setdates => "Changes to first and/or last automated enrollment dates",
                   1808:                notify => "Notification of enrollment changes",
                   1809:                crosslist => "Changes to crosslistings",
                   1810:                sections => "Changes to section settings",
                   1811:                photos => "Automatic import of student photos",
                   1812:                updatenow => "Immediate course roster update",
                   1813:                newcross => "Adding new crosslisted courses",
                   1814:                newsections => "Adding new course sections"
                   1815:     );
                   1816: 
                   1817:     my $realm = '';
                   1818:     if ( exists($ENV{'request.course.id'}) ) {
                   1819:         $realm= $ENV{'course.'.$ENV{'request.course.id'}.'.description'};
                   1820:     }
                   1821:     unless ($realm) { $realm='&nbsp;'; }
                   1822:     my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
                   1823:     my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
                   1824:     
                   1825:     #
                   1826:     # Main switch on form.action and form.state, as appropriate
                   1827:     #
                   1828: 
                   1829:     my $action = "information";
                   1830:     if ( exists($ENV{'form.action'}) ) {
                   1831:         $action = $ENV{'form.action'};
                   1832:     }
                   1833:     my $state = "choose";
                   1834: 
                   1835:     if ( exists($ENV{'form.state'}) ) {
                   1836:         $state = $ENV{'form.state'};
                   1837:     }
                   1838: 
                   1839:     if ($action eq "information") {
                   1840:         $r->print(&header()); 
                   1841:     } else {
                   1842:         if ($state eq "choose") {
                   1843:             $r->print(&choose_header());
                   1844:         } else {
                   1845:             if ($action eq "crosslist") {
                   1846:                 if ( exists($ENV{'form.numcross'}) ) {
                   1847:                     if ( $ENV{'form.numcross'} > 0 ) {
                   1848:                         $r->print(&choose_header());
                   1849:                     } else {
                   1850:                         $r->print(&header());
                   1851:                     }
                   1852:                 } else {
                   1853:                     $r->print(&header());
                   1854:                 }
                   1855:             } elsif ($action eq "sections") {
                   1856:                 if ( exists($ENV{'form.numsec'}) ) {
                   1857:                     if ( $ENV{'form.numsec'} > 0 ) {
                   1858:                         $r->print(&choose_header());
                   1859:                     } else {
                   1860:                         $r->print(&header());
                   1861:                     }
                   1862:                 } else {
                   1863:                     $r->print(&header());
                   1864:                 }
                   1865:             } else {
                   1866:                 $r->print(&header());
                   1867:             }
                   1868:         }
                   1869:     }
                   1870:   
                   1871:     my $reply = 0;
                   1872:     unless ($state eq "choose") { $reply = 1; }
                   1873: 
                   1874:     &print_mainbox($r,\%tasklong,$realm,$reply);
                   1875:     &print_navmenu($r,\@tasks,\%tasklong);
                   1876:     
                   1877:     if (($state eq "choose") || ($action eq "information")) {
                   1878:         &print_main_frame($r,$realm,$dom,$crs,\%tasktitle);
                   1879:     } elsif ($action eq "chgsettings") {
                   1880:         &print_chgsettings_response($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1881:     } elsif ($action eq "setdates") {
                   1882:         &print_setdates_response($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1883:     } elsif ($action eq "notify") {
                   1884:         &print_notify_response($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1885:     } elsif ($action eq "sections") {
                   1886:         &print_sections_menu($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1887:     } elsif ($action eq "crosslist") {
                   1888:         &print_crosslistings_menu($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1889:     } elsif ($action eq "updatenow") {
                   1890:         &print_update_result($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1891:     } elsif ($action eq "photos") {
                   1892:         &print_photos_response($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1893:     } elsif ($action eq "newcross") {
                   1894:         &print_crosslistings_response($r,$realm,$dom,$crs,$action,\%tasktitle);    
                   1895:     } elsif ($action eq "newsections") {
                   1896:         &print_sections_response($r,$realm,$dom,$crs,$action,\%tasktitle);
                   1897:     }
                   1898:     &print_doc_base($r);  
                   1899:     return OK;
                   1900: }
                   1901: ###################################################################
                   1902: 1;

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