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.) |
2112 |
my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength); |
my (@Words, $Word, @OffsetPairs, $OffsetPair, %Offsets, $Offset, $Start, $End, $OldStart, $OldEnd, $CurrentSummaryLength); |
2113 |
my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction); |
my ($DatabaseSummaryFilterKey, $DatabaseSummaryFilterFunction); |
2114 |
my ($Value, %Value, @Values, $ValueEntry); |
my ($Value, %Value, @Values, $ValueEntry); |
2115 |
|
|
2116 |
|
|
2117 |
# Check input parameters |
# Check input parameters |
2118 |
if ( !defined($SearchResults) || !%Content ) { |
if ( !defined($SearchResults) || !%Content ) { |
2119 |
return (0); |
return (0); |
2120 |
} |
} |
2121 |
|
|
|
|
|
|
|
|
2122 |
# Split the search results text into a search results list |
# Split the search results text into a search results list |
2123 |
@SearchResults = split(/\n/, $SearchResults); |
@SearchResults = split(/\n/, $SearchResults); |
|
|
|
2124 |
|
|
2125 |
|
|
2126 |
# First we count up the number of results and scoop up |
# First we count up the number of results and scoop up |
2430 |
} |
} |
2431 |
|
|
2432 |
|
|
2433 |
|
### FIX:: ADD SORT HERE |
2434 |
if ( $ResultCount > 0 ) { |
if ( $ResultCount > 0 ) { |
2435 |
|
|
2436 |
# Loop over each entry in the hits list |
# Loop over each entry in the hits list |
2688 |
if ( $HTML ) { |
if ( $HTML ) { |
2689 |
print("<!-- resultItem -->\n"); |
print("<!-- resultItem -->\n"); |
2690 |
#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>"); |
2691 |
|
# decode some basic html from headline <b> <i> |
2692 |
|
$Headline =~ s/<(\/?[bi])>/<$1>/g; |
2693 |
|
|
2694 |
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> "); |
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> "); |
2695 |
} else { |
} else { |
2696 |
printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score); |
printf("%3d $Headline ($main::DatabaseDescriptions{$Database})\n", $Score); |
2973 |
|
|
2974 |
# Make sure that we send the header |
# Make sure that we send the header |
2975 |
$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"; |
2976 |
&vSendHTMLHeader($Value, undef); |
my $JavaScript = '<SCRIPT LANGUAGE="JavaScript"> |
2977 |
|
<!-- hide |
2978 |
|
function SetChecked(val) { |
2979 |
|
dml=document.Search; |
2980 |
|
len = dml.elements.length; |
2981 |
|
var i=0; |
2982 |
|
for( i=0 ; i<len ; i++) { |
2983 |
|
if (dml.elements[i].name==\'Database\') { |
2984 |
|
dml.elements[i].checked=val; |
2985 |
|
} |
2986 |
|
} |
2987 |
|
} |
2988 |
|
// --> |
2989 |
|
</SCRIPT> |
2990 |
|
'; |
2991 |
|
|
2992 |
|
&vSendHTMLHeader($Value, $JavaScript); |
2993 |
|
|
2994 |
undef(%Value); |
undef(%Value); |
2995 |
$Value{'GetSearch'} = "GetSearch"; |
$Value{'GetSearch'} = "GetSearch"; |
3040 |
|
|
3041 |
# Send the start of the form and the buttons |
# Send the start of the form and the buttons |
3042 |
print("<TD ALIGN=RIGHT VALIGN=TOP>\n"); |
print("<TD ALIGN=RIGHT VALIGN=TOP>\n"); |
3043 |
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"); |
3044 |
print("</TD></TR>\n"); |
print("</TD></TR>\n"); |
3045 |
|
|
3046 |
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"); |
3104 |
# Database selection |
# Database selection |
3105 |
if ( %main::DatabaseDescriptions ) { |
if ( %main::DatabaseDescriptions ) { |
3106 |
|
|
3107 |
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: |
3108 |
|
</td><td> |
3109 |
|
<font size=-1>Označi |
3110 |
|
<a href=\"javascript:SetChecked(1)\">sve</a>, |
3111 |
|
<a href=\"javascript:SetChecked(0)\">niti jednu</a>. |
3112 |
|
</font> |
3113 |
|
</TD></TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=4> |
3114 |
"); |
"); |
3115 |
|
|
3116 |
# Parse out the database names and put them into a |
# Parse out the database names and put them into a |
3125 |
@ItemList = split(",", $SelectedDatabases); |
@ItemList = split(",", $SelectedDatabases); |
3126 |
} |
} |
3127 |
} |
} |
|
foreach $ItemEntry ( @ItemList ) { |
|
|
$Value{$ItemEntry} = $ItemEntry; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$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>"); |
|
|
} |
|
|
} |
|
3128 |
|
|
3129 |
print("</TABLE>\n"); |
&ShowDatabaseCheckBoxes(@ItemList); |
3130 |
|
|
3131 |
print("</TD></TR>\n"); |
print("</TD></TR>\n"); |
3132 |
|
|
3214 |
print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n"); |
print("<OPTION VALUE=\"SORT:DATE:DESC\" $Value> Datum - najprije novije\n"); |
3215 |
$Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : ""; |
$Value = (defined($main::FormData{'Order'}) && ($main::FormData{'Order'} eq "DATEASCSORT")) ? "SELECTED" : ""; |
3216 |
print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n"); |
print("<OPTION VALUE=\"SORT:DATE:ASC\" $Value> Datum - najprije starije\n"); |
3217 |
|
### FIX:: SORT |
3218 |
|
# print("<OPTION VALUE=\"SORT:700+:DESC\"> autor\n"); |
3219 |
|
# print("<OPTION VALUE=\"SORT:200+:DESC\"> naslov\n"); |
3220 |
print("</SELECT> </TD></TR>\n"); |
print("</SELECT> </TD></TR>\n"); |
3221 |
|
|
3222 |
|
|
4111 |
|
|
4112 |
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"); |
4113 |
|
|
4114 |
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"); |
4115 |
|
|
4116 |
# Parse out the database names and put them into a |
# Parse out the database names and put them into a |
4117 |
# hash table, they should be separated with a '\n' |
# hash table, they should be separated with a '\n' |
|
undef(%Value); |
|
4118 |
if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) { |
if ( defined($SelectedDatabases) && ($SelectedDatabases ne "") ) { |
4119 |
@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; |
|
|
} |
|
4120 |
} |
} |
4121 |
print("</TABLE>\n"); |
|
4122 |
|
&ShowDatabaseCheckBoxes(@ItemList); |
4123 |
|
|
4124 |
print("</TD></TR>\n"); |
print("</TD></TR>\n"); |
4125 |
} |
} |
4126 |
|
|
7427 |
} |
} |
7428 |
} |
} |
7429 |
} |
} |
7430 |
|
|
7431 |
|
#-------------------------------------------------------------------------- |
7432 |
|
# show list of all databases |
7433 |
|
# |
7434 |
|
# usage: ShowDatabaseCheckBoxes(@SelectedDatabases) |
7435 |
|
|
7436 |
|
sub ShowDatabaseCheckBoxes { |
7437 |
|
# Parse out the database names and put them into a |
7438 |
|
# hash table, they should be separated with a '\0' |
7439 |
|
my %Value; |
7440 |
|
|
7441 |
|
foreach my $ItemEntry ( @_ ) { |
7442 |
|
$Value{$ItemEntry} = $ItemEntry; |
7443 |
|
} |
7444 |
|
|
7445 |
|
print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n"); |
7446 |
|
|
7447 |
|
my @html_database; |
7448 |
|
|
7449 |
|
foreach my $key ( sort keys %main::DatabaseSort ) { |
7450 |
|
my $DatabaseName = $main::DatabaseSort{$key}; |
7451 |
|
my $Value = ((defined($Value{$DatabaseName})) || (scalar(keys(%main::DatabaseDescriptions)) == 1) || !defined($main::RemoteUser) ) ? "CHECKED" : ""; |
7452 |
|
my $ItemEntry = &lEncodeURLData($DatabaseName); |
7453 |
|
if ($main::DatabaseDescriptions{$DatabaseName}) { |
7454 |
|
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"; |
7455 |
|
} else { |
7456 |
|
push @html_database,"<td align=left valign=top>$main::DatabaseDescriptions{$DatabaseName}</td>\n"; |
7457 |
|
} |
7458 |
|
} |
7459 |
|
|
7460 |
|
|
7461 |
|
if ($main::ConfigurationData{'output-colums'}) { |
7462 |
|
# create database names in columns |
7463 |
|
|
7464 |
|
my $cols = $main::ConfigurationData{'show-nr-colums'}; |
7465 |
|
my $next = int($#html_database/$cols) ; |
7466 |
|
|
7467 |
|
for(my $i=0; $i <= $next ; $i++) { |
7468 |
|
print("<tr>"); |
7469 |
|
for(my $j=0; $j <= $cols; $j++) { |
7470 |
|
print($html_database[$i+$next*$j+$j] || ''); |
7471 |
|
} |
7472 |
|
print("</tr>"); |
7473 |
|
} |
7474 |
|
|
7475 |
|
} else { |
7476 |
|
for(my $i=0; $i <= $#html_database ; $i=$i+1) { |
7477 |
|
print("<tr>",$html_database[$i],"</tr>"); |
7478 |
|
} |
7479 |
|
} |
7480 |
|
|
7481 |
|
print("</TABLE>\n"); |
7482 |
|
} |