Diff for /loncom/interface/domainprefs.pm between versions 1.411 and 1.416

version 1.411, 2022/07/26 01:11:43 version 1.416, 2022/11/11 02:30:19
Line 359  sub handler { Line 359  sub handler {
                       modify => \&modify_passwords,                        modify => \&modify_passwords,
                     },                      },
         'quotas' =>           'quotas' => 
                     { text => 'Blogs, personal web pages, webDAV/quotas, portfolios',                      { text => 'Blogs, personal pages/timezones, webDAV/quotas, portfolio',
                       help => 'Domain_Configuration_Quotas',                        help => 'Domain_Configuration_Quotas',
                       header => [{col1 => 'User affiliation',                        header => [{col1 => 'User affiliation',
                                   col2 => 'Available tools',                                    col2 => 'Available tools',
Line 1628  sub print_login { Line 1628  sub print_login {
                       '<table><tr><th>'.$choices{'hostid'}.'</th>'.                        '<table><tr><th>'.$choices{'hostid'}.'</th>'.
                       '<th>'.$choices{'samllanding'}.'</th>'.                        '<th>'.$choices{'samllanding'}.'</th>'.
                       '<th>'.$choices{'samloptions'}.'</th></tr>'."\n";                        '<th>'.$choices{'samloptions'}.'</th></tr>'."\n";
         my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlnotsso,%styleon,%styleoff);          my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso,%styleon,%styleoff);
         foreach my $lonhost (keys(%domservers)) {          foreach my $lonhost (keys(%domservers)) {
             $samlurl{$lonhost} = '/adm/sso';              $samlurl{$lonhost} = '/adm/sso';
             $styleon{$lonhost} = 'display:none';              $styleon{$lonhost} = 'display:none';
Line 1643  sub print_login { Line 1643  sub print_login {
                     $samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'};                      $samlalt{$lonhost} = $settings->{'saml'}{$lonhost}{'alt'};
                     $samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'};                      $samlurl{$lonhost} = $settings->{'saml'}{$lonhost}{'url'};
                     $samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'};                      $samltitle{$lonhost} = $settings->{'saml'}{$lonhost}{'title'};
                       $samlwindow{$lonhost} = $settings->{'saml'}{$lonhost}{'window'};
                     $samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'};                      $samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'};
                     $styleon{$lonhost} = '';                      $styleon{$lonhost} = '';
                     $styleoff{$lonhost} = 'display:none';                      $styleoff{$lonhost} = 'display:none';
Line 1660  sub print_login { Line 1661  sub print_login {
                 $samlon = $samloff;                  $samlon = $samloff;
                 $samloff = ' ';                  $samloff = ' ';
             }              }
               my $samlwinon = '';
               my $samlwinoff = ' checked="checked"';
               if ($samlwindow{$lonhost}) {
                   $samlwinon = $samlwinoff;
                   $samlwinoff = '';
               }
             my $css_class = $itemcount%2?' class="LC_odd_row"':'';              my $css_class = $itemcount%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.$domservers{$lonhost}.'</span></td>'.              $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.$domservers{$lonhost}.'</span></td>'.
                           '<td><span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff.                            '<td><span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff.
Line 1669  sub print_login { Line 1676  sub print_login {
                           'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="1" />'.                            'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="1" />'.
                           &mt('Yes').'</label></span></td>'.                            &mt('Yes').'</label></span></td>'.
                           '<td id="samloptionson_'.$lonhost.'" style="'.$styleon{$lonhost}.'" width="100%">'.                            '<td id="samloptionson_'.$lonhost.'" style="'.$styleon{$lonhost}.'" width="100%">'.
                           '<table><tr><th colspan="5" align="center">'.&mt('SSO').'</th><th align="center">'.                            '<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th></tr>'.
                           '<span class="LC_nobreak">'.&mt('Non-SSO').'</span></th></tr>'.  
                           '<tr><th>'.&mt('Text').'</th><th>'.&mt('Image').'</th>'.                            '<tr><th>'.&mt('Text').'</th><th>'.&mt('Image').'</th>'.
                           '<th>'.&mt('Alt Text').'</th><th>'.&mt('URL').'</th>'.                            '<th>'.&mt('Alt Text').'</th></tr>'.
                           '<th>'.&mt('Tool Tip').'</th><th>'.&mt('Text').'</th></tr>'.                            '<tr'.$css_class.'><td><input type="text" name="saml_text_'.$lonhost.'" size="20" value="'.
                           '<tr'.$css_class.'><td><input type="text" name="saml_text_'.$lonhost.'" size="8" value="'.  
                           $samltext{$lonhost}.'" /></td><td>';                            $samltext{$lonhost}.'" /></td><td>';
             if ($samlimg{$lonhost}) {              if ($samlimg{$lonhost}) {
                 $datatable .= '<img src="'.$samlimg{$lonhost}.'" /><br />'.                  $datatable .= '<img src="'.$samlimg{$lonhost}.'" /><br />'.
Line 1691  sub print_login { Line 1696  sub print_login {
                 $datatable .= '<input type="file" name="saml_img_'.$lonhost.'" />';                  $datatable .= '<input type="file" name="saml_img_'.$lonhost.'" />';
             }              }
             $datatable .= '</td>'.              $datatable .= '</td>'.
                           '<td><input type="text" name="saml_alt_'.$lonhost.'" size="20" '.                            '<td><input type="text" name="saml_alt_'.$lonhost.'" size="25" '.
                           'value="'.$samlalt{$lonhost}.'" /></td>'.                            'value="'.$samlalt{$lonhost}.'" /></td></tr></table><br />'.
                           '<td><input type="text" name="saml_url_'.$lonhost.'" size="8" '.                            '<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th><th align="center">'.
                             '<span class="LC_nobreak">'.&mt('Non-SSO').'</span></th></tr>'.
                             '<tr><th>'.&mt('URL').'</th><th>'.&mt('Tool Tip').'</th>'.
                             '<th>'.&mt('Pop-up if iframe').'</th><th>'.&mt('Text').'</th></tr>'.
                             '<tr'.$css_class.'>'.
                             '<td><input type="text" name="saml_url_'.$lonhost.'" size="30" '.
                           'value="'.$samlurl{$lonhost}.'" /></td>'.                            'value="'.$samlurl{$lonhost}.'" /></td>'.
                           '<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="15">'.                            '<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="20">'.
                           $samltitle{$lonhost}.'</textarea></td>'.                            $samltitle{$lonhost}.'</textarea></td>'.
                           '<td><input type="text" name="saml_notsso_'.$lonhost.'" size="8" '.                            '<td><label><input type="radio" name="saml_window_'.$lonhost.'" value=""'.$samlwinoff.'>'.
                             &mt('No').'</label>'.('&nbsp;'x2).'<label><input type="radio" '.
                             'name="saml_window_'.$lonhost.'" value="1"'.$samlwinon.'>'.&mt('Yes').'</label></td>'.
                             '<td><input type="text" name="saml_notsso_'.$lonhost.'" size="12" '.
                           'value="'.$samlnotsso{$lonhost}.'" /></td></tr>'.                            'value="'.$samlnotsso{$lonhost}.'" /></td></tr>'.
                           '</table></td>'.                            '</table></td>'.
                           '<td id="samloptionsoff_'.$lonhost.'" style="'.$styleoff{$lonhost}.'" width="100%">&nbsp;</td></tr>';                            '<td id="samloptionsoff_'.$lonhost.'" style="'.$styleoff{$lonhost}.'" width="100%">&nbsp;</td></tr>';
Line 2370  sub print_quotas { Line 2383  sub print_quotas {
         @options = ('norequest','approval','automatic');          @options = ('norequest','approval','automatic');
         %titles = &authorrequest_titles();          %titles = &authorrequest_titles();
     } else {      } else {
         @usertools = ('aboutme','blog','webdav','portfolio');          @usertools = ('aboutme','blog','webdav','portfolio','timezone');
         %titles = &tool_titles();          %titles = &tool_titles();
     }      }
     if (ref($types) eq 'ARRAY') {      if (ref($types) eq 'ARRAY') {
Line 2474  sub print_quotas { Line 2487  sub print_quotas {
                         }                          }
                     } else {                      } else {
                         my $checked = 'checked="checked" ';                          my $checked = 'checked="checked" ';
                           if ($item eq 'timezone') {
                               $checked = '';
                           }
                         if (ref($settings) eq 'HASH') {                          if (ref($settings) eq 'HASH') {
                             if (ref($settings->{$item}) eq 'HASH') {                              if (ref($settings->{$item}) eq 'HASH') {
                                 if ($settings->{$item}->{$type} == 0) {                                  if (!$settings->{$item}->{$type}) {
                                     $checked = '';                                      $checked = '';
                                 } elsif ($settings->{$item}->{$type} == 1) {                                  } elsif ($settings->{$item}->{$type} == 1) {
                                     $checked =  'checked="checked" ';                                      $checked =  'checked="checked" ';
Line 6567  sub print_lti { Line 6583  sub print_lti {
                           '<label><input type="radio" value="1" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" />'.&mt('Yes').                            '<label><input type="radio" value="1" name="ltisec_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$hostid'".');" />'.&mt('Yes').
                           '</label>&nbsp;&nbsp;</span><div id="ltisec_divchgprivkey_'.$hostid.'" style="display:none" />'.                            '</label>&nbsp;&nbsp;</span><div id="ltisec_divchgprivkey_'.$hostid.'" style="display:none" />'.
                           '<span class="LC_nobreak">'.&mt('New Key').':'.                            '<span class="LC_nobreak">'.&mt('New Key').':'.
                           '<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="off" />'.                            '<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="new-password" />'.
                           '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.                            '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.
                           '</span></div>';                            '</span></div>';
             } else {              } else {
                 $extra .= '<span class="LC_nobreak">'.&mt('Encryption Key').':'.                  $extra .= '<span class="LC_nobreak">'.&mt('Encryption Key').':'.
                           '<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="off" />'.                            '<input type="password" size="20" name="ltisec_privkey_'.$hostid.'" value="" autocomplete="new-password" />'.
                           '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>';                            '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.ltisec_privkey_'.$hostid.'.type='."'text'".' } else { this.form.ltisec_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>';
             }              }
             $extra .= '</fieldset>';              $extra .= '</fieldset>';
Line 7704  sub print_privacy { Line 7720  sub print_privacy {
                      domain => 'Assigned domain role(s)',                       domain => 'Assigned domain role(s)',
                      author => 'Assigned co-author role(s)',                       author => 'Assigned co-author role(s)',
                      course => 'Assigned course role(s)',                       course => 'Assigned course role(s)',
                      community => 'Assigned community role',                       community => 'Assigned community role(s)',
                  );                   );
         $numinrow = 4;          $numinrow = 4;
         ($othertitle,$usertypes,$types) =          ($othertitle,$usertypes,$types) =
Line 9688  sub tool_titles { Line 9704  sub tool_titles {
                      blog       => 'Blog',                       blog       => 'Blog',
                      webdav     => 'WebDAV',                       webdav     => 'WebDAV',
                      portfolio  => 'Portfolio',                       portfolio  => 'Portfolio',
                        timezone   => 'Can set time zone',
                      official   => 'Official courses (with institutional codes)',                       official   => 'Official courses (with institutional codes)',
                      unofficial => 'Unofficial courses',                       unofficial => 'Unofficial courses',
                      community  => 'Communities',                       community  => 'Communities',
Line 10658  sub print_defaults { Line 10675  sub print_defaults {
             } elsif ($item eq 'lang_def') {              } elsif ($item eq 'lang_def') {
                 my $includeempty = 1;                  my $includeempty = 1;
                 $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);                  $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);
             } else {              } elsif ($item eq 'portal_def') {
                 my $size;  
                 if ($item eq 'portal_def') {  
                     $size = ' size="25"';  
                 }  
                 $datatable .= '<input type="text" name="'.$item.'" value="'.                  $datatable .= '<input type="text" name="'.$item.'" value="'.
                               $defaults{$item}.'"'.$size.' />';                                $defaults{$item}.'" size="25" onkeyup="portalExtras(this);" />';
                   my $portalsty = 'none';
                   if ($defaults{$item}) {
                       $portalsty = 'block';
                   }
                   foreach my $field ('email','web') {
                       my $checkedoff = ' checked="checked"';
                       my $checkedon;
                       if ($defaults{$item.'_'.$field}) {
                           $checkedon = $checkedoff;
                           $checkedoff = '';
                       } 
                       $datatable .= '<div id="'.$item.'_'.$field.'_div" style="display:'.$portalsty.'">'.
                                 '<span class="LC_nobreak">'.$titles->{$field}.'&nbsp;'.
                                 '<label><input type="radio" name="'.$item.'_'.$field.'" value="1"'.$checkedon.'/>'.&mt('Yes').'</label>'.
                                 ('&nbsp;'x2).
                                 '<label><input type="radio" name="'.$item.'_'.$field.'" value="0"'.$checkedoff.'/>'.&mt('No').'</label>'.
                                 '</div>';
                   }
               } else {
                   $datatable .= '<input type="text" name="'.$item.'" value="'.$defaults{$item}.'" />';
             }              }
             $datatable .= '</td></tr>';              $datatable .= '</td></tr>';
             $rownum ++;              $rownum ++;
Line 10760  sub defaults_titles { Line 10793  sub defaults_titles {
                    'timezone_def'  => 'Default timezone',                     'timezone_def'  => 'Default timezone',
                    'datelocale_def' => 'Default locale for dates',                     'datelocale_def' => 'Default locale for dates',
                    'portal_def'     => 'Portal/Default URL',                     'portal_def'     => 'Portal/Default URL',
                      'email'          => 'Email links use portal URL',
                      'web'            => 'Public web links use portal URL',
                    'intauth_cost'   => 'Encryption cost for bcrypt (positive integer)',                     'intauth_cost'   => 'Encryption cost for bcrypt (positive integer)',
                    'intauth_check'  => 'Check bcrypt cost if authenticated',                     'intauth_check'  => 'Check bcrypt cost if authenticated',
                    'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',                     'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',
Line 11474  sub serverstatus_pages { Line 11509  sub serverstatus_pages {
 sub defaults_javascript {  sub defaults_javascript {
     my ($settings) = @_;      my ($settings) = @_;
     return unless (ref($settings) eq 'HASH');      return unless (ref($settings) eq 'HASH');
       my $portal_js = <<"ENDPORTAL";
   
   function portalExtras(caller) {
       var x = caller.value;
       var y = new Array('email','web');
       for (var i=0; i<y.length; i++) { 
           if (document.getElementById('portal_def_'+y[i]+'_div')) {
               var z = document.getElementById('portal_def_'+y[i]+'_div');
               if (x.length > 0) {
                   z.style.display = 'block';
               } else {
                   z.style.display = 'none';
               }
           }
       }
   }
   ENDPORTAL
     if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {      if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
         my $maxnum = scalar(@{$settings->{'inststatusorder'}});          my $maxnum = scalar(@{$settings->{'inststatusorder'}});
         if ($maxnum eq '') {          if ($maxnum eq '') {
Line 11527  $jstext Line 11579  $jstext
     return;      return;
 }  }
   
   $portal_js
   
   // ]]>
   </script>
   
   ENDSCRIPT
       } else {
   return <<"ENDSCRIPT";
   <script type="text/javascript">
   // <![CDATA[
   $portal_js
 // ]]>  // ]]>
 </script>  </script>
   
Line 12254  sub modify_login { Line 12317  sub modify_login {
     my ($r,$dom,$confname,$lastactref,%domconfig) = @_;      my ($r,$dom,$confname,$lastactref,%domconfig) = @_;
     my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl,      my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl,
         %curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon,          %curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon,
         %currsaml,%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlnotsso);          %currsaml,%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso);
     %title = ( coursecatalog => 'Display course catalog',      %title = ( coursecatalog => 'Display course catalog',
                adminmail => 'Display administrator E-mail address',                 adminmail => 'Display administrator E-mail address',
                helpdesk  => 'Display "Contact Helpdesk" link',                 helpdesk  => 'Display "Contact Helpdesk" link',
Line 12278  sub modify_login { Line 12341  sub modify_login {
                     $samlalt{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'alt'};                      $samlalt{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'alt'};
                     $samlimg{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'img'};                      $samlimg{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'img'};
                     $samltitle{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'title'};                      $samltitle{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'title'};
                       $samlwindow{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'window'};
                     $samlnotsso{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'notsso'};                      $samlnotsso{$lonhost} = $domconfig{login}{'saml'}{$lonhost}{'notsso'};
                 }                  }
             }              }
Line 12535  sub modify_login { Line 12599  sub modify_login {
             if ($env{'form.saml_img_'.$lonhost.'.filename'}) {              if ($env{'form.saml_img_'.$lonhost.'.filename'}) {
                 push(@newsamlimgs,$lonhost);                  push(@newsamlimgs,$lonhost);
             }              }
             foreach my $item ('text','alt','url','title','notsso') {              foreach my $item ('text','alt','url','title','window','notsso') {
                 $env{'form.saml_'.$item.'_'.$lonhost} =~ s/^\s+|\s+$//g;                  $env{'form.saml_'.$item.'_'.$lonhost} =~ s/^\s+|\s+$//g;
             }              }
             if ($saml{$lonhost}) {              if ($saml{$lonhost}) {
                   if ($env{'form.saml_window_'.$lonhost} ne '1') {
                       $env{'form.saml_window_'.$lonhost} = '';
                   }
                 if (grep(/^\Q$lonhost\E$/,@delsamlimg)) {                  if (grep(/^\Q$lonhost\E$/,@delsamlimg)) {
 #FIXME Need to obsolete published image  #FIXME Need to obsolete published image
                     delete($currsaml{$lonhost}{'img'});                      delete($currsaml{$lonhost}{'img'});
Line 12556  sub modify_login { Line 12623  sub modify_login {
                 if ($env{'form.saml_title_'.$lonhost} ne $samltitle{$lonhost}) {                  if ($env{'form.saml_title_'.$lonhost} ne $samltitle{$lonhost}) {
                     $changes{'saml'}{$lonhost} = 1;                      $changes{'saml'}{$lonhost} = 1;
                 }                  }
                   if ($env{'form.saml_window_'.$lonhost} ne $samlwindow{$lonhost}) {
                       $changes{'saml'}{$lonhost} = 1;
                   }
                 if ($env{'form.saml_notsso_'.$lonhost} ne $samlnotsso{$lonhost}) {                  if ($env{'form.saml_notsso_'.$lonhost} ne $samlnotsso{$lonhost}) {
                     $changes{'saml'}{$lonhost} = 1;                      $changes{'saml'}{$lonhost} = 1;
                 }                  }
             } else {              } else {
                 $changes{'saml'}{$lonhost} = 1;                  $changes{'saml'}{$lonhost} = 1;
             }              }
             foreach my $item ('text','alt','url','title','notsso') {              foreach my $item ('text','alt','url','title','window','notsso') {
                 $currsaml{$lonhost}{$item} = $env{'form.saml_'.$item.'_'.$lonhost};                  $currsaml{$lonhost}{$item} = $env{'form.saml_'.$item.'_'.$lonhost};
             }              }
         } else {          } else {
Line 12763  sub modify_login { Line 12833  sub modify_login {
                                        alt    => 'Alt text for button image',                                         alt    => 'Alt text for button image',
                                        url    => 'SSO URL',                                         url    => 'SSO URL',
                                        title  => 'Tooltip for SSO link',                                         title  => 'Tooltip for SSO link',
                                          window => 'Pop-up window if iframe',
                                        notsso => 'Text for non-SSO log-in',                                         notsso => 'Text for non-SSO log-in',
                                     );                                      );
                         foreach my $lonhost (sort(keys(%{$changes{$item}}))) {                          foreach my $lonhost (sort(keys(%{$changes{$item}}))) {
                             if (ref($currsaml{$lonhost}) eq 'HASH') {                              if (ref($currsaml{$lonhost}) eq 'HASH') {
                                 $resulttext .= '<li>'.&mt("$title{$item} in use for [_1]","<b>$lonhost</b>").                                  $resulttext .= '<li>'.&mt("$title{$item} in use for [_1]","<b>$lonhost</b>").
                                                '<ul>';                                                 '<ul>';
                                 foreach my $key ('text','img','alt','url','title','notsso') {                                  foreach my $key ('text','img','alt','url','title','window','notsso') {
                                     if ($currsaml{$lonhost}{$key} eq '') {                                      if ($currsaml{$lonhost}{$key} eq '') {
                                         $resulttext .= '<li>'.&mt("$notlt{$key} not in use").'</li>';                                          $resulttext .= '<li>'.&mt("$notlt{$key} not in use").'</li>';
                                     } else {                                      } else {
                                         my $value = "'$currsaml{$lonhost}{$key}'";                                          my $value = "'$currsaml{$lonhost}{$key}'";
                                         if ($key eq 'img') {                                          if ($key eq 'img') {
                                             $value = '<img src="'.$currsaml{$lonhost}{$key}.'" />';                                              $value = '<img src="'.$currsaml{$lonhost}{$key}.'" />';
                                           } elsif ($key eq 'window') {
                                               $value = 'On';
                                         }                                          }
                                         $resulttext .= '<li>'.&mt("$notlt{$key} set to: [_1]",                                          $resulttext .= '<li>'.&mt("$notlt{$key} set to: [_1]",
                                                                   $value).'</li>';                                                                    $value).'</li>';
Line 13940  sub modify_quotas { Line 14013  sub modify_quotas {
         @usertools = ('author');          @usertools = ('author');
         %titles = &authorrequest_titles();          %titles = &authorrequest_titles();
     } else {      } else {
         @usertools = ('aboutme','blog','webdav','portfolio');          @usertools = ('aboutme','blog','webdav','portfolio','timezone');
         %titles = &tool_titles();          %titles = &tool_titles();
     }      }
     my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);      my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
Line 17877  sub modify_privacy { Line 17950  sub modify_privacy {
                    domain => 'Assigned domain role(s)',                     domain => 'Assigned domain role(s)',
                    author => 'Assigned co-author role(s)',                     author => 'Assigned co-author role(s)',
                    course => 'Assigned course role(s)',                     course => 'Assigned course role(s)',
                    community => 'Assigned community role',                     community => 'Assigned community role(s)',
                 );                  );
     my %roles = &Apache::lonlocal::texthash (      my %roles = &Apache::lonlocal::texthash (
                    domain => 'Domain role',                     domain => 'Domain role',
Line 17921  sub modify_privacy { Line 17994  sub modify_privacy {
                       );                        );
     foreach my $item (@items) {      foreach my $item (@items) {
         if (@instdoms > 1) {          if (@instdoms > 1) {
             if ($env{'form.privacy_approval_instdom'.$item} =~ /^(none|user|domain|auto)$/) {              if ($env{'form.privacy_approval_instdom_'.$item} =~ /^(none|user|domain|auto)$/) {
                 $privacyhash{'approval'}{'instdom'}{$item} = $env{'form.privacy_approval_instdom_'.$item};                  $privacyhash{'approval'}{'instdom'}{$item} = $env{'form.privacy_approval_instdom_'.$item};
             }              }
             if (ref($current{'approval'}) eq 'HASH') {              if (ref($current{'approval'}) eq 'HASH') {
Line 19966  sub modify_defaults { Line 20039  sub modify_defaults {
             }              }
         } elsif ($item eq 'portal_def') {          } elsif ($item eq 'portal_def') {
             if ($newvalues{$item} ne '') {              if ($newvalues{$item} ne '') {
                 unless ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) {                  if ($newvalues{$item} =~ /^https?\:\/\/(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])\/?$/) {
                       foreach my $field ('email','web') {
                           if ($env{'form.'.$item.'_'.$field}) {
                               $newvalues{$item.'_'.$field} = $env{'form.'.$item.'_'.$field};
                           }
                       }
                   } else {
                     push(@errors,$item);                      push(@errors,$item);
                 }                  }
             }              }
         }          }
         if (grep(/^\Q$item\E$/,@errors)) {          if (grep(/^\Q$item\E$/,@errors)) {
             $newvalues{$item} = $domdefaults{$item};              $newvalues{$item} = $domdefaults{$item};
               if ($item eq 'portal_def') {
                   if ($domdefaults{$item}) {
                       foreach my $field ('email','web') {
                           if (exists($domdefaults{$item.'_'.$field})) {
                               $newvalues{$item.'_'.$field} = $domdefaults{$item.'_'.$field};
                           }
                       }
                   }
               }
         } elsif ($domdefaults{$item} ne $newvalues{$item}) {          } elsif ($domdefaults{$item} ne $newvalues{$item}) {
             $changes{$item} = 1;              $changes{$item} = 1;
         }          }
           if ($item eq 'portal_def') {
               unless (grep(/^\Q$item\E$/,@errors)) {
                   if ($newvalues{$item} eq '') { 
                       foreach my $field ('email','web') {
                           if (exists($domdefaults{$item.'_'.$field})) {
                               delete($domdefaults{$item.'_'.$field});
                           }
                       }
                   } else {
                       unless ($changes{$item}) {
                           foreach my $field ('email','web') {
                               if ($domdefaults{$item.'_'.$field} ne $newvalues{$item.'_'.$field}) {
                                   $changes{$item} = 1;
                                   last;
                               }
                           }
                       }
                       foreach my $field ('email','web') {
                           if ($newvalues{$item.'_'.$field}) {
                               $domdefaults{$item.'_'.$field} = $newvalues{$item.'_'.$field};
                           } elsif (exists($domdefaults{$item.'_'.$field})) {
                               delete($domdefaults{$item.'_'.$field});
                           }
                       }
                   }
               }
           }
         $domdefaults{$item} = $newvalues{$item};          $domdefaults{$item} = $newvalues{$item};
     }      }
     my %staticdefaults = (      my %staticdefaults = (
Line 20175  sub modify_defaults { Line 20290  sub modify_defaults {
                         $value = $authnames{$shortauth{$value}};                          $value = $authnames{$shortauth{$value}};
                     }                      }
                     $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>';                      $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$item},$value).'</li>';
                     $mailmsgtext .= "$title->{$item} set to $value\n";                        $mailmsgtext .= "$title->{$item} set to $value\n";
                       if ($item eq 'portal_def') {
                           if ($env{'form.'.$item} ne '') {
                               foreach my $field ('email','web') {
                                   $value = $env{'form.'.$item.'_'.$field};
                                   if ($value) {
                                       $value = &mt('Yes');
                                   } else {
                                       $value = &mt('No');
                                   }
                                   $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$title->{$field},$value).'</li>';
                               }
                           }
                       }
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';

Removed from v.1.411  
changed lines
  Added in v.1.416


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