X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2Fexportlist.cgi;h=70907ba50995cedc8cec3ba5261187b93b4cc4ab;hb=4f37839bc9faacb57d9bce9196d916595f14b114;hp=45bcce198cdee7f40a198f51c7edde6c8f38967c;hpb=92a317c3620f3442f9452d834a1ed5f09bdddbf6;p=clearscm.git diff --git a/maps/bin/exportlist.cgi b/maps/bin/exportlist.cgi index 45bcce1..70907ba 100755 --- a/maps/bin/exportlist.cgi +++ b/maps/bin/exportlist.cgi @@ -17,7 +17,8 @@ use strict; use FindBin; local $0 = $FindBin::Script; -use lib $FindBin::Bin; +use lib "$FindBin::Bin/../lib"; +use lib "$FindBin::Bin/../../lib"; use MAPS; use MAPSWeb; @@ -25,18 +26,15 @@ use MAPSWeb; use CGI qw/:standard *table/; use CGI::Carp "fatalsToBrowser"; -my $type = param ("type"); -my $userid = cookie ("MAPSUser"); +my $type = param('type'); +my $userid = cookie("MAPSUser"); $userid //= $ENV{USER}; -my $Userid = ucfirst $userid; +my $Userid = ucfirst $userid; -sub PrintList { - my $type = shift; +sub PrintList($) { + my ($type) = @_; - my $year = substr ((scalar (localtime)), 20, 4); - - my ($pattern, $domain, $comment, $hit_count, $last_hit); - my $sth = FindList $type; + my $year = substr((scalar(localtime)), 20, 4); print "\################################################################################\n"; print "\#\n"; @@ -48,16 +46,23 @@ sub PrintList { print "\#\n"; print "\################################################################################\n"; - while (($_, $_, $pattern, $domain, $comment, $_, $hit_count, $last_hit) = GetList $sth) { - last if !(defined $pattern or defined $domain); - - $pattern //= ''; - $domain //= ''; - - if ($domain eq '') { - print "$pattern,$comment,$hit_count,$last_hit\n"; + FindList( + userid => $userid, + type => $type, + ); + + while (my $rec = GetList) { + $rec->{pattern} //= ''; + $rec->{domain} //= ''; + $rec->{comment} //= ''; + $rec->{hit_count} //= 0; + $rec->{last_hit} //= ''; + $rec->{retention} //= ''; + + if ($rec->{domain} eq '') { + print "$rec->{pattern},$rec->{comment},$rec->{hit_count},$rec->{last_hit},$rec->{retention}\n"; } else { - print "$pattern\@$domain,$comment,$hit_count,$last_hit\n"; + print "$rec->{pattern}\@$rec->{domain},$rec->{comment},$rec->{hit_count},$rec->{last_hit},$rec->{retention}\n"; } # if } # while @@ -65,13 +70,13 @@ sub PrintList { } # PrintList # Main -SetContext $userid; +SetContext($userid); -print header ( +print header( -type => "application/octet-stream", -attachment => "$type.list", ); -PrintList $type; +PrintList($type); exit;