#!/usr/bin/perl # This is a CGI script to do a date/kingdom search of the oanda database. # It is to be installed at /web/herald/htdocs/heraldry/OandA/oanda_date.cgi on atensubmissions.nexiliscom.com. # Set URL for this script. $cgi_url = '/cgi-bin/heraldry/OandA/oanda_date.cgi'; # Set title for form. $form_title = 'Date/Kingdom Search Form'; require '/web/herald/cgi-bin/heraldry/OandA/common.pl'; # option settings $this_year = 1900 + (localtime time)[$[+5]; $last_year = $this_year - 1; $month1 = 'January'; # default $year1 = $last_year; # default $month2 = 'December'; # default $year2 = $last_year; # default %kingdom_set = (); # default @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'); $era = $right if ($left eq 'd'); $gloss_links = $right if ($left eq 'g'); $kingdom_set{$1} = $right if ($left =~ /^k([A-Z])$/); $limit = $right if ($left eq 'l'); $month1 = $right if ($left eq 'm1'); $month2 = $right if ($left eq 'm2'); $sort = $right if ($left eq 's'); $year1 = $right if ($left eq 'y1'); $year2 = $right if ($left eq 'y2'); $p = 1; } $limit = 200 if ($limit !~ /^\d+$/); &print_header (); if ($p ne '') { &connect_to_data_server (); $year1 += 1900 if ($year1 > 66 && $year1 < 100); $year1 = 1970 if ($year1 < 1970); $year1 = $this_year if ($year1 > $this_year); $year2 += 1900 if ($year2 > 66 && $year2 < 100); $year2 = 1970 if ($year2 < 1970); $year2 = $this_year if ($year2 > $this_year); $kstring = ''; while (($k, $v) = each %kingdom_set) { $kstring .= $k if ($v ne ''); } print S "l $limit"; print S 's 1 ', $year1, $mmap{$month1}, ' ', $year2, $mmap{$month2}, ' ', $kstring; print S 'EOF'; $n = &get_matches (); if ($sort eq 'name only') { $scoresort = 0; @matches = sort byname @matches; } elsif ($sort eq 'blazon') { $scoresort = 0; @matches = sort byblazon @matches; } elsif ($sort eq 'last action date') { $scoresort = 0; @matches = sort bylastdate @matches; } } print '

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

Starting date ->'; &select ('m1', $month1, @month_name); print ''; print '

Ending date ->'; &select ('m2', $month2, @month_name); print ''; foreach (sort keys %kingdom_name) { print '
', $kingdom_name{$_}; } print '

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

Actions:

'; print ''; print ''; if ($p ne '') { print '
'; &print_results ("date between $month1/$year1 and $month2/$year2 inclusive, from one of the specified kingdoms", $n, $scoresort); } &print_trailer (); # end of /web/herald/htdocs/heraldry/OandA/oanda_date.cgi