/[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.22 by dpavlin, Tue Jul 2 17:18:43 2002 UTC revision 1.27 by dpavlin, Thu Oct 24 18:42:18 2002 UTC
# Line 1509  sub sMakeSearchString { Line 1509  sub sMakeSearchString {
1509          # Initialize the search string          # Initialize the search string
1510          $SearchString = "";          $SearchString = "";
1511    
1512  sub nuke_accents {          # tip gradje
1513          my $tmp = $_[0];          if ( defined($main::FormData{'tip'}) ) {
1514          $tmp =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´­½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'-".'',"'Rr/;                  my @t;
1515          # convert search string to lower case -> make search case insensitive                  foreach my $tip ( split(/\0/, $main::FormData{'tip'}) ) {
1516          $tmp =~ tr/A-Z/a-z/;                          push @t,"tip=$tip";
1517          return $tmp;                  }
1518  }                  $SearchString .= "(".join(" or ",@t).") and ";
1519            }
1520    
1521          # Add the search terms          # Add the search terms
1522          $SearchString .= defined($Content{'Any'}) ? ((($SearchString ne "") ? " AND " : "") . nuke_accents($Content{'Any'}) ) : "";          $SearchString .= defined($Content{'Any'}) ? ((($SearchString ne "") ? " AND " : "") . nuke_accents($Content{'Any'}) ) : "";
# Line 2998  sub vGetSearch { Line 2998  sub vGetSearch {
2998    
2999          # Send the start of the form and the buttons          # Send the start of the form and the buttons
3000          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");          print("<TD ALIGN=RIGHT VALIGN=TOP>\n");
3001          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");          print("<FORM ACTION=\"$ENV{'SCRIPT_NAME'}/GetSearchResults\" NAME=\"Search\" METHOD=POST> <INPUT TYPE=SUBMIT VALUE=\"Pretra¾i bazu\"> <INPUT TYPE=RESET VALUE=\"Vrati poèetne vrijednosti\">\n");
3002          print("</TD></TR>\n");          print("</TD></TR>\n");
3003    
3004          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 3035  sub vGetSearch { Line 3035  sub vGetSearch {
3035                          } elsif ($i == ($field - 1)) {                          } elsif ($i == ($field - 1)) {
3036                                  $Selected = "SELECTED";                                  $Selected = "SELECTED";
3037                          }                          }
                                   
3038                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");                          print("<OPTION VALUE=\"$ItemEntry\" $Selected> $main::SearchFieldDescriptions{$ItemEntry}\n");
3039                  }                  }
3040                  my $Value = "";                  my $Value = "";
# Line 3056  sub vGetSearch { Line 3055  sub vGetSearch {
3055          print("<OPTION VALUE=\"OR\" $Value> Bilo koju rijeè (OR)\n");          print("<OPTION VALUE=\"OR\" $Value> Bilo koju rijeè (OR)\n");
3056          print("</SELECT> </TD></TR>\n");          print("</SELECT> </TD></TR>\n");
3057    
3058            print "<tr><td align=left valign=top> Prika¾i samo tip graðe: </td><td align=left valign=top colspan=2>";
3059            while (@default::tip_html) {
3060                    print '<input TYPE="checkbox" NAME="tip" VALUE="',nuke_accents(shift @default::tip_html),'" >',shift @default::tip_html,"&nbsp&nbsp;";
3061            }
3062            print "</td></tr>\n";
3063    
3064          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><HR WIDTH=50%></TD></TR>\n");          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><HR WIDTH=50%></TD></TR>\n");
3065                    
# Line 3176  sub vGetSearch { Line 3180  sub vGetSearch {
3180    
3181    
3182          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><HR WIDTH=50%></TD></TR>\n");          print("<TR><TD ALIGN=CENTER VALIGN=TOP COLSPAN=3><HR WIDTH=50%></TD></TR>\n");
3183          print("<TR><TD ALIGN=RIGHT COLSPAN=3><INPUT TYPE=SUBMIT VALUE=\"Pretra¾i bazu\"> <INPUT TYPE=RESET VALUE=\"Pobri¹i polja\"></TD></TR>\n");          print("<TR><TD ALIGN=RIGHT COLSPAN=3><INPUT TYPE=SUBMIT VALUE=\"Pretra¾i bazu\"> <INPUT TYPE=RESET VALUE=\"Vrati poèetne vrijednosti\"></TD></TR>\n");
3184    
3185          print("</FORM>\n");          print("</FORM>\n");
3186          print("</TABLE>\n");          print("</TABLE>\n");
# Line 3223  sub vGetSearchResults { Line 3227  sub vGetSearchResults {
3227          my ($DatabaseRelevanceFeedbackFilterKey, $DatabaseRelevanceFeedbackFilterFunction);          my ($DatabaseRelevanceFeedbackFilterKey, $DatabaseRelevanceFeedbackFilterFunction);
3228          my (@Values, %Value, $Value);          my (@Values, %Value, $Value);
3229    
   
           
3230          # Check to see if there are any documents selected, if there are, they need          # Check to see if there are any documents selected, if there are, they need
3231          # to be converted to RF documents before we put up the header, this is because          # to be converted to RF documents before we put up the header, this is because
3232          # the header creates a search link from existing search fields, we also deduplicate          # the header creates a search link from existing search fields, we also deduplicate
# Line 3279  sub vGetSearchResults { Line 3281  sub vGetSearchResults {
3281                  $main::FormData{'Database'} = join("\0", keys(%Databases));                  $main::FormData{'Database'} = join("\0", keys(%Databases));
3282          }          }
3283    
3284            # now add all databases that had to be included always
3285            foreach (my $db = @main::always_selected_databases) {
3286                    $Databases{$db} = $Value{$db};
3287            }
3288    
3289          # Make sure that we send the header          # Make sure that we send the header
3290          &vSendHTMLHeader("Rezultati pretra¾ivanja", undef);          &vSendHTMLHeader("Rezultati pretra¾ivanja", undef);
3291          undef(%Value);          undef(%Value);
3292          &vSendMenuBar(%Value);          &vSendMenuBar(%Value);
3293    
   
