Diff for /loncom/interface/lonpopulate.pm between versions 1.75 and 1.84

version 1.75, 2013/03/01 05:10:09 version 1.84, 2016/07/24 14:34:59
Line 51  sub header { Line 51  sub header {
 sub choose_header {  sub choose_header {
     my ($action) = @_;      my ($action) = @_;
     my $notify_check = '/^note_[0-9]+$/';      my $notify_check = '/^note_[0-9]+$/';
     my %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',
             drop => 'You must select either "Enable" or "Disable" for nightly removals based on classlist changes',              drop => 'You must select either "Enable" or "Disable" for nightly removals based on classlist changes',
Line 61  sub choose_header { Line 61  sub choose_header {
             ynot => 'You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients.',              ynot => 'You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients.',
             atle => 'You must check at least one checkbox, before proceeding to the next page',              atle => 'You must check at least one checkbox, before proceeding to the next page',
     );      );
     $lt{'both'} = &mt('You have selected "No" for both addition and removal of students[_1] in the institutional classlist but not in your LON-CAPA course.[_1]','\\n');      $js_lt{'both'} = &mt('You have selected "No" for both addition and removal of students[_1] in the institutional classlist but not in your LON-CAPA course.[_1]',"\n");
     $lt{'nnot'} = &mt('You have indicated that you do not want notification of roster changes messages to be sent, but [_1] have been checked as recipients.[_2]',"'+totalnote+'",'\\n');      $js_lt{'nnot'} = &mt('You have indicated that you do not want notification of roster changes messages to be sent, but [_1] have been checked as recipients.[_2]',"'+totalnote+'","\n");
       &js_escape(\%js_lt);
           
     my $scripttag = <<ENDJSONE;      my $scripttag = <<ENDJSONE;
 <script type="text/javascript" language="JavaScript">  <script type="text/javascript" language="JavaScript">
Line 88  function process(calling,numauto,nummanu Line 89  function process(calling,numauto,nummanu
        }         }
    }     }
    if (rad1 == 0) {     if (rad1 == 0) {
        alert('$lt{'adds'}');         alert('$js_lt{'adds'}');
        checker = 0         checker = 0
    }     }
    if (rad2 == 0) {     if (rad2 == 0) {
        alert('$lt{'drop'}');         alert('$js_lt{'drop'}');
        checker = 0         checker = 0
    }     }
  }   }
Line 116  function process(calling,numauto,nummanu Line 117  function process(calling,numauto,nummanu
          }           }
      }       }
      if (rad1 == 0) {       if (rad1 == 0) {
          alert('$lt{'drop'}');           alert('$js_lt{'drop'}');
          checker = 0;           checker = 0;
      }       }
      if (rad2 == 0) {       if (rad2 == 0) {
          alert('$lt{'ysno'}');           alert('$js_lt{'ysno'}');
          checker = 0;           checker = 0;
      }       }
      if (formName.updatedrops[unenrolldis].checked && formName.updateadds[enrolldis].checked ) {       if (formName.updatedrops[unenrolldis].checked && formName.updateadds[enrolldis].checked ) {
          alert('$lt{'both'}$lt{'noup'}');           alert('$js_lt{'both'}$js_lt{'noup'}');
          checker = 0;           checker = 0;
      }       }
  }   }
