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

bisitz bisitz@source.lon-capa.org
Fri, 31 Jul 2009 17:58:16 -0000


This is a MIME encoded message

--bisitz1249063096
Content-Type: text/plain

bisitz		Fri Jul 31 17:58:16 2009 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
  Log:
  Advanced Search - consistent and nicer layout: use pick_box
  
  
--bisitz1249063096
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20090731175816.txt"

Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.313 loncom/interface/lonsearchcat.pm:1.314
--- loncom/interface/lonsearchcat.pm:1.313	Fri Jul 31 16:01:48 2009
+++ loncom/interface/lonsearchcat.pm	Fri Jul 31 17:58:16 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.313 2009/07/31 16:01:48 bisitz Exp $
+# $Id: lonsearchcat.pm,v 1.314 2009/07/31 17:58:16 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -856,9 +856,11 @@
 				       'reset' => 'Reset',
 				       'help' => 'Help');
     my $advanced_buttons=<<"END";
+<p>
 <input type="submit" name="advancedsubmit" value='$lt{"srch"}' />
 <input type="reset" name="reset" value='$lt{"reset"}' />
 $closebutton
+</p>
 END
     my $srchtype = 'Catalog';
     my $jscript;
@@ -878,20 +880,28 @@
     }
     my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search",
                                                $jscript);
-    $scrout .= <<"ENDHEADER";
-$bread_crumb
-<form method="post" action="/adm/searchcat" name="advsearch">
-<p>
-$advanced_buttons
-ENDHEADER
-    $scrout.=('&nbsp;'x2).&viewoptions().'</p>'.$hidden_fields. 
-        '<input type="hidden" name="phase" value="adv_search" />';
+    $scrout .= $bread_crumb;
+
+    $scrout .= '<form method="post" action="/adm/searchcat" name="advsearch">'
+              .$hidden_fields 
+              .'<input type="hidden" name="phase" value="adv_search" />';
+
+    $scrout .= '<fieldset>'."\n"
+              .'<legend>'.&mt('Display Options').'</legend>'."\n"
+              .&viewoptions()
+              .'</fieldset>';
+
+    $scrout .= $advanced_buttons;
+
+    $scrout .= &Apache::lonhtmlcommon::start_pick_box();
+
     my %fields=&Apache::lonmeta::fieldnames();
-    #
-    $scrout .= '<h3>'.&mt("Standard $srchtype Metadata").'</h3>';
-    $scrout .= "<table>\n";
-    $scrout .= '<tr><td>&nbsp;</td><td colspan="2"><font size="-1">'.
-        ('&nbsp;'x2).&searchhelp()."</font></td></tr>\n";
+
+    # Standard Metadata
+    $scrout .= &Apache::lonhtmlcommon::row_headline()
+              .'<h3>'.&mt("Standard $srchtype Metadata").'</h3>'
+              .&searchhelp()
+              .&Apache::lonhtmlcommon::row_closure();
     my %related_word_search = 
         ('title'    => 1,
          'author'   => 0,
@@ -903,110 +913,111 @@
          'abstract' => 1,
          'standards'=> 1,
          'mime'     => 1,
-	 'subject'  => 1,
+         'subject'  => 1,
          );
     #
     foreach my $field ('title','author','subject','owner','authorspace',
-		       'modifyinguser','keywords','notes','abstract',
-		       'standards','mime') {
-	$scrout.='<tr><td align="right">'.&titlefield($fields{$field}).'</td><td>'.
-	    &Apache::lonmeta::prettyinput($field,
+                       'modifyinguser','keywords','notes','abstract',
+                       'standards','mime') {
+        $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield($fields{$field}))
+                  .&Apache::lonmeta::prettyinput($field,
                                           $env{'form.'.$field},
                                           $field,
                                           'advsearch',
-					  $related_word_search{$field},
-                                          '</td><td align="left">',
+                                          $related_word_search{$field},
+                                          '',
                                           $env{'form.'.$field.'_related'},
                                           50);
         if ($related_word_search{$field}) {
             $scrout .= &mt('related words');
         } else {
-            $scrout .= '</td><td>&nbsp;';
+            $scrout .= '';
         }
-        $scrout .= '</td></tr>'.$/;
+        $scrout .= &Apache::lonhtmlcommon::row_closure();
     }
     foreach my $field ('lowestgradelevel','highestgradelevel') {
-	$scrout.='<tr>'.
-            '<td align="right">'.&titlefield($fields{$field}).'</td>'.
-            '<td colspan="2">'.
-	    &Apache::lonmeta::prettyinput($field,
+        $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield($fields{$field}))
+                  .&Apache::lonmeta::prettyinput($field,
                                           $env{'form.'.$field},
                                           $field,
                                           'advsearch',
-					  0).
-                                          '</td></tr>'.$/;
+                                          0)
+                  .&Apache::lonhtmlcommon::row_closure();
     }
