Diff for /loncom/interface/domainprefs.pm between versions 1.93 and 1.102.2.5

version 1.93, 2009/04/22 14:09:13 version 1.102.2.5, 2009/10/09 02:00:21
Line 28 Line 28
 ###############################################################  ###############################################################
 ##############################################################  ##############################################################
   
   =pod
   
   =head1 NAME
   
   Apache::domainprefs.pm
   
   =head1 SYNOPSIS
   
   Handles configuration of a LON-CAPA domain.  
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   
   =head1 OVERVIEW
   
   Each institution using LON-CAPA will typically have a single domain designated 
   for use by individuals affliated with the institution.  Accordingly, each domain
   may define a default set of logos and a color scheme which can be used to "brand"
   the LON-CAPA instance. In addition, an institution will typically have a language
   and timezone which are used for the majority of courses.
   
   LON-CAPA provides a mechanism to display and modify these defaults, as well as a 
   host of other domain-wide settings which determine the types of functionality
   available to users and courses in the domain.
   
   There is also a mechanism to configure cataloging of courses in the domain, and
   controls on the operation of automated processes which govern such things as
   roster updates, user directory updates and processing of course requests.
   
   The domain coordination manual which is built dynamically on install/update of 
   LON-CAPA from the relevant help items provides more information about domain 
   configuration.
   
   Most of the domain settings are stored in the configuration.db GDBM file which is
   housed on the primary library server for the domain in /home/httpd/lonUsers/$dom,
   where $dom is the domain.  The configuration.db stores settings in a number of 
   frozen hashes of hashes.  In a few cases, domain information must be uploaded to
   the domain as files (e.g., image files for logos etc., or plain text files for
   bubblesheet formats).  In this case the domainprefs.pm must be running in a user
   session hosted on the primary library server in the domain, as these files are 
   stored in author space belonging to a special $dom-domainconfig user.   
   
   domainprefs.pm in combination with lonconfigsettings.pm will retrieve and display
   the current settings, and provides an interface to make modifications.
   
   =head1 SUBROUTINES
   
   =over
   
   =item print_quotas()
   
   Inputs: 4 
   
   $dom,$settings,$rowtotal,$action.
   
   $dom is the domain, $settings is a reference to a hash of current settings for
   the current context, $rowtotal is a reference to the scalar used to record the 
   number of rows displayed on the page, and $action is the context (either quotas 
   or requestcourses).
   
   The print_quotas routine was orginally created to display/store information
   about default quota sizes for portfolio spaces for the different types of 
   institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.), 
   but is now also used to manage availability of user tools: 
   i.e., blogs, aboutme page, and portfolios, and the course request tool,
   used by course owners to request creation of a course.
   
   Outputs: 1
   
   $datatable  - HTML containing form elements which allow settings to be changed. 
   
   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 
   (official, unofficial and community).  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).
   which have the following effects:
   
   0
   
   =over
   
   - course requests are not allowed for this course types/affiliation
   
   =back
   
   approval 
   
   =over 
   
   - course requests must be approved by a Doman Coordinator in the 
   course's domain
   
   =back
   
   validate 
   
   =over
   
   - an institutional validation (e.g., check requestor is instructor
   of record) needs to be passed before the course will be created.  The required
   validation is in localenroll.pm on the primary library server for the course 
   domain.
   
   =back
   
   autolimit 
   
   =over
    
   - course requests will be processed autoatically up to a limit of
   N requests for the course type for the particular requestor.
   If N is undefined, there is no limit to the number of course requests
   which a course owner may submit and have processed automatically. 
   
   =back
   
   =item modify_quotas() 
   
   =back
   
   =cut
   
 package Apache::domainprefs;  package Apache::domainprefs;
   
 use strict;  use strict;
