/[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.7 by dpavlin, Mon Jun 24 16:39:10 2002 UTC revision 1.13 by dpavlin, Tue Jun 25 15:02:32 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 230  $main::QueryReportItemName = "document"; Line 232  $main::QueryReportItemName = "document";
232  $main::QueryReportMimeType = "application/x-wais-report";  $main::QueryReportMimeType = "application/x-wais-report";
233    
234    
   
 # Hash of icon/images names that we use  
 %main::ImageNames = (  
         'banner',                                       'banner.gif',  
         'collapse',                                     'collapse.gif',  
         'expand',                                       'expand.gif',  
         'inactive-search',                      'inactive-search.gif',  
         'active-search',                        'active-search.gif',  
         'inactive-search-history',      'inactive-search-history.gif',  
         'active-search-history',        'active-search-history.gif',  
         'inactive-saved-searches',      'inactive-saved-searches.gif',  
         'active-saved-searches',        'active-saved-searches.gif',  
         'inactive-document-folders','inactive-document-folders.gif',  
         'active-document-folders',      'active-document-folders.gif',  
         'inactive-settings',            'inactive-settings.gif',  
         'active-settings',                      'active-settings.gif',  
 );  
   
   
235  # Array of mime type names, we use this to map  # Array of mime type names, we use this to map
236  # mime types to mime type names (which are more readable)  # mime types to mime type names (which are more readable)
237  %main::MimeTypeNames = (  %main::MimeTypeNames = (
# Line 409  sub vSendHTMLHeader { Line 392  sub vSendHTMLHeader {
392                  print("$JavaScript\n");                  print("$JavaScript\n");
393          }          }
394          print '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';          print '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';
395            print '<link rel="STYLESHEET" type="text/css" href="stil.css">';
396          print("</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\">\n");          print("</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\">\n");
397    
398    
# Line 519  sub vSendMenuBar { Line 503  sub vSendMenuBar {
503                  }                  }
504          }          }
505    
506          if ( %MenuBar && defined($MenuBar{'GetSearch'}) ) {          my $DISABLED;
                 print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-search'}\" ALT=\"Search\" BORDER=0>");  
   
   
         }  
         else {  
   
                 print("<INPUT NAME=\"GetSearch\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-search'}\" ALT=\"Search\" BORDER=0>");  
   
507    
508            $DISABLED = ( %MenuBar && defined($MenuBar{'GetSearch'}) ) ? "DISABLED" : "";
509          }          print("<INPUT NAME=\"GetSearch\" TYPE=SUBMIT VALUE=\"Forma za pretra¾ivanje\" $DISABLED class=\"navigacija\">");
510    
511          if ( defined($main::RemoteUser) ) {          if ( defined($main::RemoteUser) ) {
512                  if ( %MenuBar && defined($MenuBar{'ListSearchHistory'}) ) {                  $DISABLED = ( %MenuBar && defined($MenuBar{'ListSearchHistory'}) ) ? "DISABLED" : "";
513                          print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-search-history'}\" ALT=\"Search History\" BORDER=0>");                  print"<INPUT NAME=\"ListSearchHistory\" TYPE=SUBMIT VALUE=\"Search History\" $DISABLED class=\"navigacija\">";
                 }  
                 else {  
                         print("<INPUT NAME=\"ListSearchHistory\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-search-history'}\" ALT=\"Search History\" BORDER=0>");  
                 }  
514    
515                  if ( %MenuBar && defined($MenuBar{'ListSavedSearch'}) ) {                  $DISABLED = ( %MenuBar && defined($MenuBar{'ListSavedSearch'}) ) ? "DISABLED" : "";
516                          print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-saved-searches'}\" ALT=\"Saved Searches\" BORDER=0>");                  print"<INPUT NAME=\"ListSavedSearch\" TYPE=SUBMIT VALUE=\"List Saved Search\" $DISABLED class=\"navigacija\">";
                 }  
                 else {  
                         print("<INPUT NAME=\"ListSavedSearch\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-saved-searches'}\" ALT=\"Saved Searches\" BORDER=0>");  
                 }  
517    
518                  if ( %MenuBar && defined($MenuBar{'ListFolder'}) ) {                  $DISABLED = ( %MenuBar && defined($MenuBar{'ListFolder'}) ) ? "DISABLED" : "";
519                          print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-document-folders'}\" ALT=\"Doument Folders\" BORDER=0>");                  print"<INPUT NAME=\"ListFolder\" TYPE=SUBMIT VALUE=\"List Folder\" $DISABLED class=\"navigacija\">";
520                  }          
521                  else {                  $DISABLED = ( %MenuBar && defined($MenuBar{'GetUserSettings'}) ) ? "DISABLED" : "";
522                          print("<INPUT NAME=\"ListFolder\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-document-folders'}\" ALT=\"Document Folders\" BORDER=0>");                  print"<INPUT NAME=\"GetUserSettings\" TYPE=SUBMIT VALUE=\"Get User Settings\" $DISABLED class=\"navigacija\">";
                 }  
                   
                 if ( %MenuBar && defined($MenuBar{'GetUserSettings'}) ) {  
                         print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-settings'}\" ALT=\"My Preferences\" BORDER=0>");  
                 }  
                 else {  
                         print("<INPUT NAME=\"GetUserSettings\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-settings'}\" ALT=\"My Settings\" BORDER=0>");  
                 }  
523          }          }
524    
525    
# Line 1569  sub sMakeSearchString { Line 1529  sub sMakeSearchString {
1529    
1530          # nuke accented chars          # nuke accented chars
1531          $SearchString =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;          $SearchString =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;
1532            # convert search string to lower case -> make search case insensitive
1533            $SearchString =~ tr/A-Z/a-z/;
1534    
1535          # Add the internal search terms          # Add the internal search terms
1536    
# Line 2110  sub bsDisplaySearchResults { Line 2072  sub bsDisplaySearchResults {
2072          my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength);          my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength);
2073          my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction);          my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction);
2074          my ($Value, %Value, @Values, $ValueEntry);          my ($Value, %Value, @Values, $ValueEntry);
2075            
2076            
2077          # Check input parameters          # Check input parameters
2078          if ( !defined($SearchResults) || !%Content ) {          if ( !defined($SearchResults) || !%Content ) {
2079                  return (0);                  return (0);
2080          }          }
2081                    
   
           
2082          # Split the search results text into a search results list          # Split the search results text into a search results list
2083          @SearchResults = split(/\n/, $SearchResults);                            @SearchResults = split(/\n/, $SearchResults);                  
                   
