[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface loncreateuser.pm

raeburn raeburn@source.lon-capa.org
Tue, 23 Mar 2010 16:44:46 -0000


This is a MIME encoded message

--raeburn1269362686
Content-Type: text/plain

raeburn		Tue Mar 23 16:44:46 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	loncreateuser.pm 
  Log:
  - Backport 1.334, 1.335, 1.336, 1.337.
  - Avoid &mt(&mt()) on $contextrole. 
  
  
--raeburn1269362686
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100323164446.txt"

Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.295.2.30 loncom/interface/loncreateuser.pm:1.295.2.31
--- loncom/interface/loncreateuser.pm:1.295.2.30	Fri Mar 19 21:59:53 2010
+++ loncom/interface/loncreateuser.pm	Tue Mar 23 16:44:46 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.295.2.30 2010/03/19 21:59:53 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.295.2.31 2010/03/23 16:44:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -531,7 +531,6 @@
     my %lt=&Apache::lonlocal::texthash(
                     'srst' => 'Search for a user and enroll as a student',
                     'srme' => 'Search for a user and enroll as a member',
-
                     'srad' => 'Search for a user and modify/add user information or roles',
 		    'usr'  => "Username",
                     'dom'  => "Domain",
@@ -946,7 +945,7 @@
             );
             my $response;
             if ($env{'form.origform'} eq 'crtusername') {
-                $response =  '<span class="LC_warning">'.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).
+                $response =  '<span class="LC_warning">'.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]','<b>'.$ccuname.'</b>',$ccdomain).
                             '</span><br />';
             }
             $response .= '<p class="LC_warning">'
@@ -1502,7 +1501,6 @@
                     '<br />'.&mt('Domain').': '.$coursedom.('&nbsp;'x8).
      &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
                 $sortkey.="\0".$coursedata{'description'};
-                $class=$coursedata{'type'};
             } else {
                 if ($class eq 'Community') {
                     $carea=&mt('Unavailable community').': '.$area;
@@ -1629,6 +1627,7 @@
         $roleclass{$envkey}=$class;
         $rolepriv{$envkey}=$allowed;
     } # end of foreach        (table building loop)
+
     my $rolesdisplay = 0;
     my %output = ();
     foreach my $type ('Construction Space','Course','Community','Domain','System','Unknown') {
@@ -1657,13 +1656,13 @@
                 $contextrole = &mt('Existing Roles in this Course');
             }
         } elsif ($env{'request.role'} =~ /^au\./) {
-            $contextrole = 'Existing Co-Author Roles in your Construction Space';
+            $contextrole = &mt('Existing Co-Author Roles in your Construction Space');
         } else {
-            $contextrole = 'Existing Roles in this Domain';
+            $contextrole = &mt('Existing Roles in this Domain');
         }
         $r->print('
 <h3>'.$lt{'rer'}.'</h3>'.
-'<div>'.&mt($contextrole).'</div>'.
+'<div>'.$contextrole.'</div>'.
 &Apache::loncommon::start_data_table("LC_createuser").
 &Apache::loncommon::start_data_table_header_row().
 '<th>'.$lt{'rev'}.'</th><th>'.$lt{'ren'}.'</th><th>'.$lt{'del'}.
@@ -2066,9 +2065,22 @@
                 if ($canmodify_status{'inststatus'}) {
                     $shown = &pick_inst_statuses($userenv{'inststatus'},$usertypes,$types);
                 } else {
-                    $shown .= $userenv{'inststatus'};
                     if ($userenv{'inststatus'} eq '') {
                         $hiderow = 1;
+                    } else {
+                        my @showitems;
+                        foreach my $item ( map { &unescape($_); } split(':',$userenv{'inststatus'})) {
+                            if (exists($usertypes->{$item})) {
+                                push(@showitems,$usertypes->{$item});
+                            } else {
+                                push(@showitems,$item);
+                            }
+                        }
+                        if (@showitems) {
+                            $shown = join(', ',@showitems);
+                        } else {
+                            $hiderow = 1;
+                        }
                     }
                 }
                 if (!$hiderow) {
@@ -2286,10 +2298,14 @@
     $r->print('<h3>'.&mt('User [_1] in domain [_2]',
 			 $env{'form.ccuname'}, $env{'form.ccdomain'}).'</h3>');
     my (%alerts,%rulematch,%inst_results,%curr_rules);
+    my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
     my @usertools = ('aboutme','blog','portfolio');
-    my @requestcourses = ('official','unofficial');
+    my @requestcourses = ('official','unofficial','community');
     my ($othertitle,$usertypes,$types) = 
         &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
+    my %canmodify_status =
+        &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},
+                                                   ['inststatus']);
     if ($env{'form.makeuser'}) {
 	$r->print('<h3>'.&mt('Creating new account.').'</h3>');
         # Check for the authentication mode and password
@@ -2349,49 +2365,50 @@
 	$r->print(&mt('Generating user').': '.$result);
         $uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
                                                $env{'form.ccdomain'});