Line 162  sub handler { Line 287  sub handler {
                                 col2 => 'Information settable when self-creating account (if directory data blank)'}],                                  col2 => 'Information settable when self-creating account (if directory data blank)'}],
                   },                    },
         'scantron' =>          'scantron' =>
                   { text => 'Scantron format file',                    { text => 'Bubblesheet format file',
                     help => 'Domain_Configuration_Scantron_Format',                      help => 'Domain_Configuration_Scantron_Format',
                     header => [ {col1 => 'Item',                      header => [ {col1 => 'Item',
                                  col2 => '',                                   col2 => '',
Line 172  sub handler { Line 297  sub handler {
                  {text => 'Request creation of courses',                   {text => 'Request creation of courses',
                   help => 'Domain_Configuration_Request_Courses',                    help => 'Domain_Configuration_Request_Courses',
                   header => [{col1 => 'User affiliation',                    header => [{col1 => 'User affiliation',
                               col2 => 'Requestable course types',}],                                col2 => 'Availability/Processing of requests',},
                                {col1 => 'Setting',
                                 col2 => 'Value'}],
                  },                   },
         'coursecategories' =>          'coursecategories' =>
                   { text => 'Cataloging of courses',                    { text => 'Cataloging of courses',
Line 204  sub handler { Line 331  sub handler {
         &Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname);          &Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname);
     } else {      } else {
         if (keys(%domconfig) == 0) {          if (keys(%domconfig) == 0) {
             &Apache::lonconfigsettings::print_header($r,$phase,$context);  
             my $primarylibserv = &Apache::lonnet::domain($dom,'primary');              my $primarylibserv = &Apache::lonnet::domain($dom,'primary');
             my @ids=&Apache::lonnet::current_machine_ids();              my @ids=&Apache::lonnet::current_machine_ids();
             if (!grep(/^\Q$primarylibserv\E$/,@ids)) {              if (!grep(/^\Q$primarylibserv\E$/,@ids)) {
Line 222  sub handler { Line 348  sub handler {
                     }                      }
                 }                  }
                 if ($custom_img_count > 0) {                  if ($custom_img_count > 0) {
                       &Apache::lonconfigsettings::print_header($r,$phase,$context);
                     my $switch_server = &check_switchserver($dom,$confname);                      my $switch_server = &check_switchserver($dom,$confname);
                     $r->print(                      $r->print(
     &mt('Domain configuration settings have yet to be saved for this domain via the web-based domain preferences interface.').'<br />'.      &mt('Domain configuration settings have yet to be saved for this domain via the web-based domain preferences interface.').'<br />'.
Line 298  sub print_config_box { Line 425  sub print_config_box {
     $rowtotal ++;      $rowtotal ++;
     if (($action eq 'autoupdate') || ($action eq 'rolecolors') ||       if (($action eq 'autoupdate') || ($action eq 'rolecolors') || 
         ($action eq 'usercreation') || ($action eq 'usermodification') ||          ($action eq 'usercreation') || ($action eq 'usermodification') ||
         ($action eq 'coursecategories')) {          ($action eq 'coursecategories') || ($action eq 'requestcourses')) {
         my $colspan = '';          my $colspan = '';
         if (($action eq 'rolecolors') || ($action eq 'coursecategories')) {          if (($action eq 'rolecolors') || ($action eq 'coursecategories')) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
Line 320  sub print_config_box { Line 447  sub print_config_box {
             $output .= &print_usermodification('top',$dom,$settings,\$rowtotal);              $output .= &print_usermodification('top',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'coursecategories') {          } elsif ($action eq 'coursecategories') {
             $output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal);              $output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal);
           } elsif ($action eq 'requestcourses') {
               $output .= &print_quotas($dom,$settings,\$rowtotal,$action);
         } else {          } else {
             $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);              $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
         }          }
Line 367  sub print_config_box { Line 496  sub print_config_box {
             $rowtotal ++;              $rowtotal ++;
         } elsif ($action eq 'coursecategories') {          } elsif ($action eq 'coursecategories') {
             $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);              $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
           } elsif ($action eq 'requestcourses') {
               $output .= &print_courserequestmail($dom,$settings,\$rowtotal);
         } else {          } else {
             $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'              $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
            </table>             </table>
Line 450  sub print_config_box { Line 581  sub print_config_box {
             $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);              $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
         } elsif ($action eq 'serverstatuses') {          } elsif ($action eq 'serverstatuses') {
             $output .= &print_serverstatuses($dom,$settings,\$rowtotal);              $output .= &print_serverstatuses($dom,$settings,\$rowtotal);
         } elsif ($action eq 'requestcourses') {  
             $output .= &print_quotas($dom,$settings,\$rowtotal,$action);  
         }          }
     }      }
     $output .= '      $output .= '
Line 991  sub print_quotas { Line 1120  sub print_quotas {
     } else {      } else {
         $context = $action;          $context = $action;
     }      }
     my ($datatable,$defaultquota,@usertools);      my ($datatable,$defaultquota,@usertools,@options,%validations);
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);      my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
     my $typecount = 0;      my $typecount = 0;
     my $css_class;      my ($css_class,%titles);
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial');          @usertools = ('official','unofficial','community');
           @options =('norequest','approval','autolimit','validate');
           %validations = &Apache::lonnet::auto_courserequest_checks($dom);
           %titles = &courserequest_titles();
     } else {      } else {
         @usertools = ('aboutme','blog','portfolio');          @usertools = ('aboutme','blog','portfolio');
           %titles = &tool_titles();
     }      }
     my %titles = &tool_titles();  
     if (ref($types) eq 'ARRAY') {      if (ref($types) eq 'ARRAY') {
         foreach my $type (@{$types}) {          foreach my $type (@{$types}) {
             my $currdefquota;              my $currdefquota;
Line 1019  sub print_quotas { Line 1151  sub print_quotas {
                 $datatable .= '<tr'.$css_class.'>'.                  $datatable .= '<tr'.$css_class.'>'.
                               '<td>'.$usertypes->{$type}.'</td>'.                                '<td>'.$usertypes->{$type}.'</td>'.
                               '<td class="LC_left_item">';                                '<td class="LC_left_item">';
                   if ($context eq 'requestcourses') {
                       $datatable .= '<table><tr>';
                   }
                   my %cell;  
                 foreach my $item (@usertools) {                  foreach my $item (@usertools) {
                     my $checked;                      if ($context eq 'requestcourses') {
                     unless ($context eq 'requestcourses') {                          my ($curroption,$currlimit);
                         $checked = 'checked="checked" ';                          if (ref($settings) eq 'HASH') {
                     }                              if (ref($settings->{$item}) eq 'HASH') {
                     if (ref($settings) eq 'HASH') {                                  $curroption = $settings->{$item}->{$type};
                         if (ref($settings->{$item}) eq 'HASH') {                                  if ($curroption =~ /^autolimit=(\d*)$/) {
                             if ($settings->{$item}->{$type} == 0) {                                      $currlimit = $1; 
                                 $checked = '';                                  }
                             } elsif ($settings->{$item}->{$type} == 1) {  
                                 $checked =  'checked="checked" ';  
                             }                              }
                         }                          }
                           if (!$curroption) {
                               $curroption = 'norequest';
                           }
                           $datatable .= '<th>'.$titles{$item}.'</th>';
                           foreach my $option (@options) {
                               my $val = $option;
                               if ($option eq 'norequest') {
                                   $val = 0;  
                               }
                               if ($option eq 'validate') {
                                   my $canvalidate = 0;
                                   if (ref($validations{$item}) eq 'HASH') { 
                                       if ($validations{$item}{$type}) {
                                           $canvalidate = 1;
                                       }
                                   }
                                   next if (!$canvalidate);
                               }
                               my $checked = '';
                               if ($option eq $curroption) {
                                   $checked = ' checked="checked"';
                               } elsif ($option eq 'autolimit') {
                                   if ($curroption =~ /^autolimit/) {
                                       $checked = ' checked="checked"';
                                   }                       
                               } 
                               $cell{$item} .= '<span class="LC_nobreak"><label>'.
                                     '<input type="radio" name="crsreq_'.$item.
                                     '_'.$type.'" value="'.$val.'"'.$checked.' />'.
                                     $titles{$option}.'</label>&nbsp;';
                               if ($option eq 'autolimit') {
                                   $cell{$item} .= '<input type="text" name="crsreq_'.
                                                   $item.'_limit_'.$type.'" size="1" '.
                                                   'value="'.$currlimit.'" />';
                               }
                               if ($option eq 'autolimit') {
                                   $cell{$item} .= $titles{'unlimited'};
                               }
                               $cell{$item} .= '</span>&nbsp; ';
                           }
                       } else {
                           my $checked = 'checked="checked" ';
                           if (ref($settings) eq 'HASH') {
                               if (ref($settings->{$item}) eq 'HASH') {
                                   if ($settings->{$item}->{$type} == 0) {
                                       $checked = '';
                                   } elsif ($settings->{$item}->{$type} == 1) {
                                       $checked =  'checked="checked" ';
                                   }
                               }
                           }
                           $datatable .= '<span class="LC_nobreak"><label>'.
                                         '<input type="checkbox" name="'.$context.'_'.$item.
                                         '" value="'.$type.'" '.$checked.'/>'.$titles{$item}.
                                         '</label></span>&nbsp; ';
                       }
                   }
                   if ($context eq 'requestcourses') {
                       $datatable .= '</tr><tr>';
                       foreach my $item (@usertools) {
                           $datatable .= '<td style="vertical-align: top;">'.$cell{$item}.'</td>';  
                     }                      }
                     $datatable .= '<span class="LC_nobreak"><label>'.                      $datatable .= '</tr></table>';
                                   '<input type="checkbox" name="'.$context.'_'.$item.  
                                   '" value="'.$type.'" '.$checked.'/>'.$titles{$item}.  
                                   '</label></span>&nbsp; ';  
                 }                  }
                 $datatable .= '</td>';                  $datatable .= '</td>';
                 unless ($context eq 'requestcourses') {                  unless ($context eq 'requestcourses') {
Line 1065  sub print_quotas { Line 1257  sub print_quotas {
     $datatable .= '<tr'.$css_class.'>'.      $datatable .= '<tr'.$css_class.'>'.
                   '<td>'.$othertitle.'</td>'.                    '<td>'.$othertitle.'</td>'.
                   '<td class="LC_left_item">';                    '<td class="LC_left_item">';
       if ($context eq 'requestcourses') {
           $datatable .= '<table><tr>';
       }
       my %defcell;
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         my $checked;          if ($context eq 'requestcourses') {
         unless ($context eq 'requestcourses') {              my ($curroption,$currlimit);
             $checked = 'checked="checked" ';              if (ref($settings) eq 'HASH') {
         }                  if (ref($settings->{$item}) eq 'HASH') {
         if (ref($settings) eq 'HASH') {                      $curroption = $settings->{$item}->{'default'};
             if (ref($settings->{$item}) eq 'HASH') {                      if ($curroption =~ /^autolimit=(\d*)$/) {
                 if ($settings->{$item}->{'default'} == 0) {                          $currlimit = $1;
                     $checked = '';                      }
                 } elsif ($settings->{$item}->{'default'} == 1) {  
                     $checked = 'checked="checked" ';  
                 }                  }
             }              }
               if (!$curroption) {
                   $curroption = 'norequest';
               }
               $datatable .= '<th>'.$titles{$item}.'</th>';
               foreach my $option (@options) {
                   my $val = $option;
                   if ($option eq 'norequest') {
                       $val = 0;
                   }
                   if ($option eq 'validate') {
                       my $canvalidate = 0;
                       if (ref($validations{$item}) eq 'HASH') {
                           if ($validations{$item}{'default'}) {
                               $canvalidate = 1;
                           }
                       }
                       next if (!$canvalidate);
                   }
                   my $checked = '';
                   if ($option eq $curroption) {
                       $checked = ' checked="checked"';
                   } elsif ($option eq 'autolimit') {
                       if ($curroption =~ /^autolimit/) {
                           $checked = ' checked="checked"';
                       }
                   }
                   $defcell{$item} .= '<span class="LC_nobreak"><label>'.
                                     '<input type="radio" name="crsreq_'.$item.
                                     '_default" value="'.$val.'"'.$checked.' />'.
                                     $titles{$option}.'</label>';
                   if ($option eq 'autolimit') {
                       $defcell{$item} .= '<input type="text" name="crsreq_'.
                                          $item.'_limit_default" size="1" '.
                                          'value="'.$currlimit.'" />';
                   }
                   $defcell{$item} .= '</span>&nbsp; ';
                   if ($option eq 'autolimit') {
                       $defcell{$item} .= $titles{'unlimited'};
                   }
               }
           } else {
               my $checked = 'checked="checked" ';
               if (ref($settings) eq 'HASH') {
                   if (ref($settings->{$item}) eq 'HASH') {
                       if ($settings->{$item}->{'default'} == 0) {
                           $checked = '';
                       } elsif ($settings->{$item}->{'default'} == 1) {
                           $checked = 'checked="checked" ';
                       }
                   }
               }
               $datatable .= '<span class="LC_nobreak"><label>'.
                             '<input type="checkbox" name="'.$context.'_'.$item.
                             '" value="default" '.$checked.'/>'.$titles{$item}.
                             '</label></span>&nbsp; ';
         }          }
         $datatable .= '<span class="LC_nobreak"><label>'.      }
                       '<input type="checkbox" name="'.$context.'_'.$item.      if ($context eq 'requestcourses') {
                       '" value="default" '.$checked.'/>'.$titles{$item}.          $datatable .= '</tr><tr>';
                       '</label></span>&nbsp; ';          foreach my $item (@usertools) {
               $datatable .= '<td style="vertical-align: top;">'.$defcell{$item}.'</td>';
           }
           $datatable .= '</tr></table>';
     }      }
     $datatable .= '</td>';      $datatable .= '</td>';
     unless ($context eq 'requestcourses') {      unless ($context eq 'requestcourses') {
Line 1094  sub print_quotas { Line 1346  sub print_quotas {
     $typecount ++;      $typecount ++;
     $css_class = $typecount%2?' class="LC_odd_row"':'';      $css_class = $typecount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr'.$css_class.'>'.      $datatable .= '<tr'.$css_class.'>'.
                   '<td><br/>'.&mt('LON-CAPA Advanced Users').'</td>'.                    '<td>'.&mt('LON-CAPA Advanced Users').' ';
                   '<td class="LC_left_item" colspan="2"><br />';      if ($context eq 'requestcourses') {
           $datatable .= &mt('(overrides affiliation, if set)').
                         '</td>'.
                         '<td class="LC_left_item">'.
                         '<table><tr>';
       } else {
           $datatable .= &mt('(overrides affiliation, if checked)').
                         '</td>'.
                         '<td class="LC_left_item" colspan="2">'.
                         '<br />';
       }
       my %advcell;
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         my $checked;          if ($context eq 'requestcourses') {
         unless ($context eq 'requestcourses') {              my ($curroption,$currlimit);
             $checked = 'checked="checked" ';              if (ref($settings) eq 'HASH') {
         }                  if (ref($settings->{$item}) eq 'HASH') {
         if (ref($settings) eq 'HASH') {                      $curroption = $settings->{$item}->{'_LC_adv'};
             if (ref($settings->{$item}) eq 'HASH') {                      if ($curroption =~ /^autolimit=(\d*)$/) {
                 if ($settings->{$item}->{'_LC_adv'} == 0) {                          $currlimit = $1;
                     $checked = '';                      }
                 } elsif ($settings->{$item}->{'_LC_adv'} == 1) {                  }
                     $checked = 'checked="checked" ';              }
               $datatable .= '<th>'.$titles{$item}.'</th>';
               my $checked = '';
               if ($curroption eq '') {
                   $checked = ' checked="checked"';
               }
               $advcell{$item} .= '<span class="LC_nobreak"><label>'.
                                  '<input type="radio" name="crsreq_'.$item.
                                  '__LC_adv" value=""'.$checked.' />'.
                                  &mt('No override set').'</label></span>&nbsp; ';
               foreach my $option (@options) {
                   my $val = $option;
                   if ($option eq 'norequest') {
                       $val = 0;
                   }
                   if ($option eq 'validate') {
                       my $canvalidate = 0;
                       if (ref($validations{$item}) eq 'HASH') {
                           if ($validations{$item}{'_LC_adv'}) {
                               $canvalidate = 1;
                           }
                       }
                       next if (!$canvalidate);
                   }
                   my $checked = '';
                   if ($val eq $curroption) {
                       $checked = ' checked="checked"';
                   } elsif ($option eq 'autolimit') {
                       if ($curroption =~ /^autolimit/) {
                           $checked = ' checked="checked"';
                       }
                   }
                   $advcell{$item} .= '<span class="LC_nobreak"><label>'.
                                     '<input type="radio" name="crsreq_'.$item.
                                     '__LC_adv" value="'.$val.'"'.$checked.' />'.
                                     $titles{$option}.'</label>';
                   if ($option eq 'autolimit') {
                       $advcell{$item} .= '<input type="text" name="crsreq_'.
                                          $item.'_limit__LC_adv" size="1" '.
                                          'value="'.$currlimit.'" />';
                   }
                   $advcell{$item} .= '</span>&nbsp; ';
                   if ($option eq 'autolimit') {
                       $advcell{$item} .= $titles{'unlimited'};
                   }
               }
           } else {
               my $checked = 'checked="checked" ';
               if (ref($settings) eq 'HASH') {
                   if (ref($settings->{$item}) eq 'HASH') {
                       if ($settings->{$item}->{'_LC_adv'} == 0) {
                           $checked = '';
                       } elsif ($settings->{$item}->{'_LC_adv'} == 1) {
                           $checked = 'checked="checked" ';
                       }
                 }                  }
             }              }
               $datatable .= '<span class="LC_nobreak"><label>'.
                             '<input type="checkbox" name="'.$context.'_'.$item.
                             '" value="_LC_adv" '.$checked.'/>'.$titles{$item}.
                             '</label></span>&nbsp; ';
         }          }
         $datatable .= '<span class="LC_nobreak"><label>'.  
                       '<input type="checkbox" name="'.$context.'_'.$item.  
                       '" value="_LC_adv" '.$checked.'/>'.$titles{$item}.  
                       '</label></span>&nbsp; ';  
     }      }
     $datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation').      if ($context eq 'requestcourses') {
                   ')</span></td></tr>';          $datatable .= '</tr><tr>';
           foreach my $item (@usertools) {
               $datatable .= '<td style="vertical-align: top;">'.$advcell{$item}.'</td>';
           }
           $datatable .= '</tr></table>';
       }
       $datatable .= '</td></tr>';
     $$rowtotal += $typecount;      $$rowtotal += $typecount;
     return $datatable;      return $datatable;
 }  }
   
   sub print_courserequestmail {
       my ($dom,$settings,$rowtotal) = @_;
       my ($now,$datatable,%dompersonnel,@domcoord,@currapproval,$rows);
       $now = time;
       $rows = 0;
       %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc'],$now,$now);
       foreach my $server (keys(%dompersonnel)) {
           foreach my $user (sort(keys(%{$dompersonnel{$server}}))) {
               my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
               if (!grep(/^$uname:$udom$/,@domcoord)) {
                   push(@domcoord,$uname.':'.$udom);
               }
           }
       }
       if (ref($settings) eq 'HASH') {
           if (ref($settings->{'notify'}) eq 'HASH') {
               if ($settings->{'notify'}{'approval'} ne '') {
                  @currapproval = split(',',$settings->{'notify'}{'approval'});
               }
           }
       }
       if (@currapproval) {
           foreach my $dc (@currapproval) {
               unless (grep(/^\Q$dc\E$/,@domcoord)) {
                   push(@domcoord,$dc);
               }
           }
       }
       @domcoord = sort(@domcoord);
       my $numinrow = 4;
       my $numdc = @domcoord;
       my $css_class = 'class="LC_odd_row"';
       $datatable = '<tr'.$css_class.'>'.
                    ' <td>'.&mt('Receive notification of course requests requiring approval.').
                    ' </td>'.
                    ' <td class="LC_left_item">';
       if (@domcoord > 0) {
           $datatable .= '<table>';
           for (my $i=0; $i<$numdc; $i++) {
               my $rem = $i%($numinrow);
               if ($rem == 0) {
                   if ($i > 0) {
                       $datatable .= '</tr>';
                   }
                   $datatable .= '<tr>';
                   $rows ++;
               }
               my $check = ' ';
               if (grep(/^\Q$domcoord[$i]\E$/,@currapproval)) {
                   $check = ' checked="checked" ';
               }
               my ($uname,$udom) = split(':',$domcoord[$i]);
               my $fullname = &Apache::loncommon::plainname($uname,$udom);
               if ($i == $numdc-1) {
                   my $colsleft = $numinrow-$rem;
                   if ($colsleft > 1) {
                       $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
                   } else {
                       $datatable .= '<td class="LC_left_item">';
                   }
               } else {
                   $datatable .= '<td class="LC_left_item">';
               }
               $datatable .= '<span class="LC_nobreak"><label>'.
                             '<input type="checkbox" name="reqapprovalnotify" '.
                             'value="'.$domcoord[$i].'"'.$check.'/>'.
                             $fullname.'</label></span></td>';
           }
           $datatable .= '</tr></table>';
       } else {
           $datatable .= &mt('There are no active Domain Coordinators');
           $rows ++;
       }
       $datatable .='</td></tr>';
       $$rowtotal += $rows;
       return $datatable;
   }
   
 sub print_autoenroll {  sub print_autoenroll {
     my ($dom,$settings,$rowtotal) = @_;      my ($dom,$settings,$rowtotal) = @_;
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),      my $autorun = &Apache::lonnet::auto_run(undef,$dom),
Line 1357  sub print_contacts { Line 1758  sub print_contacts {
     my $datatable;      my $datatable;
     my @contacts = ('adminemail','supportemail');      my @contacts = ('adminemail','supportemail');
     my (%checked,%to,%otheremails);      my (%checked,%to,%otheremails);
     my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail');      my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
                       'requestsmail');
     foreach my $type (@mailings) {      foreach my $type (@mailings) {
         $otheremails{$type} = '';          $otheremails{$type} = '';
     }      }
Line 1388  sub print_contacts { Line 1790  sub print_contacts {
         $checked{'packagesmail'}{'adminemail'} = ' checked="checked" ';          $checked{'packagesmail'}{'adminemail'} = ' checked="checked" ';
         $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';          $checked{'helpdeskmail'}{'supportemail'} = ' checked="checked" ';
         $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';           $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; 
           $checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
     }      }
     my ($titles,$short_titles) = &contact_titles();      my ($titles,$short_titles) = &contact_titles();
     my $rownum = 0;      my $rownum = 0;
Line 1433  sub contact_titles { Line 1836  sub contact_titles {
                    'packagesmail' => 'Package update alerts to be e-mailed to',                     'packagesmail' => 'Package update alerts to be e-mailed to',
                    'helpdeskmail' => 'Helpdesk requests to be e-mailed to',                     'helpdeskmail' => 'Helpdesk requests to be e-mailed to',
                    'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',                     'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
                      'requestsmail' => 'E-mail from course requests requiring approval',
                  );                   );
     my %short_titles = &Apache::lonlocal::texthash (      my %short_titles = &Apache::lonlocal::texthash (
                            adminemail   => 'Admin E-mail address',                             adminemail   => 'Admin E-mail address',
Line 1448  sub tool_titles { Line 1852  sub tool_titles {
                      portfolio  => 'Portfolio',                       portfolio  => 'Portfolio',
                      official   => 'Official courses (with institutional codes)',                       official   => 'Official courses (with institutional codes)',
                      unofficial => 'Unofficial courses',                       unofficial => 'Unofficial courses',
                        community  => 'Communities',
                  );                   );
     return %titles;      return %titles;
 }  }
   
   sub courserequest_titles {
       my %titles = &Apache::lonlocal::texthash (
                                      official   => 'Official',
                                      unofficial => 'Unofficial',
                                      community  => 'Communities',
                                      norequest  => 'Not allowed',
                                      approval   => 'Approval by Dom. Coord.',
                                      validate   => 'With validation',
                                      autolimit  => 'Numerical limit',
                                      unlimited  => '(blank for unlimited)',
                    );
       return %titles;
   }
   
   sub courserequest_conditions {
       my %conditions = &Apache::lonlocal::texthash (
          approval   => '(Processing of request subject to approval by Domain Coordinator).',
          validate   => '(Processing of request subject to instittutional validation).',
                    );
       return %conditions;
   }
   
   
 sub print_usercreation {  sub print_usercreation {
     my ($position,$dom,$settings,$rowtotal) = @_;      my ($position,$dom,$settings,$rowtotal) = @_;
     my $numinrow = 4;      my $numinrow = 4;
Line 1493  sub print_usercreation { Line 1921  sub print_usercreation {
             $rowcount ++;              $rowcount ++;
         }          }
     } elsif ($position eq 'middle') {      } elsif ($position eq 'middle') {
         my @creators = ('author','course','selfcreate');          my @creators = ('author','course','requestcrs','selfcreate');
         my ($rules,$ruleorder) =          my ($rules,$ruleorder) =
             &Apache::lonnet::inst_userrules($dom,'username');              &Apache::lonnet::inst_userrules($dom,'username');
         my %lt = &usercreation_types();          my %lt = &usercreation_types();
Line 1574  sub print_usercreation { Line 2002  sub print_usercreation {
             &Apache::loncommon::sorted_inst_types($dom);              &Apache::loncommon::sorted_inst_types($dom);
         if (ref($usertypes) eq 'HASH') {          if (ref($usertypes) eq 'HASH') {
             if (keys(%{$usertypes}) > 0) {              if (keys(%{$usertypes}) > 0) {
                 $datatable .= &insttypes_row($settings->{cancreate},$types,$usertypes,                  my $createsettings;
                   if (ref($settings) eq 'HASH') {
                       $createsettings = $settings->{cancreate};
                   }
                   $datatable .= &insttypes_row($createsettings,$types,$usertypes,
                                              $dom,$numinrow,$othertitle,                                               $dom,$numinrow,$othertitle,
                                              'statustocreate');                                               'statustocreate');
                 $$rowtotal ++;                  $$rowtotal ++;
Line 1692  sub usercreation_types { Line 2124  sub usercreation_types {
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                     author     => 'When adding a co-author',                      author     => 'When adding a co-author',
                     course     => 'When adding a user to a course',                      course     => 'When adding a user to a course',
                       requestcrs => 'When requesting a course',
                     selfcreate => 'User creates own account',                       selfcreate => 'User creates own account', 
                     any        => 'Any',                      any        => 'Any',
                     official   => 'Institutional only ',                      official   => 'Institutional only ',
Line 1833  sub print_scantronformat { Line 2266  sub print_scantronformat {
         %confhash);          %confhash);
     my $switchserver = &check_switchserver($dom,$confname);      my $switchserver = &check_switchserver($dom,$confname);
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                 default => 'Default scantron format file error',                  default => 'Default bubblesheet format file error',
                 custom  => 'Custom scantron format file error',                  custom  => 'Custom bubblesheet format file error',
              );               );
     my %scantronfiles = (      my %scantronfiles = (
         default => 'default.tab',          default => 'default.tab',
Line 1907  sub print_scantronformat { Line 2340  sub print_scantronformat {
                 }                  }
             }              }
         } else {          } else {
             $error{'default'} = &mt("Unable to copy default scantron formatfile to domain's RES space: [_1]",$switchserver);              $error{'default'} = &mt("Unable to copy default bubblesheet formatfile to domain's RES space: [_1]",$switchserver);
         }          }
     }      }
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
Line 2200  sub print_serverstatuses { Line 2633  sub print_serverstatuses {
 sub serverstatus_pages {  sub serverstatus_pages {
     return ('userstatus','lonstatus','loncron','server-status','codeversions',      return ('userstatus','lonstatus','loncron','server-status','codeversions',
             'clusterstatus','metadata_keywords','metadata_harvest',              'clusterstatus','metadata_keywords','metadata_harvest',
             'takeoffline','takeonline','showenv');              'takeoffline','takeonline','showenv','toggledebug');
 }  }
   
 sub coursecategories_javascript {  sub coursecategories_javascript {
Line 2227  sub coursecategories_javascript { Line 2660  sub coursecategories_javascript {
     }      }
     $output = <<"ENDSCRIPT";      $output = <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 function reorderCats(form,parent,item,idx) {  function reorderCats(form,parent,item,idx) {
     var changedVal;      var changedVal;
 $jstext  $jstext
Line 2283  $jstext Line 2717  $jstext
     }      }
     return;      return;
 }  }
   // ]]>
 </script>  </script>
   
 ENDSCRIPT  ENDSCRIPT
Line 2495  sub insttypes_row { Line 2930  sub insttypes_row {
                     $output .= '<tr>';                      $output .= '<tr>';
                 }                  }
                 my $check = ' ';                  my $check = ' ';
                 if (ref($settings->{$context}) eq 'ARRAY') {                  if (ref($settings) eq 'HASH') {
                     if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {                      if (ref($settings->{$context}) eq 'ARRAY') {
                           if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) {
                               $check = ' checked="checked" ';
                           }
                       } elsif ($context eq 'statustocreate') {
                         $check = ' checked="checked" ';                          $check = ' checked="checked" ';
                     }                      }
                 } elsif ($context eq 'statustocreate') {  
                     $check = ' checked="checked" ';  
                 }                  }
                 $output .= '<td class="LC_left_item">'.                  $output .= '<td class="LC_left_item">'.
                            '<span class="LC_nobreak"><label>'.                             '<span class="LC_nobreak"><label>'.
Line 2519  sub insttypes_row { Line 2956  sub insttypes_row {
         $output .= '<td class="LC_left_item">';          $output .= '<td class="LC_left_item">';
     }      }
     my $defcheck = ' ';      my $defcheck = ' ';
     if (ref($settings->{$context}) eq 'ARRAY') {      if (ref($settings) eq 'HASH') {  
         if (grep(/^default$/,@{$settings->{$context}})) {          if (ref($settings->{$context}) eq 'ARRAY') {
               if (grep(/^default$/,@{$settings->{$context}})) {
                   $defcheck = ' checked="checked" ';
               }
           } elsif ($context eq 'statustocreate') {
             $defcheck = ' checked="checked" ';              $defcheck = ' checked="checked" ';
         }          }
     } elsif ($context eq 'statustocreate') {  
         $defcheck = ' checked="checked" ';  
     }      }
     $output .= '<span class="LC_nobreak"><label>'.      $output .= '<span class="LC_nobreak"><label>'.
                '<input type="checkbox" name="'.$context.'" '.                 '<input type="checkbox" name="'.$context.'" '.
Line 3307  sub check_switchserver { Line 3746  sub check_switchserver {
   
 sub modify_quotas {  sub modify_quotas {
     my ($dom,$action,%domconfig) = @_;      my ($dom,$action,%domconfig) = @_;
     my ($context,@usertools);      my ($context,@usertools,@options,%validations,%titles,%confhash,%toolshash,
           %limithash,$toolregexp,%conditions,$resulttext,%changes);
     if ($action eq 'quotas') {      if ($action eq 'quotas') {
         $context = 'tools';           $context = 'tools'; 
     } else {       } else { 
         $context = $action;          $context = $action;
     }      }
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         @usertools = ('official','unofficial');          @usertools = ('official','unofficial','community');
           @options =('norequest','approval','autolimit','validate');
           %validations = &Apache::lonnet::auto_courserequest_checks($dom);
           %titles = &courserequest_titles();
           $toolregexp = join('|',@usertools);
           %conditions = &courserequest_conditions();
     } else {      } else {
         @usertools = ('aboutme','blog','portfolio');          @usertools = ('aboutme','blog','portfolio');
           %titles = &tool_titles();
     }      }
     my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);      my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
     my ($resulttext,%changes);  
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);      my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
     my %titles = &tool_titles();  
     my (%confhash,%toolshash);  
     foreach my $key (keys(%env)) {      foreach my $key (keys(%env)) {
         unless ($context eq 'requestcourses') {          if ($context eq 'requestcourses') {
               if ($key =~ /^form\.crsreq_($toolregexp)_(.+)$/) {
                   my $item = $1;
                   my $type = $2;
                   if ($type =~ /^limit_(.+)/) {
                       $limithash{$item}{$1} = $env{$key};
                   } else {
                       $confhash{$item}{$type} = $env{$key};
                   }
               }
           } else {
             if ($key =~ /^form\.quota_(.+)$/) {              if ($key =~ /^form\.quota_(.+)$/) {
                 $confhash{'defaultquota'}{$1} = $env{$key};                  $confhash{'defaultquota'}{$1} = $env{$key};
             }              }
         }              if ($key =~ /^form\.\Q$context\E_(.+)$/) {
         if ($key =~ /^form\.\Q$context\E_(.+)$/) {                  @{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key);
             @{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key);              }
         }          }
     }      }
     unless ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
           my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify');
           @approvalnotify = sort(@approvalnotify);
           $confhash{'notify'}{'approval'} = join(',',@approvalnotify);
           if (ref($domconfig{$action}) eq 'HASH') {
               if (ref($domconfig{$action}{'notify'}) eq 'HASH') {
                   if ($domconfig{$action}{'notify'}{'approval'} ne $confhash{'notify'}{'approval'}) {
                       $changes{'notify'}{'approval'} = 1;
                   }
               } else {
                   if ($domconfig{$action}{'notify'}{'approval'}) {
                       $changes{'notify'}{'approval'} = 1;
                   }
               }
           } else {
               if ($domconfig{$action}{'notify'}{'approval'}) {
                   $changes{'notify'}{'approval'} = 1;
               }
           }
       } else {
         $confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'};          $confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'};
     }      }
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         foreach my $type (@{$types},'default','_LC_adv') {          foreach my $type (@{$types},'default','_LC_adv') {
             if (grep(/^\Q$type\E$/,@{$toolshash{$item}})) {              my $unset;
                 $confhash{$item}{$type} = 1;              if ($context eq 'requestcourses') {
                   $unset = '0';
                   if ($type eq '_LC_adv') {
                       $unset = '';
                   }
                   if ($confhash{$item}{$type} eq 'autolimit') {
                       $confhash{$item}{$type} .= '=';
                       unless ($limithash{$item}{$type} =~ /\D/) {
                           $confhash{$item}{$type} .= $limithash{$item}{$type};
                       }
                   }
             } else {              } else {
                 $confhash{$item}{$type} = 0;                  if (grep(/^\Q$type\E$/,@{$toolshash{$item}})) {
                       $confhash{$item}{$type} = 1;
                   } else {
                       $confhash{$item}{$type} = 0;
                   }
             }              }
             if (ref($domconfig{$action}) eq 'HASH') {              if (ref($domconfig{$action}) eq 'HASH') {
                 if (ref($domconfig{$action}{$item}) eq 'HASH') {                  if (ref($domconfig{$action}{$item}) eq 'HASH') {
Line 3350  sub modify_quotas { Line 3836  sub modify_quotas {
                     }                      }
                 } else {                  } else {
                     if ($context eq 'requestcourses') {                      if ($context eq 'requestcourses') {
                         if ($confhash{$item}{$type}) {                          if ($confhash{$item}{$type} ne $unset) {
                             $changes{$item}{$type} = 1;                              $changes{$item}{$type} = 1;
                         }                          }
                     } else {                      } else {
Line 3361  sub modify_quotas { Line 3847  sub modify_quotas {
                 }                  }
             } else {              } else {
                 if ($context eq 'requestcourses') {                  if ($context eq 'requestcourses') {
                     if ($confhash{$item}{$type}) {                      if ($confhash{$item}{$type} ne $unset) {
                         $changes{$item}{$type} = 1;                          $changes{$item}{$type} = 1;
                     }                      }
                 } else {                  } else {
Line 3471  sub modify_quotas { Line 3957  sub modify_quotas {
                                 $typetitle = 'LON-CAPA Advanced Users';                                   $typetitle = 'LON-CAPA Advanced Users'; 
                             }                              }
                             if ($confhash{$item}{$type}) {                              if ($confhash{$item}{$type}) {
                                 $resulttext .= '<li>'.&mt('Set to be available to [_1]',$typetitle).'</li>';                                  if ($context eq 'requestcourses') {
                                       my $cond;
                                       if ($confhash{$item}{$type} =~ /^autolimit=(\d*)$/) {
                                           if ($1 eq '') {
                                               $cond = &mt('(Automatic processing of any request).');
                                           } else {
                                               $cond = &mt('(Automatic processing of requests up to limit of [quant,_1,request] per user).',$1);
                                           }
                                       } else { 
                                           $cond = $conditions{$confhash{$item}{$type}};
                                       }
                                       $resulttext .= '<li>'.&mt('Set to be available to [_1].',$typetitle).' '.$cond.'</li>';
                                   } else {
                                       $resulttext .= '<li>'.&mt('Set to be available to [_1]',$typetitle).'</li>';
                                   }
                             } else {                              } else {
                                 $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';                                  if ($type eq '_LC_adv') {
                                       if ($confhash{$item}{$type} eq '0') {
                                           $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';
                                       } else { 
                                           $resulttext .= '<li>'.&mt('No override set for [_1]',$typetitle).'</li>';
                                       }
                                   } else {
                                       $resulttext .= '<li>'.&mt('Set to be unavailable to [_1]',$typetitle).'</li>';
                                   }
                             }                              }
                         }                          }
                     }                      }
                     $resulttext .= '</ul></li>';                      $resulttext .= '</ul></li>';
                 }                  }
             }              }
               if ($action eq 'requestcourses') {
                   if (ref($changes{'notify'}) eq 'HASH') {
                       if ($changes{'notify'}{'approval'}) {
                           if (ref($confhash{'notify'}) eq 'HASH') {
                               if ($confhash{'notify'}{'approval'}) {
                                   $resulttext .= '<li>'.&mt('Notification of requests requiring approval will be sent to: ').$confhash{'notify'}{'approval'}.'</li>';
                               } else {
                                   $resulttext .= '<li>'.&mt('No Domain Coordinators will receive notification of course requests requiring approval.').'</li>';
                               }
                           }
                       }
                   }
               }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
             if (keys(%newenv)) {              if (keys(%newenv)) {
                 &Apache::lonnet::appenv(\%newenv);                  &Apache::lonnet::appenv(\%newenv);
Line 3872  sub modify_contacts { Line 4393  sub modify_contacts {
     }      }
     my (%others,%to);      my (%others,%to);
     my @contacts = ('supportemail','adminemail');      my @contacts = ('supportemail','adminemail');
     my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail');      my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',
                       'requestsmail');
     foreach my $type (@mailings) {      foreach my $type (@mailings) {
         @{$newsetting{$type}} =           @{$newsetting{$type}} = 
             &Apache::loncommon::get_env_multiple('form.'.$type);              &Apache::loncommon::get_env_multiple('form.'.$type);
Line 3918  sub modify_contacts { Line 4440  sub modify_contacts {
         $default{'packagesmail'} = 'adminemail';          $default{'packagesmail'} = 'adminemail';
         $default{'helpdeskmail'} = 'supportemail';          $default{'helpdeskmail'} = 'supportemail';
         $default{'lonstatusmail'} = 'adminemail';          $default{'lonstatusmail'} = 'adminemail';
           $default{'requestsmail'} = 'adminemail';
         foreach my $item (@contacts) {          foreach my $item (@contacts) {
            if ($to{$item} ne $default{$item}) {             if ($to{$item} ne $default{$item}) {
               $changes{$item} = 1;                $changes{$item} = 1;
Line 3984  sub modify_usercreation { Line 4507  sub modify_usercreation {
     my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule');      my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule');
     my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule');      my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule');
     my @email_rule = &Apache::loncommon::get_env_multiple('form.email_rule');      my @email_rule = &Apache::loncommon::get_env_multiple('form.email_rule');
     my @contexts = ('author','course','selfcreate');      my @contexts = ('author','course','requestcrs','selfcreate');
     foreach my $item(@contexts) {      foreach my $item(@contexts) {
         if ($item eq 'selfcreate') {          if ($item eq 'selfcreate') {
             @{$cancreate{$item}} = &Apache::loncommon::get_env_multiple('form.can_createuser_'.$item);              @{$cancreate{$item}} = &Apache::loncommon::get_env_multiple('form.can_createuser_'.$item);
Line 4006  sub modify_usercreation { Line 4529  sub modify_usercreation {
         if (@{$types} > 0) {          if (@{$types} > 0) {
             @{$cancreate{'statustocreate'}} =               @{$cancreate{'statustocreate'}} = 
                 &Apache::loncommon::get_env_multiple('form.statustocreate');                  &Apache::loncommon::get_env_multiple('form.statustocreate');
           } else {
               @{$cancreate{'statustocreate'}} = ();
         }          }
         push(@contexts,'statustocreate');          push(@contexts,'statustocreate');
     }      }
Line 4014  sub modify_usercreation { Line 4539  sub modify_usercreation {
             if (($item eq 'selfcreate') || ($item eq 'statustocreate')) {              if (($item eq 'selfcreate') || ($item eq 'statustocreate')) {
                 if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') {                  if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') {
                     foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) {                      foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) {
                         if (!grep(/^$curr$/,@{$cancreate{$item}})) {                          if (ref($cancreate{$item}) eq 'ARRAY') {
                             if (!grep(/^$item$/,@{$changes{'cancreate'}})) {                              if (!grep(/^$curr$/,@{$cancreate{$item}})) {
                                 push(@{$changes{'cancreate'}},$item);                                  if (!grep(/^$item$/,@{$changes{'cancreate'}})) {
                                       push(@{$changes{'cancreate'}},$item);
                                   }
                             }                              }
                         }                          }
                     }                      }
Line 4188  sub modify_usercreation { Line 4715  sub modify_usercreation {
             if (ref($changes{'cancreate'}) eq 'ARRAY') {              if (ref($changes{'cancreate'}) eq 'ARRAY') {
                 my %lt = &usercreation_types();                  my %lt = &usercreation_types();
                 foreach my $type (@{$changes{'cancreate'}}) {                  foreach my $type (@{$changes{'cancreate'}}) {
                     my $chgtext =  $lt{$type}.', ';                      my $chgtext;
                       unless ($type eq 'statustocreate') {
                           $chgtext = $lt{$type}.', ';
                       }
                     if ($type eq 'selfcreate') {                      if ($type eq 'selfcreate') {
                         if (@{$cancreate{$type}} == 0) {                          if (@{$cancreate{$type}} == 0) {
                             $chgtext .= &mt('creation of a new user account is not permitted.');                              $chgtext .= &mt('creation of a new user account is not permitted.');
                         } else {                          } else {
                             $chgtext .= &mt('creation of a new account is permitted for:<ul>');                              $chgtext .= &mt('creation of a new account is permitted for:').'<ul>';
                             foreach my $case (@{$cancreate{$type}}) {                              foreach my $case (@{$cancreate{$type}}) {
                                 $chgtext .= '<li>'.$selfcreatetypes{$case}.'</li>';                                  $chgtext .= '<li>'.$selfcreatetypes{$case}.'</li>';
                             }                              }
                             $chgtext .= '</ul>';                              $chgtext .= '</ul>';
                               if (ref($cancreate{$type}) eq 'ARRAY') {
                                   if (grep(/^(login|sso)$/,@{$cancreate{$type}})) {
                                       if (ref($cancreate{'statustocreate'}) eq 'ARRAY') {
                                           if (@{$cancreate{'statustocreate'}} == 0) {
                                               $chgtext .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>';
                                           }
                                       }
                                   }
                               }
                         }                          }
                     } elsif ($type eq 'statustocreate') {                      } elsif ($type eq 'statustocreate') {
                         if (@{$cancreate{'selfcreate'}} > 0) {                          if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') &&
                             if (@{$cancreate{$type}} == 0) {                              (ref($cancreate{'statustocreate'}) eq 'ARRAY')) {
                                 if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) {                              if (@{$cancreate{'selfcreate'}} > 0) {
                                     $chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.");                                  if (@{$cancreate{'statustocreate'}} == 0) {
                                 }  
                             } elsif (ref($usertypes) eq 'HASH') {                                      $chgtext .= &mt("Institutional affiliations permitted to create accounts set to 'None'.");
                                 if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {                                      if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) {
                                     $chgtext .= &mt('creation of a new account for an institutional user is restricted to the following institutional affiliation(s):').'<ul>';                                          $chgtext .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>';
                                       } 
                                   } elsif (ref($usertypes) eq 'HASH') {
                                       if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {
                                           $chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):');
                                       } else {
                                           $chgtext .= &mt('Institutional affiliations permitted to create accounts with institutional authentication were set as follows:');
                                       }
                                       $chgtext .= '<ul>';
                                     foreach my $case (@{$cancreate{$type}}) {                                      foreach my $case (@{$cancreate{$type}}) {
                                         if ($case eq 'default') {                                          if ($case eq 'default') {
                                             $chgtext .= '<li>'.$othertitle.'</li>';                                              $chgtext .= '<li>'.$othertitle.'</li>';
Line 4216  sub modify_usercreation { Line 4763  sub modify_usercreation {
                                         }                                          }
                                     }                                      }
                                     $chgtext .= '</ul>';                                      $chgtext .= '</ul>';
                                       if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) {
                                           $chgtext .= '<br /><span class="LC_warning">'.&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.').'</span>';
                                       }
                                   }
                               } else {
                                   if (@{$cancreate{$type}} == 0) {
                                       $chgtext .= &mt("Institutional affiliations permitted to create accounts were set to 'none'.");
                                   } else {
                                       $chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.');
                                 }                                  }
                             }                              }
                         }                          }
Line 4456  sub modify_defaults { Line 5012  sub modify_defaults {
             if ($newvalues{$item} ne '') {              if ($newvalues{$item} ne '') {
                 if ($newvalues{$item} =~ /^(\w+)/) {                  if ($newvalues{$item} =~ /^(\w+)/) {
                     my $langcode = $1;                      my $langcode = $1;
                     if (code2language($langcode) eq '') {                      if ($langcode ne 'x_chef') {
                         push(@errors,$item);                          if (code2language($langcode) eq '') {
                               push(@errors,$item);
                           }
                     }                      }
                 } else {                  } else {
                     push(@errors,$item);                      push(@errors,$item);

Removed from v.1.93  
changed lines
  Added in v.1.102.2.5


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