[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 09 Dec 2004 23:46:02 -0000


albertel		Thu Dec  9 18:46:02 2004 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - BUG#3704, also whichuser will now will better if a user is trying to force through a course/symb/user/daom cahnge,
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.349 loncom/xml/lonxml.pm:1.350
--- loncom/xml/lonxml.pm:1.349	Fri Dec  3 17:14:22 2004
+++ loncom/xml/lonxml.pm	Thu Dec  9 18:45:59 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.349 2004/12/03 22:14:22 albertel Exp $
+# $Id: lonxml.pm,v 1.350 2004/12/09 23:45:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1596,35 +1596,36 @@
   my ($passedsymb)=@_;
   my ($symb,$courseid,$domain,$name,$publicuser);
   if (defined($ENV{'form.grade_symb'})) {
-    my $tmp_courseid=$ENV{'form.grade_courseid'};
-    my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
-    if (!$allowed && 
-	exists($ENV{'request.course.sec'}) && 
-	$ENV{'request.course.sec'} !~ /^\s*$/) {
-	$allowed=&Apache::lonnet::allowed('vgr',$ENV{'form.grade_courseid'}.
-					  '/'.$ENV{'request.course.sec'});
-    }
-    if ($allowed) {
-      $symb=$ENV{'form.grade_symb'};
-      $courseid=$ENV{'form.grade_courseid'};
-      $domain=$ENV{'form.grade_domain'};
-      $name=$ENV{'form.grade_username'};
-    }
-  } else {
-      if (!$passedsymb) {
-          $symb=&Apache::lonnet::symbread();
-      } else {
-          $symb=$passedsymb;
+      my ($tmp_courseid)=
+	  &Apache::loncommon::get_env_multiple('form.grade_courseid');
+      my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
+      if (!$allowed && 
+	  exists($ENV{'request.course.sec'}) && 
+	  $ENV{'request.course.sec'} !~ /^\s*$/) {
+	  $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid.
+					    '/'.$ENV{'request.course.sec'});
       }
-      $courseid=$ENV{'request.course.id'};
-      $domain=$ENV{'user.domain'};
-      $name=$ENV{'user.name'};
-      if ($name eq 'public' && $domain eq 'public') {
-	  if (!defined($ENV{'form.username'})) {
-	      $ENV{'form.username'}.=time.rand(10000000);
-	  }
-	  $name.=$ENV{'form.username'};
+      if ($allowed) {
+	  ($symb)=&Apache::loncommon::get_env_multiple('form.grade_symb');
+	  $courseid=$tmp_courseid;
+	  ($domain)=&Apache::loncommon::get_env_multiple('form.grade_domain');
+	  ($name)=&Apache::loncommon::get_env_multiple('form.grade_username');
+	  return ($symb,$courseid,$domain,$name,$publicuser);
+      }
+  }
+  if (!$passedsymb) {
+      $symb=&Apache::lonnet::symbread();
+  } else {
+      $symb=$passedsymb;
+  }
+  $courseid=$ENV{'request.course.id'};
+  $domain=$ENV{'user.domain'};
+  $name=$ENV{'user.name'};
+  if ($name eq 'public' && $domain eq 'public') {
+      if (!defined($ENV{'form.username'})) {
+	  $ENV{'form.username'}.=time.rand(10000000);
       }
+      $name.=$ENV{'form.username'};
   }
   return ($symb,$courseid,$domain,$name,$publicuser);
 }