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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 19 Apr 2004 13:51:37 -0000


matthew		Mon Apr 19 09:51:37 2004 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Added &search_html_header() to consolidate a little code.  Removed weird
  background color in table.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.206 loncom/interface/lonsearchcat.pm:1.207
--- loncom/interface/lonsearchcat.pm:1.206	Wed Apr 14 14:29:32 2004
+++ loncom/interface/lonsearchcat.pm	Mon Apr 19 09:51:36 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.206 2004/04/14 18:29:32 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.207 2004/04/19 13:51:36 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -454,6 +454,23 @@
 
 } # End of course search scoping
 
+sub search_html_header {
+    my $Str = <<ENDHEADER;
+<html>
+<head>
+<title>The LearningOnline Network with CAPA</title>
+<script type="text/javascript">
+    function openhelp(val) {
+	openhelpwin=open('/adm/help/searchcat.html','helpscreen',
+	     'scrollbars=1,width=600,height=300');
+	openhelpwin.focus();
+    }
+</script>
+</head>
+ENDHEADER
+    return $Str;
+}
+
 ######################################################################
 ######################################################################
 
@@ -472,24 +489,11 @@
     my $bodytag=&Apache::loncommon::bodytag('Search').
 	&Apache::loncommon::help_open_topic('Finding_Resources').
 	&Apache::loncommon::help_open_bug('Searching');
-    my $scrout=<<"ENDDOCUMENT";
-<html>
-<head>
-<title>The LearningOnline Network with CAPA</title>
-<script type="text/javascript">
-    function openhelp(val) {
-	openhelpwin=open('/adm/help/searchcat.html','helpscreen',
-	     'scrollbars=1,width=600,height=300');
-	openhelpwin.focus();
-    }
-</script>
-</head>
-$bodytag
-ENDDOCUMENT
-if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
-    my $CatalogSearch=&mt('Catalog Search');
-    my $Statement=&searchhelp();
-    $scrout.=(<<ENDDOCUMENT);
+    my $scrout = &search_html_header().$bodytag;
+    if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
+        my $CatalogSearch=&mt('Catalog Search');
+        my $Statement=&searchhelp();
+        $scrout.=(<<ENDDOCUMENT);
 <h1>$CatalogSearch</h1>
 <form name="loncapa_search" method="post" action="/adm/searchcat">
 <input type="hidden" name="phase" value="basic_search" />
@@ -501,20 +505,23 @@
 <table>
 <tr><td>
 ENDDOCUMENT
-    $scrout.='&nbsp;'.&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;
+        $scrout.='&nbsp;'.
+        &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>
@@ -606,18 +613,8 @@
 END
     my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search');
     my $searchhelp=&searchhelp();
-    my $scrout=<<"ENDHEADER";
-<html>
-<head>
-<title>The LearningOnline Network with CAPA</title>
-<script type="text/javascript">
-    function openhelp(val) {
-	openhelpwin=open('/adm/help/searchcat.html','helpscreen',
-	     'scrollbars=1,width=600,height=300');
-	openhelpwin.focus();
-    }
-</script>
-</head>
+    my $scrout=&search_html_header();
+    $scrout .= <<"ENDHEADER";
 $bodytag
 $searchhelp
 <form method="post" action="/adm/searchcat" name="advsearch">
@@ -634,17 +631,17 @@
     foreach ('title','author','owner','authorspace','modifyinguser',
 	     'keywords','notes','abstract','standards',
 	     'lowestgradelevel','highestgradelevel','mime') {
-	$scrout.='<tr bgcolor="#FFFFBB"><td>'.&titlefield($fields{$_}).'</td><td>'.
+	$scrout.='<tr><td>'.&titlefield($fields{$_}).'</td><td>'.
 	    &Apache::lonmeta::prettyinput($_,$ENV{'form.'.$_},$_,'advsearch',
 					  1,'</td><td>',$ENV{'form.'.$_.'_related'}).
 	    '</td></tr>';
     }
-    $scrout.='<tr bgcolor="#FFFFBB"><td>'.
+    $scrout.='<tr><td>'.
 	&titlefield(&mt('MIME Type Category')).'</td><td>'. 
 	    &Apache::loncommon::filecategoryselect('category',
 						   $ENV{'form.category'}).
 	    '</td><td>&nbsp;</td></td></tr>';
-    $scrout.='<tr bgcolor="#FFFFBB"><td>'.
+    $scrout.='<tr><td>'.
 	&titlefield(&mt('Limit Search to Domains')).'</td><td>'. 
 	    &Apache::loncommon::domain_select('domains',
 						   $ENV{'form.domains'},1).
@@ -655,7 +652,7 @@
          'lastrevisiondatestart' => 'Last Revision Date After',
          'lastrevisiondateend'   => 'Last Revision Date Before');
     foreach (sort keys %dates) {
-	$scrout.='<tr bgcolor="#FFFFBB">'.
+	$scrout.='<tr>'.
             '<td>'.&titlefield($dates{$_}).'</td><td>'. 
 	    &Apache::lonhtmlcommon::date_setter('advsearch',$_,0,'',1).
 	    '</td><td>&nbsp;</td></td>'.
@@ -735,7 +732,7 @@
 ######################################################################
 ######################################################################
 sub viewoptions {
-    my $scrout="\n\n".'<table bgcolor="#FFFFBB">'.
+    my $scrout="\n\n".'<table>'.
         '<tr><th>'.&mt('View Options').'</th><th>'.
 	&mt('Records per Page').'</th></tr><tr><td>';
     unless ($ENV{'form.viewselect'}) { $ENV{'form.viewselect'}='detailed'; }