2084                    
2085                    
2086          # 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 2390  sub bsDisplaySearchResults {
2390          }          }
2391    
2392    
2393            ### FIX:: ADD SORT HERE
2394          if ( $ResultCount > 0 ) {          if ( $ResultCount > 0 ) {
2395    
2396                  # Loop over each entry in the hits list                  # Loop over each entry in the hits list
# Line 2689  sub bsDisplaySearchResults { Line 2648  sub bsDisplaySearchResults {
2648                          if ( $HTML ) {                          if ( $HTML ) {
2649                                  print("<!-- resultItem -->\n");                                  print("<!-- resultItem -->\n");
2650                                  #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>");
2651                                    # decode some basic html from headline <b> <i>
2652                                    $Headline =~ s/&lt;(\/?[bi])&gt;/<$1>/g;
2653    
2654                                  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;");
2655                          } else {                          } else {
2656                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);
# Line 3212  sub vGetSearch { Line 3174  sub vGetSearch {
3174          print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n");          print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n");
3175          $Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : "";          $Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : "";
3176          print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n");          print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n");
3177    ### FIX:: SORT
3178    #       print("<OPTION VALUE=\"SORT:700+:DESC\"> autor\n");
3179    #       print("<OPTION VALUE=\"SORT:200+:DESC\"> naslov\n");
3180          print("</SELECT> </TD></TR>\n");          print("</SELECT> </TD></TR>\n");
3181    
3182    
# Line 7153  sub vLog { Line 7118  sub vLog {
7118                  }                  }
7119                                    
7120    
7121                  if ( defined($main::FormData{'GetSearch.x'}) ) {                  if ( defined($main::FormData{'GetSearch'}) ) {
7122                          $ENV{'PATH_INFO'} = "/GetSearch";                          $ENV{'PATH_INFO'} = "/GetSearch";
7123                          delete($main::FormData{'GetSearch.x'});                          delete($main::FormData{'GetSearch'});
7124                          delete($main::FormData{'GetSearch.y'});                          delete($main::FormData{'GetSearch'});
7125                  }                  }
7126                                    
7127                  if ( defined($main::FormData{'ListSearchHistory.x'}) ) {                  if ( defined($main::FormData{'ListSearchHistory'}) ) {
7128                          $ENV{'PATH_INFO'} = "/ListSearchHistory";                          $ENV{'PATH_INFO'} = "/ListSearchHistory";
7129                          delete($main::FormData{'ListSearchHistory.x'});                          delete($main::FormData{'ListSearchHistory'});
7130                          delete($main::FormData{'ListSearchHistory.y'});                          delete($main::FormData{'ListSearchHistory'});
7131                  }                  }
7132                                    
7133                  if ( defined($main::FormData{'ListSavedSearch.x'}) ) {                  if ( defined($main::FormData{'ListSavedSearch'}) ) {
7134                          $ENV{'PATH_INFO'} = "/ListSavedSearch";                          $ENV{'PATH_INFO'} = "/ListSavedSearch";
7135                          delete($main::FormData{'ListSavedSearch.x'});                          delete($main::FormData{'ListSavedSearch'});
7136                          delete($main::FormData{'ListSavedSearch.y'});                          delete($main::FormData{'ListSavedSearch'});
7137                  }                  }
7138                                    
7139                  if ( defined($main::FormData{'ListFolder.x'}) ) {                  if ( defined($main::FormData{'ListFolder'}) ) {
7140                          $ENV{'PATH_INFO'} = "/ListFolder";                          $ENV{'PATH_INFO'} = "/ListFolder";
7141                          delete($main::FormData{'ListFolder.x'});                          delete($main::FormData{'ListFolder'});
7142                          delete($main::FormData{'ListFolder.y'});                          delete($main::FormData{'ListFolder'});
7143                  }                  }
7144                                    
7145                  if ( defined($main::FormData{'GetUserSettings.x'}) ) {                  if ( defined($main::FormData{'GetUserSettings'}) ) {
7146                          $ENV{'PATH_INFO'} = "/GetUserSettings";                          $ENV{'PATH_INFO'} = "/GetUserSettings";
7147                          delete($main::FormData{'GetUserSettings.x'});                          delete($main::FormData{'GetUserSettings'});
7148                          delete($main::FormData{'GetUserSettings.y'});                          delete($main::FormData{'GetUserSettings'});
7149                  }                  }
7150                                    
7151    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.26