Diff for /loncom/interface/loncreateuser.pm between versions 1.329.2.7 and 1.354

version 1.329.2.7, 2010/12/05 21:58:11 version 1.354, 2011/01/07 23:35:45
Line 70  use Apache::lonlocal; Line 70  use Apache::lonlocal;
 use Apache::longroup;  use Apache::longroup;
 use Apache::lonuserutils;  use Apache::lonuserutils;
 use Apache::loncoursequeueadmin;  use Apache::loncoursequeueadmin;
 use Apache::lonrequestcourse;  
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   
 my $loginscript; # piece of javascript used in two separate instances  my $loginscript; # piece of javascript used in two separate instances
Line 220  END_SCRIPT Line 219  END_SCRIPT
 sub build_tools_display {  sub build_tools_display {
     my ($ccuname,$ccdomain,$context) = @_;      my ($ccuname,$ccdomain,$context) = @_;
     my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay,      my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay,
         $colspan);          $colspan,$isadv,%domconfig);
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                    'blog'       => "Personal User Blog",                     'blog'       => "Personal User Blog",
                    'aboutme'    => "Personal Information Page",                     'aboutme'    => "Personal Information Page",
Line 244  sub build_tools_display { Line 243  sub build_tools_display {
         %reqtitles = &courserequest_titles();          %reqtitles = &courserequest_titles();
         %reqdisplay = &courserequest_display();          %reqdisplay = &courserequest_display();
         $colspan = ' colspan="2"';          $colspan = ' colspan="2"';
           %domconfig =
               &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain);
           $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
     } else {      } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                           'tools.aboutme','tools.portfolio','tools.blog');                            'tools.aboutme','tools.portfolio','tools.blog');
