From de78e21b1817db1ce95008aff35dce56a456d172 Mon Sep 17 00:00:00 2001 From: Andrew DeFaria Date: Mon, 31 Jul 2017 17:09:11 -0700 Subject: [PATCH] Added Alt-n and Alt-p accesskeys --- maps/bin/MAPSWeb.pm | 222 ++++++++++++++++++++++---------------------- maps/bin/detail.cgi | 10 +- maps/bin/list.cgi | 10 +- maps/php/list.php | 6 +- 4 files changed, 126 insertions(+), 122 deletions(-) diff --git a/maps/bin/MAPSWeb.pm b/maps/bin/MAPSWeb.pm index dc3d881..f167aae 100644 --- a/maps/bin/MAPSWeb.pm +++ b/maps/bin/MAPSWeb.pm @@ -1,7 +1,7 @@ ################################################################################# # # File: $RCSfile: MAPSWeb.pm,v $ -# Revision: $Revision: 1.1 $ +# Revision: $Revision: 1.1 $ # Description: Routines for generating portions of MAPSWeb # Author: Andrew@DeFaria.com # Created: Fri Nov 29 14:17:21 2002 @@ -43,7 +43,7 @@ sub getquickstats { my %dates = GetStats (1, $date); - foreach (@MAPSLog::Types) { + for (@MAPSLog::Types) { $dates{$date}{processed} += $dates{$date}{$_}; } # foreach @@ -58,32 +58,32 @@ sub displayquickstats { my %dates = getquickstats $date; print start_div {-class => 'quickstats'}; - print h4 {-class => 'header', - -align => 'center'}, + print h4 {-class => 'header', + -align => 'center'}, 'Today\'s Activity'; - print p {-align => 'center'}, + print p {-align => 'center'}, b ('as of ' . FormatTime ($time)); print start_table { - -align => 'center', - -border => 0, - -cellspacing => 0, - -cellpadding => 2}; + -align => 'center', + -border => 0, + -cellspacing => 0, + -cellpadding => 2}; print start_Tr {-align => 'right'}; print - td {-class => 'smalllabel', - -align => 'right'}, + td {-class => 'smalllabel', + -align => 'right'}, 'Processed'; print - td {-class => 'smallnumber', - -align => 'right'}, + td {-class => 'smallnumber', + -align => 'right'}, $dates{$date}{'processed'}; print - td {-class => 'smallnumber', - -align => 'right'}, + td {-class => 'smallnumber', + -align => 'right'}, 'n/a'; print end_Tr; - foreach (@MAPSLog::Types) { + for (@MAPSLog::Types) { print start_Tr {-align => 'right'}; my $value = $dates{$date}{$_}; @@ -92,17 +92,17 @@ sub displayquickstats { $percent = 'n/a'; } else { $percent = $dates{$date}{processed} == 0 ? - 0 : $dates{$date}{$_} / $dates{$date}{processed} * 100; + 0 : $dates{$date}{$_} / $dates{$date}{processed} * 100; $percent = sprintf '%5.1f%s', $percent, '%'; } # if my $stat = $value == 0 ? 0 : a {-href => "detail.cgi?type=$_;date=$date"}, $value; print - td {-class => 'smalllabel'}, ucfirst ($_); + td {-class => 'smalllabel'}, ucfirst ($_); print - td {-class => 'smallnumber'}, $stat; + td {-class => 'smallnumber'}, $stat; print - td {-class => 'smallnumber'}, $percent; + td {-class => 'smallnumber'}, $percent; print end_Tr; } # foreach print end_table; @@ -151,13 +151,13 @@ sub DisplayError ($) { # This subroutine puts out the header for web pages. It is called by # various cgi scripts thus has a few parameters. sub Heading ($$$$;$$@) { - my ($action, # One of getcookie, setcookie, unsetcookie - $userid, # User id (if setting a cookie) - $title, # Title string - $h1, # H1 header - $h2, # H2 header (optional) - $table_name, # Name of table in page, if any - @scripts) = @_; # Array of JavaScript scripts to include + my ($action, # One of getcookie, setcookie, unsetcookie + $userid, # User id (if setting a cookie) + $title, # Title string + $h1, # H1 header + $h2, # H2 header (optional) + $table_name, # Name of table in page, if any + @scripts) = @_; # Array of JavaScript scripts to include my @java_scripts; my $cookie; @@ -165,19 +165,19 @@ sub Heading ($$$$;$$@) { # Since CheckAddress appears on all pages (well except for the login # page) include it by default along with MAPSUtils.js push @java_scripts, [ - {-language => 'JavaScript1.2', - -src => '/maps/JavaScript/MAPSUtils.js'}, - {-language => 'JavaScript1.2', - -src => '/maps/JavaScript/CheckAddress.js'} + {-language => 'JavaScript1.2', + -src => '/maps/JavaScript/MAPSUtils.js'}, + {-language => 'JavaScript1.2', + -src => '/maps/JavaScript/CheckAddress.js'} ]; # Add on any additional JavaScripts that the caller wants. Note the # odd single element array of hashes but that's what CGI requires! # Build up scripts from array - foreach (@scripts) { + for (@scripts) { push @{$java_scripts[0]}, - {-language => 'JavaScript1.2', - -src => "/maps/JavaScript/$_"} + {-language => 'JavaScript1.2', + -src => "/maps/JavaScript/$_"} } # foreach # Since Heading is called from various scripts we sometimes need to @@ -188,61 +188,61 @@ sub Heading ($$$$;$$@) { $userid = cookie ('MAPSUser'); } elsif ($action eq 'setcookie') { $cookie = cookie ( - -name => 'MAPSUser', - -value => $userid, - -expires => '+1y', - -path => '/maps' + -name => 'MAPSUser', + -value => $userid, + -expires => '+1y', + -path => '/maps' ); } elsif ($action eq 'unsetcookie') { $cookie = cookie ( - -name => 'MAPSUser', - -value => '', - -expires => '-1d', - -path => '/maps' + -name => 'MAPSUser', + -value => '', + -expires => '-1d', + -path => '/maps' ); } # if print - header (-title => "MAPS: $title", - -cookie => $cookie); + header (-title => "MAPS: $title", + -cookie => $cookie); if (defined $table_name) { print - start_html (-title => "MAPS: $title", - -author => 'Andrew\@DeFaria.com', - -style => {-src => '/maps/css/MAPSStyle.css'}, - -onResize => "AdjustTableWidth (\"$table_name\");", - -head => [ - Link ({-rel => 'icon', - -href => '/maps/MAPS.png', - -type => 'image/png'}), - Link ({-rel => 'shortcut icon', - -href => '/maps/favicon.ico'}) + start_html (-title => "MAPS: $title", + -author => 'Andrew\@DeFaria.com', + -style => {-src => '/maps/css/MAPSStyle.css'}, + -onResize => "AdjustTableWidth (\"$table_name\");", + -head => [ + Link ({-rel => 'icon', + -href => '/maps/MAPS.png', + -type => 'image/png'}), + Link ({-rel => 'shortcut icon', + -href => '/maps/favicon.ico'}) ], - -script => @java_scripts); + -script => @java_scripts); } else { print - start_html (-title => "MAPS: $title", - -author => 'Andrew\@DeFaria.com', - -style => {-src => '/maps/css/MAPSStyle.css'}, - -head => [ - Link ({-rel => 'icon', - -href => '/maps/MAPS.png', - -type => 'image/png'}), - Link ({-rel => 'shortcut icon', - -href => '/maps/favicon.ico'})], - -script => @java_scripts); + start_html (-title => "MAPS: $title", + -author => 'Andrew\@DeFaria.com', + -style => {-src => '/maps/css/MAPSStyle.css'}, + -head => [ + Link ({-rel => 'icon', + -href => '/maps/MAPS.png', + -type => 'image/png'}), + Link ({-rel => 'shortcut icon', + -href => '/maps/favicon.ico'})], + -script => @java_scripts); } # if print start_div {class => 'heading'}; - print h2 {-align => 'center', - -class => 'header'}, - font ({-class => 'standout'}, 'MAPS'), + print h2 {-align => 'center', + -class => 'header'}, + font ({-class => 'standout'}, 'MAPS'), $h1; if (defined $h2 && $h2 ne '') { - print h3 {-align => 'center', - -class => 'header'}, + print h3 {-align => 'center', + -class => 'header'}, $h2; } # if print end_div; @@ -259,75 +259,75 @@ sub NavigationBar { print start_div {-id => 'leftbar'}; if (!defined $userid) { - print div ({-class => 'username'}, 'Welcome to MAPS'); - print div ({-class => 'menu'}, - (a {-href => '/maps/doc/'}, + print div ({-class => 'username'}, 'Welcome to MAPS'); + print div ({-class => 'menu'}, + (a {-href => '/maps/doc/'}, 'What is MAPS?
'), - (a {-href => '/maps/doc/SPAM.html'}, + (a {-href => '/maps/doc/SPAM.html'}, 'What is SPAM?
'), - (a {-href => '/maps/doc/Requirements.html'}, + (a {-href => '/maps/doc/Requirements.html'}, 'Requirements
'), - (a {-href => '/maps/SignupForm.html'}, + (a {-href => '/maps/SignupForm.html'}, 'Signup
'), - (a {-href => '/maps/doc/Using.html'}, + (a {-href => '/maps/doc/Using.html'}, 'Using MAPS
'), - (a {-href => '/maps/doc/'}, + (a {-href => '/maps/doc/'}, 'Help
'), ); } else { - print div ({-class => 'username'}, 'Welcome '. ucfirst $userid); - print div ({-class => 'menu'}, - (a {-href => '/maps/'}, + print div ({-class => 'username'}, 'Welcome '. ucfirst $userid); + print div ({-class => 'menu'}, + (a {-href => '/maps/'}, 'MAPS Home
'), - (a {-href => '/maps/bin/stats.cgi'}, + (a {-href => '/maps/bin/stats.cgi'}, 'Statistics
'), - (a {-href => '/maps/bin/editprofile.cgi'}, + (a {-href => '/maps/bin/editprofile.cgi'}, 'Edit Profile
'), - (a {-href => '/maps/php/Reports.php'}, + (a {-href => '/maps/php/Reports.php'}, 'Reports
'), - (a {-href => '/maps/php/list.php?type=white'}, + (a {-href => '/maps/php/list.php?type=white'}, 'White List
'), - (a {-href => '/maps/php/list.php?type=black'}, + (a {-href => '/maps/php/list.php?type=black'}, 'Black List
'), - (a {-href => '/maps/php/list.php?type=null'}, + (a {-href => '/maps/php/list.php?type=null'}, 'Null List
'), - (a {-href => '/maps/doc/'}, + (a {-href => '/maps/doc/'}, 'Help
'), - (a {-href => '/maps/adm/'}, + (a {-href => '/maps/adm/'}, 'MAPS Admin
'), - (a {-href => '/maps/?logout=yes'}, + (a {-href => '/maps/?logout=yes'}, 'Logout'), ); print start_div {-class => 'search'}; - print start_form {-method => 'get', - -action => '/maps/bin/search.cgi', - -name => 'search'}; + print start_form {-method => 'get', + -action => '/maps/bin/search.cgi', + -name => 'search'}; print 'Search Sender/Subject', - textfield {-class => 'searchfield', - -id => 'searchfield', - -name => 'str', - -size => 20, - -maxlength => 255, - -value => '', - -onclick => "document.search.str.value = '';"}; + textfield {-class => 'searchfield', + -id => 'searchfield', + -name => 'str', + -size => 20, + -maxlength => 255, + -value => '', + -onclick => "document.search.str.value = '';"}; print end_form; print end_div; displayquickstats; print start_div {-class => 'search'}; - print start_form {-method => 'post', - -action => 'javascript://', - -name => 'address', - -onsubmit => 'checkaddress(this);'}; + print start_form {-method => 'post', + -action => 'javascript://', + -name => 'address', + -onsubmit => 'checkaddress(this);'}; print 'Check Email Address', - textfield {-class => 'searchfield', - -id => 'searchfield', - -name => 'email', - -size => 20, - -maxlength => 255, - -value => '', - -onclick => "document.address.email.value = '';"}; + textfield {-class => 'searchfield', + -id => 'searchfield', + -name => 'email', + -size => 20, + -maxlength => 255, + -value => '', + -onclick => "document.address.email.value = '';"}; print end_form; print end_div; } # if diff --git a/maps/bin/detail.cgi b/maps/bin/detail.cgi index de7fd29..7631983 100755 --- a/maps/bin/detail.cgi +++ b/maps/bin/detail.cgi @@ -75,11 +75,13 @@ sub MakeButtons { my $type = shift; my $prev_button = $prev >= 0 ? - a ({-href => "detail.cgi?type=$type;date=$date;next=$prev"}, - 'Previous') : ''; + a ({-href => "detail.cgi?type=$type;date=$date;next=$prev", + -accesskey => 'p', + }, 'Previous') : ''; my $next_button = ($next + $lines) < $total ? - a {-href => "detail.cgi?type=$type;date=$date;next=" . ($next + $lines)}, - 'Next' : ''; + a {-href => "detail.cgi?type=$type;date=$date;next=" . ($next + $lines), + -accesskey => 'n', + }, 'Next' : ''; my $buttons = $prev_button; diff --git a/maps/bin/list.cgi b/maps/bin/list.cgi index 0b391df..edfc81b 100755 --- a/maps/bin/list.cgi +++ b/maps/bin/list.cgi @@ -67,11 +67,13 @@ sub Body { print start_div {-class => "toolbar", -align => "center"}; my $prev_button = $prev >= 0 ? - a ({-href => "list.cgi?type=$type;next=$prev"}, - "Previous") : ""; + a ({-href => "list.cgi?type=$type;next=$prev", + -accesskey => 'p', + }, "Previous") : ""; my $next_button = ($next + $lines) < $total ? - a {-href => "list.cgi?type=$type;next=" . ($next + $lines)}, - "Next" : ""; + a {-href => "list.cgi?type=$type;next=" . ($next + $lines), + -accesskey => 'n', + }, "Next" : ""; print $prev_button, submit ({-name => "action", -value => "Add New Entry", diff --git a/maps/php/list.php b/maps/php/list.php index b08bf76..1576d96 100755 --- a/maps/php/list.php +++ b/maps/php/list.php @@ -87,9 +87,9 @@ $this_page = $next / $lines + 1;
= 0 ? - "Previous" : ""; - $next_button = ($next + $lines) < $total ? - "Previous" : ""; + "Previous" : ""; + $next_button = ($next + $lines) < $total ? + "Next" : ""; print $prev_button; ?>