-        my (%changeHash,%newcustom,%changed);
+        my (%changeHash,%newcustom,%changed,%changedinfo);
         if ($uhome ne 'no_host') {
-            if ($env{'form.customquota'} == 1) {
-                if ($env{'form.portfolioquota'} eq '') {
-                    $newcustom{'quota'} = 0;
-                } else {
-                    $newcustom{'quota'} = $env{'form.portfolioquota'};
-                    $newcustom{'quota'} =~ s/[^\d\.]//g;
-                }
-                $changed{'quota'} = &quota_admin($newcustom{'quota'},\%changeHash);
-            }
-            foreach my $item (@usertools) {
-                if ($env{'form.custom'.$item} == 1) {
-                    $newcustom{$item} = $env{'form.tools_'.$item};
-                    $changed{$item} = &tool_admin($item,$newcustom{$item},
-                                                 \%changeHash,'tools');
+            if ($context eq 'domain') {
+                if ($env{'form.customquota'} == 1) {
+                    if ($env{'form.portfolioquota'} eq '') {
+                        $newcustom{'quota'} = 0;
+                    } else {
+                        $newcustom{'quota'} = $env{'form.portfolioquota'};
+                        $newcustom{'quota'} =~ s/[^\d\.]//g;
+                    }
+                    $changed{'quota'} = &quota_admin($newcustom{'quota'},\%changeHash);
                 }
-            }
-            foreach my $item (@requestcourses) {
-                $newcustom{$item} = $env{'form.crsreq_'.$item};
-                if ($env{'form.crsreq_'.$item} eq 'autolimit') {
-                    $newcustom{$item} .= '=';
-                    unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
-                        $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
+                foreach my $item (@usertools) {
+                    if ($env{'form.custom'.$item} == 1) {
+                        $newcustom{$item} = $env{'form.tools_'.$item};
+                        $changed{$item} = &tool_admin($item,$newcustom{$item},
+                                                      \%changeHash,'tools');
                     }
                 }
-                $changed{$item} = &tool_admin($item,$newcustom{$item},
+                foreach my $item (@requestcourses) {
+                    $newcustom{$item} = $env{'form.crsreq_'.$item};
+                    if ($env{'form.crsreq_'.$item} eq 'autolimit') {
+                        $newcustom{$item} .= '=';
+                        unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
+                            $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
+                        }
+                    }
+                    $changed{$item} = &tool_admin($item,$newcustom{$item},
                                               \%changeHash,'requestcourses');
+                }
             }
-            if (exists($env{'form.inststatus'})) {
-                my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
-                if (@inststatuses > 0) {
-                    $changeHash{'inststatus'} = join(',',@inststatuses);
-                    $changed{'inststatus'} = $changeHash{'inststatus'};
+            if ($canmodify_status{'inststatus'}) {
+                if (exists($env{'form.inststatus'})) {
+                    my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
+                    if (@inststatuses > 0) {
+                        $changeHash{'inststatus'} = join(',',@inststatuses);
+                        $changed{'inststatus'} = $changeHash{'inststatus'};
+                    }
                 }
             }
             if (keys(%changed)) {
-                $changeHash{'firstname'}  = $env{'form.cfirstname'};
-                $changeHash{'middlename'} = $env{'form.cmiddlename'};
-                $changeHash{'lastname'}   = $env{'form.clastname'};
-                $changeHash{'generation'} = $env{'form.cgeneration'};
-                $changeHash{'id'}         = $env{'form.cid'};
-                $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
+                foreach my $item (@userinfo) {
+                    $changeHash{$item}  = $env{'form.c'.$item};
+                }
                 my $chgresult =
                      &Apache::lonnet::put('environment',\%changeHash,
                                           $env{'form.ccdomain'},$env{'form.ccuname'});
@@ -2420,7 +2437,7 @@
 	}
     }
     ##
-    my (@userroles,%userupdate,$cnum,$cdom,$crstype,$namechanged);
+    my (@userroles,%userupdate,$cnum,$cdom,$crstype,%namechanged);
     if ($context eq 'course') {
         ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
         $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
@@ -2510,7 +2527,6 @@
                 push(@longroles,&Apache::lonnet::plaintext($role,$crstype)); 
             }
         }
-        my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
         my %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},\@userinfo,\@userroles);
         foreach my $item (@userinfo) {
             # Strip leading and trailing whitespace
@@ -2557,40 +2573,46 @@
             }
         }
         my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
-            $inststatus,$newinststatus,$oldisdefault,$newisdefault,$olddefquotatext,
-            $newdefquotatext,%oldaccess,%oldaccesstext,%newaccess,%newaccesstext,
-            $oldinststatuses,$newinststatuses);
-        my ($defquota,$settingstatus) = 
-            &Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus);
-        my ($showquota,$showtools,$showrequestcourses,$showinststatus,$showreqotherdom);
+            $newinststatus,$oldisdefault,$newisdefault,%oldsettings,
+            %oldsettingstext,%newsettings,%newsettingstext,@disporder);
+        @disporder = ('inststatus');
+        if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
+            push(@disporder,'requestcourses');
+        } else {
+            push(@disporder,'reqcrsotherdom');
+        }
+        push(@disporder,('quota','tools'));
+        my ($defquota,$settingstatus) =
+            &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus);
+        my %canshow;
         if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
