Diff for /loncom/interface/loncreateuser.pm between versions 1.416 and 1.417

version 1.416, 2016/10/10 03:02:48 version 1.417, 2016/10/22 17:56:12
Line 533  sub domainrole_req { Line 533  sub domainrole_req {
   
 sub domadhocroles {  sub domadhocroles {
     my ($ccuname,$ccdomain) = @_;      my ($ccuname,$ccdomain) = @_;
     my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'});       my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'});
     my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'},      my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'},
                                        $confname,'rolesdef_');                                         $confname,'rolesdef_');
     my $output;      my $output;
     if (keys(%existing) > 0) {      if (keys(%existing) > 0) {
         my @current;          my @current;
         my $curradhoc = 'adhocroles.'.$env{'request.role.domain'};           my $curradhoc = 'adhocroles.'.$env{'request.role.domain'};
         my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc);          my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc);
         if ($userenv{$curradhoc}) {          if ($userenv{$curradhoc}) {
             @current = split(/,/,$userenv{$curradhoc});              @current = split(/,/,$userenv{$curradhoc});
Line 560  sub domadhocroles { Line 560  sub domadhocroles {
                   &Apache::loncommon::start_data_table_header_row().                    &Apache::loncommon::start_data_table_header_row().
                   '<th>'.&mt('Action').'</th><th>'.&mt('Role').'</th>'.                    '<th>'.&mt('Action').'</th><th>'.&mt('Role').'</th>'.
                   '<th>'.&mt('Privileges in Course').'<th>'.                    '<th>'.&mt('Privileges in Course').'<th>'.
                   &Apache::loncommon::end_data_table_header_row();                     &Apache::loncommon::end_data_table_header_row();
         foreach my $key (sort(keys(%customroles))) {          foreach my $key (sort(keys(%customroles))) {
             $output .= &Apache::loncommon::start_data_table_row();              $output .= &Apache::loncommon::start_data_table_row();
             if (grep(/^\Q$key\E$/,@current)) {              if (grep(/^\Q$key\E$/,@current)) {
Line 583  sub domadhocroles { Line 583  sub domadhocroles {
                     }                      }
                     my @privs = split(/:/,$customroles{$key}{$level});                      my @privs = split(/:/,$customroles{$key}{$level});
                     foreach my $item (@privs) {                      foreach my $item (@privs) {
                         next if ($item eq '');                           next if ($item eq '');
                         my ($priv,$cond) = split(/\&/,$item);                          my ($priv,$cond) = split(/\&/,$item);
                         $output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.'<br />';                          $output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.'<br />';
                     }                      }
Line 822  sub print_username_entry_form { Line 822  sub print_username_entry_form {
                 $actiontext = $lt{'srst'};                  $actiontext = $lt{'srst'};
             }              }
         } elsif ($env{'form.action'} eq 'accesslogs') {          } elsif ($env{'form.action'} eq 'accesslogs') {
             $actiontext = $lt{'srva'};               $actiontext = $lt{'srva'};
         }          }
         $r->print("<h3>$actiontext</h3>");          $r->print("<h3>$actiontext</h3>");
         if ($env{'form.origform'} ne 'crtusername') {          if ($env{'form.origform'} ne 'crtusername') {
Line 2798  sub update_user_data { Line 2798  sub update_user_data {
                     my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd');                      my @adds = &Apache::loncommon::get_env_multiple('form.adhocroleadd');
                     if (&adhocrole_changes(\%changeHash)) {                      if (&adhocrole_changes(\%changeHash)) {
                         $changed{'adhocroles.'.$env{'request.role.domain'}} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};                          $changed{'adhocroles.'.$env{'request.role.domain'}} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};
                     }                        }
                 }                  }
             }              }
             if ($canmodify_status{'inststatus'}) {              if ($canmodify_status{'inststatus'}) {
Line 3144  sub update_user_data { Line 3144  sub update_user_data {
             if (&adhocrole_changes(\%changeHash,\%userenv)) {              if (&adhocrole_changes(\%changeHash,\%userenv)) {
                 $changed{'adhocroles'} = 1;                  $changed{'adhocroles'} = 1;
                 $oldsettings{'adhocroles'} = $userenv{'adhocroles.'.$env{'request.role.domain'}};                  $oldsettings{'adhocroles'} = $userenv{'adhocroles.'.$env{'request.role.domain'}};
                 $newsettings{'adhocroles'} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};                   $newsettings{'adhocroles'} = $changeHash{'adhocroles.'.$env{'request.role.domain'}};
             }              }
         }          }
         foreach my $item (@userinfo) {          foreach my $item (@userinfo) {
Line 3762  sub adhocrole_changes { Line 3762  sub adhocrole_changes {
                 @current = split(/,/,$userenv->{$adhoc_key});                  @current = split(/,/,$userenv->{$adhoc_key});
                 if (@dels) {                  if (@dels) {
                     foreach my $curr (@current) {                      foreach my $curr (@current) {
                         next if ($curr eq '');                           next if ($curr eq '');
                         unless (grep(/\Q$curr\E$/,@dels)) {                          unless (grep(/\Q$curr\E$/,@dels)) {
                             push(@saved,$curr);                              push(@saved,$curr);
                         }                          }
Line 3800  sub adhocrole_changes { Line 3800  sub adhocrole_changes {
         push(@alladhoc,@saved);          push(@alladhoc,@saved);
     }      }
     if (@alladhoc) {      if (@alladhoc) {
         my $adhocstr = join(',',sort(@alladhoc));           my $adhocstr = join(',',sort(@alladhoc));
         $changehashref->{$adhoc_key} = $adhocstr;          $changehashref->{$adhoc_key} = $adhocstr;
     } elsif (@dels) {      } elsif (@dels) {
         &Apache::lonnet::del('environment',[$adhoc_key],$env{'form.ccdomain'},$env{'form.ccuname'});          &Apache::lonnet::del('environment',[$adhoc_key],$env{'form.ccdomain'},$env{'form.ccuname'});
Line 4379  sub custom_role_editor { Line 4379  sub custom_role_editor {
         ($privs{'system'},$privs{'domain'},$privs{'course'})=split(/\_/,$roledef);          ($privs{'system'},$privs{'domain'},$privs{'course'})=split(/\_/,$roledef);
         if ($privs{'system'} =~ /bre\&S/) {          if ($privs{'system'} =~ /bre\&S/) {
             if ($context eq 'domain') {              if ($context eq 'domain') {
                 $crstype = 'Course';                   $crstype = 'Course';
             } elsif ($crstype eq 'Community') {              } elsif ($crstype eq 'Community') {
                 $privs{'system'} =~ s/bre\&S//;                  $privs{'system'} =~ s/bre\&S//;
             }              }
Line 4394  sub custom_role_editor { Line 4394  sub custom_role_editor {
   
 # ------------------------------------------------------- What can be assigned?  # ------------------------------------------------------- What can be assigned?
     my %full=();      my %full=();
     my %levels=(       my %levels=(
                  course => {},                   course => {},
                  domain => {},                   domain => {},
                  system => {},                   system => {},
Line 4407  sub custom_role_editor { Line 4407  sub custom_role_editor {
     &Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);      &Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
     my ($jsback,$elements) = &crumb_utilities();      my ($jsback,$elements) = &crumb_utilities();
     my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);      my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
     my $head_script =       my $head_script =
         &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,          &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,
                                                   \%full,\@templateroles,$jsback);                                                    \%full,\@templateroles,$jsback);
     push (@{$brcrum},      push (@{$brcrum},
Line 4439  ENDCCF Line 4439  ENDCCF
     $r->print(&Apache::loncommon::end_data_table().      $r->print(&Apache::loncommon::end_data_table().
    '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'.     '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'.
    '<input type="hidden" name="startrolename" value="'.$env{'form.rolename'}.     '<input type="hidden" name="startrolename" value="'.$env{'form.rolename'}.
    '" />'."\n".'<input type="hidden" name="currstate" value="" />'."\n".        '" />'."\n".'<input type="hidden" name="currstate" value="" />'."\n".
    '<input type="reset" value="'.&mt("Reset").'" />'."\n".     '<input type="reset" value="'.&mt("Reset").'" />'."\n".
    '<input type="submit" value="'.&mt('Save').'" /></form>');     '<input type="submit" value="'.&mt('Save').'" /></form>');
 }  }
Line 5359  sub print_main_menu { Line 5359  sub print_main_menu {
         push(@{  $menu[0]->{items} }, # Single Users          push(@{  $menu[0]->{items} }, # Single Users
             {              {
              linktext => 'User Access Log',               linktext => 'User Access Log',
              icon => 'document-properties.png',                 icon => 'document-properties.png',
              #help => 'User_Access_Logs',               #help => 'User_Access_Logs',
              url => '/adm/createuser?action=accesslogs',               url => '/adm/createuser?action=accesslogs',
              permission => $permission->{'activity'},               permission => $permission->{'activity'},
Line 6678  sub print_useraccesslogs_display { Line 6678  sub print_useraccesslogs_display {
     my $args = { bread_crumbs           => $brcrum,      my $args = { bread_crumbs           => $brcrum,
                  bread_crumbs_component => 'User Management'};                   bread_crumbs_component => 'User Management'};
   
 # set javascript   # set javascript
     my ($jsback,$elements) = &crumb_utilities();      my ($jsback,$elements) = &crumb_utilities();
     my $jsnav = &userlogdisplay_js($formname);      my $jsnav = &userlogdisplay_js($formname);
   
Line 6694  $jsnav Line 6694  $jsnav
   
 ENDSCRIPT  ENDSCRIPT
   
 # print page header   # print page header
     $r->print(&header($jscript,$args));      $r->print(&header($jscript,$args));
   
 # early out unless log data can be displayed.  # early out unless log data can be displayed.
Line 6711  ENDSCRIPT Line 6711  ENDSCRIPT
                  .&mt("User's domain must match role's domain")                   .&mt("User's domain must match role's domain")
                  .'</p>'                   .'</p>'
                  .&earlyout_accesslog_form($formname,$prevphasestr,$udom));                   .&earlyout_accesslog_form($formname,$prevphasestr,$udom));
         return;              return;
     }      }
   
     if (($uname eq '') || ($udom eq '')) {      if (($uname eq '') || ($udom eq '')) {
Line 6836  ENDSCRIPT Line 6836  ENDSCRIPT
                     if ($rolecode eq 'au') {                      if ($rolecode eq 'au') {
                         $extra = '';                          $extra = '';
                     } elsif ($rolecode =~ /^(ca|aa)$/) {                      } elsif ($rolecode =~ /^(ca|aa)$/) {
                         $extra = &mt('Authoring Space: [_1]',$name.':'.$dom);                           $extra = &mt('Authoring Space: [_1]',$name.':'.$dom);
                     } elsif ($rolecode =~ /^(li|dg|dh|dc|sc)$/) {                      } elsif ($rolecode =~ /^(li|dg|dh|dc|sc)$/) {
                         $extra = &mt('Domain: [_1]',$dom);                          $extra = &mt('Domain: [_1]',$dom);
                     }                      }
Line 6844  ENDSCRIPT Line 6844  ENDSCRIPT
                 my $rolename;                  my $rolename;
                 if ($rolecode =~ m{^cr/($match_domain)/($match_username)/(\w+)}) {                  if ($rolecode =~ m{^cr/($match_domain)/($match_username)/(\w+)}) {
                     my $role = $3;                      my $role = $3;
                     my $owner = "($2:$1)";                       my $owner = "($2:$1)";
                     if ($2 eq $1.'-domainconfig') {                      if ($2 eq $1.'-domainconfig') {
                         $owner = '(ad hoc)';                          $owner = '(ad hoc)';
                     }                       }
                     $rolename = &mt('Custom role: [_1]',$role.' '.$owner);                      $rolename = &mt('Custom role: [_1]',$role.' '.$owner);
                 } else {                  } else {
                     $rolename = &Apache::lonnet::plaintext($rolecode,$crstype);                      $rolename = &Apache::lonnet::plaintext($rolecode,$crstype);
Line 7195  sub user_search_result { Line 7195  sub user_search_result {
             $response .= '<br />';              $response .= '<br />';
         }          }
     } else {      } else {
         unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) {           unless (($context eq 'requestcrs') && ($srch->{'srchtype'} eq 'exact')) {
             my $domd_chk = &domdirectorysrch_check($srch);              my $domd_chk = &domdirectorysrch_check($srch);
             if ($domd_chk ne 'ok') {              if ($domd_chk ne 'ok') {
                 my $instd_chk = &instdirectorysrch_check($srch);                  my $instd_chk = &instdirectorysrch_check($srch);

Removed from v.1.416  
changed lines
  Added in v.1.417


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