[LON-CAPA-cvs] cvs: loncom(version_2_5_X) /interface loncommon.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 04 Sep 2007 23:58:08 -0000


albertel		Tue Sep  4 19:58:08 2007 EDT

  Modified files:              (Branch: version_2_5_X)
    /loncom/interface	loncommon.pm 
  Log:
  - backport 1.569
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.564.2.4 loncom/interface/loncommon.pm:1.564.2.5
--- loncom/interface/loncommon.pm:1.564.2.4	Thu Aug 30 19:02:03 2007
+++ loncom/interface/loncommon.pm	Tue Sep  4 19:58:06 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.564.2.4 2007/08/30 23:02:03 albertel Exp $
+# $Id: loncommon.pm,v 1.564.2.5 2007/09/04 23:58:06 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5582,6 +5582,7 @@
                     'instd'     => 'in institutional directory',
                     'exact'     => 'is',
                     'contains'  => 'contains',
+                    'begins'    => 'begins with',
                                        );
     my $domform = &select_dom_form($currdom,'srchdomain',1,1);
     my $srchinsel = ' <select name="srchin">';
@@ -5617,7 +5618,7 @@
     $srchbysel .= "\n  </select>\n";
 
     my $srchtypesel = ' <select name="srchtype">';
-    foreach my $option ('exact','contains') {
+    foreach my $option ('exact','begins','contains') {
         if ($curr_selected{'srchtype'} eq $option) {
             $srchtypesel .= '
    <option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>';
@@ -5686,6 +5687,13 @@
         msg += "You must include some text to search for.\\n";
     }
 
+    if (srchtype== 'begins') {
+        if (srchterm.length < 2) {
+            checkok = 0;
+            msg += "The text you are searching for must contain at least two characters when using a 'begins' type search.\\n";
+        }
+    }
+
     if (srchtype== 'contains') {
         if (srchterm.length < 3) {
             checkok = 0;