Diff for /doc/loncapafiles/updatequery.piml between versions 1.42 and 1.43

version 1.42, 2005/10/26 19:38:15 version 1.43, 2005/12/09 00:53:54
Line 129  END Line 129  END
 $|=1;  $|=1;
 my $domainDescription;  my $domainDescription;
 my $domainTabExtras;  my $domainTabExtras;
   my $primaryLibServer;
   my @libservers = ();
 unless (-e "<TARGET />") {  unless (-e "<TARGET />") {
   print(&lt;&lt;END);    print(&lt;&lt;END);
            WELCOME TO LON-CAPA!             WELCOME TO LON-CAPA!
Line 355  END Line 357  END
   }    }
 }  }
   
   # get primary library server in domain
   if ($lonRole eq 'library') {
       if (!grep/^\Q$lonHostID\E$/,@libservers) {
           push(@libservers,$lonHostID);
       } 
       if (@libservers == 1) {
           $primaryLibServer = $libservers[0];
       }
   }
   while (!$flag) {
     print(&lt;&lt;END);
   **** Domain's Primary Library Server ID ****
   This should be the LON-CAPA machine ID of a library server in your 
   domain.  If you only have a single library server in your domain, then
   the Primary Library server ID will be the machine ID of that server. 
   This server will be where domain data which are not associated with any
   specific home library server will be stored (e.g., e-mail broadcast by
   administrators to users in the domain).
   END
       if (defined($primaryLibServer)) {
           print(&lt;&lt;END);
   ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$primaryLibServer]:
   END
       } elsif (@libservers > 0) {
           print(&lt;&lt;END);
   ENTER DOMAIN'S PRIMARY LIBRARY SERVER ID [$libservers[0]]
   END
       } else {
           print (&lt;&lt;END);
   No library servers could be identified for this domain.  If you have already installed LON-CAPA on a different server (designated as a library server) in this domain, please enter the LONCAPA MACHINE ID of that server.  If not, you will need to install a LON-CAPA library server.  Enter the MACHINE ID of the server you plan to designate as a library server.
   END
       }
   
       my $choice=&lt;&gt;;
       chomp($choice);
       if ($primaryLibServer and $choice=~/^\s*$/) {
           $choice=$primaryLibServer;
           open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
           print(OUT 'primaryLibServer'."\t".$choice."\n");
           close(OUT);
           $flag=1;
       } elsif (length($choice)>15) {
           print "Name too long\n";
       } elsif (length($choice)<4) {
           print "Name too short\n";
       } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
           open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
           print(OUT 'primaryLibServer'."\t".$choice."\n");
           close(OUT);
           $primaryLibServer=$choice;
           $flag=1;
       } else {
           print "Invalid input (only alphanumeric characters supported).\n";
       }
   }
   
   
 # get admin e-mail address  # get admin e-mail address
 # accept if valid, if not valid, tell user and repeat  # accept if valid, if not valid, tell user and repeat
 $flag=0;  $flag=0;
Line 564  my %perlvarstatic; Line 623  my %perlvarstatic;
        }         }
        close(IN);         close(IN);
     }      }
       if (!$primaryLibServer and $lonCluster ne 'existing') {
           open(IN,'&lt;../'.$lonCluster.'_domain.tab');
           while(&lt;IN&gt;) {
               if (/^$perlvar{'lonDefDomain'}\:/) {
                   (undef,undef,undef,undef,undef,undef,undef,undef,
                                                 $primaryLibServer)=split(/:/,$_);
                   chomp($primaryLibServer);
               }
           }
           close(IN);
           if (!$primaryLibServer) {
               open(IN,'&lt;../'.$lonCluster.'_hosts.tab');
               while(&lt;IN&gt;) {
                   if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
                       push(@libservers,$1);
                   }
               }
               close(IN);
               if (@libservers == 1) {
                   $primaryLibServer = $libservers[0];
               }
           }
       }
       if (!$primaryLibServer) {
           open(IN,'&lt;/home/httpd/lonTabs/domain.tab');
           while(&lt;IN&gt;) {
               if (/^$perlvar{'lonDefDomain'}\:/) {
                   (undef,undef,undef,undef,undef,undef,undef,undef,
                                                 $primaryLibServer)=split(/:/,$_);
                   chomp($primaryLibServer);
               }
               close(IN);
           }
           if (!$primaryLibServer) {
               open(IN,'&lt;/home/httpd/lonTabs/hosts.tab');
               while(&lt;IN&gt;) {
                   if (/^([^\:]+)\:\Q$perlvar{'lonDefDomain'}\E\:library\:/) {
                       push(@libservers,$1);
                   }
               }
               close(IN);
               if (@libservers == 1) {
                   $primaryLibServer = $libservers[0];
               }
           }
       }
       $primaryLibServer = '';
         
 # implement editing logic below, interactively  # implement editing logic below, interactively
 # update loncapa.conf until 8 is entered  # update loncapa.conf until 8 is entered
Line 578  This is now the current configuration of Line 684  This is now the current configuration of
  1) Domain Name: $perlvar{'lonDefDomain'}   1) Domain Name: $perlvar{'lonDefDomain'}
  2) Domain Description: $domainDescription   2) Domain Description: $domainDescription
  3) Machine Name: $perlvar{'lonHostID'}   3) Machine Name: $perlvar{'lonHostID'}
  4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}   4) ID of primary library server for domain: $primaryLibServer
  5) Support E-mail Address: $perlvar{'lonSupportEMail'}   5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
  6) Role: $perlvar{'lonRole'}   6) Support E-mail Address: $perlvar{'lonSupportEMail'}
  7) Cache Expiration Time: $perlvar{'lonExpire'}   7) Role: $perlvar{'lonRole'}
  8) Server Load: $perlvar{'lonLoadLim'}   8) Cache Expiration Time: $perlvar{'lonExpire'}
  9) User Load: $perlvar{'lonUserLoadLim'}   9) Server Load: $perlvar{'lonLoadLim'}
 10) Allow only secure connections: $securestatus   10) User Load: $perlvar{'lonUserLoadLim'}
 11) Everything is correct up above  11) Allow only secure connections: $securestatus 
   12) Everything is correct up above
 END  END
   
 my $error='';  my $error='';
Line 613  foreach my $v ($perlvar{'lonExpire'},$pe Line 720  foreach my $v ($perlvar{'lonExpire'},$pe
 unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {  unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {
    $error.="\nInvalid Role";     $error.="\nInvalid Role";
 }  }
   
   if (!defined($primaryLibServer)) {
      if (@libservers > 0) {
          $error .= "No primary library server ID designated. Choose from: ".join(',',sort(@libservers));
      } else {
          $error .= "No library servers in this domain (including current server)";
      }
   } else {
      if (length($primaryLibServer)>16) { $error.="\nPrimary Library Server ID:  $primaryLibServer too long"; }
      if (length($primaryLibServer)<2) { $error.="\nPrimary Library Server ID:  $primaryLibServer too short"; }
      if ($primaryLibServer =~/capa/i) {
           if ($primaryLibServer!~/^oucapa\d+$/ &&
               ($primaryLibServer!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
                    $error.="\nPrimary library server ID $primaryLibServer contains 'capa'";
           }
      }
      foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
           'editupload') {
         $error.="\nPrimary library server ID $primaryLibServer reserved." if $primaryLibServer eq $bad;
      }
      if ($primaryLibServer=~/\W/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; }
   }
   
   
 if ($error) { print "\n*** ERRORS: $error\n"; }  if ($error) { print "\n*** ERRORS: $error\n"; }
   print(&lt;&lt;END);    print(&lt;&lt;END);
 ENTER A CHOICE OF 1-10 TO CHANGE, otherwise ENTER 11:  ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12:
 END  END
 my $choice=&lt;&gt;;  my $choice=&lt;&gt;;
 chomp($choice);  chomp($choice);
Line 655  END Line 786  END
   }    }
   elsif ($choice==4) {    elsif ($choice==4) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 4) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}  4) ID of primary library server for domain: $primaryLibServer
   ENTER NEW VALUE (this will be the LON-CAPA Machine ID of a library server in
                    your domain; it cannot contain any of '_' '-' '.' or ':'. 
                    This server will be where domain data which are not 
                    associated with any specific home library server
                    will be stored (e.g., e-mail broadcast by Domain Coordinators
                    to users in the domain).
   END
       my $choice2=&lt;&gt;;
       chomp($choice2);
       $primaryLibServer=$choice2;
     }
     elsif ($choice==5) {
     print(&lt;&lt;END);
   5) System Administrator's E-mail Address: $perlvar{'lonAdmEMail'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonAdmEMail'}=$choice2;      $perlvar{'lonAdmEMail'}=$choice2;
   }    }
   elsif ($choice==5) {    elsif ($choice==6) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 5) Support E-mail Address: $perlvar{'lonSupportEMail'}  6) Support E-mail Address: $perlvar{'lonSupportEMail'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonSupportEMail'}=$choice2;      $perlvar{'lonSupportEMail'}=$choice2;
   }    }
   elsif ($choice==6) {    elsif ($choice==7) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 6) Role: $perlvar{'lonRole'}  7) Role: $perlvar{'lonRole'}
 ENTER NEW VALUE (this should be either 'access' or 'library'   ENTER NEW VALUE (this should be either 'access' or 'library' 
                  if in doubt select 'library'):                   if in doubt select 'library'):
 END  END
