Diff for /loncom/interface/loncreateuser.pm between versions 1.421 and 1.427

version 1.421, 2016/11/12 00:16:24 version 1.427, 2017/01/01 14:08:34
Line 536  sub domainrole_req { Line 536  sub domainrole_req {
            &Apache::loncommon::end_data_table();             &Apache::loncommon::end_data_table();
 }  }
   
 sub domadhocroles {  
     my ($ccuname,$ccdomain) = @_;  
     my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'});  
     my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'},  
                                        $confname,'rolesdef_');  
     my ($output,$canmodify);  
     if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {  
         $canmodify = 1;  
     }  
     if (keys(%existing) > 0) {  
         my @current;  
         my $curradhoc = 'adhocroles.'.$env{'request.role.domain'};  
         my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc);  
         if ($userenv{$curradhoc}) {  
             @current = split(/,/,$userenv{$curradhoc});  
         }  
         if (!$canmodify && !@current) {  
             return;  
         }  
         my %customroles;  
         foreach my $key (keys(%existing)) {  
             if ($key=~/^rolesdef\_(\w+)$/) {  
                 my $rolename = $1;  
                 my %privs;  
                 ($privs{'system'},$privs{'domain'},$privs{'course'}) = split(/\_/,$existing{$key});  
                 $customroles{$rolename} = \%privs;  
             }  
         }  
         $output = '<br /><h3>'.  
                   &mt('Ad Hoc Course Roles Selectable via Helpdesk Role').  
                   '</h3>'."\n".  
                   &Apache::loncommon::start_data_table().  
                   &Apache::loncommon::start_data_table_header_row();  
         if ($canmodify) {  
             $output .= '<th>'.&mt('Action').'</th>';  
         }  
         $output .= '<th>'.&mt('Role').'</th>'.  
                    '<th>'.&mt('Privileges in Course').'<th>'.  
                    &Apache::loncommon::end_data_table_header_row();  
         foreach my $key (sort(keys(%customroles))) {  
             next if ((!$canmodify) && (!grep(/^\Q$key\E$/,@current)));  
             $output .= &Apache::loncommon::start_data_table_row();  
             if ($canmodify) {  
                 if (grep(/^\Q$key\E$/,@current)) {  
                     $output .= '<td><label>'.  
                                '<input type="checkbox" name="adhocroledel" value="'.$key.'" />'.  
                                &mt('Delete').'</label>'.  
                                '</td>';  
                 } else {  
                     $output .= '<td><label>'.  
                                '<input type="checkbox" name="adhocroleadd" value="'.$key.'" />'.  
                                &mt('Add').'</label>'.  
                                '</td>';  
                 }  
             }  
             $output .= '<td>'.$key.'</td><td>';  
             foreach my $level ('course','domain','system') {  
                 if ($customroles{$key}{$level}) {  
                     my $suffix;  
                     if (($level eq 'domain') || ($level eq 'system')) {  
                         $suffix = '&nbsp;('.&mt($level).')';  
                     }  
                     my @privs = split(/:/,$customroles{$key}{$level});  
                     foreach my $item (@privs) {  
                         next if ($item eq '');  
                         my ($priv,$cond) = split(/\&/,$item);  
                         $output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.'<br />';  
                     }  
                 }  
             }  
             $output .= '</td>'.  
                        &Apache::loncommon::end_data_table_row();  
         }  
         $output .= &Apache::loncommon::end_data_table();  
     }  
     return $output;  
 }  
   
 sub courserequest_titles {  sub courserequest_titles {
     my %titles = &Apache::lonlocal::texthash (      my %titles = &Apache::lonlocal::texthash (
                                    official   => 'Official',                                     official   => 'Official',
Line 757  sub print_username_entry_form { Line 679  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);      my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$defdom);
     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 785  sub print_username_entry_form { Line 707  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 840  sub print_username_entry_form { Line 763  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 933  ENDBLOCK Line 859  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 978  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 1063  ENDSCRIPT Line 993  ENDSCRIPT
     if ($context eq 'requestcrs') {      if ($context eq 'requestcrs') {
         $r->print('<div>');          $r->print('<div>');
     } else {      } else {
         my %breadcrumb_text = &singleuser_breadcrumb($crstype);          my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$srch->{'srchdomain'});
         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 1083  ENDSCRIPT Line 1013  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') {
             $r->print("<b>$lt{'usrch'}</b><br />");              my $readonly;
               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));
             $r->print('<h3>'.$lt{'usel'}.'</h3>');              if ($readonly) {
                   $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 1279  sub print_user_modification_page { Line 1219  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);      my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);
     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 1345  ENDFORMINFO Line 1285  ENDFORMINFO
     }      }
     my $title = '';      my $title = '';
     if ($newuser) {      if ($newuser) {
         my ($portfolioform,$domroleform,$adhocroleform);          my ($portfolioform,$domroleform);
         if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||          if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||
             (&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {              (&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {
             # Current user has quota or user tools modification privileges              # Current user has quota or user tools modification privileges
Line 1355  ENDFORMINFO Line 1295  ENDFORMINFO
             ($ccdomain eq $env{'request.role.domain'})) {              ($ccdomain eq $env{'request.role.domain'})) {
             $domroleform = '<br />'.&domainrole_req($ccuname,$ccdomain);              $domroleform = '<br />'.&domainrole_req($ccuname,$ccdomain);
         }          }
         if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {  
             $adhocroleform = &domadhocroles($ccuname,$ccdomain);  
             if ($adhocroleform) {  
                 $adhocroleform = '<br />'.$adhocroleform;  
             }  
         }  
         &initialize_authen_forms($ccdomain,$formname);          &initialize_authen_forms($ccdomain,$formname);
         my %lt=&Apache::lonlocal::texthash(          my %lt=&Apache::lonlocal::texthash(
                 'lg'             => 'Login Data',                  'lg'             => 'Login Data',
Line 1471  ENDAUTH Line 1405  ENDAUTH
         } else {          } else {
             $r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));               $r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc)); 
         }          }
         $r->print($portfolioform.$domroleform.$adhocroleform);          $r->print($portfolioform.$domroleform);
         if ($env{'form.action'} eq 'singlestudent') {          if ($env{'form.action'} eq 'singlestudent') {
             $r->print(&date_sections_select($context,$newuser,$formname,              $r->print(&date_sections_select($context,$newuser,$formname,
                                             $permission,$crstype,$ccuname,                                              $permission,$crstype,$ccuname,
Line 1514  ENDAUTH Line 1448  ENDAUTH
             $r->print(&Apache::loncommon::end_data_table());              $r->print(&Apache::loncommon::end_data_table());
         }          }
         $r->print('</div>');          $r->print('</div>');
         my @order = ('auth','quota','tools','requestauthor','adhocroles');          my @order = ('auth','quota','tools','requestauthor');
         my %user_text;          my %user_text;
         my ($isadv,$isauthor) =           my ($isadv,$isauthor) = 
             &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);              &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
Line 1524  ENDAUTH Line 1458  ENDAUTH
             ($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'})) ||   
             (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {  
             $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain);  
         }  
         $user_text{'auth'} =  &user_authentication($ccuname,$ccdomain,$formname);          $user_text{'auth'} =  &user_authentication($ccuname,$ccdomain,$formname);
         if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||          if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
             (&Apache::lonnet::allowed('mut',$ccdomain)) ||              (&Apache::lonnet::allowed('mut',$ccdomain)) ||
Line 1654  ENDNOTOOLSPRIV Line 1584  ENDNOTOOLSPRIV
 }  }
   
 sub singleuser_breadcrumb {  sub singleuser_breadcrumb {
     my ($crstype) = @_;      my ($crstype,$context,$domain) = @_;
     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 1662  sub singleuser_breadcrumb { Line 1592  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 2283  ENDBADAUTH Line 2218  ENDBADAUTH
                         $result = &mt('Currently Kerberos authenticated, Version [_1].',$krbver);                          $result = &mt('Currently Kerberos authenticated, Version [_1].',$krbver);
                     } else {                      } else {
                         $result = &mt('Currently Kerberos authenticated with domain [_1] Version [_2].',                          $result = &mt('Currently Kerberos authenticated with domain [_1] Version [_2].',
                                       $krbver,$krbrealm);                                        $krbrealm,$krbver);
                     }                      }
                 } elsif ($currentauth =~ /^internal:/) {                  } elsif ($currentauth =~ /^internal:/) {
                     $result = &mt('Currently internally authenticated.');                      $result = &mt('Currently internally authenticated.');
Line 2689  sub update_user_data { Line 2624  sub update_user_data {
                   $jsback."\n".                    $jsback."\n".
                   '// ]]>'."\n".                    '// ]]>'."\n".
                   '</script>'."\n";                    '</script>'."\n";
     my %breadcrumb_text = &singleuser_breadcrumb($crstype);      my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$env{'form.ccdomain'});
     push (@{$brcrum},      push (@{$brcrum},
              {href => "javascript:backPage(document.userupdate)",               {href => "javascript:backPage(document.userupdate)",
               text => $breadcrumb_text{'search'},                text => $breadcrumb_text{'search'},
Line 2908  sub update_user_data { Line 2843  sub update_user_data {
                                                     $newcustom{'requestauthor'},                                                      $newcustom{'requestauthor'},
                                                     \%changeHash,'requestauthor');                                                      \%changeHash,'requestauthor');
                 }                  }
                 if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {  
                     my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd');  
                     if (&adhocrole_changes(\%changeHash)) {  
                         $changed{'adhocroles.'.$env{'request.role.domain'}} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};  
                     }  
                 }  
             }              }
             if ($canmodify_status{'inststatus'}) {              if ($canmodify_status{'inststatus'}) {
                 if (exists($env{'form.inststatus'})) {                  if (exists($env{'form.inststatus'})) {
Line 2977  sub update_user_data { Line 2906  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',
              'reqcrsotherdom.placement','requestauthor',               '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 3117  sub update_user_data { Line 3045  sub update_user_data {
                 &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus,$name);                  &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus,$name);
             ($newdefquota{$name},$newsettingstatus{$name}) = ($olddefquota{$name},$oldsettingstatus{$name});              ($newdefquota{$name},$newsettingstatus{$name}) = ($olddefquota{$name},$oldsettingstatus{$name});
         }          }
         push(@disporder,'adhocroles');  
         my %canshow;          my %canshow;
         if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
             $canshow{'quota'} = 1;              $canshow{'quota'} = 1;
Line 3136  sub update_user_data { Line 3063  sub update_user_data {
         if (&Apache::lonnet::allowed('cau',$env{'form.ccdomain'})) {          if (&Apache::lonnet::allowed('cau',$env{'form.ccdomain'})) {
             $canshow{'requestauthor'} = 1;              $canshow{'requestauthor'} = 1;
         }          }
         if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {  
             $canshow{'adhocroles'} = 1;  
         }  
         my (%changeHash,%changed);          my (%changeHash,%changed);
         if ($oldinststatus eq '') {          if ($oldinststatus eq '') {
             $oldsettings{'inststatus'} = $othertitle;               $oldsettings{'inststatus'} = $othertitle; 
Line 3252  sub update_user_data { Line 3176  sub update_user_data {
                 &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,                  &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,
                               \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);                                \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
             }              }
             if ($userenv{'adhocroles.'.$env{'request.role.domain'}}) {  
                 $changeHash{'adhocroles.'.$env{'request.role.domain'}} = $userenv{'adhocroles.'.$env{'request.role.domain'}};  
             }  
             if (&adhocrole_changes(\%changeHash,\%userenv)) {  
                 $changed{'adhocroles'} = 1;  
                 $oldsettings{'adhocroles'} = $userenv{'adhocroles.'.$env{'request.role.domain'}};  
                 $newsettings{'adhocroles'} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};  
             }  
         }          }
         foreach my $item (@userinfo) {          foreach my $item (@userinfo) {
             if ($env{'form.c'.$item} ne $userenv{$item}) {              if ($env{'form.c'.$item} ne $userenv{$item}) {
Line 3302  sub update_user_data { Line 3218  sub update_user_data {
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},            &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
                                             $key,'reload','requestauthor');                                              $key,'reload','requestauthor');
                                 }                                  }
                             } elsif ($key eq 'adhocroles') {  
                                 $newenvhash{'adhocroles.'.$env{'request.role.domain'}} =  
                                     $changeHash{'adhocroles.'.$env{'request.role.domain'}};  
                             } elsif ($key ne 'quota') {                              } elsif ($key ne 'quota') {
                                 $newenvhash{'environment.tools.'.$key} =                                   $newenvhash{'environment.tools.'.$key} = 
                                     $changeHash{'tools.'.$key};                                      $changeHash{'tools.'.$key};
Line 3497  sub display_userinfo { Line 3410  sub display_userinfo {
          'textbook'       => 'Can Request Textbook Courses',           'textbook'       => 'Can Request Textbook Courses',
          'placement'      => 'Can Request Placement Tests',           'placement'      => 'Can Request Placement Tests',
          'requestauthor'  => 'Can Request Author Role',           'requestauthor'  => 'Can Request Author Role',
          'adhocroles'     => 'Ad Hoc Roles Selectable via Helpdesk Role',  
          'inststatus'     => "Affiliation",           'inststatus'     => "Affiliation",
          'prvs'           => 'Previous Value:',           'prvs'           => 'Previous Value:',
          'chto'           => 'Changed To:'           'chto'           => 'Changed To:'
Line 3863  sub tool_changes { Line 3775  sub tool_changes {
     return;      return;
 }  }
   
 sub adhocrole_changes {  
     my ($changehashref,$userenv) = @_;  
     my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd');  
     my @dels = &Apache::loncommon::get_env_multiple('form.adhocroledel');  
     my (@saved,@added,@alladhoc,$changed);  
     my $adhoc_key = 'adhocroles.'.$env{'request.role.domain'};  
     if (!$env{'form.makeuser'}) {  
         if (ref($userenv) eq 'HASH') {  
             my @current;  
             if ($userenv->{$adhoc_key}) {  
                 @current = split(/,/,$userenv->{$adhoc_key});  
                 if (@dels) {  
                     foreach my $curr (@current) {  
                         next if ($curr eq '');  
                         unless (grep(/\Q$curr\E$/,@dels)) {  
                             push(@saved,$curr);  
                         }  
                     }  
                     $changed = 1;  
                 } else {  
                     @saved = @current;  
                 }  
             }  
         }  
     }  
     if (@adds) {  
         my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'});  
         my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'},  
                                            $confname,'rolesdef_');  
         foreach my $poss (@adds) {  
             if (exists($existing{'rolesdef_'.$poss})) {  
                 push(@added,$poss);  
                 $changed = 1;  
             }  
         }  
     }  
     if (@added) {  
         if (@saved) {  
             foreach my $add (@added) {  
                 unless (grep(/^\Q$add\E$/,@saved)) {  
                     push(@alladhoc,$add);  
                 }  
             }  
         } else {  
             push(@alladhoc,@added);  
         }  
     }  
     if (@saved) {  
         push(@alladhoc,@saved);  
     }  
     if (@alladhoc) {  
         my $adhocstr = join(',',sort(@alladhoc));  
         $changehashref->{$adhoc_key} = $adhocstr;  
     } elsif (@dels) {  
         &Apache::lonnet::del('environment',[$adhoc_key],$env{'form.ccdomain'},$env{'form.ccuname'});  
         delete($changehashref->{$adhoc_key});  
         if (($env{'form.ccdomain'} eq $env{'user.domain'}) &&  
             ($env{'form.ccuname'} eq $env{'user.name'})) {  
             &Apache::lonnet::delenv($adhoc_key);  
         }  
     }  
     return $changed;  
 }  
   
 sub update_roles {  sub update_roles {
     my ($r,$context,$showcredits) = @_;      my ($r,$context,$showcredits) = @_;
     my $now=time;      my $now=time;
Line 5506  sub print_main_menu { Line 5354  sub print_main_menu {
             {              {
              linktext => 'User Access Log',               linktext => 'User Access Log',
              icon => 'document-properties.png',               icon => 'document-properties.png',
              #help => 'User_Access_Logs',               #help => 'Domain_User_Access_Logs',
              url => '/adm/createuser?action=accesslogs',               url => '/adm/createuser?action=accesslogs',
              permission => $permission->{'activity'},               permission => $permission->{'activity'},
              linktitle => 'View user access log.',               linktitle => 'View user access log.',
Line 6814  sub print_useraccesslogs_display { Line 6662  sub print_useraccesslogs_display {
     my $form = 'document.accesslog';      my $form = 'document.accesslog';
   
 # set breadcrumbs  # set breadcrumbs
     my %breadcrumb_text = &singleuser_breadcrumb();      my %breadcrumb_text = &singleuser_breadcrumb('','domain',$udom);
     push (@{$brcrum},      push (@{$brcrum},
         {href => "javascript:backPage($form)",          {href => "javascript:backPage($form)",
          text => $breadcrumb_text{'search'}});           text => $breadcrumb_text{'search'}});
Line 6834  sub print_useraccesslogs_display { Line 6682  sub print_useraccesslogs_display {
     push(@{$brcrum},      push(@{$brcrum},
              {href => '/adm/createuser?action=accesslogs',               {href => '/adm/createuser?action=accesslogs',
               text => 'User access logs',                text => 'User access logs',
               help => 'User_Access_Logs'});                help => 'Domain_User_Access_Logs'});
     my $bread_crumbs_component = 'User Access Logs';      my $bread_crumbs_component = 'User Access Logs';
     my $args = { bread_crumbs           => $brcrum,      my $args = { bread_crumbs           => $brcrum,
                  bread_crumbs_component => 'User Management'};                   bread_crumbs_component => 'User Management'};
       if ($env{'form.popup'}) {
           $args->{'no_nav_bar'} = 1;
       }
   
 # set javascript  # set javascript
     my ($jsback,$elements) = &crumb_utilities();      my ($jsback,$elements) = &crumb_utilities();
Line 7043  ENDSCRIPT Line 6894  ENDSCRIPT
                  .'</p>');                   .'</p>');
     }      }
   
       if ($env{'form.popup'} == 1) {
           $r->print('<input type="hidden" name="popup" value="1" />'."\n");
       }
   
     # Form Footer      # Form Footer
     $r->print(      $r->print(
         '<input type="hidden" name="currstate" value="" />'          '<input type="hidden" name="currstate" value="" />'
Line 7762  sub build_search_response { Line 7617  sub build_search_response {
                                 .&mt("Click 'Search'")                                  .&mt("Click 'Search'")
                                 .'</li></ul><br />';                                  .'</li></ul><br />';
                 } else {                  } else {
                     my $helplink = ' href="javascript:helpMenu('."'display'".')"';                      unless (($context eq 'domain') && ($env{'form.action'} eq 'singleuser')) {
                     $response .= '<br /><br />';                          my $helplink = ' href="javascript:helpMenu('."'display'".')"';
                     if ($context eq 'requestcrs') {                          $response .= '<br /><br />';
                         $response .= &mt("You are not authorized to define new users in the new course's domain - [_1].",$targetdom);                          if ($context eq 'requestcrs') {
                     } else {                              $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 create new users in your current role's domain - [_1].",$targetdom);                          } else {
                               $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.421  
changed lines
  Added in v.1.427


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