/[webpac-proto]/search/Search.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /search/Search.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by dpavlin, Mon Jun 24 14:50:44 2002 UTC revision 1.11 by dpavlin, Tue Jun 25 13:48:12 2002 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  #*****************************************************************************  #*****************************************************************************
4  #       Copyright (C) 1993-2000, FS Consulting Inc. All rights reserved          *  #       Copyright (C) 1993-2000, FS Consulting Inc. All rights reserved      *
5  #                                                                                                                                                        *  #                                                                            *
6  #                                                                                                                                                        *  #                                                                            *
7  #  This notice is intended as a precaution against inadvertent publication       *  #  This notice is intended as a precaution against inadvertent publication   *
8  #  and does not constitute an admission or acknowledgement that publication      *  #  and does not constitute an admission or acknowledgement that publication  *
9  #  has occurred or constitute a waiver of confidentiality.                                       *  #  has occurred or constitute a waiver of confidentiality.                   *
10  #                                                                                                                                                        *  #                                                                            *
11  #  This software is the proprietary and confidential property                            *  #  This software is the proprietary and confidential property                *
12  #  of FS Consulting, Inc.                                                                                                        *  #  of FS Consulting, Inc.                                                    *
13  #*****************************************************************************  #*****************************************************************************
14    
15  #print "Content-type: text/plain\n\n";  #print "Content-type: text/plain\n\n";
16    
17    #use Data::Dumper;
18    
19  #--------------------------------------------------------------------------  #--------------------------------------------------------------------------
20  #  #
21  # Author: Francois Schiettecatte (FS Consulting, Inc.)  # Author: Francois Schiettecatte (FS Consulting, Inc.)
# Line 1569  sub sMakeSearchString { Line 1571  sub sMakeSearchString {
1571    
1572          # nuke accented chars          # nuke accented chars
1573          $SearchString =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;          $SearchString =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
1574            # convert search string to lower case -> make search case insensitive
1575            $SearchString =~ tr/A-Z/a-z/;
1576    
1577          # Add the internal search terms          # Add the internal search terms
1578    
# Line 2110  sub bsDisplaySearchResults { Line 2114  sub bsDisplaySearchResults {
2114          my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength);          my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength);
2115          my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction);          my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction);
2116          my ($Value, %Value, @Values, $ValueEntry);          my ($Value, %Value, @Values, $ValueEntry);
2117            
2118            
2119          # Check input parameters          # Check input parameters
2120          if ( !defined($SearchResults) || !%Content ) {          if ( !defined($SearchResults) || !%Content ) {
2121                  return (0);                  return (0);
2122          }          }
2123                    
   
           
2124          # Split the search results text into a search results list          # Split the search results text into a search results list
2125          @SearchResults = split(/\n/, $SearchResults);                            @SearchResults = split(/\n/, $SearchResults);                  
                   
2126                    
2127                    
2128          # First we count up the number of results and scoop up          # First we count up the number of results and scoop up
# Line 2431  sub bsDisplaySearchResults { Line 2432  sub bsDisplaySearchResults {
2432          }          }
2433    
2434    
2435            ### FIX:: ADD SORT HERE
2436          if ( $ResultCount > 0 ) {          if ( $ResultCount > 0 ) {
2437    
2438                  # Loop over each entry in the hits list                  # Loop over each entry in the hits list
# Line 2689  sub bsDisplaySearchResults { Line 2690  sub bsDisplaySearchResults {
2690                          if ( $HTML ) {                          if ( $HTML ) {
2691                                  print("<!-- resultItem -->\n");                                  print("<!-- resultItem -->\n");
2692                                  #print("<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> $SelectorText </TD> <TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> <!-- relevance --> <B> $Score </B> <!-- /relevance --> </TD> <TD ALIGN=LEFT VALIGN=TOP> <A HREF=\"$LinkText\" OnMouseOver=\"self.status='Retrieve this document'; return true\"> $Headline <I> ( $main::DatabaseDescriptions{$Database} ) </I> </A> <BR> <FONT SIZE=-2>");                                  #print("<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> $SelectorText </TD> <TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> <!-- relevance --> <B> $Score </B> <!-- /relevance --> </TD> <TD ALIGN=LEFT VALIGN=TOP> <A HREF=\"$LinkText\" OnMouseOver=\"self.status='Retrieve this document'; return true\"> $Headline <I> ( $main::DatabaseDescriptions{$Database} ) </I> </A> <BR> <FONT SIZE=-2>");
2693                                    # decode some basic html from headline <b> <i>
2694                                    $Headline =~ s/&lt;(\/?[bi])&gt;/<$1>/g;
2695    
2696                                  print("<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> $SelectorText </TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> <A HREF=\"$LinkText\" OnMouseOver=\"self.status='Retrieve this document'; return true\"> $Headline </A> <BR> <FONT SIZE=-2>&nbsp;");                                  print("<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=1%> $SelectorText </TD><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> <A HREF=\"$LinkText\" OnMouseOver=\"self.status='Retrieve this document'; return true\"> $Headline </A> <BR> <FONT SIZE=-2>&nbsp;");
2697                          } else {                          } else {
2698                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);
# Line 3102  sub vGetSearch { Line 3106  sub vGetSearch {
3106          # Database selection          # Database selection
3107          if ( %main::DatabaseDescriptions ) {          if ( %main::DatabaseDescriptions ) {
3108    
3109                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=3> Odaberite bazu koju ¾elite pretra¾ivati: </TD></TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=4>                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> Odaberite bazu koju ¾elite pretra¾ivati:
3110                    </td><td>
3111                    <font size=-1>Oznaèi
3112                            <a href=\"javascript:SetChecked(1)\">sve</a>,
3113                            <a href=\"javascript:SetChecked(0)\">niti jednu</a>.
3114                    </font>
3115                    </TD></TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=4>
3116                  ");                  ");
3117                                    
3118                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
# Line 3117  sub vGetSearch { Line 3127  sub vGetSearch {
3127                                  @ItemList = split(",", $SelectedDatabases);                                  @ItemList = split(",", $SelectedDatabases);
3128                          }                          }
3129                  }                  }
                 foreach $ItemEntry ( @ItemList ) {  
                         $Value{$ItemEntry} = $ItemEntry;  
                 }  
                   
