Diff for /loncom/interface/loncreateuser.pm between versions 1.382 and 1.383

version 1.382, 2013/12/09 21:33:32 version 1.383, 2013/12/17 06:41:44
Line 189  END_SCRIPT Line 189  END_SCRIPT
             $showquota = $currquota;              $showquota = $currquota;
             if ($longinsttype eq '') {              if ($longinsttype eq '') {
                 $defaultinfo = &mt('For this user, the default quota would be [_1]'                  $defaultinfo = &mt('For this user, the default quota would be [_1]'
                               .' Mb.',$defquota);                                .' MB.',$defquota);
             } else {              } else {
                 $defaultinfo = &mt("For this user, the default quota would be [_1]".                  $defaultinfo = &mt("For this user, the default quota would be [_1]".
                                    " Mb, as determined by the user's institutional".                                     " MB, as determined by the user's institutional".
                                    " affiliation ([_2]).",$defquota,$longinsttype);                                     " affiliation ([_2]).",$defquota,$longinsttype);
             }              }
         } else {          } else {
             if ($longinsttype eq '') {              if ($longinsttype eq '') {
                 $defaultinfo = &mt('For this user, the default quota is [_1]'                  $defaultinfo = &mt('For this user, the default quota is [_1]'
                               .' Mb.',$defquota);                                .' MB.',$defquota);
             } else {              } else {
                 $defaultinfo = &mt("For this user, the default quota of [_1]".                  $defaultinfo = &mt("For this user, the default quota of [_1]".
                                    " Mb, is determined by the user's institutional".                                     " MB, is determined by the user's institutional".
                                    " affiliation ([_2]).",$defquota,$longinsttype);                                     " affiliation ([_2]).",$defquota,$longinsttype);
             }              }
         }          }
Line 212  END_SCRIPT Line 212  END_SCRIPT
                        '  </tr>'."\n".                         '  </tr>'."\n".
                        &Apache::loncommon::start_data_table_row()."\n".                         &Apache::loncommon::start_data_table_row()."\n".
                        '  <td>'.$lt{'cuqu'}.': '.                         '  <td>'.$lt{'cuqu'}.': '.
                        $currquota.'&nbsp;Mb.&nbsp;&nbsp;'.                         $currquota.'&nbsp;MB.&nbsp;&nbsp;'.
                        $defaultinfo.'</td>'."\n".                         $defaultinfo.'</td>'."\n".
                        &Apache::loncommon::end_data_table_row()."\n".                         &Apache::loncommon::end_data_table_row()."\n".
                        &Apache::loncommon::start_data_table_row()."\n".                         &Apache::loncommon::start_data_table_row()."\n".
Line 220  END_SCRIPT Line 220  END_SCRIPT
                        ': <label>'.                         ': <label>'.
                        '<input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_off" '.                         '<input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_off" '.
                        'value="0" '.$custom_off.' onchange="javascript:quota_changes('."'custom','$name'".');"'.                         'value="0" '.$custom_off.' onchange="javascript:quota_changes('."'custom','$name'".');"'.
                        ' />'.$lt{'defa'}.'&nbsp;('.$defquota.' Mb).</label>&nbsp;'.                         ' />'.$lt{'defa'}.'&nbsp;('.$defquota.' MB).</label>&nbsp;'.
                        '&nbsp;<label><input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_on" '.                         '&nbsp;<label><input type="radio" name="custom_'.$name.'quota" id="custom_'.$name.'quota_on" '.
                        'value="1" '.$custom_on.'  onchange="javascript:quota_changes('."'custom','$name'".');"'.                         'value="1" '.$custom_on.'  onchange="javascript:quota_changes('."'custom','$name'".');"'.
                        ' />'.$lt{'cust'}.':</label>&nbsp;'.                         ' />'.$lt{'cust'}.':</label>&nbsp;'.
                        '<input type="text" name="'.$name.'quota" id="'.$name.'quota" size ="5" '.                         '<input type="text" name="'.$name.'quota" id="'.$name.'quota" size ="5" '.
                        'value="'.$showquota.'" onfocus="javascript:quota_changes('."'quota','$name'".');"'.                         'value="'.$showquota.'" onfocus="javascript:quota_changes('."'quota','$name'".');"'.
                        ' />&nbsp;Mb</span></td>'."\n".                         ' />&nbsp;MB</span></td>'."\n".
                        &Apache::loncommon::end_data_table_row()."\n";                         &Apache::loncommon::end_data_table_row()."\n";
         }          }
     }      }
