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

version 1.83, 2015/06/09 21:22:57 version 1.84, 2016/07/24 14:34:59
Line 350  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 423  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 1064  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 1467  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 1538  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 1556  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 2728  sub print_update_result { Line 2816  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.textbook'],               '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'};
Line 2750  sub print_update_result { Line 2838  sub print_update_result {
             }              }
         }          }
     }      }
       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 2784  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,$showcredits,$defaultcredits,\@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 3155  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 3171  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 3208  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 3274  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.83  
changed lines
  Added in v.1.84


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