Diff for /loncom/interface/loncreateuser.pm between versions 1.406.2.7 and 1.418

version 1.406.2.7, 2016/11/13 15:47:04 version 1.418, 2016/11/09 16:35:46
Line 252  sub build_tools_display { Line 252  sub build_tools_display {
                    'unofficial' => 'Can request creation of unofficial courses',                     'unofficial' => 'Can request creation of unofficial courses',
                    'community'  => 'Can request creation of communities',                     'community'  => 'Can request creation of communities',
                    'textbook'   => 'Can request creation of textbook courses',                     'textbook'   => 'Can request creation of textbook courses',
                      'placement'  => 'Can request creation of placement tests',
                    'requestauthor'  => 'Can request author space',                     'requestauthor'  => 'Can request author space',
     );      );
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                       'requestcourses.official','requestcourses.unofficial',                        'requestcourses.official','requestcourses.unofficial',
                       'requestcourses.community','requestcourses.textbook');                        'requestcourses.community','requestcourses.textbook',
         @usertools = ('official','unofficial','community','textbook');                        'requestcourses.placement');
           @usertools = ('official','unofficial','community','textbook','placement');
         @options =('norequest','approval','autolimit','validate');          @options =('norequest','approval','autolimit','validate');
         %validations = &Apache::lonnet::auto_courserequest_checks($ccdomain);          %validations = &Apache::lonnet::auto_courserequest_checks($ccdomain);
         %reqtitles = &courserequest_titles();          %reqtitles = &courserequest_titles();
