Diff for /loncom/interface/lonsearchcat.pm between versions 1.204 and 1.208

version 1.204, 2004/03/03 17:25:23 version 1.208, 2004/04/19 14:42:24
Line 48  described at http://www.lon-capa.org. Line 48  described at http://www.lon-capa.org.
 lonsearchcat presents the user with an interface to search the LON-CAPA  lonsearchcat presents the user with an interface to search the LON-CAPA
 digital library.  lonsearchcat also initiates the execution of a search  digital library.  lonsearchcat also initiates the execution of a search
 by sending the search parameters to LON-CAPA servers.  The progress of   by sending the search parameters to LON-CAPA servers.  The progress of 
 search (on a server basis) is displayed to the user in a seperate window.  search (on a server basis) is displayed to the user in a separate window.
   
 =head1 Internals  =head1 Internals
   
Line 454  sub untiehash { Line 454  sub untiehash {
   
 } # End of course search scoping  } # 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;
   }
   
 ######################################################################  ######################################################################
 ######################################################################  ######################################################################
   
Line 472  sub print_basic_search_form { Line 489  sub print_basic_search_form {
     my $bodytag=&Apache::loncommon::bodytag('Search').      my $bodytag=&Apache::loncommon::bodytag('Search').
  &Apache::loncommon::help_open_topic('Finding_Resources').   &Apache::loncommon::help_open_topic('Finding_Resources').
  &Apache::loncommon::help_open_bug('Searching');   &Apache::loncommon::help_open_bug('Searching');
     my $scrout=<<"ENDDOCUMENT";      my $scrout = &search_html_header().$bodytag;
 <html>      if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
 <head>          my $CatalogSearch=&mt('Catalog Search');
 <title>The LearningOnline Network with CAPA</title>          my $Statement=&searchhelp();
 <script type="text/javascript">          $scrout.=(<<ENDDOCUMENT);
     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);  
 <h1>$CatalogSearch</h1>  <h1>$CatalogSearch</h1>
 <form name="loncapa_search" method="post" action="/adm/searchcat">  <form name="loncapa_search" method="post" action="/adm/searchcat">
 <input type="hidden" name="phase" value="basic_search" />  <input type="hidden" name="phase" value="basic_search" />
Line 501  $Statement. Line 505  $Statement.
 <table>  <table>
 <tr><td>  <tr><td>
 ENDDOCUMENT  ENDDOCUMENT
     $scrout.='&nbsp;'.&Apache::lonhtmlcommon::textbox('basicexp',          $scrout.='&nbsp;'.
                                             $ENV{'form.basicexp'},40).              &Apache::lonhtmlcommon::textbox('basicexp',
         '&nbsp;';                                          $ENV{'form.basicexp'},40).
     my $relatedcheckbox = &Apache::lonhtmlcommon::checkbox('related',                                          '&nbsp;';
  $ENV{'form.related'});          my $relatedcheckbox = 
     my $domain = $r->dir_config('lonDefDomain');              &Apache::lonhtmlcommon::checkbox('related',
     my $domaincheckbox = &Apache::lonhtmlcommon::checkbox('domains',                                               $ENV{'form.related'});
  $ENV{'form.domains'});          my $domain = $r->dir_config('lonDefDomain');
     my $srch=&mt('Search');          my $domaincheckbox = 
     my $header=&mt('Advanced Search');              &Apache::lonhtmlcommon::checkbox('domains',
     my $userelatedwords=&mt('use related words');                                               $ENV{'form.domains'});
     my $onlysearchdomain=&mt('only search domain');          my $srch=&mt('Search');
     my $view=&viewoptions();          my $header=&mt('Advanced Search');
     $scrout.=<<END;          my $userelatedwords=&mt('use related words');
           my $onlysearchdomain=&mt('only search domain');
           my $view=&viewoptions();
           $scrout.=<<END;
 </td><td><a  </td><td><a
 href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}&mode=$ENV{'form.mode'}"  href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}&mode=$ENV{'form.mode'}"
 >$header</a></td></tr>  >$header</a></td></tr>
