[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 30 Jul 2007 22:44:04 -0000


albertel		Mon Jul 30 18:44:04 2007 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - eliminate debug message
  - add in warning css to warnings
  - eliminate use of all_domains
  - update a couple of messages
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.162 loncom/interface/loncreateuser.pm:1.163
--- loncom/interface/loncreateuser.pm:1.162	Sun Jul 29 20:31:27 2007
+++ loncom/interface/loncreateuser.pm	Mon Jul 30 18:44:04 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.162 2007/07/30 00:31:27 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.163 2007/07/30 22:44:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1755,7 +1755,7 @@
     } # End of foreach (keys(%env))
 # Flush the course logs so reverse user roles immediately updated
     &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");
     foreach my $item ('srchby','srchin','srchtype','srchterm','srchdomain','ccuname','ccdomain') {
         $r->print('<input type="hidden" name="'.$item.'" value="'.$env{'form.'.$item}.'" />'."\n");
@@ -2136,7 +2136,6 @@
            if ($env{'form.phase'} eq 'get_user_info') {
                my ($state,$response,$forcenewuser,$results) = 
                    &user_search_result($srch);
-               print STDERR "Got $state,$response,$forcenewuser\n";
                if ($state eq 'select') {
                    &print_user_selection_page($r,$response,$srch,$results);
                } elsif ($state eq 'modify') {
@@ -2183,7 +2182,6 @@
 #-------------------------------------------------- functions for &phase_two
 sub user_search_result {
     my ($srch) = @_;
-    my @alldomains = sort(&Apache::lonnet::all_domains());
     my %allhomes;
     my %inst_matches;
     my %srch_results;
@@ -2203,7 +2201,7 @@
     }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
         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.')
         }
     }
@@ -2220,7 +2218,7 @@
         }
     }
     if ($response ne '') {
-        return ($state,$response);
+        return ($state,'<span class="LC_warning">'.$response.'</span>');
     }
     if ($srch->{'srchby'} eq 'uname') {
         if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs')) {
@@ -2345,11 +2343,11 @@
                                              ['directorysrch'],$srch->{'srchdomain'});
     if (ref($dom_inst_srch{'directorysrch'}) eq 'HASH') {
         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 ($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'});
             if (!@usertypes) {
@@ -2445,7 +2443,7 @@
             $state = 'modify';
             $response = &mt("$single{$srch->{'srchtype'}} was found for this $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});
         } 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') {
                 $forcenewuser = 1;
                 my $cansrchinst = 0; 
@@ -2467,7 +2465,7 @@
                         }
                     }
                 }
-                $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 />';
             }
         }
     }