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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 07 Sep 2007 19:51:44 -0000


raeburn		Fri Sep  7 15:51:44 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm loncreateuser.pm 
  Log:
  Changes suggested by Hon Kie at fsu.
  - loncommon::user_picker() change order of srchby and srchtype so ones likely to be used most frequently are listed first.  Change default srchby to 'lastname'.
  - loncreateuser.pm trimming of leading and trailing spaces in search term removed in favor of trimming multiple adjacent spaces to a single space.  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.579 loncom/interface/loncommon.pm:1.580
--- loncom/interface/loncommon.pm:1.579	Wed Sep  5 01:09:53 2007
+++ loncom/interface/loncommon.pm	Fri Sep  7 15:51:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.579 2007/09/05 05:09:53 raeburn Exp $
+# $Id: loncommon.pm,v 1.580 2007/09/07 19:51:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5651,7 +5651,7 @@
     my $currdom = $dom;
     my %curr_selected = (
                         srchin => 'dom',
-                        srchby => 'uname',
+                        srchby => 'lastname',
                       );
     my $srchterm;
     if (ref($srch) eq 'HASH') {
@@ -5713,7 +5713,7 @@
     $srchinsel .= "\n  </select>\n";
 
     my $srchbysel =  ' <select name="srchby">';
-    foreach my $option ('uname','lastname','lastfirst') {
+    foreach my $option ('lastname','lastfirst','uname') {
         if ($curr_selected{'srchby'} eq $option) {
             $srchbysel .= '
    <option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>';
@@ -5725,7 +5725,7 @@
     $srchbysel .= "\n  </select>\n";
 
     my $srchtypesel = ' <select name="srchtype">';
-    foreach my $option ('exact','begins','contains') {
+    foreach my $option ('begins','contains','exact') {
         if ($curr_selected{'srchtype'} eq $option) {
             $srchtypesel .= '
    <option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>';
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.182 loncom/interface/loncreateuser.pm:1.183
--- loncom/interface/loncreateuser.pm:1.182	Fri Aug 31 13:58:47 2007
+++ loncom/interface/loncreateuser.pm	Fri Sep  7 15:51:41 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.182 2007/08/31 17:58:47 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.183 2007/09/07 19:51:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2214,9 +2214,7 @@
     my %inst_matches;
     my %srch_results;
     my ($response,$currstate,$forcenewuser,$dirsrchres);
-    $srch->{'srchterm'} =~ s/^\s+//;
-    $srch->{'srchterm'} =~ s/\s+$//;
-
+    $srch->{'srchterm'} =~ s/\s+/ /g;
     if ($srch->{'srchby'} !~ /^(uname|lastname|lastfirst)$/) {
         $response = &mt('Invalid search.');
     }
@@ -2229,6 +2227,9 @@
     if ($srch->{'srchterm'} eq '') {
         $response = &mt('You must enter a search term.');
     }
+    if ($srch->{'srchterm'} =~ /^\s+$/) {
+        $response = &mt('Your search term must contain more than just spaces.');
+    }
     if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
         if (($srch->{'srchdomain'} eq '') || 
 	    ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {