[LON-CAPA-cvs] cvs: doc /loncapafiles updatequery.piml

albertel lon-capa-cvs-allow@mail.lon-capa.org
Fri, 20 Apr 2007 18:14:27 -0000


albertel		Fri Apr 20 14:14:27 2007 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - error messages could run together
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.53 doc/loncapafiles/updatequery.piml:1.54
--- doc/loncapafiles/updatequery.piml:1.53	Fri Apr 20 14:08:57 2007
+++ doc/loncapafiles/updatequery.piml	Fri Apr 20 14:14:26 2007
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.53 2007/04/20 18:08:57 albertel Exp $ -->
+<!-- $Id: updatequery.piml,v 1.54 2007/04/20 18:14:26 albertel Exp $ -->
 
 <!--
 
@@ -47,7 +47,7 @@
 *********************************************
 
 END
-sleep(3);
+#sleep(3);
 </perlscript>
 </file>
 <file>
@@ -705,58 +705,58 @@
 12) Everything is correct up above
 END
 
-my $error='';
+my @error;
 foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
    if (length($v)>35) { $error.="\nName $v too long"; }		
    if (length($v)<2) { $error.="\nName $v too short"; }
    if ($v=~/capa/i) {
 	if ($v!~/^oucapa\d+$/ && 
 	    ($v!~/^capa\d+$/ && $perlvar{'lonDefDomain'} eq 'uwsp')) {
-		 $error.="\nName $v contains 'capa'"; 
+		 push(@error,"Name $v contains 'capa'");
 	}
    }
    foreach my $bad ('res','raw','userfiles','priv','adm','uploaded',
 	'editupload') {
-      $error.="\nName $v reserved." if $v eq $bad;
+      push(@error,"\nName $v reserved.") if $v eq $bad;
    }
-   if ($v=~/[^\w\-.]/) { $error.="\nName $v contains special characters"; }
+   if ($v=~/[^\w\-.]/) { push(@error,"Name $v contains special characters"); }
 }
 if ($domainDescription =~ /^\s*$/) {
-   $error.="\nDomain Description is blank.";
+   push(@error,"Domain Description is blank.");
 } elsif ($domainDescription!~/^[\(\)\-\w\s,]+$/) {
-   $error.="\nDomain Description contains special characters.";
+   push(@error,"Domain Description contains special characters.");
 } 
 foreach my $v ($perlvar{'lonExpire'},$perlvar{'lonLoadLim'}) {
-   unless ($v=~/^[\d+\.]+$/) { $error.="\nNumber expected instead of $v"; }
+   unless ($v=~/^[\d+\.]+$/) { push(@error,"Number expected instead of $v"); }
 }
 unless (($perlvar{'lonRole'} eq 'library') || ($perlvar{'lonRole'} eq 'access')) {
-   $error.="\nInvalid Role";
+   push(@error,"Invalid Role");
 }
 
 if (!defined($primaryLibServer)) {
    if (@libservers > 0) {
-       $error .= "No primary library server ID designated. Choose from: ".join(',',sort(@libservers));
+       push(@error,"No primary library server ID designated. Choose from: ".join(',',sort(@libservers)));
    } else {
-       $error .= "No library servers in this domain (including current server)";
+       push(@error,"No library servers in this domain (including current server)");
    }
 } else {
-   if (length($primaryLibServer)>35) { $error.="\nPrimary Library Server ID:  $primaryLibServer too long"; }
-   if (length($primaryLibServer)<2) { $error.="\nPrimary Library Server ID:  $primaryLibServer too short"; }
+   if (length($primaryLibServer)>35) { push(@error,"Primary Library Server ID:  $primaryLibServer too long"); }
+   if (length($primaryLibServer)<2) { push(@error,"Primary 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'";
+                 push(@error,"Primary 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;
+      push(@error,"Primary library server ID $primaryLibServer reserved.") if $primaryLibServer eq $bad;
    }
-   if ($primaryLibServer=~/[^\w\-.]/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; }
+   if ($primaryLibServer=~/[^\w\-.]/) { push(@error,"Primary library server ID $primaryLibServer contains special characters"); }
 }
 
 
-if ($error) { print "\n*** ERRORS: $error\n"; }
+if (@error) { print "\n*** ERRORS: \n\t".join("\n\t",@error)."\n"; }
   print(&lt;&lt;END);
 ENTER A CHOICE OF 1-11 TO CHANGE, otherwise ENTER 12:
 END