Diff for /loncom/interface/loncreateuser.pm between versions 1.473 and 1.478

version 1.473, 2023/11/05 20:06:04 version 1.478, 2024/05/01 21:22:09
Line 245  function toggleCustom(form,item,name) { Line 245  function toggleCustom(form,item,name) {
         if (radioname) {          if (radioname) {
             if (radioname.length > 0) {              if (radioname.length > 0) {
                 var setvis;                  var setvis;
                   var RegExp = /^customtext_(aboutme|blog|portfolio|portaccess|timezone|webdav|archive)\$/;
                 for (var i=0; i<radioname.length; i++) {                  for (var i=0; i<radioname.length; i++) {
                     if (radioname[i].checked == true) {                      if (radioname[i].checked == true) {
                         if (radioname[i].value == 1) {                          if (radioname[i].value == 1) {
                             divid.style.display = 'block';                              if (RegExp.test(item)) {
                                   divid.style.display = 'inline';
                               } else {
                                   divid.style.display = 'block';
                               }
                             setvis = 1;                              setvis = 1;
                         }                          }
                         break;                          break;
Line 273  sub build_tools_display { Line 278  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,$isadv,%domconfig,@defaulteditors,@customeditors,@custommanagers,          $colspan,$isadv,%domconfig,@defaulteditors,@customeditors,@custommanagers,
         @possmanagers,$editorsty,$customsty);          @possmanagers);
     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",
                    'webdav'     => "WebDAV access to Authoring Spaces (https)",                     'webdav'     => "WebDAV access to Authoring Spaces (https)",
                    'editors'    => "Available Editors",                     'editors'    => "Available Editors",
                    'managers'   => "Co-authors who can add/revoke roles",                     'managers'   => "Co-authors who can add/revoke roles",
                      'archive'    => "Managers can download tar.gz file of Authoring Space", 
                    'portfolio'  => "Personal User Portfolio",                     'portfolio'  => "Personal User Portfolio",
                    'portaccess' => "Portfolio Shareable",                     'portaccess' => "Portfolio Shareable",
                    'timezone'   => "Can set Time Zone",                     'timezone'   => "Can set Time Zone",
Line 325  sub build_tools_display { Line 331  sub build_tools_display {
             &Apache::lonnet::get_dom('configuration',['quotas','authordefaults'],$ccdomain);              &Apache::lonnet::get_dom('configuration',['quotas','authordefaults'],$ccdomain);
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,'tools.webdav',          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,'tools.webdav',
                                                     'authoreditors','authormanagers',                                                      'authoreditors','authormanagers',
                                                     'domcoord.author');                                                      'authorarchive','domcoord.author');
         @usertools = ('webdav','editors','managers');          @usertools = ('webdav','editors','managers','archive');
         $colspan = ' colspan="2"';          $colspan = ' colspan="2"';
     } else {      } else {
         %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,          %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
Line 337  sub build_tools_display { Line 343  sub build_tools_display {
     }      }
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off,          my ($custom_access,$curr_access,$cust_on,$cust_off,$tool_on,$tool_off,
             $currdisp,$custdisp,$custradio,$onclick);              $currdisp,$custdisp,$custradio,$onclick,$customsty,$editorsty);
         $cust_off = 'checked="checked" ';          $cust_off = 'checked="checked" ';
         $tool_on = 'checked="checked" ';          $tool_on = 'checked="checked" ';
         $curr_access =          unless (($context eq 'authordefaults') || ($item eq 'webdav')) {
             &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef,              $curr_access =
                                               $context,\%userenv,'',                  &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item,undef,
                                               {'is_adv' => $isadv});                                                    $context,\%userenv,'',
                                                     {'is_adv' => $isadv});
           }
         if ($context eq 'requestauthor') {          if ($context eq 'requestauthor') {
             if ($userenv{$context} ne '') {              if ($userenv{$context} ne '') {
                 $cust_on = ' checked="checked" ';                  $cust_on = ' checked="checked" ';
                 $cust_off = '';                  $cust_off = '';
             }              }
         } elsif ($context eq 'authordefaults') {          } elsif ($context eq 'authordefaults') {
             if ($item eq 'editors') {              if (($item eq 'editors') || ($item eq 'archive')) {
                 if ($userenv{'author'.$item} ne '') {                  if ($userenv{'author'.$item} ne '') {
                     $cust_on = ' checked="checked" ';                      $cust_on = ' checked="checked" ';
                     $cust_off = '';                      $cust_off = '';
                       if ($item eq 'archive') {
                           $curr_access = $userenv{'author'.$item};
                       }
                   } elsif ($item eq 'archive') {
                       $curr_access = 0;
                       if (ref($domconfig{'authordefaults'}) eq 'HASH') {
                           $curr_access = $domconfig{'authordefaults'}{'archive'};
                       }
                 }                  }
             } elsif ($item eq 'webdav') {              } elsif ($item eq 'webdav') {
                 if ($userenv{'tools.'.$item} ne '') {                  if ($userenv{'tools.'.$item} ne '') {
Line 450  sub build_tools_display { Line 466  sub build_tools_display {
             my $current = $userenv{$context.'.'.$item};              my $current = $userenv{$context.'.'.$item};
             if ($item eq 'webdav') {              if ($item eq 'webdav') {
                 $current = $userenv{'tools.webdav'};                  $current = $userenv{'tools.webdav'};
               } elsif ($item eq 'archive') {
                   $current = $userenv{'author'.$item};
             }              }
             if ($current eq '') {              if ($current eq '') {
                 $custom_access =                  $custom_access =
Line 474  sub build_tools_display { Line 492  sub build_tools_display {
                    '  </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,$customsty);              my ($curroption,$currlimit);
             my $envkey = $context.'.'.$item;              my $envkey = $context.'.'.$item;
             if ($context eq 'requestauthor') {              if ($context eq 'requestauthor') {
                 $envkey = $context;                  $envkey = $context;
             }              }
             if ($userenv{$envkey} ne '') {              if ($userenv{$envkey} ne '') {
                 $curroption = $userenv{$envkey};                  $curroption = $userenv{$envkey};
                 $customsty = ' style="display:block"';  
             } else {              } else {
                 $customsty = ' style="display:none"';  
                 my (@inststatuses);                  my (@inststatuses);
                 if ($context eq 'requestcourses') {                  if ($context eq 'requestcourses') {
                     $curroption =                      $curroption =
Line 1518  sub print_user_modification_page { Line 1534  sub print_user_modification_page {
             unless ($isauthor) {              unless ($isauthor) {
                 push(@toggles,'requestauthor');                  push(@toggles,'requestauthor');
             }              }
             push(@toggles,('webdav','editors'));              push(@toggles,('webdav','editors','archive'));
         }          }
         if (&Apache::lonnet::allowed('mut',$ccdomain)) {          if (&Apache::lonnet::allowed('mut',$ccdomain)) {
             push(@toggles,('aboutme','blog','portfolio','portaccess','timezone'));              push(@toggles,('aboutme','blog','portfolio','portaccess','timezone'));
Line 3230  sub update_user_data { Line 3246  sub update_user_data {
     my @usertools = ('aboutme','blog','portfolio','portaccess','timezone');      my @usertools = ('aboutme','blog','portfolio','portaccess','timezone');
     my @requestcourses = ('official','unofficial','community','textbook','placement','lti');      my @requestcourses = ('official','unofficial','community','textbook','placement','lti');
     my @requestauthor = ('requestauthor');      my @requestauthor = ('requestauthor');
     my @authordefaults = ('webdav','editors');      my @authordefaults = ('webdav','editors','archive');
     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 =      my %canmodify_status =
Line 3362  sub update_user_data { Line 3378  sub update_user_data {
                     $changed{'webdav'} = &tool_admin('webdav',$newcustom{'webdav'},                      $changed{'webdav'} = &tool_admin('webdav',$newcustom{'webdav'},
                                                   \%changeHash,'authordefaults');                                                    \%changeHash,'authordefaults');
                 }                  }
                   if ($env{'for.customarchive'} == 1) {
                       $newcustom{'archive'} = $env{'form.authordefaults_archive'};
                       $changed{'archive'} = &tool_admin('archive',$newcustom{'archive'},
                                                     \%changeHash,'authordefaults');
   
                   }
             }              }
             if ($canmodify_status{'inststatus'}) {              if ($canmodify_status{'inststatus'}) {
                 if (exists($env{'form.inststatus'})) {                  if (exists($env{'form.inststatus'})) {
Line 3429  sub update_user_data { Line 3451  sub update_user_data {
              'id','permanentemail','portfolioquota','authorquota','inststatus',               'id','permanentemail','portfolioquota','authorquota','inststatus',
              'tools.aboutme','tools.blog','tools.webdav',               'tools.aboutme','tools.blog','tools.webdav',
              'tools.portfolio','tools.timezone','tools.portaccess',               'tools.portfolio','tools.timezone','tools.portaccess',
              'authormanagers','authoreditors','requestauthor',               'authormanagers','authoreditors','authorarchive','requestauthor',
              'requestcourses.official','requestcourses.unofficial',               'requestcourses.official','requestcourses.unofficial',
              'requestcourses.community','requestcourses.textbook',               'requestcourses.community','requestcourses.textbook',
              'requestcourses.placement','requestcourses.lti',               'requestcourses.placement','requestcourses.lti',
Line 3781  sub update_user_data { Line 3803  sub update_user_data {
                     }                      }
                     if (($env{'user.name'} eq $env{'form.ccuname'}) &&                      if (($env{'user.name'} eq $env{'form.ccuname'}) &&
                         ($env{'user.domain'} eq $env{'form.ccdomain'})) {                          ($env{'user.domain'} eq $env{'form.ccdomain'})) {
                         my %newenvhash;                          my (%newenvhash,$got_domdefs,%domdefaults,$got_userenv,
                               %userenv);
                           my @fromenv = keys(%changed);
                           push(@fromenv,'inststatus');
                         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') ||
Line 3791  sub update_user_data { Line 3816  sub update_user_data {
                                 if ($changeHash{'requestcourses.'.$key}) {                                  if ($changeHash{'requestcourses.'.$key}) {
                                     $newenvhash{'environment.canrequest.'.$key} = 1;                                      $newenvhash{'environment.canrequest.'.$key} = 1;
                                 } else {                                  } else {
                                       unless ($got_domdefs) {
                                           %domdefaults =
                                               &Apache::lonnet::get_domain_defaults($env{'user.domain'});
                                           $got_domdefs = 1;
                                       }
                                       unless ($got_userenv) {
                                           %userenv =
                                               &Apache::lonnet::userenvironment($env{'user.domain'},
                                                                                $env{'user.name'},@fromenv);
                                           $got_userenv = 1;
                                       }
                                     $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'},
                                             $key,'reload','requestcourses');                                              $key,'reload','requestcourses',\%userenv,\%domdefaults);
                                 }                                  }
                             } elsif ($key eq 'requestauthor') {                              } elsif ($key eq 'requestauthor') {
                                 $newenvhash{'environment.'.$key} = $changeHash{$key};                                  $newenvhash{'environment.'.$key} = $changeHash{$key};
                                 if ($changeHash{$key}) {                                  if ($changeHash{$key}) {
                                     $newenvhash{'environment.canrequest.author'} = 1;                                      $newenvhash{'environment.canrequest.author'} = 1;
                                 } else {                                  } else {
                                       unless ($got_domdefs) {
                                           %domdefaults =
                                              &Apache::lonnet::get_domain_defaults($env{'user.domain'});
                                           $got_domdefs = 1;
                                       }
                                       unless ($got_userenv) {
                                           %userenv =
                                               &Apache::lonnet::userenvironment($env{'user.domain'},
                                                                                $env{'user.name'},@fromenv);
                                           $got_userenv = 1;
                                       }
                                     $newenvhash{'environment.canrequest.author'} =                                      $newenvhash{'environment.canrequest.author'} =
           &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',\%userenv,\%domdefaults);
                                 }                                  }
                             } elsif ($key eq 'editors') {                              } elsif ($key eq 'editors') {
                                 $newenvhash{'environment.author'.$key} = $changeHash{'author'.$key};                                  $newenvhash{'environment.author'.$key} = $changeHash{'author'.$key};
                                 if ($key eq 'editors') {                                  if ($env{'form.customeditors'}) {
                                     if ($env{'form.customeditors'}) {                                      $newenvhash{'environment.editors'} = $changeHash{'author'.$key};
                                         $newenvhash{'environment.editors'} = $changeHash{'author'.$key};                                  } else {
                                       unless ($got_domdefs) {
                                           %domdefaults =
                                               &Apache::lonnet::get_domain_defaults($env{'user.domain'});
                                           $got_domdefs = 1;
                                       }
                                       if ($domdefaults{'editors'} ne '') {
                                           $newenvhash{'environment.editors'} = $domdefaults{'editors'};
                                     } else {                                      } else {
                                         $newenvhash{'environment.editors'} =                                          $newenvhash{'environment.editors'} = 'edit,xml';
           &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},  
                                             $key,'reload','authordefaults');  
                                     }                                      }
                                 }                                  }
                             } elsif ($key ne 'quota') {                              } elsif ($key ne 'quota') {
Line 3822  sub update_user_data { Line 3874  sub update_user_data {
                                     $newenvhash{'environment.availabletools.'.$key} =                                      $newenvhash{'environment.availabletools.'.$key} =
                                         $changeHash{'tools.'.$key};                                          $changeHash{'tools.'.$key};
                                 } else {                                  } else {
                                       unless ($got_domdefs) {
                                           %domdefaults =
                                              &Apache::lonnet::get_domain_defaults($env{'user.domain'});
                                           $got_domdefs = 1;
                                       }
                                       unless ($got_userenv) {
                                           %userenv =
                                               &Apache::lonnet::userenvironment($env{'user.domain'},
                                                                                $env{'user.name'},@fromenv);
                                           $got_userenv = 1;
                                       }
                                     $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',\%userenv,\%domdefaults);
                                 }                                  }
                             }                              }
                         }                          }
Line 4026  sub display_userinfo { Line 4089  sub display_userinfo {
          'chto'           => 'Changed To:',           'chto'           => 'Changed To:',
          'editors'        => "Available Editors in Authoring Space",           'editors'        => "Available Editors in Authoring Space",
          'managers'       => "Co-authors who can add/revoke roles",           'managers'       => "Co-authors who can add/revoke roles",
            'archive'        => "Managers can download tar.gz file of Authoring Space",
          'edit'           => 'Standard editor (Edit)',           'edit'           => 'Standard editor (Edit)',
          'xml'            => 'Text editor (EditXML)',           'xml'            => 'Text editor (EditXML)',
          'daxe'           => 'Daxe editor (Daxe)',           'daxe'           => 'Daxe editor (Daxe)',
Line 4059  sub display_userinfo { Line 4123  sub display_userinfo {
                     if ($entry eq 'requestauthor') {                      if ($entry eq 'requestauthor') {
                         @items = ($entry);                          @items = ($entry);
                     } elsif ($entry eq 'authordefaults') {                      } elsif ($entry eq 'authordefaults') {
                         @items = ('webdav','managers','editors');                          @items = ('webdav','managers','editors','archive');
                     } else {                      } else {
                         @items = @{$requestcourses};                          @items = @{$requestcourses};
                     }                      }
Line 4310  sub tool_changes { Line 4374  sub tool_changes {
             } elsif ($tool eq 'webdav') {              } elsif ($tool eq 'webdav') {
                 $envkey = 'tools.webdav';                  $envkey = 'tools.webdav';
                 $newval = $env{'form.'.$context.'_'.$tool};                  $newval = $env{'form.'.$context.'_'.$tool};
               } elsif ($tool eq 'archive') {
                   $envkey = 'authorarchive';
                   $newval = $env{'form.'.$context.'_'.$tool};
             }              }
         } else {          } else {
             $newval = $env{'form.'.$context.'_'.$tool};              $newval = $env{'form.'.$context.'_'.$tool};
Line 4341  sub tool_changes { Line 4408  sub tool_changes {
                 } elsif ($tool eq 'editors') {                  } elsif ($tool eq 'editors') {
                     $oldaccesstext->{$tool} = &mt('can use: [_1]',                      $oldaccesstext->{$tool} = &mt('can use: [_1]',
                                                   join(', ', map { $tooldesc{$_} } split(/,/,$userenv->{$envkey})));                                                    join(', ', map { $tooldesc{$_} } split(/,/,$userenv->{$envkey})));
                 } elsif ($tool eq 'webdav') {                  } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                     if ($userenv->{$envkey}) {                      if ($userenv->{$envkey}) {
                         $oldaccesstext->{$tool} = &mt("availability set to 'on'");                          $oldaccesstext->{$tool} = &mt("availability set to 'on'");
                     } else {                      } else {
Line 4387  sub tool_changes { Line 4454  sub tool_changes {
                                     $managers =~ s/,/, /g;                                      $managers =~ s/,/, /g;
                                     $newaccesstext->{$tool} = $managers;                                      $newaccesstext->{$tool} = $managers;
                                 }                                  }
                             } elsif ($tool eq 'webdav') {                              } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                                 if ($newval) {                                  if ($newval) {
                                     $newaccesstext->{$tool} = &mt("availability set to 'on'");                                      $newaccesstext->{$tool} = &mt("availability set to 'on'");
                                 } else {                                  } else {
Line 4427  sub tool_changes { Line 4494  sub tool_changes {
                                     $managers =~ s/,/, /g;                                      $managers =~ s/,/, /g;
                                     $newaccesstext->{$tool} = $managers;                                      $newaccesstext->{$tool} = $managers;
                                 }                                  }
                             } elsif ($tool eq 'webdav') {                              } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                                 if ($userenv->{$envkey}) {                                  if ($userenv->{$envkey}) {
                                     $newaccesstext->{$tool} = &mt("availability set to 'on'");                                      $newaccesstext->{$tool} = &mt("availability set to 'on'");
                                 } else {                                  } else {
Line 4476  sub tool_changes { Line 4543  sub tool_changes {
                                 $managers =~ s/,/, /g;                                  $managers =~ s/,/, /g;
                                 $newaccesstext->{$tool} = $managers;                                  $newaccesstext->{$tool} = $managers;
                             }                              }
                         } elsif ($tool eq 'webdav') {                          } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                             if ($userenv->{$envkey}) {                              if ($userenv->{$envkey}) {
                                 $newaccesstext->{$tool} = &mt("availability set to 'on'");                                  $newaccesstext->{$tool} = &mt("availability set to 'on'");
                             } else {                              } else {
Line 4524  sub tool_changes { Line 4591  sub tool_changes {
                         } elsif ($tool eq 'editors') {                          } elsif ($tool eq 'editors') {
                             $newaccesstext->{$tool} = &mt('can use: [_1]',                              $newaccesstext->{$tool} = &mt('can use: [_1]',
                                                           join(', ', map { $tooldesc{$_} } split(/,/,$newval)));                                                            join(', ', map { $tooldesc{$_} } split(/,/,$newval)));
                         } elsif ($tool eq 'webdav') {                          } elsif (($tool eq 'webdav') || ($tool eq 'archive')) {
                             if ($newval) {                              if ($newval) {
                                 $newaccesstext->{$tool} = &mt("availability set to 'on'");                                  $newaccesstext->{$tool} = &mt("availability set to 'on'");
                             } else {                              } else {
Line 5188  sub tool_admin { Line 5255  sub tool_admin {
             $toolchanged = 1;              $toolchanged = 1;
             if ($tool eq 'requestauthor') {              if ($tool eq 'requestauthor') {
                 $changeHash->{$context} = $settool;                  $changeHash->{$context} = $settool;
             } elsif (($tool eq 'managers') || ($tool eq 'editors')) {              } elsif (($tool eq 'managers') || ($tool eq 'editors') || ($tool eq 'archive')) {
                 $changeHash->{'author'.$tool} = $settool;                  $changeHash->{'author'.$tool} = $settool;
             } elsif ($tool eq 'webdav') {              } elsif ($tool eq 'webdav') {
                 $changeHash->{'tools.'.$tool} = $settool;                  $changeHash->{'tools.'.$tool} = $settool;

Removed from v.1.473  
changed lines
  Added in v.1.478


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