/[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.3 by dpavlin, Sun Jun 16 18:11:16 2002 UTC revision 1.7 by dpavlin, Mon Jun 24 16:39:10 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    
 # List of default configuration settings  
 %main::DefaultSettings = (  
         '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-nr-colums',3,  
 #       'show-past-date-list','yes',  
         'database-for-SearchFieldDescriptions','ps',  
 );  
   
184  # read configuration fields  # read configuration fields
185  require "config.pl";  require "config.pm";
186    
187  # List of required configuration settings  # List of required configuration settings
188  @main::RequiredSettings = (  @main::RequiredSettings = (
# Line 408  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 433  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 533  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 2696  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                          }                                  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;");
2693                          else {                          } else {
2694                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);                                  printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score);
2695                          }                          }
2696    
2697    if (0) { ## don't display description
2698    
2699                          # Put up the summary                          # Put up the summary
2700                          if ( defined($SummaryText) && ($SummaryText ne "") ) {                          if ( defined($SummaryText) && ($SummaryText ne "") ) {
# Line 2718  sub bsDisplaySearchResults { Line 2711  sub bsDisplaySearchResults {
2711                          if ( ! defined($Remainder) ) {                          if ( ! defined($Remainder) ) {
2712                                  if ( $HTML ) {                                  if ( $HTML ) {
2713                                          print("Formatttt: $MimeTypeName, ");                                          print("Formatttt: $MimeTypeName, ");
2714                            
2715                                  }                                  }
2716                                  else {                                  else {
2717                                          print("    Format: $MimeTypeName, ");                                          print("    Format: $MimeTypeName, ");
# Line 2726  sub bsDisplaySearchResults { Line 2720  sub bsDisplaySearchResults {
2720    
2721    
2722                          # Put up the date if we got it                          # Put up the date if we got it
2723                          if ( defined($Date) && ($Date ne "") ) {                           if ( defined($Date) && ($Date ne "") ) {
2724                                  print("Date: $Date");                                  print("Date: $Date");
2725                                                                    
2726                                  # Put up the time if we got it                                  # Put up the time if we got it
2727                                  if ( defined($Time) && ($Time ne "") ) {                                   if ( defined($Time) && ($Time ne "") ) {
2728                                          print(" $Time");                                          print(" $Time");
2729                                  }                                  }
2730                                                                    
# Line 2861  sub bsDisplaySearchResults { Line 2855  sub bsDisplaySearchResults {
2855                                  }                                  }
2856                                  print("\n");                                  print("\n");
2857    
2858    } #if
2859                                  # Finish off the entry                                  # Finish off the entry
2860                                  if ( $HTML ) {                                  if ( $HTML ) {
2861                                          print("</FONT></TD></TR>\n");                                          print("</FONT></TD></TR>\n");
# Line 2976  sub vGetSearch { Line 2971  sub vGetSearch {
2971    
2972          # Make sure that we send the header          # Make sure that we send the header
2973          $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";
2974          &vSendHTMLHeader($Value, undef);          my $JavaScript = '<SCRIPT LANGUAGE="JavaScript">
2975                    <!-- hide
2976                    function SetChecked(val) {
2977                            dml=document.Search;
2978                            len = dml.elements.length;
2979                            var i=0;
2980                            for( i=0 ; i<len ; i++) {
2981                                    if (dml.elements[i].name==\'Database\') {
2982                                            dml.elements[i].checked=val;
2983                                    }
2984                            }
2985                    }
2986                    // -->
2987                    </SCRIPT>
2988                    ';
2989    
2990            &vSendHTMLHeader($Value, $JavaScript);
2991    
2992          undef(%Value);          undef(%Value);
2993          $Value{'GetSearch'} = "GetSearch";          $Value{'GetSearch'} = "GetSearch";
# Line 3027  sub vGetSearch { Line 3038  sub vGetSearch {
3038    
3039          # Send the start of the form and the buttons          # Send the start of the form and the buttons
3040          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");
3041          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");
3042          print("</TD></TR>\n");          print("</TD></TR>\n");
3043    
3044          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 3056  sub vGetSearch { Line 3067  sub vGetSearch {
3067                  print ("<SELECT NAME=\"FieldName${field}\">");                  print ("<SELECT NAME=\"FieldName${field}\">");
3068                  for (my $i=0; $i<=$#SearchFieldNames; $i++) {                  for (my $i=0; $i<=$#SearchFieldNames; $i++) {
3069                          my $ItemEntry = $SearchFieldNames[$i];                          my $ItemEntry = $SearchFieldNames[$i];
3070                          my $Selected = ($main::FormData{"FieldName${field}"} == $ItemEntry || $i == ($field-1)) ? "SELECTED" : "";                          my $Selected = "";
3071                            if ($main::FormData{"FieldName${field}"} && $main::FormData{"FieldName${field}"} eq $ItemEntry) {
3072                                    $Selected = "SELECTED";
3073                            } elsif ($i == ($field - 1)) {
3074                                    $Selected = "SELECTED";
3075                            }
3076                                    
3077                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");
3078                  }                  }
3079                  my $Value = defined($main::FormData{"FieldContent${field}"}) ? "VALUE='".$main::FormData{"FieldContent${field}"}."'" : "";                  my $Value = "";
3080                    if (defined($main::FormData{"FieldContent${field}"})) {
3081                            $Value = "VALUE='".$main::FormData{"FieldContent${field}"}."'";
3082                    }
3083                  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");
3084          }          }
3085    
# Line 3082  sub vGetSearch { Line 3102  sub vGetSearch {
3102          # Database selection          # Database selection
3103          if ( %main::DatabaseDescriptions ) {          if ( %main::DatabaseDescriptions ) {
3104    
3105                  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:
3106                    </td><td>
3107                    <font size=-1>Označi
3108                            <a href=\"javascript:SetChecked(1)\">sve</a>,
3109                            <a href=\"javascript:SetChecked(0)\">niti jednu</a>.
3110                    </font>
3111                    </TD></TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=4>
3112                    ");
3113                                    
3114                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
3115                  # hash table, they should be separated with a '\0'                  # hash table, they should be separated with a '\0'
# Line 3096  sub vGetSearch { Line 3123  sub vGetSearch {
3123                                  @ItemList = split(",", $SelectedDatabases);                                  @ItemList = split(",", $SelectedDatabases);
3124                          }                          }
3125                  }                  }
                 foreach $ItemEntry ( @ItemList ) {  
                         $Value{$ItemEntry} = $ItemEntry;  
                 }  
                   
3126    
3127                    &ShowDatabaseCheckBoxes(@ItemList);
                 $Flag = 0;  
                 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");  
3128    
3129                  print("</TD></TR>\n");                  print("</TD></TR>\n");
3130                                    
# Line 4121  sub vGetUserSettings { Line 4106  sub vGetUserSettings {
4106    
4107                  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");
4108    
4109                  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");
4110                                    
4111                  # Parse out the database names and put them into a                  # Parse out the database names and put them into a
4112                  # hash table, they should be separated with a '\n'                  # hash table, they should be separated with a '\n'
                 undef(%Value);  
4113                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {                  if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) {
4114                          @ItemList = split(",", $SelectedDatabases);                          @ItemList = split(",", $SelectedDatabases);
                         foreach $ItemEntry ( @ItemList ) {  
                                 $Value{$ItemEntry} = $ItemEntry;  
                         }  
4115                  }                  }
4116                            
4117                  $Flag = 0;                  &ShowDatabaseCheckBoxes(@ItemList);
4118                  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;  
                         }  
                 }  
                 print("</TABLE>\n");  
4119                  print("</TD></TR>\n");                  print("</TD></TR>\n");
4120          }          }
4121    
# Line 7458  sub fill_SearchFieldDescriptions_fromDB Line 7419  sub fill_SearchFieldDescriptions_fromDB
7419                  foreach my $FieldInformation ( split(/\n/, $Text) ) {                  foreach my $FieldInformation ( split(/\n/, $Text) ) {
7420                          my ($FieldName, $FieldDescription, undef) = split(/\t/, $FieldInformation, 3);                          my ($FieldName, $FieldDescription, undef) = split(/\t/, $FieldInformation, 3);
7421                          $main::SearchFieldDescriptions{$FieldName} = $FieldDescription;                          $main::SearchFieldDescriptions{$FieldName} = $FieldDescription;
                         print "-- $FieldName --<br>\n";  
7422                  }                  }
7423          }          }
7424  }  }
7425    
7426    #--------------------------------------------------------------------------
7427    # show list of all databases
7428    #
7429    # usage: ShowDatabaseCheckBoxes(@SelectedDatabases)
7430    
7431    sub ShowDatabaseCheckBoxes {
7432            # Parse out the database names and put them into a
7433            # hash table, they should be separated with a '\0'
7434            my %Value;
7435    
7436            foreach my $ItemEntry ( @_ ) {
7437                    $Value{$ItemEntry} = $ItemEntry;
7438            }
7439                    
7440            print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");
7441    
7442            my @html_database;
7443    
7444            foreach my $key ( sort keys %main::DatabaseSort ) {
7445                    my $DatabaseName = $main::DatabaseSort{$key};
7446                    my $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1) || !defined($main::RemoteUser) ) ? "CHECKED" : "";
7447                    my $ItemEntry = &lEncodeURLData($DatabaseName);
7448                    if ($main::DatabaseDescriptions{$DatabaseName}) {
7449                            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";
7450                    } else {
7451                            push @html_database,"<td align=left valign=top>$main::DatabaseDescriptions{$DatabaseName}</td>\n";
7452                    }
7453            }
7454    
7455    
7456            if ($main::ConfigurationData{'output-colums'}) {
7457                    # create database names in columns
7458    
7459                    my $cols = $main::ConfigurationData{'show-nr-colums'};
7460                    my $next = int($#html_database/$cols) ;
7461    
7462                    for(my $i=0; $i <= $next ; $i++) {
7463                            print("<tr>");
7464                            for(my $j=0; $j <= $cols; $j++) {
7465                                    print($html_database[$i+$next*$j+$j] || '');
7466                            }
7467                            print("</tr>");
7468                    }
7469    
7470            } else {
7471                    for(my $i=0; $i <= $#html_database ; $i=$i+1) {
7472                            print("<tr>",$html_database[$i],"</tr>");
7473                    }
7474            }
7475    
7476            print("</TABLE>\n");
7477    }

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

  ViewVC Help
Powered by ViewVC 1.1.26