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

albertel lon-capa-cvs@mail.lon-capa.org
Sun, 10 Dec 2006 23:38:35 -0000


albertel		Sun Dec 10 18:38:35 2006 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - allowing - an . into domian/hostids
  - allwoign much longer domains
  
  
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.50 doc/loncapafiles/updatequery.piml:1.51
--- doc/loncapafiles/updatequery.piml:1.50	Thu Sep 28 18:52:43 2006
+++ doc/loncapafiles/updatequery.piml	Sun Dec 10 18:38:35 2006
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.50 2006/09/28 22:52:43 raeburn Exp $ -->
+<!-- $Id: updatequery.piml,v 1.51 2006/12/10 23:38:35 albertel Exp $ -->
 
 <!--
 
@@ -260,14 +260,14 @@
     close(OUT);
     $lonDefDomain=$choice;
     $flag=1;
-  } elsif (length($choice)>12) {
+  } elsif (length($choice)>35) {
     print "Name too long\n";
   } elsif (length($choice)<2) {
     print "Name too short\n";
   } elsif ($bad_domain_flag) {
     print "Invalid input ('$choice' conflicts with LON-CAPA namespace).\n";
     print "Please try something different than '$choice'\n";
-  } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
+  } elsif ($choice!~/\_/ and $choice=~/^[\w\-.]+$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonDefDomain'."\t".$choice."\n");
     close(OUT);
@@ -275,7 +275,7 @@
     $r='l';
     $flag=1;
   } else {
-    print "Invalid input (only alphanumeric characters supported).\n";
+    print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
   }
 }
 
@@ -348,18 +348,18 @@
     close(OUT);
     $lonHostID=$choice;
     $flag=1;
-  } elsif (length($choice)>15) {
+  } elsif (length($choice)>45) {
     print "Name too long\n";
   } elsif (length($choice)<4) {
     print "Name too short\n";
-  } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
+  } elsif ($choice!~/\_/ and $choice=~/^[\w\-.]+$/) {
     open(OUT,'&gt;&gt;/tmp/loncapa_updatequery.out');
     print(OUT 'lonHostID'."\t".$choice."\n");
     close(OUT);
     $lonHostID=$choice;
     $flag=1;
   } else {
-    print "Invalid input (only alphanumeric characters supported).\n";
+    print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
   }
 }
 
@@ -404,18 +404,18 @@
         print(OUT 'primaryLibServer'."\t".$choice."\n");
         close(OUT);
         $flag=1;
-    } elsif (length($choice)>15) {
+    } elsif (length($choice)>35) {
         print "Name too long\n";
     } elsif (length($choice)<4) {
         print "Name too short\n";
-    } elsif ($choice!~/\_/ and $choice=~/^\w+$/) {
+    } 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";
+        print "Invalid input (only alphanumeric characters, '-', and '.' supported).\n";
     }
 }
 
@@ -713,7 +713,7 @@
 
 my $error='';
 foreach my $v ($perlvar{'lonDefDomain'},$perlvar{'lonHostID'}) {
-   if (length($v)>16) { $error.="\nName $v too long"; }		
+   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+$/ && 
@@ -725,7 +725,7 @@
 	'editupload') {
       $error.="\nName $v reserved." if $v eq $bad;
    }
-   if ($v=~/\W/) { $error.="\nName $v contains special characters"; }
+   if ($v=~/[^\w\-.]/) { $error.="\nName $v contains special characters"; }
 }
 if ($domainDescription!~/^[\(\)\-\w\s,]+$/) {
    $error.="\nDomain Description contains special characters";
@@ -744,7 +744,7 @@
        $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)>35) { $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+$/ &&
@@ -756,7 +756,7 @@
         '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 ($primaryLibServer=~/[^\w\-.]/) { $error.="\nPrimary library server ID $primaryLibServer contains special characters"; }
 }
 
 
@@ -928,7 +928,7 @@
   my $hostname=`hostname -f`;chomp($hostname);
   $date=`date -I`; chomp($date);
   $lonHostID=$perlvar{'lonHostID'};
-  $lonHostID=~s/\W//g;
+  $lonHostID=~s/[^\w\-.]//g;
   $lineexistflag=0;
   $hostidexistflag=0;
   $line2insert=&lt;&lt;END;