diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-09-23 21:46:14 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-09-23 21:46:14 -0500 |
commit | ae14e320388fa5e7f400bff1c251ef885b7952e6 (patch) | |
tree | fe5375cf0a0619e148ecb9005984fc81f40d744b /httemplate/view | |
parent | e1acfb2921b35fe097015208e8072a2675d01d69 (diff) |
71873: GlobalVision - directions [better error handling]
Diffstat (limited to 'httemplate/view')
-rw-r--r-- | httemplate/view/directions.html | 17 | ||||
-rw-r--r-- | httemplate/view/map.html | 18 |
2 files changed, 31 insertions, 4 deletions
diff --git a/httemplate/view/directions.html b/httemplate/view/directions.html index a07df403b..f23b7eb7f 100644 --- a/httemplate/view/directions.html +++ b/httemplate/view/directions.html @@ -1,3 +1,5 @@ +% if ( $apikey ) { + %# the actual page <& /elements/header-popup.html, { title => '',#$name, @@ -10,6 +12,11 @@ <div id="directions_panel"></div> <div id="map_canvas"></div> +% } else { +<& /elements/header-popup.html &> +<& /elements/google_maps_api_key.html &> +% } + <%def .head> % my $lat = $cgi->param('lat'); % my $lon = $cgi->param('lon'); @@ -38,8 +45,6 @@ body { height: 100%; margin: 0px; padding: 0px } } </style> -% my $conf = new FS::Conf; -% my $apikey = $conf->config('google_maps_api_key'); <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>"> </script> @@ -69,6 +74,12 @@ function show_route() { }); } +// function name specified by google maps api, special hook for auth errors +function gm_authFailure () { + document.body.innerHTML = +<% include('/elements/google_maps_api_key.html', autherror => 1) |js_string%>; +} + function initialize() { var myOptions = { zoom: 14, @@ -88,6 +99,8 @@ function initialize() { </%def> <%shared> my ($lat, $lon, $name, $origin); +my $conf = new FS::Conf; +my $apikey = $conf->config('google_maps_api_key'); </%shared> <%init> diff --git a/httemplate/view/map.html b/httemplate/view/map.html index d996a330c..b3459dc1f 100644 --- a/httemplate/view/map.html +++ b/httemplate/view/map.html @@ -1,3 +1,5 @@ +% if ( $apikey ) { + %# the actual page <& /elements/header-popup.html, { title => '',#$name, @@ -9,6 +11,11 @@ <div id="map_canvas"></div> +% } else { +<& /elements/header-popup.html &> +<& /elements/google_maps_api_key.html &> +% } + <%def .head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> @@ -22,8 +29,6 @@ body { height: 100%; margin: 0px; padding: 0px } @media print { #map_canvas { height: 500px; margin: 0; } } </style> -% my $conf = new FS::Conf; -% my $apikey = $conf->config('google_maps_api_key'); <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>"> </script> @@ -31,6 +36,13 @@ body { height: 100%; margin: 0px; padding: 0px } var lengthLine=0; var map; +// function name specified by google maps api, special hook for auth errors +function gm_authFailure () { + document.body.innerHTML = +<% include('/elements/google_maps_api_key.html', autherror => 1) |js_string%>; +} + + function initialize() { var latlng = new google.maps.LatLng(<%$lat%>, <%$lon%>); var myOptions = { @@ -57,6 +69,8 @@ function initialize() { </%def> <%shared> my ($lat, $lon, $name); +my $conf = new FS::Conf; +my $apikey = $conf->config('google_maps_api_key'); </%shared> <%init> |