Diff for /loncom/interface/lonsearchcat.pm between versions 1.108 and 1.110

version 1.108, 2001/11/29 20:33:28 version 1.110, 2001/12/11 03:18:39
Line 28 Line 28
 # YEAR=2001  # YEAR=2001
 # 3/8, 3/12, 3/13, 3/14, 3/15, 3/19 Scott Harrison  # 3/8, 3/12, 3/13, 3/14, 3/15, 3/19 Scott Harrison
 # 3/20, 3/21, 3/22, 3/26, 3/27, 4/2, 8/15, 8/24, 8/25 Scott Harrison  # 3/20, 3/21, 3/22, 3/26, 3/27, 4/2, 8/15, 8/24, 8/25 Scott Harrison
 # 10/12,10/14,10/15,10/16,11/28,11/29 Scott Harrison  # 10/12,10/14,10/15,10/16,11/28,11/29,12/10 Scott Harrison
 #  #
 ###  ###
   
Line 103  sub BEGIN { Line 103  sub BEGIN {
     {      {
  my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.   my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
  '/language.tab');   '/language.tab');
  map {   while (<$fh>) {
     $_=~/(\w+)\s+([\w\s\-]+)/; chomp;      $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
     $language{$1}=$2;      $language{$1}=$2;
  } <$fh>;   }
     }      }
     $cprtag{'any'}='Any copyright/distribution';      $cprtag{'any'}='Any copyright/distribution';
     {      {
  my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonIncludes'}.   my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonIncludes'}.
  '/copyright.tab');   '/copyright.tab');
  map {   while (<$fh>) {
     $_=~/(\w+)\s+([\w\s\-]+)/; chomp;      $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
     $cprtag{$1}=$2;      $cprtag{$1}=$2;
  } <$fh>;   }
     }      }
     $mimetag{'any'}='Any type';      $mimetag{'any'}='Any type';
     {      {
  my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.   my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
  '/filetypes.tab');   '/filetypes.tab');
  map {   while (<$fh>) {
     $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; chomp;      if (/^\S/ and !/^\#/) {
     $mimetag{$1}=".$1 $3";   $_=~/(\S+)\s+(\S+)\s+([\S\s\-]+)/; chomp;
  } <$fh>;   $mimetag{$1}=".$1 $3";
       }
    }
     }      }
     {      {
  my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.   my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
  '/hosts.tab');   '/hosts.tab');
  map {   while (<$fh>) {
     $_=~/(\w+?)\:(\w+?)\:(\w+?)\:(.*)/; chomp;      $_=~/(\w+?)\:(\w+?)\:(\w+?)\:(.*)/; chomp;
     if ($3 eq 'library') {      if ($3 eq 'library') {
  $hostdomains{$1}=$2;   $hostdomains{$1}=$2;
  $hostips{$1}=$4;   $hostips{$1}=$4;
     }      }
  } <$fh>;   }
     }      }
 }  }
   
Line 231  END Line 233  END
     $scrout.=&searchphrasefield('Limit by abstract','abstract',      $scrout.=&searchphrasefield('Limit by abstract','abstract',
  $ENV{'form.abstract'});   $ENV{'form.abstract'});
   
     $ENV{'form.mime'}='notxxx' unless length($ENV{'form.mime'});      $ENV{'form.mime'}='any' unless length($ENV{'form.mime'});
     $scrout.=&selectbox('Limit by MIME type','mime',      $scrout.=&selectbox('Limit by MIME type','mime',
  $ENV{'form.mime'},%mimetag);   $ENV{'form.mime'},%mimetag);
   
Line 376  ENDDOCUMENT Line 378  ENDDOCUMENT
   
 # ----------- grab unprocessed CGI variables that may have been appended to URL  # ----------- grab unprocessed CGI variables that may have been appended to URL
 sub get_unprocessed_cgi {  sub get_unprocessed_cgi {
     map {      foreach (split(/&/,$ENV{'QUERY_STRING'})) {
        my ($name, $value) = split(/=/,$_);         my ($name, $value) = split(/=/,$_);
        $value =~ tr/+/ /;         $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
        if ($name eq 'catalogmode' or $name eq 'launch' or $name eq 'acts') {         if ($name eq 'catalogmode' or $name eq 'launch' or $name eq 'acts') {
    $ENV{'form.'.$name}=$value;     $ENV{'form.'.$name}=$value;
        }         }
     } (split(/&/,$ENV{'QUERY_STRING'}));      }
 }  }
   
 # ------------------------------------------------------------- make persistent  # ------------------------------------------------------------- make persistent
 sub make_persistent {  sub make_persistent {
     my $persistent='';      my $persistent='';
           
     map {      foreach (keys %ENV) {
  if (/^form\./ && !/submit/) {   if (/^form\./ && !/submit/) {
     my $name=$_;      my $name=$_;
     my $key=$name;      my $key=$name;
Line 400  sub make_persistent { Line 402  sub make_persistent {
 <input type='hidden' name='$name' value='$ENV{$key}' />  <input type='hidden' name='$name' value='$ENV{$key}' />
 END  END
         }          }
     } (keys %ENV);      }
     return $persistent;      return $persistent;
 }  }
   
Line 580  sub selectbox { Line 582  sub selectbox {
     my $uctitle=uc($title);      my $uctitle=uc($title);
     my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".      my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
  "</b></font><br />".'<select name="'.$name.'">';   "</b></font><br />".'<select name="'.$name.'">';
     map {      foreach (sort keys %options) {
         $selout.='<option value=\''.$_.'\'';          $selout.='<option value=\''.$_.'\'';
         if ($_ eq $value) { $selout.=' selected'; }          if ($_ eq $value) { $selout.=' selected'; }
         $selout.='>'.$options{$_}.'</option>';          $selout.='>'.$options{$_}.'</option>';
     } sort keys %options;      }
     return $selout.'</select>';      return $selout.'</select>';
 }  }
   
Line 1506  RESULTS Line 1508  RESULTS
 # --------- settings whenever the user causes the search window to be launched  # --------- settings whenever the user causes the search window to be launched
 sub start_fresh_session {  sub start_fresh_session {
     delete $hash{'mode_catalog'};      delete $hash{'mode_catalog'};
     map {      foreach (keys %hash) {
         if ($_ =~ /^pre_/) {          if ($_ =~ /^pre_/) {
             delete $hash{$_};              delete $hash{$_};
         }          }
         if ($_ =~ /^store/) {          if ($_ =~ /^store/) {
     delete $hash{$_};      delete $hash{$_};
  }   }
     } keys %hash;      }
 }  }
   
 1;  1;

Removed from v.1.108  
changed lines
  Added in v.1.110


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