-    $scrout.='<tr><td align="right">'.
-	&titlefield(&mt('MIME Type Category')).'</td><td colspan="2">'. 
-	    &Apache::loncommon::filecategoryselect('category',
-						   $env{'form.category'}).
-	    '</td></tr>'.$/;
-    $scrout.='<tr><td align="right" valign="top">'.
-	&titlefield(&mt('Domains')).'</td><td colspan="2">'. 
-	    &Apache::loncommon::domain_select('domains',
-						   $env{'form.domains'},1).
-						   '<br />';
-     $scrout .= '</td></tr>'.$/;
-    #
+
+    $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('MIME Type Category')))
+              .&Apache::loncommon::filecategoryselect('category',
+                   $env{'form.category'})
+              .&Apache::lonhtmlcommon::row_closure();
+
+    $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains')))
+              .&Apache::loncommon::domain_select('domains',
+                   $env{'form.domains'},1)
+              .&Apache::lonhtmlcommon::row_closure();
+
     # Misc metadata
     if ($env{'form.area'} ne 'portfolio') {
-        $scrout.='<tr><td align="right" valign="top">'.
-	         &titlefield(&mt('Copyright/Distribution')).
-                 '</td><td colspan="2">'.
-                 &Apache::lonmeta::selectbox('copyright',
+        $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Copyright/Distribution')))
+                  .&Apache::lonmeta::selectbox('copyright',
                                              $env{'form.copyright'},
                                 \&Apache::loncommon::copyrightdescription,
                                        ( undef,
                                         &Apache::loncommon::copyrightids)
-                                ).'</td></tr>'.$/;
+                                )
+                  .&Apache::lonhtmlcommon::row_closure();
     }
-    $scrout.='<tr><td align="right" valign="top">'.
-	&titlefield(&mt('Language')).'</td><td colspan="2">'.
-        &Apache::lonmeta::selectbox('language',
+
+    $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Language')))
+              .&Apache::lonmeta::selectbox('language',
                                     $env{'form.language'},
                                     \&Apache::loncommon::languagedescription,
                                     ('any',&Apache::loncommon::languageids)
-                                    ).'</td></tr>';
-    $scrout .= "</table>\n";
-
+                                    )
+              .&Apache::lonhtmlcommon::row_closure();
     
