Diff for /loncom/interface/domainprefs.pm between versions 1.324 and 1.325

version 1.324, 2018/01/01 01:29:38 version 1.325, 2018/03/23 01:01:20
Line 104  $datatable  - HTML containing form eleme Line 104  $datatable  - HTML containing form eleme
   
 In the case of course requests, radio buttons are displayed for each institutional  In the case of course requests, radio buttons are displayed for each institutional
 affiliate type (and also default, and _LC_adv) for each of the course types   affiliate type (and also default, and _LC_adv) for each of the course types 
 (official, unofficial, community, textbook, and placement).    (official, unofficial, community, textbook, placement, and lti).  
 In each case the radio buttons allow the selection of one of four values:    In each case the radio buttons allow the selection of one of four values:  
   
 0, approval, validate, autolimit=N (where N is blank, or a positive integer).  0, approval, validate, autolimit=N (where N is blank, or a positive integer).
Line 1893  sub print_quotas { Line 1893  sub print_quotas {
     my $typecount = 0;      my $typecount = 0;
     my ($css_class,%titles);      my ($css_class,%titles);
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial','community','textbook','placement');          @usertools = ('official','unofficial','community','textbook','placement','lti');
         @options =('norequest','approval','validate','autolimit');          @options =('norequest','approval','validate','autolimit');
         %validations = &Apache::lonnet::auto_courserequest_checks($dom);          %validations = &Apache::lonnet::auto_courserequest_checks($dom);
         %titles = &courserequest_titles();          %titles = &courserequest_titles();
Line 2357  sub print_studentcode { Line 2357  sub print_studentcode {
     my ($settings,$rowtotal) = @_;      my ($settings,$rowtotal) = @_;
     my $rownum = 0;       my $rownum = 0; 
     my ($output,%current);      my ($output,%current);
     my @crstypes = ('official','unofficial','community','textbook','placement');      my @crstypes = ('official','unofficial','community','textbook','placement','lti');
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (ref($settings->{'uniquecode'}) eq 'HASH') {          if (ref($settings->{'uniquecode'}) eq 'HASH') {
             foreach my $type (@crstypes) {              foreach my $type (@crstypes) {
Line 2806  ENDSCRIPT Line 2806  ENDSCRIPT
 }  }
   
 sub lti_toggle_js {  sub lti_toggle_js {
       my %lcauthparmtext = &Apache::lonlocal::texthash (
                               localauth => 'Local auth argument',
                               krb       => 'Kerberos domain',
                            );
     return <<"ENDSCRIPT";      return <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 2883  function toggleLTI(form,setting,item) { Line 2887  function toggleLTI(form,setting,item) {
                 }                  }
             }              }
         }          }
       } else if (setting == 'lcauth') {
           var numauth = form.elements['lti_lcauth_'+item].length;
           if (numauth) {
               for (var i=0; i<numauth; i++) {
                   if (form.elements['lti_lcauth_'+item][i].checked) {
                       if (document.getElementById('lti_'+setting+'_parmrow_'+item)) {
                           if ((form.elements['lti_'+setting+'_'+item][i].value == 'internal') || (form.elements['lti_'+setting+'_'+item][i].value == 'lti')) {
                               document.getElementById('lti_'+setting+'_parmrow_'+item).style.display = 'none';
                           } else {
                               document.getElementById('lti_'+setting+'_parmrow_'+item).style.display = 'table-row';
                               if (document.getElementById('lti_'+setting+'_parmtext_'+item)) {
                                   if (form.elements['lti_'+setting+'_'+item][i].value == 'localauth') {
                                       document.getElementById('lti_'+setting+'_parmtext_'+item).innerHTML = "$lcauthparmtext{'localauth'}";
                                   } else {
                                       document.getElementById('lti_'+setting+'_parmtext_'+item).innerHTML = "$lcauthparmtext{'krb'}";
                                   }
                               }
                           }
                       }
                   }
               }
           }
     }      }
     return;      return;
 }  }
Line 4614  sub print_lti { Line 4640  sub print_lti {
                 '<input type="password" size="20" name="lti_secret_'.$i.'" value="'.$secret.'" />'.                  '<input type="password" size="20" name="lti_secret_'.$i.'" value="'.$secret.'" />'.
                 '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.                  '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.
                 '<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" /></span>'.                  '<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" /></span>'.
                 '</fieldset>'.&lti_options($i,$current,%lt).'</td></tr>';                  '</fieldset>'.&lti_options($i,$current,$itemcount,%lt).'</td></tr>';
             $itemcount ++;              $itemcount ++;
         }          }
     }      }
