/[local]/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.1 by dpavlin, Thu Jun 13 17:01:56 2002 UTC revision 1.8 by dpavlin, Mon Jun 24 16:49:54 2002 UTC
# Line 12  Line 12 
12  #  of FS Consulting, Inc.                                                                                                        *  #  of FS Consulting, Inc.                                                                                                        *
13  #*****************************************************************************  #*****************************************************************************
14    
15    #print "Content-type: text/plain\n\n";
16    
17  #--------------------------------------------------------------------------  #--------------------------------------------------------------------------
18  #  #
19  # Author: Francois Schiettecatte (FS Consulting, Inc.)  # Author: Francois Schiettecatte (FS Consulting, Inc.)
# Line 179  $main::MPSSession = 0; Line 181  $main::MPSSession = 0;
181  #  #
182    
183    
184  # List of default configuration settings  # read configuration fields
185  %main::DefaultSettings = (  require "config.pm";
         'lowest-year',  '1990',  
         'max-score',    '1000',  
         'allow-summary-displays','no',  
         'allow-similiar-search','no',  
         'allow-regular-searches','no',  
         'deliver-empty-results-from-regular-search','no',  
 #       'allow-relevance-feedback-searches','no',  
         'mailer-application','/usr/lib/sendmail',  
         'server-log','mps.log',  
         'output-colums','yes',  
 #       'show-past-date-list','yes',  
         'database-for-SearchFieldDescriptions','ps',  
 );  
   
 # DbP: Define which fields you have in normal and advanced search  
 # first define all available fields and then how many fields of that  
 # are visible.  
 @main::NormalSearchFieldNames = (  
         '700+',  
         '200+',  
         '610',  
         '210',  
         '10',  
   
 );  
 $main::NormalSearchDropdowns = 3 ;  
   
 @main::AdvancedSearchFieldNames = (  
         '700+',  
         '200+',  
         '610',  
         '210',  
         '225',  
         '300+',  
         '330',  
         '464',  
         '675',  
         '686',  
         '990',  
         '991',  
         '10',  
         '001',  
 );  
 $main::AdvancedSearchDropdowns = 4 ;  
   