3130    
3131                    &ShowDatabaseCheckBoxes(@ItemList);
                 $Flag = 0;  
   
                 print('  
                         <a href="javascript:SetChecked(1)">all</a>  
                         <a href="javascript:SetChecked(0)">none</a>  
                         ');  
                   
                 print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");  
   
                 my @html_database;  
   
                 foreach my $key ( sort keys %main::DatabaseSort ) {  
                         $DatabaseName = $main::DatabaseSort{$key};  
                         $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1) || !defined($main::RemoteUser) ) ? "CHECKED" : "";  
                         $ItemEntry = &lEncodeURLData($DatabaseName);  
                         if ($main::DatabaseDescriptions{$DatabaseName}) {  
                                 push @html_database,"<TD ALIGN=LEFT VALIGN=TOP><INPUT TYPE=\"checkbox\" NAME=\"Database\" VALUE=\"$DatabaseName\" $Value> <A HREF=\"$ENV{'SCRIPT_NAME'}/GetDatabaseInfo?Database=$ItemEntry\" OnMouseOver=\"self.status='Informacije io bazi $main::DatabaseDescriptions{$DatabaseName} '; return true\"> $main::DatabaseDescriptions{$DatabaseName}  </A> </TD>\n";  
                         } else {  
                                 push @html_database,"<td align=left valign=top>$main::DatabaseDescriptions{$DatabaseName}</td>\n";  
                         }  
                 }  
   
   
                 if ($main::ConfigurationData{'output-colums'}) {  
                         # create database names in columns  
   
                         my $cols = $main::ConfigurationData{'show-nr-colums'};  
                         my $next = int($#html_database/$cols) ;  
   
                         for(my $i=0; $i <= $next ; $i++) {  
                                 print("<tr>");  
                                 for(my $j=0; $j <= $cols; $j++) {  
                                         print($html_database[$i+$next*$j+$j] || '');  
                                 }  
                                 print("</tr>");  
                         }  
   
                 } else {  
                         for(my $i=0; $i <= $#html_database ; $i=$i+1) {  
                                 print("<tr>",$html_database[$i],"</tr>");  
                         }  
                 }  
   
                 print("</TABLE>\n");  
3132    
3133                  print("</TD></TR>\n");                  print("</TD></TR>\n");
3134                                    
# Line 3254  sub vGetSearch { Line 3216  sub vGetSearch {
3216          print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n");          print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n");
3217          $Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : "";          $Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : "";
3218          print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n");          print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n");
3219    ### FIX:: SORT
3220    #       print("<OPTION VALUE=\"SORT:700+:DESC\"> autor\n");
3221    #       print("<OPTION VALUE=\"SORT:200+:DESC\"> naslov\n");
3222          print("</SELECT> </TD></TR>\n");          print("</SELECT> </TD></TR>\n");
3223    
3224    
# Line 4148  sub vGetUserSettings { Line 4113  sub vGetUserSettings {
4113    
4114                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> <B> Odabrane baze: </B> </TD></TR>\n");                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> <B> Odabrane baze: </B> </TD></TR>\n");
4115    
4116                  print("<TR><TD ALIGN=LEFT VALIGN=TOP> Oznaèite baze koje uvijek ¾elite pretra¾ivati: </TD> <TD ALIGN=LEFT VALIGN=TOP>\n");                  print("<TR><TD ALIGN=LEFT VALIGN=TOP> Oznaèite baze koje uvijek ¾elite pretra¾ivati:</TD> <TD ALIGN=LEFT VALIGN=TOP>\n");
4117                                    
4118                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
4119                  # hash table, they should be separated with a '\n'                  # hash table, they should be separated with a '\n'
                 undef(%Value);  
