[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Tue, 09 Nov 2010 14:14:56 -0000


raeburn		Tue Nov  9 14:14:56 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	lonuserutils.pm 
  Log:
  - Customization for GCI_3.
    - Backport 1.130.
    - Renumbering for reverse association js as initial password now second in 
       option list.
    - Scope issue for $user.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.109.2.7 loncom/interface/lonuserutils.pm:1.109.2.8
--- loncom/interface/lonuserutils.pm:1.109.2.7	Mon Nov  8 21:11:14 2010
+++ loncom/interface/lonuserutils.pm	Tue Nov  9 14:14:55 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.109.2.7 2010/11/08 21:11:14 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.109.2.8 2010/11/09 14:14:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -566,6 +566,7 @@
         if (message!='') {
             message+='\\n';
         }
+        message+='$alert{'section'}';
     }
     if (foundemail==0) {
         if (message!='') {
@@ -668,10 +669,10 @@
     for (i=0;i<=vf.nfields.value;i++) {
         tw=eval('vf.f'+i+'.selectedIndex');
         if (tw==1) { founduname=1; }
-        if ((tw>=2) && (tw<=6)) { foundname=1; }
-        if (tw==7) { foundid=1; }
-        if (tw==8) { foundsec=1; }
-        if (tw==9) { foundpwd=1; }
+        if (tw==2) { foundpwd=1; }
+        if ((tw>=3) && (tw<=7)) { foundname=1; }
+        if (tw==8) { foundid=1; }
+        if (tw==9) { foundsec=1; }
         if (tw==10) { foundemail=1; }
         if (tw==11) { foundrole=1; }
         if (tw==12) { founddomain=1; }
@@ -777,6 +778,7 @@
     var foundname=0;
     var foundid=0;
     var foundsec=0;
+    var foundemail=0;
     var foundrole=0;
     var founddomain=0;
     var foundinststatus=0;
@@ -784,38 +786,39 @@
     for (i=0;i<=vf.nfields.value;i++) {
         tw=eval('vf.f'+i+'.selectedIndex');
         if (i==0 && tw!=0) { founduname=1; }
-        if (((i>=1) && (i<=5)) && tw!=0 ) { foundname=1; }
-        if (i==6 && tw!=0) { foundid=1; }
-        if (i==7 && tw!=0) { foundsec=1; }
-        if (i==8 && tw!=0) { foundpwd=1; }
-        if (i==9 && tw!=0) { foundrole=1; }
-        if (i==10 && tw!=0) { founddomain=1; }
-        if (i==13 && tw!=0) { foundinstatus=1; }
+        if (i==1 && tw!=0) { foundpwd=1; }
+        if (((i>=2) && (i<=6)) && tw!=0 ) { foundname=1; }
+        if (i==7 && tw!=0) { foundid=1; }
+        if (i==8 && tw!=0) { foundsec=1; }
+        if (i==9 && tw!=0) { foundemail=1; }
+        if (i==10 && tw!=0) { foundrole=1; }
+        if (i==11 && tw!=0) { founddomain=1; }
+        if (i==12 && tw!=0) { foundinstatus=1; }
     }
-    verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundrole,founddomain,foundinststatus);
+    verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail,foundrole,founddomain,foundinststatus);
 }
 
 function flip(vf,tf) {
    var nw=eval('vf.f'+tf+'.selectedIndex');
    var i;
    // picked the all one name field, reset the other name ones to blank
-   if (tf==1 && nw!=0) {
-      for (i=2;i<=5;i++) {
+   if (tf==2 && nw!=0) {
+      for (i=3;i<=6;i++) {
          eval('vf.f'+i+'.selectedIndex=0;')
       }
    }
    //picked one of the piecewise name fields, reset the all in
    //one field to blank
-   if ((tf>=2) && (tf<=5) && (nw!=0)) {
-      eval('vf.f1.selectedIndex=0;')
+   if ((tf>=3) && (tf<=6) && (nw!=0)) {
+      eval('vf.f2.selectedIndex=0;')
    }
    $auth_update
 }
 
 function clearpwd(vf) {
     var i;
-    if (eval('vf.f8.selectedIndex')!=0) {
-        eval('vf.f8.selectedIndex=0;')
+    if (eval('vf.f1.selectedIndex')!=0) {
+        eval('vf.f1.selectedIndex=0;')
     }
 }
 ENDPICK
@@ -4310,7 +4313,6 @@
                         }
                         $checkid = 1;
                         $newuser = 1;
-                        my $user = $username.':'.$domain;
                         if ($username =~/^[^\@]+\@[^\@]+$/) {
                             if ($email eq '') {
                                 $email = $username;
@@ -4334,6 +4336,7 @@
                             }
                         }
                     }
+                    my $user = $username.':'.$userdomain;
                     if ($newuser) {
                         my $checkhash;
                         my $checks = { 'username' => 1 };