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

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 21 Apr 2004 15:48:34 -0000


matthew		Wed Apr 21 11:48:34 2004 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Reworked basic search interface.  No feature changes, it's just less un-pretty.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.212 loncom/interface/lonsearchcat.pm:1.213
--- loncom/interface/lonsearchcat.pm:1.212	Mon Apr 19 17:46:50 2004
+++ loncom/interface/lonsearchcat.pm	Wed Apr 21 11:48:34 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.212 2004/04/19 21:46:50 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.213 2004/04/21 15:48:34 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -150,7 +150,8 @@
     ## Initialize global variables
     ##
     my $domain  = $r->dir_config('lonDefDomain');
-    $diropendb= "/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_searchcat.db";
+    $diropendb= "/home/httpd/perl/tmp/".
+        "$ENV{'user.domain'}_$ENV{'user.name'}_searchcat.db";
     #
     # set the name of the persistent database
     #          $ENV{'form.persistent_db_id'} can only have digits in it.
@@ -535,64 +536,75 @@
                                             undef,undef,! $ENV{'form.launch'});
     my $scrout = &search_html_header().$bodytag;
     if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
-        my $Statement=&searchhelp();
-        $scrout.=(<<ENDDOCUMENT);
-<form name="loncapa_search" method="post" action="/adm/searchcat">
-<input type="hidden" name="phase" value="basic_search" />
-$hidden_fields
-<p>
-$Statement.
-</p>
-<p>
-<table>
-<tr><td>
-ENDDOCUMENT
-        $scrout.='&nbsp;'.
+        # Define interface components
+        my $userelatedwords=
+            &mt('[_1] use related words',
+                &Apache::lonhtmlcommon::checkbox
+                ('related',$ENV{'form.related'}));
+        my $onlysearchdomain=
+            &mt('[_1] only search domain [_2]',
+                &Apache::lonhtmlcommon::checkbox
+                ('domains',$ENV{'form.domains'}),
+                $r->dir_config('lonDefDomain'));
+        my $adv_search_link = 
+            '<a href="/adm/searchcat?'.
+            'phase=disp_adv&'.
+            'catalogmode='.$ENV{'form.catalogmode'}.
+            '&launch='.$ENV{'form.launch'}.
+            '&mode='.$ENV{'form.mode'}.
+            '">'.&mt('Advanced Search').'</a>';
+        #
+        $scrout.='<form name="loncapa_search" method="post" '.
+            'action="/adm/searchcat">'.
+            '<input type="hidden" name="phase" value="basic_search" />'.
+            $hidden_fields;
+        #
+        $scrout .= '<center>'.$/;
+        if ($ENV{'request.course.id'}) {
+            $scrout .= '<h1>'.&mt('LON-CAPA Catalog Search').'</h1>';
+        } else {
+            # No need to tell them they are searching
+            $scrout.= ('<br />'x2);
+        }
+        $scrout.='<table>'.
+            '<tr><td align="center" valign="top">'.
             &Apache::lonhtmlcommon::textbox('basicexp',
-                                        $ENV{'form.basicexp'},40).
-                                        '&nbsp;';
-        my $relatedcheckbox = 
-            &Apache::lonhtmlcommon::checkbox('related',
-                                             $ENV{'form.related'});
-        my $domain = $r->dir_config('lonDefDomain');
-        my $domaincheckbox = 
-            &Apache::lonhtmlcommon::checkbox('domains',
-                                             $ENV{'form.domains'});
-        my $srch=&mt('Search');
-        my $header=&mt('Advanced Search');
-        my $userelatedwords=&mt('use related words');
-        my $onlysearchdomain=&mt('only search domain');
-        my $view=&viewoptions();
-        $scrout.=<<END;
-</td><td><a
-href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}&mode=$ENV{'form.mode'}"
->$header</a></td></tr>
-<tr><td>$relatedcheckbox $userelatedwords</td>
-    <td>$domaincheckbox $onlysearchdomain <b>$domain</b></td></tr>
-</table>
-</p>
-$view
-<p>
-&nbsp;<input type="submit" name="basicsubmit" value='$srch' />&nbsp;
-$closebutton
-END
-    $scrout.=<<ENDDOCUMENT;
-</p>
-</form>
-ENDDOCUMENT
+                                            $ENV{'form.basicexp'},50).'<br />'.
+            '<font size="-1">'.&searchhelp().'</font>'.'</td>'.
+            '<td><font size="-1">'.
+            '<nobr>'.('&nbsp;'x3).$adv_search_link.'</nobr>'.'<br />'.
+            '<nobr>'.('&nbsp;'x1).$userelatedwords.'</nobr>'.'<br />'.
+            '<nobr>'.('&nbsp;'x1).$onlysearchdomain.'</nobr>'.'<br />'.
+            '</font></td>'.
+            '</tr>'.$/;
+        #
+#        $scrout .= '<tr><td align="center">'.
+#            '<font size="-1">'.
+#            $userelatedwords.('&nbsp;'x3).
+#            $onlysearchdomain.('&nbsp;'x2).$adv_search_link.
+#            '</font>'.
+#            '</td></tr>'.$/;
+        $scrout .= '<tr><td align="center" colspan="2">'.
+            '<font size="-1">'.
+            '<input type="submit" name="basicsubmit" '.
+            'value="'.&mt('Search').'" />'.
+            ('&nbsp;'x2).$closebutton.('&nbsp;'x2).&viewoptions().
+            '</font>'.
+            '</td></tr>'.$/;
+        $scrout .= '</table>'.$/.'</center>'.'</form>';
     }
     if ($ENV{'request.course.id'}) {
-	my %lt=&Apache::lonlocal::texthash(
-					   'srch' => 'Search',
+	my %lt=&Apache::lonlocal::texthash('srch' => 'Search',
                                            'header' => 'Course Search',
 	 'note' => 'Enter terms or phrases, then press "Search" below',
 	 'use' => 'use related words',
 	 'full' =>'fulltext search (time consuming)'
 					   );
         $scrout.=(<<ENDCOURSESEARCH);
+<form name="loncapa_search" method="post" action="/adm/searchcat">
+<center>
 <hr />
 <h1>$lt{'header'}</h1>    
-<form name="course_search" method="post" action="/adm/searchcat">
 <input type="hidden" name="phase" value="course_search" />
 $hidden_fields
 <p>
@@ -618,6 +630,8 @@
 </table><p>
 &nbsp;<input type="submit" name="coursesubmit" value='$lt{'srch'}' />
 </p>
+</center>
+</form>
 ENDENDCOURSE
     }
     $scrout.=(<<ENDDOCUMENT);