Diff for /loncom/interface/lonsearchcat.pm between versions 1.132 and 1.133

version 1.132, 2002/06/27 14:46:00 version 1.133, 2002/06/27 19:28:50
Line 212  END Line 212  END
 onClick='javascript:select_group()'>  onClick='javascript:select_group()'>
 END  END
     }      }
     $hidden .= <<END;      $hidden .= &make_persistent({ "form.mode"    => $ENV{'form.mode'},
 <input type='hidden' name='mode'    value='$ENV{'form.mode'}'>                                    "form.form"    => $ENV{'form.form'},
 <input type='hidden' name='form'    value='$ENV{'form.form'}'>                                    "form.element" => $ENV{'form.element'},
 <input type='hidden' name='element' value='$ENV{'form.element'}'>                                    "form.date"    => 2 });
 <input type='hidden' name='date' value='2'>  
 END  
     ##      ##
     ##  What are we doing?      ##  What are we doing?
     ##      ##
Line 395  ENDHEADER Line 393  ENDHEADER
  undef,   undef,
  (&Apache::loncommon::filecategories()));   (&Apache::loncommon::filecategories()));
     $ENV{'form.language'}='any' unless length($ENV{'form.language'});      $ENV{'form.language'}='any' unless length($ENV{'form.language'});
     #      #----------------------------------------------------------------
     # Allow restriction to multiple domains.      # Allow restriction to multiple domains.
     #   I make the crazy assumption that there will never be a domain 'any'.      #   I make the crazy assumption that there will never be a domain 'any'.
     #      #
       $ENV{'form.domains'} = 'any' if (! exists($ENV{'form.domains'}));
       my @allowed_domains = (ref($ENV{'form.domains'}) ? @{$ENV{'form.domains'}} 
                              :  ($ENV{'form.domains'}) );
       my %domain_hash = ();
       foreach (@allowed_domains) {
           $domain_hash{$_}++;
       }
     my @domains =&Apache::loncommon::get_domains();      my @domains =&Apache::loncommon::get_domains();
     # adjust the size of the select box      # adjust the size of the select box
     my $size = 4;      my $size = 4;
Line 407  ENDHEADER Line 412  ENDHEADER
     if ((scalar @domains) == 1) {      if ((scalar @domains) == 1) {
         $scrout .='<input type="hidden" name="domains" value="any" />'."\n";          $scrout .='<input type="hidden" name="domains" value="any" />'."\n";
     } else {      } else {
         $scrout.='<font color="#800000" face="helvetica"><b>'.          $scrout.="\n".'<font color="#800000" face="helvetica"><b>'.
             'DOMAINS</b></font><br />'.              'DOMAINS</b></font><br />'.
                 '<select name="domains" size="'.$size.'" multiple>'."\n".                  '<select name="domains" size="'.$size.'" multiple>'."\n".
                     '<option name="any" selected>all domains</option>'."\n";                      '<option name="any" value="any" '.
                           ($domain_hash{'any'}? 'selected ' :'').
                           '>all domains</option>'."\n";
         foreach my $dom (sort @domains) {          foreach my $dom (sort @domains) {
             $scrout.="<option name=\"$dom\">$dom</option>\n";              $scrout.="<option name=\"$dom\" ".
                   ($domain_hash{$dom} ? 'selected ' :'').">$dom</option>\n";
         }          }
         $scrout.="</select>\n";          $scrout.="</select>\n";
     }      }
     #      #----------------------------------------------------------------
     #       # 
     #      #
     $scrout.=&selectbox('Limit by language','language',      $scrout.=&selectbox('Limit by language','language',
Line 517  to be somewhat persistent. Line 525  to be somewhat persistent.
 ######################################################################  ######################################################################
   
 sub make_persistent {  sub make_persistent {
       my %save = %{shift()};
     my $persistent='';      my $persistent='';
     foreach (keys %ENV) {      foreach (keys %save) {
  if (/^form\./ && !/submit/) {   if (/^form\./ && !/submit/) {
     my $name=$_;      my $name=$_;
     my $key=$name;              my @values = (ref($save{$name}) ? @{$save{$name}} : ($save{$name}));
     $ENV{$key}=~s/\'//g; # do not mess with html field syntax  
     $name=~s/^form\.//;      $name=~s/^form\.//;
     $persistent.=<<END;              foreach (@values) {
 <input type="hidden" name="$name" value="$ENV{$key}" />                  s/\"/\'/g; # do not mess with html field syntax
                   $persistent.=<<END;
   <input type="hidden" name="$name" value="$_" />
 END  END
               }
         }          }
     }      }
     return $persistent;      return $persistent;
Line 810  sub advancedsearch { Line 821  sub advancedsearch {
  my @fields=split(/\s+/,$customshow);   my @fields=split(/\s+/,$customshow);
  $customshow=join(" ",@fields);   $customshow=join(" ",@fields);
     }      }
     ##      ## ---------------------------------------------------------------
     ## Deal with restrictions to given domains      ## Deal with restrictions to given domains
     ##       ## 
     my $libraries_to_query = undef;      my $libraries_to_query = undef;
Line 831  sub advancedsearch { Line 842  sub advancedsearch {
             push @$libraries_to_query,$_;              push @$libraries_to_query,$_;
         }          }
     }      }
     if (defined($libraries_to_query)) {      ## ---------------------------------------------------------------
         &Apache::lonnet::logthis("libraries: @$libraries_to_query");  
     } else {  
         &Apache::lonnet::logthis("libraries: undef");  
     }  
     #      #
     # Send query statements over the network to be processed by either the SQL      # Send query statements over the network to be processed by either the SQL
     # database or a recursive scheme of 'grep'-like actions (for custom      # database or a recursive scheme of 'grep'-like actions (for custom
Line 1116  sub output_results { Line 1123  sub output_results {
     my $viewselect=$ENV{'form.viewselect'};      my $viewselect=$ENV{'form.viewselect'};
     #      #
     # make query information persistent to allow for subsequent revision      # make query information persistent to allow for subsequent revision
     my $persistent=&make_persistent();      my $persistent=&make_persistent(\%ENV);
     # spit out the results header      # spit out the results header
     $r->print(&search_results_header($mode));      $r->print(&search_results_header($mode));
     $r->rflush();      $r->rflush();
Line 1858  sub filled { Line 1865  sub filled {
 sub output_blank_field_error {  sub output_blank_field_error {
     my ($r)=@_;      my ($r)=@_;
     # make query information persistent to allow for subsequent revision      # make query information persistent to allow for subsequent revision
     my $persistent=&make_persistent();      my $persistent=&make_persistent(\%ENV);
   
     $r->print(<<BEGINNING);      $r->print(<<BEGINNING);
 <html>  <html>
Line 1904  Output a full html page with an error me Line 1911  Output a full html page with an error me
 sub output_date_error {  sub output_date_error {
     my ($r,$message)=@_;      my ($r,$message)=@_;
     # make query information persistent to allow for subsequent revision      # make query information persistent to allow for subsequent revision
     my $persistent=&make_persistent();      my $persistent=&make_persistent(\%ENV);
   
     $r->print(<<RESULTS);      $r->print(<<RESULTS);
 <html>  <html>

Removed from v.1.132  
changed lines
  Added in v.1.133


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