Line 290  sub build_tools_display { Line 292  sub build_tools_display {
                    &Apache::loncommon::start_data_table_row()."\n";                     &Apache::loncommon::start_data_table_row()."\n";
         if ($context eq 'requestcourses') {          if ($context eq 'requestcourses') {
             my ($curroption,$currlimit);              my ($curroption,$currlimit);
             $curroption = $userenv{$context.'.'.$item};              if ($userenv{$context.'.'.$item} ne '') {
                   $curroption = $userenv{$context.'.'.$item};
               } else {
                   my (@inststatuses);
                   $curroption =
                       &Apache::loncoursequeueadmin::get_processtype($ccuname,$ccdomain,$isadv,$ccdomain,
                                                                  $item,\@inststatuses,\%domconfig);
               }
             if (!$curroption) {              if (!$curroption) {
                 $curroption = 'norequest';                  $curroption = 'norequest';
             }              }
Line 473  sub print_username_entry_form { Line 482  sub print_username_entry_form {
     my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum) = @_;      my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum) = @_;
     my $defdom=$env{'request.role.domain'};      my $defdom=$env{'request.role.domain'};
     my $formtoset = 'crtuser';      my $formtoset = 'crtuser';
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if (exists($env{'form.startrolename'})) {      if (exists($env{'form.startrolename'})) {
         $formtoset = 'docustom';          $formtoset = 'docustom';
         $env{'form.rolename'} = $env{'form.startrolename'};          $env{'form.rolename'} = $env{'form.startrolename'};
Line 495  sub print_username_entry_form { Line 503  sub print_username_entry_form {
         && (&Apache::lonnet::allowed('mcr','/'))) {          && (&Apache::lonnet::allowed('mcr','/'))) {
         $jscript .= &customrole_javascript();          $jscript .= &customrole_javascript();
     }      }
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     my $helpitem = 'Course_Change_Privileges';      my $helpitem = 'Course_Change_Privileges';
     if ($env{'form.action'} eq 'custom') {      if ($env{'form.action'} eq 'custom') {
         $helpitem = 'Course_Editing_Custom_Roles';          $helpitem = 'Course_Editing_Custom_Roles';
Line 529  sub print_username_entry_form { Line 531  sub print_username_entry_form {
     my $args = {bread_crumbs           => $brcrum,      my $args = {bread_crumbs           => $brcrum,
                 bread_crumbs_component => 'User Management',                  bread_crumbs_component => 'User Management',
                 add_entries            => \%loaditems,};                  add_entries            => \%loaditems,};
     $r->print(&Apache::loncommon::start_page($title,$jscript,$args));      $r->print(&Apache::loncommon::start_page('User Management',$jscript,$args));
   
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                     'srst' => 'Search for a user and enroll as a student',                      'srst' => 'Search for a user and enroll as a student',
Line 541  sub print_username_entry_form { Line 543  sub print_username_entry_form {
                     'nr'   => "role name",                      'nr'   => "role name",
                     'cre'  => "Next",                      'cre'  => "Next",
        );         );
   
     if ($env{'form.action'} eq 'custom') {      if ($env{'form.action'} eq 'custom') {
         if (&Apache::lonnet::allowed('mcr','/')) {          if (&Apache::lonnet::allowed('mcr','/')) {
             my $newroletext = &mt('Define new custom role:');              my $newroletext = &mt('Define new custom role:');
Line 635  END Line 638  END
   
 sub entry_form {  sub entry_form {
     my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;      my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;
     my %domconf = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom);  
     my ($usertype,$inexact);      my ($usertype,$inexact);
     if (ref($srch) eq 'HASH') {      if (ref($srch) eq 'HASH') {
         if (($srch->{'srchin'} eq 'dom') &&          if (($srch->{'srchin'} eq 'dom') &&
Line 643  sub entry_form { Line 645  sub entry_form {
             ($srch->{'srchtype'} eq 'exact') &&              ($srch->{'srchtype'} eq 'exact') &&
             ($srch->{'srchdomain'} ne '') &&              ($srch->{'srchdomain'} ne '') &&
             ($srch->{'srchterm'} ne '')) {              ($srch->{'srchterm'} ne '')) {
               my (%curr_rules,%got_rules);
             my ($rules,$ruleorder) =              my ($rules,$ruleorder) =
                 &Apache::lonnet::inst_userrules($srch->{'srchdomain'},'username');                  &Apache::lonnet::inst_userrules($srch->{'srchdomain'},'username');
             $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules);              $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules,\%curr_rules,\%got_rules);
         } else {          } else {
             $inexact = 1;              $inexact = 1;
         }          }
Line 671  $userpicker Line 674  $userpicker
 ENDBLOCK  ENDBLOCK
     if ($env{'form.phase'} eq '') {      if ($env{'form.phase'} eq '') {
         my $defdom=$env{'request.role.domain'};          my $defdom=$env{'request.role.domain'};
         my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain','',1);          my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
         my %lt=&Apache::lonlocal::texthash(          my %lt=&Apache::lonlocal::texthash(
                   'enro' => 'Enroll one student',                    'enro' => 'Enroll one student',
                   'enrm' => 'Enroll one member',                    'enrm' => 'Enroll one member',
Line 720  $showresponse Line 723  $showresponse
 <table>  <table>
  <tr>   <tr>
   <td>$lt{'usr'}:</td>    <td>$lt{'usr'}:</td>
   <td><input type="text" size="25" name="srchterm" /></td>    <td><input type="text" size="15" name="srchterm" /></td>
   <td>&nbsp;$lt{'dom'}:</td><td>$domform</td>    <td>&nbsp;$lt{'dom'}:</td><td>$domform</td>
   <td>&nbsp;$sellink&nbsp;</td>    <td>&nbsp;$sellink&nbsp;</td>
   <td>&nbsp;<input name="userrole" type="submit" value="$buttontext" /></td>    <td>&nbsp;<input name="userrole" type="submit" value="$buttontext" /></td>
Line 765  sub print_user_selection_page { Line 768  sub print_user_selection_page {
     my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype,$brcrum) = @_;      my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype,$brcrum) = @_;
     my @fields = ('username','domain','lastname','firstname','permanentemail');      my @fields = ('username','domain','lastname','firstname','permanentemail');
     my $sortby = $env{'form.sortby'};      my $sortby = $env{'form.sortby'};
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
   
     if (!grep(/^\Q$sortby\E$/,@fields)) {      if (!grep(/^\Q$sortby\E$/,@fields)) {
         $sortby = 'lastname';          $sortby = 'lastname';
Line 804  ENDSCRIPT Line 806  ENDSCRIPT
     if ($context eq 'requestcrs') {      if ($context eq 'requestcrs') {
         $r->print('<div>');          $r->print('<div>');
     } else {      } else {
         my $title = 'User Management';  
         if ($context eq 'course') {  
             if ($is_custom) {  
                 $title = 'Enrollment and Student Activity';  
             }  
         }  
         my %breadcrumb_text = &singleuser_breadcrumb($crstype);          my %breadcrumb_text = &singleuser_breadcrumb($crstype);
         my $helpitem;          my $helpitem;
         if ($env{'form.action'} eq 'singleuser') {          if ($env{'form.action'} eq 'singleuser') {
Line 828  ENDSCRIPT Line 824  ENDSCRIPT
                    bug  => 'Instructor Interface',                     bug  => 'Instructor Interface',
                    help => $helpitem}                     help => $helpitem}
                   );                    );
         $r->print(&Apache::loncommon::start_page($title,$jscript,{bread_crumbs => $brcrum}));          $r->print(&Apache::loncommon::start_page('User Management',$jscript,{bread_crumbs => $brcrum}));
         if ($env{'form.action'} eq 'singleuser') {          if ($env{'form.action'} eq 'singleuser') {
             $r->print("<b>$lt{'usrch'}</b><br />");              $r->print("<b>$lt{'usrch'}</b><br />");
             $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));              $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
Line 910  ENDSCRIPT Line 906  ENDSCRIPT
     if ($context eq 'requestcrs') {      if ($context eq 'requestcrs') {
         $r->print($opener_elements.'</form></div>');          $r->print($opener_elements.'</form></div>');
     } else {      } else {
         $r->print($response.'</form>'.&Apache::loncommon::end_page());          $r->print($response.'</form>');
     }      }
 }  }
   
Line 941  sub print_user_modification_page { Line 937  sub print_user_modification_page {
     my %abv_auth = &auth_abbrev();      my %abv_auth = &auth_abbrev();
     my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);      my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);
     my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);      my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($is_custom) {  
         if ($uhome eq 'no_host') {  
             my $lc_ccuname = lc($ccuname);  
             if ($lc_ccuname ne $ccuname) {  
                 $uhome = &Apache::lonnet::homeserver($lc_ccuname,$ccdomain);  
                 $ccuname = $lc_ccuname;  
             }  
         }  
     }  
     if ($uhome eq 'no_host') {      if ($uhome eq 'no_host') {
           my $usertype;
         my ($rules,$ruleorder) =          my ($rules,$ruleorder) =
             &Apache::lonnet::inst_userrules($ccdomain,'username');              &Apache::lonnet::inst_userrules($ccdomain,'username');
         my $usertype =              $usertype =
             &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);                  &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules,
                                                          \%curr_rules,\%got_rules);
         my $cancreate =          my $cancreate =
             &Apache::lonuserutils::can_create_user($ccdomain,$context,              &Apache::lonuserutils::can_create_user($ccdomain,$context,
                                                    $usertype);                                                     $usertype);
Line 965  sub print_user_modification_page { Line 953  sub print_user_modification_page {
                 official   => 'institutional',                  official   => 'institutional',
                 unofficial => 'non-institutional',                  unofficial => 'non-institutional',
             );              );
             if ($ccdomain eq 'gci') {  
                 $usertypetext{'unofficial'} = 'institutional',  
             }  
             my $response;              my $response;
             if ($env{'form.origform'} eq 'crtusername') {              if ($env{'form.origform'} eq 'crtusername') {
                 if ($is_custom) {                  $response =  '<span class="LC_warning">'.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]','<b>'.$ccuname.'</b>',$ccdomain).
                     $response = '<span class="LC_warning">'.&mt('Invalid format for username for new user: [_1]','<b>'.$ccuname.'</b>').                              '</span><br />';
                                 '</span><br />';  
                 } else {  
                     $response =  '<span class="LC_warning">'.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).'</span><br />';  
                 }  
             }              }
             $response .= '<p class="LC_warning">'              $response .= '<p class="LC_warning">'
                         .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")                          .&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
                         .'<br />';                          .' '
             if ($ccdomain =~ /^\w+citest$/) {                          .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
                 $response .= &mt('Enter a valid e-mail address as the username for the new user.').' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.'                              ,'<a href="'.$helplink.'">','</a>')
                              ,'<a href="'.$helplink.'">','</a>')                          .'</p><br />';
                              .'</p><br />';  
             }  
             $env{'form.phase'} = '';              $env{'form.phase'} = '';
             &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);              &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
             return;              return;
Line 1031  sub print_user_modification_page { Line 1010  sub print_user_modification_page {
   
     my $js = &validation_javascript($context,$ccdomain,$pjump_def,      my $js = &validation_javascript($context,$ccdomain,$pjump_def,
                                $groupslist,$newuser,$formname,\%loaditem);                                 $groupslist,$newuser,$formname,\%loaditem);
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     my $helpitem = 'Course_Change_Privileges';      my $helpitem = 'Course_Change_Privileges';
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
Line 1067  sub print_user_modification_page { Line 1040  sub print_user_modification_page {
         $args->{'no_nav_bar'} = 1;          $args->{'no_nav_bar'} = 1;
     }      }
     my $start_page =      my $start_page =
         &Apache::loncommon::start_page($title,$js,$args);          &Apache::loncommon::start_page('User Management',$js,$args);
   
     my $forminfo =<<"ENDFORMINFO";      my $forminfo =<<"ENDFORMINFO";
 <form action="/adm/createuser" method="post" name="$formname">  <form action="/adm/createuser" method="post" name="$formname">
Line 1492  sub display_existing_roles { Line 1465  sub display_existing_roles {
             $newkey .= '_'.$newrole;              $newkey .= '_'.$newrole;
             if ($start ne '' && $end ne '') {              if ($start ne '' && $end ne '') {
                 $newvalue .= '_'.$end.'_'.$start;                  $newvalue .= '_'.$end.'_'.$start;
               } elsif ($end ne '') {
                   $newvalue .= '_'.$end;
             }              }
             $rolesdump{$newkey} = $newvalue;              $rolesdump{$newkey} = $newvalue;
         }          }
     } else {      } else {
         %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname);          my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
           %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname,'.',undef,$extra);
     }      }
     # Build up table of user roles to allow revocation and re-enabling of roles.      # Build up table of user roles to allow revocation and re-enabling of roles.
     my ($tmp) = keys(%rolesdump);      my ($tmp) = keys(%rolesdump);
Line 1648  sub display_existing_roles { Line 1624  sub display_existing_roles {
             $plaintext=&Apache::lonnet::plaintext($role_code,$class)              $plaintext=&Apache::lonnet::plaintext($role_code,$class)
         } else {          } else {
             $plaintext=              $plaintext=
         "Customrole '$croletitle'<br />defined by $croleuname\@$croleudom";                  &mt('Customrole [_1][_2]defined by [_3]',
                           '"'.$croletitle.'"',
                           '<br />',
                           $croleuname.':'.$croleudom);
         }          }
         $row.= '</td><td>'.$plaintext.          $row.= '</td><td>'.$plaintext.
                '</td><td>'.$area.                 '</td><td>'.$area.
Line 2100  sub personal_data_display { Line 2079  sub personal_data_display {
                 if ($canmodify_status{'inststatus'}) {                  if ($canmodify_status{'inststatus'}) {
                     $shown = &pick_inst_statuses($userenv{'inststatus'},$usertypes,$types);                      $shown = &pick_inst_statuses($userenv{'inststatus'},$usertypes,$types);
                 } else {                  } else {
                     $shown .= $userenv{'inststatus'};  
                     if ($userenv{'inststatus'} eq '') {                      if ($userenv{'inststatus'} eq '') {
                         $hiderow = 1;                          $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) {                  if (!$hiderow) {
Line 2198  sub get_inststatuses { Line 2190  sub get_inststatuses {
   
 # ================================================================= Phase Three  # ================================================================= Phase Three
 sub update_user_data {  sub update_user_data {
     my ($r,$context,$crstype,$brcrum) = @_;      my ($r,$context,$crstype,$brcrum) = @_; 
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},      my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},
                                           $env{'form.ccdomain'});                                            $env{'form.ccdomain'});
     # Error messages      # Error messages
Line 2224  sub update_user_data { Line 2215  sub update_user_data {
                   '// ]]>'."\n".                    '// ]]>'."\n".
                   '</script>'."\n";                    '</script>'."\n";
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
       push (@{$brcrum},
                {href => "javascript:backPage(document.userupdate)",
                 text => $breadcrumb_text{'search'},
                 faq  => 282,
                 bug  => 'Instructor Interface',}
                );
       if ($env{'form.prevphase'} eq 'userpicked') {
           push(@{$brcrum},
                  {href => "javascript:backPage(document.userupdate,'get_user_info','select')",
                   text => $breadcrumb_text{'userpicked'},
                   faq  => 282,
                   bug  => 'Instructor Interface',});
       }
     my $helpitem = 'Course_Change_Privileges';      my $helpitem = 'Course_Change_Privileges';
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
         $helpitem = 'Course_Add_Student';          $helpitem = 'Course_Add_Student';
     }      }
     my $bread_crumbs_component = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $bread_crumbs_component = 'Enrollment and Student Activity';  
         }  
     }  
     push(@{$brcrum},       push(@{$brcrum}, 
             {href => "javascript:backPage(document.userupdate,'$env{'form.prevphase'}','modify')",              {href => "javascript:backPage(document.userupdate,'$env{'form.prevphase'}','modify')",
              text => $breadcrumb_text{'modify'},               text => $breadcrumb_text{'modify'},
Line 2244  sub update_user_data { Line 2242  sub update_user_data {
              faq  => 282,               faq  => 282,
              bug  => 'Instructor Interface',               bug  => 'Instructor Interface',
              help => $helpitem});               help => $helpitem});
     my $args = {bread_crumbs           => $brcrum,      my $args = {bread_crumbs          => $brcrum,
                 bread_crumbs_component => $bread_crumbs_component};                  bread_crumbs_component => 'User Management'};
     if ($env{'form.popup'}) {      if ($env{'form.popup'}) {
         $args->{'no_nav_bar'} = 1;          $args->{'no_nav_bar'} = 1;
     }      }
     $r->print(&Apache::loncommon::start_page($title,$jscript,$args));      $r->print(&Apache::loncommon::start_page($title,$jscript,$args));
   
     $r->print(&update_result_form($uhome));      $r->print(&update_result_form($uhome));
     # Check Inputs      # Check Inputs
     if (! $env{'form.ccuname'} ) {      if (! $env{'form.ccuname'} ) {
Line 2317  sub update_user_data { Line 2314  sub update_user_data {
   
     $r->print('<h3>'.&mt('User [_1] in domain [_2]',      $r->print('<h3>'.&mt('User [_1] in domain [_2]',
  $env{'form.ccuname'}, $env{'form.ccdomain'}).'</h3>');   $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 (%alerts,%rulematch,%inst_results,%curr_rules);
       my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
     my @usertools = ('aboutme','blog','portfolio');      my @usertools = ('aboutme','blog','portfolio');
     my @requestcourses = ('official','unofficial','community');      my @requestcourses = ('official','unofficial','community');
     my ($othertitle,$usertypes,$types) =       my ($othertitle,$usertypes,$types) = 
         &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});          &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'}) {      if ($env{'form.makeuser'}) {
  $r->print('<h3>'.&mt('Creating new account.').'</h3>');   $r->print('<h3>'.&mt('Creating new account.').'</h3>');
         # Check for the authentication mode and password          # Check for the authentication mode and password
Line 2381  sub update_user_data { Line 2384  sub update_user_data {
  $r->print(&mt('Generating user').': '.$result);   $r->print(&mt('Generating user').': '.$result);
         $uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},          $uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
                                                $env{'form.ccdomain'});                                                 $env{'form.ccdomain'});
         my (%changeHash,%newcustom,%changed);          my (%changeHash,%newcustom,%changed,%changedinfo);
         if ($uhome ne 'no_host') {          if ($uhome ne 'no_host') {
             if ($env{'form.customquota'} == 1) {              if ($context eq 'domain') {
                 if ($env{'form.portfolioquota'} eq '') {                  if ($env{'form.customquota'} == 1) {
                     $newcustom{'quota'} = 0;                      if ($env{'form.portfolioquota'} eq '') {
                 } else {                          $newcustom{'quota'} = 0;
                     $newcustom{'quota'} = $env{'form.portfolioquota'};                      } else {
                     $newcustom{'quota'} =~ s/[^\d\.]//g;                          $newcustom{'quota'} = $env{'form.portfolioquota'};
                           $newcustom{'quota'} =~ s/[^\d\.]//g;
                       }
                       $changed{'quota'} = &quota_admin($newcustom{'quota'},\%changeHash);
                 }                  }
                 $changed{'quota'} = &quota_admin($newcustom{'quota'},\%changeHash);                  foreach my $item (@usertools) {
             }                      if ($env{'form.custom'.$item} == 1) {
             foreach my $item (@usertools) {                          $newcustom{$item} = $env{'form.tools_'.$item};
                 if ($env{'form.custom'.$item} == 1) {                          $changed{$item} = &tool_admin($item,$newcustom{$item},
                     $newcustom{$item} = $env{'form.tools_'.$item};                                                       \%changeHash,'tools');
                     $changed{$item} = &tool_admin($item,$newcustom{$item},                      }
                                                  \%changeHash,'tools');  
                 }                  }
             }                  foreach my $item (@requestcourses) {
             foreach my $item (@requestcourses) {                      if ($env{'form.custom'.$item} == 1) {
                 $newcustom{$item} = $env{'form.crsreq_'.$item};                          $newcustom{$item} = $env{'form.crsreq_'.$item};
                 if ($env{'form.crsreq_'.$item} eq 'autolimit') {                          if ($env{'form.crsreq_'.$item} eq 'autolimit') {
                     $newcustom{$item} .= '=';                              $newcustom{$item} .= '=';
                     unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {                              unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
                         $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};                                  $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 (exists($env{'form.inststatus'})) {              if ($canmodify_status{'inststatus'}) {
                 my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');                  if (exists($env{'form.inststatus'})) {
                 if (@inststatuses > 0) {                      my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
                     $changeHash{'inststatus'} = join(',',@inststatuses);                      if (@inststatuses > 0) {
                     $changed{'inststatus'} = $changeHash{'inststatus'};                          $changeHash{'inststatus'} = join(',',@inststatuses);
                           $changed{'inststatus'} = $changeHash{'inststatus'};
                       }
                 }                  }
             }              }
             if (keys(%changed)) {              if (keys(%changed)) {
                 $changeHash{'firstname'}  = $env{'form.cfirstname'};                  foreach my $item (@userinfo) {
                 $changeHash{'middlename'} = $env{'form.cmiddlename'};                      $changeHash{$item}  = $env{'form.c'.$item};
                 $changeHash{'lastname'}   = $env{'form.clastname'};                  }
                 $changeHash{'generation'} = $env{'form.cgeneration'};  
                 $changeHash{'id'}         = $env{'form.cid'};  
                 $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};  
                 my $chgresult =                  my $chgresult =
                      &Apache::lonnet::put('environment',\%changeHash,                       &Apache::lonnet::put('environment',\%changeHash,
                                           $env{'form.ccdomain'},$env{'form.ccuname'});                                            $env{'form.ccdomain'},$env{'form.ccuname'});
Line 2451  sub update_user_data { Line 2457  sub update_user_data {
     $r->print($error.&mt('You do not have the authority to modify this users authentification information').'.'.$end);          $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') {      if ($context eq 'course') {
         ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();          ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
         $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);          $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
Line 2542  sub update_user_data { Line 2551  sub update_user_data {
                 push(@longroles,&Apache::lonnet::plaintext($role,$crstype));                   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);          my %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},\@userinfo,\@userroles);
         foreach my $item (@userinfo) {          foreach my $item (@userinfo) {
             # Strip leading and trailing whitespace              # Strip leading and trailing whitespace
Line 2589  sub update_user_data { Line 2597  sub update_user_data {
             }              }
         }          }
         my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,          my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
             $inststatus,$newinststatus,$oldisdefault,$newisdefault,$olddefquotatext,              $newinststatus,$oldisdefault,$newisdefault,%oldsettings,
             $newdefquotatext,%oldaccess,%oldaccesstext,%newaccess,%newaccesstext,              %oldsettingstext,%newsettings,%newsettingstext,@disporder,
             $oldinststatuses,$newinststatuses);              $olddefquota,$oldsettingstatus,$newdefquota,$newsettingstatus);
         my ($defquota,$settingstatus) =           @disporder = ('inststatus');
             &Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus);          if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
         my ($showquota,$showtools,$showrequestcourses,$showinststatus,$showreqotherdom);              push(@disporder,'requestcourses');
           } else {
               push(@disporder,'reqcrsotherdom');
           }
           push(@disporder,('quota','tools'));
           $oldinststatus = $userenv{'inststatus'};
           ($olddefquota,$oldsettingstatus) = 
               &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus);
           ($newdefquota,$newsettingstatus) = ($olddefquota,$oldsettingstatus);
           my %canshow;
         if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
             $showquota = 1;              $canshow{'quota'} = 1;
         }          }
         if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
             $showtools = 1;              $canshow{'tools'} = 1;
         }          }
         if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {
             $showrequestcourses = 1;              $canshow{'requestcourses'} = 1;
         } elsif (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {          } elsif (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
             $showreqotherdom = 1;              $canshow{'reqcrsotherdom'} = 1;
         }          }
         if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {
             $showinststatus = 1;              $canshow{'inststatus'} = 1;
         }          }
         my (%changeHash,%changed);          my (%changeHash,%changed);
         $oldinststatus = $userenv{'inststatus'};  
         if ($oldinststatus eq '') {          if ($oldinststatus eq '') {
             $oldinststatuses = $othertitle;               $oldsettings{'inststatus'} = $othertitle; 
         } else {          } else {
             if (ref($usertypes) eq 'HASH') {              if (ref($usertypes) eq 'HASH') {
                 $oldinststatuses = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));                  $oldsettings{'inststatus'} = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
             } else {              } else {
                 $oldinststatuses = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));                  $oldsettings{'inststatus'} = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
             }              }
         }          }
         $changeHash{'inststatus'} = $userenv{'inststatus'};          $changeHash{'inststatus'} = $userenv{'inststatus'};
         my %canmodify_inststatus = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},['inststatus'],\@userroles);          if ($canmodify_status{'inststatus'}) {
         if ($canmodify_inststatus{'inststatus'}) {              $canshow{'inststatus'} = 1;
             if (exists($env{'form.inststatus'})) {              if (exists($env{'form.inststatus'})) {
                 my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');                  my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
                 if (@inststatuses > 0) {                  if (@inststatuses > 0) {
Line 2630  sub update_user_data { Line 2646  sub update_user_data {
                     $changeHash{'inststatus'} = $newinststatus;                      $changeHash{'inststatus'} = $newinststatus;
                     if ($newinststatus ne $oldinststatus) {                      if ($newinststatus ne $oldinststatus) {
                         $changed{'inststatus'} = $newinststatus;                          $changed{'inststatus'} = $newinststatus;
                           ($newdefquota,$newsettingstatus) =
                               &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
                     }                      }
                     if (ref($usertypes) eq 'HASH') {                      if (ref($usertypes) eq 'HASH') {
                         $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));                           $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); 
                     } else {                      } else {
                         $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));                          $newsettings{'inststatus'} = join(', ',@inststatuses);
                     }  
                 } else {  
                     $newinststatus = '';  
                     $changeHash{'inststatus'} = $newinststatus;  
                     $newinststatuses = $othertitle;  
                     if ($newinststatus ne $oldinststatus) {  
                         $changed{'inststatus'} = $changeHash{'inststatus'};  
                     }                      }
                 }                  }
               } else {
                   $newinststatus = '';
                   $changeHash{'inststatus'} = $newinststatus;
                   $newsettings{'inststatus'} = $othertitle;
                   if ($newinststatus ne $oldinststatus) {
                       $changed{'inststatus'} = $changeHash{'inststatus'};
                       ($newdefquota,$newsettingstatus) =
                           &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus);
                   }
             }              }
           } elsif ($context ne 'selfcreate') {
               $canshow{'inststatus'} = 1;
               $newsettings{'inststatus'} = $oldsettings{'inststatus'};
         }          }
         $changeHash{'portfolioquota'} = $userenv{'portfolioquota'};          $changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
         if ($userenv{'portfolioquota'} ne '') {          if ($context eq 'domain') {
             $oldportfolioquota = $userenv{'portfolioquota'};              if ($userenv{'portfolioquota'} ne '') {
             if ($env{'form.customquota'} == 1) {                  $oldportfolioquota = $userenv{'portfolioquota'};
                 if ($env{'form.portfolioquota'} eq '') {                  if ($env{'form.customquota'} == 1) {
                     $newportfolioquota = 0;                      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 {                  } else {
                     $newportfolioquota = $env{'form.portfolioquota'};                      $changed{'quota'} = &quota_admin('',\%changeHash);
                     $newportfolioquota =~ s/[^\d\.]//g;                      $newportfolioquota = $newdefquota;
                 }                      $newisdefault = 1;
                 if ($newportfolioquota != $oldportfolioquota) {  
                     $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);  
                 }                  }
             } else {              } else {
                 $changed{'quota'} = &quota_admin('',\%changeHash);                  $oldisdefault = 1;
                 $newportfolioquota = $defquota;                  $oldportfolioquota = $olddefquota;
                 $newisdefault = 1;                  if ($env{'form.customquota'} == 1) {
             }                      if ($env{'form.portfolioquota'} eq '') {
         } else {                          $newportfolioquota = 0;
             $oldisdefault = 1;                      } else {
             $oldportfolioquota = $defquota;                          $newportfolioquota = $env{'form.portfolioquota'};
             if ($env{'form.customquota'} == 1) {                          $newportfolioquota =~ s/[^\d\.]//g;
                 if ($env{'form.portfolioquota'} eq '') {                      }
                     $newportfolioquota = 0;                      $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);
                 } else {                  } else {
                     $newportfolioquota = $env{'form.portfolioquota'};                      $newportfolioquota = $newdefquota;
                     $newportfolioquota =~ s/[^\d\.]//g;                      $newisdefault = 1;
                 }                  }
                 $changed{'quota'} = &quota_admin($newportfolioquota,\%changeHash);              }
               if ($oldisdefault) {
                   $oldsettingstext{'quota'} = &get_defaultquota_text($oldsettingstatus);
               }
               if ($newisdefault) {
                   $newsettingstext{'quota'} = &get_defaultquota_text($newsettingstatus);
               }
               &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 {              } else {
                 $newportfolioquota = $defquota;                  &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,
                 $newisdefault = 1;                                \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
             }              }
         }          }
         if ($oldisdefault) {          foreach my $item (@userinfo) {
             $olddefquotatext = &get_defaultquota_text($settingstatus);              if ($env{'form.c'.$item} ne $userenv{$item}) {
         }                  $namechanged{$item} = 1;
         if ($newisdefault) {              }
             $newdefquotatext = &get_defaultquota_text($settingstatus);          }
         }          $oldsettings{'quota'} = $oldportfolioquota.' Mb';
         &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,          $newsettings{'quota'} = $newportfolioquota.' Mb';
                       \%changeHash,\%changed,\%newaccess,\%newaccesstext);          if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
         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'};  
             my ($chgresult,$namechgresult);              my ($chgresult,$namechgresult);
             if (keys(%changed) > 0) {              if (keys(%changed) > 0) {
                 $chgresult =                   $chgresult = 
Line 2725  sub update_user_data { Line 2743  sub update_user_data {
                                 $newenvhash{'environment.requestcourses.'.$key} =                                  $newenvhash{'environment.requestcourses.'.$key} =
                                     $changeHash{'requestcourses.'.$key};                                      $changeHash{'requestcourses.'.$key};
                                 if ($changeHash{'requestcourses.'.$key} ne '') {                                  if ($changeHash{'requestcourses.'.$key} ne '') {
                                     $newenvhash{'environment.canrequest.'.$key} =                                      $newenvhash{'environment.canrequest.'.$key} = 1;
                                         $changeHash{'requestcourses.'.$key};  
                                 } else {                                  } else {
                                     $newenvhash{'environment.canrequest.'.$key} =                                      $newenvhash{'environment.canrequest.'.$key} =
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},            &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
Line 2740  sub update_user_data { Line 2757  sub update_user_data {
                                         $changeHash{'tools.'.$key};                                          $changeHash{'tools.'.$key};
                                 } else {                                  } else {
                                     $newenvhash{'environment.availabletools.'.$key} =                                      $newenvhash{'environment.availabletools.'.$key} =
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},            &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},                                            $key,'reload','tools');
                                             $key,'reload','tools');  
                                 }                                  }
                             }                              }
                         }                          }
Line 2751  sub update_user_data { Line 2767  sub update_user_data {
                     }                      }
                 }                  }
             }              }
             if ($namechanged) {              if (keys(%namechanged) > 0) {
             # Make the change                  foreach my $field (@userinfo) {
                       $changeHash{$field}  = $env{'form.c'.$field};
                   }
   # Make the change
                 $namechgresult =                  $namechgresult =
                     &Apache::lonnet::modifyuser($env{'form.ccdomain'},                      &Apache::lonnet::modifyuser($env{'form.ccdomain'},
                         $env{'form.ccuname'},$changeHash{'id'},undef,undef,                          $env{'form.ccuname'},$changeHash{'id'},undef,undef,
                         $changeHash{'firstname'},$changeHash{'middlename'},                          $changeHash{'firstname'},$changeHash{'middlename'},
                         $changeHash{'lastname'},$changeHash{'generation'},                          $changeHash{'lastname'},$changeHash{'generation'},
                         $changeHash{'id'},undef,$changeHash{'permanentemail'});                          $changeHash{'id'},undef,$changeHash{'permanentemail'},undef,\@userinfo);
                 %userupdate = (                  %userupdate = (
                                lastname   => $env{'form.clastname'},                                 lastname   => $env{'form.clastname'},
                                middlename => $env{'form.cmiddlename'},                                 middlename => $env{'form.cmiddlename'},
Line 2767  sub update_user_data { Line 2786  sub update_user_data {
                                id         => $env{'form.cid'},                                 id         => $env{'form.cid'},
                              );                               );
             }              }
             if (($namechanged && $namechgresult eq 'ok') ||               if (((keys(%namechanged) > 0) && $namechgresult eq 'ok') || 
                 ((keys(%changed) > 0) && $chgresult eq 'ok')) {                  ((keys(%changed) > 0) && $chgresult eq 'ok')) {
             # Tell the user we changed the name              # Tell the user we changed the name
  my %lt=&Apache::lonlocal::texthash(                  &display_userinfo($r,1,\@disporder,\%canshow,\@requestcourses,
                              'uic'        => 'User Information Changed',                                    \@usertools,\%userenv,\%changed,\%namechanged,
                              'frst'       => 'First Name',                                    \%oldsettings, \%oldsettingstext,\%newsettings,
                              'mddl'       => 'Middle Name',                                    \%newsettingstext);
                              '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 />');  
                 if ($env{'form.cid'} ne $userenv{'id'}) {                  if ($env{'form.cid'} ne $userenv{'id'}) {
                     &Apache::lonnet::idput($env{'form.ccdomain'},                      &Apache::lonnet::idput($env{'form.ccdomain'},
                          ($env{'form.ccuname'} => $env{'form.cid'}));                           ($env{'form.ccuname'} => $env{'form.cid'}));
Line 2925  END Line 2818  END
                       $env{'form.ccuname'}.' '.&mt('in domain').' '.                        $env{'form.ccuname'}.' '.&mt('in domain').' '.
                       $env{'form.ccdomain'}.'</span><br />');                        $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,              # They did not want to change the users name, quota, tool availability,
             # or ability to request creation of courses,               # or ability to request creation of courses, 
             # but we can still tell them what the name and quota and availabilities are                # but we can still tell them what the name and quota and availabilities are  
     my %lt=&Apache::lonlocal::texthash(              &display_userinfo($r,undef,\@disporder,\%canshow,\@requestcourses,
                            'id'         => "Student/Employee ID",                                \@usertools,\%userenv,\%changed,\%namechanged,\%oldsettings,
                            'mail'       => "Permanent e-mail address",                                \%oldsettingstext,\%newsettings,\%newsettingstext);
                            '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>');  
         }          }
         if (@mod_disallowed) {          if (@mod_disallowed) {
             my ($rolestr,$contextname);              my ($rolestr,$contextname);
Line 3019  END Line 2871  END
         $r->print('</a></p>');          $r->print('</a></p>');
     } else {      } else {
         my @rolechanges = &update_roles($r,$context);          my @rolechanges = &update_roles($r,$context);
         if ($namechanged) {          if (keys(%namechanged) > 0) {
             if ($context eq 'course') {              if ($context eq 'course') {
                 if (@userroles > 0) {                  if (@userroles > 0) {
                     if ((@rolechanges == 0) ||                       if ((@rolechanges == 0) || 
Line 3047  END Line 2899  END
     }      }
 }  }
   
   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 {  sub tool_changes {
     my ($context,$usertools,$oldaccess,$oldaccesstext,$userenv,$changeHash,      my ($context,$usertools,$oldaccess,$oldaccesstext,$userenv,$changeHash,
         $changed,$newaccess,$newaccesstext) = @_;          $changed,$newaccess,$newaccesstext) = @_;
Line 3476  sub update_roles { Line 3458  sub update_roles {
  }   }
     } # End of foreach (keys(%env))      } # End of foreach (keys(%env))
 # Flush the course logs so reverse user roles immediately updated  # Flush the course logs so reverse user roles immediately updated
     &Apache::lonnet::flushcourselogs();      $r->register_cleanup(\&Apache::lonnet::flushcourselogs);
     if (@rolechanges == 0) {      if (@rolechanges == 0) {
         $r->print(&mt('No roles to modify'));          $r->print(&mt('No roles to modify'));
     }      }
Line 3677  sub custom_role_editor { Line 3659  sub custom_role_editor {
  &print_username_entry_form($r,undef,undef,undef,undef,$crstype,$brcrum);   &print_username_entry_form($r,undef,undef,undef,undef,$crstype,$brcrum);
         return;          return;
     }      }
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     my $title = 'User Management';  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
 # ------------------------------------------------------- What can be assigned?  # ------------------------------------------------------- What can be assigned?
     my %full=();      my %full=();
     my %courselevel=();      my %courselevel=();
Line 3954  sub set_custom_role { Line 3930  sub set_custom_role {
                  .$jsback."\n"                   .$jsback."\n"
                  .'// ]]>'."\n"                   .'// ]]>'."\n"
                  .'</script>'."\n";                   .'</script>'."\n";
     my $bread_crumbs_component = 'User Management';  
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $bread_crumbs_component = 'Enrollment and Student Activity';  
         }  
     }  
   
     push(@{$brcrum},      push(@{$brcrum},
         {href => "javascript:backPage(document.customresult,'pickrole','')",          {href => "javascript:backPage(document.customresult,'pickrole','')",
          text => "Pick custom role",           text => "Pick custom role",
Line 3978  sub set_custom_role { Line 3946  sub set_custom_role {
          help => 'Course_Editing_Custom_Roles'},           help => 'Course_Editing_Custom_Roles'},
         );          );
     my $args = { bread_crumbs           => $brcrum,      my $args = { bread_crumbs           => $brcrum,
                  bread_crumbs_component => $bread_crumbs_component };                   bread_crumbs_component => 'User Management'}; 
     $r->print(&Apache::loncommon::start_page('Save Custom Role',$jscript,$args));      $r->print(&Apache::loncommon::start_page('Save Custom Role',$jscript,$args));
   
     my ($rdummy,$roledef)=      my ($rdummy,$roledef)=
Line 4055  sub handler { Line 4023  sub handler {
     } else {      } else {
         $context = 'domain';          $context = 'domain';
     }      }
     my ($permission,$allowed) =  
         &Apache::lonuserutils::get_permission($context,$crstype);  
     if (!$allowed) {  
         $env{'user.error.msg'}=  
             "/adm/createuser:cst:0:0:Cannot create/modify user data ".  
                                  "or view user status.";  
         return HTTP_NOT_ACCEPTABLE;  
     }  
   
     &Apache::loncommon::content_type($r,'text/html');  
     $r->send_http_header;  
   
     my $title = 'User Management';  
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($context eq 'course') {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
         ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',          ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
          'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);           'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     my $args;      my $args;
     my $brcrum = [];      my $brcrum = [];
     my $bread_crumbs_component = $title;      my $bread_crumbs_component = 'User Management';
     if ($env{'form.context'} eq 'requestcrs') {      if ($env{'form.action'} ne 'dateselect') {
         my $reqstate = 'uploadroster';  
         if ($env{'form.state'} eq 'enrolling') {  
             $reqstate = 'enrolling';  
         }  
         unless (&Apache::lonrequestcourse::generate_page($r,'new',$reqstate)) {  
             return OK;  
         }  
     } elsif ($env{'form.action'} ne 'dateselect') {  
         $brcrum = [{href=>"/adm/createuser",          $brcrum = [{href=>"/adm/createuser",
                     text=>$title,                      text=>"User Management",
                     help=>'Course_Create_Class_List,Course_Change_Privileges,Course_View_Class_List,Course_Editing_Custom_Roles,Course_Add_Student,Course_Drop_Student,Course_Automated_Enrollment,Course_Self_Enrollment,Course_Manage_Group'}                      help=>'Course_Create_Class_List,Course_Change_Privileges,Course_View_Class_List,Course_Editing_Custom_Roles,Course_Add_Student,Course_Drop_Student,Course_Automated_Enrollment,Course_Self_Enrollment,Course_Manage_Group'}
                   ];                    ];
     }      }
     #SD Following files not added to help, because the corresponding .tex-files seem to      #SD Following files not added to help, because the corresponding .tex-files seem to
     #be missing: Course_Approve_Selfenroll,Course_User_Logs,      #be missing: Course_Approve_Selfenroll,Course_User_Logs,
       my ($permission,$allowed) = 
           &Apache::lonuserutils::get_permission($context,$crstype);
       if (!$allowed) {
           $env{'user.error.msg'}=
               "/adm/createuser:cst:0:0:Cannot create/modify user data ".
                                    "or view user status.";
           return HTTP_NOT_ACCEPTABLE;
       }
   
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
   
     # Main switch on form.action and form.state, as appropriate      # Main switch on form.action and form.state, as appropriate
     if (! exists($env{'form.action'})) {      if (! exists($env{'form.action'})) {
         $args = {bread_crumbs => $brcrum,          $args = {bread_crumbs => $brcrum,
                  bread_crumbs_component => $bread_crumbs_component};                   bread_crumbs_component => $bread_crumbs_component}; 
         $r->print(&header(undef,$args));          $r->print(&header(undef,$args));
         $r->print(&print_main_menu($permission,$context,$crstype));          $r->print(&print_main_menu($permission,$context,$crstype));
     } elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {      } elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
         unless ($env{'form.context'} eq 'requestcrs') {          push(@{$brcrum},
             push(@{$brcrum},                { href => '/adm/createuser?action=upload&state=',
                   { href => '/adm/createuser?action=upload&state=',                  text => 'Upload Users List',
                     text => 'Upload Users List',                  help => 'Course_Create_Class_List',
                     help => 'Course_Create_Class_List',                });
                   });          $bread_crumbs_component = 'Upload Users List';
             $bread_crumbs_component = 'Upload Users List';          $args = {bread_crumbs           => $brcrum,
             $args = {bread_crumbs           => $brcrum,                   bread_crumbs_component => $bread_crumbs_component};
                      bread_crumbs_component => $bread_crumbs_component};          $r->print(&header(undef,$args));
             $r->print(&header(undef,$args));          $r->print('<form name="studentform" method="post" '.
         }                    'enctype="multipart/form-data" '.
         unless (($env{'form.context'} eq 'requestcrs') && ($env{'form.state'} eq 'enrolling')) {                    ' action="/adm/createuser">'."\n");
             $r->print('<form name="studentform" method="post" '.  
                       'enctype="multipart/form-data" '.  
                       ' action="/adm/createuser">'."\n");  
         }  
         if (! exists($env{'form.state'})) {          if (! exists($env{'form.state'})) {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);              &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         } elsif ($env{'form.state'} eq 'got_file') {          } elsif ($env{'form.state'} eq 'got_file') {
             my $formname;  
             if ($env{'form.context'} eq 'requestcrs') {  
                 $formname = 'studentform';  
             }  
             &Apache::lonuserutils::print_upload_manager_form($r,$context,              &Apache::lonuserutils::print_upload_manager_form($r,$context,
                                                              $permission,$crstype,$formname);                                                               $permission,$crstype);
             if ($env{'form.context'} eq 'requestcrs') {  
                 $r->print('<input type="hidden" name="concepttest" value="'.$env{'form.concepttest'}.'" />');  
             }  
         } elsif ($env{'form.state'} eq 'enrolling') {          } elsif ($env{'form.state'} eq 'enrolling') {
             if ($env{'form.datatoken'}) {              if ($env{'form.datatoken'}) {
                 &Apache::lonuserutils::upfile_drop_add($r,$context,$permission);                  &Apache::lonuserutils::upfile_drop_add($r,$context,$permission);
                 if ($env{'form.context'} eq 'requestcrs') {  
                     $r->print('<br /><hr />'.  
                               '<form name="requestcrs" method="post" action="/adm/requestcourse">'.  
                               '<input type="hidden" name="context" value="'.$env{'form.context'}.'" />'.  
                               '<input type="hidden" name="concepttest" value="'.$env{'form.concepttest'}.'" />'.  
                               '<input type="hidden" name="reqaction" value="new" />'.  
                               '<input type="hidden" name="state" value="'.$env{'form.state'}.'" />'.  
                               &Apache::lonrequestcourse::done_display());  
                 }  
             }              }
         } else {          } else {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);              &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         }          }
         $r->print('</form>');  
     } elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}      } elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
              eq 'singlestudent')) && ($permission->{'cusr'})) {               eq 'singlestudent')) && ($permission->{'cusr'})) {
         my $phase = $env{'form.phase'};          my $phase = $env{'form.phase'};
Line 4164  sub handler { Line 4095  sub handler {
             if ($env{'form.phase'} eq 'createnewuser') {              if ($env{'form.phase'} eq 'createnewuser') {
                 my $response;                  my $response;
                 if ($env{'form.srchterm'} !~ /^$match_username$/) {                  if ($env{'form.srchterm'} !~ /^$match_username$/) {
                     my $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>';                      my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
                     $env{'form.phase'} = '';                      $env{'form.phase'} = '';
                     &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum);                      &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum);
                 } else {                  } else {
Line 4172  sub handler { Line 4103  sub handler {
                     my $ccdomain=&LONCAPA::clean_domain($srch->{'srchdomain'});                      my $ccdomain=&LONCAPA::clean_domain($srch->{'srchdomain'});
                     &print_user_modification_page($r,$ccuname,$ccdomain,                      &print_user_modification_page($r,$ccuname,$ccdomain,
                                                   $srch,$response,$context,                                                    $srch,$response,$context,
                                                   $permission,$crstype);                                                    $permission,$crstype,$brcrum);
                 }                  }
             } elsif ($env{'form.phase'} eq 'get_user_info') {              } elsif ($env{'form.phase'} eq 'get_user_info') {
                 my ($currstate,$response,$forcenewuser,$results) =                   my ($currstate,$response,$forcenewuser,$results) = 
Line 4182  sub handler { Line 4113  sub handler {
                 }                  }
                 if ($currstate eq 'select') {                  if ($currstate eq 'select') {
                     &print_user_selection_page($r,$response,$srch,$results,                      &print_user_selection_page($r,$response,$srch,$results,
                                                \@search,$context,undef,$crstype);                                                 \@search,$context,undef,$crstype,
                                                  $brcrum);
                 } elsif ($currstate eq 'modify') {                  } elsif ($currstate eq 'modify') {
                     my ($ccuname,$ccdomain);                      my ($ccuname,$ccdomain);
                     if (($srch->{'srchby'} eq 'uname') &&                       if (($srch->{'srchby'} eq 'uname') && 
Line 4212  sub handler { Line 4144  sub handler {
                 my $ccuname = &LONCAPA::clean_username($env{'form.seluname'});                  my $ccuname = &LONCAPA::clean_username($env{'form.seluname'});
                 my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'});                  my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'});
                 &print_user_modification_page($r,$ccuname,$ccdomain,$srch,'',                  &print_user_modification_page($r,$ccuname,$ccdomain,$srch,'',
                                               $context,$permission,$crstype,$brcrum);                                                $context,$permission,$crstype,
                                                 $brcrum);
             }              }
         } elsif ($env{'form.phase'} eq 'update_user_data') {          } elsif ($env{'form.phase'} eq 'update_user_data') {
             &update_user_data($r,$context,$crstype,$brcrum);              &update_user_data($r,$context,$crstype,$brcrum);
         } else {          } else {
             &print_username_entry_form($r,$context,undef,$srch,undef,$crstype,$brcrum);              &print_username_entry_form($r,$context,undef,$srch,undef,$crstype,
                                          $brcrum);
         }          }
     } elsif ($env{'form.action'} eq 'custom' && $permission->{'custom'}) {      } elsif ($env{'form.action'} eq 'custom' && $permission->{'custom'}) {
         if ($env{'form.phase'} eq 'set_custom_roles') {          if ($env{'form.phase'} eq 'set_custom_roles') {
Line 4240  sub handler { Line 4174  sub handler {
             $r->print(&header(undef,$args));              $r->print(&header(undef,$args));
             my $setting = $env{'form.roletype'};              my $setting = $env{'form.roletype'};
             my $choice = $env{'form.bulkaction'};              my $choice = $env{'form.bulkaction'};
             $r->print(&Apache::lonhtmlcommon::breadcrumbs("Update Users",  
                                                           'Course_View_Class_List'));  
             if ($permission->{'cusr'}) {              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 {              } else {
                 $r->print(&mt('You are not authorized to make bulk changes to user roles'));                  $r->print(&mt('You are not authorized to make bulk changes to user roles'));
                 $r->print('<p><a href="/adm/createuser?action=listusers">'.&mt('Display User Lists').'</a>');                  $r->print('<p><a href="/adm/createuser?action=listusers">'.&mt('Display User Lists').'</a>');
Line 4277  sub handler { Line 4208  sub handler {
                 }                  }
                 $jscript .= &verify_user_display();                  $jscript .= &verify_user_display();
                 my $js = &add_script($jscript).$cb_jscript;                  my $js = &add_script($jscript).$cb_jscript;
                 my $loadcode =                  my $loadcode = 
                     &Apache::lonuserutils::course_selector_loadcode($formname);                      &Apache::lonuserutils::course_selector_loadcode($formname);
                 if ($loadcode ne '') {                  if ($loadcode ne '') {
                     $args->{add_entries} = {onload => $loadcode};                      $args->{add_entries} = {onload => $loadcode};
Line 4307  sub handler { Line 4238  sub handler {
         }          }
         $bread_crumbs_component = $brtext;          $bread_crumbs_component = $brtext;
         $args = {bread_crumbs           => $brcrum,          $args = {bread_crumbs           => $brcrum,
                  bread_crumbs_component => $bread_crumbs_component};                   bread_crumbs_component => $bread_crumbs_component}; 
         $r->print(&header(undef,$args));          $r->print(&header(undef,$args));
         if (!exists($env{'form.state'})) {          if (!exists($env{'form.state'})) {
             &Apache::lonuserutils::print_drop_menu($r,$context,$permission,$crstype);              &Apache::lonuserutils::print_drop_menu($r,$context,$permission,$crstype);
Line 4317  sub handler { Line 4248  sub handler {
         }          }
     } elsif ($env{'form.action'} eq 'dateselect') {      } elsif ($env{'form.action'} eq 'dateselect') {
         if ($permission->{'cusr'}) {          if ($permission->{'cusr'}) {
             $r->print(&header(undef,undef,{'no_nav_bar' => 1}).              $r->print(&header(undef,{'no_nav_bar' => 1}).
                       &Apache::lonuserutils::date_section_selector($context,                        &Apache::lonuserutils::date_section_selector($context,
                                                                    $permission,$crstype));                                                                     $permission,$crstype));
         } else {          } else {
             $r->print(&header().              $r->print(&header(undef,{'no_nav_bar' => 1}).
                      '<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>');                       '<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>'); 
         }          }
     } elsif ($env{'form.action'} eq 'selfenroll') {      } elsif ($env{'form.action'} eq 'selfenroll') {
         push(@{$brcrum},          push(@{$brcrum},
Line 4385  sub handler { Line 4316  sub handler {
         $r->print(&header(undef,$args));          $r->print(&header(undef,$args));
         &print_userchangelogs_display($r,$context,$permission);          &print_userchangelogs_display($r,$context,$permission);
     } else {      } else {
           $bread_crumbs_component = 'User Management';
         $args = { bread_crumbs           => $brcrum,          $args = { bread_crumbs           => $brcrum,
                   bread_crumbs_component => $bread_crumbs_component};                    bread_crumbs_component => $bread_crumbs_component};
         $r->print(&header(undef,$args));          $r->print(&header(undef,$args));
Line 4396  sub handler { Line 4328  sub handler {
   
 sub header {  sub header {
     my ($jscript,$args) = @_;      my ($jscript,$args) = @_;
     my $title = 'User Management';  
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if ($env{'request.course.id'}) {  
         if ($is_custom) {  
             $title = 'Enrollment and Student Activity';  
         }  
     }  
     my $start_page;      my $start_page;
     if (ref($args) eq 'HASH') {      if (ref($args) eq 'HASH') {
         $start_page=&Apache::loncommon::start_page($title,$jscript,$args);          $start_page=&Apache::loncommon::start_page('User Management',$jscript,$args);
     } else {      } else {
         $start_page=&Apache::loncommon::start_page($title,$jscript);          $start_page=&Apache::loncommon::start_page('User Management',$jscript);
     }      }
     return $start_page;      return $start_page;
 }  }
Line 4440  END Line 4365  END
 #  Menu Phase One  #  Menu Phase One
 sub print_main_menu {  sub print_main_menu {
     my ($permission,$context,$crstype) = @_;      my ($permission,$context,$crstype) = @_;
     my $is_custom = &Apache::loncommon::needs_gci_custom();  
     if (($context eq 'course') && ($is_custom)) {  
         return &print_gci_main_menu($permission,$context,$crstype)  
     }  
     my $linkcontext = $context;      my $linkcontext = $context;
     my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));      my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));
     if (($context eq 'course') && ($crstype eq 'Community')) {      if (($context eq 'course') && ($crstype eq 'Community')) {
Line 4464  sub print_main_menu { Line 4385  sub print_main_menu {
                 course => {                  course => {
                             upload     => 'Upload a File of Course Users',                              upload     => 'Upload a File of Course Users',
                             singleuser => 'Add/Modify a Course User',                              singleuser => 'Add/Modify a Course User',
                             listusers  => 'Manage Course Users',                              listusers  => 'List and Modify Multiple Course Users',
                             },                              },
                 community => {                  community => {
                             upload     => 'Upload a File of Community Users',                              upload     => 'Upload a File of Community Users',
                             singleuser => 'Add/Modify a Community User',                              singleuser => 'Add/Modify a Community User',
                             listusers  => 'Manage Community Users',                              listusers  => 'List and Modify Multiple Community Users',
                            },                             },
                 );                  );
      my %linktitles = (       my %linktitles = (
Line 4508  sub print_main_menu { Line 4429  sub print_main_menu {
          [           [
             {              {
              linktext => $links{$linkcontext}{'upload'},               linktext => $links{$linkcontext}{'upload'},
              icon => 'sctr.png',               icon => 'uplusr.png',
              #help => 'Course_Create_Class_List',               #help => 'Course_Create_Class_List',
              url => '/adm/createuser?action=upload',               url => '/adm/createuser?action=upload',
              permission => $permission->{'cusr'},               permission => $permission->{'cusr'},
Line 4516  sub print_main_menu { Line 4437  sub print_main_menu {
             },              },
             {              {
              linktext => $links{$linkcontext}{'listusers'},               linktext => $links{$linkcontext}{'listusers'},
              icon => 'edit-find.png',               icon => 'mngcu.png',
              #help => 'Course_View_Class_List',               #help => 'Course_View_Class_List',
              url => '/adm/createuser?action=listusers',               url => '/adm/createuser?action=listusers',
              permission => ($permission->{'view'} || $permission->{'cusr'}),               permission => ($permission->{'view'} || $permission->{'cusr'}),
Line 4603  sub print_main_menu { Line 4524  sub print_main_menu {
             },              },
             {              {
              linktext => $linktext{$crstype}{'groups'},               linktext => $linktext{$crstype}{'groups'},
              icon => 'conf.png',               icon => 'grps.png',
              #help => 'Course_Manage_Group',               #help => 'Course_Manage_Group',
              url => '/adm/coursegroups?refpage=cusr',               url => '/adm/coursegroups?refpage=cusr',
              permission => $permission->{'grp_manage'},               permission => $permission->{'grp_manage'},
Line 4648  sub print_main_menu { Line 4569  sub print_main_menu {
             push(@{ $menu[2]->{items} },               push(@{ $menu[2]->{items} }, 
                 {                  {
                  linktext => 'User Self-Enrollment',                   linktext => 'User Self-Enrollment',
                  icon => 'cstr.png',                   icon => 'self_enroll.png',
                  #help => 'Course_Self_Enrollment',                   #help => 'Course_Self_Enrollment',
                  url => '/adm/createuser?action=selfenroll',                   url => '/adm/createuser?action=selfenroll',
                  permission => $permission->{'cusr'},                   permission => $permission->{'cusr'},
Line 4665  return Apache::lonhtmlcommon::generate_m Line 4586  return Apache::lonhtmlcommon::generate_m
 #               });  #               });
 }  }
   
 sub print_gci_main_menu {  
     my ($permission,$context,$crstype) = @_;  
     my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));  
     my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();  
     my %links = (  
         course => {  
                     single     => 'Add/Modify a Student',  
                     drop       => 'Drop Students',  
                     upload     => 'Upload a File of Course Users',  
                     singleuser => 'Add/Modify a Course User',  
                     listusers  => 'Concept Test Roster and Student Activity',  
                   },  
      );  
      my %linktitles = (  
         course => {  
                     singleuser => 'Add a user with a certain role to this course.',  
                     listusers  => 'Show and manage users in this course.',  
                     single     => 'Add a user with the role of student to this course',  
                     drop       => 'Remove a student from this course.',  
                     upload     => 'Upload a CSV or a text file containing users.',   
                   },  
     );  
     my @menu = ( {categorytitle => 'Manage Users',  
          items =>  
          [  
             {  
              linktext => $links{$context}{'single'},  
              #help => 'Course_Add_Student',  
              icon => 'list-add.png',  
              url => '/adm/createuser?action=singlestudent',  
              permission => $permission->{'cusr'},  
              linktitle => $linktitles{$context}{'single'},  
   
             },  
             {  
              linktext => $links{$context}{'drop'},  
              icon => 'edit-undo.png',  
              #help => 'Course_Drop_Student',  
              url => '/adm/createuser?action=drop',  
              permission => $permission->{'cusr'},  
              linktitle => $linktitles{$context}{'drop'},  
             },  
             {  
              linktext => $links{$context}{'upload'},  
              icon => 'sctr.png',  
              #help => 'Course_Create_Class_List',  
              url => '/adm/createuser?action=upload',  
              permission => $permission->{'cusr'},  
              linktitle => $linktitles{$context}{'upload'},  
             },  
             {  
              linktext => $links{$context}{'listusers'},  
              icon => 'edit-find.png',  
              #help => 'Course_View_Class_List',  
              url => '/adm/createuser?action=listusers',  
              permission => ($permission->{'view'} || $permission->{'cusr'}),  
              linktitle => $linktitles{$context}{'listusers'},  
             },  
          ]},  
          {categorytitle => 'Administration',  
          items => [ ]},  
     );  
   
     push(@{ $menu[1]->{items} }, #Category: Administration  
         {  
            linktext => 'Change Log',  
            icon => 'document-properties.png',  
            #help => 'Course_User_Logs',  
            url => '/adm/createuser?action=changelogs',  
            permission => $permission->{'cusr'},  
            linktitle => 'View change log.',  
          },  
     );  
     return Apache::lonhtmlcommon::generate_menu(@menu);  
 }  
   
 sub restore_prev_selections {  sub restore_prev_selections {
     my %saveable_parameters = ('srchby'   => 'scalar',      my %saveable_parameters = ('srchby'   => 'scalar',
        'srchin'   => 'scalar',         'srchin'   => 'scalar',
Line 5150  ENDSCRIPT Line 4995  ENDSCRIPT
                                    '<input type="checkbox" name="selfenroll_notify"'.$notifyon.' value="'.$cc.'" />'.                                     '<input type="checkbox" name="selfenroll_notify"'.$notifyon.' value="'.$cc.'" />'.
                                    &Apache::loncommon::plainname($ccuname,$ccudom).                                     &Apache::loncommon::plainname($ccuname,$ccudom).
                                    '</label></span></td>';                                     '</label></span></td>';
                         $count;                          $count ++;
                     }                      }
                     my $rem = $count%$numcols;                      my $rem = $count%$numcols;
                     if ($rem) {                      if ($rem) {
Line 5167  ENDSCRIPT Line 5012  ENDSCRIPT
                 my $cid = $env{'request.course.id'};                  my $cid = $env{'request.course.id'};
                 my $currlim = $env{'course.'.$cid.'.internal.selfenroll_limit'};                  my $currlim = $env{'course.'.$cid.'.internal.selfenroll_limit'};
                 my $currcap = $env{'course.'.$cid.'.internal.selfenroll_cap'};                  my $currcap = $env{'course.'.$cid.'.internal.selfenroll_cap'};
                 my $nolimit = ' checked="checked" ';                  $nolimit = ' checked="checked" ';
                 if ($currlim eq 'allstudents') {                  if ($currlim eq 'allstudents') {
                     $crslimit = ' checked="checked" ';                      $crslimit = ' checked="checked" ';
                     $selflimit = ' ';                      $selflimit = ' ';
Line 5223  sub visible_in_cat { Line 5068  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_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.',                     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{'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]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{'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]Set course environment[_2] to assign a category to the course.','"<a href="/adm/parmset?action=crsenv">','</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 (ref($domconf{'coursecategories'}) eq 'HASH') {
         if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {          if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
             $settable{'togglecats'} = 1;              $settable{'togglecats'} = 1;
Line 5705  sub role_display_filter { Line 5550  sub role_display_filter {
     # Update Display button      # Update Display button
     $output .= '<p>'      $output .= '<p>'
               .'<input type="submit" value="'.&mt('Update Display').'" />'                .'<input type="submit" value="'.&mt('Update Display').'" />'
               .'</p><hr />';                .'</p>';
   
       # Server version info
       $output .= '<p class="LC_info">'
                 .&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.'
                     ,'2.6.99.0');
       if ($version) {
           $output .= ' '.&mt('This LON-CAPA server is version [_1]',$version);
       }
       $output .= '</p><hr />';
     return $output;      return $output;
 }  }
   
Line 5755  sub user_search_result { Line 5609  sub user_search_result {
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
         if (($srch->{'srchdomain'} eq '') ||           if (($srch->{'srchdomain'} eq '') || 
     ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {      ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {
             $response = '<p class="LC_warning">'.&mt('You must specify a valid domain when searching in a domain or institutional directory.').'</p>';              $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.')
         }          }
     }      }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
Line 5768  sub user_search_result { Line 5622  sub user_search_result {
                 }                  }
             }              }
             if ($unamecheck !~ /^$match_username$/) {              if ($unamecheck !~ /^$match_username$/) {
                 $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>';                  $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
             }              }
         }          }
     }      }
Line 5943  sub user_search_result { Line 5797  sub user_search_result {
                 ($currstate,$response,$forcenewuser) =                   ($currstate,$response,$forcenewuser) = 
                     &build_search_response($context,$srch,%srch_results);                      &build_search_response($context,$srch,%srch_results);
             } else {              } else {
                 my $showdom = &display_domain_info($srch->{'srchdomain'});                  my $showdom = &display_domain_info($srch->{'srchdomain'});                $response = '<span class="LC_warning">'.
                 $response = '<span class="LC_warning">'.  
                     &mt('Institutional directory search is not available in domain: [_1]',$showdom).                      &mt('Institutional directory search is not available in domain: [_1]',$showdom).
                     '</span><br />'.                      '</span><br />'.
                     &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').                      &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
Line 6055  sub build_search_response { Line 5908  sub build_search_response {
     my ($context,$srch,%srch_results) = @_;      my ($context,$srch,%srch_results) = @_;
     my ($currstate,$response,$forcenewuser);      my ($currstate,$response,$forcenewuser);
     my %names = (      my %names = (
           'uname' => 'username',            'uname'     => 'username',
           'lastname' => 'last name',            'lastname'  => 'last name',
           'lastfirst' => 'last name, first name',            'lastfirst' => 'last name, first name',
           'crs' => 'this course',            'crs'       => 'this course',
           'dom' => 'LON-CAPA domain: ',            'dom'       => 'LON-CAPA domain',
           'instd' => 'the institutional directory for domain: ',            'instd'     => 'the institutional directory for domain',
     );      );
   
     my %single = (      my %single = (
Line 6080  sub build_search_response { Line 5933  sub build_search_response {
             $currstate = 'modify';              $currstate = 'modify';
             $response = &mt("$single{$srch->{'srchtype'}} was found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});              $response = &mt("$single{$srch->{'srchtype'}} was found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});
             if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {              if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {
                 $response .= &display_domain_info($srch->{'srchdomain'});                  $response .= ': '.&display_domain_info($srch->{'srchdomain'});
             }              }
         } else {          } else { # Search has nothing found. Prepare message to user.
             $response = '<span class="LC_warning">'.&mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}",$srch->{'srchterm'});              $response = '<span class="LC_warning">';
             if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {              if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {
                 $response .= &display_domain_info($srch->{'srchdomain'});                  $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}: [_2]",
                                    '<b>'.$srch->{'srchterm'}.'</b>',
                                    &display_domain_info($srch->{'srchdomain'}));
               } else {
                   $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}.",
                                    '<b>'.$srch->{'srchterm'}.'</b>');
             }              }
             $response .= '</span>';              $response .= '</span>';
   
             if ($srch->{'srchin'} ne 'alc') {              if ($srch->{'srchin'} ne 'alc') {
                 $forcenewuser = 1;                  $forcenewuser = 1;
                 my $cansrchinst = 0;                   my $cansrchinst = 0; 
Line 6459  sub update_selfenroll_config { Line 6318  sub update_selfenroll_config {
                             $newnum ++;                              $newnum ++;
                         }                          }
                     }                      }
                     for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) {                        if ((!grep(/^$j$/,@deletedoms)) && (!grep(/^$j$/,@activations))) {                      for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) {
                           if ((!grep(/^$j$/,@deletedoms)) && (!grep(/^$j$/,@activations))) {
                             my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$j);                              my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$j);
                             if (@types > 0) {                              if (@types > 0) {
                                 @types = sort(@types);                                  @types = sort(@types);
Line 6771  sub is_courseowner { Line 6631  sub is_courseowner {
     }      }
     if ($courseowner ne '') {      if ($courseowner ne '') {
         if ($courseowner eq $env{'user.name'}.':'.$env{'user.domain'}) {          if ($courseowner eq $env{'user.name'}.':'.$env{'user.domain'}) {
                 return 1;              return 1;
         }          }
     }      }
     return;      return;

Removed from v.1.329.2.7  
changed lines
  Added in v.1.354


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>