#!/usr/bin/perl # This is a CGI script to do a blazon pattern search of the oanda database. # It is to be installed at /web/herald/htdocs/heraldry/OandA/oanda_bp.cgi on atensubmissions.nexiliscom.com. # Set URL for this script. $cgi_url = '/cgi-bin/heraldry/OandA/oanda_bp.cgi'; # Set title for form. $form_title = 'Blazon Pattern Search Form'; require '/web/herald/cgi-bin/heraldry/OandA/common.pl'; # option settings @cases = ('case-sensitive', 'case-insensitive'); $case = 'case-insensitive'; @sorts = ('name only', 'last action date', 'blazon'); $sort = 'name only'; # default # Process arguments. foreach $pair (split (/\&/, $ENV{'QUERY_STRING'})) { ($left, $right) = split (/[=]/, $pair, 2); $left = &decode ($left); $right = &decode ($right); $arm_descs = $right if ($left eq 'a'); $case = $right if ($left eq 'c'); $era = $right if ($left eq 'd'); $gloss_links = $right if ($left eq 'g'); $limit = $right if ($left eq 'l'); $p = $right if ($left eq 'p'); $sort = $right if ($left eq 's'); } $limit = 25 if ($limit !~ /^\d+$/); &print_header (); if ($p ne '') { &connect_to_data_server (); print S 'l ', $limit; if ($case eq 'case-insensitive') { $i = 'i'; } else { $i = ''; } print S "eb$i 1 $p"; print S 'EOF'; $n = &get_matches (); if ($sort eq 'name only') { $scoresort = 0; @matches = sort byname @matches; } elsif ($sort eq 'last action date') { $scoresort = 0; @matches = sort bylastdate @matches; } elsif ($sort eq 'blazon') { $scoresort = 0; @matches = sort byblazon @matches; } } print '

There are other search forms available.'; print 'For help using this form, please refer to the hints page.'; print '

Enter the blazon pattern for which you are searching ->'; print ''; print '

Select type of search ->'; &select ('c', $case, @cases); print '

Maximum number of items to display ->'; print ''; &display_options (); print '

Actions:

'; print ''; print ''; if ($p ne '') { print '
'; &print_results ($case.' blazon pattern="'.&escape($p).'"', $n, $scoresort); print 'convert to complex search' } &print_trailer (); # end of /web/herald/htdocs/heraldry/OandA/oanda_bp.cgi