#!/usr/bin/perl # This is a CGI script to do a name pattern search of the oanda database. # It is to be installed at /web/herald/htdocs/heraldry/OandA/oanda_np.cgi on atensubmissions.nexiliscom.com. # Set URL for this script. $cgi_url = '/cgi-bin/heraldry/OandA/oanda_np.cgi'; # Set title for form. $form_title = 'Name Pattern Search Form'; require '/web/herald/cgi-bin/heraldry/OandA/common.pl'; # option settings @breadths = ('narrow', 'broad'); $breadth = 'narrow'; @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'); $breadth = $right if ($left eq 'b'); $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 ($breadth eq 'broad') { $b = 'n'; } else { $b = '1'; } if ($case eq 'case-insensitive') { $i = 'i'; } else { $i = ''; } print S "e$b$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 name pattern for which you are searching ->'; print ''; print '

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

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

Actions:

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