+    # Portfolio Metadata
     if ($env{'form.area'} eq 'portfolio') {
         # Added fields
         my $curnumadd = $env{'form.numaddedfields'};
         if ($curnumadd eq '') {
             $curnumadd = 1;
         }
-        $scrout .= '<h3>'.&mt('Custom Metadata fields').'</h3>';
-        $scrout .= "<table>\n";
-        $scrout .= '<tr><td>&nbsp;</td><td align="center">'.
-                   &mt('Field Name').'</td>'.'<td align="center">'.
-                   &mt('Field Value(s)').'</td></tr>';
+        $scrout .= &Apache::lonhtmlcommon::row_headline()
+                  .'<h3>'.&mt('Custom Metadata fields').'</h3>'
+                  .&Apache::lonhtmlcommon::row_closure()
+                  .&Apache::lonhtmlcommon::row_title('')
+                  .&mt('Field Name').' | '.&mt('Field Value(s)')
+                  .&Apache::lonhtmlcommon::row_closure();
 
         for (my $j=0; $j<$curnumadd; $j++) {
             my $num = $j+1;
-            $scrout .= '<tr><td>'.&mt('Custom metadata [_1]: ',$num).
-                       '</td><td align="center">'.
-                       '<input type="text" name="addedfield_'.$j.
-                       '" size="10" value="'.$env{'form.addedfield_'.$j}.
-                       '" /></td>'.
-                       '<td align="center"><input type="text" '.
-                       'name="addedvalues_'.$j.'" size="15" value="'.
-                       $env{'form.addedvalues_'.$j}.'" /></td></tr>';
-        }
-        $scrout .= '<tr><td align="left" colspan="3"><label>'.
-                   '<input type="checkbox" name="newfield" '.
-                   'value="1" onclick="javascript:additional_metadata()" />'.
-                   &mt('Another custom field/value pair?').'</label>'.
-                   '<input type="hidden" name="numaddedfields" value="'.
-                   $curnumadd.'" /></td></tr></table>';
-    } else {
+            $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Custom metadata [_1]',$num))
+                      .'<input type="text"'
+                      .' name="addedfield_'.$j.'" size="10"'
+                      .' value="'.$env{'form.addedfield_'.$j}.'" />'
+                      .' '
+                      .'<input type="text" '
+                      .'name="addedvalues_'.$j.'" size="15"'
+                      .' value="'.$env{'form.addedvalues_'.$j}.'" />'
+                      .&Apache::lonhtmlcommon::row_closure();
+        }
+        $scrout .= &Apache::lonhtmlcommon::row_title('')
+                  .'<label>'
+                  .'<input type="checkbox" name="newfield"'
+                  .' value="1" onclick="javascript:additional_metadata()" />'
+                  .&mt('Another custom field/value pair?').'</label>'
+                  .'<input type="hidden" name="numaddedfields"'
+                  .' value="'.$curnumadd.'" />'
+                  .&Apache::lonhtmlcommon::row_closure();
+} else {
         #
         # Dynamic metadata
-        $scrout .= '<h3>'.&mt('Problem Statistics').'</h3>';
-        $scrout .= "<table>\n";
-        $scrout .= '<tr><td>&nbsp;</td><td align="center">'.
-                   &mt('Minimum').'</td>'.'<td align="center">'.
-                   &mt('Maximum').'</td></tr>'."\n";
+        $scrout .= &Apache::lonhtmlcommon::row_headline()
+                  .'<h3>'.&mt('Problem Statistics').'</h3>'
+                  .&Apache::lonhtmlcommon::row_closure();
+        $scrout .= &Apache::lonhtmlcommon::row_title('')
+                  .&mt('Minimum').' | '.&mt('Maximum')
+                  .&Apache::lonhtmlcommon::row_closure();
         foreach my $statistic 
             ({ name=>'count',
                description=>'Network-wide number of accesses (hits)',},
@@ -1019,20 +1030,21 @@
                description=>'Degree of difficulty',},
              { name => 'disc',
                description=>'Degree of discrimination'}) {
-              $scrout .= '<tr><td align="right">'.
-                         &titlefield(&mt($statistic->{'description'})).
-                         '</td><td align="center">'.
-                         '<input type="text" name="'.$statistic->{'name'}.
-                         '_min" value="" size="6" /></td><td align="center">'.
-                         '<input type="text" name="'.$statistic->{'name'}.
-                         '_max" value="" size="6" /></td></tr>'.$/;
-        }
-        $scrout .= "</table>\n";
-        $scrout .= '<h3>'.&mt('Evaluation Data').'</h3>';
-        $scrout .= "<table>\n";
-        $scrout .= '<tr><td>&nbsp;</td><td align="center">'.
-                   &mt('Minimum').'</td>'.'<td align="center">'.
-                   &mt('Maximum').'</td></tr>'."\n";
+              $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($statistic->{'description'})))
+                        .'<input type="text" name="'.$statistic->{'name'}
+                        .'_min" value="" size="6" />'
+                        .' '
+                        .'<input type="text" name="'.$statistic->{'name'}
+                        .'_max" value="" size="6" />'
+                        .&Apache::lonhtmlcommon::row_closure();
+        }
+
+        $scrout .= &Apache::lonhtmlcommon::row_headline()
+                  .'<h3>'.&mt('Evaluation Data').'</h3>'
+                  .&Apache::lonhtmlcommon::row_closure();
+        $scrout .= &Apache::lonhtmlcommon::row_title('')
+                  .&mt('Minimum').' | '.&mt('Maximum')
+                  .&Apache::lonhtmlcommon::row_closure();
         foreach my $evaluation
             ( { name => 'clear',
                 description => 'Material presented in clear way'},
@@ -1044,22 +1056,24 @@
                 description => 'Material appears to be correct'},
               { name => 'technical',
                 description => 'Resource is technically correct'}){
-            $scrout .= '<tr><td align="right">'.
-                       &titlefield(&mt($evaluation->{'description'})).
-                       '</td><td align="center">'.
-                       '<input type="text" name="'.
-                       $evaluation->{'name'}.'_min" value="" size="6" />'.
-                       '</td><td align="center"><input type="text" name="'.
-                       $evaluation->{'name'}.'_max" value="" size="6" />'.
-                       '</td></tr>'.$/;
+            $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt($evaluation->{'description'})))
+                      .'<input type="text" name="'
+                      .$evaluation->{'name'}.'_min" value="" size="6" />'
+                      .' '
+                      .'<input type="text" name="'
+                      .$evaluation->{'name'}.'_max" value="" size="6" />'
+                      .&Apache::lonhtmlcommon::row_closure();
         }