Line 4647  sub print_lti { Line 4673  sub print_lti {
                   ('&nbsp;'x2).                    ('&nbsp;'x2).
                   '<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" />'.                    '<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" />'.
                   '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n".                    '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n".
                   '</fieldset>'.&lti_options('add',undef,%lt).                    '</fieldset>'.&lti_options('add',undef,$itemcount,%lt).
                   '</td>'."\n".                    '</td>'."\n".
                   '</tr>'."\n";                    '</tr>'."\n";
     $$rowtotal ++;      $$rowtotal ++;
Line 4672  sub lti_names { Line 4698  sub lti_names {
 }  }
   
 sub lti_options {  sub lti_options {
     my ($num,$current,%lt) = @_;      my ($num,$current,$itemcount,%lt) = @_;
     my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield);      my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield);
     $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';      $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';
     $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';      $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';
Line 4682  sub lti_options { Line 4708  sub lti_options {
     $checked{'selfenroll'} = {};      $checked{'selfenroll'} = {};
     $checked{'crssec'} = {};      $checked{'crssec'} = {};
     $checked{'crssecsrc'} = {};      $checked{'crssecsrc'} = {};
       $checked{'lcauth'} = {};
       if ($num eq 'add') {
           $checked{'lcauth'}{'lti'} = ' checked="checked"';
       }
     my $userfieldsty = 'none';      my $userfieldsty = 'none';
     my $crsfieldsty = 'none';      my $crsfieldsty = 'none';
     my $crssecfieldsty = 'none';      my $crssecfieldsty = 'none';
     my $secsrcfieldsty = 'none';      my $secsrcfieldsty = 'none';
       my $lcauthparm;
       my $lcauthparmstyle = 'display:none';
       my $lcauthparmtext;
       my $numinrow = 4;
   
     if (ref($current) eq 'HASH') {      if (ref($current) eq 'HASH') {
         if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) {          if (($current->{'mapuser'} ne '') && ($current->{'mapuser'} ne 'lis_person_sourcedid')) {
Line 4722  sub lti_options { Line 4755  sub lti_options {
                 $checked{'makeuser'}{$role} = ' checked="checked"';                  $checked{'makeuser'}{$role} = ' checked="checked"';
             }              }
         }          }
           if ($current->{'lcauth'} =~ /^(internal|localauth|krb4|krb5|lti)$/) {
               $checked{'lcauth'}{$1} = ' checked="checked"';
               unless (($current->{'lcauth'} eq 'lti') || ($current->{'lcauth'} eq 'internal')) {
                   $lcauthparm = $current->{'lcauthparm'};
                   $lcauthparmstyle = 'display:table-row'; 
                   if ($current->{'lcauth'} eq 'localauth') {
                       $lcauthparmtext = &mt('Local auth argument');
                   } else {
                       $lcauthparmtext = &mt('Kerberos domain');
                   }
               }
           }
         if (ref($current->{'selfenroll'}) eq 'ARRAY') {          if (ref($current->{'selfenroll'}) eq 'ARRAY') {
             foreach my $role (@{$current->{'selfenroll'}}) {              foreach my $role (@{$current->{'selfenroll'}}) {
                 $checked{'selfenroll'}{$role} = ' checked="checked"';                  $checked{'selfenroll'}{$role} = ' checked="checked"';
Line 4746  sub lti_options { Line 4791  sub lti_options {
     } else {      } else {
         $checked{'makecrs'}{'N'} = ' checked="checked"';          $checked{'makecrs'}{'N'} = ' checked="checked"';
         $checked{'crssec'}{'N'} = ' checked="checked"';          $checked{'crssec'}{'N'} = ' checked="checked"';
   #FIXME        
     }      }
     my @coursetypes = ('official','unofficial','community','textbook','placement');      my @coursetypes = ('official','unofficial','community','textbook','placement','lti');
     my %coursetypetitles = &Apache::lonlocal::texthash (      my %coursetypetitles = &Apache::lonlocal::texthash (
                                official   => 'Official',                                 official   => 'Official',
                                unofficial => 'Unofficial',                                 unofficial => 'Unofficial',
                                community  => 'Community',                                 community  => 'Community',
                                textbook   => 'Textbook',                                 textbook   => 'Textbook',
                                placement  => 'Placement Test',                                 placement  => 'Placement Test',
                                  lti        => 'LTI Provider',
     );      );
       my @authtypes = ('internal','krb4','krb5','localauth');
       my %shortauth = (
                        internal => 'int',
                        krb4 => 'krb4',
                        krb5 => 'krb5',
                        localauth  => 'loc'
                       );
       my %authnames = &authtype_names();
     my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator);      my @ltiroles = qw(Learner Instructor ContentDeveloper TeachingAssistant Mentor Member Manager Administrator);
     my @lticourseroles = qw(Learner Instructor TeachingAssistant Mentor);      my @lticourseroles = qw(Learner Instructor TeachingAssistant Mentor);
     my @courseroles = ('cc','in','ta','ep','st');      my @courseroles = ('cc','in','ta','ep','st');
Line 4762  sub lti_options { Line 4817  sub lti_options {
     my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"';      my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"';
     my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"';      my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"';
     my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"';      my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"';
       my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"';
     my $output = '<fieldset><legend>'.&mt('Mapping users').'</legend>'.      my $output = '<fieldset><legend>'.&mt('Mapping users').'</legend>'.
                  '<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('LON-CAPA username').':&nbsp;';                   '<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('LON-CAPA username').':&nbsp;';
     foreach my $option ('sourcedid','email','other') {      foreach my $option ('sourcedid','email','other') {
Line 4803  sub lti_options { Line 4859  sub lti_options {
                    $checked{'makeuser'}{$ltirole}.' />'.$ltirole.'</label>&nbsp;</span> ';                          $checked{'makeuser'}{$ltirole}.' />'.$ltirole.'</label>&nbsp;</span> ';     
     }      }
     $output .= '</fieldset>'.      $output .= '</fieldset>'.
                  '<fieldset><legend>'.&mt('New user accounts created for LTI users').'</legend>'.
                  '<table>'.
                  &modifiable_userdata_row('lti','instdata_'.$num,$current,$numinrow,$itemcount).
                  '</table>'.
                  '<table class="LC_nested"><tr><td class="LC_left_item">LON-CAPA Authentication</td>'.
                  '<td class="LC_left_item">';
       foreach my $auth ('lti',@authtypes) {
           my $authtext;
           if ($auth eq 'lti') {
               $authtext = &mt('None');
           } else {
               $authtext = $authnames{$shortauth{$auth}};
           }
           $output .= '<span class="LC_nobreak"><label><input type="radio" name="lti_lcauth_'.$num.
                      '" value="'.$auth.'"'.$checked{'lcauth'}{$auth}.$onclicklcauth.' />'.
                      $authtext.'</label></span> &nbsp;';
       }
       $output .= '</td></tr>'.
                  '<tr id="lti_lcauth_parmrow_'.$num.'" style="'.$lcauthparmstyle.'">'.
                  '<td class="LC_right_item" colspan="2"><span class="LC_nobreak">'.
                  '<span id="lti_lcauth_parmtext_'.$num.'">'.$lcauthparmtext.'</span>'.
                  '<input type="text" name="lti_lcauthparm_'.$num.'" value="" /></span></td></tr>'.
                  '</table></fieldset>'.
                '<fieldset><legend>'.&mt('Mapping courses').'</legend>'.                 '<fieldset><legend>'.&mt('Mapping courses').'</legend>'.
                '<div class="LC_floatleft"><span class="LC_nobreak">'.                 '<div class="LC_floatleft"><span class="LC_nobreak">'.
                &mt('Unique course identifier').':&nbsp;';                 &mt('Unique course identifier').':&nbsp;';
Line 6445  sub courserequest_titles { Line 6524  sub courserequest_titles {
                                    community  => 'Communities',                                     community  => 'Communities',
                                    textbook   => 'Textbook',                                     textbook   => 'Textbook',
                                    placement  => 'Placement tests',                                     placement  => 'Placement tests',
                                      lti        => 'LTI Provider',
                                    norequest  => 'Not allowed',                                     norequest  => 'Not allowed',
                                    approval   => 'Approval by Dom. Coord.',                                     approval   => 'Approval by DC',
                                    validate   => 'With validation',                                     validate   => 'With validation',
                                    autolimit  => 'Numerical limit',                                     autolimit  => 'Numerical limit',
                                    unlimited  => '(blank for unlimited)',                                     unlimited  => '(blank for unlimited)',
Line 6558  sub print_usercreation { Line 6638  sub print_usercreation {
         }          }
     } else {      } else {
         my @contexts = ('author','course','domain');          my @contexts = ('author','course','domain');
         my @authtypes = ('int','krb4','krb5','loc');          my @authtypes = ('int','krb4','krb5','loc','lti');
         my %checked;          my %checked;
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             if (ref($settings->{'authtypes'}) eq 'HASH') {              if (ref($settings->{'authtypes'}) eq 'HASH') {
Line 7298  sub authtype_names { Line 7378  sub authtype_names {
                       krb4   => 'Kerberos 4',                        krb4   => 'Kerberos 4',
                       krb5   => 'Kerberos 5',                        krb5   => 'Kerberos 5',
                       loc    => 'Local',                        loc    => 'Local',
                         lti    => 'LTI',
                   );                    );
     return %lt;      return %lt;
 }  }
Line 7366  sub print_defaults { Line 7447  sub print_defaults {
                           '<td><span class="LC_nobreak">'.$titles->{$item}.                            '<td><span class="LC_nobreak">'.$titles->{$item}.
                           '</span></td><td class="LC_right_item" colspan="3">';                            '</span></td><td class="LC_right_item" colspan="3">';
             if ($item eq 'auth_def') {              if ($item eq 'auth_def') {
                 my @authtypes = ('internal','krb4','krb5','localauth');                  my @authtypes = ('internal','krb4','krb5','localauth','lti');
                 my %shortauth = (                  my %shortauth = (
                                  internal => 'int',                                   internal => 'int',
                                  krb4 => 'krb4',                                   krb4 => 'krb4',
                                  krb5 => 'krb5',                                   krb5 => 'krb5',
                                  localauth  => 'loc'                                   localauth  => 'loc',
                                    lti => 'lti',
                                 );                                  );
                 my %authnames = &authtype_names();                  my %authnames = &authtype_names();
                 foreach my $auth (@authtypes) {                  foreach my $auth (@authtypes) {
Line 8447  sub modifiable_userdata_row { Line 8529  sub modifiable_userdata_row {
         } else {          } else {
             $rolename = $role;              $rolename = $role;
         }          }
       } elsif ($context eq 'lti') {
           $rolename = &mt('Institutional data used (if available)');
     } else {      } else {
         if ($role eq 'cr') {          if ($role eq 'cr') {
             $rolename = &mt('Custom role');              $rolename = &mt('Custom role');
Line 8489  sub modifiable_userdata_row { Line 8573  sub modifiable_userdata_row {
               '<td class="LC_left_item" colspan="2"><table>';                '<td class="LC_left_item" colspan="2"><table>';
     my $rem;      my $rem;
     my %checks;      my %checks;
       my %current;
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (ref($settings->{$context}) eq 'HASH') {          my $hashref;
           if ($context eq 'lti') {
               if (ref($settings) eq 'HASH') {
                   $hashref = $settings->{'instdata'};
               }
           } elsif (ref($settings->{$context}) eq 'HASH') {
             if (ref($settings->{$context}->{$role}) eq 'HASH') {              if (ref($settings->{$context}->{$role}) eq 'HASH') {
                 my $hashref = $settings->{$context}->{$role};                  $hashref = $settings->{'lti_instdata'};
                 if ($role eq 'emailusername') {              }
                     if ($statustype) {              if ($role eq 'emailusername') {
                         if (ref($settings->{$context}->{$role}->{$statustype}) eq 'HASH') {                  if ($statustype) {
                             $hashref = $settings->{$context}->{$role}->{$statustype};                      if (ref($settings->{$context}->{$role}->{$statustype}) eq 'HASH') {
                             if (ref($hashref) eq 'HASH') {                           $hashref = $settings->{$context}->{$role}->{$statustype};
                                 foreach my $field (@fields) {  
                                     if ($hashref->{$field}) {  
                                         $checks{$field} = $hashref->{$field};  
                                     }  
                                 }  
                             }  
                         }  
                     }                      }
                 } else {                  }
                     if (ref($hashref) eq 'HASH') {              }
                         foreach my $field (@fields) {          }
                             if ($hashref->{$field}) {          if (ref($hashref) eq 'HASH') { 
                                 $checks{$field} = ' checked="checked" ';              foreach my $field (@fields) {
                             }                  if ($hashref->{$field}) {
                         }                      if ($role eq 'emailusername') {
                           $checks{$field} = $hashref->{$field};
                       } else {
                           $checks{$field} = ' checked="checked" ';
                     }                      }
                 }                  }
             }              }
Line 8532  sub modifiable_userdata_row { Line 8618  sub modifiable_userdata_row {
         unless ($role eq 'emailusername') {          unless ($role eq 'emailusername') {
             if (exists($checks{$fields[$i]})) {              if (exists($checks{$fields[$i]})) {
                 $check = $checks{$fields[$i]}                  $check = $checks{$fields[$i]}
             } else {              } elsif ($context ne 'lti') {
                 if ($role eq 'st') {                  if ($role eq 'st') {
                     if (ref($settings) ne 'HASH') {                      if (ref($settings) ne 'HASH') {
                         $check = ' checked="checked" ';                           $check = ' checked="checked" '; 
Line 8542  sub modifiable_userdata_row { Line 8628  sub modifiable_userdata_row {
         }          }
         $output .= '<td class="LC_left_item">'.          $output .= '<td class="LC_left_item">'.
                    '<span class="LC_nobreak">';                     '<span class="LC_nobreak">';
           my $prefix = 'canmodify';
         if ($role eq 'emailusername') {          if ($role eq 'emailusername') {
             unless ($checks{$fields[$i]} =~ /^(required|optional)$/) {              unless ($checks{$fields[$i]} =~ /^(required|optional)$/) {
                 $checks{$fields[$i]} = 'omit';                  $checks{$fields[$i]} = 'omit';
Line 8552  sub modifiable_userdata_row { Line 8639  sub modifiable_userdata_row {
                     $checked='checked="checked" ';                      $checked='checked="checked" ';
                 }                  }
                 $output .= '<label>'.                  $output .= '<label>'.
                            '<input type="radio" name="canmodify_'.$item.'_'.$fields[$i].'" value="'.$option.'" '.$checked.'/>'.                             '<input type="radio" name="'.$prefix.'_'.$item.'_'.$fields[$i].'" value="'.$option.'" '.$checked.'/>'.
                            &mt($option).'</label>'.('&nbsp;' x2);                             &mt($option).'</label>'.('&nbsp;' x2);
             }              }
             $output .= '<i>'.$fieldtitles{$fields[$i]}.'</i>';              $output .= '<i>'.$fieldtitles{$fields[$i]}.'</i>';
         } else {          } else {
               if ($context eq 'lti') {
                   $prefix = 'lti';
               }
             $output .= '<label>'.              $output .= '<label>'.
                        '<input type="checkbox" name="canmodify_'.$role.'" '.                         '<input type="checkbox" name="'.$prefix.'_'.$role.'" '.
                        'value="'.$fields[$i].'"'.$check.'/>'.$fieldtitles{$fields[$i]}.                         'value="'.$fields[$i].'"'.$check.'/>'.$fieldtitles{$fields[$i]}.
                        '</label>';                         '</label>';
         }          }
Line 9968  sub modify_quotas { Line 10058  sub modify_quotas {
         $context = $action;          $context = $action;
     }      }
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial','community','textbook','placement');          @usertools = ('official','unofficial','community','textbook','placement','lti');
         @options =('norequest','approval','validate','autolimit');          @options =('norequest','approval','validate','autolimit');
         %validations = &Apache::lonnet::auto_courserequest_checks($dom);          %validations = &Apache::lonnet::auto_courserequest_checks($dom);
         %titles = &courserequest_titles();          %titles = &courserequest_titles();
Line 10017  sub modify_quotas { Line 10107  sub modify_quotas {
         my @approvalnotify = &Apache::loncommon::get_env_multiple('form.'.$context.'notifyapproval');          my @approvalnotify = &Apache::loncommon::get_env_multiple('form.'.$context.'notifyapproval');
         @approvalnotify = sort(@approvalnotify);          @approvalnotify = sort(@approvalnotify);
         $confhash{'notify'}{'approval'} = join(',',@approvalnotify);          $confhash{'notify'}{'approval'} = join(',',@approvalnotify);
         my @crstypes = ('official','unofficial','community','textbook','placement');          my @crstypes = ('official','unofficial','community','textbook','placement','lti');
         my @hasuniquecode = &Apache::loncommon::get_env_multiple('form.uniquecode');          my @hasuniquecode = &Apache::loncommon::get_env_multiple('form.uniquecode');
         foreach my $type (@hasuniquecode) {          foreach my $type (@hasuniquecode) {
             if (grep(/^\Q$type\E$/,@crstypes)) {              if (grep(/^\Q$type\E$/,@crstypes)) {
Line 11361  sub modify_lti { Line 11451  sub modify_lti {
                                textbook   => 'Textbook',                                 textbook   => 'Textbook',
                                placement  => 'Placement Test',                                 placement  => 'Placement Test',
     );      );
       my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();
     my %lt = &lti_names();      my %lt = &lti_names();
     map { $posslti{$_} = 1; } @ltiroles;      map { $posslti{$_} = 1; } @ltiroles;
     map { $posslticrs{$_} = 1; } @lticourseroles;      map { $posslticrs{$_} = 1; } @lticourseroles;
     map { $posscrstype{$_} = 1; } @coursetypes;      map { $posscrstype{$_} = 1; } @coursetypes;
   
   #FIXME
           
     my (@items,%deletions,%itemids);      my (@items,%deletions,%itemids);
     if ($env{'form.lti_add'}) {      if ($env{'form.lti_add'}) {
Line 11453  sub modify_lti { Line 11546  sub modify_lti {
             }              }
         }          }
         $confhash{$itemid}{'makeuser'} = \@makeuser;          $confhash{$itemid}{'makeuser'} = \@makeuser;
           if (@makeuser) {
               my $lcauth = $env{'form.lti_lcauth_'.$idx};
               if ($lcauth =~ /^(internal|krb4|krb5|localauth)$/) {
                   $confhash{$itemid}{'lcauth'} = $lcauth;
                   if ($lcauth ne 'internal') {
                       my $lcauthparm = $env{'form.lti_lcauthparm_'.$idx};
                       $lcauthparm =~ s/^(\s+|\s+)$//g;
                       $lcauthparm =~ s/`//g;
                       if ($lcauthparm ne '') {
                           $confhash{$itemid}{'lcauthparm'} = $lcauthparm;
                       }
                   }
               } else {
                   $confhash{$itemid}{'lcauth'} = 'lti';
               }
           }
           my @possinstdata =  &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx);
           if (@possinstdata) {
               foreach my $field (@possinstdata) {
                   if (exists($fieldtitles{$field})) {
                       push(@{$confhash{$itemid}{'instdata'}});
                   }
               }
           }
         if (($env{'form.lti_mapcrs_'.$idx} eq 'course_offering_sourcedid') ||          if (($env{'form.lti_mapcrs_'.$idx} eq 'course_offering_sourcedid') ||
             ($env{'form.lti_mapcrs_'.$idx} eq 'context_id'))  {              ($env{'form.lti_mapcrs_'.$idx} eq 'context_id'))  {
             $confhash{$itemid}{'mapcrs'} = $env{'form.lti_mapcrs_'.$idx};              $confhash{$itemid}{'mapcrs'} = $env{'form.lti_mapcrs_'.$idx};
Line 11499  sub modify_lti { Line 11616  sub modify_lti {
             }              }
         }          }
         unless (($idx eq 'add') || ($changes{$itemid})) {          unless (($idx eq 'add') || ($changes{$itemid})) {
             foreach my $field ('mapuser','mapcrs','section','passback','roster') {              foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm') {
                 if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {                  if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {
                     $changes{$itemid} = 1;                      $changes{$itemid} = 1;
                 }                  }
             }              }
             foreach my $field ('makeuser','mapcrstype','selfenroll') {              foreach my $field ('makeuser','mapcrstype','selfenroll','instdata') {
                 unless ($changes{$itemid}) {                  unless ($changes{$itemid}) {
                     if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {                      if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {
                         if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {                          if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
Line 11650  sub modify_lti { Line 11767  sub modify_lti {
                     if (ref($confhash{$itemid}{'makeuser'}) eq 'ARRAY') {                      if (ref($confhash{$itemid}{'makeuser'}) eq 'ARRAY') {
                         if (@{$confhash{$itemid}{'makeuser'}} > 0) {                           if (@{$confhash{$itemid}{'makeuser'}} > 0) { 
                             $resulttext .= '<li>'.&mt('Following roles may create user accounts: [_1]',                              $resulttext .= '<li>'.&mt('Following roles may create user accounts: [_1]',
                                                       join(', ',@{$confhash{$itemid}{'makeuser'}})).'</li>';                                                        join(', ',@{$confhash{$itemid}{'makeuser'}})).'<br />';
                               if ($confhash{$itemid}{'lcauth'} eq 'lti') {
                                   $resulttext .= &mt('New users will only be able to authenticate via LTI').'</li>';
                               } else {
                                   $resulttext .= &mt('New users will be assigned LON-CAPA authentication: [_1]',
                                                      $confhash{$itemid}{'lcauth'});
                                   if ($confhash{$itemid}{'lcauth'} eq 'internal') {
                                       $resulttext .= '; '.&mt('a randomly generated password will be created');
                                   } elsif ($confhash{$itemid}{'lcauth'} eq 'localauth') {
                                       if ($confhash{$itemid}{'lcauthparm'} ne '') {
                                           $resulttext .= ' '.&mt('with argument: [_1]',$confhash{$itemid}{'lcauthparm'});
                                       }
                                   } else {
                                       $resulttext .= '; '.&mt('Kerberos domain: [_1]',$confhash{$itemid}{'lcauthparm'});
                                   }
                               }
                               $resulttext .= '</li>';
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('User account creation not permitted.').'</li>';                              $resulttext .= '<li>'.&mt('User account creation not permitted.').'</li>';
                         }                          }
                     }                      }
                       if (ref($confhash{$itemid}{'instdata'}) eq 'ARRAY') {
                           if (@{$confhash{$itemid}{'instdata'}} > 0) {
                               $resulttext .= '<li>'.&mt('Institutional data will be used when creating a new user for: [_1]',
                                                         join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'</li>';
                           } else {
                               $resulttext .= '<li>'.&mt('No institutional data used when creating a new user.').'</li>';
                           }
                       }
                     if ($confhash{$itemid}{'mapcrs'}) {                      if ($confhash{$itemid}{'mapcrs'}) {
                         $resulttext .= '<li>'.&mt('Unique course identifier').': '.$confhash{$itemid}{'mapcrs'}.'</li>';                          $resulttext .= '<li>'.&mt('Unique course identifier').': '.$confhash{$itemid}{'mapcrs'}.'</li>';
                     }                      }
Line 12838  sub modify_usercreation { Line 12979  sub modify_usercreation {
     }      }
   
     my @authen_contexts = ('author','course','domain');      my @authen_contexts = ('author','course','domain');
     my @authtypes = ('int','krb4','krb5','loc');      my @authtypes = ('int','krb4','krb5','loc','lti');
     my %authhash;      my %authhash;
     foreach my $item (@authen_contexts) {      foreach my $item (@authen_contexts) {
         my @authallowed =  &Apache::loncommon::get_env_multiple('form.'.$item.'_auth');          my @authallowed =  &Apache::loncommon::get_env_multiple('form.'.$item.'_auth');
Line 14020  sub modify_defaults { Line 14161  sub modify_defaults {
     my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);      my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
     my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def',      my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def',
                  'portal_def','intauth_cost','intauth_check','intauth_switch');                   'portal_def','intauth_cost','intauth_check','intauth_switch');
     my @authtypes = ('internal','krb4','krb5','localauth');      my @authtypes = ('internal','krb4','krb5','localauth','lti');
     foreach my $item (@items) {      foreach my $item (@items) {
         $newvalues{$item} = $env{'form.'.$item};          $newvalues{$item} = $env{'form.'.$item};
         if ($item eq 'auth_def') {          if ($item eq 'auth_def') {
Line 14212  sub modify_defaults { Line 14353  sub modify_defaults {
                                           krb4       => 'krb4',                                            krb4       => 'krb4',
                                           krb5       => 'krb5',                                            krb5       => 'krb5',
                                           localauth  => 'loc',                                            localauth  => 'loc',
                                             lti        => 'lti',
                         );                          );
                         $value = $authnames{$shortauth{$value}};                          $value = $authnames{$shortauth{$value}};
                     } elsif ($item eq 'intauth_switch') {                      } elsif ($item eq 'intauth_switch') {

Removed from v.1.324  
changed lines
  Added in v.1.325


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