Diff for /loncom/interface/lonpopulate.pm between versions 1.85 and 1.92

version 1.85, 2016/11/09 00:48:52 version 1.92, 2022/02/16 16:38:11
Line 37  use Apache::lonuserutils; Line 37  use Apache::lonuserutils;
 use Apache::Constants qw(:common :http REDIRECT);  use Apache::Constants qw(:common :http REDIRECT);
 use Time::Local;  use Time::Local;
 use LONCAPA::Enrollment;  use LONCAPA::Enrollment;
   use LONCAPA qw(:DEFAULT :match);
   
 ###############################################################  ###############################################################
 sub header {  sub header {
Line 49  sub header { Line 50  sub header {
 ###############################################################  ###############################################################
   
 sub choose_header {  sub choose_header {
     my ($action,$permref) = @_;      my ($action,$permref,$dom) = @_;
     my $notify_check = '/^note_[0-9]+$/';      my $notify_check = '/^note_[0-9]+$/';
       my $additems;
     my %js_lt =       my %js_lt = 
         &Apache::lonlocal::texthash(          &Apache::lonlocal::texthash(
             adds => 'You must select either "Enable" or "Disable" for nightly additions based on classlist changes',              adds => 'You must select either "Enable" or "Disable" for nightly additions based on classlist changes',
Line 219  function countChecked(field) { Line 221  function countChecked(field) {
 }  }
   
 ENDJSTWO  ENDJSTWO
       } elsif ($action eq 'chgfailsafe') {
           my %domconfig =
               &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
           my $includedom = 1;
           if (ref($domconfig{'autoenroll'}) eq 'HASH') {
               if ($domconfig{'autoenroll'}->{'failsafe'} eq 'off') {
                   $includedom = 0;
               }
           }
           $scripttag .= <<ENDJSTHREE;
   
   function toggleFailsafe(form) {
       var radioname = 'autodropfailsafetype';
       var divid = 'autodropfailsafe';
       var num = form.elements[radioname].length;
       if (num) {
           var includedom = '$includedom';
           var setvis = '';
           for (var i=0; i<num; i++) {
               if (form.elements[radioname][i].checked) {
                   if ((form.elements[radioname][i].value == 'zero') || (form.elements[radioname][i].value == 'any') || ((form.elements[radioname][i].value == 'dom') && (includedom == 1))) {
                       if (document.getElementById(divid)) {
                           document.getElementById(divid).style.display = 'inline-block';
                       }
                       setvis = 1;
                   }
                   break;
               }
           }
           if (!setvis) {
               if (document.getElementById(divid)) {
                   document.getElementById(divid).style.display = 'none';
               }
           }
       }
       return;
   }
   
   ENDJSTHREE
           $additems = { 'onload' => "toggleFailsafe(document.enter);" };
     }      }
     $scripttag .= <<ENDJS;      $scripttag .= <<ENDJS;
 // ]]>  // ]]>
 </script>  </script>
 ENDJS  ENDJS
     my $args = &make_crumbs($action,$permref);      my $args = &make_crumbs($action,$permref,$additems);
     return &Apache::loncommon::start_page('Classlist Manager',      return &Apache::loncommon::start_page('Classlist Manager',
   $scripttag,$args);    $scripttag,$args);
 }  }
   
 sub make_crumbs {  sub make_crumbs {
     my ($action,$permref) = @_;      my ($action,$permref,$additems) = @_;
     my ($tasklong,$tasktitle) = &get_task_text($permref);      my ($tasklong,$tasktitle) = &get_task_text($permref);
     my $brcrum = [{href=>"/adm/createuser",      my $brcrum = [{href=>"/adm/createuser",
                    text=>"User Management",},                     text=>"User Management",},
Line 254  sub make_crumbs { Line 296  sub make_crumbs {
             );              );
     }      }
     return {bread_crumbs           => $brcrum,      return {bread_crumbs           => $brcrum,
             bread_crumbs_component => 'Automated Management'};              bread_crumbs_component => 'Automated Management',
               add_entries => $additems};
 }  }
   
 sub print_navmenu {  sub print_navmenu {
Line 368  sub print_main_frame { Line 411  sub print_main_frame {
               <td>'.&mt('Use [_1]View students and change type[_2] to display the current course roster, and (optionally) change enrollment type for selected students from "auto" to "manual" and vice versa.','<i>"','"</i>').'</td>                <td>'.&mt('Use [_1]View students and change type[_2] to display the current course roster, and (optionally) change enrollment type for selected students from "auto" to "manual" and vice versa.','<i>"','"</i>').'</td>
             </tr>              </tr>
             <tr>              <tr>
             <td>&nbsp;</td>               <td>&nbsp;</td>
               <td>'.&mt('Use [_1]Change zero enrollment failsafe[_2] to set number of existing enrollments in an institutional section above which no automated drops occur whenever section enrollment retrieved from institutional data is zero.','<i>"','"</i>').'</td>               <td>'.&mt('Use [_1]View/change enrollment failsafe[_2] to (a) set number of drops from existing enrollments in an institutional section above which no automated drops will occur (e.g., when section enrollment retrieved from institutional data is incomplete) and (b) set whether this only applies when retrieved data contains zero records for the institutional section.','<i>"','"</i>').'</td>
             </tr>');              </tr>');
       } else {        } else {
           if (($permref->{'view'}) || ($permref->{'view_section'} ne '')) {            if (($permref->{'view'}) || ($permref->{'view_section'} ne '')) {
Line 406  sub print_main_frame { Line 449  sub print_main_frame {
                         '<i>"','"</i>').'</td>                          '<i>"','"</i>').'</td>
             </tr>              </tr>
             <tr>              <tr>
             <td>&nbsp;</td>               <td>&nbsp;</td>
               <td>'.&mt('Use [_1]Zero enrollment failsafe[_2] to set number of existing enrollments in an institutional section above which no automated drops occur whenever section enrollment retrieved from institutional data is zero.','<i>"','"</i>').'</td>               <td>'.&mt('Use [_1]Enrollment failsafe[_2] to display (a) number of drops from existing enrollments in an institutional section above which no automated drops occur (e.g., when section enrollment retrieved from institutional data is incomplete), and (b) whether this only applies when retrieved data contains zero records for the institutional section.','<i>"','"</i>').'</td>
             </tr>');              </tr>');
           }            }
           if (($permref->{'show'}) || ($permref->{'show_section'} ne '')) {            if (($permref->{'show'}) || ($permref->{'show_section'} ne '')) {
Line 494  sub print_main_frame { Line 537  sub print_main_frame {
             <input type="hidden" name="state" value="process" />              <input type="hidden" name="state" value="process" />
             </form>'."\n");              </form>'."\n");
   } elsif ($action eq 'chgfailsafe') {    } elsif ($action eq 'chgfailsafe') {
       my $autofailsafe;        my ($autofailsafe,$failsafetype,$failsafesty,%failsafechecked);
         $failsafesty = 'inline-block';
         %failsafechecked = (
             dom => ' checked="checked"',
         );
         my $domdefault;
       my %domconfig =        my %domconfig =
           &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);            &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
       if (ref($domconfig{'autoenroll'}) eq 'HASH') {        if (ref($domconfig{'autoenroll'}) eq 'HASH') {
Line 502  sub print_main_frame { Line 550  sub print_main_frame {
           if ($autofailsafe =~ /\D/) {            if ($autofailsafe =~ /\D/) {
               undef($autofailsafe);                undef($autofailsafe);
           }            }
             if ($domconfig{'autoenroll'}->{'failsafe'} eq 'off') {
                 undef($autofailsafe);
                 $failsafesty = 'none';
                 $failsafetype = 'off';
                 $domdefault = &mt('Failsafe is not in use.');
             } elsif ($domconfig{'autoenroll'}->{'failsafe'} eq 'any') {
                 $failsafesty = 'inline-block';
                 $failsafetype = 'any';
                 $domdefault = &mt('Failsafe will apply if retrieved enrollment for institutional section is zero or greater.');
             } else {
                 $failsafesty = 'inline-block';
                 $failsafetype = 'zero';
                 $domdefault = &mt('Failsafe will only apply if retrieved enrollment for institutional section is zero.');
             }
         }
         if ((exists($enrollvar{'autodropfailsafetype'})) &&
             ($enrollvar{'autodropfailsafetype'} ne '')) {
             if ($enrollvar{'autodropfailsafetype'} eq 'off') {
                 $failsafesty = 'none';
                 $failsafechecked{'dom'} = '';
                 $failsafechecked{'off'} = ' checked="checked"';
             } elsif ($enrollvar{'autodropfailsafetype'} eq 'any') {
                 $failsafesty = 'inline-block';
                 $failsafechecked{'dom'} = '';
                 $failsafechecked{'any'} = ' checked="checked"';
             } elsif ($enrollvar{'autodropfailsafetype'} eq 'zero') {
                 $failsafesty = 'inline-block';
                 $failsafechecked{'dom'} = '';
                 $failsafechecked{'zero'} = ' checked="checked"';
             }
       }        }
       $r->print('        $r->print('
           <form name="enter" method="post" action=""><br />            <form name="enter" method="post" action=""><br />
            <table width="100%" border="0" cellpadding="2" cellspacing="2">             <table width="100%" border="0" cellpadding="2" cellspacing="2">
             <tr>              <tr>
              <td align="left"><b>'.$$tasktitleref{$action}.'</b><br /><p>'.               <td align="left"><b>'.$$tasktitleref{$action}.'</b><br /><p>'.
              &mt('In a course where multiple institutional sections provide enrollment, the "failsafe" value can prevent automated enrollment from expiring student roles for registered students in one section, in the case where no enrollment is returned for that particular section because of a temporary institutional data retrieval problem external to LON-CAPA.').'</p>'.               &mt('The "failsafe" mechanism for automated enrollment can prevent unwanted expiration of student roles for registered students in an institutional section, in the case where either no enrollment, or only partial enrollment, is returned for that particular section because of a temporary institutional data retrieval problem external to LON-CAPA.').'</p>'.
             '<p>'.&mt('For example if this value is set to 10, and the current LON-CAPA enrollment count is 11 or more for a particular course section, no role expiration will occur if the latest retrieved enrollment count is zero for that institutional section (or cross-listing).').'</p>');              '<p>'.&mt('For example if the threshold is set to 10, and the current LON-CAPA enrollment count is 11 or more for a particular course section, no role expiration will occur if the latest retrieved enrollment count is zero for that institutional section (or cross-listing).').'</p>');
       if ($enrollvar{'autodropfailsafe'} eq '') {        if ($enrollvar{'autodropfailsafe'} eq '') {
           $r->print('<p>'.&mt('Currently no course-specific failsafe value is set.').' ');            $r->print('<p>'.&mt('Currently no course-specific failsafe threshold is set.').' ');
           if ($autofailsafe eq '') {            if ($autofailsafe eq '') {
               $r->print(&mt('Currently no domain default failsafe is set either.'));                $r->print(&mt('Currently no domain default failsafe is set either.'));
           } else {            } else {
               $r->print(&mt('The current domain default of [_1] will apply, unless a value is set here specific to this course.',$autofailsafe));                $r->print(&mt('The current domain default of [_1] will apply unless a value is set here specific to this course.','<b>'.$autofailsafe.'</b>'));
           }            }
           $r->print('</p>');            $r->print('</p>');
       } else {        } else {
           $r->print('<p>'.&mt('Currently, the course-specific failsafe is set to [_1].',"<i>$enrollvar{'autodropfailsafe'}</i>").'</p>');            unless (($enrollvar{'autodropfailsafetype'} eq 'off') || 
                     (($enrollvar{'autodropfailsafetype'} eq '') && ($failsafetype eq 'off'))) {
                 $r->print('<p>'.&mt('Currently, the course-specific failsafe is set to [_1].',"<i>$enrollvar{'autodropfailsafe'}</i>").'</p>');
             }
         }
         unless (($enrollvar{'autodropfailsafe'} eq '') && ($autofailsafe eq '')) {
             if ($enrollvar{'autodropfailsafetype'} eq '') {
                 $r->print('<p>'.&mt('Currently no course-specific failsafe condition is set.').' ');
                 if ($failsafetype eq 'any') {
                     $r->print(&mt('The current domain default, whereby the failsafe is in effect if the retrieved section enrollment is zero or greater, will apply unless overridden here for this specific course.'));
                 } elsif ($failsafetype eq 'zero') {
                     $r->print(&mt('The current domain default, whereby the failsafe is only in effect if the retrieved section enrollment is zero, will apply unless overridden here for this specific course.'));
                 } elsif ($failsafetype eq 'off') {
                     $r->print(&mt('The current domain default (failsafe not in use) will apply unless overridden here for this specific course.'));
                 }
                 $r->print('</p>');
             } else {
                 if ($enrollvar{'autodropfailsafetype'} eq 'zero') {
                     $r->print('<p>'.&mt('Currently, the course-specific failsafe condition is set such that any failsafe threshold is only in effect when the retrieved institutional section enrollment is zero.'));
                 } elsif ($enrollvar{'autodropfailsafetype'} eq 'any') {
                     $r->print('<p>'.&mt('Currently, the course-specific failsafe condition is set such that any failsafe threshold is in effect when the retrieved institutional section enrollment is zero (or greater).'));
                 } elsif ($enrollvar{'autodropfailsafetype'} eq 'off') {
                     $r->print('<p>'.&mt('Currently, the course-specific failsafe condition is set such that a failsafe will not be used.'));
                 }
                 $r->print('</p>');
             }
       }        }
       $r->print('        $r->print('
              </td>               </td>
             </tr>              </tr>
            </table>             </table>
            <table width="100%" border="0" cellpadding="3" cellspacing="3">             <table width="100%" border="0" cellpadding="3" cellspacing="3">
             <tr>               <tr>
              <td><b>               <td><b>'.&mt('Condition for use of failsafe in this course').'</b><br />
             '.&mt('Failsafe (enter an integer)').'</b>&nbsp;&nbsp;               <span class="LC_nobreak"><label><input type="radio" name="autodropfailsafetype" value="dom" onclick="toggleFailsafe(this.form);"'.$failsafechecked{'dom'}.$disabled.' />'.&mt('Use domain default').'</label></span>&nbsp;--&nbsp;'.$domdefault.'<br />
               <input type="textbox" name="autodropfailsafe" value="'.$enrollvar{'autodropfailsafe'}.'" size="4"'.$disabled.' /><br />');               <span class="LC_nobreak"><label><input type="radio" name="autodropfailsafetype" value="zero" onclick="toggleFailsafe(this.form);"'.$failsafechecked{'zero'}.$disabled.' />'.&mt('Failsafe will apply if retrieved institutional section enrollment is zero.').'</label></span><br />
        if ($enrollvar{'autodropfailsafe'}) {               <span class="LC_nobreak"><label><input type="radio" name="autodropfailsafetype" value="any" onclick="toggleFailsafe(this.form);"'.$failsafechecked{'any'}.$disabled.' />'.&mt('Failsafe will apply if retrieved institutional section enrollment is zero or greater.').'</label></span><br />
           if ($autofailsafe) {                 <span class="LC_nobreak"><label><input type="radio" name="autodropfailsafetype" value="off" onclick="toggleFailsafe(this.form);"'.$failsafechecked{'off'}.$disabled.' />'.&mt('Failsafe will not be in use in this course.').'</label></span><br />
               $r->print(&mt('Leave blank to use domain default of [_1].',$autofailsafe));               <div class="LC_floatleft" style="display:'.$failsafesty.';" id="autodropfailsafe">
           } else {               <span class="LC_nobreak"><b>'.
               $r->print(&mt('Leave blank to not use.'));               &mt('Failsafe threshold (enter an integer)').'</b>&nbsp;&nbsp;
           }               <input type="text" name="autodropfailsafe" value="'.$enrollvar{'autodropfailsafe'}.'" size="4"'.$disabled.' /></span><br />');
          if ($autofailsafe) {
              $r->print(&mt('Leave blank to use domain default of [_1].','<b>'.$autofailsafe.'</b>'));
          } else {
              $r->print(&mt('As no domain default is set, failsafe will not be used if blank.'));
        }         }
        $r->print('         $r->print('</div>
              </td>               </td>
             </tr>              </tr>
             <tr>              <tr>
Line 903  sub print_main_frame { Line 1010  sub print_main_frame {
                  <th>'.&mt('LON-CAPA section ID').'</th>                   <th>'.&mt('LON-CAPA section ID').'</th>
           ');            ');
           $r->print(&Apache::loncommon::end_data_table_row());            $r->print(&Apache::loncommon::end_data_table_row());
           for (my $i=0; $i<@xlists; $i++) {            my @showable;
             &reformat_xlists($dom,$crs,$enrollvar{'coursecode'},\@xlists,\@showable);
             for (my $i=0; $i<@showable; $i++) {
               my $xl = '&nbsp;';                my $xl = '&nbsp;';
               my $lc_sec = '&nbsp;';                my $lc_sec = '&nbsp;';
               if ($xlists[$i] =~ /^([^:]+):?(.*)$/) {                if ($showable[$i] =~ /^([^:]+):?(.*)$/) {
                   $xl = $1;                    $xl = $1;
                   $lc_sec = $2;                    $lc_sec = $2;
               }                               }               
Line 1296  onclick="javascript:document.photoupdate Line 1405  onclick="javascript:document.photoupdate
                 &mt("Students with an enroll type of [_1]manual[_2], will be converted automatically to the 'auto' type, when they first appear in the institutional classlist for the course - as long as nightly adds are enabled and active, or the update roster utility is used.","'<b>","'</b>").' '.                  &mt("Students with an enroll type of [_1]manual[_2], will be converted automatically to the 'auto' type, when they first appear in the institutional classlist for the course - as long as nightly adds are enabled and active, or the update roster utility is used.","'<b>","'</b>").' '.
                 &mt("Use the 'Lock' checkbox for any manually enrolled students for whom you wish to prevent type conversion.").' '.                  &mt("Use the 'Lock' checkbox for any manually enrolled students for whom you wish to prevent type conversion.").' '.
                 &mt("Use the 'Change' checkbox to switch the enroll type from auto to manual, and vice versa.").' '.                  &mt("Use the 'Change' checkbox to switch the enroll type from auto to manual, and vice versa.").' '.
                 &mt("Use the 'Unlock' checkbox for any maually enrolled students for whom you no longer wish to lock the enroll type.").' '.                  &mt("Use the 'Unlock' checkbox for any manually enrolled students for whom you no longer wish to lock the enroll type.").' '.
                 &mt("Click the 'Go' button at the end of the page to process your desired changes.").'</td>                  &mt("Click the 'Go' button at the end of the page to process your desired changes.").'</td>
                     </tr>                      </tr>
                     <tr><td>&nbsp;</td></tr>                       <tr><td>&nbsp;</td></tr> 
Line 1680  sub print_chgsettings_response { Line 1789  sub print_chgsettings_response {
   
 sub print_chgfailsafe_response {  sub print_chgfailsafe_response {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;      my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
     my %settings = &Apache::lonnet::get('environment',['internal.autodropfailsafe'],      my %settings = &Apache::lonnet::get('environment',
                                           ['internal.autodropfailsafe',
                                            'internal.autodropfailsafetype'],
                                         $dom,$crs);                                          $dom,$crs);
     my ($currfailsafe,$newfailsafe,$response);      my ($currfailsafe,$newfailsafe,$currfailsafetype,$newfailsafetype,$response);
     if ( defined($settings{'internal.autodropfailsafe'}) ) {      if (defined($settings{'internal.autodropfailsafe'})) {
         $currfailsafe = $settings{'internal.autodropfailsafe'};          $currfailsafe = $settings{'internal.autodropfailsafe'};
     }      }
       if (defined($settings{'internal.autodropfailsafetype'})) {
           $currfailsafetype = $settings{'internal.autodropfailsafetype'};
       }
     if (exists($env{'form.autodropfailsafe'})) {      if (exists($env{'form.autodropfailsafe'})) {
         $env{'form.autodropfailsafe'} =~ s{^\s+|\s+$}{}g;          $env{'form.autodropfailsafe'} =~ s{^\s+|\s+$}{}g;
         if ($env{'form.autodropfailsafe'} !~ /\D/) {           if ($env{'form.autodropfailsafe'} !~ /\D/) { 
             $newfailsafe = $env{'form.autodropfailsafe'};              $newfailsafe = $env{'form.autodropfailsafe'};
         }          }
     }      }
     if ($currfailsafe ne $newfailsafe) {      if ($env{'form.autodropfailsafetype'} =~ /^(any|zero|off)$/) {
         my %cenv = ('internal.autodropfailsafe' => $newfailsafe);          $newfailsafetype = $env{'form.autodropfailsafetype'};
       }
       if (($currfailsafe ne $newfailsafe) || ($currfailsafetype ne $newfailsafetype)) {
           my %cenv = ('internal.autodropfailsafe' => $newfailsafe,
                       'internal.autodropfailsafetype' => $newfailsafetype,
                      );
         my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);          my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
         if ($reply ne 'ok') {          if ($reply ne 'ok') {
             $response =              $response =
                 &mt('There was a problem processing your requested changes.').' '.                  &mt('There was a problem processing your requested changes.').' '.
                 &mt('The automated enrollment settings for this course have been left unchanged.').'<br />';                  &mt('The automated enrollment settings for this course have been left unchanged.').'<br />';
         } elsif ($newfailsafe ne '') {  
             $response = &mt('Automated drop failsafe set to [_1]',$newfailsafe);  
         } else {          } else {
             $response = &mt('Course-specific automated drop failsafe deleted.');              if ($currfailsafetype ne $newfailsafetype) {
                   if ($env{'form.autodropfailsafetype'} eq 'dom') {
                       $response = &mt('Course-specific setting for condition for when failsafe applies deleted; domain default now applies.');
                   } elsif ($newfailsafetype eq 'off') {
                       $response = &mt('Course-specific setting set to disable failsafe use.');
                   } elsif ($newfailsafetype eq 'zero') {
                       $response = &mt('Course-specific setting set so failsafe applies when zero enrollment retrieved for an institutional section.');
                   } else {
                       $response = &mt('Course-specific setting set so failsafe applies when zero or greater enrollment is retrieved for an institutional section.');
                   }
                   $response .= '<br />';
               }
               if ($currfailsafe ne $newfailsafe) {
                   if ($newfailsafe ne '') {
                       $response .= &mt('Course-specific setting for drop failsafe threshold set to [_1]',$newfailsafe);
                   } else {
                       $response .= &mt('Course-specific setting for drop failsafe threshold deleted; domain default now applies.');
                   }
               }
         }          }
     } else {      } else {
         $response = &mt('The new value for the automated drop failsafe was the same as the existing value, so no changes have been made.');           $response = &mt('The new values for the automated drop failsafe threshold and conditions under which failsafe applies were the same as the existing values, so no changes have been made.'); 
     }      }
     &print_reply($r,$response,$$tasktitleref{$action});      &print_reply($r,$response,$$tasktitleref{$action});
     return;      return;
Line 2063  sub print_crosslistings_menu { Line 2198  sub print_crosslistings_menu {
  if ($crosscount > 0) {   if ($crosscount > 0) {
     $response .= &mt('The [quant,_1,course] 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.',$crosscount).      $response .= &mt('The [quant,_1,course] 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.',$crosscount).
                          '<br /><ul>'."\n";                           '<br /><ul>'."\n";
     foreach my $xl (@xlists) {              my @showable;
  my ($xlist,$lc_sec) = split(/:/,$xl);              &reformat_xlists($dom,$crs,$coursecode,\@xlists,\@showable);
               foreach my $item (@showable) {
                   my ($xlist,$lc_sec) = split(/:/,$item);
  $response .=    $response .= 
                     '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'."\n";                      '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'."\n";
     }      }
Line 2074  sub print_crosslistings_menu { Line 2211  sub print_crosslistings_menu {
     if ( exists($env{'form.numcross'}) ) {      if ( exists($env{'form.numcross'}) ) {
  my $numcross = $env{'form.numcross'};   my $numcross = $env{'form.numcross'};
  if ($numcross) {   if ($numcross) {
     $response .=               my (@codetitles,%cat_titles,%cat_order,@code_order);
                 &mt('You indicated that you wish to add an additional [quant,_1,crosslisting].',$numcross).' '.              &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
                 &mt('For each new crosslisting enter the institutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section 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.').' '.                                                       \%cat_order,\@code_order);       
                 &mt('The LON-CAPA section ID can be left blank, if you do not wish to tie a section ID to this crosslisting.').' '.      $response .=
                 &mt("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.").                  &mt('You indicated that you wish to add an additional [quant,_1,crosslisting].',$numcross).' ';
                 '<br /><br />              if (@codetitles > 0) {
            <form name="enter" method="post" action="">'.                  my $lastitem = pop(@codetitles);
            &Apache::loncommon::start_data_table().                  $response .=
            &Apache::loncommon::start_data_table_row().'                      &mt('For each new crosslisting select [_1], and enter the [_2] and the LON-CAPA section ID.',join(', ',@codetitles),$lastitem).' '.
                  <th>'.&mt('Crosslisting').'</th>                      &mt('The LON-CAPA section ID can be left blank, if you do not wish to tie a section ID to this crosslisting.').' '.
                  <th>'.&mt('LON-CAPA section ID').'</th>'."\n".                      '<br /><br />'.
            &Apache::loncommon::end_data_table_row();                      '<form name="enter" method="post" action="">'."\n".
    for (my $i=0; $i<$numcross; $i++) {                      &Apache::loncommon::start_data_table()."\n".
                $response .=                       &Apache::loncommon::start_data_table_header_row()."\n";
                    &Apache::loncommon::start_data_table_row().'                  foreach my $title (@codetitles) {
                    <td><input type="text" size="15" name="newcross_'.$i.'" /></td>                      if (ref($cat_order{$title}) eq 'ARRAY') {
                     <td align="right"><input type="text" size="10" name="newlcsec_'.$i.'" /></td>'.                          if (@{$cat_order{$title}} > 0) {
                               $response .= '<th>'.$title.'</th>';
                           }
                       }
                   }
                   $response .= '<th>'.$lastitem.'</th>'."\n".
                                '<th>'.&mt('Institutional section').'</th>'."\n".
                                '<th>'.&mt('LON-CAPA section').'</th>'."\n".
                                &Apache::loncommon::end_data_table_header_row()."\n";
                   for (my $i=0; $i<$numcross; $i++) {
                       $response .=
                           &Apache::loncommon::start_data_table_row()."\n";
                       foreach my $title (@codetitles) {
                           if (ref($cat_order{$title}) eq 'ARRAY') {
                               if (@{$cat_order{$title}} > 0) {
                                   $response .= '<td align="center">'.
                                                '<select name="newcross_'.$i.'_'.$title.'">'."\n".
                                                ' <option value="" selected="selected">'.
                                                &mt('Select').'</option>'."\n";
                                   foreach my $item (@{$cat_order{$title}}) {
                                       my $longitem = $item;
                                       if (ref($cat_titles{$title}) eq 'HASH') {
                                           if ($cat_titles{$title}{$item} ne '') {
                                               $longitem = $cat_titles{$title}{$item};
                                           }
                                       }
                                       $response .= '<option value="'.$item.'">'.$longitem.
                                                    '</option>'."\n";
                                   }
                                   $response .= '</select></td>'."\n";
                               }
                           }
                       }
                       $response .= '<td align="center">'.
                                    '<input type="text" size="5" name="newcross_'.$i.'_'.$lastitem.'" />'.
                                    '</td>'."\n".'<td align="center">'.
                                    '<input type="text" size="10" name="newcross_'.$i.'_instsec" />'.
                                    '</td>'."\n".'<td align="center">'.
                                    '<input type="text" size="10" name="newlcsec_'.$i.'" /></td>'.
                                    &Apache::loncommon::end_data_table_row()."\n";
                   }
                   $response .= &Apache::loncommon::end_data_table()."\n";
               } else {
                   $response .=              
                       &mt('For each new crosslisting enter the institutional course section code (e.g., fs03zol101001, for section 001 of zol101 for fs03 semester), and the LON-CAPA section 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.').' '.
                       &mt('The LON-CAPA section ID can be left blank, if you do not wish to tie a section ID to this crosslisting.').' '.
                       &mt("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 />'.
                       '<form name="enter" method="post" action="">'."\n".
                       &Apache::loncommon::start_data_table()."\n".
                       &Apache::loncommon::start_data_table_row()."\n".
                       '<th>'.&mt('Crosslisting').'</th>'."\n".
                       '<th>'.&mt('LON-CAPA section ID').'</th>'."\n".
                     &Apache::loncommon::end_data_table_row();                      &Apache::loncommon::end_data_table_row();
     }         for (my $i=0; $i<$numcross; $i++) {
             $response .= &Apache::loncommon::end_data_table().'                     $response .= 
                          &Apache::loncommon::start_data_table_row().'
                          <td><input type="text" size="15" name="newcross_'.$i.'" /></td>
                          <td align="right"><input type="text" size="10" name="newlcsec_'.$i.'" /></td>'.
                          &Apache::loncommon::end_data_table_row();
           }
                   $response .= &Apache::loncommon::end_data_table();
               }
               $response .= '
               </td>                </td>
              </tr>               </tr>
              <tr>               <tr>
Line 2134  sub print_crosslistings_response { Line 2331  sub print_crosslistings_response {
     }      }
     if ($numcross) {      if ($numcross) {
         my %curr_groups = &Apache::longroup::coursegroups();          my %curr_groups = &Apache::longroup::coursegroups();
           my (@codetitles,%cat_titles,%cat_order,@code_order);
           &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
                                                    \%cat_order,\@code_order);
           my $lastitem = $codetitles[-1];
  for (my $i=0; $i<$numcross; $i++) {   for (my $i=0; $i<$numcross; $i++) {
     my $xl = "newcross_".$i;      my $xl = '';
               if (@code_order > 0) {
                   foreach my $item (@code_order) {
                       my $possval = $env{'form.newcross_'.$i.'_'.$item};
                       if ($item eq $lastitem) {
                           $xl .= $possval;
                       } else {
                           my $possval = $env{'form.newcross_'.$i.'_'.$item};
                           if (ref($cat_order{$item}) eq 'ARRAY') {
                               if (grep(/^\Q$possval\E$/,@{$cat_order{$item}})) {
                                   $xl .= $possval;
                               }
                           }
                       }
                   }
                   if ($xl ne '') {
                       my $crskey = $crs.':'.$xl;
                       if ($env{'form.newcross_'.$i.'_instsec'} ne '') {
                           my $poss_sec = $env{'form.newcross_'.$i.'_instsec'};
                           my %formatted = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',
                                                                                  {$crskey => [$poss_sec]});
                           if (ref($formatted{$crskey}) eq 'ARRAY') {
                               $xl .= $formatted{$crskey}->[0];
                           }
                       }
                   }
               } else {
                   $xl = $env{'form.newcross_'.$i};
               }
     my $lc_sec = "newlcsec_".$i;      my $lc_sec = "newlcsec_".$i;
     if ( exists($env{"form.$xl"}) ) {      if ($xl ne '') {
                 if (exists($env{"form.$lc_sec"})) {                  if (exists($env{"form.$lc_sec"})) {
                     my $lc_sec_check = &validate_lcsec(\%curr_groups,                      my $lc_sec_check = &validate_lcsec(\%curr_groups,
                                                     $env{"form.$lc_sec"});                                                      $env{"form.$lc_sec"});
                     if ($lc_sec_check eq 'reserved') {                      if ($lc_sec_check eq 'reserved') {
                         push(@reserved,$env{"form.$xl"}.":".$env{"form.$lc_sec"});                          push(@reserved,$xl.':'.$env{"form.$lc_sec"});
                         next;                          next;
                     } elsif ($lc_sec_check eq 'group') {                      } elsif ($lc_sec_check eq 'group') {
                         push(@matchgroup,$env{"form.$xl"}.":".$env{"form.$lc_sec"});                          push(@matchgroup,$xl.':'.$env{"form.$lc_sec"});
                         next;                          next;
                     }                      }
                 }                  }
  my $coursecheck =    my $coursecheck =
                     &Apache::lonnet::auto_validate_courseID($crs,$dom,$env{"form.$xl"});                      &Apache::lonnet::auto_validate_courseID($crs,$dom,$xl);
  if ($coursecheck eq 'ok') {   if ($coursecheck eq 'ok') {
     my $addcheck = '';      my $addcheck = '';
     $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$env{"form.$xl"},$owner,$coowners);      $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$xl,$owner,$coowners);
     if ($addcheck eq 'ok') {      unless ($addcheck eq 'ok') {
  push(@xlists,$env{"form.$xl"}.":".$env{"form.$lc_sec"});                          if ($coowners) {
     } else {                              foreach my $user (split(/,/,$coowners)) {
  push(@badowner,$env{"form.$xl"}.":".$env{"form.$lc_sec"});                                  if ($user =~ /^($match_username):($match_domain)$/) {
                                       if (&Apache::lonnet::auto_validate_inst_crosslist($crs,$dom,$coursecode,
                                                                                         $xl,$user) eq 'valid') {
                                           $addcheck = 'ok';
                                           last;
                                       }
                                   }
                               }
                           }
                       }
                       if ($addcheck eq 'ok') {
                           push(@xlists,$xl.':'.$env{"form.$lc_sec"});
                       } else { 
    push(@badowner,$xl.':'.$env{"form.$lc_sec"});
     }      }
  } else {   } else {
     push(@badxlists,$env{"form.$xl"}.":".$env{"form.$lc_sec"}.":".$coursecheck);      push(@badxlists,$xl.':'.$env{"form.$lc_sec"}.":".$coursecheck);
  }   }
     }      }
  }   }
Line 2180  sub print_crosslistings_response { Line 2422  sub print_crosslistings_response {
                 '<br /><br />';                  '<br /><br />';
  } else {   } else {
     $response = &mt('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";      $response = &mt('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";
     foreach my $item (@allxlists) {              my @showable;
               &reformat_xlists($dom,$crs,$coursecode,\@allxlists,\@showable);
               foreach my $item (@showable) {
  my ($xlist,$lc_sec) = split(/:/,$item);   my ($xlist,$lc_sec) = split(/:/,$item);
  $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.   $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.
                               "\n";                                "\n";
Line 2192  sub print_crosslistings_response { Line 2436  sub print_crosslistings_response {
     my @oldxlists = split(/,/,$xliststr);      my @oldxlists = split(/,/,$xliststr);
     $response .= &mt('Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.').      $response .= &mt('Although no new crosslistings were added, the courses listed below continue to be crosslisted with your LON-CAPA course.').
                          '<br /><ul>'."\n";                           '<br /><ul>'."\n";
     foreach my $xl (@oldxlists) {              my @showable;
  my ($xlist,$lc_sec) = split(/:/,$xl);              &reformat_xlists($dom,$crs,$coursecode,\@oldxlists,\@showable);
               foreach my $item (@showable) {
    my ($xlist,$lc_sec) = split(/:/,$item);
  $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.   $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.
                              "\n";                               "\n";
     }      }
Line 2203  sub print_crosslistings_response { Line 2449  sub print_crosslistings_response {
     if (@badxlists > 0) {      if (@badxlists > 0) {
  $response .= &mt("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.").   $response .= &mt("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";                       '<br /><ul>'."\n";
  foreach my $item (@badxlists) {          my @showable;
           &reformat_xlists($dom,$crs,$coursecode,\@badxlists,\@showable);
           foreach my $item (@showable) {
     my ($xlist,$lc_sec,$prob) = split(/:/,$item);      my ($xlist,$lc_sec,$prob) = split(/:/,$item);
     $response .= '<li>'.      $response .= '<li>'.
                          &mt('[_1] - ID: [_2] - Error: [_3]',                           &mt('[_1] - ID: [_2] - Error: [_3]',
Line 2215  sub print_crosslistings_response { Line 2463  sub print_crosslistings_response {
     if (@badowner > 0) {      if (@badowner > 0) {
  $response .= &mt("The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - [_1] - does not have rights to view enrollment in those classes, as determined by your instititution's policies on access to official classlists.",$owner).   $response .= &mt("The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the owner of this course - [_1] - does not have rights to view enrollment in those classes, as determined by your instititution's policies on access to official classlists.",$owner).
                      '<br /><ul>'."\n";                       '<br /><ul>'."\n";
  foreach my $item (@badowner) {          my @showable;
           &reformat_xlists($dom,$crs,$coursecode,\@badowner,\@showable);
           foreach my $item (@showable) {
     my ($xlist,$lc_sec) = split(/:/,$item);      my ($xlist,$lc_sec) = split(/:/,$item);
     $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.      $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.
                          "\n";                           "\n";
Line 2227  sub print_crosslistings_response { Line 2477  sub print_crosslistings_response {
                      &mt('Please [_1]go back[_2]</a> and change the section ID for each of these courses.',                       &mt('Please [_1]go back[_2]</a> and change the section ID for each of these courses.',
                          '<a href="javascript:history(-1)">','>/a>').                           '<a href="javascript:history(-1)">','>/a>').
                      '<br /><ul>'."\n";                         '<br /><ul>'."\n";  
         foreach my $item (@reserved) {          my @showable;
           &reformat_xlists($dom,$crs,$coursecode,\@reserved,\@showable);
           foreach my $item (@showable) {
             my ($xlist,$lc_sec) = split(/:/,$item);              my ($xlist,$lc_sec) = split(/:/,$item);
             $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.              $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.
                          "\n";                           "\n";
Line 2239  sub print_crosslistings_response { Line 2491  sub print_crosslistings_response {
         $response .= &mt('The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the section ID associated with the crosslisted course is the name of a group in this course.').' '.          $response .= &mt('The courses listed below could not be included in the crosslistings for this LON-CAPA course, because the section ID associated with the crosslisted course is the name of a group in this course.').' '.
                      &mt('Please [_1]go back[_2] and change the section ID for each of these courses.','<a href="javascript:history(-1)">','</a>').                       &mt('Please [_1]go back[_2] and change the section ID for each of these courses.','<a href="javascript:history(-1)">','</a>').
                      '<br /><ul>'."\n";                       '<br /><ul>'."\n";
         foreach my $item (@matchgroup) {          my @showable;
           &reformat_xlists($dom,$crs,$coursecode,\@matchgroup,\@showable);
           foreach my $item (@showable) {
             my ($xlist,$lc_sec) = split(/:/,$item);              my ($xlist,$lc_sec) = split(/:/,$item);
             $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.              $response .= '<li>'.&mt('[_1] - ID: [_2]',$xlist,$lc_sec).'</li>'.
                          "\n";                           "\n";
Line 2259  sub print_crosslistings_response { Line 2513  sub print_crosslistings_response {
     return;      return;
 }  }
   
   sub reformat_xlists {
       my ($dom,$crs,$coursecode,$xlistsref,$showxlistsref) = @_;
       return unless ((ref($xlistsref) eq 'ARRAY') && (ref($showxlistsref) eq 'ARRAY'));
       my $crskey = $crs.':'.$coursecode;
       my (@xlcodes,@lcsecs,@extras);
       foreach my $xl (@{$xlistsref}) {
           my ($instcodesec,$lc_sec,$extra) = split(/:/,$xl);
           push(@xlcodes,$instcodesec);
           push(@lcsecs,$lc_sec);
           push(@extras,$extra);
       }
       my %reformatted =
           &Apache::lonnet::auto_instsec_reformat($dom,'declutter',
                                                  {$crskey => \@xlcodes});
       if (ref($reformatted{$crskey}) eq 'ARRAY') {
           @xlcodes = @{$reformatted{$crskey}};
           for (my $i=0; $i<@xlcodes; $i++) {
               my $value = $xlcodes[$i].':'.$lcsecs[$i];
               if ($extras[$i] ne '') {
                   $value .= ':'.$extras[$i];
               }
               push(@{$showxlistsref},$value);
           }
       }
       return;
   }
   
 sub print_sections_menu {  sub print_sections_menu {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;      my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
     my %settings =       my %settings = 
Line 2294  sub print_sections_menu { Line 2575  sub print_sections_menu {
     push(@sections,$secentry);      push(@sections,$secentry);
     $seccount ++;      $seccount ++;
  } else {   } else {
     my $newsec = $coursecode.$env{"form.$secnum"};                      my $newsec;
                       my $crskey = $crs.':'.$coursecode;
                       my %formattedsec = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',
                                                                     {$crskey => [$env{"form.$secnum"}]});
                       if (ref($formattedsec{$crskey}) eq 'ARRAY') {
                           $newsec = $coursecode.$formattedsec{$crskey}->[0];
                       } else {
                           $newsec = $coursecode.$env{"form.$secnum"};
                       }
     my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);      my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
     if ($coursecheck eq 'ok') {      if ($coursecheck eq 'ok') {
  my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);   my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);
Line 2482  sub print_sections_response { Line 2771  sub print_sections_response {
                         push(@matchgroup,$env{"form.$sec"}.":".$env{"form.$lc_sec"});                          push(@matchgroup,$env{"form.$sec"}.":".$env{"form.$lc_sec"});
                         next;                          next;
                     }                      }
     my $newsec = $coursecode.$env{"form.$sec"};                      my $newsec;
                       my $crskey = $crs.':'.$coursecode;
                       my %formattedsec = &Apache::lonnet::auto_instsec_reformat($dom,'clutter',
                                                                     {$crskey => [$env{"form.$sec"}]});
                       if (ref($formattedsec{$crskey}) eq 'ARRAY') {
                           $newsec = $coursecode.$formattedsec{$crskey}->[0];
                       } else {
                           $newsec = $coursecode.$env{"form.$sec"};
                       }
     my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);      my $coursecheck = &Apache::lonnet::auto_validate_courseID($crs,$dom,$newsec);
     if ($coursecheck eq 'ok') {      if ($coursecheck eq 'ok') {
  my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);   my $addcheck = &Apache::lonnet::auto_new_course($crs,$dom,$newsec,$owner,$coowners);
Line 2801  sub print_photoupdate_response { Line 3098  sub print_photoupdate_response {
  'internal.sectionnums',   'internal.sectionnums',
  'internal.crosslistings'],   'internal.crosslistings'],
  $dom,$crs);   $dom,$crs);
     &Apache::loncommon::get_institutional_codes(\%settings,\@allcourses,\%LC_code);      &Apache::loncommon::get_institutional_codes($dom,$crs,\%settings,\@allcourses,\%LC_code);
     if (@allcourses > 0) {      if (@allcourses > 0) {
         @{$affiliates{$crs}} = @allcourses;          @{$affiliates{$crs}} = @allcourses;
         $outcome = &Apache::lonnet::auto_photoupdate(\%affiliates,$dom,$crs,\%changes);          $outcome = &Apache::lonnet::auto_photoupdate(\%affiliates,$dom,$crs,\%changes);
Line 2883  sub print_update_result { Line 3180  sub print_update_result {
         &Apache::lonnet::get('environment',          &Apache::lonnet::get('environment',
             ['internal.coursecode','internal.sectionnums','internal.crosslistings',              ['internal.coursecode','internal.sectionnums','internal.crosslistings',
              'internal.authtype','internal.autharg','internal.showphoto','internal.defaultcredits',               'internal.authtype','internal.autharg','internal.showphoto','internal.defaultcredits',
              'internal.autodropfailsafe','internal.textbook'],               'internal.autodropfailsafe','internal.autodropfailsafetype','internal.textbook'],
             $dom,$crs);              $dom,$crs);
     my $coursecode = $settings{'internal.coursecode'};      my $coursecode = $settings{'internal.coursecode'};
     my $authtype = $settings{'internal.authtype'};      my $authtype = $settings{'internal.authtype'};
Line 2905  sub print_update_result { Line 3202  sub print_update_result {
             }              }
         }          }
     }      }
       my $failsafetype = $settings{'internal.autodropfailsafetype'};
       if ($failsafetype eq '') {
           $failsafetype = $domdefaults{'failsafe'};
       }
     my $failsafe = $settings{'internal.autodropfailsafe'};      my $failsafe = $settings{'internal.autodropfailsafe'};
     if ($failsafe eq '') {      if ($failsafe eq '') {
         $failsafe = $domdefaults{'autofailsafe'};          $failsafe = $domdefaults{'autofailsafe'};
Line 2931  sub print_update_result { Line 3232  sub print_update_result {
  $response = &mt('There was a problem retrieving the course code for this LON-CAPA course.').' '.   $response = &mt('There was a problem retrieving the course code for this LON-CAPA course.').' '.
                     &mt('An update of the class roster has not been carried out, and enrollment remains unchanged.');                      &mt('An update of the class roster has not been carried out, and enrollment remains unchanged.');
     } else {      } else {
         &Apache::loncommon::get_institutional_codes(\%settings,\@allcourses,\%LC_code);          &Apache::loncommon::get_institutional_codes($dom,$crs,\%settings,\@allcourses,\%LC_code);
  if (@allcourses > 0) {   if (@allcourses > 0) {
     @{$affiliates{$crs}} = @allcourses;      @{$affiliates{$crs}} = @allcourses;
     my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs);      my $outcome = &Apache::lonnet::fetch_enrollment_query('updatenow',\%affiliates,\%reply,$dom,$crs);
Line 2943  sub print_update_result { Line 3244  sub print_update_result {
                                  ": ".$outcome);                                   ": ".$outcome);
             }              }
     if ($reply{$crs} > 0) {      if ($reply{$crs} > 0) {
  ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,$showcredits,$defaultcredits,$failsafe,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow",\%phototypes);   ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,$showcredits,$defaultcredits,$failsafe,$failsafetype,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow",\%phototypes);
     } else {      } else {
  $response = &mt('There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course.').' '.   $response = &mt('There was a problem retrieving institutional class list data for the course sections and crosslisted courses which contribute enrollment to this course.').' '.
                             &mt('No updates have been carried out, and the roster remains unchanged.');                              &mt('No updates have been carried out, and the roster remains unchanged.');
Line 3323  sub get_task_text { Line 3624  sub get_task_text {
         &Apache::lonlocal::texthash(          &Apache::lonlocal::texthash(
            information   => 'Task information',             information   => 'Task information',
            chgsettings   => 'Automated adds/drops',             chgsettings   => 'Automated adds/drops',
            chgfailsafe   => 'Change zero enrollment failsafe',             chgfailsafe   => 'View/change enrollment failsafe',
            setdates      => 'Change enrollment dates',             setdates      => 'Change enrollment dates',
            setaccess     => 'Change access dates',             setaccess     => 'Change access dates',
            notify        => 'Notification of changes',             notify        => 'Notification of changes',
Line 3355  sub get_task_text { Line 3656  sub get_task_text {
     );      );
   
     if ((ref($permref) eq 'HASH') && (!$permref->{'edit'})) {      if ((ref($permref) eq 'HASH') && (!$permref->{'edit'})) {
         $tasklong{'chgfailsafe'} = &mt('Zero enrollment failsafe');          $tasklong{'chgfailsafe'} = &mt('Enrollment failsafe');
         $tasklong{'setdates'}    = &mt('Enrollment dates');          $tasklong{'setdates'}    = &mt('Enrollment dates');
         $tasklong{'setaccess'}   = &mt('Access dates');          $tasklong{'setaccess'}   = &mt('Access dates');
         $tasklong{'crosslist'}   = &mt('Crosslistings');          $tasklong{'crosslist'}   = &mt('Crosslistings');
Line 3463  sub handler { Line 3764  sub handler {
         $r->print(&header($action,\%permhash));          $r->print(&header($action,\%permhash));
     } else {      } else {
         if ($state eq "choose") {          if ($state eq "choose") {
             $r->print(&choose_header($action,\%permhash));              $r->print(&choose_header($action,\%permhash,$dom));
         } else {          } else {
             if ($action eq "crosslist") {              if ($action eq "crosslist") {
                 if ( exists($env{'form.numcross'}) ) {                  if ( exists($env{'form.numcross'}) ) {
                     if ( $env{'form.numcross'} > 0 ) {                      if ( $env{'form.numcross'} > 0 ) {
                         $r->print(&choose_header($action,\%permhash));                          $r->print(&choose_header($action,\%permhash,$dom));
                     } else {                      } else {
                         $r->print(&header($action,\%permhash));                          $r->print(&header($action,\%permhash));
                     }                      }
Line 3478  sub handler { Line 3779  sub handler {
             } elsif ($action eq "sections") {              } elsif ($action eq "sections") {
                 if ( exists($env{'form.numsec'}) ) {                  if ( exists($env{'form.numsec'}) ) {
                     if ( $env{'form.numsec'} > 0 ) {                      if ( $env{'form.numsec'} > 0 ) {
                         $r->print(&choose_header($action,\%permhash));                          $r->print(&choose_header($action,\%permhash,$dom));
                     } else {                      } else {
                         $r->print(&header($action,\%permhash));                          $r->print(&header($action,\%permhash));
                     }                      }

Removed from v.1.85  
changed lines
  Added in v.1.92


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