Line 568  sub requestauthor_display { Line 568  sub requestauthor_display {
    return %titles;     return %titles;
 }  }
   
   sub requestchange_display {
       my %titles = &Apache::lonlocal::texthash (
                                      approval   => "availability set to 'on' (approval required)", 
                                      automatic  => "availability set to 'on' (automatic approval)",
                                      norequest  => "availability set to 'off'",
      );
      return %titles;
   }
   
 sub curr_requestauthor {  sub curr_requestauthor {
     my ($uname,$udom,$isadv,$inststatuses,$domconfig) = @_;      my ($uname,$udom,$isadv,$inststatuses,$domconfig) = @_;
     return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH'));      return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH'));
Line 1225  ENDFORMINFO Line 1234  ENDFORMINFO
             # Current user has quota or user tools modification privileges              # Current user has quota or user tools modification privileges
             $portfolioform = '<br />'.&user_quotas($ccuname,$ccdomain);              $portfolioform = '<br />'.&user_quotas($ccuname,$ccdomain);
         }          }
         if (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) {          if ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) &&
               ($ccdomain eq $env{'request.role.domain'})) {
             $domroleform = '<br />'.&domainrole_req($ccuname,$ccdomain);              $domroleform = '<br />'.&domainrole_req($ccuname,$ccdomain);
         }          }
         &initialize_authen_forms($ccdomain,$formname);          &initialize_authen_forms($ccdomain,$formname);
Line 1392  ENDCHANGEUSER Line 1402  ENDCHANGEUSER
         my ($isadv,$isauthor) =           my ($isadv,$isauthor) = 
             &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);              &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
         if ((!$isauthor) &&           if ((!$isauthor) && 
             (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))) {              (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))
               && ($env{'request.role.domain'} eq $ccdomain)) {
             $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);              $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
         }          }
         $user_text{'auth'} =  &user_authentication($ccuname,$ccdomain,$formname);          $user_text{'auth'} =  &user_authentication($ccuname,$ccdomain,$formname);
Line 2597  sub update_user_data { Line 2608  sub update_user_data {
                         $newcustom{$item} = $env{'form.crsreq_'.$item};                          $newcustom{$item} = $env{'form.crsreq_'.$item};
                         if ($env{'form.crsreq_'.$item} eq 'autolimit') {                          if ($env{'form.crsreq_'.$item} eq 'autolimit') {
                             $newcustom{$item} .= '=';                              $newcustom{$item} .= '=';
                             unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {                              $env{'form.crsreq_'.$item.'_limit'} =~ s/\D+//g;
                               if ($env{'form.crsreq_'.$item.'_limit'}) {
                                 $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};                                  $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
                             }                              }
                         }                          }
Line 2923  sub update_user_data { Line 2935  sub update_user_data {
                 }                  }
                 if ($oldisdefault{$name}) {                  if ($oldisdefault{$name}) {
                     $oldsettingstext{'quota'}{$name} = &get_defaultquota_text($oldsettingstatus{$name});                      $oldsettingstext{'quota'}{$name} = &get_defaultquota_text($oldsettingstatus{$name});
                   }  else {
                       $oldsettingstext{'quota'}{$name} = &mt('custom quota: [_1] MB',$oldquota{$name});
                 }                  }
                 if ($newisdefault{$name}) {                  if ($newisdefault{$name}) {
                     $newsettingstext{'quota'}{$name} = &get_defaultquota_text($newsettingstatus{$name});                      $newsettingstext{'quota'}{$name} = &get_defaultquota_text($newsettingstatus{$name});
                   } else {
                       $newsettingstext{'quota'}{$name} = &mt('custom quota: [_1] MB',$newquota{$name});
                 }                  }
             }              }
             &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,              &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,
