Diff for /loncom/interface/loncreateuser.pm between versions 1.161 and 1.166

version 1.161, 2007/07/29 04:32:44 version 1.166, 2007/08/02 01:02:56
Line 200  sub print_username_entry_form { Line 200  sub print_username_entry_form {
         $formtoset = 'docustom';          $formtoset = 'docustom';
         $env{'form.rolename'} = $env{'form.startrolename'};          $env{'form.rolename'} = $env{'form.startrolename'};
     }      }
     my ($newuserscript,$newuservalidate);  
   
     if ($forcenewuser) {  
         $newuserscript = <<"ENDSCRIPT";  
   
 function setSearch() {  
     var createnew = 0;  
     for (var i=0; i<document.crtuser.forcenew.length; i++) {  
         if (document.crtuser.forcenew[i].checked) {  
             if (document.crtuser.forcenew[i].value == 1) {  
                 createnew = 1;  
             }  
         }  
     }   
     if (createnew == 1) {  
         for (var i=0; i<document.crtuser.srchby.length; i++) {  
             if (document.crtuser.srchby.options[i].value == 'uname') {  
                 document.crtuser.srchby.selectedIndex = i;  
             }  
         }  
         for (var i=0; i<document.crtuser.srchin.length; i++) {  
             if (document.crtuser.srchin.options[i].value == 'dom') {  
                 document.crtuser.srchin.selectedIndex = i;  
             }  
         }  
         for (var i=0; i<document.crtuser.srchtype.length; i++) {  
             if (document.crtuser.srchtype.options[i].value == 'exact') {  
                 document.crtuser.srchtype.selectedIndex = i;  
             }  
         }  
         for (var i=0; i<document.crtuser.srchdomain.length; i++) {  
             if (document.crtuser.srchdomain.options[i].value == '$env{'request.role.domain'}') {  
                 document.crtuser.srchdomain.selectedIndex = i;  
             }  
         }  
     }  
 }  
 ENDSCRIPT  
         $newuservalidate = <<"ENDBLOCK";  
     setSearch();  
 ENDBLOCK  
     }  
     my $validatescript = <<"ENDSCRIPT";  
   
 function validateEntry() {  
     var checkok = 1;  
     var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value;  
     var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value;  
     var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value;  
     var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value;  
     var srchterm =  document.crtuser.srchterm.value;  
     var msg = "";  
   
     if (srchterm == "") {  
         checkok = 0;  
         msg += "You must include some text to search for.\\n";  
     }  
   
     $newuservalidate  
   
     if (srchtype== 'contains') {  
         if (srchterm.length < 3) {  
             checkok = 0;  
             msg += "The text you are searching for must contain at least three characters when using a 'contained in' type search.\\n";     
         }  
     }  
     if (srchin == 'instd') {  
         if (srchdomain == '') {  
             checkok = 0;  
             msg += "You must choose a domain when using an institutional directory search.\\n";   
         }  
     }  
     if (srchin == 'dom') {  
         if (srchdomain == '') {  
             checkok = 0;  
             msg += "You must choose a domain when using a domain search.\\n";  
         }  
     }  
     if (srchby == 'lastfirst') {  
         if (srchterm.indexOf(",") == -1) {  
             checkok = 0;  
             msg += "When using searching by last,first you must include a comma as separator between last name and first name.\\n";  
         }  
         if (srchterm.indexOf(",") == srchterm.length -1) {   
             checkok = 0;  
             msg += "When searching by last,first you must include at least one character in the first name.\\n";  
         }  
     }  
     if (checkok == 0) {  
         alert("The following need to be corrected before the search can be run:\\n"+msg);  
         return;  
     }  
     if (checkok == 1) {  
         document.crtuser.submit();  
     }  
 }  
   
 ENDSCRIPT  
   
     my ($jsback,$elements) = &crumb_utilities();      my ($jsback,$elements) = &crumb_utilities();
   
     my $jscript = &Apache::loncommon::studentbrowser_javascript()."\n".      my $jscript = &Apache::loncommon::studentbrowser_javascript()."\n".
         '<script type"text/javascript">'."\n".          '<script type="text/javascript">'."\n".
         &Apache::lonhtmlcommon::set_form_elements($elements->{$formtoset}).          &Apache::lonhtmlcommon::set_form_elements($elements->{$formtoset}).
         $newuserscript.$validatescript.'</script>'."\n";          '</script>'."\n";
   
     my %loaditems = (      my %loaditems = (
                 'onload' => "javascript:setFormElements(document.$formtoset)",                  'onload' => "javascript:setFormElements(document.$formtoset)",
Line 314  ENDSCRIPT Line 216  ENDSCRIPT
        $jscript,{'add_entries' => \%loaditems,});         $jscript,{'add_entries' => \%loaditems,});
    &Apache::lonhtmlcommon::add_breadcrumb     &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage(document.crtuser)",       ({href=>"javascript:backPage(document.crtuser)",
        text=>"User/custom role search",         text=>"User modify/custom role",
        faq=>282,bug=>'Instructor Interface',});         faq=>282,bug=>'Instructor Interface',});
   
     my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management');      my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management');
