blob: 0c9d19353cb8663aed3209168d146477e905bca9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<% $content %>\
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
my $acl_edit = $curuser->access_right('Edit FCC report configuration');
my $acl_edit_global = $curuser->access_right('Edit FCC report configuration for all agents');
die "access denied"
unless $acl_edit or $acl_edit_global;
my($name, $content);
my($query) = $cgi->keywords;
if ( $query =~ /^(\d+)$/ || $cgi->param('zonenum') =~ /^(\d+$)/ ) {
my $zonenum = $1;
$name = $zonenum;
my $deploy_zone = qsearchs('deploy_zone', { 'zonenum' => $zonenum })
or die 'unknown zonenum';
$content = $deploy_zone->geo_json_feature->to_json;
} elsif ( $cgi->param('zonetype') =~ /^(\w)$/ ) {
my $zonetype = $1;
$name = $zonetype;
my @deploy_zone = qsearch('deploy_zone', { 'zonetype' => $zonetype,
'disabled' => '', });
my $fc = Geo::JSON::FeatureCollection->new({
features => [ map $_->geo_json_feature, @deploy_zone ],
});
$content = $fc->to_json;
} else {
die "no zonenum or zonetype\n";
}
http_header('Content-Type' => 'application/geo+json' );
http_header('Content-Disposition' => "filename=$name.geojson" );
http_header('Content-Length' => length($content) );
http_header('Cache-control' => 'max-age=60' );
</%init>
|