-            $showquota = 1;
+            $canshow{'quota'} = 1;
         }
         if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
-            $showtools = 1;
+            $canshow{'tools'} = 1;
         }
         if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {
-            $showrequestcourses = 1;
+            $canshow{'requestcourses'} = 1;
         } elsif (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
-            $showreqotherdom = 1;
+            $canshow{'reqcrsotherdom'} = 1;
         }
         if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {
-            $showinststatus = 1;
+            $canshow{'inststatus'} = 1;
         }
         my (%changeHash,%changed);
         $oldinststatus = $userenv{'inststatus'};
         if ($oldinststatus eq '') {
-            $oldinststatuses = $othertitle; 
+            $oldsettings{'inststatus'} = $othertitle;
         } else {
             if (ref($usertypes) eq 'HASH') {
-                $oldinststatuses = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
+                $oldsettings{'inststatus'} = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
             } else {
-                $oldinststatuses = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
+                $oldsettings{'inststatus'} = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
             }
         }
         $changeHash{'inststatus'} = $userenv{'inststatus'};
-        my %canmodify_inststatus = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},['inststatus'],\@userroles);
-        if ($canmodify_inststatus{'inststatus'}) {
+        if ($canmodify_status{'inststatus'}) {
+            $canshow{'inststatus'} = 1;
             if (exists($env{'form.inststatus'})) {
                 my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
                 if (@inststatuses > 0) {
@@ -2600,84 +2622,82 @@
                         $changed{'inststatus'} = $newinststatus;
                     }
                     if (ref($usertypes) eq 'HASH') {
-                        $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); 
+                        $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
                     } else {
-                        $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
-                    }
-                } else {
-                    $newinststatus = '';
-                    $changeHash{'inststatus'} = $newinststatus;
-                    $newinststatuses = $othertitle;
-                    if ($newinststatus ne $oldinststatus) {
-                        $changed{'inststatus'} = $changeHash{'inststatus'};
+                        $newsettings{'inststatus'} = join(', ',@inststatuses);
                     }
                 }
+            } else {
+                $newinststatus = '';
+                $changeHash{'inststatus'} = $newinststatus;
+                $newsettings{'inststatus'} = $othertitle;
+                if ($newinststatus ne $oldinststatus) {
+                    $changed{'inststatus'} = $changeHash{'inststatus'};
+                }
             }
+        } elsif ($context ne 'selfcreate') {
+            $canshow{'inststatus'} = 1;
+            $newsettings{'inststatus'} = $oldsettings{'inststatus'};
         }
         $changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