186    
187  # List of required configuration settings  # List of required configuration settings
188  @main::RequiredSettings = (  @main::RequiredSettings = (
# Line 436  sub vSendHTMLHeader { Line 393  sub vSendHTMLHeader {
393          if ( ! $ENV{'GATEWAY_INTERFACE'} ) {          if ( ! $ENV{'GATEWAY_INTERFACE'} ) {
394                  return;                  return;
395          }          }
396            
397          # Bail if we have already sent the header          # Bail if we have already sent the header
398          if ( $main::HeaderSent ) {          if ( $main::HeaderSent ) {
399                  return;                  return;
# Line 461  sub vSendHTMLHeader { Line 418  sub vSendHTMLHeader {
418    
419          # Send the banner          # Send the banner
420          print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\n");          print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\n");
421          print("<TR><TD VALIGN=TOP ALIGN=RIGHT> <A HREF=\"/\" OnMouseOver=\"self.status='Return Home'; return true\"><IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'banner'}\" ALT=\"Return Home\" BORDER=0></A> </TD></TR>\n");  #       print("<TR><TD VALIGN=TOP ALIGN=RIGHT> <A HREF=\"/\" OnMouseOver=\"self.status='Return Home'; return true\"><IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'banner'}\" ALT=\"Return Home\" BORDER=0></A> </TD></TR>\n");
422          print("</TABLE>\n");  
423            print("<TR><TD VALIGN=TOP ALIGN=RIGHT> <A HREF=\"/\" OnMouseOver=\"self.status='Return Home'; return true\"><H3>Katalozi knjižnica Filozofskog fakulteta</H3> </A> </TD></TR>\n");
424    
425            print("</TABLE>\n");
426                                    
427    
428          # Set the flag saying that the header has been sent          # Set the flag saying that the header has been sent
# Line 561  sub vSendMenuBar { Line 521  sub vSendMenuBar {
521    
522          if ( %MenuBar && defined($MenuBar{'GetSearch'}) ) {          if ( %MenuBar && defined($MenuBar{'GetSearch'}) ) {
523                  print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-search'}\" ALT=\"Search\" BORDER=0>");                  print("<IMG SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'inactive-search'}\" ALT=\"Search\" BORDER=0>");
524    
525    
526          }          }
527          else {          else {
528    
529                  print("<INPUT NAME=\"GetSearch\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-search'}\" ALT=\"Search\" BORDER=0>");                  print("<INPUT NAME=\"GetSearch\" TYPE=IMAGE SRC=\"$main::ConfigurationData{'image-base-path'}/$main::ImageNames{'active-search'}\" ALT=\"Search\" BORDER=0>");
530    
531            
532    
533          }          }
534    
535          if ( defined($main::RemoteUser) ) {          if ( defined($main::RemoteUser) ) {
# Line 2724  sub bsDisplaySearchResults { Line 2688  sub bsDisplaySearchResults {
2688                          # Put up the headline and the score, this one links to the document                          # Put up the headline and the score, this one links to the document
2689                          if ( $HTML ) {                          if ( $HTML ) {
2690                                  print("<!-- resultItem -->\n");                                  print("<!-- resultItem -->\n");
2691                                  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>");
2692                          }                                  # decode some basic html from headline <b> <i>
2693                          else {                                  $Headline =~ s/&lt;(\/?[bi])&gt;/<$1>/g;
2694    
2695                                    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;");
2696                            } else {
2697                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);
2698                          }                          }
2699    
2700    if (0) { ## don't display description
2701    
2702                          # Put up the summary                          # Put up the summary
2703                          if ( defined($SummaryText) && ($SummaryText ne "") ) {                          if ( defined($SummaryText) && ($SummaryText ne "") ) {
# Line 2746  sub bsDisplaySearchResults { Line 2714  sub bsDisplaySearchResults {
2714                          if ( ! defined($Remainder) ) {                          if ( ! defined($Remainder) ) {
2715                                  if ( $HTML ) {                                  if ( $HTML ) {
2716                                          print("Formatttt: $MimeTypeName, ");                                          print("Formatttt: $MimeTypeName, ");
2717                            
2718                                  }                                  }
2719                                  else {                                  else {
2720                                          print("    Format: $MimeTypeName, ");                                          print("    Format: $MimeTypeName, ");
# Line 2754  sub bsDisplaySearchResults { Line 2723  sub bsDisplaySearchResults {
2723    
2724    
2725                          # Put up the date if we got it                          # Put up the date if we got it
2726                          if ( defined($Date) && ($Date ne "") ) {                           if ( defined($Date) && ($Date ne "") ) {
2727                                  print("Date: $Date");                                  print("Date: $Date");
2728                                                                    
2729                                  # Put up the time if we got it                                  # Put up the time if we got it
2730                                  if ( defined($Time) && ($Time ne "") ) {                                   if ( defined($Time) && ($Time ne "") ) {
2731                                          print(" $Time");                                          print(" $Time");
2732                                  }                                  }
2733                                                                    
# Line 2889  sub bsDisplaySearchResults { Line 2858  sub bsDisplaySearchResults {
2858                                  }                                  }
2859                                  print("\n");                                  print("\n");
2860    
2861    } #if
2862                                  # Finish off the entry                                  # Finish off the entry
2863                                  if ( $HTML ) {                                  if ( $HTML ) {
2864                                          print("</FONT></TD></TR>\n");                                          print("</FONT></TD></TR>\n");
# Line 3004  sub vGetSearch { Line 2974  sub vGetSearch {
2974    
2975          # Make sure that we send the header          # Make sure that we send the header
2976          $Value = ($ENV{'PATH_INFO'} eq "/GetExpandedSearch") ? "Pretraživanje s više kriterija" : "Jednostavno pretraživanje";          $Value = ($ENV{'PATH_INFO'} eq "/GetExpandedSearch") ? "Pretraživanje s više kriterija" : "Jednostavno pretraživanje";
2977          &vSendHTMLHeader($Value, undef);          my $JavaScript = '<SCRIPT LANGUAGE="JavaScript">
2978                    <!-- hide
2979                    function SetChecked(val) {
2980                            dml=document.Search;
2981                            len = dml.elements.length;
2982                            var i=0;
2983                            for( i=0 ; i<len ; i++) {
2984                                    if (dml.elements[i].name==\'Database\') {
2985                                            dml.elements[i].checked=val;
2986                                    }
2987                            }
2988                    }
2989                    // -->
2990                    </SCRIPT>
2991                    ';
2992    
2993            &vSendHTMLHeader($Value, $JavaScript);
2994    
2995          undef(%Value);          undef(%Value);
2996          $Value{'GetSearch'} = "GetSearch";          $Value{'GetSearch'} = "GetSearch";
# Line 3055  sub vGetSearch { Line 3041  sub vGetSearch {
3041    
3042          # Send the start of the form and the buttons          # Send the start of the form and the buttons
3043          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");
3044          print("<FORM ACTION=\"$ENV{'SCRIPT_NAME'}/GetSearchResults\" METHOD=POST> <INPUT TYPE=SUBMIT VALUE=\"Pretraži bazu\"> <INPUT TYPE=RESET VALUE=\"Pobriši polja\">\n");          print("<FORM ACTION=\"$ENV{'SCRIPT_NAME'}/GetSearchResults\" NAME=\"Search\" METHOD=POST> <INPUT TYPE=SUBMIT VALUE=\"Pretraži bazu\"> <INPUT TYPE=RESET VALUE=\"Pobriši polja\">\n");
3045          print("</TD></TR>\n");          print("</TD></TR>\n");
3046    
3047          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><BR></TD></TR>\n");          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><BR></TD></TR>\n");
# Line 3084  sub vGetSearch { Line 3070  sub vGetSearch {
3070                  print ("<SELECT NAME=\"FieldName${field}\">");                  print ("<SELECT NAME=\"FieldName${field}\">");
3071                  for (my $i=0; $i<=$#SearchFieldNames; $i++) {                  for (my $i=0; $i<=$#SearchFieldNames; $i++) {
3072                          my $ItemEntry = $SearchFieldNames[$i];                          my $ItemEntry = $SearchFieldNames[$i];
3073                          my $Selected = ($main::FormData{"FieldName${field}"} == $ItemEntry || $i == ($field-1)) ? "SELECTED" : "";                          my $Selected = "";
3074                            if ($main::FormData{"FieldName${field}"} && $main::FormData{"FieldName${field}"} eq $ItemEntry) {
3075                                    $Selected = "SELECTED";
3076                            } elsif ($i == ($field - 1)) {
3077                                    $Selected = "SELECTED";
3078                            }
3079                                    
3080                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");
3081                  }                  }
3082                  my $Value = defined($main::FormData{"FieldContent${field}"}) ? "VALUE='".$main::FormData{"FieldContent${field}"}."'" : "";                  my $Value = "";
3083                    if (defined($main::FormData{"FieldContent${field}"})) {
3084                            $Value = "VALUE='".$main::FormData{"FieldContent${field}"}."'";
3085                    }
3086                  print("</SELECT></TD><TD ALIGN=LEFT><INPUT NAME=\"FieldContent${field}\" TYPE=TEXT $Value SIZE=45> </TD></TR>\n");                  print("</SELECT></TD><TD ALIGN=LEFT><INPUT NAME=\"FieldContent${field}\" TYPE=TEXT $Value SIZE=45> </TD></TR>\n");
3087          }          }
3088    
# Line 3110  sub vGetSearch { Line 3105  sub vGetSearch {
3105          # Database selection          # Database selection
3106          if ( %main::DatabaseDescriptions ) {          if ( %main::DatabaseDescriptions ) {
3107    
3108                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> Odaberite bazu koju želite pretraživati: </TD> <TD ALIGN=LEFT VALIGN=TOP>\n");                  print("<TR><TD ALIGN=LEFT VALIGN=TOP COLSPAN=2> Odaberite bazu koju želite pretraživati:
3109                    </td><td>
3110                    <font size=-1>Označi
3111                            <a href=\"javascript:SetChecked(1)\">sve</a>,
3112                            <a href=\"javascript:SetChecked(0)\">niti jednu</a>.
3113                    </font>
3114                    </TD></TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=4>
3115                    ");
3116                                    
3117                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
3118                  # hash table, they should be separated with a '\0'                  # hash table, they should be separated with a '\0'
# Line 3124  sub vGetSearch { Line 3126  sub vGetSearch {
3126                                  @ItemList = split(",", $SelectedDatabases);                                  @ItemList = split(",", $SelectedDatabases);
3127                          }                          }
3128                  }                  }
                 foreach $ItemEntry ( @ItemList ) {  
                         $Value{$ItemEntry} = $ItemEntry;  
                 }  
                   
   
   
                 $Flag = 0;  
                 print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\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";  
                         }  
                 }  
3129    
3130                    &ShowDatabaseCheckBoxes(@ItemList);
                 if ($main::ConfigurationData{'output-colums'}) {  
                         # create database names in columns  
   
                         my $max = $#html_database+1 ;  
   
                         my $j=0;  
                         for(my $i=0; $i < $max ; $i=$i+2) {  
                                 print("<tr>",$html_database[$j],$html_database[$j+int($max/2)],"</tr>");  
                                 $j++;  
                         }  
   
                 } else {  
                         for(my $i=0; $i <= $#html_database ; $i=$i+1) {  
                                 print("<tr>",$html_database[$i],"</tr>");  
                         }  
                 }  
   
                 print("</TABLE>\n");  
3131    
3132                  print("</TD></TR>\n");                  print("</TD></TR>\n");
3133                                    
# Line 4146  sub vGetUserSettings { Line 4109  sub vGetUserSettings {
4109    
4110                  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");
4111    
4112                  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");
4113                                    
4114                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
4115                  # hash table, they should be separated with a '\n'                  # hash table, they should be separated with a '\n'
                 undef(%Value);  
4116                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {
4117                          @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;  
                         }  
4118                  }                  }
4119                  print("</TABLE>\n");          
4120                    &ShowDatabaseCheckBoxes(@ItemList);
4121            
4122                  print("</TD></TR>\n");                  print("</TD></TR>\n");
4123          }          }
4124    
# Line 7486  sub fill_SearchFieldDescriptions_fromDB Line 7425  sub fill_SearchFieldDescriptions_fromDB
7425                  }                  }
7426          }          }
7427  }  }
7428    
7429    #--------------------------------------------------------------------------
7430    # show list of all databases
7431    #
7432    # usage: ShowDatabaseCheckBoxes(@SelectedDatabases)
7433    
7434    sub ShowDatabaseCheckBoxes {
7435            # Parse out the database names and put them into a
7436            # hash table, they should be separated with a '\0'
7437            my %Value;
7438    
7439            foreach my $ItemEntry ( @_ ) {
7440                    $Value{$ItemEntry} = $ItemEntry;
7441            }
7442                    
7443            print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");
7444    
7445            my @html_database;
7446    
7447            foreach my $key ( sort keys %main::DatabaseSort ) {
7448                    my $DatabaseName = $main::DatabaseSort{$key};
7449                    my $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1) || !defined($main::RemoteUser) ) ? "CHECKED" : "";
7450                    my $ItemEntry = &lEncodeURLData($DatabaseName);
7451                    if ($main::DatabaseDescriptions{$DatabaseName}) {
7452                            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";
7453                    } else {
7454                            push @html_database,"<td align=left valign=top>$main::DatabaseDescriptions{$DatabaseName}</td>\n";
7455                    }
7456            }
7457    
7458    
7459            if ($main::ConfigurationData{'output-colums'}) {
7460                    # create database names in columns
7461    
7462                    my $cols = $main::ConfigurationData{'show-nr-colums'};
7463                    my $next = int($#html_database/$cols) ;
7464    
7465                    for(my $i=0; $i <= $next ; $i++) {
7466                            print("<tr>");
7467                            for(my $j=0; $j <= $cols; $j++) {
7468                                    print($html_database[$i+$next*$j+$j] || '');
7469                            }
7470                            print("</tr>");
7471                    }
7472    
7473            } else {
7474                    for(my $i=0; $i <= $#html_database ; $i=$i+1) {
7475                            print("<tr>",$html_database[$i],"</tr>");
7476                    }
7477            }
7478    
7479            print("</TABLE>\n");
7480    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.26