Line 141  function process(calling,numauto,nummanu Line 142  function process(calling,numauto,nummanu
      }       }
      if (totalnote > 0) {       if (totalnote > 0) {
  if (formName.notify[1].checked == true) {   if (formName.notify[1].checked == true) {
      if (confirm('$lt{'nnot'}$lt{'eras'}')) {       if (confirm('$js_lt{'nnot'}$js_lt{'eras'}')) {
  checker = 1;   checker = 1;
      } else {       } else {
  checker = 0;   checker = 0;
Line 149  function process(calling,numauto,nummanu Line 150  function process(calling,numauto,nummanu
  }   }
      } else {       } else {
  if (formName.notify[0].checked == true) {   if (formName.notify[0].checked == true) {
      alert('$lt{'ynot'}');       alert('$js_lt{'ynot'}');
      checker = 0;       checker = 0;
  }   }
      }       }
Line 177  function process(calling,numauto,nummanu Line 178  function process(calling,numauto,nummanu
         document.forms.studentform.state.value = "process";          document.forms.studentform.state.value = "process";
      }       }
      if (totcheck == 0) {       if (totcheck == 0) {
         alert('$lt{'atle'}')          alert('$js_lt{'atle'}')
         checker = 0;          checker = 0;
      }       }
  }    } 
Line 290  sub print_main_frame { Line 291  sub print_main_frame {
 # Get course settings  # Get course settings
   my %enrollvar;    my %enrollvar;
   my %settings = &Apache::lonnet::dump('environment',$dom,$crs);    my %settings = &Apache::lonnet::dump('environment',$dom,$crs);
   foreach my $item (keys %settings) {    foreach my $item (keys(%settings)) {
       if ($item =~ m/^internal\.(.+)$/) {        if ($item =~ m/^internal\.(.+)$/) {
           $enrollvar{$1} = $settings{$item};            $enrollvar{$1} = $settings{$item};
       } elsif ($item =~ /^default_enrollment_(start|end)_date$/) {        } elsif ($item =~ /^default_enrollment_(start|end)_date$/) {
Line 349  sub print_main_frame { Line 350  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>'.&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>
               </tr>
               <tr>
              <td colspan="2">&nbsp;</td>               <td colspan="2">&nbsp;</td>
             </tr>              </tr>
             <tr>              <tr>
Line 422  sub print_main_frame { Line 427  sub print_main_frame {
             <input type="hidden" name="action" value="'.$action.'" />              <input type="hidden" name="action" value="'.$action.'" />
             <input type="hidden" name="state" value="process" />              <input type="hidden" name="state" value="process" />
             </form>'."\n");              </form>'."\n");
     } elsif ($action eq 'chgfailsafe') {
         my $autofailsafe;
         my %domconfig =
             &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
         if (ref($domconfig{'autoenroll'}) eq 'HASH') {
             $autofailsafe = $domconfig{'autoenroll'}->{'autofailsafe'};
             if ($autofailsafe =~ /\D/) {
                 undef($autofailsafe);
             }
         }
         $r->print('
             <form name="enter" method="post" action=""><br />
              <table width="100%" border="0" cellpadding="2" cellspacing="2">
               <tr>
                <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>'.
               '<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>');
         if ($enrollvar{'autodropfailsafe'} eq '') {
             $r->print('<p>'.&mt('Currently no course-specific failsafe value is set.').' ');
             if ($autofailsafe eq '') {
                 $r->print(&mt('Currently no domain default failsafe is set either.'));
             } 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('</p>');
         } else {
             $r->print('<p>'.&mt('Currently, the course-specific failsafe is set to [_1].',"<i>$enrollvar{'autodropfailsafe'}</i>").'</p>');
         }
         $r->print('
                </td>
               </tr>
              </table>
              <table width="100%" border="0" cellpadding="3" cellspacing="3">
               <tr>
                <td><b>
               '.&mt('Failsafe (enter an integer)').'</b>&nbsp;&nbsp;
                 <input type="textbox" name="autodropfailsafe" value="'.$enrollvar{'autodropfailsafe'}.'" size="4" /><br />');
          if ($enrollvar{'autodropfailsafe'}) {
             if ($autofailsafe) {  
                 $r->print(&mt('Leave blank to use domain default of [_1].',$autofailsafe));
             } else {
                 $r->print(&mt('Leave blank to not use.'));
             }
          }
          $r->print('
                </td>
               </tr>
               <tr>
                 <td>&nbsp;</td>
               </tr>
               <tr>
                 <td>'.&mt('Push "Go" to save your changes').'
               <tr>
                 <td>&nbsp;</td>
               </tr>
               <tr>
                <td align="right">
                 <input type="button" name="updatefailsafe" value="'.&mt('Go').'" onclick="'."process('chgfailsafe')".'" />
                </td>
               </tr>
              </table>
              <input type="hidden" name="action" value="'.$action.'" />
              <input type="hidden" name="state" value="process" />
              </form>'."\n");
   } elsif ($action eq 'setdates') {    } elsif ($action eq 'setdates') {
       my ($start_table,$end_table) = &date_setting_table($enrollvar{autostart},$enrollvar{autoend},$action);        my ($start_table,$end_table) = &date_setting_table($enrollvar{autostart},$enrollvar{autoend},$action);
       my $oldstartshow = '';        my $oldstartshow = '';
Line 749  sub print_main_frame { Line 818  sub print_main_frame {
           $r->print(            $r->print(
               &mt('Currently, this LON-CAPA course is crosslisted with [quant,_1,course section,course sections].',$cross_str).' '.                &mt('Currently, this LON-CAPA course is crosslisted with [quant,_1,course section,course sections].',$cross_str).' '.
               &mt('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.').' '.                &mt('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.').' '.
               &mt('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: [_1; otherwise uncheck it.',"<b>$realm ($enrollvar{coursecode})</b>").' '.                &mt('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: [_1]; otherwise uncheck it.',"<b>$realm ($enrollvar{coursecode})</b>").' '.
               &mt('If you wish to change the section ID assigned in your LON-CAPA course for a crosslisted course, enter the new section ID in the appropriate textbox.').' '.                &mt('If you wish to change the section ID assigned in your LON-CAPA course for a crosslisted course, enter the new section ID in the appropriate textbox.').' '.
               &mt('The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this crosslisting.').' '.                &mt('The LON-CAPA section ID can be left (or set to) empty, if you do not wish to tie a section ID to this crosslisting.').' '.
               &mt('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.').' '.                &mt('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.').' '.
Line 1063  sub print_main_frame { Line 1132  sub print_main_frame {
                     </tr>                      </tr>
                     <tr>                      <tr>
                      <td align="right">                       <td align="right">
                       <input type="button" name="showphotos" value="Go" onclick="process('."'photos'".')" />                        <input type="button" name="showphotos" value="'.&mt('Go').'" onclick="process('."'photos'".')" />
                      </td>                       </td>
                     </tr>                      </tr>
                    </table>                     </table>
Line 1356  sub print_accessdate_table { Line 1425  sub print_accessdate_table {
          'fnew' => 'for new students added when you update the class roster',           'fnew' => 'for new students added when you update the class roster',
          'ifad'  => 'If automated adds are enabled, then when students are added their student roles will become active on the date set here for first access, and their roles will become inactive on the date set here for last access.  These default access dates will be overridden for specific students if the institutional classlist data supplied to the automatic enrollment process includes entries for the startdate and enddate fields for those students.',           'ifad'  => 'If automated adds are enabled, then when students are added their student roles will become active on the date set here for first access, and their roles will become inactive on the date set here for last access.  These default access dates will be overridden for specific students if the institutional classlist data supplied to the automatic enrollment process includes entries for the startdate and enddate fields for those students.',
     );      );
     $lt{'ncds'} = &mt('changing default start and end access dates will affect [_1]future enrollments[_2] and also [_1]currently inactive[_2] students (i.e., those for whom access will begin in the future).','<b>','</b>');      $lt{'ncds'} = &mt('Changing default start and end access dates will affect [_1]future enrollments[_2] and also [_1]currently inactive[_2] students (i.e., those for whom access will begin in the future).','<b>','</b>');
     $lt{'tcha'} = &mt('To change access dates for [_1]currently active[_2] students, use User Management -> "Manage Course Users" to display currently active students, then use the dropdown menu for "Action to take for selected users:" to choose "Change starting/ending dates", select the students to change, and click "Proceed".','<b>','</b>');      $lt{'tcha'} = &mt('To change access dates for [_1]currently active[_2] students, use User Management -> "Manage Course Users" to display currently active students, then use the dropdown menu for "Action to take for selected users:" to choose "Change starting/ending dates", select the students to change, and click "Proceed".','<b>','</b>');
     my $dateshow;      my $dateshow;
     if ( ($oldendshow eq '') && ($oldstartshow eq '') ) {      if ( ($oldendshow eq '') && ($oldstartshow eq '') ) {
Line 1466  sub print_doc_base { Line 1535  sub print_doc_base {
 ###################################################################  ###################################################################
 sub print_chgsettings_response {  sub print_chgsettings_response {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;      my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
     my %settings = &Apache::lonnet::get('environment',['internal.sectionnums','internal.crosslistings','internal.autostart','internal.autoend','internal.autoadds','internal.autodrops'],$dom,$crs);      my %settings = &Apache::lonnet::get('environment',['internal.autoadds','internal.autodrops'],$dom,$crs);
     my ($currend,$currstart,$currsecs,$currxlists,$curradds,$currdrops,      my ($curradds,$currdrops,$autoadds,$autodrops,$response,$warning,
         $autoadds,$autodrops,$response,$warning,$warn_prefix,$warn_suffix,          $warn_prefix,$warn_suffix,$warnfiller);
         $warnfiller);  
     if ( defined($settings{'internal.autoadds'}) ) {      if ( defined($settings{'internal.autoadds'}) ) {
  $curradds = $settings{'internal.autoadds'};   $curradds = $settings{'internal.autoadds'};
     }      }
     if ( defined($settings{'internal.autodrops'}) ) {      if ( defined($settings{'internal.autodrops'}) ) {
  $currdrops = $settings{'internal.autodrops'};   $currdrops = $settings{'internal.autodrops'};
     }      }
     if ( defined($settings{'internal.autostart'}) ) {  
  $currstart = $settings{'internal.autostart'};  
     }  
     if ( defined($settings{'internal.autoend'}) ) {  
  $currend = $settings{'internal.autoend'};  
     }  
     if ( defined($settings{'internal.sectionnums'}) ) {  
  $currsecs = $settings{'internal.sectionnums'};  
     }  
     if ( defined($settings{'internal.crosslistings'}) ) {  
  $currxlists = $settings{'internal.crosslistings'}  
     }  
     if ( exists($env{'form.autoadds'}) ) {      if ( exists($env{'form.autoadds'}) ) {
  $autoadds=$env{'form.autoadds'};   $autoadds=$env{'form.autoadds'};
     }      }
Line 1537  sub print_chgsettings_response { Line 1593  sub print_chgsettings_response {
             unless ($warning eq '') {              unless ($warning eq '') {
         $response .= '<br /><span class="LC_warning">'.          $response .= '<br /><span class="LC_warning">'.
                              '<b>'.&mt('Warning.').'</b> ';                               '<b>'.&mt('Warning.').'</b> ';
                 if ($autodrops && $autodrops) {                  if ($autoadds && $autodrops) {
                     $response .=                       $response .= 
                         &mt('Although you indicated that nightly adds and drops should be enabled, additional action is required.');                          &mt('Although you indicated that nightly adds and drops should be enabled, additional action is required.');
                 } elsif ($autoadds) {                  } elsif ($autoadds) {
Line 1555  sub print_chgsettings_response { Line 1611  sub print_chgsettings_response {
     return;      return;
 }  }
   
   sub print_chgfailsafe_response {
       my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
       my %settings = &Apache::lonnet::get('environment',['internal.autodropfailsafe'],
                                           $dom,$crs);
       my ($currfailsafe,$newfailsafe,$response);
       if ( defined($settings{'internal.autodropfailsafe'}) ) {
           $currfailsafe = $settings{'internal.autodropfailsafe'};
       }
       if (exists($env{'form.autodropfailsafe'})) {
           $env{'form.autodropfailsafe'} =~ s{^\s+|\s+$}{}g;
           if ($env{'form.autodropfailsafe'} !~ /\D/) { 
               $newfailsafe = $env{'form.autodropfailsafe'};
           }
       }
       if ($currfailsafe ne $newfailsafe) {
           my %cenv = ('internal.autodropfailsafe' => $newfailsafe);
           my $reply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
           if ($reply ne 'ok') {
               $response =
                   &mt('There was a problem processing your requested changes.').' '.
                   &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 {
               $response = &mt('Course-specific automated drop failsafe deleted.');
           }
       } else {
           $response = &mt('The new value for the automated drop failsafe was the same as the existing value, so no changes have been made.'); 
       }
       &print_reply($r,$response,$$tasktitleref{$action});
       return;
   }
   
 sub print_setdates_response {  sub print_setdates_response {
     my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;      my ($r,$realm,$dom,$crs,$action,$tasktitleref) = @_;
     my %settings =       my %settings = 
Line 1706  sub print_setaccess_response { Line 1795  sub print_setaccess_response {
                 '<br />'.                  '<br />'.
                 &mt('Any change in access dates will only apply to students who are not currently active, i.e., those who currently have access start dates in the future, and to those added by future automated enrollment.').                  &mt('Any change in access dates will only apply to students who are not currently active, i.e., those who currently have access start dates in the future, and to those added by future automated enrollment.').
                 '<br /><br />'.                  '<br /><br />'.
                  &mt('To change access dates for any currently active students, use User Management -> "Manage Users" to display currently active students, then use the dropdown menu for "Action to take for selected users:" to choose "Change starting/ending dates", select the students to change, and click "Proceed".').                   &mt('To change access dates for [_1]currently active[_2] students, use User Management -> "Manage course users" to display currently active students, then use the dropdown menu for "Action to take for selected users:" to choose "Change starting/ending dates", select the students to change, and click "Proceed".','<b>','</b>').
                 '<br />';                  '<br />';
   
 # Generate message in case where old first access date was later than today, but new first access date is now today or earlier.  # Generate message in case where old first access date was later than today, but new first access date is now today or earlier.
Line 1920  sub print_crosslistings_menu { Line 2009  sub print_crosslistings_menu {
  if ($numcross) {   if ($numcross) {
     $response .=       $response .= 
                 &mt('You indicated that you wish to add an additional [quant,_1,crosslisting].',$numcross).' '.                  &mt('You indicated that you wish to add an additional [quant,_1,crosslisting].',$numcross).' '.
                 &mt('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 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('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 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.").                  &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 />                  '<br /><br />
Line 2250  sub print_sections_menu { Line 2339  sub print_sections_menu {
  if ($numsec > 0) {   if ($numsec > 0) {
     $response .=       $response .= 
                 &mt('You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional [quant,_1,section].',$numsec).' '.                  &mt('You indicated that you wish to incorporate student enrollment in your LON-CAPA course from an additional [quant,_1,section].',$numsec).' '.
                &mt('For each new section enter the insititutional section code (e.g., 004), 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 this particular section.').' '.                 &mt('For each new section enter the institutional section code (e.g., 004), 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 this particular section.').' '.
                &mt('The LON-CAPA section ID can be left blank, if you do not wish to designate a section ID for this course section.').' '.                 &mt('The LON-CAPA section ID can be left blank, if you do not wish to designate a section ID for this course section.').' '.
                &mt("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.").'                 &mt("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 />                 <br /><br />
Line 2356  sub print_sections_response { Line 2445  sub print_sections_response {
  }   }
     }      }
   
     if ($putreply ne 'ok') {      if ($putreply eq 'ok') {
  $response = &mt('Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course [_1], if you have chosen to enable a nightly automated enrollment update.',   $response = &mt('Students enrolling in the sections listed below will be automatically added to the class roster for LON-CAPA course [_1], if you have chosen to enable a nightly automated enrollment update.',
                         "$realm ($coursecode)").'<br /><ul>'."\n";                          "$realm ($coursecode)").'<br /><ul>'."\n";
  foreach my $section (@allsections) {   foreach my $section (@allsections) {
Line 2726  sub print_update_result { Line 2815  sub print_update_result {
     my %settings =       my %settings = 
         &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.authtype','internal.autharg','internal.showphoto','internal.defaultcredits',
                'internal.autodropfailsafe','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'};
     my $autharg = $settings{'internal.autharg'};      my $autharg = $settings{'internal.autharg'};
     my $showphotos = $settings{'internal.showphoto'};      my $showphotos = $settings{'internal.showphoto'};
       my $textbook = $settings{'internal.textbook'};
       my ($showcredits,$defaultcredits);
       my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
       if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbookcredits'}) {
           $showcredits = 1;
           $defaultcredits = $settings{'internal.defaultcredits'};
           if ($defaultcredits eq '') {
               if ($coursecode ne '') {
                   $defaultcredits = $domdefaults{'officialcredits'};   
               } elsif ($textbook ne '') {
                   $defaultcredits = $domdefaults{'textbookcredits'};
               } else {
                   $defaultcredits = $domdefaults{'unofficialcredits'};
               }
           }
       }
       my $failsafe = $settings{'internal.autodropfailsafe'};
       if ($failsafe eq '') {
           $failsafe = $domdefaults{'autofailsafe'};
       }
     my ($startaccess,$endaccess) = &get_dates_from_form();      my ($startaccess,$endaccess) = &get_dates_from_form();
     if ( exists($env{'form.updateadds'}) ) {      if ( exists($env{'form.updateadds'}) ) {
         $updateadds = $env{'form.updateadds'};          $updateadds = $env{'form.updateadds'};
Line 2766  sub print_update_result { Line 2876  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,\@allcourses,\%LC_code,\$logmsg,\$newusermsg,"updatenow",\%phototypes);   ($changecount,$response) = &LONCAPA::Enrollment::update_LC($dom,$crs,$updateadds,$updatedrops,$startaccess,$endaccess,$authtype,$autharg,$showcredits,$defaultcredits,$failsafe,\@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 2811  sub print_viewclass_response { Line 2921  sub print_viewclass_response {
     my $secidx=&Apache::loncoursedata::CL_SECTION;      my $secidx=&Apache::loncoursedata::CL_SECTION;
     my $typeidx=&Apache::loncoursedata::CL_TYPE;      my $typeidx=&Apache::loncoursedata::CL_TYPE;
     my $lockedidx=&Apache::loncoursedata::CL_LOCKEDTYPE;      my $lockedidx=&Apache::loncoursedata::CL_LOCKEDTYPE;
       my $creditsidx=&Apache::loncoursedata::CL_CREDITS;
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                ['chgauto','chgmanual','lockchg','unlockchg']);                                 ['chgauto','chgmanual','lockchg','unlockchg']);
     my @typechglist = (&Apache::loncommon::get_env_multiple('form.chgauto'),      my @typechglist = (&Apache::loncommon::get_env_multiple('form.chgauto'),
Line 2818  sub print_viewclass_response { Line 2929  sub print_viewclass_response {
     my @lockchglist = (&Apache::loncommon::get_env_multiple('form.lockchg'),      my @lockchglist = (&Apache::loncommon::get_env_multiple('form.lockchg'),
        &Apache::loncommon::get_env_multiple('form.unlockchg'));         &Apache::loncommon::get_env_multiple('form.unlockchg'));
   
     foreach my $student (sort @typechglist) {      foreach my $student (sort(@typechglist)) {
         my ($uname,$udom) = split(/:/,$student);          my ($uname,$udom) = split(/:/,$student);
         my $sdata    = $classlist->{$student};          my $sdata    = $classlist->{$student};
         my $section  = $sdata->[$secidx];          my $section  = $sdata->[$secidx];
Line 2827  sub print_viewclass_response { Line 2938  sub print_viewclass_response {
         my $end      = $sdata->[$endidx];          my $end      = $sdata->[$endidx];
         my $type     = $sdata->[$typeidx];          my $type     = $sdata->[$typeidx];
         my $lock   = $sdata->[$lockedidx];          my $lock   = $sdata->[$lockedidx];
           my $credits = $sdata->[$creditsidx];
         my $newlock = $lock;          my $newlock = $lock;
         $chgtotal ++;          $chgtotal ++;
         my $newtype = 'auto';          my $newtype = 'auto';
Line 2843  sub print_viewclass_response { Line 2955  sub print_viewclass_response {
             } elsif ($newtype eq '') {              } elsif ($newtype eq '') {
                 $newlock = '1';                  $newlock = '1';
             }              }
             my $modreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$newtype,$newlock,$cid,'','chgtype');              my $modreply = 
                   &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'',
                                                              '','','',$section,$end,
                                                              $start,$newtype,
                                                              $newlock,$cid,'',
                                                              'chgtype',$credits);
             if ($modreply eq 'ok') {              if ($modreply eq 'ok') {
                 $chgok ++;                  $chgok ++;
                 $chg{$student} = &mt("Changed to $change");                  $chg{$student} = &mt("Changed to $change");
Line 2865  sub print_viewclass_response { Line 2982  sub print_viewclass_response {
         my $end      = $sdata->[$endidx];          my $end      = $sdata->[$endidx];
         my $type     = $sdata->[$typeidx];          my $type     = $sdata->[$typeidx];
         my $lock   = $sdata->[$lockedidx];          my $lock   = $sdata->[$lockedidx];
           my $credits = $sdata->[$creditsidx];
         my $newlock = 1;          my $newlock = 1;
         my $oldlockname = &mt('unlocked');          my $oldlockname = &mt('unlocked');
         my $newlockname = &mt('locked');          my $newlockname = &mt('locked');
Line 2875  sub print_viewclass_response { Line 2993  sub print_viewclass_response {
                 $newlockname = &mt('unlocked');                  $newlockname = &mt('unlocked');
                 $oldlockname = &mt('locked');                   $oldlockname = &mt('locked'); 
             }              }
             my $lockreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$type,$newlock,$cid,'','chgtype');              my $lockreply = &Apache::lonnet::modify_student_enrollment($udom,$uname,$uid,'','','','',$section,$end,$start,$type,$newlock,$cid,'','chgtype',$credits);
             if ($lockreply eq 'ok') {              if ($lockreply eq 'ok') {
                 $lockok ++;                  $lockok ++;
                 $lockchg{$student} = &mt('Changed to [_1]',$newlockname);                  $lockchg{$student} = &mt('Changed to [_1]',$newlockname);
Line 3013  sub warning_message { Line 3131  sub warning_message {
     unless ( $caller eq 'chgsettings') {      unless ( $caller eq 'chgsettings') {
         if ( (!$curradds) && (!$currdrops) ) {          if ( (!$curradds) && (!$currdrops) ) {
             $warning .= '<li>'.              $warning .= '<li>'.
                 &mt('You [_1]must[_2] now use [_3]Automated adds/drops[_4] to enable automated adds and/or drops if you want automatic enrollment updates to occur in this course.','<b>','</b>','<a href="/adm/populate?action=chgsettings">').'</li>';                  &mt('You [_1]must[_2] now use [_3]Automated adds/drops[_4] to enable automated adds and/or drops if you want automatic enrollment updates to occur in this course.','<b>','</b>','<a href="/adm/populate?action=chgsettings">','</a>').'</li>';
         }          }
     }      }
     if ($warning) {      if ($warning) {
Line 3129  sub get_task_text { Line 3247  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',
                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 3145  sub get_task_text { Line 3264  sub get_task_text {
     my %tasktitle =       my %tasktitle = 
         &Apache::lonlocal::texthash(          &Apache::lonlocal::texthash(
                chgsettings  => 'Changes to nightly automated enrollments',                 chgsettings  => 'Changes to nightly automated enrollments',
                  chgfailsafe  => 'Changes to failsafe protection for data retrieval problems',
                setdates     => 'Changes to first and/or last automated enrollment dates',                 setdates     => 'Changes to first and/or last automated enrollment dates',
                setaccess    => 'Changes to default start and/or end dates for student access',                 setaccess    => 'Changes to default start and/or end dates for student access',
                notify       => 'Notification of enrollment changes',                 notify       => 'Notification of enrollment changes',
Line 3182  sub handler { Line 3302  sub handler {
     $r->send_http_header;      $r->send_http_header;
   
     my @tasks = ('information','chgsettings','setdates','setaccess','notify','crosslist',      my @tasks = ('information','chgsettings','setdates','setaccess','notify','crosslist',
                  'sections','photos','updatenow','updatephotos','viewclass');                   'sections','photos','updatenow','updatephotos','viewclass','chgfailsafe');
     
     my ($tasklong,$tasktitle) = &get_task_text();      my ($tasklong,$tasktitle) = &get_task_text();
     my $realm;      my $realm;
Line 3248  sub handler { Line 3368  sub handler {
         &print_main_frame($r,$realm,$dom,$crs,$tasktitle);          &print_main_frame($r,$realm,$dom,$crs,$tasktitle);
     } elsif ($action eq "chgsettings") {      } elsif ($action eq "chgsettings") {
         &print_chgsettings_response($r,$realm,$dom,$crs,$action,$tasktitle);          &print_chgsettings_response($r,$realm,$dom,$crs,$action,$tasktitle);
       } elsif ($action eq "chgfailsafe") {
           &print_chgfailsafe_response($r,$realm,$dom,$crs,$action,$tasktitle);
     } elsif ($action eq "setdates") {      } elsif ($action eq "setdates") {
         &print_setdates_response($r,$realm,$dom,$crs,$action,$tasktitle);          &print_setdates_response($r,$realm,$dom,$crs,$action,$tasktitle);
     } elsif ($action eq "setaccess") {      } elsif ($action eq "setaccess") {

Removed from v.1.75  
changed lines
  Added in v.1.84


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