Line 330  ENDSCRIPT Line 232  ENDSCRIPT
                     'ecrp' => "Edit Custom Role Privileges",                      'ecrp' => "Edit Custom Role Privileges",
                     'nr'   => "Name of Role",                      'nr'   => "Name of Role",
                     'cre'  => "Custom Role Editor",                      'cre'  => "Custom Role Editor",
                       'mod'  => "to add/modify roles",
        );         );
     my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface');      my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface');
     my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges');      my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges');
Line 342  ENDSCRIPT Line 245  ENDSCRIPT
 $start_page  $start_page
 $crumbs  $crumbs
 <h2>$lt{siur}$helpsiur</h2>  <h2>$lt{siur}$helpsiur</h2>
 <h3>$lt{'srch'} $sellink</h3>  <h3>$lt{'srch'} $sellink $lt{'mod'}</h3>
 $response");  $response");
     $r->print(&entry_form($defdom,$srch,$forcenewuser));      $r->print(&entry_form($defdom,$srch,$forcenewuser));
     if (&Apache::lonnet::allowed('mcr','/')) {      if (&Apache::lonnet::allowed('mcr','/')) {
Line 426  $jsback Line 329  $jsback
 ENDSCRIPT  ENDSCRIPT
   
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                                        'srch'           => "User Search",                                         'srch'           => "User Search to add/modify roles of",
                                        'username'       => "username",                                         'username'       => "username",
                                        'domain'         => "domain",                                         'domain'         => "domain",
                                        'lastname'       => "last name",                                         'lastname'       => "last name",
Line 436  ENDSCRIPT Line 339  ENDSCRIPT
     $r->print(&Apache::loncommon::start_page('Create Users, Change User Privileges',$jscript));      $r->print(&Apache::loncommon::start_page('Create Users, Change User Privileges',$jscript));
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"javascript:backPage(document.usersrchform,'','')",          ({href=>"javascript:backPage(document.usersrchform,'','')",
           text=>"User/custom role search",            text=>"User modify/custom role edit",
           faq=>282,bug=>'Instructor Interface',},            faq=>282,bug=>'Instructor Interface',},
          {href=>"javascript:backPage(document.usersrchform,'get_user_info','select')",           {href=>"javascript:backPage(document.usersrchform,'get_user_info','select')",
           text=>"Select User",            text=>"Select User",
Line 444  ENDSCRIPT Line 347  ENDSCRIPT
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
     $r->print("<b>$lt{'srch'}</b><br />");      $r->print("<b>$lt{'srch'}</b><br />");
     $r->print(&entry_form($srch->{'srchdomain'},$srch));      $r->print(&entry_form($srch->{'srchdomain'},$srch));
     $r->print('<h3>'.&mt('Select a user').'</h3>');      $r->print('<h3>'.&mt('Select a user to add/modify roles of').'</h3>');
     $r->print('<form name="usersrchform" method="post">'.      $r->print('<form name="usersrchform" method="post">'.
               &Apache::loncommon::start_data_table()."\n".                &Apache::loncommon::start_data_table()."\n".
               &Apache::loncommon::start_data_table_header_row()."\n".                &Apache::loncommon::start_data_table_header_row()."\n".
Line 516  sub print_user_modification_page { Line 419  sub print_user_modification_page {
     $loginscript  = &Apache::loncommon::authform_header(%param);      $loginscript  = &Apache::loncommon::authform_header(%param);
     $authformkrb  = &Apache::loncommon::authform_kerberos(%param);      $authformkrb  = &Apache::loncommon::authform_kerberos(%param);
   
     $ccuname =&LONCAPA::clean_username($ccuname);  
     $ccdomain=&LONCAPA::clean_domain($ccdomain);  
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();      my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dc_setcourse_code = '';      my $dc_setcourse_code = '';
     my $nondc_setsection_code = '';                                              my $nondc_setsection_code = '';                                        
Line 730  ENDSECCODE Line 631  ENDSECCODE
        $js,{'add_entries' => \%loaditem,});         $js,{'add_entries' => \%loaditem,});
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage(document.cu)",       ({href=>"javascript:backPage(document.cu)",
        text=>"User/custom role search",         text=>"User modify/custom role edit",
        faq=>282,bug=>'Instructor Interface',});         faq=>282,bug=>'Instructor Interface',});
   
     if ($env{'form.phase'} eq 'userpicked') {      if ($env{'form.phase'} eq 'userpicked') {
Line 768  ENDFORMINFO Line 669  ENDFORMINFO
                          srchby => 'uname',                           srchby => 'uname',
                          srchtype => 'exact',                           srchtype => 'exact',
                        };                         };
         if ((exists($env{'form.seluname'})) && (exists($env{'form.seludom'}))) {          if ($env{'form.phase'} eq 'userpicked') {
             $instsrch->{'srchterm'} = $env{'form.seluname'};              $instsrch->{'srchterm'} = $env{'form.seluname'};
             $instsrch->{'srchdomain'} = $env{'form.seludom'};              $instsrch->{'srchdomain'} = $env{'form.seludom'};
         } else {          } else {
             $instsrch->{'srchterm'} = $env{'form.srchterm'};              $instsrch->{'srchterm'} = $ccuname;
             $instsrch->{'srchdomain'} = $env{'form.srchdomain'},              $instsrch->{'srchdomain'} = $ccdomain,
         }          }
         if (($instsrch->{'srchterm'} ne '') && ($instsrch->{'srchdomain'} ne '')) {          if (($instsrch->{'srchterm'} ne '') && ($instsrch->{'srchdomain'} ne '')) {
             $newuser = $instsrch->{'srchterm'}.':'.$instsrch->{'srchdomain'};              $newuser = $instsrch->{'srchterm'}.':'.$instsrch->{'srchdomain'};
Line 784  ENDFORMINFO Line 685  ENDFORMINFO
                 %dirsrch_results = &Apache::lonnet::inst_directory_query($instsrch);                  %dirsrch_results = &Apache::lonnet::inst_directory_query($instsrch);
                 if (ref($dirsrch_results{$newuser}) eq 'HASH') {                   if (ref($dirsrch_results{$newuser}) eq 'HASH') { 
                     %inst_results = %{$dirsrch_results{$newuser}};                      %inst_results = %{$dirsrch_results{$newuser}};
                 }                   }
             }              }
         }          }
         my $home_server_list=          my $home_server_list=
