################################################################################
#
# File: $RCSfile: list.cgi,v $
-# Revision: $Revision: 1.1 $
-# Description: Manage lists
+# Revision: $Revision: 1.1 $
+# Description: Manage lists
# Author: Andrew@DeFaria.com
# Created: Mon Jan 16 20:25:32 PST 2006
# Modified: $Date: 2013/06/12 14:05:47 $
use warnings;
use FindBin;
-$0 = $FindBin::Script;
+
+local $0 = $FindBin::Script;
use lib $FindBin::Bin;
use CGI qw (:standard *table start_div end_div);
use CGI::Carp "fatalsToBrowser";
-my $next = param ("next");
-my $lines = param ("lines");
-my $type = param ("type");
-my $message = param ("message");
-my $Type = ucfirst $type;
+my $next = param("next");
+my $lines = param("lines");
+my $type = param("type");
+my $message = param("message");
+my $Type = ucfirst $type;
my $userid;
my $prev;
my $total;
my $type = shift;
if (defined $message) {
- print div {-align => "center"},
- font {-class => "error"}, $message;
+ print div {-align => "center"},
+ font {-class => "error"}, $message;
} # if
print start_form {
- -method => "post",
- -action => "processaction.cgi",
- -name => "list"
+ -method => "post",
+ -action => "processaction.cgi",
+ -name => "list"
};
# Print some hidden fields to pass along
print
- hidden (-name => "type",
- -default => $type),
- hidden (-name => "next",
- -default => $next);
+ hidden (-name => "type",
+ -default => $type),
+ hidden (-name => "next",
+ -default => $next);
my $current = $next + 1;
print div {-align => "center"}, b (
"(" . $current . "-" . $last . " of " . $total . ")");
- print start_div {-class => "toolbar",
- -align => "center"};
+ print start_div {-class => "toolbar",
+ -align => "center"};
my $prev_button = $prev >= 0 ?
- a ({-href => "list.cgi?type=$type;next=$prev"},
- "<img src=/maps/images/previous.gif border=0 alt=Previous align=middle>") : "";
+ a ({-href => "list.cgi?type=$type;next=$prev",
+ -accesskey => 'p',
+ }, "<img src=/maps/images/previous.gif border=0 alt=Previous align=middle>") : "";
my $next_button = ($next + $lines) < $total ?
- a {-href => "list.cgi?type=$type;next=" . ($next + $lines)},
- "<img src=/maps/images/next.gif border=0 alt=Next align=middle>" : "";
+ a {-href => "list.cgi?type=$type;next=" . ($next + $lines),
+ -accesskey => 'n',
+ }, "<img src=/maps/images/next.gif border=0 alt=Next align=middle>" : "";
print $prev_button,
- submit ({-name => "action",
- -value => "Add New Entry",
- -onClick => "return NoneChecked (document.list);"}),
- submit ({-name => "action",
- -value => "Delete Marked",
- -onClick => "return CheckAtLeast1Checked (document.list) && AreYouSure ('Are you sure you want to delete these entries?');"}),
- submit ({-name => "action",
- -value => "Modify Marked",
- -onClick => "return CheckAtLeast1Checked (document.list);"}),
- submit ({-name => "action",
- -value => "Reset Marks",
- -onClick => "return ClearAll (document.list);"}),
+ submit ({-name => "action",
+ -value => "Add New Entry",
+ -onClick => "return NoneChecked (document.list);"}),
+ submit ({-name => "action",
+ -value => "Delete Marked",
+ -onClick => "return CheckAtLeast1Checked (document.list) && AreYouSure ('Are you sure you want to delete these entries?');"}),
+ submit ({-name => "action",
+ -value => "Modify Marked",
+ -onClick => "return CheckAtLeast1Checked (document.list);"}),
+ submit ({-name => "action",
+ -value => "Reset Marks",
+ -onClick => "return ClearAll (document.list);"}),
$next_button;
print end_div;
- print start_table {-align => "center",
- -id => $table_name,
- -border => 0,
- -cellspacing => 0,
- -cellpadding => 4,
- -width => "100%"};
+ print start_table {-align => "center",
+ -id => $table_name,
+ -border => 0,
+ -cellspacing => 0,
+ -cellpadding => 4,
+ -width => "100%"};
print Tr [
- th {-class => "tableleftend"}, "Seq",
- th {-class => "tableheader"}, "Mark",
- th {-class => "tableheader"}, "Username",
- th {-class => "tableheader"}, "@",
- th {-class => "tableheader"}, "Domain",
- th {-class => "tablerightend"}, "Comments"
+ th {-class => "tableleftend"}, "Seq",
+ th {-class => "tableheader"}, "Mark",
+ th {-class => "tableheader"}, "Username",
+ th {-class => "tableheader"}, "@",
+ th {-class => "tableheader"}, "Domain",
+ th {-class => "tablerightend"}, "Comments"
];
my @list = ReturnList $type, $next, $lines;
foreach (@list) {
%record = %{$_};
- $record{pattern} = " " if !defined $record{pattern};
- $record{domain} = " " if !defined $record{domain};
- $record{comment} = " " if !defined $record{comment};
+ $record{pattern} = " " if !defined $record{pattern};
+ $record{domain} = " " if !defined $record{domain};
+ $record{comment} = " " if !defined $record{comment};
my $leftclass = ($i eq $lines || $record{sequence} eq $total) ?
"tablebottomleft" : "tableleftdata";
$i++;
print Tr [
- td {-class => $leftclass,
- -align => "center"}, $record{sequence},
- td {-class => $dataclass,
- -align => "center"},
- checkbox ({-name => "action$record{sequence}",
- -label => ""}),
- td {-class => $dataclass,
- -align => "right"}, $record{pattern},
- td {-class => $dataclass,
- -align => "center"}, "\@",
- td {-class => $dataclass,
- -align => "left"}, $record{domain},
- td {-class => $rightclass,
- -align => "left"}, $record{comment}
+ td {-class => $leftclass,
+ -align => "center"}, $record{sequence},
+ td {-class => $dataclass,
+ -align => "center"},
+ checkbox ({-name => "action$record{sequence}",
+ -label => ""}),
+ td {-class => $dataclass,
+ -align => "right"}, $record{pattern},
+ td {-class => $dataclass,
+ -align => "center"}, "\@",
+ td {-class => $dataclass,
+ -align => "left"}, $record{domain},
+ td {-class => $rightclass,
+ -align => "left"}, $record{comment}
];
} # foreach
print end_table;
print end_form;
- print div ({-align => "center"},
+ print div ({-align => "center"},
a ({-href => "/maps/bin/exportlist.cgi?type=$type"},
- submit ({-name => "export",
- -value => "Export list"})),
+ submit ({-name => "export",
+ -value => "Export List"})),
a ({-href => "/maps/bin/importlist.cgi?type=$type"},
- submit ({-name => "import",
- -value => "Import List"})));
+ submit ({-name => "import",
+ -value => "Import List"})));
+
+ return;
} # Body
# Main
if (($next - $lines) > 0) {
$prev = $next - $lines;
} else {
- $prev = $next eq 0 ? -1 : 0;
+ $prev = $next == 0 ? -1 : 0;
} # if
Body $type;