diff options
| author | Mitch Jackson <mitch@freeside.biz> | 2018-08-22 14:14:30 -0400 |
|---|---|---|
| committer | Mitch Jackson <mitch@freeside.biz> | 2018-08-22 15:04:52 -0400 |
| commit | f894f28f646e6a233ccb10624f37d7a5f216279b (patch) | |
| tree | b8ea3e9bc5aeebacd664a1b5a1aff00dfffe7633 | |
| parent | 2fc8238ca5301e2ed686447f4efea0e55cd69567 (diff) | |
RT# 81150 Google now requires api key for drawing api
| -rw-r--r-- | FS/FS/deploy_zone.pm | 2 | ||||
| -rw-r--r-- | httemplate/elements/polygon.html | 5 | ||||
| -rw-r--r-- | httemplate/search/elements/gmap.html | 5 |
3 files changed, 9 insertions, 3 deletions
diff --git a/FS/FS/deploy_zone.pm b/FS/FS/deploy_zone.pm index 6ad355f72..7c3a76ca5 100644 --- a/FS/FS/deploy_zone.pm +++ b/FS/FS/deploy_zone.pm @@ -6,7 +6,7 @@ use FS::Record qw( qsearch qsearchs dbh ); use Storable qw(thaw); use MIME::Base64; -use JSON qw(encode_json decode_json) ; +use Cpanel::JSON::XS qw(encode_json decode_json); use LWP::UserAgent; use HTTP::Request::Common; diff --git a/httemplate/elements/polygon.html b/httemplate/elements/polygon.html index 813aa419f..b5aa93753 100644 --- a/httemplate/elements/polygon.html +++ b/httemplate/elements/polygon.html @@ -5,13 +5,16 @@ my $id = $opt{'id'} || $opt{'field'}; my $div_id = "div_$id"; my $vertices_json = $opt{'curr_value'} || '[]'; + +my $apikey = FS::Conf->new->config('google_maps_api_key'); + </%init> <& hidden.html, %opt &> <div id="<% $div_id %>" style="height: 600px; width: 600px"></div> <div id="<% $div_id %>_hint" style="width: 100%; border: 2px solid black; text-align: center; box-sizing: border-box; padding: 4px"> </div> <script src="<% $fsurl %>elements/jquery.js"></script> -<script src="https://maps.googleapis.com/maps/api/js?libraries=drawing&v=3.22"></script> +<script src="https://maps.googleapis.com/maps/api/js?libraries=drawing&v=3.22<% $apikey ? "&key=$apikey" : '' %>"></script> <script> var map; var drawingManager; diff --git a/httemplate/search/elements/gmap.html b/httemplate/search/elements/gmap.html index 47db1507d..1caf76718 100644 --- a/httemplate/search/elements/gmap.html +++ b/httemplate/search/elements/gmap.html @@ -37,6 +37,9 @@ Generic Google Maps front end. </%doc> <%init> + +my $apikey = FS::Conf->new->config('google_maps_api_key'); + foreach (@features) { $_->{type} = 'Feature'; # any other per-feature massaging can go here @@ -57,7 +60,7 @@ body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 100%; } </style> -<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3"> +<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3<% $apikey ? "&key=$apikey" : '' %>"> </script> <script type="text/javascript"> |
