diff options
Diffstat (limited to 'modules_v3/googlemap')
| -rw-r--r-- | modules_v3/googlemap/admin_places.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/css/wt_v3_googlemap.css | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/db_schema/db_schema_0_1.php | 7 | ||||
| -rw-r--r-- | modules_v3/googlemap/db_schema/db_schema_1_2.php | 7 | ||||
| -rw-r--r-- | modules_v3/googlemap/db_schema/db_schema_2_3.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/db_schema/db_schema_3_4.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/db_schema/db_schema_4_5.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/defaultconfig.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/googlemap.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/help_text.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/module.php | 13 | ||||
| -rw-r--r-- | modules_v3/googlemap/placehierarchy.php | 11 | ||||
| -rw-r--r-- | modules_v3/googlemap/places_edit.php | 36 | ||||
| -rw-r--r-- | modules_v3/googlemap/wt_v3_places_edit.js.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/wt_v3_places_edit_overlays.js.php | 4 | ||||
| -rw-r--r-- | modules_v3/googlemap/wt_v3_street_view.php | 482 |
16 files changed, 268 insertions, 328 deletions
diff --git a/modules_v3/googlemap/admin_places.php b/modules_v3/googlemap/admin_places.php index 3aed1fd254..41fb9cd96c 100644 --- a/modules_v3/googlemap/admin_places.php +++ b/modules_v3/googlemap/admin_places.php @@ -2,7 +2,7 @@ // Interface to edit place locations // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/css/wt_v3_googlemap.css b/modules_v3/googlemap/css/wt_v3_googlemap.css index a6546e60f0..02c598afc3 100644 --- a/modules_v3/googlemap/css/wt_v3_googlemap.css +++ b/modules_v3/googlemap/css/wt_v3_googlemap.css @@ -2,7 +2,7 @@ * webtrees googlemap V3 css * * webtrees: Web based Family History software - * Copyright (C) 2013 webtrees development team. + * Copyright (C) 2014 webtrees development team. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ div.infowindow { diff --git a/modules_v3/googlemap/db_schema/db_schema_0_1.php b/modules_v3/googlemap/db_schema/db_schema_0_1.php index c0ac5a7ac7..3f003ddcdd 100644 --- a/modules_v3/googlemap/db_schema/db_schema_0_1.php +++ b/modules_v3/googlemap/db_schema/db_schema_0_1.php @@ -12,10 +12,7 @@ // seconds, for systems with low timeout values. // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. -// -// Derived from PhpGedView -// Copyright (C) 2009 Greg Roach +// Copyright (C) 2014 Greg Roach // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -29,7 +26,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/db_schema/db_schema_1_2.php b/modules_v3/googlemap/db_schema/db_schema_1_2.php index 8c1f706842..35bf11a21f 100644 --- a/modules_v3/googlemap/db_schema/db_schema_1_2.php +++ b/modules_v3/googlemap/db_schema/db_schema_1_2.php @@ -13,10 +13,7 @@ // seconds, for systems with low timeout values. // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. -// -// Derived from PhpGedView -// Copyright (C) 2009 Greg Roach +// Copyright (C) 2014 Greg Roach // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -30,7 +27,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/db_schema/db_schema_2_3.php b/modules_v3/googlemap/db_schema/db_schema_2_3.php index 7c7b7887f4..e99278f46c 100644 --- a/modules_v3/googlemap/db_schema/db_schema_2_3.php +++ b/modules_v3/googlemap/db_schema/db_schema_2_3.php @@ -11,7 +11,7 @@ // seconds, for systems with low timeout values. // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/db_schema/db_schema_3_4.php b/modules_v3/googlemap/db_schema/db_schema_3_4.php index 53d233c078..86b2a77bf8 100644 --- a/modules_v3/googlemap/db_schema/db_schema_3_4.php +++ b/modules_v3/googlemap/db_schema/db_schema_3_4.php @@ -11,7 +11,7 @@ // seconds, for systems with low timeout values. // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/db_schema/db_schema_4_5.php b/modules_v3/googlemap/db_schema/db_schema_4_5.php index 94ad3b085e..06b95617d0 100644 --- a/modules_v3/googlemap/db_schema/db_schema_4_5.php +++ b/modules_v3/googlemap/db_schema/db_schema_4_5.php @@ -11,7 +11,7 @@ // seconds, for systems with low timeout values. // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 Greg Roach // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/defaultconfig.php b/modules_v3/googlemap/defaultconfig.php index f7ca70c0b4..60d697fd33 100644 --- a/modules_v3/googlemap/defaultconfig.php +++ b/modules_v3/googlemap/defaultconfig.php @@ -2,7 +2,7 @@ // Configuration file required by GoogleMap module // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved. @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/googlemap.php b/modules_v3/googlemap/googlemap.php index 3ab5c75f17..8ac04a1d63 100644 --- a/modules_v3/googlemap/googlemap.php +++ b/modules_v3/googlemap/googlemap.php @@ -2,7 +2,7 @@ // Google map module for webtrees // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/help_text.php b/modules_v3/googlemap/help_text.php index b74927cd69..015cc6a0df 100644 --- a/modules_v3/googlemap/help_text.php +++ b/modules_v3/googlemap/help_text.php @@ -5,7 +5,7 @@ // It simply needs to set $title and $text for the help topic $help_topic // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php index 24864a42c8..81afc5d0af 100644 --- a/modules_v3/googlemap/module.php +++ b/modules_v3/googlemap/module.php @@ -2,7 +2,7 @@ // Classes and libraries for module system // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2010 John Finlay @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); @@ -70,10 +70,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu break; case 'admin_places': case 'places_edit': + case 'wt_v3_street_view': // TODO: these files should be methods in this class - require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php'; - require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; - require WT_ROOT.WT_MODULES_DIR.$this->getName().'/'.$mod_action.'.php'; + require WT_ROOT . WT_MODULES_DIR . 'googlemap/googlemap.php'; + require WT_ROOT . WT_MODULES_DIR . 'googlemap/defaultconfig.php'; + require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php'; break; default: header('HTTP/1.0 404 Not Found'); @@ -271,7 +272,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu </td> </tr> <tr> - <th><?php echo WT_I18N::translate('Google Street View™'); ?></th> + <th><?php echo /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ WT_I18N::translate('Google Street View™'); ?></th> <td><?php echo radio_buttons('NEW_GM_USE_STREETVIEW', array(false=>WT_I18N::translate('hide'),true=>WT_I18N::translate('show')), get_module_setting('googlemap', 'GM_USE_STREETVIEW', '0')); ?></td> </tr> <tr> diff --git a/modules_v3/googlemap/placehierarchy.php b/modules_v3/googlemap/placehierarchy.php index 0214f48e2b..75c6cb2efe 100644 --- a/modules_v3/googlemap/placehierarchy.php +++ b/modules_v3/googlemap/placehierarchy.php @@ -2,7 +2,7 @@ // Displays a place hierachy // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); @@ -227,12 +227,9 @@ function create_map($placelevels) { $sv_zoom=1; } - $_map = WT_I18N::translate('Google Maps™'); - $_reset = WT_I18N::translate('Reset'); - $_streetview = /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ WT_I18N::translate('Google Street View™'); ?> <div> - <iframe style="background:transparent; margin-top:-3px; margin-left:2px; width:530px;height:405px;padding:0;border:solid 0px black" src="<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?>googlemap/wt_v3_street_view.php?x=<?php echo $sv_lng; ?>&y=<?php echo $sv_lat; ?>&z=18&t=2&c=1&s=1&b=<?php echo $sv_dir; ?>&p=<?php echo $sv_pitch; ?>&m=<?php echo $sv_zoom; ?>&j=1&k=1&v=1&map=<?php echo $_map; ?>&reset=<?php echo $_reset; ?>&streetview=<?php echo $_streetview; ?>" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe> + <iframe style="background:transparent; margin-top:-3px; margin-left:2px; width:530px;height:405px;padding:0;border:solid 0px black" src="module.php?mod=googlemap&mod_action=wt_v3_street_view&?x=<?php echo $sv_lng; ?>&y=<?php echo $sv_lat; ?>&z=18&t=2&c=1&s=1&b=<?php echo $sv_dir; ?>&p=<?php echo $sv_pitch; ?>&m=<?php echo $sv_zoom; ?>&j=1&k=1&v=1" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe> </div> <?php @@ -657,4 +654,4 @@ function map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $pla } } $controller->addInlineJavascript(ob_get_clean()); -}
\ No newline at end of file +} diff --git a/modules_v3/googlemap/places_edit.php b/modules_v3/googlemap/places_edit.php index f4761c1af7..ab4cc75c8a 100644 --- a/modules_v3/googlemap/places_edit.php +++ b/modules_v3/googlemap/places_edit.php @@ -2,7 +2,7 @@ // Interface to edit place locations // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. @@ -19,14 +19,13 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); exit; } -require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; require WT_ROOT.'includes/functions/functions_edit.php'; $action = WT_Filter::post('action', null, WT_Filter::get('action')); @@ -103,23 +102,20 @@ if ($action=='updaterecord' && WT_USER_IS_ADMIN) { exit; } -// Update placelocation STREETVIEW fields ---------------------------------------------------------- -if ($action=='update_sv_params' && WT_USER_IS_ADMIN) { - echo "Google Street View™ parameters updated"; - echo "<br><br>"; - echo "LATI = ".$_REQUEST['svlati']."<br>"; - echo "LONG = ".$_REQUEST['svlong']."<br>"; - echo "BEAR = ".$_REQUEST['svbear']."<br>"; - echo "ELEV = ".$_REQUEST['svelev']."<br>"; - echo "ZOOM = ".$_REQUEST['svzoom']."<br>"; - echo "<br><br>"; - $statement= - WT_DB::prepare("UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?"); - $statement->execute(array($_REQUEST['svlati'], $_REQUEST['svlong'], $_REQUEST['svbear'], $_REQUEST['svelev'], $_REQUEST['svzoom'], $placeid)); - if (!WT_DEBUG) { - $controller->addInlineJavaScript('closePopupAndReloadParent();'); - } - echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", WT_I18N::translate('close'), "</button></div>"; +// Update placelocation STREETVIEW fields +// TODO: This ought to be a POST request, rather than a GET request +if ($action == 'update_sv_params' && WT_USER_IS_ADMIN) { + WT_DB::prepare( + "UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?" + )->execute(array( + WT_Filter::get('svlati'), + WT_Filter::get('svlong'), + WT_Filter::get('svbear'), + WT_Filter::get('svelev'), + WT_Filter::get('svzoom'), + $placeid + )); + $controller->addInlineJavaScript('window.close();'); exit; } diff --git a/modules_v3/googlemap/wt_v3_places_edit.js.php b/modules_v3/googlemap/wt_v3_places_edit.js.php index 2e40b80c10..286081aa2f 100644 --- a/modules_v3/googlemap/wt_v3_places_edit.js.php +++ b/modules_v3/googlemap/wt_v3_places_edit.js.php @@ -2,7 +2,7 @@ // Included script file for Interface to edit place locations // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // Derived from PhpGedView // Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved. @@ -19,7 +19,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); diff --git a/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php b/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php index 894c23770e..5a797828c1 100644 --- a/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php +++ b/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php @@ -2,7 +2,7 @@ // Overlays file for Interface to edit place locations // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ?> // === Create Borders for the UK Countries ========================================================= diff --git a/modules_v3/googlemap/wt_v3_street_view.php b/modules_v3/googlemap/wt_v3_street_view.php index c870cf406c..1b10218147 100644 --- a/modules_v3/googlemap/wt_v3_street_view.php +++ b/modules_v3/googlemap/wt_v3_street_view.php @@ -2,7 +2,7 @@ // Displays a streetview map // // webtrees: Web based Family History software -// Copyright (C) 2013 webtrees development team. +// Copyright (C) 2014 webtrees development team. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -16,82 +16,67 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// This PHP script *really* ought to include session.php, so it picks up -// language, access, etc... -define('WT_GM_SCRIPT', 'https://maps.google.com/maps/api/js?v=3.2&sensor=false'); +if (!defined('WT_WEBTREES')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} header('Content-type: text/html; charset=UTF-8'); ?> - <html> -<head> -<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> -<script src="<?php echo WT_GM_SCRIPT; ?>"></script> + <head> + <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> + <script src="https://maps.google.com/maps/api/js?v=3.2&sensor=false"></script> + <script> -<script> - - // Following function creates an array of the google map parameters passed --------------------- - var qsParm = new Array(); - function qs() { - var query = window.location.search.substring(1); - var parms = query.split('&'); - for (var i=0; i<parms.length; i++) { - var pos = parms[i].indexOf('='); - if (pos > 0) { - var key = parms[i].substring(0,pos); - var val = parms[i].substring(pos+1); - qsParm[key] = val; - } +// Following function creates an array of the google map parameters passed --------------------- +var qsParm = new Array(); +function qs() { + var query = window.location.search.substring(1); + var parms = query.split('&'); + for (var i=0; i<parms.length; i++) { + var pos = parms[i].indexOf('='); + if (pos > 0) { + var key = parms[i].substring(0,pos); + var val = parms[i].substring(pos+1); + qsParm[key] = val; } } - qsParm['x'] = null; - qsParm['y'] = null; - qs(); - // --------------------------------------------------------------------------------------------- - - - // --------------------------------------------------------------------------------------------- +} +qsParm['x'] = null; +qsParm['y'] = null; +qs(); var geocoder = new google.maps.Geocoder(); function geocodePosition(pos) { - geocoder.geocode({ - latLng: pos - }, function(responses) { - if (responses && responses.length > 0) { - updateMarkerAddress(responses[0].formatted_address); - } else { - updateMarkerAddress('Cannot determine address at this location.'); - } - }); + geocoder.geocode({ + latLng: pos + }, function(responses) { + if (responses && responses.length > 0) { + updateMarkerAddress(responses[0].formatted_address); + } else { + updateMarkerAddress('Cannot determine address at this location.'); + } + }); } function updateMarkerStatus(str) { - document.getElementById('markerStatus').innerHTML = str; + document.getElementById('markerStatus').innerHTML = str; } - - -//function updateMarkerBearing(bearing) { -// document.getElementById('sv_bearText').value; = str; -//} - -// var bearing = document.getElementById('sv_bearText').value; - function updateMarkerPosition(latLng) { - // document.getElementById('sv_latiText').value = pos.lat()+"\u00B0"; - // document.getElementById('sv_longText').value = pos.lng()+"\u00B0"; - document.getElementById('info').innerHTML = [ - latLng.lat(), - latLng.lng() - ].join(', '); + document.getElementById('info').innerHTML = [ + latLng.lat(), + latLng.lng() + ].join(', '); } function updateMarkerAddress(str) { - document.getElementById('address').innerHTML = str; + document.getElementById('address').innerHTML = str; } function roundNumber(num, dec) { @@ -100,196 +85,190 @@ function roundNumber(num, dec) { } function initialize() { - var x = qsParm['x']; - var y = qsParm['y']; - var b = parseFloat(qsParm['b']); - var p = parseFloat(qsParm['p']); - var m = parseFloat(qsParm['m']); + var y = qsParm['y']; + var b = parseFloat(qsParm['b']); + var p = parseFloat(qsParm['p']); + var m = parseFloat(qsParm['m']); - var latLng = new google.maps.LatLng(y, x); + var latLng = new google.maps.LatLng(y, x); - // Create the map and mapOptions + // Create the map and mapOptions var mapOptions = { zoom: 16, center: latLng, - mapTypeId: google.maps.MapTypeId.ROADMAP, // ROADMAP, SATELLITE, HYBRID, TERRAIN + mapTypeId: google.maps.MapTypeId.ROADMAP, // ROADMAP, SATELLITE, HYBRID, TERRAIN mapTypeControlOptions: { - style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR + style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR }, navigationControl: true, - navigationControlOptions: { - position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc - style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN - }, - streetViewControl: false, // Show Pegman or not - scrollwheel: true + navigationControlOptions: { + position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc + style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN + }, + streetViewControl: false, // Show Pegman or not + scrollwheel: true }; - var map = new google.maps.Map(document.getElementById('mapCanvas'), mapOptions); + var map = new google.maps.Map(document.getElementById('mapCanvas'), mapOptions); - var bearing = b; - if (bearing < 0) { - bearing=bearing+360; - } - var pitch = p; - var svzoom = m; + var bearing = b; + if (bearing < 0) { + bearing=bearing+360; + } + var pitch = p; + var svzoom = m; var imageNum = Math.round(bearing/22.5) % 16; - var image = new google.maps.MarkerImage('images/panda-icons/panda-' + imageNum + '.png', - // This marker is 50 pixels wide by 50 pixels tall. - new google.maps.Size(50, 50), - // The origin for this image is 0,0. - new google.maps.Point(0, 0), - // The anchor for this image is the base of the flagpole at 0,32. - new google.maps.Point(26, 36) - ); + var image = new google.maps.MarkerImage('<?php echo WT_SCRIPT_PATH . WT_MODULES_DIR; ?>/googlemap/images/panda-icons/panda-' + imageNum + '.png', + // This marker is 50 pixels wide by 50 pixels tall. + new google.maps.Size(50, 50), + // The origin for this image is 0,0. + new google.maps.Point(0, 0), + // The anchor for this image is the base of the flagpole at 0,32. + new google.maps.Point(26, 36) + ); - var shape = { - coord: [1, 1, 1, 20, 18, 20, 18 , 1], - type: 'poly' - }; - - var marker = new google.maps.Marker({ - icon: image, - // shape: shape, - position: latLng, - title: 'Drag me to a Blue Street', - map: map, - draggable: true - }); + var shape = { + coord: [1, 1, 1, 20, 18, 20, 18 , 1], + type: 'poly' + }; + var marker = new google.maps.Marker({ + icon: image, + // shape: shape, + position: latLng, + title: 'Drag me to a Blue Street', + map: map, + draggable: true + }); - // ===Next, get the map’s default panorama and set up some defaults. =========================== + // ===Next, get the map’s default panorama and set up some defaults. =========================== - // --- First check if Browser supports html5 --- - var browserName=navigator.appName; - if (browserName=='Microsoft Internet Explorer') { - var render_type = ''; - } else { - var render_type = 'html5'; - } + // --- First check if Browser supports html5 --- + var browserName=navigator.appName; + if (browserName=='Microsoft Internet Explorer') { + var render_type = ''; + } else { + var render_type = 'html5'; + } // --- Create the panorama --- - var panoramaOptions = { - navigationControl: true, - navigationControlOptions: { - position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc - style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN - }, - linksControl: true, - addressControl: true, - addressControlOptions: { - style: { - // display: 'none', // USE CSS notation here - // backgroundColor: 'red' - } - }, - position: latLng, - mode: render_type, - pov: { - heading: bearing, - pitch: pitch, - zoom: svzoom - } - }; + var panoramaOptions = { + navigationControl: true, + navigationControlOptions: { + position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc + style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN + }, + linksControl: true, + addressControl: true, + addressControlOptions: { + style: { + // display: 'none' + // backgroundColor: 'red' + } + }, + position: latLng, + mode: render_type, + pov: { + heading: bearing, + pitch: pitch, + zoom: svzoom + } + }; panorama = new google.maps.StreetViewPanorama(document.getElementById('mapCanvas'), panoramaOptions); panorama.setPosition(latLng); setTimeout(function() { panorama.setVisible(true); }, 1000); - setTimeout(function() { panorama.setVisible(true); }, 2000); - setTimeout(function() { panorama.setVisible(true); }, 3000); - - - // Enable navigator contol and address control to be toggled with right mouse button ------- - var aLink = document.createElement('a'); - aLink.href = 'javascript:void(0)'; onmousedown=function(e) { - if (parseInt(navigator.appVersion)>3) { - var clickType=1; - if (navigator.appName=='Netscape') { - clickType=e.which; - } else { - clickType=event.button; - } - if (clickType==1) { - self.status='Left button!'; - } - if (clickType!=1) { - if (panorama.get('addressControl') == false) { - panorama.set('navigationControl', false); - panorama.set('addressControl', true); - panorama.set('linksControl', true); - } else { - panorama.set('navigationControl', false); - panorama.set('addressControl', false); - panorama.set('linksControl', false); - } - } - } - return true; - }; - panorama.controls[google.maps.ControlPosition.TOP_RIGHT].push(aLink); - // ----------------------------------------------------------------------------------------- + setTimeout(function() { panorama.setVisible(true); }, 2000); + setTimeout(function() { panorama.setVisible(true); }, 3000); + // Enable navigator contol and address control to be toggled with right mouse button ------- + var aLink = document.createElement('a'); + aLink.href = 'javascript:void(0)'; onmousedown=function(e) { + if (parseInt(navigator.appVersion)>3) { + var clickType=1; + if (navigator.appName=='Netscape') { + clickType=e.which; + } else { + clickType=event.button; + } + if (clickType==1) { + self.status='Left button!'; + } + if (clickType!=1) { + if (panorama.get('addressControl') == false) { + panorama.set('navigationControl', false); + panorama.set('addressControl', true); + panorama.set('linksControl', true); + } else { + panorama.set('navigationControl', false); + panorama.set('addressControl', false); + panorama.set('linksControl', false); + } + } + } + return true; + }; + panorama.controls[google.maps.ControlPosition.TOP_RIGHT].push(aLink); - // Update current position info. - updateMarkerPosition(latLng); - geocodePosition(latLng); + // Update current position info. + updateMarkerPosition(latLng); + geocodePosition(latLng); - // Add dragging event listeners. - google.maps.event.addListener(marker, 'dragstart', function() { - updateMarkerAddress('Dragging...'); - }); + // Add dragging event listeners. + google.maps.event.addListener(marker, 'dragstart', function() { + updateMarkerAddress('Dragging...'); + }); - google.maps.event.addListener(marker, 'drag', function() { - updateMarkerStatus('Dragging...'); - updateMarkerPosition(marker.getPosition()); - panorama.setPosition(marker.getPosition()); - }); + google.maps.event.addListener(marker, 'drag', function() { + updateMarkerStatus('Dragging...'); + updateMarkerPosition(marker.getPosition()); + panorama.setPosition(marker.getPosition()); + }); - google.maps.event.addListener(marker, 'dragend', function() { - updateMarkerStatus('Drag ended'); - geocodePosition(marker.getPosition()); - }); + google.maps.event.addListener(marker, 'dragend', function() { + updateMarkerStatus('Drag ended'); + geocodePosition(marker.getPosition()); + }); google.maps.event.addListener(panorama, 'pov_changed', function() { povLevel = panorama.getPov(); - parent.document.getElementById('sv_bearText').value = roundNumber(povLevel.heading, 2)+"\u00B0"; - parent.document.getElementById('sv_elevText').value = roundNumber(povLevel.pitch, 2)+"\u00B0"; - parent.document.getElementById('sv_zoomText').value = roundNumber(povLevel.zoom, 2); + parent.document.getElementById('sv_bearText').value = roundNumber(povLevel.heading, 2)+"\u00B0"; + parent.document.getElementById('sv_elevText').value = roundNumber(povLevel.pitch, 2)+"\u00B0"; + parent.document.getElementById('sv_zoomText').value = roundNumber(povLevel.zoom, 2); }); google.maps.event.addListener(panorama, 'position_changed', function() { pos = panorama.getPosition(); marker.setPosition(pos); - parent.document.getElementById('sv_latiText').value = pos.lat()+"\u00B0"; - parent.document.getElementById('sv_longText').value = pos.lng()+"\u00B0"; + parent.document.getElementById('sv_latiText').value = pos.lat()+"\u00B0"; + parent.document.getElementById('sv_longText').value = pos.lng()+"\u00B0"; }); - //============================================================================================== // CREATE THE MAP PANE STREETVIEW BLUE STREETS //====================================================================================== - // First lets create the Traffic ImageMap + // First lets create the Traffic ImageMap //-------------------------------------------------------------------------------------- var traffic = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var X = coord.x % (1 << zoom); // wrap - return 'http://mt3.google.com/mapstt?' + - 'zoom=' + zoom + '&x=' + X + '&y=' + coord.y + '&client=api'; + return 'http://mt3.google.com/mapstt?' + 'zoom=' + zoom + '&x=' + X + '&y=' + coord.y + '&client=api'; }, tileSize: new google.maps.Size(256, 256), isPng: true }); + //====================================================================================== - // Now add the ImageMapType overlay to the map + // Now add the ImageMapType overlay to the map //-------------------------------------------------------------------------------------- map.overlayMapTypes.push(traffic); map.overlayMapTypes.push(null); + //====================================================================================== - // Now create the StreetView ImageMap + // Now create the StreetView ImageMap //-------------------------------------------------------------------------------------- - // http://cbk0.google.com/cbk?output=overlay&zoom=12&x=2045&y=1361&cb_client=api var street = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var X = coord.x % (1 << zoom); // wrap @@ -299,26 +278,23 @@ function initialize() { tileSize: new google.maps.Size(256, 256), isPng: true }); + //====================================================================================== // Add the Street view Image Map //-------------------------------------------------------------------------------------- map.overlayMapTypes.setAt(1, street); //============================================================================================== +} - -} // end init - -var mapbutt = "<?php echo $_GET['map']; ?>"; -var svbutt = "<?php echo $_GET['streetview']; ?>"; function toggleStreetView() { - var toggle = panorama.getVisible(); - if (toggle == false) { - panorama.setVisible(true); - document.myForm.butt1.value=mapbutt; - } else { - panorama.setVisible(false); - document.myForm.butt1.value=svbutt; - } + var toggle = panorama.getVisible(); + if (toggle == false) { + panorama.setVisible(true); + document.myForm.butt1.value = "<?php echo WT_I18N::translate('Google Maps™'); ?>"; + } else { + panorama.setVisible(false); + document.myForm.butt1.value = "<?php echo WT_I18N::translate('Google Street View™'); ?>"; + } } function resetview() { @@ -330,70 +306,46 @@ google.maps.event.addDomListener(window, 'load', initialize); </script> </head> + <body> + <style> + #mapCanvas { + width: 520px; + height: 350px; + margin: 0 auto; + margin-top: -10px; + border:1px solid black; + } + #infoPanel { + display: none; + margin: 0 auto; + margin-top: 5px; + } + #infoPanel div { + display: none; + margin-bottom: 5px; + background: #ffffff; + } + div { + text-align: center; + } + </style> -<body> - - <style> -/* Fixed widths don't work well with different DPI settings or some translations - #butt0 { - width:105px; - } - #butt1{ - width:120px; - } - #butt2 { - width:90px; - } -*/ - #mapCanvas { - width: 520px; - height: 350px; - margin: 0 auto; - margin-top: -10px; - border:1px solid black; - // float: left; - } - #infoPanel { - display: none; - margin: 0 auto; - margin-top: 5px; - //float: left; - //margin-left: 10px; - } - #infoPanel div { - display: none; - margin-bottom: 5px; - background: #ffffff; - } - div { - text-align: center; - } - </style> - - <div id="toggle"> - <form name="myForm" title="myForm"> - <?php - $map = $_GET['map']; - $reset = $_GET['reset']; - echo '<input id="butt1" name ="butt1" type="button" value="', $map, '" onclick="toggleStreetView();"></input>'; - echo '<input id="butt2" name ="butt2" type="button" value="', $reset, '" onclick="resetview();"></input>'; - ?> - - </form> - </div> - - <div id="mapCanvas"> - - </div> + <div id="toggle"> + <form name="myForm" title="myForm"> + <?php + echo '<input id="butt1" name ="butt1" type="button" value="', WT_I18N::translate('Google Maps™'), '" onclick="toggleStreetView();"></input>'; + echo '<input id="butt2" name ="butt2" type="button" value="', WT_I18N::translate('Reset'), '" onclick="resetview();"></input>'; + ?> + </form> + </div> - <div id="infoPanel"> - <!-- <b>Marker status:</b> --> - <div id="markerStatus"><em>Click and drag the marker.</em></div> -<!-- <b>Current position:</b> --> - <div id="info" ></div> -<!-- <b>Closest matching address:</b> --> - <div id="address"></div> - </div> + <div id="mapCanvas"> + </div> -</body> + <div id="infoPanel"> + <div id="markerStatus"><em>Click and drag the marker.</em></div> + <div id="info" ></div> + <div id="address"></div> + </div> + </body> </html> |
