--- search/Search.cgi 2002/06/16 18:11:16 1.3 +++ search/Search.cgi 2002/06/25 15:25:14 1.14 @@ -1,17 +1,21 @@ #!/usr/bin/perl -w #***************************************************************************** -# Copyright (C) 1993-2000, FS Consulting Inc. All rights reserved * -# * -# * -# This notice is intended as a precaution against inadvertent publication * -# and does not constitute an admission or acknowledgement that publication * -# has occurred or constitute a waiver of confidentiality. * -# * -# This software is the proprietary and confidential property * -# of FS Consulting, Inc. * +# Copyright (C) 1993-2000, FS Consulting Inc. All rights reserved * +# * +# * +# This notice is intended as a precaution against inadvertent publication * +# and does not constitute an admission or acknowledgement that publication * +# has occurred or constitute a waiver of confidentiality. * +# * +# This software is the proprietary and confidential property * +# of FS Consulting, Inc. * #***************************************************************************** +#print "Content-type: text/plain\n\n"; + +#use Data::Dumper; + #-------------------------------------------------------------------------- # # Author: Francois Schiettecatte (FS Consulting, Inc.) @@ -179,25 +183,8 @@ # -# 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', -); - # read configuration fields -require "config.pl"; +require "config.pm"; # List of required configuration settings @main::RequiredSettings = ( @@ -245,25 +232,6 @@ $main::QueryReportMimeType = "application/x-wais-report"; - -# 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', -); - - # Array of mime type names, we use this to map # mime types to mime type names (which are more readable) %main::MimeTypeNames = ( @@ -408,7 +376,7 @@ if ( ! $ENV{'GATEWAY_INTERFACE'} ) { return; } - + # Bail if we have already sent the header if ( $main::HeaderSent ) { return; @@ -424,6 +392,7 @@ print("$JavaScript\n"); } print ''; + print ''; print("\n\n"); @@ -433,8 +402,11 @@ # Send the banner print("\n"); - print("\n"); - print("
\"Return
\n"); +# print(" \"Return \n"); + + print("

Katalozi knji¾nica Filozofskog fakulteta

\n"); + + print("\n"); # Set the flag saying that the header has been sent @@ -531,43 +503,23 @@ } } - if ( %MenuBar && defined($MenuBar{'GetSearch'}) ) { - print("\"Search\""); - } - else { - print(""); + my $DISABLED; - - } + $DISABLED = ( %MenuBar && defined($MenuBar{'GetSearch'}) ) ? "DISABLED" : ""; + print(""); if ( defined($main::RemoteUser) ) { - if ( %MenuBar && defined($MenuBar{'ListSearchHistory'}) ) { - print("\"Search"); - } - else { - print(""); - } + $DISABLED = ( %MenuBar && defined($MenuBar{'ListSearchHistory'}) ) ? "DISABLED" : ""; + print""; - if ( %MenuBar && defined($MenuBar{'ListSavedSearch'}) ) { - print("\"Saved"); - } - else { - print(""); - } + $DISABLED = ( %MenuBar && defined($MenuBar{'ListSavedSearch'}) ) ? "DISABLED" : ""; + print""; - if ( %MenuBar && defined($MenuBar{'ListFolder'}) ) { - print("\"Doument"); - } - else { - print(""); - } - - if ( %MenuBar && defined($MenuBar{'GetUserSettings'}) ) { - print("\"My"); - } - else { - print(""); - } + $DISABLED = ( %MenuBar && defined($MenuBar{'ListFolder'}) ) ? "DISABLED" : ""; + print""; + + $DISABLED = ( %MenuBar && defined($MenuBar{'GetUserSettings'}) ) ? "DISABLED" : ""; + print""; } @@ -1577,6 +1529,8 @@ # nuke accented chars $SearchString =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/; + # convert search string to lower case -> make search case insensitive + $SearchString =~ tr/A-Z/a-z/; # Add the internal search terms @@ -2118,18 +2072,15 @@ my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength); my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction); my ($Value, %Value, @Values, $ValueEntry); - - + + # Check input parameters if ( !defined($SearchResults) || !%Content ) { return (0); } - - # Split the search results text into a search results list @SearchResults = split(/\n/, $SearchResults); - # First we count up the number of results and scoop up @@ -2439,7 +2390,7 @@ } - +### FIX:: ADD SORT HERE if ( $ResultCount > 0 ) { # Loop over each entry in the hits list @@ -2696,12 +2647,16 @@ # Put up the headline and the score, this one links to the document if ( $HTML ) { print("\n"); - print(" $SelectorText $Score $Headline ( $main::DatabaseDescriptions{$Database} )
"); - } - else { + #print(" $SelectorText $Score $Headline ( $main::DatabaseDescriptions{$Database} )
"); + # decode some basic html from headline + $Headline =~ s/<(\/?[bi])>/<$1>/g; + + print(" $SelectorText $Headline
 "); + } else { printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score); } +if (0) { ## don't display description # Put up the summary if ( defined($SummaryText) && ($SummaryText ne "") ) { @@ -2718,6 +2673,7 @@ if ( ! defined($Remainder) ) { if ( $HTML ) { print("Formatttt: $MimeTypeName, "); + } else { print(" Format: $MimeTypeName, "); @@ -2726,11 +2682,11 @@ # Put up the date if we got it - if ( defined($Date) && ($Date ne "") ) { + if ( defined($Date) && ($Date ne "") ) { print("Date: $Date"); # Put up the time if we got it - if ( defined($Time) && ($Time ne "") ) { + if ( defined($Time) && ($Time ne "") ) { print(" $Time"); } @@ -2861,6 +2817,7 @@ } print("\n"); +} #if # Finish off the entry if ( $HTML ) { print("\n"); @@ -2976,7 +2933,23 @@ # Make sure that we send the header $Value = ($ENV{'PATH_INFO'} eq "/GetExpandedSearch") ? "Pretra¾ivanje s vi¹e kriterija" : "Jednostavno pretra¾ivanje"; - &vSendHTMLHeader($Value, undef); + my $JavaScript = ' + '; + + &vSendHTMLHeader($Value, $JavaScript); undef(%Value); $Value{'GetSearch'} = "GetSearch"; @@ -3027,7 +3000,7 @@ # Send the start of the form and the buttons print("\n"); - print("
\n"); + print(" \n"); print("\n"); print("
\n"); @@ -3056,10 +3029,19 @@ print (" \n"); } @@ -3082,7 +3064,14 @@ # Database selection if ( %main::DatabaseDescriptions ) { - print(" Odaberite bazu koju ¾elite pretra¾ivati: \n"); + print(" Odaberite bazu koju ¾elite pretra¾ivati: + + Oznaèi + sve, + niti jednu. + + + "); # Parse out the database names and put them into a # hash table, they should be separated with a '\0' @@ -3096,50 +3085,8 @@ @ItemList = split(",", $SelectedDatabases); } } - foreach $ItemEntry ( @ItemList ) { - $Value{$ItemEntry} = $ItemEntry; - } - - - $Flag = 0; - print("\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,"\n"; - } else { - push @html_database,"\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(""); - for(my $j=0; $j <= $cols; $j++) { - print($html_database[$i+$next*$j+$j]); - } - print(""); - } - - } else { - for(my $i=0; $i <= $#html_database ; $i=$i+1) { - print("",$html_database[$i],""); - } - } - - print("
$main::DatabaseDescriptions{$DatabaseName} $main::DatabaseDescriptions{$DatabaseName}
\n"); + &ShowDatabaseCheckBoxes(@ItemList); print("\n"); @@ -3227,6 +3174,9 @@ print("