Line 1330  sub update_user_data { Line 1231  sub update_user_data {
     $r->print(&Apache::loncommon::start_page($title,$jscript));      $r->print(&Apache::loncommon::start_page($title,$jscript));
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
        ({href=>"javascript:backPage(document.userupdate)",         ({href=>"javascript:backPage(document.userupdate)",
          text=>"User/custom role search",           text=>"User modify/custom role edit",
          faq=>282,bug=>'Instructor Interface',});           faq=>282,bug=>'Instructor Interface',});
     if ($env{'form.prevphase'} eq 'userpicked') {      if ($env{'form.prevphase'} eq 'userpicked') {
         &Apache::lonhtmlcommon::add_breadcrumb          &Apache::lonhtmlcommon::add_breadcrumb
Line 1407  sub update_user_data { Line 1308  sub update_user_data {
     $r->print($error.&mt('Invalid login mode or password').$end);          $r->print($error.&mt('Invalid login mode or password').$end);    
     return;      return;
     }      }
   
   
       $r->print('<h2>'.&mt('User [_1] in domain [_2]',
    $env{'form.ccuname'}, $env{'form.ccdomain'}).'</h2>');
   
     if ($env{'form.makeuser'}) {      if ($env{'form.makeuser'}) {
         # Create a new user   $r->print('<h3>'.&mt('Creating new account.').'</h3>');
  my %lt=&Apache::lonlocal::texthash(  
                     'cru'  => "Creating user",                      
                     'id'   => "in domain"  
    );  
  $r->print(<<ENDNEWUSERHEAD);  
 <h3>$lt{'cru'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"</h3>  
 ENDNEWUSERHEAD  
         # Check for the authentication mode and password          # Check for the authentication mode and password
         if (! $amode || ! $genpwd) {          if (! $amode || ! $genpwd) {
     $r->print($error.&mt('Invalid login mode or password').$end);          $r->print($error.&mt('Invalid login mode or password').$end);    
Line 1448  ENDNEWUSERHEAD Line 1347  ENDNEWUSERHEAD
     } elsif (($env{'form.login'} ne 'nochange') &&      } elsif (($env{'form.login'} ne 'nochange') &&
              ($env{'form.login'} ne ''        )) {               ($env{'form.login'} ne ''        )) {
  # Modify user privileges   # Modify user privileges
     my %lt=&Apache::lonlocal::texthash(  
                     'usr'  => "User",                      
                     'id'   => "in domain"  
        );  
  $r->print(<<ENDMODIFYUSERHEAD);  
 <h2>$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"</h2>  
 ENDMODIFYUSERHEAD  
         if (! $amode || ! $genpwd) {          if (! $amode || ! $genpwd) {
     $r->print($error.'Invalid login mode or password'.$end);          $r->print($error.'Invalid login mode or password'.$end);    
     return;      return;
Line 1618  END Line 1510  END
             # They did not want to change the users name but we can              # They did not want to change the users name but we can
             # still tell them what the name is              # still tell them what the name is
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
                            'usr'  => "User",                      
                            'id'   => "in domain",  
                            'gen'  => "Generation",  
                            'mail' => "Permanent e-mail",                             'mail' => "Permanent e-mail",
                            'disk' => "Disk space allocated to user's portfolio files",                             'disk' => "Disk space allocated to user's portfolio files",
        );         );
             $r->print(<<"END");              $r->print(<<"END");
 <h2>$lt{'usr'} "$env{'form.ccuname'}" $lt{'id'} "$env{'form.ccdomain'}"</h2>  <h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'}</h4>
 <h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} </h4>  
 <h4>$lt{'gen'}: $userenv{'generation'}</h4>  
 <h4>$lt{'mail'}: $userenv{'permanentemail'}</h4>  <h4>$lt{'mail'}: $userenv{'permanentemail'}</h4>
 END  END
             if ($putresult eq 'ok') {              if ($putresult eq 'ok') {
Line 1855  END Line 1742  END
     } # End of foreach (keys(%env))      } # End of foreach (keys(%env))
 # Flush the course logs so reverse user roles immediately updated  # Flush the course logs so reverse user roles immediately updated
     &Apache::lonnet::flushcourselogs();      &Apache::lonnet::flushcourselogs();
     $r->print('<p><a href="/adm/createuser">Create/Modify Another User</a></p>');      $r->print('<p><a href="/adm/createuser">'.&mt('Create/Modify Another User').'</a></p>');
     $r->print('<form name="userupdate" method="post" />'."\n");      $r->print('<form name="userupdate" method="post" />'."\n");
     foreach my $item ('srchby','srchin','srchtype','srchterm','srchdomain','ccuname','ccdomain') {      foreach my $item ('srchby','srchin','srchtype','srchterm','srchdomain','ccuname','ccdomain') {
         $r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n");          $r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n");
Line 1997  sub custom_role_editor { Line 1884  sub custom_role_editor {
     $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));      $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
    &Apache::lonhtmlcommon::add_breadcrumb     &Apache::lonhtmlcommon::add_breadcrumb
      ({href=>"javascript:backPage(document.form1,'','')",       ({href=>"javascript:backPage(document.form1,'','')",
        text=>"User/custom role search",         text=>"User modify/custom role edit",
        faq=>282,bug=>'Instructor Interface',},         faq=>282,bug=>'Instructor Interface',},
       {href=>"javascript:backPage(document.form1,'','')",        {href=>"javascript:backPage(document.form1,'','')",
          text=>"Edit custom role",           text=>"Edit custom role",
Line 2137  sub set_custom_role { Line 2024  sub set_custom_role {
     $r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);      $r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"javascript:backPage(document.customresult,'','')",          ({href=>"javascript:backPage(document.customresult,'','')",
           text=>"User/custom role search",            text=>"User modify/custom role edit",
           faq=>282,bug=>'Instructor Interface',},            faq=>282,bug=>'Instructor Interface',},
          {href=>"javascript:backPage(document.customresult,'selected_custom_edit','')",           {href=>"javascript:backPage(document.customresult,'selected_custom_edit','')",
           text=>"Edit custom role",            text=>"Edit custom role",
Line 2240  sub handler { Line 2127  sub handler {
                    &print_user_selection_page($r,$response,$srch,$results);                     &print_user_selection_page($r,$response,$srch,$results);
                } elsif ($state eq 'modify') {                 } elsif ($state eq 'modify') {
                    my ($ccuname,$ccdomain);                     my ($ccuname,$ccdomain);
                    if ($srch->{'srchby'} eq 'uname') {                     if (($srch->{'srchby'} eq 'uname') && 
                          ($srch->{'srchtype'} eq 'exact')) {
                        $ccuname = $srch->{'srchterm'};                         $ccuname = $srch->{'srchterm'};
                        $ccdomain= $srch->{'srchdomain'};                         $ccdomain= $srch->{'srchdomain'};
                    } else {                     } else {
Line 2281  sub handler { Line 2169  sub handler {
 #-------------------------------------------------- functions for &phase_two  #-------------------------------------------------- functions for &phase_two
 sub user_search_result {  sub user_search_result {
     my ($srch) = @_;      my ($srch) = @_;
     my @alldomains = sort(&Apache::lonnet::all_domains());  
     my %allhomes;      my %allhomes;
     my %inst_matches;      my %inst_matches;
     my %srch_results;      my %srch_results;
Line 2301  sub user_search_result { Line 2188  sub user_search_result {
     }      }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {      if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
         if (($srch->{'srchdomain'} eq '') ||           if (($srch->{'srchdomain'} eq '') || 
             (!(grep/^\Q$srch->{'srchdomain'}\E$/,@alldomains))) {      ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {
             $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.')              $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.')
         }          }
     }      }
Line 2318  sub user_search_result { Line 2205  sub user_search_result {
         }          }
     }      }
     if ($response ne '') {      if ($response ne '') {
         return ($state,$response);          return ($state,'<span class="LC_warning">'.$response.'</span>');
     }      }
     if ($srch->{'srchby'} eq 'uname') {      if ($srch->{'srchby'} eq 'uname') {
         if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs')) {          if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs')) {
Line 2336  sub user_search_result { Line 2223  sub user_search_result {
                 }                  }
             } else {              } else {
                 if ($srch->{'srchin'} eq 'dom') {                  if ($srch->{'srchin'} eq 'dom') {
                     my $uhome=&Apache::lonnet::homeserver($srch->{'srchterm'},$srch->{'srchdomain'});                      if ($srch->{'srchtype'} eq 'exact') {
                     if ($uhome eq 'no_host') {                          my $uhome=&Apache::lonnet::homeserver($srch->{'srchterm'},$srch->{'srchdomain'});
                           if ($uhome eq 'no_host') {
                               ($state,$response,$forcenewuser) =
                                   &build_search_response($srch,%srch_results);
                           } else {
                               $state = 'modify';
                           }
                       } else {
                           %srch_results = &Apache::lonnet::usersearch($srch);
                         ($state,$response,$forcenewuser) =                          ($state,$response,$forcenewuser) =
                             &build_search_response($srch,%srch_results);                              &build_search_response($srch,%srch_results);
                     } else {  
                         $state = 'modify';  
                     }                      }
                 } else {                  } else {
                     my %courseusers = &get_courseusers();                      my %courseusers = &get_courseusers();
                     if (exists($courseusers{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) {                      if ($srch->{'srchtype'} eq 'exact') {
                         $state = 'modify';                          if (exists($courseusers{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) {
                               $state = 'modify';
                           } else {
                               ($state,$response,$forcenewuser) =
                                   &build_search_response($srch,%srch_results);
                           }
                     } else {                      } else {
                           foreach my $user (keys(%courseusers)) {
                               my ($cuname,$cudomain) = split(/:/,$user);
                               if ($cudomain eq $srch->{'srchdomain'}) {
                                   if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) {
                                       $srch_results{$user} = '';
                                   }
                               }
                           }
                         ($state,$response,$forcenewuser) =                          ($state,$response,$forcenewuser) =
                             &build_search_response($srch,%srch_results);                              &build_search_response($srch,%srch_results);
                     }                      }
Line 2424  sub directorysrch_check { Line 2330  sub directorysrch_check {
                                              ['directorysrch'],$srch->{'srchdomain'});                                               ['directorysrch'],$srch->{'srchdomain'});
     if (ref($dom_inst_srch{'directorysrch'}) eq 'HASH') {      if (ref($dom_inst_srch{'directorysrch'}) eq 'HASH') {
         if (!$dom_inst_srch{'directorysrch'}{'available'}) {          if (!$dom_inst_srch{'directorysrch'}{'available'}) {
             return &mt('Directory search unavailable in domain: [_1]',$srch->{'srchdomain'});               return &mt('Institutional directory search unavailable in domain: [_1]',$srch->{'srchdomain'}); 
         }          }
         if ($dom_inst_srch{'directorysrch'}{'localonly'}) {          if ($dom_inst_srch{'directorysrch'}{'localonly'}) {
             if ($env{'request.role.domain'} ne $srch->{'srchdomain'}) {              if ($env{'request.role.domain'} ne $srch->{'srchdomain'}) {
                 return &mt('Directory search in domain: [_1] is only allowed for users with a current role in the domain.',$srch->{'srchdomain'});                   return &mt('Insitutional directory search in domain: [_1] is only allowed for users with a current role in the domain.',$srch->{'srchdomain'}); 
             }              }
             my @usertypes = split(/:/,$env{'environment.inststatus'});              my @usertypes = split(/:/,$env{'environment.inststatus'});
             if (!@usertypes) {              if (!@usertypes) {
Line 2524  sub build_search_response { Line 2430  sub build_search_response {
             $state = 'modify';              $state = 'modify';
             $response = &mt("$single{$srch->{'srchtype'}} was found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});              $response = &mt("$single{$srch->{'srchtype'}} was found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});
         } else {          } else {
             $response = &mt("$nomatch{$srch->{'srchtype'}} found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});              $response = '<span class="LC_warning">'.&mt("$nomatch{$srch->{'srchtype'}} found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'}).'</span>';
             if ($srch->{'srchin'} ne 'alc') {              if ($srch->{'srchin'} ne 'alc') {
                 $forcenewuser = 1;                  $forcenewuser = 1;
                 my $cansrchinst = 0;                   my $cansrchinst = 0; 
Line 2546  sub build_search_response { Line 2452  sub build_search_response {
                         }                          }
                     }                      }
                 }                  }
                 $response .= '<br />'.&mt("To add as a new user:").'<ul><li>'.&mt("Enter the proposed username in the <i>'Search for'</i> box").'</li><li>'.&mt("Set <i>'Make new user if no match found</i>' to <b>Yes</b>").'</li><li>'.&mt("Click <i>'Search'</i>").'</li></ul>'.&mt("Note: you can only create new users in the domain of your current role -".$env{'request.role.domain'}).'<br /><br />';                  $response .= '<br />'.&mt("To add as a new user:").'<ul><li>'.&mt("Enter the proposed username in the <i>'Search for'</i> box").'</li><li>'.&mt("Set <i>'Make new user if no match found</i>' to <b>Yes</b>").'</li><li>'.&mt("Click <i>'Search'</i>").'</li></ul>'.&mt("Note: you can only create new users in the domain of your current role - [_1]",$env{'request.role.domain'}).'<br /><br />';
             }              }
         }          }
     }      }

Removed from v.1.161  
changed lines
  Added in v.1.166


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