Line 2945  sub update_user_data { Line 2961  sub update_user_data {
             }              }
         }          }
         foreach my $name ('portfolio','author') {          foreach my $name ('portfolio','author') {
             $oldsettings{'quota'}{$name} = $oldquota{$name}.' Mb';              $oldsettings{'quota'}{$name} = $oldquota{$name}.' MB';
             $newsettings{'quota'}{$name} = $newquota{$name}.' Mb';              $newsettings{'quota'}{$name} = $newquota{$name}.' MB';
         }          }
         if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {          if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
             my ($chgresult,$namechgresult);              my ($chgresult,$namechgresult);
Line 3178  sub display_userinfo { Line 3194  sub display_userinfo {
         $r->print('<th><span class="LC_nobreak"><b>'.$lt{'chto'}.'</b></span></th>');          $r->print('<th><span class="LC_nobreak"><b>'.$lt{'chto'}.'</b></span></th>');
         $r->print(&Apache::loncommon::end_data_table_header_row());          $r->print(&Apache::loncommon::end_data_table_header_row());
         my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');          my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
           
   
         foreach my $item (@userinfo) {          foreach my $item (@userinfo) {
             my $value = $env{'form.c'.$item};              my $value = $env{'form.c'.$item};
             #show changes only:              #show changes only:
             unless($value eq $userenv->{$item}){              unless ($value eq $userenv->{$item}){
                 $r->print(&Apache::loncommon::start_data_table_row());                  $r->print(&Apache::loncommon::start_data_table_row());
   
                 $r->print("<td>$lt{$item}</td>\n");                  $r->print("<td>$lt{$item}</td>\n");
                 $r->print('<td>'.$userenv->{$item}.' </td>');                  $r->print("<td>".$userenv->{$item}."</td>\n");
                 $r->print("<td>$value </td>\n");                  $r->print("<td>$value </td>\n");
   
                 $r->print(&Apache::loncommon::end_data_table_row());                  $r->print(&Apache::loncommon::end_data_table_row());
             }              }
         }          }
         foreach my $entry (@{$order}) {          foreach my $entry (@{$order}) {
             if ($canshow->{$entry} && ($newsetting->{$entry} ne $newsetting->{$entry})) {              if ($canshow->{$entry}) {
                 $r->print(&Apache::loncommon::start_data_table_row());                  if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom') || ($entry eq 'requestauthor')) {
                 if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {                      my @items;
                     foreach my $item (@{$requestcourses}) {                      if ($entry eq 'requestauthor') {
                         $r->print("<td>$lt{$item}</td>\n");                          @items = ($entry);
                         $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");                      } else {
                         my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};                          @items = @{$requestcourses};
                         if ($changedhash->{$item}) {                      } 
                             $value = '<span class="LC_cusr_emph">'.$value.'</span>';                      foreach my $item (@items) {
                           if (($newsetting->{$item} ne $oldsetting->{$item}) || 
                               ($newsettingtext->{$item} ne $oldsettingtext->{$item})) {
                               $r->print(&Apache::loncommon::start_data_table_row()."\n");  
                               $r->print("<td>$lt{$item}</td>\n");
                               $r->print("<td>".$oldsetting->{$item});
                               if ($oldsettingtext->{$item}) {
                                   if ($oldsetting->{$item}) {
                                       $r->print(' -- ');
                                   }
                                   $r->print($oldsettingtext->{$item});
                               }
                               $r->print("</td>\n");
                               $r->print("<td>".$newsetting->{$item});
                               if ($newsettingtext->{$item}) {
                                   if ($newsetting->{$item}) {
                                       $r->print(' -- ');
                                   }
                                   $r->print($newsettingtext->{$item});
                               }
                               $r->print("</td>\n");
                               $r->print(&Apache::loncommon::end_data_table_row()."\n");
                         }                          }
                         $r->print("<td>$value </td>\n");  
                     }                      }
                 } elsif ($entry eq 'tools') {                  } elsif ($entry eq 'tools') {
                     foreach my $item (@{$usertools}) {                      foreach my $item (@{$usertools}) {
                         $r->print("<td>$lt{$item}</td>\n");                          if ($newsetting->{$item} ne $oldsetting->{$item}) {
                         $r->print("<td>$oldsetting->{$item} $oldsettingtext->{$item}</td>\n");                              $r->print(&Apache::loncommon::start_data_table_row()."\n");
                         my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};                              $r->print("<td>$lt{$item}</td>\n");
                         if ($changedhash->{$item}) {                              $r->print("<td>".$oldsetting->{$item}.' '.$oldsettingtext->{$item}."</td>\n");
                             $value = '<span class="LC_cusr_emph">'.$value.'</span>';                              $r->print("<td>".$newsetting->{$item}.' '.$newsettingtext->{$item}."</td>\n");
                               $r->print(&Apache::loncommon::end_data_table_row()."\n");
                         }                          }
                         $r->print("<td>$value </td>\n");  
                     }                      }
                 } elsif ($entry eq 'quota') {                  } elsif ($entry eq 'quota') {
                     if ((ref($oldsetting->{$entry}) eq 'HASH') && (ref($oldsettingtext->{$entry}) eq 'HASH') &&                      if ((ref($oldsetting->{$entry}) eq 'HASH') && (ref($oldsettingtext->{$entry}) eq 'HASH') &&
                         (ref($newsetting->{$entry}) eq 'HASH') && (ref($newsettingtext->{$entry}) eq 'HASH')) {                          (ref($newsetting->{$entry}) eq 'HASH') && (ref($newsettingtext->{$entry}) eq 'HASH')) {
                         foreach my $name ('portfolio','author') {                          foreach my $name ('portfolio','author') {
                             $r->print("<td>$lt{$name.$entry}</td>\n");                              if ($newsetting->{$entry}->{$name} ne $oldsetting->{$entry}->{$name}) {
                             $r->print("<td>$oldsetting->{$entry}->{$name} $oldsettingtext->{$entry}->{$name} </td>\n");                                  $r->print(&Apache::loncommon::start_data_table_row()."\n");
                             my $value = $newsetting->{$entry}->{$name}.' '.$newsettingtext->{$entry}->{$name};                                  $r->print("<td>$lt{$name.$entry}</td>\n");
                             if ($changedhash->{$entry}) {                                  $r->print("<td>".$oldsettingtext->{$entry}->{$name}."</td>\n");
                                 $value = '<span class="LC_cusr_emph">'.$value.'</span>';                                  $r->print("<td>".$newsettingtext->{$entry}->{$name}."</td>\n");
                                   $r->print(&Apache::loncommon::end_data_table_row()."\n");
                             }                              }
                              $r->print("<td>$value </td>\n");  
                         }                          }
                     }                      }
                 } else {                  } else {
                     $r->print("<td>$lt{$entry}</td>\n");                      if ($newsetting->{$entry} ne $oldsetting->{$entry}) {
                     $r->print("<td>$oldsetting->{$entry} $oldsettingtext->{$entry} </td>\n");                          $r->print(&Apache::loncommon::start_data_table_row()."\n");
                     my $value = $newsetting->{$entry}.' '.$newsettingtext->{$entry};                          $r->print("<td>$lt{$entry}</td>\n");
                     if ($changedhash->{$entry}) {                          $r->print("<td>".$oldsetting->{$entry}.' '.$oldsettingtext->{$entry}."</td>\n");
                         $value = '<span class="LC_cusr_emph">'.$value.'</span>';                          $r->print("<td>".$newsetting->{$entry}.' '.$newsettingtext->{$entry}."</td>\n");
                           $r->print(&Apache::loncommon::end_data_table_row()."\n");
                     }                      }
                     $r->print("<td>$value </td>\n");  
                 }                  }
                 $r->print(&Apache::loncommon::end_data_table_row());  
             }              }
         }          }
         $r->print(&Apache::loncommon::end_data_table().'<br />');          $r->print(&Apache::loncommon::end_data_table().'<br />');