-        $scrout .= "</table>\n";
     }
     #
     # Creation/Modification date limits
-    $scrout .= '<h3>'.&mt('Creation and Modification dates').'</h3>';
-    $scrout .= "\n<table>\n";
-    $scrout .= "<tr><td>&nbsp;</td><td>".&mt('Month[_1]Day[_2]Year','&nbsp;'x14,'&nbsp;'x6)."</td></tr>\n";
+    $scrout .= &Apache::lonhtmlcommon::row_headline()
+              .'<h3>'.&mt('Creation and Modification dates').'</h3>'
+              .&Apache::lonhtmlcommon::row_closure();
+    $scrout .= &Apache::lonhtmlcommon::row_title('')
+              .&mt('Month[_1]Day[_2]Year','&nbsp;'x14,'&nbsp;'x6)
+              .&Apache::lonhtmlcommon::row_closure();
+
     my $cafter = 
         &Apache::lonhtmlcommon::date_setter('advsearch',         # formname
                                             'creationdate1', # fieldname
@@ -1078,10 +1092,13 @@
                                             '',          # state
                                             1,           # no_hh_mm_ss
                                             );
-    $scrout .= '<tr><td align="right">'.&mt('Created between').'</td>'
-              .'<td>'.$cafter.'</td></tr>'
-              .'<tr><td align="right">'.&mt('and').'</td>'
-              .'<td>'.$cbefore.'</td></tr>';
+    $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Created between'))
+              .$cafter
+              .&Apache::lonhtmlcommon::row_closure(1)
+              .&Apache::lonhtmlcommon::row_title(&mt('and'))
+              .$cbefore
+              .&Apache::lonhtmlcommon::row_closure();
+
     my $lafter = 
         &Apache::lonhtmlcommon::date_setter('advsearch',
                                             'revisiondate1', 
@@ -1100,15 +1117,18 @@
                                             '',          # state
                                             1,           # no_hh_mm_ss
                                             );
-    $scrout .= '<tr><td align="right">'.&mt('Last modified between').'</td>'
-              .'<td>'.$lafter.'</td></tr>'
-              .'<tr><td align="right">'.&mt('and').'</td>'
-              .'<td>'.$lbefore.'</td></tr>';
-    $scrout.="</table>\n";
-    $scrout.=<<ENDDOCUMENT;
-$advanced_buttons
-</form>
-ENDDOCUMENT
+    $scrout .= &Apache::lonhtmlcommon::row_title(&mt('Last modified between'))
+              .$lafter
+              .&Apache::lonhtmlcommon::row_closure(1)
+              .&Apache::lonhtmlcommon::row_title(&mt('and'))
+              .$lbefore
+              .&Apache::lonhtmlcommon::row_closure(1); # Last row of total pick_box
+
+    $scrout .= &Apache::lonhtmlcommon::end_pick_box();
+
+    $scrout .= $advanced_buttons
+              .'</form>';
+
     $scrout .= &Apache::loncommon::end_page();
     $r->print($scrout);
     return;

--bisitz1249063096--