--- loncom/interface/loncreateuser.pm	2010/04/02 14:53:26	1.339
+++ loncom/interface/loncreateuser.pm	2010/09/14 06:02:35	1.348
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.339 2010/04/02 14:53:26 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.348 2010/09/14 06:02:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1613,7 +1613,10 @@ sub display_existing_roles {
             $plaintext=&Apache::lonnet::plaintext($role_code,$class)
         } else {
             $plaintext=
-        "Customrole '$croletitle'<br />defined by $croleuname\@$croleudom";
+                &mt('Customrole [_1][_2]defined by [_3]',
+                        '"'.$croletitle.'"',
+                        '<br />',
+                        $croleuname.':'.$croleudom);
         }
         $row.= '</td><td>'.$plaintext.
                '</td><td>'.$area.
@@ -2297,6 +2300,8 @@ sub update_user_data {
 
     $r->print('<h3>'.&mt('User [_1] in domain [_2]',
 			 $env{'form.ccuname'}, $env{'form.ccdomain'}).'</h3>');
+    $r->print('<p class="LC_info">'.&mt('Please be patient').'</p>');
+
     my (%alerts,%rulematch,%inst_results,%curr_rules);
     my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
     my @usertools = ('aboutme','blog','portfolio');
@@ -2385,15 +2390,17 @@ sub update_user_data {
                     }
                 }
                 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'};
+                    if ($env{'form.custom'.$item} == 1) {
+                        $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');
                     }
-                    $changed{$item} = &tool_admin($item,$newcustom{$item},
-                                                  \%changeHash,'requestcourses');
                 }
             }
             if ($canmodify_status{'inststatus'}) {
@@ -2436,8 +2443,11 @@ sub update_user_data {
 	    $r->print($error.&mt('You do not have the authority to modify this users authentification information').'.'.$end);    
 	}
     }
+
+    $r->rflush(); # Finish display of header before time consuming actions start
+
     ##
-    my (@userroles,%userupdate,$cnum,$cdom,$crstype,%namechanged);
+    my (@userroles,%userupdate,$cnum,$cdom,%namechanged);
     if ($context eq 'course') {
         ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
         $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
@@ -3435,7 +3445,7 @@ sub update_roles {
 	}
     } # End of foreach (keys(%env))
 # Flush the course logs so reverse user roles immediately updated
-    &Apache::lonnet::flushcourselogs();
+    $r->register_cleanup(\&Apache::lonnet::flushcourselogs());
     if (@rolechanges == 0) {
         $r->print(&mt('No roles to modify'));
     }
@@ -4386,7 +4396,7 @@ sub print_main_menu {
          [
             {
              linktext => $links{$linkcontext}{'upload'},
-             icon => 'sctr.png',
+             icon => 'uplusr.png',
              #help => 'Course_Create_Class_List',
              url => '/adm/createuser?action=upload',
              permission => $permission->{'cusr'},
@@ -4394,7 +4404,7 @@ sub print_main_menu {
             },
             {
              linktext => $links{$linkcontext}{'listusers'},
-             icon => 'edit-find.png',
+             icon => 'mngcu.png',
              #help => 'Course_View_Class_List',
              url => '/adm/createuser?action=listusers',
              permission => ($permission->{'view'} || $permission->{'cusr'}),
@@ -4526,7 +4536,7 @@ sub print_main_menu {
             push(@{ $menu[2]->{items} }, 
                 {
                  linktext => 'User Self-Enrollment',
-                 icon => 'cstr.png',
+                 icon => 'self_enroll.png',
                  #help => 'Course_Self_Enrollment',
                  url => '/adm/createuser?action=selfenroll',
                  permission => $permission->{'cusr'},
@@ -4952,7 +4962,7 @@ ENDSCRIPT
                                    '<input type="checkbox" name="selfenroll_notify"'.$notifyon.' value="'.$cc.'" />'.
                                    &Apache::loncommon::plainname($ccuname,$ccudom).
                                    '</label></span></td>';
-                        $count;
+                        $count ++;
                     }
                     my $rem = $count%$numcols;
                     if ($rem) {
@@ -4969,7 +4979,7 @@ ENDSCRIPT
                 my $cid = $env{'request.course.id'};
                 my $currlim = $env{'course.'.$cid.'.internal.selfenroll_limit'};
                 my $currcap = $env{'course.'.$cid.'.internal.selfenroll_cap'};
-                my $nolimit = ' checked="checked" ';
+                $nolimit = ' checked="checked" ';
                 if ($currlim eq 'allstudents') {
                     $crslimit = ' checked="checked" ';
                     $selflimit = ' ';
@@ -5025,9 +5035,9 @@ sub visible_in_cat {
                    dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',
                    dc_addcat => 'Ask a domain coordinator to assign a category to the course.',
     );
-    $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','"<a href="/adm/parmset?action=crsenv">','</a>"');
-    $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"<a href="/adm/parmset?action=crsenv">','</a>"');
-    $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','"<a href="/adm/parmset?action=crsenv">','</a>"');
+    $visactions{'unhide'} = &mt('Use [_1]Categorize course[_2] to change the "Exclude from course catalog" setting.','<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
+    $visactions{'chgcat'} = &mt('Use [_1]Categorize course[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
+    $visactions{'addcat'} = &mt('Use [_1]Categorize course[_2] to assign a category to the course.','"<a href="/adm/courseprefs?phase=display&actions=courseinfo">','</a>"');
     if (ref($domconf{'coursecategories'}) eq 'HASH') {
         if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
             $settable{'togglecats'} = 1;