Diff for /loncom/interface/domainprefs.pm between versions 1.359 and 1.364

version 1.359, 2019/05/06 19:28:17 version 1.364, 2019/07/23 01:30:35
Line 2905  function toggleLTI(form,setting,item) { Line 2905  function toggleLTI(form,setting,item) {
                 }                  }
             }              }
         }          }
     } else if ((setting == 'user') || (setting == 'crs') || (setting == 'passback')) {      } else if ((setting == 'user') || (setting == 'crs') || (setting == 'passback') || (setting == 'callback')) {
         var radioname = '';          var radioname = '';
         var divid = '';          var divid = '';
         if (setting == 'user') {          if (setting == 'user') {
Line 2914  function toggleLTI(form,setting,item) { Line 2914  function toggleLTI(form,setting,item) {
         } else if (setting == 'crs') {          } else if (setting == 'crs') {
             radioname = 'lti_mapcrs_'+item;              radioname = 'lti_mapcrs_'+item;
             divid = 'lti_crsfield_'+item;              divid = 'lti_crsfield_'+item;
           } else if (setting == 'callback') {
               radioname = 'lti_callback_'+item;
               divid = 'lti_callbackfield_'+item;
         } else {          } else {
             radioname = 'lti_passback_'+item;              radioname = 'lti_passback_'+item;
             divid =  'lti_passback_'+item;              divid =  'lti_passback_'+item;
Line 2923  function toggleLTI(form,setting,item) { Line 2926  function toggleLTI(form,setting,item) {
             var setvis = '';              var setvis = '';
             for (var i=0; i<num; i++) {              for (var i=0; i<num; i++) {
                if (form.elements[radioname][i].checked) {                 if (form.elements[radioname][i].checked) {
                    if (setting == 'passback') {                     if ((setting == 'passback') || (setting == 'callback')) {
                        if (form.elements[radioname][i].value == '1') {                         if (form.elements[radioname][i].value == '1') {
                            if (document.getElementById(divid)) {                             if (document.getElementById(divid)) {
                                document.getElementById(divid).style.display = 'inline-block';                                 document.getElementById(divid).style.display = 'inline-block';
Line 4957  sub lti_names { Line 4960  sub lti_names {
   
 sub lti_options {  sub lti_options {
     my ($num,$current,$itemcount,%lt) = @_;      my ($num,$current,$itemcount,%lt) = @_;
     my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield);      my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield,$callback);
     $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';      $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';
     $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';      $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';
     $checked{'makecrs'}{'N'} = '  checked="checked"';      $checked{'makecrs'}{'N'} = '  checked="checked"';
Line 4975  sub lti_options { Line 4978  sub lti_options {
     my $crsfieldsty = 'none';      my $crsfieldsty = 'none';
     my $crssecfieldsty = 'none';      my $crssecfieldsty = 'none';
     my $secsrcfieldsty = 'none';      my $secsrcfieldsty = 'none';
       my $callbacksty = 'none';
     my $passbacksty = 'none';      my $passbacksty = 'none';
     my $optionsty = 'block';      my $optionsty = 'block';
     my $lcauthparm;      my $lcauthparm;
Line 5054  sub lti_options { Line 5058  sub lti_options {
         } else {          } else {
             $checked{'crssec'}{'N'} = ' checked="checked"';              $checked{'crssec'}{'N'} = ' checked="checked"';
         }          }
           if ($current->{'callback'} ne '') {
               $callback = $current->{'callback'};
               $checked{'callback'}{'Y'} = ' checked="checked"';
               $callbacksty = 'inline-block';
           } else {
               $checked{'callback'}{'N'} = ' checked="checked"';
           }
         if ($current->{'topmenu'}) {          if ($current->{'topmenu'}) {
             $checked{'topmenu'}{'Y'} = ' checked="checked"';              $checked{'topmenu'}{'Y'} = ' checked="checked"';
         } else {          } else {
Line 5079  sub lti_options { Line 5090  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"';
           $checked{'callback'}{'N'} = ' checked="checked"';
         $checked{'topmenu'}{'N'} = ' checked="checked"';          $checked{'topmenu'}{'N'} = ' checked="checked"';
         $checked{'inlinemenu'}{'Y'} = ' checked="checked"';           $checked{'inlinemenu'}{'Y'} = ' checked="checked"'; 
         $checked{'menuitem'}{'grades'} = ' checked="checked"';          $checked{'menuitem'}{'grades'} = ' checked="checked"';
Line 5107  sub lti_options { Line 5119  sub lti_options {
     my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"';      my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"';
     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 $onclickcallback = ' onclick="toggleLTI(this.form,'."'callback','$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 $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"';
     my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"';      my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"';
Line 5256  sub lti_options { Line 5269  sub lti_options {
                '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.1"'.$pb1p1chk.' />'.                 '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.1"'.$pb1p1chk.' />'.
                &mt('Outcomes Service (1.1)').'</label>'.('&nbsp;'x2).                 &mt('Outcomes Service (1.1)').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.                 '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.
                &mt('Outcomes Extension (1.0)').'</label></span></div></fieldset>'.                 &mt('Outcomes Extension (1.0)').'</label></span></div>'.
                  '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
                  '<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('Callback on logout').':&nbsp;'.
                  '<label><input type="radio" name="lti_callback_'.$num.'" value="0"'.
                  $checked{'callback'}{'N'}.$onclickcallback.' />'.&mt('No').'</label>'.('&nbsp;'x2).
                  '<label><input type="radio" name="lti_callback_'.$num.'" value="1"'.
                  $checked{'callback'}{'Y'}.$onclickcallback.' />'.&mt('Yes').'</label></span></div>'.
                  '<div class="LC_floatleft" style="display:'.$callbacksty.';" id="lti_callbackfield_'.$num.'">'.
                  '<span class="LC_nobreak">'.&mt('Parameter').': '.
                  '<input type="text" name="lti_callbackparam_'.$num.'" value="'.$callback.'" /></span>'.
                  '</div><div style="padding:0;clear:both;margin:0;border:0"></div></fieldset>'.
                '<fieldset class="ltioption_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'.                 '<fieldset class="ltioption_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'.
                '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'topmenu'}.':&nbsp;'.                 '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'topmenu'}.':&nbsp;'.
                '<label><input type="radio" name="lti_topmenu_'.$num.'" value="0"'.                 '<label><input type="radio" name="lti_topmenu_'.$num.'" value="0"'.
Line 5904  sub print_privacy { Line 5927  sub print_privacy {
                                                        '',$othertitle);                                                         '',$othertitle);
                 $itemcount ++;                  $itemcount ++;
             } else {              } else {
                 $datatable .= &mt('Nothing to set here, as there are no other domains');                  my (@insttypes,%insttitles);
                   if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
                       @insttypes = @{$types};
                       %insttitles = %{$usertypes};
                   }
                   foreach my $item (@insttypes,'default') {
                       my $title;
                       if ($item eq 'default') {
                           $title = $othertitle;
                       } else {
                           $title = $insttitles{$item};
                       }
                       $css_class = $itemcount%2?' class="LC_odd_row"':'';
                       $datatable .= '<tr'.$css_class.'>'.
                                     '<td class="LC_left_item">'.$title.'</td>'.
                                     '<td class="LC_left_item">'.
                                     &mt('Nothing to set here, as there are no other domains').
                                     '</td></tr>';
                       $itemcount ++;
                   }
             }              }
         }          }
     } else {      } else {
Line 10778  sub check_configuser { Line 10820  sub check_configuser {
     my ($configuserok,%currroles);      my ($configuserok,%currroles);
     if ($uhome eq 'no_host') {      if ($uhome eq 'no_host') {
         srand( time() ^ ($$ + ($$ << 15))  ); # Seed rand.          srand( time() ^ ($$ + ($$ << 15))  ); # Seed rand.
         my $configpass = &LONCAPA::Enrollment::create_password();          my $configpass = &LONCAPA::Enrollment::create_password($dom);
         $configuserok =           $configuserok = 
             &Apache::lonnet::modifyuser($dom,$confname,'','internal',              &Apache::lonnet::modifyuser($dom,$confname,'','internal',
                              $configpass,'','','','','',undef,$servadm);                               $configpass,'','','','','',undef,$servadm);
Line 12656  sub modify_lti { Line 12698  sub modify_lti {
                     }                      }
                 }                  }
             }              }
               if ($env{'form.lti_callback_'.$idx}) {
                   if ($env{'form.lti_callbackparam_'.$idx}) {
                       my $callback = $env{'form.lti_callbackparam_'.$idx};
                       $callback =~ s/^\s+|\s+$//g;
                       $confhash{$itemid}{'callback'} = $callback;
                   }
               }
             foreach my $field ('passback','roster','topmenu','inlinemenu') {              foreach my $field ('passback','roster','topmenu','inlinemenu') {
                 if ($env{'form.lti_'.$field.'_'.$idx}) {                  if ($env{'form.lti_'.$field.'_'.$idx}) {
                     $confhash{$itemid}{$field} = 1;                      $confhash{$itemid}{$field} = 1;
Line 12681  sub modify_lti { Line 12730  sub modify_lti {
                 }                  }
             }              }
             unless (($idx eq 'add') || ($changes{$itemid})) {              unless (($idx eq 'add') || ($changes{$itemid})) {
                 foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu') {                  foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu','callback') {
                     if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {                      if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {
                         $changes{$itemid} = 1;                          $changes{$itemid} = 1;
                     }                      }
Line 12907  sub modify_lti { Line 12956  sub modify_lti {
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No section assignment').'</li>';                              $resulttext .= '<li>'.&mt('No section assignment').'</li>';
                         }                          }
                           if ($confhash{$itemid}{'callback'}) {
                               $resulttext .= '<li>'.&mt('Callback setting').': '.$confhash{$itemid}{'callback'}.'</li>';
                           } else {
                               $resulttext .= '<li>'.&mt('No callback to logout LON-CAPA session when user logs out of Comsumer');
                           }
                         foreach my $item ('passback','roster','topmenu','inlinemenu') {                          foreach my $item ('passback','roster','topmenu','inlinemenu') {
                             $resulttext .= '<li>'.$lt{$item}.':&nbsp;';                              $resulttext .= '<li>'.$lt{$item}.':&nbsp;';
                             if ($confhash{$itemid}{$item}) {                              if ($confhash{$itemid}{$item}) {
Line 15709  sub modify_selfcreation { Line 15763  sub modify_selfcreation {
                                 $chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:').                                  $chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:').
                                             '<ul>';                                              '<ul>';
                                 foreach my $status (@statuses) {                                  foreach my $status (@statuses) {
                                     if ($type eq 'default') {                                      if ($status eq 'default') {
                                         $chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>';                                          $chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>';
                                     } else {                                      } else {
                                         $chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>';                                          $chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>';
Line 16841  sub modify_coursecategories { Line 16895  sub modify_coursecategories {
                     }                      }
                     $resulttext .= '</ul></li>';                      $resulttext .= '</ul></li>';
                 }                  }
                   &Apache::lonnet::do_cache_new('cats',$dom,$cathash,3600);
                   if (ref($lastactref) eq 'HASH') {
                       $lastactref->{'cats'} = 1;
                   }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
             if ($changes{'unauth'} || $changes{'auth'}) {              if ($changes{'unauth'} || $changes{'auth'}) {
Line 19621  sub devalidate_remote_domconfs { Line 19679  sub devalidate_remote_domconfs {
     my %thismachine;      my %thismachine;
     map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();      map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
     my @posscached = ('domainconfig','domdefaults','ltitools','usersessions',      my @posscached = ('domainconfig','domdefaults','ltitools','usersessions',
                       'directorysrch','passwdconf');                        'directorysrch','passwdconf','cats');
     if (keys(%servers)) {      if (keys(%servers)) {
         foreach my $server (keys(%servers)) {          foreach my $server (keys(%servers)) {
             next if ($thismachine{$server});              next if ($thismachine{$server});

Removed from v.1.359  
changed lines
  Added in v.1.364


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