Line 333  sub build_tools_display { Line 335  sub build_tools_display {
                    '   <td'.$colspan.'>'.$lt{$item}.'</td>'."\n".                     '   <td'.$colspan.'>'.$lt{$item}.'</td>'."\n".
                    '  </tr>'."\n".                     '  </tr>'."\n".
                    &Apache::loncommon::start_data_table_row()."\n";                     &Apache::loncommon::start_data_table_row()."\n";
     
         if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {          if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
             my ($curroption,$currlimit);              my ($curroption,$currlimit);
             my $envkey = $context.'.'.$item;              my $envkey = $context.'.'.$item;
Line 426  sub build_tools_display { Line 429  sub build_tools_display {
                           '</span>';                            '</span>';
         }          }
         $output .= '  <td'.$colspan.'>'.$custom_access.('&nbsp;'x4).          $output .= '  <td'.$colspan.'>'.$custom_access.('&nbsp;'x4).
                    $lt{'avai'}.': '.$currdisp.'</td>'."\n".                     $lt{'avai'}.': '.$currdisp.'</td>'."\n";
                    &Apache::loncommon::end_data_table_row()."\n";                     &Apache::loncommon::end_data_table_row()."\n";
         unless (&Apache::lonnet::allowed('udp',$ccdomain)) {          unless (&Apache::lonnet::allowed('udp',$ccdomain)) {
             $output .=              $output .=
Line 451  sub coursereq_externaluser { Line 454  sub coursereq_externaluser {
                    'unofficial' => 'Can request creation of unofficial courses',                     'unofficial' => 'Can request creation of unofficial courses',
                    'community'  => 'Can request creation of communities',                     'community'  => 'Can request creation of communities',
                    'textbook'   => 'Can request creation of textbook courses',                     'textbook'   => 'Can request creation of textbook courses',
                      'placement'  => 'Can request creation of placement tests',
     );      );
   
     %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,      %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
                       'reqcrsotherdom.official','reqcrsotherdom.unofficial',                        'reqcrsotherdom.official','reqcrsotherdom.unofficial',
                       'reqcrsotherdom.community','reqcrsotherdom.textbook');                        'reqcrsotherdom.community','reqcrsotherdom.textbook',
     @usertools = ('official','unofficial','community','textbook');                        'reqcrsotherdom.placement');
       @usertools = ('official','unofficial','community','textbook','placement');
     @options = ('approval','validate','autolimit');      @options = ('approval','validate','autolimit');
     %validations = &Apache::lonnet::auto_courserequest_checks($cdom);      %validations = &Apache::lonnet::auto_courserequest_checks($cdom);
     my $optregex = join('|',@options);      my $optregex = join('|',@options);
Line 615  sub courserequest_titles { Line 620  sub courserequest_titles {
                                    unofficial => 'Unofficial',                                     unofficial => 'Unofficial',
                                    community  => 'Communities',                                     community  => 'Communities',
                                    textbook   => 'Textbook',                                     textbook   => 'Textbook',
                                      placement  => 'Placement Tests',
                                    norequest  => 'Not allowed',                                     norequest  => 'Not allowed',
                                    approval   => 'Approval by Dom. Coord.',                                     approval   => 'Approval by Dom. Coord.',
                                    validate   => 'With validation',                                     validate   => 'With validation',
Line 751  sub print_username_entry_form { Line 757  sub print_username_entry_form {
     } elsif ($env{'form.action'} eq 'accesslogs') {      } elsif ($env{'form.action'} eq 'accesslogs') {
         $helpitem = 'Domain_User_Access_Logs';          $helpitem = 'Domain_User_Access_Logs';
     }      }
     my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$defdom);      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     if ($env{'form.action'} eq 'custom') {      if ($env{'form.action'} eq 'custom') {
         push(@{$brcrum},          push(@{$brcrum},
                  {href=>"javascript:backPage(document.crtuser)",                          {href=>"javascript:backPage(document.crtuser)",       
Line 779  sub print_username_entry_form { Line 785  sub print_username_entry_form {
                     'srst' => 'Search for a user and enroll as a student',                      'srst' => 'Search for a user and enroll as a student',
                     'srme' => 'Search for a user and enroll as a member',                      'srme' => 'Search for a user and enroll as a member',
                     'srad' => 'Search for a user and modify/add user information or roles',                      'srad' => 'Search for a user and modify/add user information or roles',
                     'srvu' => 'Search for a user and view user information and roles',  
                     'srva' => 'Search for a user and view access log information',                      'srva' => 'Search for a user and view access log information',
     'usr'  => "Username",      'usr'  => "Username",
                     'dom'  => "Domain",                      'dom'  => "Domain",
Line 835  sub print_username_entry_form { Line 840  sub print_username_entry_form {
             }              }
         } elsif ($env{'form.action'} eq 'accesslogs') {          } elsif ($env{'form.action'} eq 'accesslogs') {
             $actiontext = $lt{'srva'};              $actiontext = $lt{'srva'};
         } elsif (($env{'form.action'} eq 'singleuser') &&  
                  ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$defdom))) {  
             $actiontext = $lt{'srvu'};  
         }          }
         $r->print("<h3>$actiontext</h3>");          $r->print("<h3>$actiontext</h3>");
         if ($env{'form.origform'} ne 'crtusername') {          if ($env{'form.origform'} ne 'crtusername') {
Line 931  ENDBLOCK Line 933  ENDBLOCK
     } else {      } else {
         $output = '<p>'.$userpicker.'</p>';          $output = '<p>'.$userpicker.'</p>';
     }      }
     if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs') &&      if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs')) {
         (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') &&  
         (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) {  
         my $defdom=$env{'request.role.domain'};          my $defdom=$env{'request.role.domain'};
         my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');          my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
         my %lt=&Apache::lonlocal::texthash(          my %lt=&Apache::lonlocal::texthash(
Line 1050  ENDSCRIPT Line 1050  ENDSCRIPT
                                        'stusrch'        => "User Search to enroll student",                                         'stusrch'        => "User Search to enroll student",
                                        'memsrch'        => "User Search to enroll member",                                         'memsrch'        => "User Search to enroll member",
                                        'srcva'          => "Search for a user and view access log information",                                         'srcva'          => "Search for a user and view access log information",
                                        'usrvu'          => "User Search to view user roles",  
                                        'usel'           => "Select a user to add/modify roles",                                         'usel'           => "Select a user to add/modify roles",
                                        'suvr'           => "Select a user to view roles",  
                                        'stusel'         => "Select a user to enroll as a student",                                         'stusel'         => "Select a user to enroll as a student",
                                        'memsel'         => "Select a user to enroll as a member",                                         'memsel'         => "Select a user to enroll as a member",
                                        'vacsel'         => "Select a user to view access log",                                         'vacsel'         => "Select a user to view access log",
Line 1065  ENDSCRIPT Line 1063  ENDSCRIPT
     if ($context eq 'requestcrs') {      if ($context eq 'requestcrs') {
         $r->print('<div>');          $r->print('<div>');
     } else {      } else {
         my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$srch->{'srchdomain'});          my %breadcrumb_text = &singleuser_breadcrumb($crstype);
         my $helpitem;          my $helpitem;
         if ($env{'form.action'} eq 'singleuser') {          if ($env{'form.action'} eq 'singleuser') {
             $helpitem = 'Course_Change_Privileges';              $helpitem = 'Course_Change_Privileges';
Line 1085  ENDSCRIPT Line 1083  ENDSCRIPT
                   );                    );
         $r->print(&Apache::loncommon::start_page('User Management',$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') {
             my $readonly;              $r->print("<b>$lt{'usrch'}</b><br />");
             if (($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$srch->{'srchdomain'}))) {  
                 $readonly = 1;  
                 $r->print("<b>$lt{'usrvu'}</b><br />");  
             } else {  
                 $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));
             if ($readonly) {              $r->print('<h3>'.$lt{'usel'}.'</h3>');
                 $r->print('<h3>'.$lt{'suvr'}.'</h3>');  
             } else {  
                 $r->print('<h3>'.$lt{'usel'}.'</h3>');  
             }  
         } elsif ($env{'form.action'} eq 'singlestudent') {          } elsif ($env{'form.action'} eq 'singlestudent') {
             $r->print($jscript."<b>");              $r->print($jscript."<b>");
             if ($crstype eq 'Community') {              if ($crstype eq 'Community') {
Line 1291  sub print_user_modification_page { Line 1279  sub print_user_modification_page {
   
     my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,      my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
                                $groupslist,$newuser,$formname,\%loaditem);                                 $groupslist,$newuser,$formname,\%loaditem);
     my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);      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') {
         $helpitem = 'Course_Add_Student';          $helpitem = 'Course_Add_Student';
Line 1513  ENDAUTH Line 1501  ENDAUTH
         $r->print('<div class="LC_left_float">');          $r->print('<div class="LC_left_float">');
         $r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context,          $r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context,
                                          $inst_results{$ccuname.':'.$ccdomain}));                                           $inst_results{$ccuname.':'.$ccdomain}));
         if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) ||          if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) || 
             (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {              (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
             $r->print('<br /><h3>'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'</h3>'.              $r->print('<br /><h3>'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'</h3>'.
                       &Apache::loncommon::start_data_table());                        &Apache::loncommon::start_data_table());
Line 1533  ENDAUTH Line 1521  ENDAUTH
         if ((!$isauthor) &&           if ((!$isauthor) && 
             ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||              ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
              (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&               (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&
              ($env{'request.role.domain'} eq $ccdomain)) {              ($env{'request.role.domain'} eq $ccdomain)) {
             $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);              $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
         }          }
         if ((&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) ||          if ((&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) || 
             (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {              (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
             $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain);              $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain);
         }          }
Line 1608  ENDNOTOOLSPRIV Line 1596  ENDNOTOOLSPRIV
         } elsif (($context eq 'course') && ((&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) ||          } elsif (($context eq 'course') && ((&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) ||
                  ($env{'request.course.sec'} &&                   ($env{'request.course.sec'} &&
                   &Apache::lonnet::allowed('vcl',$env{'request.course.id'}.'/'.$env{'request.course.sec'})))) {                    &Apache::lonnet::allowed('vcl',$env{'request.course.id'}.'/'.$env{'request.course.sec'})))) {
             $statuses = ['active'];              $statuses = ['active'];   
         }          }
         if ($env{'form.action'} ne 'singlestudent') {          if ($env{'form.action'} ne 'singlestudent') {
             &display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context,              &display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context,
Line 1666  ENDNOTOOLSPRIV Line 1654  ENDNOTOOLSPRIV
 }  }
   
 sub singleuser_breadcrumb {  sub singleuser_breadcrumb {
     my ($crstype,$context,$domain) = @_;      my ($crstype) = @_;
     my %breadcrumb_text;      my %breadcrumb_text;
     if ($env{'form.action'} eq 'singlestudent') {      if ($env{'form.action'} eq 'singlestudent') {
         if ($crstype eq 'Community') {          if ($crstype eq 'Community') {
Line 1674  sub singleuser_breadcrumb { Line 1662  sub singleuser_breadcrumb {
         } else {          } else {
             $breadcrumb_text{'search'} = 'Enroll a student';              $breadcrumb_text{'search'} = 'Enroll a student';
         }          }
         $breadcrumb_text{'userpicked'} = 'Select a user';          $breadcrumb_text{'userpicked'} = 'Select a user',
         $breadcrumb_text{'modify'} = 'Set section/dates';          $breadcrumb_text{'modify'} = 'Set section/dates',
     } elsif ($env{'form.action'} eq 'accesslogs') {      } elsif ($env{'form.action'} eq 'accesslogs') {
         $breadcrumb_text{'search'} = 'View access logs for a user';          $breadcrumb_text{'search'} = 'View access logs for a user';
         $breadcrumb_text{'userpicked'} = 'Select a user';          $breadcrumb_text{'userpicked'} = 'Select a user',
         $breadcrumb_text{'activity'} = 'Activity';          $breadcrumb_text{'activity'} = 'Activity',
     } elsif (($env{'form.action'} eq 'singleuser') && ($context eq 'domain') &&  
              (!&Apache::lonnet::allowed('mau',$domain))) {  
         $breadcrumb_text{'search'} = "View user's roles";  
         $breadcrumb_text{'userpicked'} = 'Select a user';  
         $breadcrumb_text{'modify'} = 'User roles';  
     } else {      } else {
         $breadcrumb_text{'search'} = 'Create/modify a user';          $breadcrumb_text{'search'} = 'Create/modify a user';
         $breadcrumb_text{'userpicked'} = 'Select a user';          $breadcrumb_text{'userpicked'} = 'Select a user',
         $breadcrumb_text{'modify'} = 'Set user role';          $breadcrumb_text{'modify'} = 'Set user role',
     }      }
     return %breadcrumb_text;      return %breadcrumb_text;
 }  }
Line 1842  sub display_existing_roles { Line 1825  sub display_existing_roles {
         if ($active) {          if ($active) {
             next unless($showall || $showactive);              next unless($showall || $showactive);
         } else {          } else {
             next unless($showall || $showexpired);              next unless($showall || $showexpired); 
         }          }
 # Is this a custom role? Get role owner and title.  # Is this a custom role? Get role owner and title.
         my ($croleudom,$croleuname,$croletitle)=          my ($croleudom,$croleuname,$croletitle)=
Line 1853  sub display_existing_roles { Line 1836  sub display_existing_roles {
         my $class='Unknown';          my $class='Unknown';
         my $credits='';          my $credits='';
         my $csec;          my $csec;
         if ($area =~ m{^/($match_domain)/($match_courseid)}) {          if ($area =~ m{^/($match_domain)/($match_courseid)} ) {
             $class='Course';              $class='Course';
             my ($coursedom,$coursedir) = ($1,$2);              my ($coursedom,$coursedir) = ($1,$2);
             my $cid = $1.'_'.$2;              my $cid = $1.'_'.$2;
             # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3).              # $1.'_'.$2 is the course id (eg. 103_12345abcef103l3).
             next if ($envkey =~ m{^/$match_domain/$match_courseid/[A-Za-z0-9]+_gr$});  
             my %coursedata=              my %coursedata=
                 &Apache::lonnet::coursedescription($cid);                  &Apache::lonnet::coursedescription($cid);
             if ($coursedir =~ /^$match_community$/) {              if ($coursedir =~ /^$match_community$/) {
Line 1917  sub display_existing_roles { Line 1899  sub display_existing_roles {
                 }                  }
             }              }
             if ($area=~m{^/($match_domain/$match_courseid/(\w+))}) {              if ($area=~m{^/($match_domain/$match_courseid/(\w+))}) {
                   
                 $csec = $2;                  $csec = $2;
                 $carea.='<br />'.&mt('Section: [_1]',$csec);                  $carea.='<br />'.&mt('Section: [_1]',$csec);
                 $sortkey.="\0$csec";                  $sortkey.="\0$csec";
Line 1987  sub display_existing_roles { Line 1970  sub display_existing_roles {
             } else {              } else {
                 $row.='&nbsp;';                  $row.='&nbsp;';
             }              }
             $row.= '</td>';              $row.= '</td>'; 
         }          }
         my $plaintext='';          my $plaintext='';
         if (!$croletitle) {          if (!$croletitle) {
Line 2018  sub display_existing_roles { Line 2001  sub display_existing_roles {
             $rolepriv{$envkey}='edit';              $rolepriv{$envkey}='edit';
         } else {          } else {
             if ($context eq 'domain') {              if ($context eq 'domain') {
                 if ((&Apache::lonnet::allowed('vur',$ccdomain)) &&                  if (&Apache::lonnet::allowed('vur',$ccdomain)) {
                     ($envkey=~m{^/$ccdomain/})) {  
                     $rolepriv{$envkey}='view';                      $rolepriv{$envkey}='view';
                 }                  }
             } elsif ($context eq 'course') {              } elsif ($context eq 'course') {
Line 2076  sub display_existing_roles { Line 2058  sub display_existing_roles {
 &Apache::loncommon::start_data_table_header_row());  &Apache::loncommon::start_data_table_header_row());
         if ($showall) {          if ($showall) {
             $r->print(              $r->print(
 '<th>'.$lt{'rev'}.'</th><th>'.$lt{'ren'}.'</th><th>'.$lt{'del'}.'</th>'  '<th>'.$lt{'rev'}.'</th><th>'.$lt{'ren'}.'</th><th>'.$lt{'del'}
             );              );
         } elsif ($showexpired) {          } elsif ($showexpired) {
             $r->print('<th>'.$lt{'rev'}.'</th>');              $r->print('<th>'.$lt{'rev'}.'</th>');
         }          }
         $r->print(          $r->print(
 '<th>'.$lt{'rol'}.'</th><th>'.$lt{'ext'}.'</th>'.  '</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'ext'}.
 '<th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.  '</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
 &Apache::loncommon::end_data_table_header_row());  &Apache::loncommon::end_data_table_header_row());
         foreach my $type ('Authoring Space','Course','Community','Domain','System','Unknown') {          foreach my $type ('Authoring Space','Course','Community','Domain','System','Unknown') {
             if ($output{$type}) {              if ($output{$type}) {
Line 2256  $lt{'uuas'} ($currentauth). $lt{'adcs'}. Line 2238  $lt{'uuas'} ($currentauth). $lt{'adcs'}.
 ENDBADAUTH  ENDBADAUTH
         }          }
     } else { # Authentication type is valid      } else { # Authentication type is valid
           
         &initialize_authen_forms($ccdomain,$formname,$currentauth,'modifyuser');          &initialize_authen_forms($ccdomain,$formname,$currentauth,'modifyuser');
         my ($authformcurrent,$can_modify,@authform_others) =          my ($authformcurrent,$can_modify,@authform_others) =
             &modify_login_block($ccdomain,$currentauth);              &modify_login_block($ccdomain,$currentauth);
Line 2705  sub update_user_data { Line 2688  sub update_user_data {
                   $jsback."\n".                    $jsback."\n".
                   '// ]]>'."\n".                    '// ]]>'."\n".
                   '</script>'."\n";                    '</script>'."\n";
     my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$env{'form.ccdomain'});      my %breadcrumb_text = &singleuser_breadcrumb($crstype);
     push (@{$brcrum},      push (@{$brcrum},
              {href => "javascript:backPage(document.userupdate)",               {href => "javascript:backPage(document.userupdate)",
               text => $breadcrumb_text{'search'},                text => $breadcrumb_text{'search'},
Line 2814  sub update_user_data { Line 2797  sub update_user_data {
     my (%alerts,%rulematch,%inst_results,%curr_rules);      my (%alerts,%rulematch,%inst_results,%curr_rules);
     my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');      my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
     my @usertools = ('aboutme','blog','webdav','portfolio');      my @usertools = ('aboutme','blog','webdav','portfolio');
     my @requestcourses = ('official','unofficial','community','textbook');      my @requestcourses = ('official','unofficial','community','textbook','placement');
     my @requestauthor = ('requestauthor');      my @requestauthor = ('requestauthor');
     my ($othertitle,$usertypes,$types) =       my ($othertitle,$usertypes,$types) = 
         &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});          &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
Line 2993  sub update_user_data { Line 2976  sub update_user_data {
              'requestcourses.community','requestcourses.textbook',               'requestcourses.community','requestcourses.textbook',
              'reqcrsotherdom.official','reqcrsotherdom.unofficial',               'reqcrsotherdom.official','reqcrsotherdom.unofficial',
              'reqcrsotherdom.community','reqcrsotherdom.textbook',               'reqcrsotherdom.community','reqcrsotherdom.textbook',
              'requestauthor','adhocroles.'.$env{'request.role.domain'}],               'reqcrsotherdom.placement','requestauthor',
                'adhocroles.'.$env{'request.role.domain'}],
               $env{'form.ccdomain'},$env{'form.ccuname'});                $env{'form.ccdomain'},$env{'form.ccuname'});
         my ($tmp) = keys(%userenv);          my ($tmp) = keys(%userenv);
         if ($tmp =~ /^(con_lost|error)/i) {           if ($tmp =~ /^(con_lost|error)/i) { 
Line 3296  sub update_user_data { Line 3280  sub update_user_data {
                         ($env{'user.domain'} eq $env{'form.ccdomain'})) {                          ($env{'user.domain'} eq $env{'form.ccdomain'})) {
                         my %newenvhash;                          my %newenvhash;
                         foreach my $key (keys(%changed)) {                          foreach my $key (keys(%changed)) {
                             if (($key eq 'official') || ($key eq 'unofficial')                              if (($key eq 'official') || ($key eq 'unofficial') ||
                                 || ($key eq 'community') || ($key eq 'textbook')) {                                  ($key eq 'community') || ($key eq 'textbook') ||
                                   ($key eq 'placement')) {
                                 $newenvhash{'environment.requestcourses.'.$key} =                                  $newenvhash{'environment.requestcourses.'.$key} =
                                     $changeHash{'requestcourses.'.$key};                                      $changeHash{'requestcourses.'.$key};
                                 if ($changeHash{'requestcourses.'.$key}) {                                  if ($changeHash{'requestcourses.'.$key}) {
Line 3366  sub update_user_data { Line 3351  sub update_user_data {
                                   \%newsettingstext);                                    \%newsettingstext);
                 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'}},$uhome,'ids');
                     if (($recurseid) &&                      if (($recurseid) &&
                         (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) {                          (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) {
                         my $idresult =                           my $idresult = 
Line 3509  sub display_userinfo { Line 3494  sub display_userinfo {
          'unofficial'     => 'Can Request Unofficial Courses',           'unofficial'     => 'Can Request Unofficial Courses',
          'community'      => 'Can Request Communities',           'community'      => 'Can Request Communities',
          'textbook'       => 'Can Request Textbook Courses',           'textbook'       => 'Can Request Textbook Courses',
            'placement'      => 'Can Request Placement Tests',
          'requestauthor'  => 'Can Request Author Role',           'requestauthor'  => 'Can Request Author Role',
          'adhocroles'     => 'Ad Hoc Roles Selectable via Helpdesk Role',           'adhocroles'     => 'Ad Hoc Roles Selectable via Helpdesk Role',
          'inststatus'     => "Affiliation",           'inststatus'     => "Affiliation",
Line 4549  sub custom_role_editor { Line 4535  sub custom_role_editor {
               );                );
     my $args = { bread_crumbs          => $brcrum,      my $args = { bread_crumbs          => $brcrum,
                  bread_crumbs_component => 'User Management'};                   bread_crumbs_component => 'User Management'};
    
     $r->print(&Apache::loncommon::start_page('Custom Role Editor',      $r->print(&Apache::loncommon::start_page('Custom Role Editor',
                                              $head_script,$args).                                               $head_script,$args).
               $body_top);                $body_top);
Line 5190  sub handler { Line 5176  sub handler {
             } elsif ($env{'form.state'} eq 'done') {              } elsif ($env{'form.state'} eq 'done') {
                 $r->print('<h3>'.&mt('Enrollment request processing').'</h3>'."\n");                  $r->print('<h3>'.&mt('Enrollment request processing').'</h3>'."\n");
                 $r->print(&Apache::loncoursequeueadmin::update_request_queue($context,                  $r->print(&Apache::loncoursequeueadmin::update_request_queue($context,
                               $cdom,$cnum,$coursedesc));                                 $cdom,$cnum,$coursedesc));
             }              }
         } else {          } else {
             $r->print(&header(undef,{'no_nav_bar' => 1}).              $r->print(&header(undef,{'no_nav_bar' => 1}).
                      '<span class="LC_error">'.&mt('You do not have permission to manage self-enrollment').'</span>');                       '<span class="LC_error">'.&mt('You do not have permission to manage self-enrollment').'</span>');
         }          }
   
     } elsif ($env{'form.action'} eq 'changelogs') {      } elsif ($env{'form.action'} eq 'changelogs') {
         if ($permission->{cusr} || $permission->{view}) {          if ($permission->{cusr} || $permission->{view}) {
             &print_userchangelogs_display($r,$context,$permission,$brcrum);              &print_userchangelogs_display($r,$context,$permission,$brcrum);
Line 5457  sub print_main_menu { Line 5442  sub print_main_menu {
                 );                  );
   if ($linkcontext eq 'domain') {    if ($linkcontext eq 'domain') {
       unless ($permission->{'cusr'}) {        unless ($permission->{'cusr'}) {
           $links{'domain'}{'singleuser'} = 'View a User';            $links{'domain'}{'singleuser'} = 'View a User'; 
           $linktitles{'domain'}{'singleuser'} = 'View information about a user in the domain';            $linktitles{'domain'}{'singleuser'} = 'View information about a user in the domain';
             
       }        }
   } elsif ($linkcontext eq 'course') {    } elsif ($linkcontext eq 'course') {
       unless ($permission->{'cusr'}) {        unless ($permission->{'cusr'}) {
Line 5577  sub print_main_menu { Line 5562  sub print_main_menu {
                                           groups => 'Community Groups',                                            groups => 'Community Groups',
                                         },                                          },
                        );                         );
           $linktext{'Placement'} = $linktext{'Course'};
   
         my %linktitle = (          my %linktitle = (
             'Course' => {              'Course' => {
Line 5591  sub print_main_menu { Line 5577  sub print_main_menu {
                            },                             },
         );          );
   
           $linktitle{'Placement'} = $linktitle{'Course'};
   
         push(@{ $menu[0]->{items} }, #Category: Single Users          push(@{ $menu[0]->{items} }, #Category: Single Users
             {                 {   
              linktext => $linktext{$crstype}{'single'},               linktext => $linktext{$crstype}{'single'},
Line 6108  ENDSCRIPT Line 6096  ENDSCRIPT
                 }                  }
                 if ($registered) {                  if ($registered) {
                     $regon = ' checked="checked" ';                      $regon = ' checked="checked" ';
                     $regoff = '';                      $regoff = ' ';
                 } else {                  } else {
                     $regon = '';                      $regon = ' ';
                     $regoff = ' checked="checked" ';                      $regoff = ' checked="checked" ';
                 }                  }
                 $output .= '<label>'.                  $output .= '<label>'.
                            '<input type="radio" name="selfenroll_registered" value="1"'.$regon.$disabled.' />'.                             '<input type="radio" name="selfenroll_registered" value="1"'.$regon.$disabled.'/>'.
                            &mt('Yes').'</label>&nbsp;&nbsp;<label>'.                             &mt('Yes').'</label>&nbsp;&nbsp;<label>'.
                            '<input type="radio" name="selfenroll_registered" value="0"'.$regoff.$disabled.' />'.                             '<input type="radio" name="selfenroll_registered" value="0"'.$regoff.$disabled.'/>'.
                            &mt('No').'</label>';                             &mt('No').'</label>';
             } elsif ($item eq 'enroll_dates') {              } elsif ($item eq 'enroll_dates') {
                 my ($starttime,$endtime);                  my ($starttime,$endtime);
Line 6202  ENDSCRIPT Line 6190  ENDSCRIPT
             } elsif ($item eq 'approval') {              } elsif ($item eq 'approval') {
                 my ($currnotified,$currapproval,%appchecked);                  my ($currnotified,$currapproval,%appchecked);
                 my %selfdescs = &Apache::lonuserutils::selfenroll_default_descs();                  my %selfdescs = &Apache::lonuserutils::selfenroll_default_descs();
                 if (ref($currsettings) eq 'HASH') {                  if (ref($currsettings) eq 'HASH') { 
                     $currnotified = $currsettings->{'selfenroll_notifylist'};                      $currnotified = $currsettings->{'selfenroll_notifylist'};
                     $currapproval = $currsettings->{'selfenroll_approval'};                      $currapproval = $currsettings->{'selfenroll_approval'};
                 }                  }
Line 6330  ENDSCRIPT Line 6318  ENDSCRIPT
                    .&mt('Save').'" onclick="validate_types(this.form);" />';                     .&mt('Save').'" onclick="validate_types(this.form);" />';
     }      }
     $output .= '<input type="hidden" name="action" value="selfenroll" />'      $output .= '<input type="hidden" name="action" value="selfenroll" />'
                .'<input type="hidden" name="state" value="done" />'."\n"                .'<input type="hidden" name="state" value="done" />'."\n"
                .$additional.'</form>';                .$additional.'</form>';
     $r->print($output);      $r->print($output);
     return;      return;
 }  }
Line 6736  ENDSCRIPT Line 6724  ENDSCRIPT
             }              }
         }          }
         if (($context eq 'course') && ($viewablesec ne '')) {          if (($context eq 'course') && ($viewablesec ne '')) {
             next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec);              next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec); 
         }          }
         $count ++;          $count ++;
         next if ($count < $minshown);          next if ($count < $minshown);
Line 6825  sub print_useraccesslogs_display { Line 6813  sub print_useraccesslogs_display {
     my $form = 'document.accesslog';      my $form = 'document.accesslog';
   
 # set breadcrumbs  # set breadcrumbs
     my %breadcrumb_text = &singleuser_breadcrumb('','domain',$udom);      my %breadcrumb_text = &singleuser_breadcrumb();
     push (@{$brcrum},      push (@{$brcrum},
         {href => "javascript:backPage($form)",          {href => "javascript:backPage($form)",
          text => $breadcrumb_text{'search'}});           text => $breadcrumb_text{'search'}});
Line 7773  sub build_search_response { Line 7761  sub build_search_response {
                                 .&mt("Click 'Search'")                                  .&mt("Click 'Search'")
                                 .'</li></ul><br />';                                  .'</li></ul><br />';
                 } else {                  } else {
                     unless (($context eq 'domain') && ($env{'form.action'} eq 'singleuser')) {                      my $helplink = ' href="javascript:helpMenu('."'display'".')"';
                         my $helplink = ' href="javascript:helpMenu('."'display'".')"';                      $response .= '<br /><br />';
                         $response .= '<br /><br />';                      if ($context eq 'requestcrs') {
                         if ($context eq 'requestcrs') {                          $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);
                             $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);                      } else {
                         } else {                          $response .= &mt("You are not authorized to create new users in your current role's domain - [_1].",$targetdom);
                             $response .= &mt("You are not authorized to create new users in your current role's domain - [_1].",$targetdom);  
                         }  
                         $response .= '<br />'  
                                      .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'  
                                         ,' <a'.$helplink.'>'  
                                         ,'</a>')  
                                      .'<br />';  
                     }                      }
                       $response .= '<br />'
                                    .&mt('Please contact the [_1]helpdesk[_2] if you need to create a new user.'
                                       ,' <a'.$helplink.'>'
                                       ,'</a>')
                                    .'<br />';
                 }                  }
             }              }
         }          }

Removed from v.1.406.2.7  
changed lines
  Added in v.1.418


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