Line 3258  sub tool_changes { Line 3290  sub tool_changes {
           (ref($newaccess) eq 'HASH') && (ref($newaccesstext) eq 'HASH'))) {            (ref($newaccess) eq 'HASH') && (ref($newaccesstext) eq 'HASH'))) {
         return;          return;
     }      }
       my %reqdisplay = &requestchange_display();
     if ($context eq 'reqcrsotherdom') {      if ($context eq 'reqcrsotherdom') {
         my @options = ('approval','validate','autolimit');          my @options = ('approval','validate','autolimit');
         my $optregex = join('|',@options);          my $optregex = join('|',@options);
         my %reqdisplay = &courserequest_display();  
         my $cdom = $env{'request.role.domain'};          my $cdom = $env{'request.role.domain'};
         foreach my $tool (@{$usertools}) {          foreach my $tool (@{$usertools}) {
             $oldaccesstext->{$tool} = &mt('No');              $oldaccesstext->{$tool} = &mt("availability set to 'off'");
             $newaccesstext->{$tool} = $oldaccesstext->{$tool};              $newaccesstext->{$tool} = $oldaccesstext->{$tool};
             $changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool};              $changeHash->{$context.'.'.$tool} = $userenv->{$context.'.'.$tool};
             my $newop;              my ($newop,$limit);
             if ($env{'form.'.$context.'_'.$tool}) {              if ($env{'form.'.$context.'_'.$tool}) {
                 $newop = $env{'form.'.$context.'_'.$tool};                  $newop = $env{'form.'.$context.'_'.$tool};
                 if ($newop eq 'autolimit') {                  if ($newop eq 'autolimit') {
                     my $limit = $env{'form.'.$context.'_'.$tool.'_limit'};                      $limit = $env{'form.'.$context.'_'.$tool.'_limit'};
                     $limit =~ s/\D+//g;                      $limit =~ s/\D+//g;
                     $newop .= '='.$limit;                      $newop .= '='.$limit;
                 }                  }
Line 3281  sub tool_changes { Line 3313  sub tool_changes {
                     $changed->{$tool}=&tool_admin($tool,$cdom.':'.$newop,                      $changed->{$tool}=&tool_admin($tool,$cdom.':'.$newop,
                                                   $changeHash,$context);                                                    $changeHash,$context);
                     if ($changed->{$tool}) {                      if ($changed->{$tool}) {
                         $newaccesstext->{$tool} = &mt('Yes');                          if ($newop =~ /^autolimit/) {
                               if ($limit) {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                               } else {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                               }
                           } else {
                               $newaccesstext->{$tool} = $reqdisplay{$newop};
                           }
                     } else {                      } else {
                         $newaccesstext->{$tool} = $oldaccesstext->{$tool};                          $newaccesstext->{$tool} = $oldaccesstext->{$tool};
                     }                      }
Line 3292  sub tool_changes { Line 3332  sub tool_changes {
                 my $changedoms;                  my $changedoms;
                 foreach my $req (@curr) {                  foreach my $req (@curr) {
                     if ($req =~ /^\Q$cdom\E\:($optregex\=?\d*)$/) {                      if ($req =~ /^\Q$cdom\E\:($optregex\=?\d*)$/) {
                         $oldaccesstext->{$tool} = &mt('Yes');  
                         my $oldop = $1;                          my $oldop = $1;
                           if ($oldop =~ /^autolimit=(\d*)/) {
                               my $limit = $1;
                               if ($limit) {
                                   $oldaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                               } else {
                                   $oldaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                               }
                           } else {
                               $oldaccesstext->{$tool} = $reqdisplay{$oldop};
                           }
                         if ($oldop ne $newop) {                          if ($oldop ne $newop) {
                             $changedoms = 1;                              $changedoms = 1;
                             foreach my $item (@curr) {                              foreach my $item (@curr) {
Line 3327  sub tool_changes { Line 3376  sub tool_changes {
                                 my $limit = $env{'form.'.$context.'_'.$tool.'_limit'};                                  my $limit = $env{'form.'.$context.'_'.$tool.'_limit'};
                                 $limit =~ s/\D+//g;                                  $limit =~ s/\D+//g;
                                 if ($limit) {                                  if ($limit) {
                                     $newaccesstext->{$tool} = &mt('Yes, up to limit of [quant,_1,request] per user.',$limit);                                      $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                                 } else {                                  } else {
                                     $newaccesstext->{$tool} = &mt('Yes, processed automatically');                                      $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                                 }                                  }
                             } else {                              } else {
                                 $newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}};                                  $newaccesstext->{$tool} = $reqdisplay{$env{'form.'.$context.'_'.$tool}};
                             }                              }
                         } else {                          } else {
                             $newaccesstext->{$tool} = &mt('No');                              $newaccesstext->{$tool} = &mt("availability set to 'off'");
                         }                          }
                     }                      }
                 }                  }
Line 3344  sub tool_changes { Line 3393  sub tool_changes {
         return;          return;
     }      }
     foreach my $tool (@{$usertools}) {      foreach my $tool (@{$usertools}) {
         my ($newval,$envkey);          my ($newval,$limit,$envkey);
         $envkey = $context.'.'.$tool;          $envkey = $context.'.'.$tool;
         if ($context eq 'requestcourses') {          if ($context eq 'requestcourses') {
             $newval = $env{'form.crsreq_'.$tool};              $newval = $env{'form.crsreq_'.$tool};
             if ($newval eq 'autolimit') {              if ($newval eq 'autolimit') {
                 $newval .= '='.$env{'form.crsreq_'.$tool.'_limit'};                  $limit = $env{'form.crsreq_'.$tool.'_limit'};
                   $limit =~ s/\D+//g;
                   $newval .= '='.$limit;
             }              }
         } elsif ($context eq 'requestauthor') {          } elsif ($context eq 'requestauthor') {
             $newval = $env{'form.'.$context};              $newval = $env{'form.'.$context};
Line 3359  sub tool_changes { Line 3410  sub tool_changes {
         }          }
         if ($userenv->{$envkey} ne '') {          if ($userenv->{$envkey} ne '') {
             $oldaccess->{$tool} = &mt('custom');              $oldaccess->{$tool} = &mt('custom');
             if ($userenv->{$envkey}) {              if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
                 $oldaccesstext->{$tool} = &mt("availability set to 'on'");                  if ($userenv->{$envkey} =~ /^autolimit=(\d*)$/) {
                       my $currlimit = $1;
                       if ($currlimit eq '') {
                           $oldaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                       } else {
                           $oldaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$currlimit);
                       }
                   } elsif ($userenv->{$envkey}) {
                       $oldaccesstext->{$tool} = $reqdisplay{$userenv->{$envkey}};
                   } else {
                       $oldaccesstext->{$tool} = &mt("availability set to 'off'");
                   }
             } else {              } else {
                 $oldaccesstext->{$tool} = &mt("availability set to 'off'");                  if ($userenv->{$envkey}) {
                       $oldaccesstext->{$tool} = &mt("availability set to 'on'");
                   } else {
                       $oldaccesstext->{$tool} = &mt("availability set to 'off'");
                   }
             }              }
             $changeHash->{$envkey} = $userenv->{$envkey};              $changeHash->{$envkey} = $userenv->{$envkey};
             if ($env{'form.custom'.$tool} == 1) {              if ($env{'form.custom'.$tool} == 1) {
Line 3371  sub tool_changes { Line 3437  sub tool_changes {
                                                     $context);                                                      $context);
                     if ($changed->{$tool}) {                      if ($changed->{$tool}) {
                         $newaccess->{$tool} = &mt('custom');                          $newaccess->{$tool} = &mt('custom');
                         if ($newval) {                          if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
                             $newaccesstext->{$tool} = &mt("availability set to 'on'");                              if ($newval =~ /^autolimit/) {
                                   if ($limit) {
                                       $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                                   } else {
                                       $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                                   }
                               } elsif ($newval) {
                                   $newaccesstext->{$tool} = $reqdisplay{$newval};
                               } else {
                                   $newaccesstext->{$tool} = &mt("availability set to 'off'");
                               }
                         } else {                          } else {
                             $newaccesstext->{$tool} = &mt("availability set to 'off'");                              if ($newval) {
                                   $newaccesstext->{$tool} = &mt("availability set to 'on'");
                               } else {
                                   $newaccesstext->{$tool} = &mt("availability set to 'off'");
                               }
                         }                          }
                     } else {                      } else {
                         $newaccess->{$tool} = $oldaccess->{$tool};                          $newaccess->{$tool} = $oldaccess->{$tool};
                         if ($userenv->{$context.'.'.$tool}) {                          if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
                             $newaccesstext->{$tool} = &mt("availability set to 'on'");                              if ($newval =~ /^autolimit/) {
                                   if ($limit) {
                                       $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                                   } else {
                                       $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                                   }
                               } elsif ($newval) {
                                   $newaccesstext->{$tool} = $reqdisplay{$newval};
                               } else {
                                   $newaccesstext->{$tool} = &mt("availability set to 'off'");
                               }
                         } else {                          } else {
                             $newaccesstext->{$tool} = &mt("availability set to 'off'");                              if ($userenv->{$context.'.'.$tool}) {
                                   $newaccesstext->{$tool} = &mt("availability set to 'on'");
                               } else {
                                   $newaccesstext->{$tool} = &mt("availability set to 'off'");
                               }
                         }                          }
                     }                      }
                 } else {                  } else {
Line 3394  sub tool_changes { Line 3488  sub tool_changes {
                     $newaccess->{$tool} = &mt('default');                      $newaccess->{$tool} = &mt('default');
                 } else {                  } else {
                     $newaccess->{$tool} = $oldaccess->{$tool};                      $newaccess->{$tool} = $oldaccess->{$tool};
                     if ($userenv->{$context.'.'.$tool}) {                      if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
                         $newaccesstext->{$tool} = &mt("availability set to 'on'");                          if ($newval =~ /^autolimit/) {
                               if ($limit) {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                               } else {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                               }
                           } elsif ($newval) {
                               $newaccesstext->{$tool} = $reqdisplay{$newval};
                           } else {
                               $newaccesstext->{$tool} = &mt("availability set to 'off'");
                           }
                     } else {                      } else {
                         $newaccesstext->{$tool} = &mt("availability set to 'off'");                          if ($userenv->{$context.'.'.$tool}) {
                               $newaccesstext->{$tool} = &mt("availability set to 'on'");
                           } else {
                               $newaccesstext->{$tool} = &mt("availability set to 'off'");
                           }
                     }                      }
                 }                  }
             }              }
Line 3408  sub tool_changes { Line 3516  sub tool_changes {
                                                 $context);                                                  $context);
                 if ($changed->{$tool}) {                  if ($changed->{$tool}) {
                     $newaccess->{$tool} = &mt('custom');                      $newaccess->{$tool} = &mt('custom');
                     if ($newval) {                      if (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
                         $newaccesstext->{$tool} = &mt("availability set to 'on'");                          if ($newval =~ /^autolimit/) {
                               if ($limit) {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval, up to limit of [quant,_1,request] per user',$limit);
                               } else {
                                   $newaccesstext->{$tool} = &mt('available with automatic approval (unlimited)');
                               }
                           } elsif ($newval) {
                               $newaccesstext->{$tool} = $reqdisplay{$newval};
                           } else {
                               $newaccesstext->{$tool} = &mt("availability set to 'off'");
                           }
                     } else {                      } else {
                         $newaccesstext->{$tool} = &mt("availability set to 'off'");                          if ($newval) {
                               $newaccesstext->{$tool} = &mt("availability set to 'on'");
                           } else {
                               $newaccesstext->{$tool} = &mt("availability set to 'off'");
                           }
                     }                      }
                 } else {                  } else {
                     $newaccess->{$tool} = $oldaccess->{$tool};                      $newaccess->{$tool} = $oldaccess->{$tool};
Line 3834  sub get_defaultquota_text { Line 3956  sub get_defaultquota_text {
     my ($settingstatus) = @_;      my ($settingstatus) = @_;
     my $defquotatext;       my $defquotatext; 
     if ($settingstatus eq '') {      if ($settingstatus eq '') {
         $defquotatext = &mt('(default)');          $defquotatext = &mt('default');
     } else {      } else {
         my ($usertypes,$order) =          my ($usertypes,$order) =
             &Apache::lonnet::retrieve_inst_usertypes($env{'form.ccdomain'});              &Apache::lonnet::retrieve_inst_usertypes($env{'form.ccdomain'});
         if ($usertypes->{$settingstatus} eq '') {          if ($usertypes->{$settingstatus} eq '') {
             $defquotatext = &mt('(default)');              $defquotatext = &mt('default');
         } else {          } else {
             $defquotatext = &mt('(default for [_1])',$usertypes->{$settingstatus});              $defquotatext = &mt('default for [_1]',$usertypes->{$settingstatus});
         }          }
     }      }
     return $defquotatext;      return $defquotatext;
Line 3866  sub update_result_form { Line 3988  sub update_result_form {
         $outcome .= '<input type="hidden" name="forcenewuser" value="1" />'."\n";          $outcome .= '<input type="hidden" name="forcenewuser" value="1" />'."\n";
     }      }
     $outcome .= '<input type="hidden" name="phase" value="" />'."\n".      $outcome .= '<input type="hidden" name="phase" value="" />'."\n".
                 '<input type ="hidden" name="currstate" value="" />'."\n".                  '<input type="hidden" name="currstate" value="" />'."\n".
                 '<input type ="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n".                  '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n".
                 '</form>';                  '</form>';
     return $outcome;      return $outcome;
 }  }

Removed from v.1.382  
changed lines
  Added in v.1.383


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