[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm londropadd.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 11 Jan 2005 22:12:23 -0000


albertel		Tue Jan 11 17:12:23 2005 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm londropadd.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - fixes so that usenrames with _ work again
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.97 loncom/interface/loncreateuser.pm:1.98
--- loncom/interface/loncreateuser.pm:1.97	Tue Jan 11 17:08:08 2005
+++ loncom/interface/loncreateuser.pm	Tue Jan 11 17:12:22 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.97 2005/01/11 22:08:08 albertel Exp $
+# $Id: loncreateuser.pm,v 1.98 2005/01/11 22:12:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -173,8 +173,8 @@
     my $ccuname=$ENV{'form.ccuname'};
     my $ccdomain=$ENV{'form.ccdomain'};
 
-    $ccuname=~s/[\W|_]//gs;
-    $ccdomain=~s/[\W|_]//gs;
+    $ccuname=~s/\W//g;
+    $ccdomain=~s/\W//g;
 
     unless (($ccuname) && ($ccdomain)) {
 	&print_username_entry_form($r);
@@ -1176,7 +1176,7 @@
 		        $r->print(&commit_customrole($securl,$three,$four,$five,$start,$end));
                     }
                 }
-	    } elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) {
+	    } elsif ($_=~/^form\.act\_([^\_]+)\_(\w+)\_([^\_]+)$/) {
 		# Activate roles for sections with 3 id numbers
 		# set start, end times, and the url for the class
 		my ($one,$two,$three)=($1,$2,$3);
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.122 loncom/interface/londropadd.pm:1.123
--- loncom/interface/londropadd.pm:1.122	Thu Dec  2 14:00:38 2004
+++ loncom/interface/londropadd.pm	Tue Jan 11 17:12:22 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.122 2004/12/02 19:00:38 matthew Exp $
+# $Id: londropadd.pm,v 1.123 2005/01/11 22:12:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -937,8 +937,8 @@
     #
     my $username = $ENV{'form.cuname'};
     my $domain   = $ENV{'form.cudomain'};
-    $username=~s/[\W|_]//gs;
-    $domain=~s/[\W|_]//gs;
+    $username=~s/\W//gs;
+    $domain=~s/\W//gs;
     my $home = &Apache::lonnet::homeserver($username,$domain);
     # $new_user flags whether we are creating a new user or using an old one
     my $new_user = 1;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.586 loncom/lonnet/perl/lonnet.pm:1.587
--- loncom/lonnet/perl/lonnet.pm:1.586	Tue Jan 11 16:43:33 2005
+++ loncom/lonnet/perl/lonnet.pm	Tue Jan 11 17:12:22 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.586 2005/01/11 21:43:33 albertel Exp $
+# $Id: lonnet.pm,v 1.587 2005/01/11 22:12:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2410,8 +2410,15 @@
         foreach (split(/&/,$rolesdump)) {
 	  if ($_!~/^rolesdef_/) {
             my ($area,$role)=split(/=/,$_);
-            $area=~s/\_\w\w$//;
-            my ($trole,$tend,$tstart)=split(/_/,$role);
+	    $area=~s/\_\w\w$//;
+	    
+            my ($trole,$tend,$tstart);
+	    if ($role=~/^cr/) { 
+		($trole,my $trest)=($role=~m|^(cr/\w+/\w+/[a-zA-Z0-9]+)_(.*)$|);
+		($tend,$tstart)=split('_',$trest);
+	    } else {
+		($trole,$tend,$tstart)=split(/_/,$role);
+	    }
             $userroles.=&set_arearole($trole,$area,$tstart,$tend,$domain,$username);
             if (($tend!=0) && ($tend<$now)) { $trole=''; }
             if (($tstart!=0) && ($tstart>$now)) { $trole=''; }