-        if ($userenv{'portfolioquota'} ne '') {
-            $oldportfolioquota = $userenv{'portfolioquota'};
-            if ($env{'form.customquota'} == 1) {
-                if ($env{'form.portfolioquota'} eq '') {
-                    $newportfolioquota = 0;
+        if ($context eq 'domain') {
+            if ($userenv{'portfolioquota'} ne '') {
+                $oldportfolioquota = $userenv{'portfolioquota'};
+                if ($env{'form.customquota'} == 1) {
+                    if ($env{'form.portfolioquota'} eq '') {
+                        $newportfolioquota = 0;
+                    } else {
+                        $newportfolioquota = $env{'form.portfolioquota'};
+                        $newportfolioquota =~ s/[^\d\.]//g;
+                    }
+                    if ($newportfolioquota != $oldportfolioquota) {
+                        $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
+                    }
                 } else {
-                    $newportfolioquota = $env{'form.portfolioquota'};
-                    $newportfolioquota =~ s/[^\d\.]//g;
-                }
-                if ($newportfolioquota != $oldportfolioquota) {
-                    $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
+                    $changed{'quota'} = &quota_admin('',\%changeHash);
+                    $newportfolioquota = $defquota;
+                    $newisdefault = 1;
                 }
             } else {
-                $changed{'quota'} = &quota_admin('',\%changeHash);
-                $newportfolioquota = $defquota;
-                $newisdefault = 1;
-            }
-        } else {
-            $oldisdefault = 1;
-            $oldportfolioquota = $defquota;
-            if ($env{'form.customquota'} == 1) {
-                if ($env{'form.portfolioquota'} eq '') {
-                    $newportfolioquota = 0;
+                $oldisdefault = 1;
+                $oldportfolioquota = $defquota;
+                if ($env{'form.customquota'} == 1) {
+                    if ($env{'form.portfolioquota'} eq '') {
+                        $newportfolioquota = 0;
+                    } else {
+                        $newportfolioquota = $env{'form.portfolioquota'};
+                        $newportfolioquota =~ s/[^\d\.]//g;
+                    }
+                    $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
                 } else {
-                    $newportfolioquota = $env{'form.portfolioquota'};
-                    $newportfolioquota =~ s/[^\d\.]//g;
+                    $newportfolioquota = $defquota;
+                    $newisdefault = 1;
                 }
-                $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
+            }
+            if ($oldisdefault) {
+                $oldsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+            }
+            if ($newisdefault) {
+                $newsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+            }
+            &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,
+                          \%changeHash,\%changed,\%newsettings,\%newsettingstext);
+            if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
+                &tool_changes('requestcourses',\@requestcourses,\%oldsettings,\%oldsettingstext,
+                              \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
             } else {
-                $newportfolioquota = $defquota;
-                $newisdefault = 1;
+                &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,
+                              \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
+            }
+        }
+        foreach my $item (@userinfo) {
+            if ($env{'form.c'.$item} ne $userenv{$item}) {
+                $namechanged{$item} = 1;
             }
         }
-        if ($oldisdefault) {
-            $olddefquotatext = &get_defaultquota_text($settingstatus);
-        }
-        if ($newisdefault) {
-            $newdefquotatext = &get_defaultquota_text($settingstatus);
-        }
-        &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,
-                      \%changeHash,\%changed,\%newaccess,\%newaccesstext);
-        if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
-            &tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext,
-                          \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
-        } else {
-            &tool_changes('reqcrsotherdom',\@requestcourses,\%oldaccess,\%oldaccesstext,
-                          \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
-        }
-        if ($env{'form.cfirstname'}  ne $userenv{'firstname'}  ||
-            $env{'form.cmiddlename'} ne $userenv{'middlename'} ||
-            $env{'form.clastname'}   ne $userenv{'lastname'}   ||
-            $env{'form.cgeneration'} ne $userenv{'generation'} ||
-            $env{'form.cid'} ne $userenv{'id'}                 ||
-            $env{'form.cpermanentemail'} ne $userenv{'permanentemail'} ) {
-            $namechanged = 1;
-        }
-        if (($namechanged) || (keys(%changed) > 0)) {
-            $changeHash{'firstname'}  = $env{'form.cfirstname'};
-            $changeHash{'middlename'} = $env{'form.cmiddlename'};
-            $changeHash{'lastname'}   = $env{'form.clastname'};
-            $changeHash{'generation'} = $env{'form.cgeneration'};
-            $changeHash{'id'}         = $env{'form.cid'};
-            $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
+        $oldsettings{'quota'} = $oldportfolioquota.' Mb';
+        $newsettings{'quota'} = $newportfolioquota.' Mb';
+        if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
             my ($chgresult,$namechgresult);
             if (keys(%changed) > 0) {
                 $chgresult = 
@@ -2717,14 +2737,17 @@
                     }
                 }
             }
-            if ($namechanged) {
-            # Make the change
+            if (keys(%namechanged) > 0) {
+                foreach my $field (@userinfo) {
+                    $changeHash{$field}  = $env{'form.c'.$field};
+                }
+# Make the change
                 $namechgresult =
                     &Apache::lonnet::modifyuser($env{'form.ccdomain'},
                         $env{'form.ccuname'},$changeHash{'id'},undef,undef,
                         $changeHash{'firstname'},$changeHash{'middlename'},
                         $changeHash{'lastname'},$changeHash{'generation'},
-                        $changeHash{'id'},undef,$changeHash{'permanentemail'});
+                        $changeHash{'id'},undef,$changeHash{'permanentemail'},undef,\@userinfo);
                 %userupdate = (
                                lastname   => $env{'form.clastname'},
                                middlename => $env{'form.cmiddlename'},
@@ -2733,139 +2756,14 @@
                                id         => $env{'form.cid'},
                              );
             }
-            if (($namechanged && $namechgresult eq 'ok') || 
+            if (((keys(%namechanged) > 0) && $namechgresult eq 'ok') ||
                 ((keys(%changed) > 0) && $chgresult eq 'ok')) {
             # Tell the user we changed the name
-		my %lt=&Apache::lonlocal::texthash(
-                             'uic'        => 'User Information Changed',
-                             'frst'       => 'First Name',
-                             'mddl'       => 'Middle Name',
-                             'lst'        => 'Last Name',
-                             'gen'        => 'Generation',
-                             'id'         => 'Student/Employee ID',
-                             'mail'       => 'Permanent e-mail address',
-                             'disk'       => 'Disk space allocated to portfolio files',
-                             'blog'       => 'Blog Availability',
-                             'aboutme'    => 'Personal Information Page Availability',
-                             'portfolio'  => 'Portfolio Availability',
-                             'official'   => 'Can Request Official Courses',
-                             'unofficial' => 'Can Request Unofficial Courses',
-                             'community'  => 'Can Request Communities',
-                             'inststatus' => "Affiliation",
-                             'prvs'       => 'Previous Value:',
-                             'chto'       => 'Changed To:'
-						   );
-                $r->print('<h4>'.$lt{'uic'}.'</h4>'.
-                          &Apache::loncommon::start_data_table().
-                          &Apache::loncommon::start_data_table_header_row());
-                $r->print(<<"END");
-    <th>&nbsp;</th>
-    <th>$lt{'frst'}</th>
-    <th>$lt{'mddl'}</th>
-    <th>$lt{'lst'}</th>
-    <th>$lt{'gen'}</th>
-    <th>$lt{'id'}</th>
-    <th>$lt{'mail'}</th>
-END
-                if ($showinststatus) {
-                    $r->print("
-    <th>$lt{'inststatus'}</th>\n");
-                }
-                if ($showrequestcourses) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <th>$lt{$item}</th>\n");
-                    }
-                } elsif ($showreqotherdom) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <th>$lt{$item}</th>\n");
-                    }
-                }
-                if ($showquota) {
-                    $r->print("
-    <th>$lt{'disk'}</th>\n");
-                }
-                if ($showtools) {
-                    foreach my $item (@usertools) {
-                        $r->print("
-    <th>$lt{$item}</th>\n");
-                    }
-                }
-                $r->print(&Apache::loncommon::end_data_table_header_row().
-                          &Apache::loncommon::start_data_table_row());
-                $r->print(<<"END");
-    <td><b>$lt{'prvs'}</b></td>
-    <td>$userenv{'firstname'}  </td>
-    <td>$userenv{'middlename'} </td>
-    <td>$userenv{'lastname'}   </td>
-    <td>$userenv{'generation'} </td>
-    <td>$userenv{'id'}</td>
-    <td>$userenv{'permanentemail'} </td>
-END
-                if ($showinststatus) {
-                    $r->print("
-    <td>$oldinststatuses</td>\n");
-                }  
-                if ($showrequestcourses) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <td>$oldaccess{$item} $oldaccesstext{$item}</td>\n");
-                    }
-                } elsif ($showreqotherdom) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <td>$oldaccess{$item} $oldaccesstext{$item}</td>\n");
-                    }
-                }
-                if ($showquota) {
-                    $r->print("
-    <td>$oldportfolioquota Mb $olddefquotatext </td>\n");
-                }
-                if ($showtools) {
-                    foreach my $item (@usertools) {
-                        $r->print("
-    <td>$oldaccess{$item} $oldaccesstext{$item} </td>\n");
-                    }
-                }
-                $r->print(&Apache::loncommon::end_data_table_row().
-                          &Apache::loncommon::start_data_table_row());
-                $r->print(<<"END");
-    <td><span class="LC_nobreak"><b>$lt{'chto'}</b></span></td>
-    <td>$env{'form.cfirstname'}  </td>
-    <td>$env{'form.cmiddlename'} </td>
-    <td>$env{'form.clastname'}   </td>
-    <td>$env{'form.cgeneration'} </td>
-    <td>$env{'form.cid'} </td>
-    <td>$env{'form.cpermanentemail'} </td>
-END
-                if ($showinststatus) {
-                    $r->print("
-    <td>$newinststatuses</td>\n");
-                }
-                if ($showrequestcourses) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <td>$newaccess{$item} $newaccesstext{$item} </td>\n");
-                    }
-                } elsif ($showreqotherdom) {
-                    foreach my $item (@requestcourses) {
-                        $r->print("
-    <td>$newaccess{$item} $newaccesstext{$item} </td>\n");
-                    }
-                }
-                if ($showquota) {
-                    $r->print("
-    <td>$newportfolioquota Mb $newdefquotatext </td>\n");
-                }
-                if ($showtools) {
-                    foreach my $item (@usertools) {
-                        $r->print("
-    <td>$newaccess{$item} $newaccesstext{$item} </td>\n");
-                    }
-                }
-                $r->print(&Apache::loncommon::end_data_table_row().
-                          &Apache::loncommon::end_data_table().'<br />');
+                &display_userinfo($r,1,\@disporder,\%canshow,\@requestcourses,
+                                  \@usertools,\%userenv,\%changed,\%namechanged,
+                                  \%oldsettings, \%oldsettingstext,\%newsettings,
+                                  \%newsettingstext);
+
                 if ($env{'form.cid'} ne $userenv{'id'}) {
                     &Apache::lonnet::idput($env{'form.ccdomain'},
                          ($env{'form.ccuname'} => $env{'form.cid'}));
@@ -2891,54 +2789,13 @@
                       $env{'form.ccuname'}.' '.&mt('in domain').' '.
                       $env{'form.ccdomain'}.'</span><br />');
             }
-        }  else { # End of if ($env ... ) logic
+        } else { # End of if ($env ... ) logic
             # They did not want to change the users name, quota, tool availability,
             # or ability to request creation of courses, 
             # but we can still tell them what the name and quota and availabilities are  
-	    my %lt=&Apache::lonlocal::texthash(
-                           'id'         => "Student/Employee ID",
-                           'mail'       => "Permanent e-mail address",
-                           'disk'       => "Disk space allocated to user's portfolio files",
-                           'blog'       => "Blog Availability",
-                           'aboutme'    => "Personal Information Page Availability",
-                           'portfolio'  => "Portfolio Availability",
-                           'official'   => "Can Request Official Courses",
-                           'unofficial' => "Can Request Unofficial Courses",
-                           'community'  => "Can Request Communities",
-                           'inststatus' => "Affiliation",
-					       );
-            $r->print(<<"END");
-<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'}
-END
-            if ($userenv{'permanentemail'} ne '') {
-                $r->print('<br />['.$lt{'mail'}.': '.
-                          $userenv{'permanentemail'}.']');
-            }
-            if ($showinststatus) {
-                $r->print('<br />['.$lt{'inststatus'}.': '.$oldinststatuses.']');
-            }
-            if ($showrequestcourses) {
-                foreach my $item (@requestcourses) {
-                    $r->print('<br />['.$lt{$item}.': '.$newaccess{$item}.' '.
-                              $newaccesstext{$item}.']'."\n");
-                }
-            } elsif ($showreqotherdom) {
-                foreach my $item (@requestcourses) {
-                    $r->print('<br />['.$lt{$item}.': '.$newaccess{$item}.' '.
-                              $newaccesstext{$item}.']'."\n");
-                }
-            }
-            if ($showtools) {
-                foreach my $item (@usertools) {
-                    $r->print('<br />['.$lt{$item}.': '.$newaccess{$item}.' '.
-                              $newaccesstext{$item}.']'."\n");
-                }
-            }
-            if ($showquota) {
-                $r->print('<br />['.$lt{'disk'}.': '.$oldportfolioquota.' Mb '.
-                          $olddefquotatext.']');
-            }
-            $r->print('</h4>');
+            &display_userinfo($r,undef,\@disporder,\%canshow,\@requestcourses,
+                              \@usertools,\%userenv,\%changed,\%namechanged,\%oldsettings,
+                              \%oldsettingstext,\%newsettings,\%newsettingstext);
         }
         if (@mod_disallowed) {
             my ($rolestr,$contextname);
@@ -2985,7 +2842,7 @@
         $r->print('</a></p>');
     } else {
         my @rolechanges = &update_roles($r,$context);
-        if ($namechanged) {
+        if (keys(%namechanged) > 0) {
             if ($context eq 'course') {
                 if (@userroles > 0) {
                     if ((@rolechanges == 0) || 
@@ -3014,6 +2871,136 @@
     $r->print(&Apache::loncommon::end_page());
 }
 
+sub display_userinfo {
+    my ($r,$changed,$order,$canshow,$requestcourses,$usertools,$userenv,
+        $changedhash,$namechangedhash,$oldsetting,$oldsettingtext,
+        $newsetting,$newsettingtext) = @_;
+    return unless (ref($order) eq 'ARRAY' &&
+                   ref($canshow) eq 'HASH' &&
+                   ref($requestcourses) eq 'ARRAY' &&
+                   ref($usertools) eq 'ARRAY' &&
+                   ref($userenv) eq 'HASH' &&
+                   ref($changedhash) eq 'HASH' &&
+                   ref($oldsetting) eq 'HASH' &&
+                   ref($oldsettingtext) eq 'HASH' &&
+                   ref($newsetting) eq 'HASH' &&
+                   ref($newsettingtext) eq 'HASH');
+    my %lt=&Apache::lonlocal::texthash(
+         'ui'             => 'User Information (unchanged)',
+         'uic'            => 'User Information Changed',
+         'firstname'      => 'First Name',
+         'middlename'     => 'Middle Name',
+         'lastname'       => 'Last Name',
+         'generation'     => 'Generation',
+         'id'             => 'Student/Employee ID',
+         'permanentemail' => 'Permanent e-mail address',
+         'quota'          => 'Disk space allocated to portfolio files',
+         'blog'           => 'Blog Availability',
+         'aboutme'        => 'Personal Information Page Availability',
+         'portfolio'      => 'Portfolio Availability',
+         'official'       => 'Can Request Official Courses',
+         'unofficial'     => 'Can Request Unofficial Courses',
+         'community'      => 'Can Request Communities',
+         'inststatus'     => "Affiliation",
+         'prvs'           => 'Previous Value:',
+         'chto'           => 'Changed To:'
+    );
+    my $title = $lt{'ui'};
+    if ($changed) {
+        $title = $lt{'uic'};
+    }
+    $r->print('<h4>'.$title.'</h4>'.
+              &Apache::loncommon::start_data_table().
+              &Apache::loncommon::start_data_table_header_row());
+    if ($changed) {
+        $r->print("<th>&nbsp;</th>\n");
+    }
+    my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
+    foreach my $item (@userinfo) {
+        $r->print("<th>$lt{$item}</th>\n");
+    }
+    foreach my $entry (@{$order}) {
+        if ($canshow->{$entry}) {
+            if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+                foreach my $item (@{$requestcourses}) {
+                    $r->print("<th>$lt{$item}</th>\n");
+                }
+            } elsif ($entry eq 'tools') {
+                foreach my $item (@{$usertools}) {
+                    $r->print("<th>$lt{$item}</th>\n");
+                }
+            } else {
+                $r->print("<th>$lt{$entry}</th>\n");
+            }
+        }
+    }
+    $r->print(&Apache::loncommon::end_data_table_header_row().
+             &Apache::loncommon::start_data_table_row());
+    if ($changed) {
+        $r->print('<td><b>'.$lt{'prvs'}.'</b></td>'."\n");
+    }
+    foreach my $item (@userinfo) {
+        $r->print('<td>'.$userenv->{$item}.' </td>'."\n");
+    }
+    foreach my $entry (@{$order}) {
+        if ($canshow->{$entry}) {
+            if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+                foreach my $item (@{$requestcourses}) {
+                    $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
+                }
+            } elsif ($entry eq 'tools') {
+                foreach my $item (@{$usertools}) {
+                    $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");
+                }
+            } else {
+                $r->print("<td>$oldsetting->{$entry} $oldsettingtext->{$entry} </td>\n");
+            }
+        }
+    }
+    $r->print(&Apache::loncommon::end_data_table_row());
+    if ($changed) {
+        $r->print(&Apache::loncommon::start_data_table_row().
+                  '<td><span class="LC_nobreak"><b>'.$lt{'chto'}.'</b></span></td>'."\n");
+        foreach my $item (@userinfo) {
+            my $value = $env{'form.c'.$item};
+            if ($namechangedhash->{$item}) {
+                $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+            }
+            $r->print("<td>$value </td>\n");
+        }
+        foreach my $entry (@{$order}) {
+            if ($canshow->{$entry}) {
+                if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+                    foreach my $item (@{$requestcourses}) {
+                        my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
+                        if ($changedhash->{$item}) {
+                            $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+                        }
+                        $r->print("<td>$value </td>\n");
+                    }
+                } elsif ($entry eq 'tools') {
+                    foreach my $item (@{$usertools}) {
+                        my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
+                        if ($changedhash->{$item}) {
+                            $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+                        }
+                        $r->print("<td>$value </td>\n");
+                    }
+                } else {
+                    my $value = $newsetting->{$entry}.' '.$newsettingtext->{$entry};
+                    if ($changedhash->{$entry}) {
+                        $value = '<span class="LC_cusr_emph">'.$value.'</span>';
+                    }
+                    $r->print("<td>$value </td>\n");
+                }
+            }
+        }
+        $r->print(&Apache::loncommon::end_data_table_row());
+    }
+    $r->print(&Apache::loncommon::end_data_table().'<br />');
+    return;
+}
+
 sub tool_changes {
     my ($context,$usertools,$oldaccess,$oldaccesstext,$userenv,$changeHash,
         $changed,$newaccess,$newaccesstext) = @_;
@@ -3793,7 +3780,7 @@
 '<th>'.$lt{'prv'}.'</th><th>'.$lt{'crl'}.'</th><th>'.$lt{'dml'}.
 '</th><th>'.$lt{'ssl'}.'</th>'.
               &Apache::loncommon::end_data_table_header_row());
-    foreach my $priv (sort keys %full) {
+    foreach my $priv (sort(keys(%full))) {
         my $privtext = &Apache::lonnet::plaintext($priv,$crstype);
         $r->print(&Apache::loncommon::start_data_table_row().
 	          '<td>'.$privtext.'</td><td>'.
@@ -4141,7 +4128,7 @@
             $r->print(&Apache::lonhtmlcommon::breadcrumbs("Update Users",
                                                           'Course_View_Class_List'));
             if ($permission->{'cusr'}) {
-                &Apache::lonuserutils::update_user_list($r,$context,$setting,$choice);
+                &Apache::lonuserutils::update_user_list($r,$context,$setting,$choice,$crstype);
                 $r->print(&Apache::loncommon::end_page());
             } else {
                 $r->print(&mt('You are not authorized to make bulk changes to user roles'));
@@ -4200,7 +4187,7 @@
             ({href=>'/adm/createuser?action=drop',
               text=>$brtext});
         if (!exists($env{'form.state'})) {
-            $r->print(&Apache::lonhtmlcommon::breadcrumbs('Drop Students',
+            $r->print(&Apache::lonhtmlcommon::breadcrumbs($brtext,
                                                           'Course_Drop_Student'));
 
             &Apache::lonuserutils::print_drop_menu($r,$context,$permission,$crstype);
@@ -4339,17 +4326,17 @@
     my %links = (
                        domain => {
                                    upload => 'Upload a File of Users',
-                                   singleuser => 'Add/Modify a Single User',
-                                   listusers => 'Manage Multiple Users',
+                                   singleuser => 'Add/Modify a User',
+                                   listusers => 'Manage Users',
                                  },
                        author => {
                                    upload => 'Upload a File of Co-authors',
-                                   singleuser => 'Add/Modify a Single Co-author',
-                                   listusers => 'Display Co-authors and Manage Multiple Users',
+                                   singleuser => 'Add/Modify a Co-author',
+                                   listusers => 'Manage Co-authors',
                                  },
                        course => {
                                    upload => 'Upload a File of Course Users',
-                                   singleuser => 'Add/Modify a Single Course User',
+                                   singleuser => 'Add/Modify a Course User',
                                    listusers => 'Display Class Lists and Manage Multiple Users',
                                  },
                        community => {
@@ -6019,7 +6006,7 @@
                       '<input type="hidden" name="origdom" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="dccourse" value="" />';
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link
-            ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course').'</b>';
+            ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Community','crstype').'</b>';
     my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser');
     my %lt=&Apache::lonlocal::texthash(
                     'rol'  => "Role",

--raeburn1269362686--