projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed old tunnel. Implemented speak bin
[clearscm.git]
/
maps
/
bin
/
importlist.cgi
diff --git
a/maps/bin/importlist.cgi
b/maps/bin/importlist.cgi
index
a8720a7
..
495da15
100755
(executable)
--- a/
maps/bin/importlist.cgi
+++ b/
maps/bin/importlist.cgi
@@
-17,7
+17,7
@@
use strict;
use FindBin;
local $0 = $FindBin::Script;
use FindBin;
local $0 = $FindBin::Script;
-use lib
$FindBin::Bin
;
+use lib
"$FindBin::Bin/../lib"
;
use Getopt::Long;
use Pod::Usage;
use Getopt::Long;
use Pod::Usage;
@@
-28,15
+28,18
@@
use MAPSWeb;
use CGI qw/:standard *table/;
use CGI::Carp "fatalsToBrowser";
use CGI qw/:standard *table/;
use CGI::Carp "fatalsToBrowser";
-my $type = param('type');
my $userid = cookie('MAPSUser');
$userid //= $ENV{USER};
my $Userid = ucfirst $userid;
my $userid = cookie('MAPSUser');
$userid //= $ENV{USER};
my $Userid = ucfirst $userid;
+my $type = param 'type';
+my $file = param 'file';
+
my %opts = (
usage => sub { pod2usage },
help => sub { pod2usage (-verbose => 2)},
my %opts = (
usage => sub { pod2usage },
help => sub { pod2usage (-verbose => 2)},
- file => param('file'),
+ type => $type,
+ file => $file,
);
sub importList ($) {
);
sub importList ($) {
@@
-57,17
+60,19
@@
sub importList ($) {
my $alreadyExists;
if ($type eq 'white') {
my $alreadyExists;
if ($type eq 'white') {
-
$alreadyExists = OnWhitelist $pattern, $userid
;
+
($alreadyExists) = OnWhitelist($pattern, $userid)
;
} elsif ($type eq 'black') {
} elsif ($type eq 'black') {
-
$alreadyExists = OnBlacklist $pattern, $userid
;
+
($alreadyExists) = OnBlacklist($pattern, $userid)
;
} elsif ($type eq 'null') {
} elsif ($type eq 'null') {
-
$alreadyExists = OnNulllist $pattern, $userid
;
+
($alreadyExists) = OnNulllist($pattern, $userid)
;
} # if
unless ($alreadyExists) {
} # if
unless ($alreadyExists) {
- AddList
($type, $pattern, 0, $comment, $hit_count, $last_hit);
+ AddList($type, $pattern, 0, $comment, $hit_count, $last_hit);
$count++;
$count++;
+ } else {
+ print br "$pattern is already on your " . ucfirst($type) . 'list';
} # unless
} # while
} # unless
} # while
@@
-77,31
+82,32
@@
sub importList ($) {
} # importList
# Main
} # importList
# Main
-GetOptions
(
+GetOptions(
\%opts,
'usage',
'help',
'verbose',
'debug',
'file=s',
\%opts,
'usage',
'help',
'verbose',
'debug',
'file=s',
+ 'type=s',
);
);
-pod2usage "Type not specified" unless $
type
;
+pod2usage "Type not specified" unless $
opts{type}
;
pod2usage '-file should be specified' unless $opts{file};
pod2usage "Unable to read $opts{file}" unless -r $opts{file};
pod2usage '-file should be specified' unless $opts{file};
pod2usage "Unable to read $opts{file}" unless -r $opts{file};
-$userid = Heading
(
+$userid = Heading(
'getcookie',
'',
'Import List',
'Import List',
);
'getcookie',
'',
'Import List',
'Import List',
);
-SetContext
$userid
;
+SetContext
($userid)
;
-NavigationBar
$userid
;
+NavigationBar
($userid)
;
-my $count = importList
$type
;
+my $count = importList
($opts{type})
;
if ($count == 1) {
print br "$count list entry imported";
if ($count == 1) {
print br "$count list entry imported";