3294          # Check that at least one database was selected          # Check that at least one database was selected
3295          if ( !defined($main::FormData{'Database'}) ) {          if ( !defined($main::FormData{'Database'}) && $#main::always_selected_databases < 0 ) {
3296                  print("<H3>Pretra¾ivanje baza:</H3>\n");                  print("<H3>Pretra¾ivanje baza:</H3>\n");
3297                  print("<H3><CENTER>Niste odabrali knji¾nicu koju ¾elite pretra¾ivati.</CENTER></H3>\n");                  print("<H3><CENTER>Niste odabrali knji¾nicu koju ¾elite pretra¾ivati.</CENTER></H3>\n");
3298                  print("<P>\n");                  print("<P>\n");
# Line 3322  sub vGetSearchResults { Line 3326  sub vGetSearchResults {
3326    
3327          # Convert all the '\0' to ','          # Convert all the '\0' to ','
3328          $Databases =~ tr/\0/,/;          $Databases =~ tr/\0/,/;
3329            
3330            # add always selected databases
3331            if (@main::always_selected_databases) {
3332                    $Databases .= ",".join(",",@main::always_selected_databases);
3333            }
3334    
3335          # Add the max doc restriction          # Add the max doc restriction
3336          if ( !defined($main::FormData{'Max'}) ) {          if ( !defined($main::FormData{'Max'}) ) {
3337                  $main::FormData{'Max'} = $main::DefaultMaxDoc;                  $main::FormData{'Max'} = $main::DefaultMaxDoc;
3338          }          }
3339    
           
3340          # Generate the search string          # Generate the search string
3341          $SearchString = &sMakeSearchString(%main::FormData);          $SearchString = &sMakeSearchString(%main::FormData);
3342    
# Line 6884  sub vRunSavedSearches { Line 6891  sub vRunSavedSearches {
6891                          # Print out the message header (Content-Type)                          # Print out the message header (Content-Type)
6892                          if ( $DeliveryMethod eq "attachement" ) {                          if ( $DeliveryMethod eq "attachement" ) {
6893                                  print("Mime-Version: 1.0\n");                                  print("Mime-Version: 1.0\n");
                                 print("Content-Type: multipart/mixed; boundary=\"============_-1234567890==_============\"\n");  
6894                          }                          }
6895                          else {                          else {
6896                                  print("Mime-Version: 1.0\n");                                  print("Mime-Version: 1.0\n");
# Line 7380  sub fill_SearchFieldDescriptions_fromDB Line 7386  sub fill_SearchFieldDescriptions_fromDB
7386                          my ($FieldName, $FieldDescription, undef) = split(/\t/, $FieldInformation, 3);                          my ($FieldName, $FieldDescription, undef) = split(/\t/, $FieldInformation, 3);
7387                          $main::SearchFieldDescriptions{$FieldName} = $FieldDescription;                          $main::SearchFieldDescriptions{$FieldName} = $FieldDescription;
7388                  }                  }
7389            } else {
7390                    &vLog("Error - cant read database description from '$Database'\n");
7391          }          }
7392  }  }
7393    
# Line 7396  sub ShowDatabaseCheckBoxes { Line 7404  sub ShowDatabaseCheckBoxes {
7404          foreach my $ItemEntry ( @_ ) {          foreach my $ItemEntry ( @_ ) {
7405                  $Value{$ItemEntry} = $ItemEntry;                  $Value{$ItemEntry} = $ItemEntry;
7406          }          }
7407                    
7408          print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");          print("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n");
7409          print "<tr><td colspan=3 align=\"center\">          print "<tr><td colspan=3 align=\"center\">
7410                  <font size=-1>Oznaèi                  <font size=-1>Oznaèi
# Line 7440  sub ShowDatabaseCheckBoxes { Line 7448  sub ShowDatabaseCheckBoxes {
7448          }          }
7449    
7450          print("</TABLE>\n");          print("</TABLE>\n");
7451    
7452  }  }
7453    
7454    #--------------------------------------------------------------------------
7455    #
7456    sub nuke_accents {
7457            my $tmp = $_[0];
7458            $tmp =~ tr/Çüéâäùæç³ëÕõî¬ÄÆÉÅåôö¥µ¦¶ÖÜ«»£èáíóú¡±®¾Êê¼ÈºÁÂ̪¯¿ÃãðÐÏËïÒÍÎìÞÙÓÔÑñò©¹ÀÚàÛýÝþ´½²·¢¸¨ÿØø/CueaauccleOoiZACELlooLlSsOUTtLcaiouAaZzEezCsAAESZzAadDDEdNIIeTUOoNnnSsRUrUyYt'".'',"'Rr/;
7459            # convert search string to lower case -> make search case insensitive
7460            $tmp =~ tr/A-Z/a-z/;
7461            return $tmp;
7462    }
7463    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.26