Line 681  END Line 826  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonRole'}=$choice2;      $perlvar{'lonRole'}=$choice2;
   }    }
   elsif ($choice==7) {    elsif ($choice==8) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 7) Cache Expiration Time: $perlvar{'lonExpire'}  8) Cache Expiration Time: $perlvar{'lonExpire'}
 ENTER NEW VALUE (in seconds, 86400 is a reasonable value):  ENTER NEW VALUE (in seconds, 86400 is a reasonable value):
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonExpire'}=$choice2;      $perlvar{'lonExpire'}=$choice2;
   }    }
   elsif ($choice==8) {    elsif ($choice==9) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 8) Server Load: $perlvar{'lonLoadLim'}  9) Server Load: $perlvar{'lonLoadLim'}
 ENTER NEW VALUE:  ENTER NEW VALUE:
 END  END
     my $choice2=&lt;&gt;;      my $choice2=&lt;&gt;;
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonLoadLim'}=$choice2;      $perlvar{'lonLoadLim'}=$choice2;
   }    }
   elsif ($choice==9) {    elsif ($choice==10) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 9) User Load: $perlvar{'lonUserLoadLim'}  10) User Load: $perlvar{'lonUserLoadLim'}
 Numer of users that can login before machine is 'overloaded'  Numer of users that can login before machine is 'overloaded'
 ENTER NEW VALUE (integer value, 0 means there is no limit):  ENTER NEW VALUE (integer value, 0 means there is no limit):
 END  END
Line 709  END Line 854  END
     chomp($choice2);      chomp($choice2);
     $perlvar{'lonUserLoadLim'}=$choice2;      $perlvar{'lonUserLoadLim'}=$choice2;
   }    }
   elsif ($choice==10) {    elsif ($choice==11) {
   print(&lt;&lt;END);    print(&lt;&lt;END);
 10) Allow only secure connections: $securestatus   11) Allow only secure connections: $securestatus 
 The Lon-CAPA communication daemons lonc and lond can be configured to  The Lon-CAPA communication daemons lonc and lond can be configured to
 allow only secure connections by default.  allow only secure connections by default.
   
Line 738  END Line 883  END
     }      }
     ($securestatus,$securenum)=&securesetting(%perlvar);      ($securestatus,$securenum)=&securesetting(%perlvar);
   }    }
   elsif (($choice==11) && (!$error)) {    elsif (($choice==12) && (!$error)) {
     $flag=1;      $flag=1;
   }    }
   else {    else {
Line 769  unless (-l "<TARGET />") { Line 914  unless (-l "<TARGET />") {
   $line2insert=&lt;&lt;END;    $line2insert=&lt;&lt;END;
 $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname  $perlvar{'lonHostID'}:$perlvar{'lonDefDomain'}:$perlvar{'lonRole'}:$hostname
 END  END
   $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras\n";    $domaininsert="$perlvar{'lonDefDomain'}:$domainDescription:$domainTabExtras:$primaryLibServer\n";
   if ($lonCluster eq 'standalone') {    if ($lonCluster eq 'standalone') {
     open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or      open(OUT,'&gt;../'.$lonCluster.'_hosts.tab') or
       die('file generation error');        die('file generation error');

Removed from v.1.42  
changed lines
  Added in v.1.43


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