4120                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {
4121                          @ItemList = split(",", $SelectedDatabases);                          @ItemList = split(",", $SelectedDatabases);
                         foreach $ItemEntry ( @ItemList ) {  
                                 $Value{$ItemEntry} = $ItemEntry;  
                         }  
                 }  
                   
                 $Flag = 0;  
                 print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%\n");  
                   
                 foreach $DatabaseName ( sort(keys(%main::DatabaseDescriptions)) ) {  
                           
                         if ( $Flag == 0 ) {  
                                 print("<TR>");  
                         }  
                           
                         $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1)) ? "CHECKED" : "";  
                         $ItemEntry = &lEncodeURLData($DatabaseName);  
                         print("<TD ALIGN=LEFT VALIGN=TOP><INPUT TYPE=\"checkbox\" NAME=\"SelectedDatabases\" VALUE=\"$DatabaseName\" $Value> <A HREF=\"$ENV{'SCRIPT_NAME'}/GetDatabaseInfo?Database=$ItemEntry\" OnMouseOver=\"self.status='Get Information about the $main::DatabaseDescriptions{$DatabaseName} database'; return true\">  $main::DatabaseDescriptions{$DatabaseName} </A></TD>\n");  
                           
                         if ( $Flag == 1 ) {  
                                 print("</TR>");  
                                 $Flag = 0;  
                         }  
                         else {  
                                 $Flag = 1;  
                         }  
4122                  }                  }
4123                  print("</TABLE>\n");          
4124                    &ShowDatabaseCheckBoxes(@ItemList);
4125            
4126                  print("</TD></TR>\n");                  print("</TD></TR>\n");
4127          }          }
4128    
# Line 7488  sub fill_SearchFieldDescriptions_fromDB Line 7429  sub fill_SearchFieldDescriptions_fromDB
7429                  }                  }
7430          }          }
7431  }  }
7432    
7433    #--------------------------------------------------------------------------
7434    # show list of all databases
7435    #
7436    # usage: ShowDatabaseCheckBoxes(@SelectedDatabases)
7437    
7438    sub ShowDatabaseCheckBoxes {
7439            # Parse out the database names and put them into a
7440            # hash table, they should be separated with a '\0'
7441            my %Value;
7442    
7443            foreach my $ItemEntry ( @_ ) {
7444                    $Value{$ItemEntry} = $ItemEntry;
7445            }
7446                    
7447            print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");
7448    
7449            my @html_database;
7450    
7451            foreach my $key ( sort keys %main::DatabaseSort ) {
7452                    my $DatabaseName = $main::DatabaseSort{$key};
7453                    my $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1) || !defined($main::RemoteUser) ) ? "CHECKED" : "";
7454                    my $ItemEntry = &lEncodeURLData($DatabaseName);
7455                    if ($main::DatabaseDescriptions{$DatabaseName}) {
7456                            push @html_database,"<TD ALIGN=LEFT VALIGN=TOP><INPUT TYPE=\"checkbox\" NAME=\"Database\" VALUE=\"$DatabaseName\" $Value> <A HREF=\"$ENV{'SCRIPT_NAME'}/GetDatabaseInfo?Database=$ItemEntry\" OnMouseOver=\"self.status='Informacije io bazi $main::DatabaseDescriptions{$DatabaseName} '; return true\"> $main::DatabaseDescriptions{$DatabaseName}  </A> </TD>\n";
7457                    } else {
7458                            push @html_database,"<td align=left valign=top>$main::DatabaseDescriptions{$DatabaseName}</td>\n";
7459                    }
7460            }
7461    
7462    
7463            if ($main::ConfigurationData{'output-colums'}) {
7464                    # create database names in columns
7465    
7466                    my $cols = $main::ConfigurationData{'show-nr-colums'};
7467                    my $next = int($#html_database/$cols) ;
7468    
7469                    for(my $i=0; $i <= $next ; $i++) {
7470                            print("<tr>");
7471                            for(my $j=0; $j <= $cols; $j++) {
7472                                    print($html_database[$i+$next*$j+$j] || '');
7473                            }
7474                            print("</tr>");
7475                    }
7476    
7477            } else {
7478                    for(my $i=0; $i <= $#html_database ; $i=$i+1) {
7479                            print("<tr>",$html_database[$i],"</tr>");
7480                    }
7481            }
7482    
7483            print("</TABLE>\n");
7484    }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.26