Line 602  sub print_advanced_search_form{ Line 609  sub print_advanced_search_form{
 <input type="reset" name="reset" value='$lt{"reset"}' />  <input type="reset" name="reset" value='$lt{"reset"}' />
 $closebutton  $closebutton
 <input type="button" value="$lt{'help'}" onClick="openhelp()" />  <input type="button" value="$lt{'help'}" onClick="openhelp()" />
 </p>  
 END  END
     my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search');      my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search');
     my $searchhelp=&searchhelp();      my $searchhelp=&searchhelp();
     my $scrout=<<"ENDHEADER";      my $scrout=&search_html_header();
 <html>      $scrout .= <<"ENDHEADER";
 <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  $bodytag
 $searchhelp  
 <form method="post" action="/adm/searchcat" name="advsearch">  <form method="post" action="/adm/searchcat" name="advsearch">
 $advanced_buttons  $advanced_buttons
 $hidden_fields  
 <input type="hidden" name="phase" value="adv_search" />  
 ENDHEADER  ENDHEADER
     $scrout.=&viewoptions();      $scrout.=('&nbsp;'x2).&viewoptions().'</p>'.$hidden_fields. 
           '<input type="hidden" name="phase" value="adv_search" />';
     my %fields=&Apache::lonmeta::fieldnames();      my %fields=&Apache::lonmeta::fieldnames();
       #
       $scrout.= '<p>'.$searchhelp.'</p>'.
           "<table>\n";
       my %related_word_search = 
           ('title'=>1,
            'author'=>0,
            'owner'=>0,
            'authorspace'=>0,
            'modifyinguser'=>0,
            'keywords'=>1,
            'notes'=>1,
            'abstract'=>1,
            'standards'=>1,
            'mime'=>1,
            );
   
     $scrout.='<table>';      foreach my $field ('title','author','owner','authorspace','modifyinguser',
     $scrout.="<tr><th>".&mt('Field').'</th><th>'.&mt('Value').'</th><th>'       'keywords','notes','abstract','standards','mime') {
  .&mt('Related').'<br />'.&mt('Words')."</td></tr>\n";   $scrout.='<tr><td align="right">'.&titlefield($fields{$field}).'</td><td>'.
     foreach ('title','author','owner','authorspace','modifyinguser',      &Apache::lonmeta::prettyinput($field,
      'keywords','notes','abstract','standards',                                            $ENV{'form.'.$field},
      'lowestgradelevel','highestgradelevel','mime') {                                            $field,
  $scrout.='<tr bgcolor="#FFFFBB"><td>'.&titlefield($fields{$_}).'</td><td>'.                                            'advsearch',
     &Apache::lonmeta::prettyinput($_,$ENV{'form.'.$_},$_,'advsearch',    $related_word_search{$field},
   1,'</td><td>',$ENV{'form.'.$_.'_related'}).                                            '</td><td align="left">',
     '</td></tr>';                                            $ENV{'form.'.$field.'_related'},
                                             50);
           if ($related_word_search{$field}) {
               $scrout .= 'related words';
           } else {
               $scrout .= '</td><td>&nbsp;';
           }
           $scrout .= '</td></tr>'.$/;
       }
       foreach my $field ('lowestgradelevel','highestgradelevel') {
    $scrout.='<tr>'.
               '<td align="right">'.&titlefield($fields{$field}).'</td>'.
               '<td colspan="2">'.
       &Apache::lonmeta::prettyinput($field,
                                             $ENV{'form.'.$field},
                                             $field,
                                             'advsearch',
     0).
                                             '</td></tr>'.$/;
     }      }
     $scrout.='<tr bgcolor="#FFFFBB"><td>'.      $scrout.='<tr><td align="right">'.
  &titlefield(&mt('MIME Type Category')).'</td><td>'.    &titlefield(&mt('MIME Type Category')).'</td><td colspan="2">'. 
     &Apache::loncommon::filecategoryselect('category',      &Apache::loncommon::filecategoryselect('category',
    $ENV{'form.category'}).     $ENV{'form.category'}).
     '</td><td>&nbsp;</td></td></tr>';      '</td></tr>'.$/;
     $scrout.='<tr bgcolor="#FFFFBB"><td>'.      $scrout.='<tr><td align="right" valign="top">'.
  &titlefield(&mt('Limit Search to Domains')).'</td><td>'.    &titlefield(&mt('Domains')).'</td><td colspan="2">'. 
     &Apache::loncommon::domain_select('domains',      &Apache::loncommon::domain_select('domains',
    $ENV{'form.domains'},1).     $ENV{'form.domains'},1).
     '</td><td>&nbsp;</td></td></tr>';      '</td></tr>'.$/;
       $scrout .= "</table>\n<br />\n<table>\n";
     my %dates=&Apache::lonlocal::texthash      my %dates=&Apache::lonlocal::texthash
         ('creationdatestart'     => 'Creation Date After',          ('creationdatestart'     => 'Creation Date After',
          'creationdateend'       => 'Creation Date Before',           'creationdateend'       => 'Creation Date Before',
          'lastrevisiondatestart' => 'Last Revision Date After',           'lastrevisiondatestart' => 'Last Revision Date After',
          'lastrevisiondateend'   => 'Last Revision Date Before');           'lastrevisiondateend'   => 'Last Revision Date Before');
     foreach (sort keys %dates) {      foreach my $field (sort keys %dates) {
  $scrout.='<tr bgcolor="#FFFFBB">'.   $scrout.='<tr>'.
             '<td>'.&titlefield($dates{$_}).'</td><td>'.               '<td align="right">'.&titlefield($dates{$field}).'</td><td>'. 
     &Apache::lonhtmlcommon::date_setter('advsearch',$_,0,'',1).      &Apache::lonhtmlcommon::date_setter('advsearch',$field,0,'',1).
     '</td><td>&nbsp;</td></td>'.      '</td></tr>'.$/;
             '</tr>';  
     }      }
   
     $scrout.="</table>\n";      $scrout.="</table>\n";
     $scrout.=<<ENDDOCUMENT;      $scrout.=<<ENDDOCUMENT;
 $advanced_buttons  $advanced_buttons
Line 690  Outputs: titletext with font wrapper Line 716  Outputs: titletext with font wrapper
 ######################################################################  ######################################################################
 sub titlefield {  sub titlefield {
     my $title=shift;      my $title=shift;
     return '<font face="arial" color="#800000">'.$title.'</font>';      return $title;
 }  }
   
 ######################################################################  ######################################################################
Line 735  Outputs: text for box with view options Line 761  Outputs: text for box with view options
 ######################################################################  ######################################################################
 ######################################################################  ######################################################################
 sub viewoptions {  sub viewoptions {
     my $scrout="\n\n".'<table bgcolor="#FFFFBB">'.      my $scrout="\n".'<nobr>';
         '<tr><th>'.&mt('View Options').'</th><th>'.      if (! defined($ENV{'form.viewselect'})) { 
  &mt('Records per Page').'</th></tr><tr><td>';          $ENV{'form.viewselect'}='detailed'; 
     unless ($ENV{'form.viewselect'}) { $ENV{'form.viewselect'}='detailed'; }      }
     $scrout.=&Apache::lonmeta::selectbox('viewselect',      $scrout.=&Apache::lonmeta::selectbox('viewselect',
  $ENV{'form.viewselect'},   $ENV{'form.viewselect'},
  \&viewoptiontext,   \&viewoptiontext,
  sort(keys(%Views)));   sort(keys(%Views)));
     $scrout.='</td><td>';      $scrout.= '&nbsp;&nbsp;';
     $scrout.=&Apache::lonmeta::selectbox('show',      $scrout.=&Apache::lonmeta::selectbox('show',
  $ENV{'form.show'},   $ENV{'form.show'},
  undef,   undef,
  (10,20,50,100,1000,10000));   (10,20,50,100,1000,10000));
     $scrout.="</td></tr></table>\n\n";      $scrout .= ('&nbsp;'x2).&mt('Records per Page').'</nobr>'.$/;
     return $scrout;      return $scrout;
 }  }
   
Line 882  Inputs: Hash of values to save, filename Line 908  Inputs: Hash of values to save, filename
   
 Store variables away to the %persistent_db.  Store variables away to the %persistent_db.
 Values will be escaped.  Values that are array pointers will have their  Values will be escaped.  Values that are array pointers will have their
 elements escaped and concatenated in a comma seperated string.    elements escaped and concatenated in a comma separated string.  
   
 =cut  =cut
   
Line 914  Inputs: filename of persistent database. Line 940  Inputs: filename of persistent database.
   
 Store most form variables away to the %persistent_db.  Store most form variables away to the %persistent_db.
 Values will be escaped.  Values that are array pointers will have their  Values will be escaped.  Values that are array pointers will have their
 elements escaped and concatenated in a comma seperated string.    elements escaped and concatenated in a comma separated string.  
   
 =cut  =cut
   
Line 2236  The 'title' field is set to "Untitled" i Line 2262  The 'title' field is set to "Untitled" i
 sub parse_raw_result {  sub parse_raw_result {
     my ($result,$hostname) = @_;      my ($result,$hostname) = @_;
     # conclude from self to others regarding fields      # conclude from self to others regarding fields
     my %Fields=&Apache::lonmeta::metadata_col_to_hash(      my %Fields=&LONCAPA::lonmetadata::metadata_col_to_hash
  map {          (map {
  &Apache::lonnet::unescape($_);              &Apache::lonnet::unescape($_);
  } (split(/\,/,$result))          } (split(/\,/,$result)) );
       );  
     return %Fields;      return %Fields;
 }  }
   

Removed from v.1.204  
changed lines
  Added in v.1.208


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>