summaryrefslogtreecommitdiff
path: root/modules_v3/googlemap
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-08-04 19:03:17 +0000
committerfisharebest <fisharebest@gmail.com>2011-08-04 19:03:17 +0000
commit3a66749533ae4ec372c95f7b0a6363efa4f5d294 (patch)
tree48931d265ee51c08f56820a767237975b00ebc3a /modules_v3/googlemap
parentd83d060a1ac10dc72134c3d4804e89b04cc68ad6 (diff)
downloadwebtrees-3a66749533ae4ec372c95f7b0a6363efa4f5d294.tar.gz
webtrees-3a66749533ae4ec372c95f7b0a6363efa4f5d294.tar.bz2
webtrees-3a66749533ae4ec372c95f7b0a6363efa4f5d294.zip
#821050 - Error calling page after update to 1.2.2
Diffstat (limited to 'modules_v3/googlemap')
-rw-r--r--modules_v3/googlemap/admin_editconfig.php407
-rw-r--r--modules_v3/googlemap/admin_placecheck.php379
-rw-r--r--modules_v3/googlemap/admin_places.php660
-rw-r--r--modules_v3/googlemap/css/googlemap_style.css60
-rw-r--r--modules_v3/googlemap/css/wt_v3_googlemap.css268
-rw-r--r--modules_v3/googlemap/css/wt_v3_places_edit.css37
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_0_1.php62
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_1_2.php59
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_2_3.php40
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_3_4.php45
-rw-r--r--modules_v3/googlemap/defaultconfig.php160
-rw-r--r--modules_v3/googlemap/flags.php256
-rw-r--r--modules_v3/googlemap/googlemap.php640
-rw-r--r--modules_v3/googlemap/googlemap_readme.txt69
-rw-r--r--modules_v3/googlemap/help_text.php283
-rw-r--r--modules_v3/googlemap/images/css_sprite_facts.pngbin0 -> 33977 bytes
-rw-r--r--modules_v3/googlemap/images/flag_shadow.pngbin0 -> 625 bytes
-rw-r--r--modules_v3/googlemap/images/icon1.pngbin0 -> 874 bytes
-rw-r--r--modules_v3/googlemap/images/icon2.pngbin0 -> 770 bytes
-rw-r--r--modules_v3/googlemap/images/icon2L.pngbin0 -> 1284 bytes
-rw-r--r--modules_v3/googlemap/images/icon2Ls.pngbin0 -> 1005 bytes
-rw-r--r--modules_v3/googlemap/images/icon2R.pngbin0 -> 1245 bytes
-rw-r--r--modules_v3/googlemap/images/icon2Rs.pngbin0 -> 939 bytes
-rw-r--r--modules_v3/googlemap/images/icon3.pngbin0 -> 772 bytes
-rw-r--r--modules_v3/googlemap/images/icon3L.pngbin0 -> 1215 bytes
-rw-r--r--modules_v3/googlemap/images/icon3Ls.pngbin0 -> 927 bytes
-rw-r--r--modules_v3/googlemap/images/icon3R.pngbin0 -> 1179 bytes
-rw-r--r--modules_v3/googlemap/images/icon3Rs.pngbin0 -> 873 bytes
-rw-r--r--modules_v3/googlemap/images/icon4.pngbin0 -> 851 bytes
-rw-r--r--modules_v3/googlemap/images/icon4L.pngbin0 -> 1160 bytes
-rw-r--r--modules_v3/googlemap/images/icon4Ls.pngbin0 -> 985 bytes
-rw-r--r--modules_v3/googlemap/images/icon4R.pngbin0 -> 1153 bytes
-rw-r--r--modules_v3/googlemap/images/icon4Rs.pngbin0 -> 893 bytes
-rw-r--r--modules_v3/googlemap/images/icon5.pngbin0 -> 803 bytes
-rw-r--r--modules_v3/googlemap/images/icon5L.pngbin0 -> 1278 bytes
-rw-r--r--modules_v3/googlemap/images/icon5Ls.pngbin0 -> 794 bytes
-rw-r--r--modules_v3/googlemap/images/icon5R.pngbin0 -> 1236 bytes
-rw-r--r--modules_v3/googlemap/images/icon5Rs.pngbin0 -> 780 bytes
-rw-r--r--modules_v3/googlemap/images/icon6.pngbin0 -> 810 bytes
-rw-r--r--modules_v3/googlemap/images/icon6L.pngbin0 -> 1267 bytes
-rw-r--r--modules_v3/googlemap/images/icon6Ls.pngbin0 -> 991 bytes
-rw-r--r--modules_v3/googlemap/images/icon6R.pngbin0 -> 1224 bytes
-rw-r--r--modules_v3/googlemap/images/icon6Rs.pngbin0 -> 901 bytes
-rw-r--r--modules_v3/googlemap/images/icon7.pngbin0 -> 959 bytes
-rw-r--r--modules_v3/googlemap/images/icon7L.pngbin0 -> 1341 bytes
-rw-r--r--modules_v3/googlemap/images/icon7Ls.pngbin0 -> 1046 bytes
-rw-r--r--modules_v3/googlemap/images/icon7R.pngbin0 -> 1304 bytes
-rw-r--r--modules_v3/googlemap/images/icon7Rs.pngbin0 -> 947 bytes
-rw-r--r--modules_v3/googlemap/images/icon8.pngbin0 -> 928 bytes
-rw-r--r--modules_v3/googlemap/images/icon8L.pngbin0 -> 1260 bytes
-rw-r--r--modules_v3/googlemap/images/icon8Ls.pngbin0 -> 973 bytes
-rw-r--r--modules_v3/googlemap/images/icon8R.pngbin0 -> 1224 bytes
-rw-r--r--modules_v3/googlemap/images/icon8Rs.pngbin0 -> 880 bytes
-rw-r--r--modules_v3/googlemap/images/marker_green.pngbin0 -> 793 bytes
-rw-r--r--modules_v3/googlemap/images/marker_yellow.pngbin0 -> 894 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-0.pngbin0 -> 1138 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-1.pngbin0 -> 1175 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-10.pngbin0 -> 1392 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-11.pngbin0 -> 1239 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-12.pngbin0 -> 989 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-13.pngbin0 -> 1194 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-14.pngbin0 -> 1277 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-15.pngbin0 -> 1151 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-16.pngbin0 -> 1569 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-17.pngbin0 -> 1477 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-18.pngbin0 -> 1490 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-19.pngbin0 -> 1422 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-2.pngbin0 -> 1186 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-20.pngbin0 -> 1207 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-3.pngbin0 -> 1119 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-4.pngbin0 -> 987 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-5.pngbin0 -> 1248 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-6.pngbin0 -> 1428 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-7.pngbin0 -> 1614 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-8.pngbin0 -> 1436 bytes
-rw-r--r--modules_v3/googlemap/images/panda-icons/panda-9.pngbin0 -> 1489 bytes
-rw-r--r--modules_v3/googlemap/images/pedigree_map.gifbin0 -> 1328 bytes
-rw-r--r--modules_v3/googlemap/images/shadow-left-large.pngbin0 -> 894 bytes
-rw-r--r--modules_v3/googlemap/images/shadow-left-small.pngbin0 -> 649 bytes
-rw-r--r--modules_v3/googlemap/images/shadow-right-large.pngbin0 -> 1015 bytes
-rw-r--r--modules_v3/googlemap/images/shadow-right-small.pngbin0 -> 695 bytes
-rw-r--r--modules_v3/googlemap/images/shadow50.pngbin0 -> 711 bytes
-rw-r--r--modules_v3/googlemap/images/sq1.pngbin0 -> 246 bytes
-rw-r--r--modules_v3/googlemap/images/sq2.pngbin0 -> 189 bytes
-rw-r--r--modules_v3/googlemap/images/sq3.pngbin0 -> 188 bytes
-rw-r--r--modules_v3/googlemap/images/sq4.pngbin0 -> 188 bytes
-rw-r--r--modules_v3/googlemap/images/sq5.pngbin0 -> 189 bytes
-rw-r--r--modules_v3/googlemap/images/sq6.pngbin0 -> 189 bytes
-rw-r--r--modules_v3/googlemap/images/sq7.pngbin0 -> 189 bytes
-rw-r--r--modules_v3/googlemap/images/sq8.pngbin0 -> 188 bytes
-rw-r--r--modules_v3/googlemap/images/transparent-left-large.pngbin0 -> 996 bytes
-rw-r--r--modules_v3/googlemap/images/transparent-left-small.pngbin0 -> 996 bytes
-rw-r--r--modules_v3/googlemap/images/transparent-right-large.pngbin0 -> 977 bytes
-rw-r--r--modules_v3/googlemap/images/transparent-right-small.pngbin0 -> 977 bytes
-rw-r--r--modules_v3/googlemap/index.php34
-rw-r--r--modules_v3/googlemap/module.php182
-rw-r--r--modules_v3/googlemap/pedigree_map.php288
-rw-r--r--modules_v3/googlemap/placehierarchy.php666
-rw-r--r--modules_v3/googlemap/places_edit.php371
-rw-r--r--modules_v3/googlemap/util.js84
-rw-r--r--modules_v3/googlemap/wt_v3_googlemap.js.php732
-rw-r--r--modules_v3/googlemap/wt_v3_pedigree_map.js.php681
-rw-r--r--modules_v3/googlemap/wt_v3_places_edit.js.php463
-rw-r--r--modules_v3/googlemap/wt_v3_places_edit_overlays.js.php125
-rw-r--r--modules_v3/googlemap/wt_v3_street_view.php430
105 files changed, 7481 insertions, 0 deletions
diff --git a/modules_v3/googlemap/admin_editconfig.php b/modules_v3/googlemap/admin_editconfig.php
new file mode 100644
index 0000000000..1bf8f363bd
--- /dev/null
+++ b/modules_v3/googlemap/admin_editconfig.php
@@ -0,0 +1,407 @@
+<?php
+// Online UI for editing site configuration variables
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// @version $Id$
+
+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=safe_REQUEST($_REQUEST, 'action');
+
+function print_level_config_table($level) {
+ global $GM_MARKER_COLOR, $GM_MARKER_SIZE, $GM_PREFIX;
+ global $GM_POSTFIX, $GM_PRE_POST_MODE, $GM_MAX_NOF_LEVELS;
+?>
+ <div id="level<?php echo $level; ?>" style="display:<?php if ($GM_MAX_NOF_LEVELS >= $level) {echo "block";} else {echo "none";} ?>">
+ <table id="gm_levels">
+ <tr>
+ <th colspan="2">
+ <?php
+ if ($level==1) {
+ echo WT_I18N::translate('Country');
+ } else {
+ echo WT_I18N::translate('Level'), " ", $level;
+ }
+ ?>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <?php echo WT_I18N::translate('Prefix'), help_link('GM_NAME_PREFIX','googlemap'); ?>
+ </td>
+ <td>
+ <input type="text" name="NEW_GM_PREFIX_<?php echo $level; ?>" value="<?php echo $GM_PREFIX[$level]; ?>" size="20" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <?php echo WT_I18N::translate('Postfix'), help_link('GM_NAME_POSTFIX','googlemap'); ?>
+ </td>
+ <td>
+ <input type="text" name="NEW_GM_POSTFIX_<?php echo $level; ?>" value="<?php echo $GM_POSTFIX[$level]; ?>" size="20" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <?php echo WT_I18N::translate('Prefix / Postfix order'), help_link('GM_NAME_PRE_POST','googlemap'); ?>
+ </td>
+ <td>
+ <select name="NEW_GM_PRE_POST_MODE_<?php echo $level; ?>" dir="ltr" onchange="showSelectedLevels()">
+ <option value="0"<?php if ($GM_PRE_POST_MODE[$level] == 0) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('No pre/postfix'); ?></option>
+ <option value="1"<?php if ($GM_PRE_POST_MODE[$level] == 1) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Normal, prefix, postfix, both'); ?></option>
+ <option value="2"<?php if ($GM_PRE_POST_MODE[$level] == 2) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Normal, postfix, prefix, both'); ?></option>
+ <option value="3"<?php if ($GM_PRE_POST_MODE[$level] == 3) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Prefix, postfix, both, normal'); ?></option>
+ <option value="4"<?php if ($GM_PRE_POST_MODE[$level] == 4) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Postfix, prefix, both, normal'); ?></option>
+ <option value="5"<?php if ($GM_PRE_POST_MODE[$level] == 5) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Prefix, postfix, normal, both'); ?></option>
+ <option value="6"<?php if ($GM_PRE_POST_MODE[$level] == 6) echo ' selected="selected"'; ?>><?php echo WT_I18N::translate('Postfix, prefix, normal, both'); ?></option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </div>
+<?php
+}
+
+print_header(WT_I18N::translate('Google Maps configuration'));
+
+
+if (!WT_USER_IS_ADMIN) {
+ echo '<div>', WT_I18N::translate('Page only for Administrators'), '</div>';
+ print_footer();
+ exit;
+} else {
+ echo '<table id="gm_config"><tr>',
+ '<th><a ', (safe_GET('mod_action')=="admin_editconfig" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_places" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_placecheck" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_I18N::translate('Place Check'), '</a>', help_link('GOOGLEMAP_PLACECHECK','googlemap'), '</th>',
+ '</tr></table>';
+}
+
+if ($action=="update" && !isset($security_user)) {
+ set_module_setting('googlemap', 'GM_MAP_TYPE', $_POST['NEW_GM_MAP_TYPE']);
+ set_module_setting('googlemap', 'GM_USE_STREETVIEW', $_POST['NEW_GM_USE_STREETVIEW']);
+ set_module_setting('googlemap', 'GM_MIN_ZOOM', $_POST['NEW_GM_MIN_ZOOM']);
+ set_module_setting('googlemap', 'GM_MAX_ZOOM', $_POST['NEW_GM_MAX_ZOOM']);
+ set_module_setting('googlemap', 'GM_XSIZE', $_POST['NEW_GM_XSIZE']);
+ set_module_setting('googlemap', 'GM_YSIZE', $_POST['NEW_GM_YSIZE']);
+ set_module_setting('googlemap', 'GM_PRECISION_0', $_POST['NEW_GM_PRECISION_0']);
+ set_module_setting('googlemap', 'GM_PRECISION_1', $_POST['NEW_GM_PRECISION_1']);
+ set_module_setting('googlemap', 'GM_PRECISION_2', $_POST['NEW_GM_PRECISION_2']);
+ set_module_setting('googlemap', 'GM_PRECISION_3', $_POST['NEW_GM_PRECISION_3']);
+ set_module_setting('googlemap', 'GM_PRECISION_4', $_POST['NEW_GM_PRECISION_4']);
+ set_module_setting('googlemap', 'GM_PRECISION_5', $_POST['NEW_GM_PRECISION_5']);
+ set_module_setting('googlemap', 'GM_DEFAULT_TOP_VALUE', $_POST['NEW_GM_DEFAULT_TOP_LEVEL']);
+ set_module_setting('googlemap', 'GM_MAX_NOF_LEVELS', $_POST['NEW_GM_LEVEL_COUNT']);
+ set_module_setting('googlemap', 'GM_COORD', $_POST['NEW_GM_COORD']);
+ set_module_setting('googlemap', 'GM_PLACE_HIERARCHY', $_POST['NEW_GM_PLACE_HIERARCHY']);
+ set_module_setting('googlemap', 'GM_PH_XSIZE', $_POST['NEW_GM_PH_XSIZE']);
+ set_module_setting('googlemap', 'GM_PH_YSIZE', $_POST['NEW_GM_PH_YSIZE']);
+ set_module_setting('googlemap', 'GM_PH_MARKER', $_POST['NEW_GM_PH_MARKER']);
+ set_module_setting('googlemap', 'GM_DISP_SHORT_PLACE', $_POST['NEW_GM_DISP_SHORT_PLACE']);
+ set_module_setting('googlemap', 'GM_PH_WHEEL', $_POST['NEW_GM_PH_WHEEL']);
+ set_module_setting('googlemap', 'GM_PH_CONTROLS', $_POST['NEW_GM_PH_CONTROLS']);
+ set_module_setting('googlemap', 'GM_DISP_COUNT', $_POST['NEW_GM_DISP_COUNT']);
+
+ for ($i=1; $i<=9; $i++) {
+ set_module_setting('googlemap', 'GM_PREFIX_'.$i, $_POST['NEW_GM_PREFIX_'.$i]);
+ set_module_setting('googlemap', 'GM_POSTFIX_'.$i, $_POST['NEW_GM_POSTFIX_'.$i]);
+ set_module_setting('googlemap', 'GM_PRE_POST_MODE_'.$i, $_POST['NEW_GM_PRE_POST_MODE_'.$i]);
+ }
+
+ AddToLog('Googlemap config updated', 'config');
+ // read the config file again, to set the vars
+ require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+}
+
+?>
+<script type="text/javascript">
+<!--
+ function showSelectedLevels() {
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 1) {
+ document.getElementById('level1').style.display = 'block';
+ } else {
+ document.getElementById('level1').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 2) {
+ document.getElementById('level2').style.display = 'block';
+ } else {
+ document.getElementById('level2').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 3) {
+ document.getElementById('level3').style.display = 'block';
+ } else {
+ document.getElementById('level3').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 4) {
+ document.getElementById('level4').style.display = 'block';
+ } else {
+ document.getElementById('level4').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 5) {
+ document.getElementById('level5').style.display = 'block';
+ } else {
+ document.getElementById('level5').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 6) {
+ document.getElementById('level6').style.display = 'block';
+ } else {
+ document.getElementById('level6').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 7) {
+ document.getElementById('level7').style.display = 'block';
+ } else {
+ document.getElementById('level7').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 8) {
+ document.getElementById('level8').style.display = 'block';
+ } else {
+ document.getElementById('level8').style.display = 'none';
+ }
+ if (document.configform.NEW_GM_LEVEL_COUNT.value >= 9) {
+ document.getElementById('level9').style.display = 'block';
+ } else {
+ document.getElementById('level9').style.display = 'none';
+ }
+ }
+
+ //-->
+</script>
+
+
+<?php
+echo WT_JS_START;
+?>
+jQuery(document).ready(function() {
+jQuery("#tabs").tabs();
+});
+<?php
+echo WT_JS_END;
+echo '<div id="tabs">',
+ '<ul>',
+ '<li><a href="#gm_basic"><span>', WT_I18N::translate('Basic'), '</span></a></li>',
+ '<li><a href="#gm_advanced"><span>', WT_I18N::translate('Advanced'), '</span></a></li>',
+ '</ul>';
+?>
+<form method="post" name="configform" action="module.php?mod=googlemap&mod_action=admin_editconfig">
+<input type="hidden" name="action" value="update" />
+
+<div id="gm_basic">
+<table class="gm_edit_config">
+ <tr>
+ <th><?php echo WT_I18N::translate('Default map type'), help_link('GOOGLEMAP_MAP_TYPE','googlemap'); ?></th>
+ <td>
+ <select name="NEW_GM_MAP_TYPE">
+ <option value="ROADMAP" <?php if ($GOOGLEMAP_MAP_TYPE=="ROADMAP") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Map'); ?></option>
+ <option value="SATELLITE" <?php if ($GOOGLEMAP_MAP_TYPE=="SATELLITE") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Satellite'); ?></option>
+ <option value="HYBRID" <?php if ($GOOGLEMAP_MAP_TYPE=="HYBRID") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Hybrid'); ?></option>
+ <option value="TERRAIN" <?php if ($GOOGLEMAP_MAP_TYPE=="TERRAIN") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Terrain'); ?></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Enable Google Street View'), help_link('STREETVIEW_ENABLE','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_USE_STREETVIEW', get_module_setting('googlemap', 'GM_USE_STREETVIEW')); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Size of map (in pixels)'), help_link('GOOGLEMAP_MAP_SIZE','googlemap'); ?></th>
+ <td>
+ <?php echo WT_I18N::translate('Width'); ?>
+ <input type="text" name="NEW_GM_XSIZE" value="<?php echo $GOOGLEMAP_XSIZE; ?>" size="10" />
+ <?php echo WT_I18N::translate('Height'); ?>
+ <input type="text" name="NEW_GM_YSIZE" value="<?php echo $GOOGLEMAP_YSIZE; ?>" size="10" />
+ </td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Use Googlemap for Place Hierarchy'), help_link('GOOGLEMAP_PH','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_PLACE_HIERARCHY', get_module_setting('googlemap', 'GM_PLACE_HIERARCHY')); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Size of Place Hierarchy map (in pixels)'), help_link('GOOGLEMAP_PH_MAP_SIZE','googlemap'); ?></th>
+ <td>
+ <?php echo WT_I18N::translate('Width'); ?>
+ <input type="text" name="NEW_GM_PH_XSIZE" value="<?php echo $GOOGLEMAP_PH_XSIZE; ?>" size="10" />
+ <?php echo WT_I18N::translate('Height'); ?>
+ <input type="text" name="NEW_GM_PH_YSIZE" value="<?php echo $GOOGLEMAP_PH_YSIZE; ?>" size="10" />
+ </td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Type of place markers in Place Hierarchy'), help_link('GOOGLEMAP_PH_MARKER','googlemap'); ?></th>
+ <td>
+ <select name="NEW_GM_PH_MARKER">
+ <option value="G_DEFAULT_ICON" <?php if ($GOOGLEMAP_PH_MARKER=="G_DEFAULT_ICON") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Standard'); ?></option>
+ <option value="G_FLAG" <?php if ($GOOGLEMAP_PH_MARKER=="G_FLAG") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Flag'); ?></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Display short placenames'), help_link('GM_DISP_SHORT_PLACE','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_DISP_SHORT_PLACE', $GM_DISP_SHORT_PLACE); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Display indis and families count'), help_link('GM_DISP_COUNT','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_DISP_COUNT', $GM_DISP_COUNT); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Use mouse wheel for zoom'), help_link('GOOGLEMAP_PH_WHEEL','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_PH_WHEEL', $GOOGLEMAP_PH_WHEEL); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Hide map controls'), help_link('GOOGLEMAP_PH_CONTROLS','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_PH_CONTROLS', $GOOGLEMAP_PH_CONTROLS); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Display Map Co-ordinates'), help_link('GOOGLEMAP_COORD','googlemap'); ?></th>
+ <td><?php echo edit_field_yes_no('NEW_GM_COORD', $GOOGLEMAP_COORD); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Zoom factor of map'), help_link('GOOGLEMAP_MAP_ZOOM','googlemap'); ?></th>
+ <td>
+ <?php echo WT_I18N::translate('minimum'); ?>: <select name="NEW_GM_MIN_ZOOM">
+ <?php for ($j=1; $j < 15; $j++) { ?>
+ <option value="<?php echo $j, "\""; if ($GOOGLEMAP_MIN_ZOOM==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>
+ <?php echo WT_I18N::translate('maximum'); ?>: <select name="NEW_GM_MAX_ZOOM">
+ <?php for ($j=1; $j < 17; $j++) { ?>
+ <option value="<?php echo $j, "\""; if ($GOOGLEMAP_MAX_ZOOM==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>
+ </td>
+ </tr>
+</table>
+</div>
+<div id="gm_advanced">
+<table class="gm_edit_config">
+ <tr>
+ <th><?php echo WT_I18N::translate('Precision of the latitude and longitude'), help_link('GOOGLEMAP_PRECISION','googlemap'); ?></th>
+ <td>
+ <table>
+ <tr>
+ <td><?php echo WT_I18N::translate('Country'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_0">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_0==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ <tr>
+ <td><?php echo WT_I18N::translate('State'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_1">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_1==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ <tr>
+ <td><?php echo WT_I18N::translate('City'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_2">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_2==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ <tr><td><?php echo WT_I18N::translate('Neighborhood'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_3">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_3==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ <tr><td><?php echo WT_I18N::translate('House'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_4">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_4==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ <tr><td><?php echo WT_I18N::translate('Max'); ?>&nbsp;&nbsp;</td>
+ <td><select name="NEW_GM_PRECISION_5">
+ <?php for ($j=0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>"<?php if ($GOOGLEMAP_PRECISION_5==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php } ?>
+ </select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Default value for top-level'), help_link('GM_DEFAULT_LEVEL_0','googlemap'); ?></th>
+ <td><input type="text" name="NEW_GM_DEFAULT_TOP_LEVEL" value="<?php echo $GM_DEFAULT_TOP_VALUE; ?>" size="20" /></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Number of levels'), help_link('GM_NOF_LEVELS','googlemap'); ?></th>
+ <td>
+ <select name="NEW_GM_LEVEL_COUNT" dir="ltr" onchange="showSelectedLevels()">
+ <option value="1"<?php if ($GM_MAX_NOF_LEVELS == 1) echo " selected=\"selected\""; ?>>1</option>
+ <option value="2"<?php if ($GM_MAX_NOF_LEVELS == 2) echo " selected=\"selected\""; ?>>2</option>
+ <option value="3"<?php if ($GM_MAX_NOF_LEVELS == 3) echo " selected=\"selected\""; ?>>3</option>
+ <option value="4"<?php if ($GM_MAX_NOF_LEVELS == 4) echo " selected=\"selected\""; ?>>4</option>
+ <option value="5"<?php if ($GM_MAX_NOF_LEVELS == 5) echo " selected=\"selected\""; ?>>5</option>
+ <option value="6"<?php if ($GM_MAX_NOF_LEVELS == 6) echo " selected=\"selected\""; ?>>6</option>
+ <option value="7"<?php if ($GM_MAX_NOF_LEVELS == 7) echo " selected=\"selected\""; ?>>7</option>
+ <option value="8"<?php if ($GM_MAX_NOF_LEVELS == 8) echo " selected=\"selected\""; ?>>8</option>
+ <option value="9"<?php if ($GM_MAX_NOF_LEVELS == 9) echo " selected=\"selected\""; ?>>9</option>
+ </select>
+ </td>
+ </tr>
+ <tr><th colspan="2"><?php echo WT_I18N::translate('Configuration per level'); ?></th></tr>
+ <tr><td colspan="2">
+ <table id="gm_levels">
+ <?php
+ echo
+ '<tr><td>', print_level_config_table(1), '</td><td>', print_level_config_table(2), '</td></tr>',
+ '<tr><td>', print_level_config_table(3), '</td><td>', print_level_config_table(4), '</td></tr>',
+ '<tr><td>', print_level_config_table(5), '</td><td>', print_level_config_table(6), '</td></tr>',
+ '<tr><td>', print_level_config_table(7), '</td><td>', print_level_config_table(8), '</td></tr>',
+ '<tr><td>', print_level_config_table(9), '</td><td>&nbsp;</td></tr>';
+ ?>
+ </table>
+ </td></tr>
+</table>
+</div>
+</div>
+<p>
+ <input type="submit" value="<?php echo WT_I18N::translate('Save'); ?>" onclick="closeHelp();" />
+ &nbsp;&nbsp;
+ <input type="reset" value="<?php echo WT_I18N::translate('Reset'); ?>" />
+</p>
+</form>
+<?php
+
+if (empty($SEARCH_SPIDER)) {
+ print_footer();
+} else {
+ echo WT_I18N::translate('Search Engine Spider Detected'), ": ", $SEARCH_SPIDER;
+ echo "</div></body></html>";
+}
diff --git a/modules_v3/googlemap/admin_placecheck.php b/modules_v3/googlemap/admin_placecheck.php
new file mode 100644
index 0000000000..c41e7d32c3
--- /dev/null
+++ b/modules_v3/googlemap/admin_placecheck.php
@@ -0,0 +1,379 @@
+<?php
+// Provides a way to compare places in your family tree file with the matching
+// entries in the Google Maps 'placelocations' table.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License or,
+// at your discretion, any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+if (!WT_USER_IS_ADMIN) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'admin.php');
+ exit;
+}
+
+$action =safe_POST ('action' );
+$gedcom_id=safe_POST ('gedcom_id', array_keys(get_all_gedcoms()), WT_GED_ID );
+$openinnew=safe_POST_bool('openinnew' );
+$country =safe_POST ('country', WT_REGEX_UNSAFE, '' );
+if (!$country) {
+ // allow placelist to link directly to a specific country/state
+ $country=safe_GET ('country', WT_REGEX_UNSAFE, 'XYZ' );
+}
+$state =safe_POST ('state', WT_REGEX_UNSAFE, '' );
+if (!$state) {
+ $state=safe_GET ('state', WT_REGEX_UNSAFE, 'XYZ' );
+}
+if (isset($_REQUEST['show_changes']) && $_REQUEST['show_changes']=='yes') {
+ $show_changes = true;
+} else {
+ $show_changes = false;
+}
+
+if ($show_changes && !empty($_SESSION['placecheck_gedcom_id'])) {
+ $gedcom_id = $_SESSION['placecheck_gedcom_id'];
+} else {
+ $_SESSION['placecheck_gedcom_id'] = $gedcom_id;
+}
+if ($show_changes && !empty($_SESSION['placecheck_openinnew'])) {
+ $openinnew = $_SESSION['placecheck_openinnew'];
+} else {
+ $_SESSION['placecheck_openinnew'] = $openinnew;
+}
+if ($show_changes && !empty($_SESSION['placecheck_country'])) {
+ $country = $_SESSION['placecheck_country'];
+} else {
+ $_SESSION['placecheck_country'] = $country;
+}
+if ($show_changes && !empty($_SESSION['placecheck_state'])) {
+ $state = $_SESSION['placecheck_state'];
+} else {
+ $_SESSION['placecheck_state'] = $state;
+}
+
+// Must be an admin user to use this module
+if (!WT_USER_GEDCOM_ADMIN) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'login.php?url=placelist.php');
+ exit;
+}
+print_header(WT_I18N::translate('Place Check').' - '.WT_GEDCOM);
+
+$target=$openinnew ? 'target="_blank"' : '';
+
+echo '<table id="gm_config"><tr>',
+ '<th><a ', (safe_GET('mod_action')=="admin_editconfig" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_places" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=="admin_placecheck" ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_I18N::translate('Place Check'), '</a>', help_link('GOOGLEMAP_PLACECHECK','googlemap'), '</th>',
+'</tr></table>';
+
+//Start of User Defined options
+echo '<table id="gm_check_outer">';
+echo '<form method="post" name="placecheck" action="module.php?mod=googlemap&amp;mod_action=admin_placecheck">';
+echo '<tr valign="top">';
+echo '<td>';
+echo '<table class="gm_check_top" align="left">';
+echo '<tr><th colspan="2">', WT_I18N::translate('PlaceCheck List Options'), '</th></tr>';
+//Option box to select gedcom
+echo '<tr><td>', WT_I18N::translate('Family tree'), '</td>';
+echo '<td><select name="gedcom_id">';
+foreach (get_all_gedcoms() as $ged_id=>$gedcom) {
+ echo '<option value="', $ged_id, '"', $ged_id==$gedcom_id?' selected="selected"':'', '>', get_gedcom_setting($ged_id, 'title'), '</option>';
+}
+echo '</select></td></tr>';
+//Option box for 'Open in new window'
+echo '<tr><td>', WT_I18N::translate('Open links in'), '</td>';
+echo '<td><select name="openinnew">';
+echo '<option value="0" ', $openinnew?' selected="selected"':'', '>', WT_I18N::translate('Same tab/window'), '</option>';
+echo '<option value="1" ', $openinnew?' selected="selected"':'', '>', WT_I18N::translate('New tab/window'), '</option>';
+echo '</select></td></tr>';
+//Option box to select Country within Gedcom
+echo '<tr><td>', WT_I18N::translate('Country'), '</td>';
+echo '<td><select name="country">';
+echo '<option value="XYZ" selected="selected">', /* I18N: first/default option in a drop-down listbox */ WT_I18N::translate('&lt;select&gt;'), '</option>';
+echo '<option value="XYZ">', WT_I18N::translate('All'), '</option>';
+$rows=
+ WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")
+ ->fetchAssoc();
+foreach ($rows as $id=>$place) {
+ echo '<option value="', $place, '"';
+ if ($place==$country) {
+ echo ' selected="selected"';
+ $par_id=$id;
+ }
+ echo '>', $place, '</option>';
+}
+echo '</select></td></tr>';
+
+//Option box to select level 2 place within the selected Country
+if ($country!='XYZ') {
+ echo '<tr><td>', /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'), '</td>';
+ echo '<td><select name="state">';
+ echo '<option value="XYZ" selected="selected">', WT_I18N::translate('&lt;select&gt;'), '</option>';
+ echo '<option value="XYZ">', WT_I18N::translate('All'), '</option>';
+ $places=
+ WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")
+ ->execute(array($par_id))
+ ->fetchOneColumn();
+ foreach ($places as $place) {
+ echo '<option value="', $place, '"', $place==$state?' selected="selected"':'', '>', $place, '</option>';
+ }
+ echo '</select></td></tr>';
+}
+echo '</table>';
+echo '</td>';
+//Show Filter table
+if (!isset ($_POST['matching'])) {$matching=false;} else {$matching=true;}
+echo '<td>';
+echo '<table class="gm_check_top" align="center">';
+echo '<tr><th colspan="2">';
+echo WT_I18N::translate('List filtering options'), help_link('PLACECHECK_FILTER','googlemap');
+echo '</th></tr><tr><td>';
+echo WT_I18N::translate('Include fully matched places: '), help_link('PLACECHECK_MATCH','googlemap');
+echo '</td><td><input type="checkbox" name="matching" value="active"';
+if ($matching) {
+ echo ' checked="checked"';
+}
+if ($show_changes) {
+ $action = 'go';
+}
+echo '></td></tr>';
+echo '</table>';
+echo '</td>';
+echo '<td>';
+echo '<input type="submit" value="', WT_I18N::translate('Show'), '"', $target, '><input type="hidden" name="action" value="go">';
+echo '</td>';
+echo '</tr>';
+echo '</form>';
+echo '</table>';
+echo '<hr />';
+
+switch ($action) {
+case 'go':
+ //Identify gedcom file
+ echo "<div id=\"gm_check_title\"><span>", WT_I18N::translate('Place list for GEDCOM file'), ": </span>", htmlspecialchars(get_gedcom_setting($gedcom_id, 'title')), "</div>";
+ //Select all '2 PLAC ' tags in the file and create array
+ $place_list=array();
+ $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")
+ ->execute(array("%\n2 PLAC %", $gedcom_id))
+ ->fetchOneColumn();
+ foreach ($ged_data as $ged_datum) {
+ preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
+ foreach ($matches[1] as $match) {
+ $place_list[$match]=true;
+ }
+ }
+ $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?")
+ ->execute(array("%\n2 PLAC %", $gedcom_id))
+ ->fetchOneColumn();
+ foreach ($ged_data as $ged_datum) {
+ preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
+ foreach ($matches[1] as $match) {
+ $place_list[$match]=true;
+ }
+ }
+ // Unique list of places
+ $place_list=array_keys($place_list);
+
+ // Apply_filter
+ if ($country=='XYZ') {
+ $filter='.*$';
+ } else {
+ $filter=preg_quote($country).'$';
+ if ($state!='XYZ') {
+ $filter=preg_quote($state).', '.$filter;
+ }
+ }
+ $place_list=preg_grep('/'.$filter.'/', $place_list);
+
+ //sort the array, limit to unique values, and count them
+ $place_parts=array();
+ usort($place_list, "utf8_strcasecmp");
+ $i=count($place_list);
+
+ //calculate maximum no. of levels to display
+ $x=0;
+ $max=0;
+ while ($x<$i) {
+ $levels=explode(",", $place_list[$x]);
+ $parts=count($levels);
+ if ($parts>$max) $max=$parts;
+ $x++;}
+ $x=0;
+
+ //scripts for edit, add and refresh
+ ?>
+ <script type="text/javascript">
+ <!--
+ function edit_place_location(placeid) {
+ window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid+"&"+sessionname+"="+sessionid, '_blank', 'top=50, left=50, width=680, height=550, resizable=1, scrollbars=1');
+ return false;
+ }
+
+ function add_place_location(placeid) {
+ window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid+"&"+sessionname+"="+sessionid, '_blank', 'top=50, left=50, width=680, height=550, resizable=1, scrollbars=1');
+ return false;
+ }
+ function showchanges() {
+ window.location='<?php echo $_SERVER["REQUEST_URI"]; ?>&show_changes=yes';
+ }
+ //-->
+ </script>
+ <?php
+
+ //start to produce the display table
+ $cols=0;
+ $span=$max*3+3;
+ echo "<div class='gm_check_details'>";
+ echo "<table class='gm_check_details'><tr>";
+ echo "<th rowspan='3'>", WT_I18N::translate('GEDCOM File Place Data<br />(2 PLAC tag)'), "</th>";
+ echo "<th colspan='", $span, "'>", WT_I18N::translate('GoogleMap Places Table Data'), "</th></tr>";
+ echo "<tr>";
+ while ($cols<$max) {
+ if ($cols == 0) {
+ echo "<th colspan='3'>", PrintReady(WT_I18N::translate('Country')), "</th>";
+ } else {
+ echo "<th colspan='3'>", PrintReady(WT_I18N::translate('Level')), "&nbsp;", $cols+1, "</th>";
+ }
+ $cols++;
+ }
+ echo "</tr><tr>";
+ $cols=0;
+ while ($cols<$max) {
+ echo "<th>", WT_Gedcom_Tag::getLabel('PLAC'), "</th><th>", WT_I18N::translate('Latitude'), "</th><th>", WT_I18N::translate('Longitude'), "</th></td>";
+ $cols++;
+ }
+ echo "</tr>";
+ $countrows=0;
+ while ($x<$i) {
+ $placestr="";
+ $levels=explode(",", $place_list[$x]);
+ $parts=count($levels);
+ $levels=array_reverse($levels);
+ $placestr.="<a href=\"placelist.php?action=show&amp;";
+ foreach ($levels as $pindex=>$ppart) {
+ $ppart=urlencode(trim($ppart));
+ $placestr.="parent[$pindex]=".$ppart."&amp;";
+ }
+ $placestr.="level=".count($levels);
+ $placestr.="\">".$place_list[$x]."</a>";
+ $gedplace="<tr><td>".$placestr."</td>";
+ $z=0;
+ $y=0;
+ $id=0;
+ $level=0;
+ $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels
+ $mapstr_edit="<a href=\"javascript:;\" onclick=\"edit_place_location('";
+ $mapstr_add="<a href=\"javascript:;\" onclick=\"add_place_location('";
+ $mapstr3="";
+ $mapstr4="";
+ $mapstr5="')\" title='";
+ $mapstr6="' >";
+ $mapstr7="')\">";
+ $mapstr8="</a>";
+ while ($z<$parts) {
+ if ($levels[$z]==' ' || $levels[$z]=='')
+ $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , ,
+
+ $levels[$z]=rtrim(ltrim($levels[$z]));
+
+ $placelist=create_possible_place_names($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name
+ foreach ($placelist as $key=>$placename) {
+ $row=
+ WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
+ ->execute(array($z, $id, $placename))
+ ->fetchOneRow(PDO::FETCH_ASSOC);
+ if (!empty($row['pl_id'])) {
+ $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db
+ break;
+ }
+ }
+ if ($row['pl_id']!='') {
+ $id=$row['pl_id'];
+ }
+
+ if ($row['pl_place']!='') {
+ $placestr2=$mapstr_edit.$id."&amp;level=".$level.$mapstr3.$mapstr5.WT_I18N::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8;
+ if ($row['pl_place']=='unknown')
+ $matched[$x]++;
+ } else {
+ if ($levels[$z]=="unknown") {
+ $placestr2=$mapstr_add.$id."&amp;level=".$level.$mapstr3.$mapstr7."<strong>".rtrim(ltrim(WT_I18N::translate('unknown')))."</strong>".$mapstr8;$matched[$x]++;
+ } else {
+ $placestr2=$mapstr_add.$id."&amp;place_name=".urlencode($levels[$z])."&amp;level=".$level.$mapstr3.$mapstr7.'<span class="error">'.rtrim(ltrim($levels[$z])).'</span>'.$mapstr8;$matched[$x]++;
+ }
+ }
+ $plac[$z]="<td>".$placestr2."</td>\n";
+ if ($row['pl_lati']=='0') {
+ $lati[$z]="<td class='error'><strong>".$row['pl_lati']."</strong></td>";
+ } else if ($row['pl_lati']!='') {
+ $lati[$z]="<td>".$row['pl_lati']."</td>";
+ } else {
+ $lati[$z]="<td class='error' align='center'><strong>X</strong></td>";$matched[$x]++;
+ }
+ if ($row['pl_long']=='0') {
+ $long[$z]="<td class='error'><strong>".$row['pl_long']."</strong></td>";
+ } else if ($row['pl_long']!='') {
+ $long[$z]="<td>".$row['pl_long']."</td>";
+ } else {
+ $long[$z]="<td class='error' align='center'><strong>X</strong></td>";$matched[$x]++;
+ }
+ $level++;
+ $mapstr3=$mapstr3."&amp;parent[".$z."]=".addslashes(PrintReady($row['pl_placerequested']));
+ $mapstr4=$mapstr4."&amp;parent[".$z."]=".addslashes(PrintReady(rtrim(ltrim($levels[$z]))));
+ $z++;
+ }
+ if ($matching) {
+ $matched[$x]=1;
+ }
+ if ($matched[$x]!=0) {
+ echo $gedplace;
+ $z=0;
+ while ($z<$max) {
+ if ($z<$parts) {
+ echo $plac[$z];
+ echo $lati[$z];
+ echo $long[$z];
+ } else {
+ echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";}
+ $z++;
+ }
+ echo "</tr>";
+ $countrows++;
+ }
+ $x++;
+ }
+
+ // echo final row of table
+ echo "<tr><td colspan=\"2\" class=\"accepted\">", /* I18N: A count of places */ WT_I18N::translate('Total places: %s', WT_I18N::number($countrows)), "</td></tr></table></div>";
+ break;
+default:
+ // Do not run until user selects a gedcom/place/etc.
+ // Instead, show some useful help info.
+ echo "<div class=\"gm_check_top accepted\">", WT_I18N::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), "</div>";
+ break;
+}
+
+//echo footers
+print_footer();
diff --git a/modules_v3/googlemap/admin_places.php b/modules_v3/googlemap/admin_places.php
new file mode 100644
index 0000000000..b37add05a9
--- /dev/null
+++ b/modules_v3/googlemap/admin_places.php
@@ -0,0 +1,660 @@
+<?php
+// Interface to edit place locations
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+
+global $WT_IMAGES;
+$action=safe_REQUEST($_REQUEST, 'action');
+if (isset($_REQUEST['parent'])) $parent=safe_REQUEST($_REQUEST, 'parent');
+if (isset($_REQUEST['inactive'])) $inactive=safe_GET_bool('inactive');
+if (isset($_REQUEST['mode'])) $mode=safe_REQUEST($_REQUEST, 'mode');
+if (isset($_REQUEST['deleteRecord'])) $deleteRecord=safe_REQUEST($_REQUEST, 'deleteRecord');
+
+if (!isset($parent)) $parent=0;
+if (!isset($inactive)) $inactive=false;
+
+// Take a place id and find its place in the hierarchy
+// Input: place ID
+// Output: ordered array of id=>name values, starting with the Top Level
+// e.g. array(0=>'Top Level', 16=>'England', 19=>'London', 217=>'Westminster');
+// NB This function exists in both places.php and places_edit.php
+function place_id_to_hierarchy($id) {
+ $statement=
+ WT_DB::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?");
+ $arr=array();
+ while ($id!=0) {
+ $row=$statement->execute(array($id))->fetchOneRow();
+ $arr=array($id=>$row->pl_place)+$arr;
+ $id=$row->pl_parent_id;
+ }
+ return $arr;
+}
+
+// NB This function exists in both admin_places.php and places_edit.php
+function getHighestIndex() {
+ return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne();
+}
+
+function getHighestLevel() {
+ return (int)WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne();
+}
+
+/**
+ * Find all of the places in the hierarchy
+ */
+function get_place_list_loc($parent_id, $inactive=false) {
+ if ($inactive) {
+ $rows=
+ WT_DB::prepare("SELECT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")
+ ->execute(array($parent_id))
+ ->fetchAll();
+ } else {
+ $rows=
+ WT_DB::prepare(
+ "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon".
+ " FROM `##placelocation`".
+ " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place AND `##placelocation`.pl_level=`##places`.p_level".
+ " WHERE pl_parent_id=? ORDER BY pl_place"
+ )
+ ->execute(array($parent_id))
+ ->fetchAll();
+ }
+
+ $placelist=array();
+ foreach ($rows as $row) {
+ $placelist[]=array('place_id'=>$row->pl_id, 'place'=>$row->pl_place, 'lati'=>$row->pl_lati, 'long'=>$row->pl_long, 'zoom'=>$row->pl_zoom, 'icon'=>$row->pl_icon);
+ }
+ uasort($placelist, 'placesort');
+ return $placelist;
+}
+
+function outputLevel($parent_id) {
+ $tmp = place_id_to_hierarchy($parent_id);
+ $maxLevel = getHighestLevel();
+ if ($maxLevel>8) $maxLevel = 8;
+ $prefix = implode(';', $tmp);
+ if ($prefix!='')
+ $prefix.=';';
+ $suffix=str_repeat(';', $maxLevel-count($tmp));
+ $level=count($tmp);
+
+ $rows=
+ WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")
+ ->execute(array($parent_id))
+ ->fetchAll();
+
+ foreach ($rows as $row) {
+ echo $level,';',$prefix,$row->pl_place,$suffix,';',$row->pl_long,';',$row->pl_lati,';',$row->pl_zoom,';',$row->pl_icon,"\r\n";
+ if ($level < $maxLevel) {
+ outputLevel($row->pl_id);
+ }
+ }
+}
+
+/**
+ * recursively find all of the csv files on the server
+ *
+ * @param string $path
+ */
+function findFiles($path) {
+ global $placefiles;
+ if (file_exists($path)) {
+ $dir = dir($path);
+ while (false !== ($entry = $dir->read())) {
+ if ($entry!='.' && $entry!='..' && $entry!='.svn') {
+ if (is_dir($path.'/'.$entry)) {
+ findFiles($path.'/'.$entry);
+ } elseif (strstr($entry, '.csv')!==false) {
+ $placefiles[] = preg_replace('~'.WT_MODULES_DIR.'googlemap/extra~', '', $path).'/'.$entry;
+ }
+ }
+ }
+ $dir->close();
+ }
+}
+
+if (!WT_USER_IS_ADMIN) {
+ header('Location: '.WT_SERVER_NAME.WT_SCRIPT_PATH.'admin.php');
+ exit;
+}
+
+global $GOOGLEMAP_MAX_ZOOM;
+
+if ($action=='ExportFile' && WT_USER_IS_ADMIN) {
+ $tmp = place_id_to_hierarchy($parent);
+ $maxLevel = getHighestLevel();
+ if ($maxLevel>8) $maxLevel=8;
+ $tmp[0] = 'places';
+ $outputFileName=preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)).'.csv';
+ header('Content-Type: application/octet-stream');
+ header('Content-Disposition: attachment; filename="'.$outputFileName.'"');
+ echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
+ if ($maxLevel>0) echo '"', WT_I18N::translate('State'), '";';
+ if ($maxLevel>1) echo '"', WT_I18N::translate('County'), '";';
+ if ($maxLevel>2) echo '"', WT_I18N::translate('City'), '";';
+ if ($maxLevel>3) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel>4) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel>5) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel>6) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel>7) echo '"', WT_I18N::translate('Place'), '";';
+ echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
+ echo '"', WT_I18N::translate('Zoom factor'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
+ outputLevel($parent);
+ exit;
+}
+
+print_header(WT_I18N::translate('Edit geographic place locations'));
+
+echo '<table id="gm_config"><tr>',
+ '<th><a ', (safe_GET('mod_action')=='admin_editconfig' ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=='admin_places' ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>', '</th>',
+ '<th><a ', (safe_GET('mod_action')=='admin_placecheck' ? 'class="current" ' : ''), 'href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_I18N::translate('Place Check'), '</a>', help_link('GOOGLEMAP_PLACECHECK','googlemap'), '</th>',
+'</tr></table>';
+
+if ($action=='ImportGedcom') {
+ $placelist=array();
+ $j=0;
+ if ($mode=='all') {
+ $statement=
+ WT_DB::prepare("SELECT i_gedcom FROM `##individuals` UNION ALL SELECT f_gedcom FROM `##families`")
+ ->execute();
+ } else {
+ $statement=
+ WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")
+ ->execute(array(WT_GED_ID, WT_GED_ID));
+ }
+ while ($gedrec=$statement->fetchColumn()) {
+ $i = 1;
+ $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
+ while (!empty($placerec)) {
+ if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
+ $placelist[$j] = array();
+ $placelist[$j]['place'] = trim($match[1]);
+ if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
+ $placelist[$j]['lati'] = trim($match[1]);
+ if (($placelist[$j]['lati'][0] != 'N') && ($placelist[$j]['lati'][0] != 'S')) {
+ if ($placelist[$j]['lati'] < 0) {
+ $placelist[$j]['lati'][0] = 'S';
+ } else {
+ $placelist[$j]['lati'] = 'N'.$placelist[$j]['lati'];
+ }
+ }
+ }
+ else $placelist[$j]['lati'] = NULL;
+ if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
+ $placelist[$j]['long'] = trim($match[1]);
+ if (($placelist[$j]['long'][0] != 'E') && ($placelist[$j]['long'][0] != 'W')) {
+ if ($placelist[$j]['long'] < 0) {
+ $placelist[$j]['long'][0] = 'W';
+ } else {
+ $placelist[$j]['long'] = 'E'.$placelist[$j]['long'];
+ }
+ }
+ }
+ else $placelist[$j]['long'] = NULL;
+ $j = $j + 1;
+ }
+ $i = $i + 1;
+ $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
+ }
+ }
+ asort($placelist);
+
+ $prevPlace = '';
+ $prevLati = '';
+ $prevLong = '';
+ $placelistUniq = array();
+ $j = 0;
+ foreach ($placelist as $k=>$place) {
+ if ($place['place'] != $prevPlace) {
+ $placelistUniq[$j] = array();
+ $placelistUniq[$j]['place'] = $place['place'];
+ $placelistUniq[$j]['lati'] = $place['lati'];
+ $placelistUniq[$j]['long'] = $place['long'];
+ $j = $j + 1;
+ } else if (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) {
+ if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) {
+ $placelistUniq[$j-1]['lati'] = $place['lati'];
+ $placelistUniq[$j-1]['long'] = $place['long'];
+ } else if (($place['lati'] != '0') || ($place['long'] != '0')) {
+ echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br />';
+ }
+ }
+ $prevPlace = $place['place'];
+ $prevLati = $place['lati'];
+ $prevLong = $place['long'];
+ }
+
+ $highestIndex = getHighestIndex();
+
+ $default_zoom_level=array(4, 7, 10, 12);
+ foreach ($placelistUniq as $k=>$place) {
+ $parent=preg_split('/ *, */', $place['place']);
+ $parent=array_reverse($parent);
+ $parent_id=0;
+ for ($i=0; $i<count($parent); $i++) {
+ if (!isset($default_zoom_level[$i]))
+ $default_zoom_level[$i]=$default_zoom_level[$i-1];
+ $escparent=$parent[$i];
+ if ($escparent == '') {
+ $escparent = 'Unknown';
+ }
+ $row=
+ WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")
+ ->execute(array($i, $parent_id, $escparent))
+ ->fetchOneRow();
+ if ($i < count($parent)-1) {
+ // Create higher-level places, if necessary
+ if (empty($row)) {
+ $highestIndex++;
+ WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")
+ ->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i]));
+ echo htmlspecialchars($escparent), '<br />';
+ $parent_id=$highestIndex;
+ } else {
+ $parent_id=$row->pl_id;
+ }
+ } else {
+ // Create lowest-level place, if necessary
+ if (empty($row->pl_id)) {
+ $highestIndex++;
+ WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")
+ ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i]));
+ echo htmlspecialchars($escparent), '<br />';
+ } else {
+ if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati']!='0' && $place['long']!='0') {
+ WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")
+ ->execute(array($place['lati'], $place['long'], $row->pl_id));
+ echo htmlspecialchars($escparent), '<br />';
+ }
+ }
+ }
+ }
+ }
+ $parent=0;
+}
+
+if ($action=='ImportFile') {
+ $placefiles = array();
+ findFiles(WT_MODULES_DIR.'googlemap/extra');
+ sort($placefiles);
+?>
+<form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&mod_action=admin_places">
+ <input type="hidden" name="action" value="ImportFile2" />
+ <table class="gm_plac_edit">
+ <tr>
+ <th><?php echo WT_I18N::translate('File containing places (CSV)'), help_link('PLIF_FILENAME','googlemap'); ?></th>
+ <td><input type="file" name="placesfile" size="50"></td>
+ </tr>
+ <?php if (count($placefiles)>0) { ?>
+ <tr>
+ <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE','googlemap'); ?></th>
+ <td>
+ <select name="localfile">
+ <option></option>
+ <?php foreach ($placefiles as $p=>$placefile) { ?>
+ <option value="<?php echo htmlspecialchars($placefile); ?>"><?php
+ if (substr($placefile, 0, 1)=="/") echo substr($placefile, 1);
+ else echo $placefile; ?></option>
+ <?php } ?>
+ </select>
+ </td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <th><?php echo WT_I18N::translate('Clear all place-locations before import?'), help_link('PLIF_CLEAN','googlemap'); ?></th>
+ <td><input type="checkbox" name="cleardatabase"></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Update existing places only?'), help_link('PLIF_UPDATE','googlemap'); ?></th>
+ <td><input type="checkbox" name="updateonly"></td>
+ </tr>
+ <tr>
+ <th><?php echo WT_I18N::translate('Overwrite location-data with data from file?'), help_link('PLIF_OVERWRITE','googlemap'); ?></th>
+ <td><input type="checkbox" name="overwritedata"></td>
+ </tr>
+ </table>
+ <input id="savebutton" type="submit" value="<?php echo WT_I18N::translate('Continue Adding'); ?>" /><br />
+</form>
+<?php
+ print_footer();
+ exit;
+}
+
+if ($action=='ImportFile2') {
+ $country_names=array();
+ foreach (WT_Stats::iso3166() as $key=>$value) {
+ $country_names[$key]=WT_I18N::translate($key);
+ }
+ if (isset($_POST['cleardatabase'])) {
+ WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1");
+ }
+ if (!empty($_FILES['placesfile']['tmp_name'])) {
+ $lines = file($_FILES['placesfile']['tmp_name']);
+ } elseif (!empty($_REQUEST['localfile'])) {
+ $lines = file(WT_MODULES_DIR.'googlemap/extra'.$_REQUEST['localfile']);
+ }
+ // Strip BYTE-ORDER-MARK, if present
+ if (!empty($lines[0]) && substr($lines[0], 0, 3)==WT_UTF8_BOM) $lines[0]=substr($lines[0], 3);
+ asort($lines);
+ $highestIndex = getHighestIndex();
+ $placelist = array();
+ $j = 0;
+ $maxLevel = 0;
+ foreach ($lines as $p => $placerec) {
+ $fieldrec = explode(';', $placerec);
+ if ($fieldrec[0] > $maxLevel) $maxLevel = $fieldrec[0];
+ }
+ $fields = count($fieldrec);
+ $set_icon = true;
+ if (!is_dir(WT_MODULES_DIR.'googlemap/places/flags/')) {
+ $set_icon = false;
+ }
+ foreach ($lines as $p => $placerec) {
+ $fieldrec = explode(';', $placerec);
+ if (is_numeric($fieldrec[0]) && $fieldrec[0]<=$maxLevel) {
+ $placelist[$j] = array();
+ $placelist[$j]['place'] = '';
+ for ($ii=$fields-4; $ii>1; $ii--) {
+ if ($fieldrec[0] > $ii-2) $placelist[$j]['place'] .= $fieldrec[$ii].',';
+ }
+ foreach ($country_names as $countrycode => $countryname) {
+ if ($countrycode == strtoupper($fieldrec[1])) {
+ $fieldrec[1] = $countryname;
+ break;
+ }
+ }
+ $placelist[$j]['place'] .= $fieldrec[1];
+ $placelist[$j]['long'] = $fieldrec[$fields-4];
+ $placelist[$j]['lati'] = $fieldrec[$fields-3];
+ $placelist[$j]['zoom'] = $fieldrec[$fields-2];
+ if($set_icon) {
+ $placelist[$j]['icon'] = trim($fieldrec[$fields-1]);
+ } else {
+ $placelist[$j]['icon'] = '';
+ }
+ $j = $j + 1;
+ }
+ }
+
+ $prevPlace = '';
+ $prevLati = '';
+ $prevLong = '';
+ $placelistUniq = array();
+ $j = 0;
+ foreach ($placelist as $k=>$place) {
+ if ($place['place'] != $prevPlace) {
+ $placelistUniq[$j] = array();
+ $placelistUniq[$j]['place'] = $place['place'];
+ $placelistUniq[$j]['lati'] = $place['lati'];
+ $placelistUniq[$j]['long'] = $place['long'];
+ $placelistUniq[$j]['zoom'] = $place['zoom'];
+ $placelistUniq[$j]['icon'] = $place['icon'];
+ $j = $j + 1;
+ } else if (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) {
+ if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) {
+ $placelistUniq[$j-1]['lati'] = $place['lati'];
+ $placelistUniq[$j-1]['long'] = $place['long'];
+ $placelistUniq[$j-1]['zoom'] = $place['zoom'];
+ $placelistUniq[$j-1]['icon'] = $place['icon'];
+ } else if (($place['lati'] != '0') || ($place['long'] != '0')) {
+ echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br />';
+ }
+ }
+ $prevPlace = $place['place'];
+ $prevLati = $place['lati'];
+ $prevLong = $place['long'];
+ }
+
+ $default_zoom_level = array();
+ $default_zoom_level[0] = 4;
+ $default_zoom_level[1] = 7;
+ $default_zoom_level[2] = 10;
+ $default_zoom_level[3] = 12;
+ foreach ($placelistUniq as $k=>$place) {
+ $parent = explode(',', $place['place']);
+ $parent = array_reverse($parent);
+ $parent_id=0;
+ for ($i=0; $i<count($parent); $i++) {
+ $escparent=$parent[$i];
+ if ($escparent == '') {
+ $escparent = 'Unknown';
+ }
+ $row=
+ WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
+ ->execute(array($i, $parent_id, $escparent))
+ ->fetchOneRow();
+ if (empty($row)) { // this name does not yet exist: create entry
+ if (!isset($_POST['updateonly'])) {
+ $highestIndex = $highestIndex + 1;
+ if (($i+1) == count($parent)) {
+ $zoomlevel = $place['zoom'];
+ } elseif (isset($default_zoom_level[$i])) {
+ $zoomlevel = $default_zoom_level[$i];
+ } else {
+ $zoomlevel = $GOOGLEMAP_MAX_ZOOM;
+ }
+ if (($place['lati'] == '0') || ($place['long'] == '0') || (($i+1) < count($parent))) {
+ WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")
+ ->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon']));
+ } else {
+ //delete leading zero
+ $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.') , $place['lati']);
+ $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.') , $place['long']);
+ if ($pl_lati >= 0) {
+ $place['lati'] = 'N'.abs($pl_lati);
+ } elseif ($pl_lati < 0) {
+ $place['lati'] = 'S'.abs($pl_lati);
+ }
+ if ($pl_long >= 0) {
+ $place['long'] = 'E'.abs($pl_long);
+ } elseif ($pl_long < 0) {
+ $place['long'] = 'W'.abs($pl_long);
+ }
+ WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
+ ->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon']));
+ }
+ $parent_id = $highestIndex;
+ }
+ } else {
+ $parent_id = $row->pl_id;
+ if ((isset($_POST['overwritedata'])) && ($i+1 == count($parent))) {
+ WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")
+ ->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id));
+ } else {
+ if ((($row->pl_long == '0') || ($row->pl_long == null)) && (($row->pl_lati == '0') || ($row->pl_lati == null))) {
+ WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")
+ ->execute(array($place['lati'], $place['long'], $parent_id));
+ }
+ if (empty($row->pl_icon) && !empty($place['icon'])) {
+ WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?")
+ ->execute(array($place['icon'], $parent_id));
+ }
+ }
+ }
+ }
+ }
+ $parent=0;
+}
+
+if ($action=='DeleteRecord') {
+ $exists=
+ WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")
+ ->execute(array($deleteRecord))
+ ->fetchOne();
+
+ if (!$exists) {
+ WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($deleteRecord));
+ } else {
+ echo '<table class="facts_table"><tr><td>', WT_I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>';
+ }
+}
+
+?>
+<script type="text/javascript">
+<!--
+function showchanges() {
+ window.location = '<?php echo basename($_SERVER['REQUEST_URI']); ?>&show_changes=yes';
+}
+
+function updateList(inactive) {
+ window.location.href='<?php if (strstrb($_SERVER['REQUEST_URI'], '&inactive')) { $uri=strstrb($_SERVER['REQUEST_URI'], '&inactive');} else { $uri=$_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?>'+inactive;
+}
+
+function edit_place_location(placeid) {
+ window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid+'&'+sessionname+'='+sessionid, '_blank', 'top=50, left=50, width=690, height=630, resizable=1, scrollbars=1');
+ return false;
+}
+
+function add_place_location(placeid) {
+ window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid+'&'+sessionname+'='+sessionid, '_blank', 'top=50, left=50, width=690, height=630, resizable=1, scrollbars=1');
+ return false;
+}
+
+function delete_place(placeid) {
+ var answer=confirm('<?php echo WT_I18N::translate('Remove this location?'); ?>');
+ if (answer == true) {
+ window.location = '<?php echo $_SERVER['REQUEST_URI']; ?>&action=DeleteRecord&deleteRecord=' + placeid;
+ }
+}
+
+//-->
+</script>
+<?php
+echo '<div id="gm_breadcrumb">';
+$where_am_i=place_id_to_hierarchy($parent);
+foreach (array_reverse($where_am_i, true) as $id=>$place) {
+ if ($id==$parent) {
+ if ($place != 'Unknown') {
+ echo PrintReady($place);
+ } else {
+ echo WT_I18N::translate('unknown');
+ }
+ } else {
+ echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">';
+ if ($place != 'Unknown') {
+ echo PrintReady($place), '</a>';
+ } else {
+ echo WT_I18N::translate('unknown'), '</a>';
+ }
+ }
+ echo ' - ';
+}
+echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top Level'), '</a></div>';
+echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">';
+echo '<label for="inactive">', WT_I18N::translate('Click here to show inactive places'), '</label>';
+echo help_link('PLE_ACTIVE','googlemap');
+echo '<input type="checkbox" name="inactive" id="inactive"';
+if ($inactive) echo ' checked="checked"';
+echo ' onclick="updateList(this.checked)"';
+echo '></div></form>';
+
+$placelist=get_place_list_loc($parent, $inactive);
+echo '<div class="gm_plac_edit">';
+echo '<table class="gm_plac_edit"><tr>';
+echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>';
+echo '<th>', WT_Gedcom_Tag::getLabel('LATI'), '</th>';
+echo '<th>', WT_Gedcom_Tag::getLabel('LONG'), '</th>';
+echo '<th>', WT_I18N::translate('Zoom factor'), '</th>';
+echo '<th>', WT_I18N::translate('Icon'), '</th>';
+echo '<th colspan="2">';
+echo WT_I18N::translate('Edit geographic location'), help_link('PL_EDIT_LOCATION','googlemap'), '</th></tr>';
+if (count($placelist) == 0)
+ echo '<tr><td colspan="7" class="accepted">', WT_I18N::translate('No places found'), '</td></tr>';
+foreach ($placelist as $place) {
+ echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
+ if ($place['place'] != 'Unknown')
+ echo PrintReady($place['place']), '</a></td>';
+ else
+ echo WT_I18N::translate('unknown'), '</a></td>';
+ echo '<td>', $place['lati'], '</td>';
+ echo '<td>', $place['long'], '</td>';
+ echo '<td>', $place['zoom'], '</td>';
+ echo '<td>';
+ if (($place['icon'] == NULL) || ($place['icon'] == '')) {
+ if (($place['lati'] == NULL) || ($place['long'] == NULL) || (($place['lati'] == '0') && ($place['long'] == '0'))) {
+ echo '&nbsp;';
+ echo '<img src="http://labs.google.com/ridefinder/images/mm_20_yellow.png">';
+ }
+ else {
+ echo '&nbsp;';
+ echo '<img src="http://labs.google.com/ridefinder/images/mm_20_red.png">';
+ }
+ } else {
+ echo '<img src="', WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">';
+ }
+ echo '</td>';
+ echo '<td class="narrow"><a href="javascript:;" onclick="edit_place_location(', $place['place_id'], ');return false;"><img src="', $WT_IMAGES['edit'], '" border="0" alt="', WT_I18N::translate("Edit"), '" /></a></td>';
+ $noRows=
+ WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")
+ ->execute(array($place['place_id']))
+ ->fetchOne();
+ if ($noRows==0) { ?>
+ <td><a href="javascript:;" onclick="delete_place(<?php echo $place['place_id'], ');return false;">'; ?><img src="<?php echo $WT_IMAGES['remove'];?>" border="0" alt="<?php echo WT_I18N::translate('Remove'); ?>" /></a></td>
+<?php } else { ?>
+ <td><img src="<?php echo $WT_IMAGES['remove_grey'];?>" border="0" alt="" /> </td>
+<?php } ?>
+ </tr>
+ <?php
+}
+?>
+</table>
+</div>
+<table id="gm_manage">
+ <tr>
+ <td colspan="3"><a href="javascript:;" onclick="add_place_location(<?php echo $parent; ?>);return false;"><?php echo WT_I18N::translate('Add place'); ?></a><?php echo help_link('PL_ADD_LOCATION','googlemap'); ?></td>
+ </tr>
+ <tr>
+ <td><a href="module.php?mod=googlemap&mod_action=admin_places&action=ImportGedcom&mode=curr"><?php echo WT_I18N::translate('Import from current GEDCOM'); ?></a><?php echo help_link('PL_IMPORT_GEDCOM','googlemap'); ?></td>
+ <td><a href="module.php?mod=googlemap&mod_action=admin_places&action=ImportGedcom&mode=all"><?php echo WT_I18N::translate('Import from all GEDCOMs'); ?></a><?php echo help_link('PL_IMPORT_ALL_GEDCOM','googlemap'); ?></td>
+ <td><a href="module.php?mod=googlemap&mod_action=admin_places&action=ImportFile&mode=add"><?php echo WT_I18N::translate('Import from file'); ?></a><?php echo help_link('PL_IMPORT_FILE','googlemap'); ?></td>
+ </tr>
+ <tr>
+ <td>
+<?php
+ if (count($where_am_i)<=4) {
+ echo '<a href="module.php?mod=googlemap&mod_action=admin_places&action=ExportFile&parent=', $parent, '">';
+ echo WT_I18N::translate('Export current view to file'), '</a>';
+ echo help_link('PL_EXPORT_FILE','googlemap');
+ } else {
+ echo '&nbsp;';
+ }
+ echo '</td><td colspan="2">';
+ echo '<a href="module.php?mod=googlemap&mod_action=admin_places&action=ExportFile&parent=0">';
+ echo WT_I18N::translate('Export all locations to file'), '</a>';
+ echo help_link('PL_EXPORT_ALL_FILE','googlemap');
+ echo '</td></tr></table>';
+if (empty($SEARCH_SPIDER)) {
+ print_footer();
+} else {
+ echo WT_I18N::translate('Search Engine Spider Detected'), ': ', $SEARCH_SPIDER;
+ echo '</div></body></html>';
+}
diff --git a/modules_v3/googlemap/css/googlemap_style.css b/modules_v3/googlemap/css/googlemap_style.css
new file mode 100644
index 0000000000..775c94c5aa
--- /dev/null
+++ b/modules_v3/googlemap/css/googlemap_style.css
@@ -0,0 +1,60 @@
+/**
+ * Stylesheet for Googlemap module
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Modules
+ * @version $Id$
+ */
+
+#map_type
+{
+ margin: 0;
+ padding: 0;
+ font-family: Arial;
+ font-size: 10px;
+ list-style: none;
+}
+#map_type li
+{
+ display: block;
+ width: 70px;
+ text-align: center;
+ padding: 2px;
+ border: 1px solid black;
+ cursor: pointer;
+ float: left;
+ margin-left: 2px;
+}
+#map_type li.non_active
+{
+ background: white;
+ color: black;
+ font-weight: normal;
+}
+#map_type li.active
+{
+ background: gray;
+ color: white;
+ font-weight: bold;
+}
+#map_type li:hover
+{
+ background: #ddd;
+}
diff --git a/modules_v3/googlemap/css/wt_v3_googlemap.css b/modules_v3/googlemap/css/wt_v3_googlemap.css
new file mode 100644
index 0000000000..50e8f90ead
--- /dev/null
+++ b/modules_v3/googlemap/css/wt_v3_googlemap.css
@@ -0,0 +1,268 @@
+/*
+ * webtrees googlemap V3 css
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Module
+ * $Id$
+ *
+ * @author Brian Holland
+*/
+
+div.infowindow {
+ max-height:260px;
+ overflow-x:hidden;
+}
+
+#iwhead {
+ text-align: center;
+ font-size: 10px;
+ white-space: normal;
+ margin-right: 0px;
+ margin-left: -2px;
+ margin-top: -1px;
+ background: #ffffff;
+ border-top: 1px solid #bbbbbb;
+ border-bottom: 1px solid #bbbbbb;
+ border-left: 0px solid #bbbbbb;
+ border-right: 0px solid #bbbbbb;
+ padding-left: .2em;
+ padding-right: .2em;
+ padding-top: .3em;
+ padding-bottom: .3em;
+ width: 300px;
+
+}
+
+#iwhead a:hover {
+ color: red;
+}
+
+#iwcontent {
+ /* background-color: #ddeeff; */
+ background-color: #eeeeee;
+ border: 1px solid #bbbbbb;
+ /*min-width: 314px; */
+ min-height: 260px;
+ margin-right: 0em;
+}
+
+#iwcontent a {
+ color: black;
+}
+
+#iwhead a {
+ color: #0000cc;
+}
+
+#iwcontent a:hover {
+ color: red;
+}
+
+#gmtabs {
+ /* background-color: #ddeeff; */
+ background-color: #eeeeee;
+ border: 0px solid red;
+ margin-top: 0em;
+ margin-left: -2px;
+ font-size: 11px;
+ margin-right: 4.5em;
+ width: 247px;
+}
+
+#gmtabs ul {
+ margin-left: -2px;
+ border: 0px solid red;
+ border-bottom: 1px solid #aaaaaa;
+}
+
+h4 {
+ margin-bottom: -0.1em;
+}
+
+
+#txt {
+width:300px;
+margin-top: -8px;
+margin-left: -8px;
+background: #ffffcc;
+text-align: center;
+}
+
+#pano {
+width:297px;
+height: 216px;
+margin-left: 0px;
+margin-top: 0em;
+border-top: 1px solid #aaaaaa;
+}
+
+.highlt_img {
+ width: 60px;
+ /* background-color: #ddeeff; */
+ background-color: #eeeeee;
+ text-align: center;
+}
+.highlt_img img{
+ float: none;
+ border: none;
+}
+
+/* root element for tabs ====================== */
+ul.tabs {
+ margin:0 !important;
+ padding:0;
+ padding-left:2px;
+ padding-top: 2px;
+ height:20px;
+ border: 1px solid #666;
+ background: #ddeeff;
+ width: 296px;
+}
+
+/* single tab */
+ul.tabs li {
+ float:left;
+ padding:0;
+ margin:0;
+ margin-left:2px;
+ list-style-type:none;
+}
+
+/* link inside the tab. uses a background image */
+ul.tabs a {
+ float:left;
+ font-size:13px;
+ display:block;
+ /* padding:5px 30px; */
+ padding: 0px 10px;
+ text-decoration:none;
+ border:1px solid #666;
+ border-bottom:0px;
+ height:18px;
+ background-color:#efefef;
+ color:#777;
+ margin-right:2px;
+ position:relative;
+ top:1px;
+ outline:0;
+ -moz-border-radius:4px 4px 0 0;
+}
+
+ul.tabs a:hover {
+ /* background-color:#F7F7F7; */
+ background-color:#ffffff;
+ color:#333;
+}
+
+/* selected tab */
+ul.tabs a.current {
+ background-color:#fff;
+ border-bottom:1px solid #ddd;
+ color:#000;
+ cursor:default;
+}
+
+
+/* tabs */
+#EV {
+ background: #ffffff;
+ padding-bottom: 1px;
+}
+#SV {
+ background: #cccccc;
+ padding-bottom: 0px;
+}
+#PH {
+ background: #cccccc;
+ padding-bottom: 0px;
+}
+#SP {
+ background: #cccccc;
+ padding-bottom: 0px;
+}
+
+
+
+/* tab panes */
+#pane1 {
+ display:block;
+}
+#pane2 {
+ display:none;
+}
+#pane3 {
+ display:none;
+}
+#pane3_text, #pane4_text {
+ margin-left: 10px;
+}
+
+
+/* view_type */
+#view_type {
+ display: block;
+ margin-top: -12px;
+}
+#view_type td {
+ width: 360px;
+}
+#view_type form{
+ width: 360px;
+ text-align: center;
+}
+
+
+/* place_hierarchy elements */
+#place_hierarchy {
+/* float:left;
+margin-left:-130px; */
+}
+
+/* === Elements To be defined later (leave as dislay:none; for now) ==== */
+
+/* sidebar */
+#s_bar {
+ display: none;
+ width:370px;
+ border: 1px solid black;
+ margin-bottom: 1em;
+}
+#s_bar td{
+ padding-left:5px;
+ width: 370px;
+ text-decoration:none;
+ color:#4444ff;
+ background:#aabbd8;
+}
+
+/* Generated by http://css.spritegen.com CSS Sprite Generator */
+.icon_bapm, .icon_reti, .icon_cens, .icon_buri, .icon_mili,
+.icon_resi, .icon_deat, .icon_occu, .icon_birt
+{ display: block; background: url('../images/css_sprite_facts.png') no-repeat; }
+
+.icon_bapm { background-position: -0px -0px; width: 60px; height: 60px; }
+.icon_reti { background-position: -60px -0px; width: 60px; height: 60px; }
+.icon_cens { background-position: -120px -0px; width: 60px; height: 60px; }
+.icon_buri { background-position: -0px -60px; width: 60px; height: 60px; }
+.icon_mili { background-position: -60px -60px; width: 60px; height: 60px; }
+.icon_resi { background-position: -120px -60px; width: 60px; height: 60px; }
+.icon_deat { background-position: -0px -120px; width: 60px; height: 60px; }
+.icon_occu { background-position: -60px -120px; width: 60px; height: 60px; }
+.icon_birt { background-position: -120px -120px; width: 60px; height: 60px; }
diff --git a/modules_v3/googlemap/css/wt_v3_places_edit.css b/modules_v3/googlemap/css/wt_v3_places_edit.css
new file mode 100644
index 0000000000..508b79c950
--- /dev/null
+++ b/modules_v3/googlemap/css/wt_v3_places_edit.css
@@ -0,0 +1,37 @@
+/*
+ * webtrees googlemap V3 css
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Module
+ * $Id$
+ *
+ * @author Brian Holland
+*/
+
+#gname {
+ vertical-align: text-middle;
+ margin-top: 0px;
+ white-space:pre-wrap;
+ width:200px;
+ height: 60px;
+
+#namelink {
+ padding-bottom: 5px;
+} \ No newline at end of file
diff --git a/modules_v3/googlemap/db_schema/db_schema_0_1.php b/modules_v3/googlemap/db_schema/db_schema_0_1.php
new file mode 100644
index 0000000000..ef69f384f1
--- /dev/null
+++ b/modules_v3/googlemap/db_schema/db_schema_0_1.php
@@ -0,0 +1,62 @@
+<?php
+// Update the GM module database schema from version 0 to version 1
+//
+// Version 0: empty database
+// Version 1: create the tables, as per PGV 4.2.1
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2009 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// Create all of the tables needed for this module
+WT_DB::exec(
+ "CREATE TABLE IF NOT EXISTS `##placelocation` (".
+ " pl_id INTEGER NOT NULL,".
+ " pl_parent_id INTEGER NULL,".
+ " pl_level INTEGER NULL,".
+ " pl_place VARCHAR(255) NULL,".
+ " pl_long VARCHAR(30) NULL,".
+ " pl_lati VARCHAR(30) NULL,".
+ " pl_zoom INTEGER NULL,".
+ " pl_icon VARCHAR(255) NULL,".
+ " PRIMARY KEY (pl_id),".
+ " KEY ix1 (pl_level),".
+ " KEY ix2 (pl_long),".
+ " KEY ix3 (pl_lati),".
+ " KEY ix4 (pl_place),".
+ " KEY ix5 (pl_parent_id)".
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+);
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
diff --git a/modules_v3/googlemap/db_schema/db_schema_1_2.php b/modules_v3/googlemap/db_schema/db_schema_1_2.php
new file mode 100644
index 0000000000..45ca7fd7e0
--- /dev/null
+++ b/modules_v3/googlemap/db_schema/db_schema_1_2.php
@@ -0,0 +1,59 @@
+<?php
+// Update the GM module database schema from version 1 to version 2
+//
+// Version 0: empty database
+// Version 1: create the tables, as per PGV 4.2.1
+// Version 2: update the tables to support streetview
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2009 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// Create all of the tables needed for this module
+//try {
+ WT_DB::exec(
+ "ALTER TABLE `##placelocation` ADD (".
+ " pl_media VARCHAR(60) NULL,".
+ " sv_long FLOAT NOT NULL DEFAULT 0,".
+ " sv_lati FLOAT NOT NULL DEFAULT 0,".
+ " sv_bearing FLOAT NOT NULL DEFAULT 0,".
+ " sv_elevation FLOAT NOT NULL DEFAULT 0,".
+ " sv_zoom FLOAT NOT NULL DEFAULT 1".
+ ")"
+ );
+//} catch (PDOException $ex) {
+ // Already done this?
+//}
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
diff --git a/modules_v3/googlemap/db_schema/db_schema_2_3.php b/modules_v3/googlemap/db_schema/db_schema_2_3.php
new file mode 100644
index 0000000000..3309af8eb7
--- /dev/null
+++ b/modules_v3/googlemap/db_schema/db_schema_2_3.php
@@ -0,0 +1,40 @@
+<?php
+// Update the GM module database schema from version 2 to version 3
+//
+// Convert flag icons from .gif to .png
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+WT_DB::exec("UPDATE `##placelocation` SET pl_icon=REPLACE(pl_icon, '.gif', '.png')");
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
diff --git a/modules_v3/googlemap/db_schema/db_schema_3_4.php b/modules_v3/googlemap/db_schema/db_schema_3_4.php
new file mode 100644
index 0000000000..b54b57d683
--- /dev/null
+++ b/modules_v3/googlemap/db_schema/db_schema_3_4.php
@@ -0,0 +1,45 @@
+<?php
+// Update the GM module database schema from version 3 to version 4
+//
+// Combine the two ways of enabling the GM module
+//
+// The script should assume that it can be interrupted at
+// any point, and be able to continue by re-running the script.
+// Fatal errors, however, should be allowed to throw exceptions,
+// which will be caught by the framework.
+// It shouldn't do anything that might take more than a few
+// seconds, for systems with low timeout values.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+self::exec(
+ "UPDATE `##module` m, `##module_setting` ms SET m.status=CASE WHEN (m.status=1 AND ms.setting_value=1) THEN 'enabled' ELSE 'disabled' END WHERE m.module_name=ms.module_name AND m.module_name='googlemap' AND ms.setting_name='GM_ENABLED'"
+);
+self::exec(
+ "DELETE FROM `##module_setting` WHERE module_name='googlemap' AND setting_name='GM_ENABLED'"
+);
+
+// Update the version to indicate success
+set_site_setting($schema_name, $next_version);
diff --git a/modules_v3/googlemap/defaultconfig.php b/modules_v3/googlemap/defaultconfig.php
new file mode 100644
index 0000000000..9018812ae0
--- /dev/null
+++ b/modules_v3/googlemap/defaultconfig.php
@@ -0,0 +1,160 @@
+<?php
+/**
+ * Configuration file required by GoogleMap module
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage GoogleMap
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// Create GM tables, if not already present
+try {
+ WT_DB::updateSchema(WT_ROOT.WT_MODULES_DIR.'/googlemap/db_schema/', 'GM_SCHEMA_VERSION', 4);
+} catch (PDOException $ex) {
+ // The schema update scripts should never fail. If they do, there is no clean recovery.
+ die($ex);
+}
+
+global $GOOGLEMAP_MAP_TYPE;
+$GOOGLEMAP_MAP_TYPE = get_module_setting('googlemap', 'GM_MAP_TYPE', 'G_NORMAL_MAP'); // possible values: G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP or G_HYBRID_MAP.
+
+global $GOOGLEMAP_MIN_ZOOM;
+$GOOGLEMAP_MIN_ZOOM = get_module_setting('googlemap', 'GM_MIN_ZOOM', '2'); // min zoom level
+global $GOOGLEMAP_MAX_ZOOM;
+$GOOGLEMAP_MAX_ZOOM = get_module_setting('googlemap', 'GM_MAX_ZOOM', '13'); // max zoom level
+
+global $GOOGLEMAP_XSIZE;
+$GOOGLEMAP_XSIZE = get_module_setting('googlemap', 'GM_XSIZE', '600'); // X-size of Google map
+global $GOOGLEMAP_YSIZE;
+$GOOGLEMAP_YSIZE = get_module_setting('googlemap', 'GM_YSIZE', '400'); // Y-size of Google map
+
+global $GOOGLEMAP_PRECISION_0;
+$GOOGLEMAP_PRECISION_0 = get_module_setting('googlemap', 'GM_PRECISION_0', '0'); // Country level
+global $GOOGLEMAP_PRECISION_1;
+$GOOGLEMAP_PRECISION_1 = get_module_setting('googlemap', 'GM_PRECISION_1', '1'); // State level
+global $GOOGLEMAP_PRECISION_2;
+$GOOGLEMAP_PRECISION_2 = get_module_setting('googlemap', 'GM_PRECISION_2', '2'); // City level
+global $GOOGLEMAP_PRECISION_3;
+$GOOGLEMAP_PRECISION_3 = get_module_setting('googlemap', 'GM_PRECISION_3', '3'); // Neighborhood level
+global $GOOGLEMAP_PRECISION_4;
+$GOOGLEMAP_PRECISION_4 = get_module_setting('googlemap', 'GM_PRECISION_4', '4'); // House level
+global $GOOGLEMAP_PRECISION_5;
+$GOOGLEMAP_PRECISION_5 = get_module_setting('googlemap', 'GM_PRECISION_5', '9'); // Max prcision level
+
+global $GM_MAX_NOF_LEVELS;
+$GM_MAX_NOF_LEVELS = get_module_setting('googlemap', 'GM_MAX_NOF_LEVELS', '4'); // Max nr of levels to use in Googlemap
+global $GM_DEFAULT_TOP_VALUE;
+$GM_DEFAULT_TOP_VALUE = get_module_setting('googlemap', 'GM_DEFAULT_TOP_VALUE', '' ); // Default value, inserted when no location can be found
+
+global $GOOGLEMAP_COORD;
+$GOOGLEMAP_COORD = get_module_setting('googlemap', 'GM_COORD', '0'); // Enable or disable Display Map Co-ordinates
+
+//Place Hierarchy
+global $GOOGLEMAP_PH_XSIZE;
+$GOOGLEMAP_PH_XSIZE =get_module_setting('googlemap', 'GM_PH_XSIZE', '500' ); // X-size of Place Hierarchy Google map
+global $GOOGLEMAP_PH_YSIZE;
+$GOOGLEMAP_PH_YSIZE =get_module_setting('googlemap', 'GM_PH_YSIZE', '350' ); // Y-size of Place Hierarchy Google map
+global $GOOGLEMAP_PH_MARKER;
+$GOOGLEMAP_PH_MARKER =get_module_setting('googlemap', 'GM_PH_MARKER', 'G_FLAG'); // Possible values: G_FLAG = Flag, G_DEFAULT_ICON = Standard icon
+global $GM_DISP_SHORT_PLACE;
+$GM_DISP_SHORT_PLACE =get_module_setting('googlemap', 'GM_DISP_SHORT_PLACE', '0'); // Display full place name or only the actual level name
+global $GM_DISP_COUNT;
+$GM_DISP_COUNT =get_module_setting('googlemap', 'GM_DISP_COUNT', '0'); // Display the count of individuals and families connected to the place
+global $GOOGLEMAP_PH_WHEEL;
+$GOOGLEMAP_PH_WHEEL =get_module_setting('googlemap', 'GM_PH_WHEEL', '0'); // Use mouse wheel for zooming
+global $GOOGLEMAP_PH_CONTROLS;
+$GOOGLEMAP_PH_CONTROLS =get_module_setting('googlemap', 'GM_PH_CONTROLS', '1'); // Hide map controls when mouse is out
+
+
+// Configuration-options per location-level
+global $GM_MARKER_COLOR;
+global $GM_MARKER_SIZE;
+global $GM_PREFIX;
+global $GM_POSTFIX;
+global $GM_PRE_POST_MODE;
+
+$GM_MARKER_COLOR [1]=get_module_setting('googlemap', 'GM_MARKER_COLOR_1', 'Red' ); // Marker to be used
+$GM_MARKER_SIZE [1]=get_module_setting('googlemap', 'GM_MARKER_SIZE_1', 'Large'); // 'Small' or 'Large'
+$GM_PREFIX [1]=get_module_setting('googlemap', 'GM_PREFIX_1', '' ); // Text to be placed in front of the name
+$GM_POSTFIX [1]=get_module_setting('googlemap', 'GM_POSTFIX_1', '' ); // Text to be placed after the name
+$GM_PRE_POST_MODE[1]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_1', '0' ); // Prefix/Postfix mode. Possible value are:
+ // 0 = no pre/postfix
+ // 1 = Normal name, Prefix, Postfix, Both
+ // 2 = Normal name, Postfix, Prefxi, Both
+ // 3 = Prefix, Postfix, Both, Normal name
+ // 4 = Postfix, Prefix, Both, Normal name
+ // 5 = Prefix, Postfix, Normal name, Both
+ // 6 = Postfix, Prefix, Normal name, Both
+
+$GM_MARKER_COLOR [2]=get_module_setting('googlemap', 'GM_MARKER_COLOR_2', 'Red' );
+$GM_MARKER_SIZE [2]=get_module_setting('googlemap', 'GM_MARKER_SIZE_2', 'Large');
+$GM_PREFIX [2]=get_module_setting('googlemap', 'GM_PREFIX_2', '' );
+$GM_POSTFIX [2]=get_module_setting('googlemap', 'GM_POSTFIX_2', '' );
+$GM_PRE_POST_MODE[2]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_2', '0' );
+
+$GM_MARKER_COLOR [3]=get_module_setting('googlemap', 'GM_MARKER_COLOR_3', 'Red' );
+$GM_MARKER_SIZE [3]=get_module_setting('googlemap', 'GM_MARKER_SIZE_3', 'Large');
+$GM_PREFIX [3]=get_module_setting('googlemap', 'GM_PREFIX_3', '' );
+$GM_POSTFIX [3]=get_module_setting('googlemap', 'GM_POSTFIX_3', '' );
+$GM_PRE_POST_MODE[3]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_3', '0' );
+
+$GM_MARKER_COLOR [4]=get_module_setting('googlemap', 'GM_MARKER_COLOR_4', 'Red' );
+$GM_MARKER_SIZE [4]=get_module_setting('googlemap', 'GM_MARKER_SIZE_4', 'Large');
+$GM_PREFIX [4]=get_module_setting('googlemap', 'GM_PREFIX_4', '' );
+$GM_POSTFIX [4]=get_module_setting('googlemap', 'GM_POSTFIX_4', '' );
+$GM_PRE_POST_MODE[4]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_4', '0' );
+
+$GM_MARKER_COLOR [5]=get_module_setting('googlemap', 'GM_MARKER_COLOR_5', 'Red' );
+$GM_MARKER_SIZE [5]=get_module_setting('googlemap', 'GM_MARKER_SIZE_5', 'Large');
+$GM_PREFIX [5]=get_module_setting('googlemap', 'GM_PREFIX_5', '' );
+$GM_POSTFIX [5]=get_module_setting('googlemap', 'GM_POSTFIX_5', '' );
+$GM_PRE_POST_MODE[5]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_5', '0' );
+
+$GM_MARKER_COLOR [6]=get_module_setting('googlemap', 'GM_MARKER_COLOR_6', 'Red' );
+$GM_MARKER_SIZE [6]=get_module_setting('googlemap', 'GM_MARKER_SIZE_6', 'Large');
+$GM_PREFIX [6]=get_module_setting('googlemap', 'GM_PREFIX_6', '' );
+$GM_POSTFIX [6]=get_module_setting('googlemap', 'GM_POSTFIX_6', '' );
+$GM_PRE_POST_MODE[6]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_6', '0' );
+
+$GM_MARKER_COLOR [7]=get_module_setting('googlemap', 'GM_MARKER_COLOR_7', 'Red' );
+$GM_MARKER_SIZE [7]=get_module_setting('googlemap', 'GM_MARKER_SIZE_7', 'Large');
+$GM_PREFIX [7]=get_module_setting('googlemap', 'GM_PREFIX_7', '' );
+$GM_POSTFIX [7]=get_module_setting('googlemap', 'GM_POSTFIX_7', '' );
+$GM_PRE_POST_MODE[7]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_7', '0' );
+
+$GM_MARKER_COLOR [8]=get_module_setting('googlemap', 'GM_MARKER_COLOR_8', 'Red' );
+$GM_MARKER_SIZE [8]=get_module_setting('googlemap', 'GM_MARKER_SIZE_8', 'Large');
+$GM_PREFIX [8]=get_module_setting('googlemap', 'GM_PREFIX_8', '' );
+$GM_POSTFIX [8]=get_module_setting('googlemap', 'GM_POSTFIX_8', '' );
+$GM_PRE_POST_MODE[8]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_8', '0' );
+
+$GM_MARKER_COLOR [9]=get_module_setting('googlemap', 'GM_MARKER_COLOR_9', 'Red' );
+$GM_MARKER_SIZE [9]=get_module_setting('googlemap', 'GM_MARKER_SIZE_9', 'Large');
+$GM_PREFIX [9]=get_module_setting('googlemap', 'GM_PREFIX_9', '' );
+$GM_POSTFIX [9]=get_module_setting('googlemap', 'GM_POSTFIX_9', '' );
+$GM_PRE_POST_MODE[9]=get_module_setting('googlemap', 'GM_PRE_POST_MODE_9', '0' );
diff --git a/modules_v3/googlemap/flags.php b/modules_v3/googlemap/flags.php
new file mode 100644
index 0000000000..4dbceba4aa
--- /dev/null
+++ b/modules_v3/googlemap/flags.php
@@ -0,0 +1,256 @@
+<?php
+// Interface to edit place locations
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+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';
+
+$countries=WT_Stats::get_all_countries();
+$action=safe_REQUEST($_REQUEST, 'action');
+
+if (isset($_REQUEST['countrySelected'])) $countrySelected = $_REQUEST['countrySelected'];
+if (!isset($countrySelected)) $countrySelected='Countries';
+if (isset($_REQUEST['stateSelected'])) $stateSelected = $_REQUEST['stateSelected'];
+if (!isset($stateSelected)) $stateSelected='States';
+
+print_simple_header(WT_I18N::translate('Select flag'));
+if (!is_dir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/flags/')) {
+ echo WT_I18N::translate('The flags directory doesn\'t exist.'), '<br /><br />', WT_I18N::translate('To make the flags work make sure that %s directory exists and contains flags files. They can be downloaded from Addons section of webtrees site.', WT_MODULES_DIR.'googlemap/places/flags/'), '<br /><br />';
+ echo '<a href="', WT_WEBTREES_URL, 'en/add-ons/gmfiles">', WT_I18N::translate('Download flags'), '</a>';
+ echo '<br /><br /><div class="center"><a href="javascript:;" onclick="window.close();">', WT_I18N::translate('Close Window'), '</a></div><br />';
+ print_simple_footer();
+ return;
+}
+
+$country = array();
+$rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/flags/');
+while ($file = readdir($rep)) {
+ if (stristr($file, '.png')) {
+ $country[] = substr($file, 0, strlen($file)-4);
+ }
+}
+closedir($rep);
+sort($country);
+
+if ($countrySelected == 'Countries') {
+ $flags = $country;
+}
+else {
+ $flags = array();
+ $rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/');
+ while ($file = readdir($rep)) {
+ if (stristr($file, '.png')) {
+ $flags[] = substr($file, 0, strlen($file)-4);
+ }
+ }
+ closedir($rep);
+ sort($flags);
+}
+$flags_s = array();
+if ($stateSelected != 'States' && is_dir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$stateSelected.'/')) {
+ $rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$stateSelected.'/');
+ while ($file = readdir($rep)) {
+ if (stristr($file, '.png')) {
+ $flags_s[] = substr($file, 0, strlen($file)-4);
+ }
+ }
+ closedir($rep);
+ sort($flags_s);
+}
+
+if ($action == 'ChangeFlag') {
+?>
+ <script type="text/javascript">
+ <!--
+ function edit_close() {
+<?php if ($_POST['selcountry'] == 'Countries') { ?>
+ window.opener.document.editplaces.icon.value = 'places/flags/<?php echo $flags[$_POST['FLAGS']]; ?>.png';
+ window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_MODULES_DIR; ?>googlemap/places/flags/<?php echo $country[$_POST['FLAGS']]; ?>.png\">&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>";
+<?php } else if ($_POST["selstate"] != "States"){ ?>
+ window.opener.document.editplaces.icon.value = 'places/<?php echo $countrySelected, '/flags/', $_POST['selstate'], '/', $flags_s[$_POST['FLAGS']]; ?>.png';
+ window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_MODULES_DIR; ?>googlemap/places/<?php echo $countrySelected, "/flags/", $_POST["selstate"], "/", $flags_s[$_POST['FLAGS']]; ?>.png\">&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>";
+<?php } else { ?>
+ window.opener.document.editplaces.icon.value = "places/<?php echo $countrySelected, "/flags/", $flags[$_POST['FLAGS']]; ?>.png";
+ window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_MODULES_DIR; ?>googlemap/places/<?php echo $countrySelected, "/flags/", $flags[$_POST['FLAGS']]; ?>.png\">&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>";
+<?php } ?>
+ window.close();
+ }
+ //-->
+ </script>
+<?php
+ // autoclose window when update successful unless debug on
+ if (!WT_DEBUG) {
+ echo "\n<script type=\"text/javascript\">\n<!--\nedit_close();\n//-->\n</script>";
+ }
+ echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close();\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
+ print_simple_footer();
+ exit;
+}
+else {
+?>
+<script type="text/javascript">
+<!--
+ function enableButtons() {
+ document.flags.save1.disabled = '';
+ document.flags.save2.disabled = '';
+ }
+
+ function selectCountry() {
+ if (document.flags.COUNTRYSELECT.value == 'Countries') {
+ window.location="module.php?mod=googlemap&mod_action=flags";
+ }
+ else if (document.flags.STATESELECT.value != 'States') {
+ window.location="module.php?mod=googlemap&mod_action=flags&countrySelected=" + document.flags.COUNTRYSELECT.value + "&stateSelected=" + document.flags.STATESELECT.value;
+ }
+ else {
+ window.location="module.php?mod=googlemap&mod_action=flags&countrySelected=" + document.flags.COUNTRYSELECT.value;
+ }
+ }
+
+ function edit_close() {
+ window.close();
+ }
+
+//-->
+</script>
+<?php
+}
+ if (!isset($_SESSION['flags_countrylist'])) {
+ $countryList = array();
+ $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/');
+ for ($i = 0; $i < count($country); $i++) {
+ if (count(preg_grep('/'.$country[$i].'/', $placesDir)) != 0) {
+ $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$country[$i].'/');
+ while ($file = readdir($rep)) {
+ if (stristr($file, 'flags')) {
+ $countryList[$country[$i]] = $countries[$country[$i]];
+ }
+ }
+ closedir($rep);
+ }
+ }
+ asort($countryList);
+ $_SESSION['flags_countrylist'] = serialize($countryList);
+ } else {
+ $countryList = unserialize($_SESSION['flags_countrylist']);
+ }
+ $stateList = array();
+ if ($countrySelected != 'Countries') {
+ $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/');
+ for ($i = 0; $i < count($flags); $i++) {
+ if (in_array($flags[$i], $placesDir)) {
+ $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$flags[$i].'/');
+ while ($file = readdir($rep)) {
+ $stateList[$flags[$i]] = $flags[$i];
+ }
+ closedir($rep);
+ }
+ }
+ asort($stateList);
+ }
+?>
+
+<form method="post" id="flags" name="flags" action="module.php?mod=googlemap&mod_action=flags&countrySelected=<?php echo $countrySelected; ?>&stateSelected=<?php echo $stateSelected; ?>">
+ <input type="hidden" name="action" value="ChangeFlag" />
+ <input type="hidden" name="selcountry" value="<?php echo $countrySelected; ?>" />
+ <input type="hidden" name="selstate" value="<?php echo $stateSelected; ?>" />
+ <input id="savebutton" name="save1" type="submit" disabled="true" value="<?php echo WT_I18N::translate('Save'); ?>" /><br />
+ <table class="facts_table">
+ <tr>
+ <td class="optionbox" colspan="4">
+ <?php echo help_link('PLE_FLAGS','googlemap'); ?>
+ <select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()">
+ <option value="Countries"><?php echo WT_I18N::translate('Countries'); ?></option>
+ <?php foreach ($countryList as $country_key=>$country_name) {
+ echo '<option value="', $country_key, '"';
+ if ($countrySelected == $country_key) echo ' selected="selected" ';
+ echo '>', $country_name, '</option>';
+ } ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+<?php
+ $j = 1;
+ for ($i = 0; $i < count($flags); $i++) {
+ if ($countrySelected == 'Countries') {
+ $tempstr = "<td><input type=\"radio\" dir=\"ltr\" name=\"FLAGS\" value=\"".$i."\" onchange=\"enableButtons();\"><img src=\"".WT_MODULES_DIR."googlemap/places/flags/".$flags[$i].".png\" alt=\"".$flags[$i]."\" title=\"";
+ if ($flags[$i]!='blank') $tempstr.=$countries[$flags[$i]];
+ else $tempstr.=$countries['???'];
+ echo $tempstr, "\">&nbsp;&nbsp;", $flags[$i], "</input></td>\n";
+ }
+ else {
+ echo "<td><input type=\"radio\" dir=\"ltr\" name=\"FLAGS\" value=\"", $i, "\" onchange=\"enableButtons();\"><img src=\"".WT_MODULES_DIR."googlemap/places/", $countrySelected, "/flags/", $flags[$i], ".png\">&nbsp;&nbsp;", $flags[$i], "</input></td>\n";
+ }
+ if ($j == 4) {
+ echo "</tr><tr>\n";
+ $j = 0;
+ }
+ $j++;
+ }
+ echo '</tr><tr';
+ if ($countrySelected == 'Countries' || count($stateList)==0) {
+ echo ' style=" visibility: hidden"';
+ }
+ echo '>';
+?>
+ <td class="optionbox" colspan="4">
+ <?php echo help_link('PLE_FLAGS','googlemap'); ?>
+ <select name="STATESELECT" dir="ltr" onchange="selectCountry()">
+ <option value="States"><?php echo /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'); ?></option>
+ <?php foreach ($stateList as $state_key=>$state_name) {
+ echo "<option value=\"", $state_key, "\"";
+ if ($stateSelected == $state_key) echo " selected=\"selected\" ";
+ echo ">", $state_name, "</option>\n";
+ } ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+<?php
+ $j = 1;
+ for ($i = 0; $i < count($flags_s); $i++) {
+ if ($stateSelected != "States") {
+ echo "<td><input type=\"radio\" dir=\"ltr\" name=\"FLAGS\" value=\"", $i, "\" onchange=\"enableButtons();\"><img src=\"".WT_MODULES_DIR."googlemap/places/", $countrySelected, "/flags/", $stateSelected, "/", $flags_s[$i], ".png\">&nbsp;&nbsp;", $flags_s[$i], "</input></td>\n";
+ }
+ if ($j == 4) {
+ echo "</tr><tr>\n";
+ $j = 0;
+ }
+ $j++;
+ }
+?>
+ </tr>
+ </table>
+ <input id="savebutton" name="save2" type="submit" disabled="true" value="<?php echo WT_I18N::translate('Save'); ?>" /><br />
+</form>
+<?php
+echo '<div class="center"><a href="javascript:;" onclick="edit_close();">', WT_I18N::translate('Close Window'), '</a></div><br />';
+
+print_simple_footer();
diff --git a/modules_v3/googlemap/googlemap.php b/modules_v3/googlemap/googlemap.php
new file mode 100644
index 0000000000..ae022d9b62
--- /dev/null
+++ b/modules_v3/googlemap/googlemap.php
@@ -0,0 +1,640 @@
+<?php
+// Google map module for phpGedView
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// functions copied from print_fact_place
+function print_fact_place_map($factrec) {
+ $ct = preg_match("/2 PLAC (.*)/", $factrec, $match);
+ if ($ct>0) {
+ $retStr = ' ';
+ $levels = explode(',', $match[1]);
+ $place = trim($match[1]);
+ // reverse the array so that we get the top level first
+ $levels = array_reverse($levels);
+ $retStr .= '<a href="placelist.php?action=show&amp;';
+ foreach ($levels as $pindex=>$ppart) {
+ // routine for replacing ampersands
+ $ppart = preg_replace("/amp\%3B/", "", trim($ppart));
+ $retStr .= "parent[$pindex]=".PrintReady($ppart)."&amp;";
+ }
+ $retStr .= 'level='.count($levels);
+ $retStr .= '"> '.PrintReady($place).'</a>';
+ return $retStr;
+ }
+ return '';
+}
+
+
+function print_address_structure_map($factrec, $level) {
+ global $WORD_WRAPPED_NOTES;
+ global $POSTAL_CODE;
+
+ // $POSTAL_CODE = 'false' - before city, 'true' - after city and/or state
+ //-- define per gedcom till can do per address countries in address languages
+ //-- then this will be the default when country not recognized or does not exist
+ //-- both Finland and Suomi are valid for Finland etc.
+ //-- see http://www.bitboost.com/ref/international-address-formats.html
+
+ $nlevel = $level+1;
+ $ct = preg_match_all("/$level ADDR(.*)/", $factrec, $omatch, PREG_SET_ORDER);
+ for ($i=0; $i<$ct; $i++) {
+ $arec = get_sub_record($level, "$level ADDR", $factrec, $i+1);
+ $resultText = '';
+ $cn = preg_match("/$nlevel _NAME (.*)/", $arec, $cmatch);
+ if ($cn>0) $resultText .= str_replace("/", "", $cmatch[1]).'<br />';
+ $resultText .= PrintReady(trim($omatch[$i][1]));
+ $cont = get_cont($nlevel, $arec);
+ if (!empty($cont)) $resultText .= str_replace(array(' ', "<br&nbsp;"), array("&nbsp;", "<br "), PrintReady($cont));
+ else {
+ if (strlen(trim($omatch[$i][1])) > 0) echo '<br />';
+ $cs = preg_match("/$nlevel ADR1 (.*)/", $arec, $cmatch);
+ if ($cs>0) {
+ if ($cn==0) {
+ $resultText .= '<br />';
+ $cn=0;
+ }
+ $resultText .= PrintReady($cmatch[1]);
+ }
+ $cs = preg_match("/$nlevel ADR2 (.*)/", $arec, $cmatch);
+ if ($cs>0) {
+ if ($cn==0) {
+ $resultText .= '<br />';
+ $cn=0;
+ }
+ $resultText .= PrintReady($cmatch[1]);
+ }
+
+ if ($POSTAL_CODE) {
+ if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch))
+ $resultText.=' '.PrintReady($cmatch[1]);
+ if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch))
+ $resultText.=', '.PrintReady($cmatch[1]);
+ if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch))
+ $resultText.='<br />'.PrintReady($cmatch[1]);
+ } else {
+ if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch))
+ $resultText.='<br />'.PrintReady($cmatch[1]);
+ if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch))
+ $resultText.=' '.PrintReady($cmatch[1]);
+ if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch))
+ $resultText.=', '.PrintReady($cmatch[1]);
+ }
+ }
+ if (preg_match("/$nlevel CTRY (.*)/", $arec, $cmatch))
+ $resultText.='<br />'.PrintReady($cmatch[1]);
+ $resultText.= '<br />';
+ // Here we can examine the resultant text and remove empty tags
+ echo str_replace(chr(10), ' ' , $resultText);
+ }
+ $resultText = "<table>";
+ $ct = preg_match_all("/$level PHON (.*)/", $factrec, $omatch, PREG_SET_ORDER);
+ for ($i=0; $i<$ct; $i++) {
+ $resultText .= '<tr><td><span class="label"><b>'.WT_Gedcom_Tag::getLabel('PHON').': </b></span></td><td><span class="field">';
+ $resultText .= getLRM() . $omatch[$i][1]. getLRM();
+ $resultText .= '</span></td></tr>';
+ }
+ $ct = preg_match_all("/$level FAX (.*)/", $factrec, $omatch, PREG_SET_ORDER);
+ for ($i=0; $i<$ct; $i++) {
+ $resultText .= '<tr><td><span class="label"><b>'.WT_Gedcom_Tag::getLabel('FAX').': </b></span></td><td><span class="field">';
+ $resultText .= getLRM() . $omatch[$i][1] . getLRM();
+ $resultText .= '</span></td></tr>';
+ }
+ $ct = preg_match_all("/$level EMAIL (.*)/", $factrec, $omatch, PREG_SET_ORDER);
+ for ($i=0; $i<$ct; $i++) {
+ $resultText .= '<tr><td><span class="label"><b>'.WT_Gedcom_Tag::getLabel('EMAIL').': </b></span></td><td><span class="field">';
+ $resultText .= '<a href="mailto:'.$omatch[$i][1].'">'.$omatch[$i][1].'</a>';
+ $resultText .= '</span></td></tr>';
+ }
+ $ct = preg_match_all("/$level (WWW|URL) (.*)/", $factrec, $omatch, PREG_SET_ORDER);
+ for ($i=0; $i<$ct; $i++) {
+ $resultText .= '<tr><td><span class="label"><b>'.WT_Gedcom_Tag::getLabel('URL').': </b></span></td><td><span class="field">';
+ $resultText .= '<a href="'.$omatch[$i][2].'" target="_blank">'.$omatch[$i][2].'</a>';
+ $resultText .= '</span></td></tr>';
+ }
+ $resultText .= '</table>';
+ if ($resultText!='<table></table>') echo str_replace(chr(10), ' ' , $resultText);
+}
+
+function rem_prefix_from_placename($prefix_list, $place, &$placelist) {
+ $prefix_split = explode(';', $prefix_list);
+ foreach ($prefix_split as $prefix) {
+ if ($prefix && substr($place, 0, strlen($prefix)+1)==$prefix.' ') {
+ $placelist[] = substr($place, strlen($prefix)+1);
+ }
+ }
+ return $placelist;
+}
+
+function rem_postfix_from_placename($postfix_list, $place, &$placelist) {
+ $postfix_split = explode (';', $postfix_list);
+ foreach ($postfix_split as $postfix) {
+ if ($postfix && substr($place, -strlen($postfix)-1)==' '.$postfix) {
+ $placelist[] = substr($place, 0, strlen($place)-strlen($postfix)-1);
+ }
+ }
+ return $placelist;
+}
+
+function rem_prefix_postfix_from_placename($prefix_list, $postfix_list, $place, &$placelist) {
+ $prefix_split = explode (";", $prefix_list);
+ $postfix_split = explode (";", $postfix_list);
+ foreach ($prefix_split as $prefix) {
+ foreach ($postfix_split as $postfix) {
+ if ($prefix && $postfix && substr($place, 0, strlen($prefix)+1)==$prefix.' ' && substr($place, -strlen($postfix)-1)==' '.$postfix) {
+ $placelist[] = substr($place, strlen($prefix)+1, strlen($place)-strlen($prefix)-strlen($postfix)-2);
+ }
+ }
+ }
+ return $placelist;
+}
+
+function create_possible_place_names ($placename, $level) {
+ global $GM_PREFIX, $GM_POSTFIX, $GM_PRE_POST_MODE;
+
+ $retlist = array();
+
+ switch (@$GM_PRE_POST_MODE[$level]) {
+ case 0: // 0: no pre/postfix
+ $retlist[] = $placename;
+ break;
+ case 1: // 1 = Normal name, Prefix, Postfix, Both
+ $retlist[] = $placename;
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ break;
+ case 2: // 2 = Normal name, Postfix, Prefix, Both
+ $retlist[] = $placename;
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ break;
+ case 3: // 3 = Prefix, Postfix, Both, Normal name
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ $retlist[] = $placename;
+ break;
+ case 4: // 4 = Postfix, Prefix, Both, Normal name
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ $retlist[] = $placename;
+ break;
+ case 5: // 5 = Prefix, Postfix, Normal name, Both
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist[] = $placename;
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ break;
+ case 6: // 6 = Postfix, Prefix, Normal name, Both
+ $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist);
+ $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist);
+ $retlist[] = $placename;
+ $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist);
+ break;
+ }
+ return $retlist;
+}
+
+function abbreviate($text) {
+ if (utf8_strlen($text)>13) {
+ if (trim(utf8_substr($text, 10, 1))!='') {
+ $desc = utf8_substr($text, 0, 11).'.';
+ } else {
+ $desc = trim(utf8_substr($text, 0, 11));
+ }
+ }
+ else $desc = $text;
+ return $desc;
+}
+
+function get_lati_long_placelocation ($place) {
+ $parent = explode (',', $place);
+ $parent = array_reverse($parent);
+ $place_id = 0;
+ for ($i=0; $i<count($parent); $i++) {
+ $parent[$i] = trim($parent[$i]);
+ if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , ,
+ $placelist = create_possible_place_names($parent[$i], $i+1);
+ foreach ($placelist as $key => $placename) {
+ $pl_id=
+ WT_DB::prepare("SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
+ ->execute(array($i, $place_id, $placename))
+ ->fetchOne();
+ if (!empty($pl_id)) break;
+ }
+ if (empty($pl_id)) break;
+ $place_id = $pl_id;
+ }
+
+ $row=
+ // WT_DB::prepare("SELECT pl_lati, pl_long, pl_zoom, pl_icon, pl_level FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place")
+ WT_DB::prepare("SELECT pl_media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, pl_lati, pl_long, pl_zoom, pl_icon, pl_level FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place")
+ ->execute(array($place_id))
+ ->fetchOneRow();
+ if ($row) {
+ return array('media'=>$row->pl_media, 'sv_lati'=>$row->sv_lati, 'sv_long'=>$row->sv_long, 'sv_bearing'=>$row->sv_bearing, 'sv_elevation'=>$row->sv_elevation, 'sv_zoom'=>$row->sv_zoom, 'lati'=>$row->pl_lati, 'long'=>$row->pl_long, 'zoom'=>$row->pl_zoom, 'icon'=>$row->pl_icon, 'level'=>$row->pl_level);
+ } else {
+ return array();
+ }
+}
+
+function setup_map() {
+ global $GOOGLEMAP_MAP_TYPE, $GOOGLEMAP_MIN_ZOOM, $GOOGLEMAP_MAX_ZOOM;
+
+ ?>
+ <!-- V3 ============ -->
+ <script src="http://maps.google.com/maps/api/js?v=3.2&amp;sensor=false&amp;language=<?php echo WT_LOCALE; ?>" type="text/javascript"></script>
+ <!-- V3 ============ -->
+ <script type="text/javascript">
+ var minZoomLevel = <?php echo $GOOGLEMAP_MIN_ZOOM;?>;
+ var maxZoomLevel = <?php echo $GOOGLEMAP_MAX_ZOOM;?>;
+ var startZoomLevel = <?php echo $GOOGLEMAP_MAX_ZOOM;?>;
+ </script>
+ <?php
+}
+
+function build_indiv_map($indifacts, $famids) {
+ global $GOOGLEMAP_MAP_TYPE, $GOOGLEMAP_MIN_ZOOM, $GOOGLEMAP_MAX_ZOOM, $GEDCOM;
+ global $GOOGLEMAP_XSIZE, $GOOGLEMAP_YSIZE, $SHOW_LIVING_NAMES;
+ global $TEXT_DIRECTION, $GM_DEFAULT_TOP_VALUE, $GOOGLEMAP_COORD;
+
+ $zoomLevel = $GOOGLEMAP_MAX_ZOOM;
+ // Create the markers list array ===============================================================
+ $markers=array();
+ // Add the events to the markers list array=====================================================
+ //-- sort the facts into date order
+ sort_facts($indifacts);
+ $i = 0;
+ foreach ($indifacts as $key => $value) {
+ $fact = $value->getTag();
+ $fact_data=$value->getDetail();
+ $factrec = $value->getGedComRecord();
+ $placerec = null;
+
+ if ($value->getPlace()!=null) {
+ $placerec = get_sub_record(2, '2 PLAC', $factrec);
+ $addrFound = false;
+ } else {
+ if (preg_match("/\d ADDR (.*)/", $factrec, $match)) {
+ $placerec = get_sub_record(1, "\d ADDR", $factrec);
+ $addrFound = true;
+ }
+ }
+ if (!empty($placerec)) {
+ $ctla = preg_match("/\d LATI (.*)/", $placerec, $match1);
+ $ctlo = preg_match("/\d LONG (.*)/", $placerec, $match2);
+ $spouserec = get_sub_record(2, '2 _WTS', $factrec);
+ $ctlp = preg_match("/\d _WTS @(.*)@/", $spouserec, $spouseid);
+ if ($ctlp>0) {
+ $useThisItem = WT_Family::getInstance($spouseid[1])->canDisplayDetails();
+ } else {
+ $useThisItem = true;
+ }
+ if (($ctla>0) && ($ctlo>0) && ($useThisItem==true)) {
+ $i = $i + 1;
+ $markers[$i]=array('class'=>'optionbox', 'index'=>'', 'tabindex'=>'', 'placed'=>'no');
+ if ($fact == "EVEN" || $fact=="FACT") {
+ $eventrec = get_sub_record(1, '2 TYPE', $factrec);
+ if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) {
+ $markers[$i]['fact']=$match3[1];
+ } else {
+ $markers[$i]['fact']=WT_Gedcom_Tag::getLabel($fact);
+ }
+ } else {
+ $markers[$i]['fact']=WT_Gedcom_Tag::getLabel($fact);
+ }
+ if (!empty($fact_data) && $fact_data!='Y') {
+ $markers[$i]['info'] = $fact_data;
+ }
+ $markers[$i]['placerec'] = $placerec;
+ $match1[1] = trim($match1[1]);
+ $match2[1] = trim($match2[1]);
+ $markers[$i]['lati'] = str_replace(array('N', 'S', ','), array('', '-', '.') , $match1[1]);
+ $markers[$i]['lng'] = str_replace(array('E', 'W', ','), array('', '-', '.') , $match2[1]);
+ $ctd = preg_match("/2 DATE (.+)/", $factrec, $match);
+ if ($ctd>0) {
+ $markers[$i]['date'] = $match[1];
+ }
+ if ($ctlp>0) {
+ $markers[$i]['name']=$spouseid[1];
+ }
+ } else {
+ if ($useThisItem==true && $addrFound==false) {
+ $ctpl = preg_match("/\d PLAC (.*)/", $placerec, $match1);
+ $latlongval = get_lati_long_placelocation($match1[1]);
+ if ((count($latlongval) == 0) && (!empty($GM_DEFAULT_TOP_VALUE))) {
+ $latlongval = get_lati_long_placelocation($match1[1].', '.$GM_DEFAULT_TOP_VALUE);
+ if ((count($latlongval) != 0) && ($latlongval['level'] == 0)) {
+ $latlongval['lati'] = NULL;
+ $latlongval['long'] = NULL;
+ }
+ }
+ if ((count($latlongval) != 0) && ($latlongval['lati'] != NULL) && ($latlongval['long'] != NULL)) {
+ $i = $i + 1;
+ $markers[$i]=array('class'=>'optionbox', 'index'=>'', 'tabindex'=>'', 'placed'=>'no');
+ if ($fact == "EVEN" || $fact=="FACT") {
+ $eventrec = get_sub_record(1, '2 TYPE', $factrec);
+ if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) {
+ $markers[$i]['fact']=$match3[1];
+ } else {
+ $markers[$i]['fact']=WT_Gedcom_Tag::getLabel($fact);
+ }
+ } else {
+ $markers[$i]['fact']=WT_Gedcom_Tag::getLabel($fact);
+ }
+ if (!empty($fact_data) && $fact_data!='Y') {
+ $markers[$i]['info'] = $fact_data;
+ }
+ $markers[$i]['icon'] = $latlongval['icon'];
+ $markers[$i]['placerec'] = $placerec;
+ if ($zoomLevel > $latlongval['zoom']) {
+ $zoomLevel = $latlongval['zoom'];
+ }
+ $markers[$i]['lati'] = str_replace(array('N', 'S', ','), array('', '-', '.') , $latlongval['lati']);
+ $markers[$i]['lng'] = str_replace(array('E', 'W', ','), array('', '-', '.') , $latlongval['long']);
+ $markers[$i]['media'] = $latlongval['media'];
+ $markers[$i]['sv_lati'] = $latlongval['sv_lati'];
+ $markers[$i]['sv_long'] = $latlongval['sv_long'];
+ $markers[$i]['sv_bearing'] = $latlongval['sv_bearing'];
+ $markers[$i]['sv_elevation'] = $latlongval['sv_elevation'];
+ $markers[$i]['sv_zoom'] = $latlongval['sv_zoom'];
+ $ctd = preg_match("/2 DATE (.+)/", $factrec, $match);
+ if ($ctd>0) {
+ $markers[$i]['date'] = $match[1];
+ }
+ if ($ctlp>0) {
+ $markers[$i]['name']=$spouseid[1];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Add children to the markers list array ======================================================
+ if (count($famids)>0) {
+ $hparents=false;
+ for ($f=0; $f<count($famids); $f++) {
+ if (!empty($famids[$f])) {
+ $famrec = find_gedcom_record($famids[$f], WT_GED_ID, true);
+ if ($famrec) {
+ $num = preg_match_all("/1\s*CHIL\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
+ for ($j=0; $j<$num; $j++) {
+ $person=WT_Person::getInstance($smatch[$j][1]);
+ if ($person->canDisplayDetails()) {
+ $srec = find_person_record($smatch[$j][1], WT_GED_ID);
+ $birthrec = '';
+ $placerec = '';
+ foreach ($person->getAllFactsByType('BIRT') as $sEvent) {
+ $birthrec = $sEvent->getGedcomRecord();
+ $placerec = get_sub_record(2, '2 PLAC', $birthrec);
+ if (!empty($placerec)) {
+ $ctd = preg_match("/\d DATE (.*)/", $birthrec, $matchd);
+ $ctla = preg_match("/\d LATI (.*)/", $placerec, $match1);
+ $ctlo = preg_match("/\d LONG (.*)/", $placerec, $match2);
+ if (($ctla>0) && ($ctlo>0)) {
+ $i = $i + 1;
+ $markers[$i]=array('index'=>'', 'tabindex'=>'', 'placed'=>'no');
+ if (strpos($srec, "\n1 SEX F")!==false) {
+ $markers[$i]['fact'] = WT_I18N::translate('Daughter');
+ $markers[$i]['class'] = 'person_boxF';
+ } else {
+ if (strpos($srec, "\n1 SEX M")!==false) {
+ $markers[$i]['fact'] = WT_I18N::translate('Son');
+ $markers[$i]['class'] = 'person_box';
+ } else {
+ $markers[$i]['fact'] = WT_Gedcom_Tag::getLabel('CHIL');
+ $markers[$i]['class'] = 'person_boxNN';
+ }
+ }
+ $markers[$i]['placerec'] = $placerec;
+ $match1[1] = trim($match1[1]);
+ $match2[1] = trim($match2[1]);
+ $markers[$i]['lati'] = str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]);
+ $markers[$i]['lng'] = str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]);
+ if ($ctd > 0) {
+ $markers[$i]['date'] = $matchd[1];
+ }
+ $markers[$i]['name'] = $smatch[$j][1];
+ } else {
+ $ctpl = preg_match("/\d PLAC (.*)/", $placerec, $match1);
+ $latlongval = get_lati_long_placelocation($match1[1]);
+ if ((count($latlongval) == 0) && (!empty($GM_DEFAULT_TOP_VALUE))) {
+ $latlongval = get_lati_long_placelocation($match1[1].', '.$GM_DEFAULT_TOP_VALUE);
+ if ((count($latlongval) != 0) && ($latlongval['level'] == 0)) {
+ $latlongval['lati'] = NULL;
+ $latlongval['long'] = NULL;
+ }
+ }
+ if ((count($latlongval) != 0) && ($latlongval['lati'] != NULL) && ($latlongval['long'] != NULL)) {
+ $i = $i + 1;
+ $markers[$i]=array('index'=>'', 'tabindex'=>'', 'placed'=>'no');
+ $markers[$i]['fact'] = WT_Gedcom_Tag::getLabel('CHIL');
+ $markers[$i]['class'] = 'option_boxNN';
+ if (strpos($srec, "\n1 SEX F")!==false) {
+ $markers[$i]['fact'] = WT_I18N::translate('Daughter');
+ $markers[$i]['class'] = 'person_boxF';
+ }
+ if (strpos($srec, "\n1 SEX M")!==false) {
+ $markers[$i]['fact'] = WT_I18N::translate('Son');
+ $markers[$i]['class'] = 'person_box';
+ }
+ $markers[$i]['icon'] = $latlongval['icon'];
+ $markers[$i]['placerec'] = $placerec;
+ if ($zoomLevel > $latlongval['zoom']) {
+ $zoomLevel = $latlongval['zoom'];
+ }
+ $markers[$i]['lati'] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval['lati']);
+ $markers[$i]['lng'] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval['long']);
+ if ($ctd > 0) {
+ $markers[$i]['date'] = $matchd[1];
+ }
+ $markers[$i]['name'] = $smatch[$j][1];
+ $markers[$i]['media'] = $latlongval['media'];
+ $markers[$i]['sv_lati'] = $latlongval['sv_lati'];
+ $markers[$i]['sv_long'] = $latlongval['sv_long'];
+ $markers[$i]['sv_bearing'] = $latlongval['sv_bearing'];
+ $markers[$i]['sv_elevation'] = $latlongval['sv_elevation'];
+ $markers[$i]['sv_zoom'] = $latlongval['sv_zoom'];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Prepare the $markers array for use by the following "required" file/files ===================
+ if ($i == 0) {
+ echo '<table class="facts_table">';
+ echo '<tr><td colspan="2" class="facts_value">', WT_I18N::translate('No map data for this person');
+ echo '</td></tr>';
+ if (WT_USER_IS_ADMIN) {
+ echo '<tr><td align="center" colspan="2">';
+ echo '<a href="module.php?mod=googlemap&mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>';
+ echo '</td></tr>';
+ }
+ } else {
+ $indexcounter = 0;
+ for ($j=1; $j<=$i; $j++) {
+ if ($markers[$j]['placed'] == 'no') {
+ $multimarker = -1;
+ // Count nr of locations where the long/lati is identical
+ for ($k=$j; $k<=$i; $k++) {
+ if (($markers[$j]['lati'] == $markers[$k]['lati']) && ($markers[$j]['lng'] == $markers[$k]['lng'])) {
+ $multimarker = $multimarker + 1;
+ }
+ }
+ // If only one location with this long/lati combination
+ if ($multimarker == 0) {
+ // --- NOTE for V3 api, following line is changed from "yes" to "no" -----------
+ // --- This aids in identifying multi-event locations
+ $markers[$j]['placed'] = 'no';
+ // -----------------------------------------------------------------------------
+ $markers[$j]['index'] = $indexcounter;
+ $markers[$j]['tabindex'] = 0;
+ $indexcounter = $indexcounter + 1;
+ } else {
+ $tabcounter = 0;
+ $markersindex = 0;
+ $markers[$j]['placed'] = 'yes';
+ $markers[$j]['index'] = $indexcounter;
+ $markers[$j]['tabindex'] = $tabcounter;
+ $tabcounter = $tabcounter + 1;
+ for ($k=$j+1; $k<=$i; $k++) {
+ if (($markers[$j]['lati'] == $markers[$k]['lati']) && ($markers[$j]['lng'] == $markers[$k]['lng'])) {
+ $markers[$k]['placed'] = 'yes';
+ $markers[$k]['index'] = $indexcounter;
+ // if ($tabcounter == 4) {
+ // V3 ==============================
+ if ($tabcounter == 30) {
+ // V3 ==============================
+ $indexcounter = $indexcounter + 1;
+ $tabcounter = 0;
+ $markersindex = $markersindex + 1;
+ }
+ $markers[$k]['index'] = $indexcounter;
+ $markers[$k]['tabindex'] = $tabcounter;
+ $tabcounter = $tabcounter + 1;
+ }
+ }
+ $indexcounter = $indexcounter + 1;
+ }
+ }
+ }
+
+ // === add $gmarks array to the required wt_v3_googlemap.js.php ============================
+ $gmarks = $markers;
+
+ global $controller;
+ $pid=$controller->indi->getXref();
+
+ // === Include css and js files ============================================================
+ echo '<link type="text/css" href="', WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet" />';
+ require_once WT_ROOT.WT_MODULES_DIR.'googlemap/wt_v3_googlemap.js.php';
+
+ // === Create the normal googlemap sidebar of events and children ==========================
+ echo '<div style="overflow: auto; overflow-x: hidden; overflow-y: auto; height:', $GOOGLEMAP_YSIZE, 'px;"><table class="facts_table">';
+ $z=0;
+
+ foreach($markers as $marker) {
+ echo '<tr>';
+ echo '<td class="facts_label">';
+ echo '<a href="javascript:myclick(', $z, ', ', $marker['index'], ', ', $marker['tabindex'], ')">', $marker['fact'], '</a></td>';
+ $z++;
+ echo '<td class="', $marker['class'], '" style="white-space: normal">';
+ if (!empty($marker['info'])) {
+ echo '<span class="field">', $marker['info'], '</span><br />';
+ }
+ if (!empty($marker['name'])) {
+ $person=WT_Person::getInstance($marker['name']);
+ if ($person) {
+ echo '<a href="', $person->getHtmlUrl(), '">', $person->canDisplayName() ? PrintReady($person->getFullName()) : WT_I18N::translate('Private'), '</a>';
+ }
+ echo '<br />';
+ }
+ if (preg_match("/2 PLAC (.*)/", $marker['placerec']) == 0) {
+ print_address_structure_map($marker['placerec'], 1);
+ } else {
+ echo print_fact_place_map($marker['placerec']), '<br />';
+ }
+ if (!empty($marker['date'])) {
+ $date=new WT_Date($marker['date']);
+ echo $date->Display(true), '<br />';
+ }
+ echo '</td>';
+ echo '</tr>';
+ }
+ echo '</table></div><br />';
+ } // end prepare markers array =================================================================
+
+ // ======= More V3 api stuff (not displayed now) but will be sorted later ==========
+ ?>
+ <table id="s_bar" style="display:none;">
+ <tr>
+ <td valign="top" style="padding-left:5px; width:360px; text-decoration:none; color:#4444ff; background:#aabbd8;">
+ <div id="side_bar"></div>
+ </td>
+ </tr>
+ </table>
+ <table style="display:none;">
+ <tr>
+ <td style="width: 360px; text-align:center;">
+ <form style="width: 360px;" id="form1" action="#">
+ <!-- Event Map:<input name= "radio1" type="checkbox" id="theatrebox" onclick="boxclick(this,'theatre')" checked /> &nbsp; -->
+ Street View Only:<input name= "radio2" type="checkbox" id="golfbox" onclick="boxclick(this,'golf')" /> &nbsp;
+ <!-- Other Map:<input type="checkbox" id="infobox" onclick="boxclick(this,'info')" /> -->
+
+ <?php
+ // --------- Maybe for later use ---------------
+ /*
+ Other Map:<input type="checkbox" id="infobox" onclick="boxclick(this,'info')" />
+ <b>Pedigree Map:</b><input id="sel2" name="select" type=radio />
+ &nbsp;&nbsp;
+ Parents: <input type="checkbox" id="parentsbox" onclick="boxclick(this,'gen1')" /> &nbsp;&nbsp;
+ Grandparents: <input type="checkbox" id="gparentsbox" onclick="boxclick(this,'gen2')" /> &nbsp;&nbsp;
+ Great Grandparents: <input type="checkbox" id="ggparentsbox" onclick="boxclick(this,'gen3')" /><br />
+ */
+ ?>
+ </form>
+ </td>
+ <td style="width: 200px;">
+ </td>
+ </tr>
+ </table>
+ <?php
+ // =================================================================================
+ echo '<br />';
+ return $i;
+} // end build_indiv_map function
diff --git a/modules_v3/googlemap/googlemap_readme.txt b/modules_v3/googlemap/googlemap_readme.txt
new file mode 100644
index 0000000000..b231597fc7
--- /dev/null
+++ b/modules_v3/googlemap/googlemap_readme.txt
@@ -0,0 +1,69 @@
+README file for the Google Maps module for webtrees
+
+The files in this archive should be extracted into your modules directory.
+
+These are the instruction on getting your Google Maps interface to work:
+
+1. Go to the Modules. You can find this page under the Administration page.
+2. Tick Enable Google Maps.
+
+The map will only be shown if at least one fact has a place with coordinates
+attached to it. Attaching a coordinate can be done through the generic
+place-location interface (located at the Google Maps configuration page) or
+by specifying a MAP record with an event.
+
+Adding places one by one to your GEDCOM file (not recommended):
+
+This method is included so that you may have an idea of how a GEDCOM stores
+place data. You do not need the Google Maps module to use this procedure.
+The co-ordinates for an event can only be added directly to a GEDCOM file.
+The correct way to do this is for a PLAC record:
+2 PLAC <Placename>
+3 MAP
+4 LONG <Longitude>
+4 LATI <Latitude>
+(Make sure you use the "3 MAP" record after a PLAC record.)
+The MAP, LONG and LATI lines should be added directly after the PLAC line.
+In the ‘edit’ function pop-up window, there is a ‘+’ (plus sign) under ‘Place’
+where you can select a country, state, county, and city that exists in your
+webtrees ‘place’ file. This can help avoid duplications by various spellings
+or versions of the same place. The webtrees configuration allows for ‘expanded’
+editing if that option is selected.
+
+It is also possible to define a MAP record within a ADDR record, even though
+this is not according to the standard (these records are created by Legacy).
+
+Add a place using webtrees Google Maps module (recommended method):
+
+Forenote: the Google Map module is designed to work with locations in tree-like
+fashion. If we were to consider a suburb of London, the tree would take the
+order 'England, London, Hackney'. This is not how we enter place names in our
+family data, but it is how we manage the Google Map module. This will give
+access to useful place lookup features as we build up map information. It will
+help you find groups of people from the same locale. And it conforms to the
+GEDCOM specification, a feature of webtrees.
+
+And, BEFORE you start with any mapping endeavours, review your data. Make sure
+spelling is consistent, there are no 'almost' duplicates, places are in their
+right country, and the places you describe are in true tree fashion. Only then
+will the module make it easy for you to connect family data with Google Maps.
+
+This feature uses new database tables to store place text and location
+information. Existing places can be imported and location information can be
+added using graphic tools (zoom/click on map) or specific location data.
+
+The location information is held outside the GEDCOM (and can be shared between
+family trees in webtrees) and location data is entered only once for each place.
+Backup of location data is available by export of each new place database table
+to a text file (separated with ";"). Bulk additions can be performed by text
+file import (with reservations for specific place structure and spelling).
+
+Using the tree structure mentioned above, we start to build location data
+from the top down – which, in 99% of cases, will mean starting by entering
+a country. When that is done, we move to the next layer (state, county,
+whatever is appropriate for your locale.)
+
+To make the flags work make sure that ./places/flags directory exists.
+
+More information:
+http://wiki.webtrees.net/Google_Map_module \ No newline at end of file
diff --git a/modules_v3/googlemap/help_text.php b/modules_v3/googlemap/help_text.php
new file mode 100644
index 0000000000..ae6d29b852
--- /dev/null
+++ b/modules_v3/googlemap/help_text.php
@@ -0,0 +1,283 @@
+<?php
+/**
+ * Googlemap Module help text.
+ *
+ * This file is included from the application help_text.php script.
+ * It simply needs to set $title and $text for the help topic $help_topic
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @version $Id$
+ */
+
+if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+switch ($help) {
+
+case 'GOOGLEMAP_MAP_TYPE':
+ $title=WT_I18N::translate('Default map type');
+ $text=WT_I18N::translate('The type of map that will be shown by default. This can be Map, Satellite, Hybrid or Terrain.');
+ break;
+
+case 'GOOGLEMAP_MAP_SIZE':
+ $title=WT_I18N::translate('Size of map (in pixels)');
+ $text=WT_I18N::translate('The size of the map (in pixels) as shown on the Individual pages.');
+ break;
+
+case 'GOOGLEMAP_MAP_ZOOM':
+ $title=WT_I18N::translate('Zoom factor of map');
+ $text=WT_I18N::translate('Minimum and maximum zoom factor for the Google map. 1 is the full map, 15 is single house. Note that 15 is only available in certain areas.');
+ break;
+
+case 'GOOGLEMAP_PRECISION':
+ $title=WT_I18N::translate('Precision of the latitude and longitude');
+ $text=WT_I18N::translate('This specifies the precision of the different levels when entering new geographic locations. For example a country will be specified with precision 0 (=0 digits after the decimal point), while a town needs 3 or 4 digits.');
+ break;
+
+case 'GM_DEFAULT_LEVEL_0':
+ $title=WT_I18N::translate('Default value for top-level');
+ $text=WT_I18N::translate('Here the default level for the highest level in the place-hierarchy can be defined. If a place cannot be found this name is added as the highest level (country) and the database is searched again.');
+ break;
+
+case 'GM_NOF_LEVELS':
+ $title=WT_I18N::translate('Number of levels');
+ $text=WT_I18N::translate('This field indicates the number of levels in the places-hierarchy that is being used by the Googlemap modules.<br />The default value is 4 (Country, State, County, Place), which is usually good enough. If you want to add an extra level (for example to add specific location like cemeteries or schools) change this value. If you want to remove a level (for example county) you can also change this value, but keep in mind that the files containing the place-locations contain a 4-level structure.');
+ break;
+
+case 'GM_NAME_PREFIX':
+ $title=WT_I18N::translate('Prefix for names used on this level');
+ $text=WT_I18N::translate('This value will be added to the front of the names on this level. Multiple values can be used, seperated by semicolons.');
+ break;
+
+case 'GM_NAME_POSTFIX':
+ $title=WT_I18N::translate('Postfix for names used on this level');
+ $text=WT_I18N::translate('This value will be added to the back of the names on this level. Multiple values can be used, seperated by semilcolons.');
+ break;
+
+case 'GM_NAME_PRE_POST':
+ $title=WT_I18N::translate('Prefix / Postfix order');
+ $text=WT_I18N::translate('This field indicates the order in which names are tried using the prefix and postfix. The possible values are:<br /><ul><li>No pre/postfix</li><li>Normal name, Prefix, Postfix, both</li><li>Normal name, Postfix, Prefix, both</li><li>Prefix, Postfix, both, Normal name</li><li>Postfix, Prefix, both, Normal name</li><li>Prefix, Postfix, Normal name, both</li><li>Postfix, Prefix, Normal name, both</li></ul>');
+ break;
+
+case 'PL_EDIT_LOCATION':
+ $title=WT_I18N::translate('Edit or delete location');
+ $text=WT_I18N::translate('Here you can edit the location or delete the location. When you click on Edit a new window will open where you can change the values of the geographic location.<br />If you click on the delete-icon the record will be deleted. This can only be done if there are no records connected to this location. If no records are connected the delete-icon is active, otherwise it is inactive.');
+ break;
+
+case 'PL_ADD_LOCATION':
+ $title=WT_I18N::translate('Add geographic location');
+ $text=WT_I18N::translate('Use this to add a place to the location table. The location will be added at this level.');
+ break;
+
+case 'PL_IMPORT_GEDCOM':
+ $title=WT_I18N::translate('Import geographic locations from GEDCOM');
+ $text=WT_I18N::translate('Import geographic location-data from current GEDCOM. The current GEDCOM will be scanned and all places will be added to the table. If latitude and longitude are available these will also be imported.');
+ break;
+
+case 'PL_IMPORT_ALL_GEDCOM':
+ $title=WT_I18N::translate('Import geographic locations from all GEDCOMs');
+ $text=WT_I18N::translate('Import geographic location-data from all GEDCOMs. All GEDCOMs will be scanned and all places will be added to the table. If latitude and longitude are available these will also be imported.');
+ break;
+
+case 'PL_IMPORT_FILE':
+ $title=WT_I18N::translate('Import geographic locations from file');
+ $text=WT_I18N::translate('Import geographic location data from a file. The file should be formatted as CSV file on the local computer. The record separator used within the lines is \';\'.');
+ break;
+
+case 'PL_EXPORT_FILE':
+ $title=WT_I18N::translate('Export locations to file');
+ $text=WT_I18N::translate('Export location data to a file. This option will save the data from the current view and all dependant data to a file. This means that if a country is selected and the states are shown, this option will save the data of the states, all the counties that are defined in those states and all places within those counties.');
+ break;
+
+case 'PL_EXPORT_ALL_FILE':
+ $title=WT_I18N::translate('Export all locations to file');
+ $text=WT_I18N::translate('Export all location data to a file. This option will save all location data and transfer it to the local computer.');
+ break;
+
+case 'GOOGLEMAP_COORD':
+ $title=WT_I18N::translate('Display Map Coordinates');
+ $text=WT_I18N::translate('This options sets whether Latitude and Longitude are displayed on the pop-up window attached to map markers.');
+ break;
+
+// Help texts for places_edit.php
+
+case 'PLE_PLACES':
+ $title=WT_I18N::translate('Enter place name');
+ $text=WT_I18N::translate('Here you can enter or change the name of the place.<br />The \'Search on this level\' option allow to search the latitude and longitude of entered place name only among the places with that level.<br />The \'Search on this level\' option allow to search the latitude and longitude of all places having entered name. Some the lower levels places can not be displayed with this method of search.');
+ break;
+
+case 'PLE_PRECISION':
+ $title=WT_I18N::translate('Enter precision');
+ $text=WT_I18N::translate('Here you can enter the precision. Based on this setting the number of digits that will be used in the latitude and longitude is determined.');
+ break;
+
+case 'PLE_LATLON_CTRL':
+ $title=WT_I18N::translate('Enter latitude or Longitude');
+ $text=WT_I18N::translate('Here the latitude and longitude can be entered. First select the area you want to set (E/W or N/S). Next enter the value for latitude or longitude. This should be a decimal value.<br />The decimal value can be determined by converting the minutes and seconds using the following formula:<br />degrees_decimal = ((seconds / 60) + minutes) / 60 + degrees.');
+ break;
+
+case 'PLE_ZOOM':
+ $title=WT_I18N::translate('Enter zoom level');
+ $text=WT_I18N::translate('Here the zoom level can be entered. This value will be used as the minimal value when displaying this geographic location on a map.');
+ break;
+
+case 'PLE_ICON':
+ $title=WT_I18N::translate('Select an icon');
+ $text=WT_I18N::translate('Here an icon can be set or removed. Using this link a flag can be selected. When this geographic location is shown, this flag will be displayed.');
+ break;
+
+case 'PLE_FLAGS':
+ $title=WT_I18N::translate('Select flag');
+ $text=WT_I18N::translate('Using the pull down menu it is possible to select a country, of which a flag can be selected. If no flags are shown, then there are no flags defined for this country.');
+ break;
+
+case 'PLIF_FILENAME':
+ $title=WT_I18N::translate('Enter filename');
+ $text=WT_I18N::translate('Browse for the file on your computer which contains the place locations in CSV format.');
+ break;
+
+case 'PLIF_LOCALFILE':
+ $title=WT_I18N::translate('Enter filename');
+ $text=WT_I18N::translate('Select a file from the list of files already on the server which contains the place locations in CSV format.');
+ break;
+
+case 'PLIF_CLEAN':
+ $title=WT_I18N::translate('Clean placelocation database');
+ $text=WT_I18N::translate('When this option is selected the placelocation database will be cleared. This means that only the location stored in this table will be deleted. This will not change anything in the GEDCOM.');
+ break;
+
+case 'PLIF_UPDATE':
+ $title=WT_I18N::translate('Update existing records');
+ $text=WT_I18N::translate('Only update existing records.<br />When this option is selected only existing records will be updated. This can be used to fill in latitude and longitude of places that have been imported from a GEDCOM. No new places will be added to the database.');
+ break;
+
+case 'PLIF_OVERWRITE':
+ $title=WT_I18N::translate('Overwrite location data');
+ $text=WT_I18N::translate('Overwrite location data in the database with data from the file.<br />When this option is selected, the location data in the database (latitude, longitude, zoomlevel and flag) are overwritten with the data in the file, if available. If the record is not already in the database a new record will be created, unless the Update-only option is also selected.');
+ break;
+
+case 'PLE_ACTIVE':
+ $title=WT_I18N::translate('Show inactive places');
+ $text=
+ '<p>'.
+ WT_I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.').
+ '</p><p class="warning">'.
+ WT_I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.').
+ '</p>';
+ break;
+
+// Help text for placecheck.php
+
+case 'GOOGLEMAP_PLACECHECK':
+ $title=WT_I18N::translate('Place Check');
+ $text=WT_I18N::translate('<strong>This tool</strong> provides a way to compare places in your gedcom file with the matching entries in the googlemaps \'placelocations\' table.<br /><br /><strong>The display</strong> can be structured for a specific gedcom file; for a specific country within that file; and for a particular area (e.g. state or county) within that country.<br /><br /><strong>Places</strong>are listed alphabetically so that minor spelling differences can be easily spotted, and corrected.<br /><br /><strong>From</strong> the results of the comparison you can click on place names for one of these three options:<br /><br /><strong>1 - </strong>For gedcom file places you will be taken to the Place Heirarchy view. Here you will see all records that are linked to that place.<br /><br /><strong>2 - </strong>For places that exist in the gedcom file, but not in the googlemap table (highlighted in red), you will get the googlemap \"Add place\" screen.<br /><br /><strong>3 - </strong>For places that exist in both the gedcom file and the googlemap table (perhaps without coordinates) you will get the googlemap \"edit place\" screen. Here you can edit any aspect of the place record for the googlemap display.<br /><br /><strong>Hovering</strong> over any place in the googlemap table columns will display the zoom level curently set for that place.');
+ break;
+
+case 'PLACECHECK_FILTER':
+ $title=WT_I18N::translate('Place Check - List Filtering Optons');
+ $text=WT_I18N::translate('This section includes options to limit or extend the scope of the listed places.<br /><br />It is hoped to add more options in the future.');
+ break;
+
+case 'PLACECHECK_MATCH':
+ $title=WT_I18N::translate('Include matched places');
+ $text=WT_I18N::translate('By default the list does NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables.<br />Fully matched means all levels exist in both the gedcom file and the GoogleMap tables; and the GoogleMap places have coordinates for every level.<br /><br />Check this block to include those matched places.');
+ break;
+
+case 'PLACECHECK_KEY':
+ $title=WT_I18N::translate('Key to colors used below');
+ $text=
+ '<table border="1" cellspacing="0" cellpadding="3"><tr><td style="color:red;">'.
+ WT_Gedcom_Tag::getLabel('PLAC').
+ '</td><td style="color:red;" align="center"><strong>X</strong></td><td align="center" style="color:red;"><strong>X</strong></td><td style="font-size:85%; white-space:normal;">'.
+ WT_I18N::translate('This place and its coordinates do not exist in the GoogleMap tables.').
+ '</td></tr><tr><td style="color:blue;">'.
+ WT_Gedcom_Tag::getLabel('PLAC').
+ '</td><td style="color:red;" align="center"><strong>X</strong></td><td align="center" style="color:red;"><strong>X</strong></td><td style="font-size:85%; white-space:normal;">'.
+ WT_I18N::translate('This place exists in the GoogleMap tables, but has no coordinates.').
+ '</td></tr><tr><td><strong>'.
+ WT_I18N::translate('unknown').
+ '</td><td style="color:red;" align="center"><strong>X</strong></td><td align="center" style="color:red;"><strong>X</strong></td><td style="font-size:85%; white-space:normal;">'.
+ WT_I18N::translate('This place level is blank in your GEDCOM file. It should be added to GoogleMap places as "unknown" with coordinates from its parent level before you add any place to the next level.').
+ '</td></tr><tr><td style="color:blue;">'.
+ WT_I18N::translate('unknown').
+ '</td><td align="center">N55.0</td><td align="center">W85.0</td><td style="font-size:85%; white-space:normal;">'.
+ WT_I18N::translate('This place level is blank in your GEDCOM file, but exists as "unknown" in the GoogleMap places table with coordinates. No action required until the missing level can be entered.').
+ '</td></tr></table>';
+
+
+
+
+ break;
+
+// Help text for Place Hierarchy display
+
+case 'GOOGLEMAP_PH':
+ $title=WT_I18N::translate('Use Googlemap for Place Hierarchy');
+ $text=WT_I18N::translate('Use this option to enable (Yes) or disable (No) the ability to substitute Googlemap for <strong>webtrees</strong> usual Place Hierarchy. To be able to set this option to YES, the Googlemap module must be also be enabled. CAUTION: Before using this option, it is recommended that you insert all places currently existing in your GED into the Googlemap tables.');
+ break;
+
+case 'GOOGLEMAP_PH_MAP_SIZE':
+ $title=WT_I18N::translate('Size of Place Hierarchy map (in pixels)');
+ $text=WT_I18N::translate('The size of the map (in pixels) as shown on the Place Hierarchy pages.');
+ break;
+
+case 'GOOGLEMAP_PH_MARKER':
+ $title=WT_I18N::translate('Type of place markers in Place Hierarchy');
+ $text=WT_I18N::translate('Here you can specify what type of marker be able to use (standard or flag). If place has no flag, use standard marker.');
+ break;
+
+case 'GM_DISP_SHORT_PLACE':
+ $title=WT_I18N::translate('Display short placenames');
+ $text=WT_I18N::translate('Here you can choose between two types of displaying places names in hierarchy. If set Yes the place has short name or actual level name, if No - full name.<br /><b>Examples:<br />Full name: </b>Chicago, Illinois, USA<br /><b>Short name: </b>Chicago<br /><b>Full name: </b>Illinois, USA<br /><b>Short name: </b>Illinois');
+ break;
+
+case 'GM_DISP_COUNT':
+ $title=WT_I18N::translate('Display indis and families counts');
+ $text=WT_I18N::translate('Here you can specify if the counts of indis and families connected to the place is displayed. Now if GEDCOM file contains many people is recomended to turn it off.');
+ break;
+
+case 'GOOGLEMAP_PH_WHEEL':
+ $title=WT_I18N::translate('Use mouse wheel for zoom');
+ $text=WT_I18N::translate('Here you can specify if the mouse wheel is enebled for zooming.');
+ break;
+
+case 'GOOGLEMAP_PH_CONTROLS':
+ $title=WT_I18N::translate('Hide map controls');
+ $text=WT_I18N::translate('This option allow to hide map controls (i.e. the map type choice) if mouse is outside the map.');
+ break;
+
+// Pedigree map
+
+case 'PEDIGREE_MAP_clustersize':
+ $title=WT_I18N::translate('Cluster size');
+ $text=WT_I18N::translate('The number of markers to be placed at one point before a trail of pins is started in a north east line behind the younger generations. The \'trail\' is usually only visable at high zoom values.');
+ break;
+
+case 'PEDIGREE_MAP_hidelines':
+ $title=WT_I18N::translate('Hide lines');
+ $text=WT_I18N::translate('Hide the lines connecting the child to each parent if they exist on the map.');
+ break;
+
+case 'PEDIGREE_MAP_hideflags':
+ $title=WT_I18N::translate('Hide flags');
+ $text=WT_I18N::translate('Hide the flags that are configured in the googlemap module. Usually these are for countries and states. This serves as a visual cue that the markers around the flag are from the general area, and not the specific spot.');
+ break;
+}
diff --git a/modules_v3/googlemap/images/css_sprite_facts.png b/modules_v3/googlemap/images/css_sprite_facts.png
new file mode 100644
index 0000000000..3aeb42d635
--- /dev/null
+++ b/modules_v3/googlemap/images/css_sprite_facts.png
Binary files differ
diff --git a/modules_v3/googlemap/images/flag_shadow.png b/modules_v3/googlemap/images/flag_shadow.png
new file mode 100644
index 0000000000..340046a162
--- /dev/null
+++ b/modules_v3/googlemap/images/flag_shadow.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon1.png b/modules_v3/googlemap/images/icon1.png
new file mode 100644
index 0000000000..50b53ce822
--- /dev/null
+++ b/modules_v3/googlemap/images/icon1.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon2.png b/modules_v3/googlemap/images/icon2.png
new file mode 100644
index 0000000000..3de6378410
--- /dev/null
+++ b/modules_v3/googlemap/images/icon2.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon2L.png b/modules_v3/googlemap/images/icon2L.png
new file mode 100644
index 0000000000..52b0d4e3e0
--- /dev/null
+++ b/modules_v3/googlemap/images/icon2L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon2Ls.png b/modules_v3/googlemap/images/icon2Ls.png
new file mode 100644
index 0000000000..b15e6706b1
--- /dev/null
+++ b/modules_v3/googlemap/images/icon2Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon2R.png b/modules_v3/googlemap/images/icon2R.png
new file mode 100644
index 0000000000..29e3f57724
--- /dev/null
+++ b/modules_v3/googlemap/images/icon2R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon2Rs.png b/modules_v3/googlemap/images/icon2Rs.png
new file mode 100644
index 0000000000..594f97a4e8
--- /dev/null
+++ b/modules_v3/googlemap/images/icon2Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon3.png b/modules_v3/googlemap/images/icon3.png
new file mode 100644
index 0000000000..b3d2f094af
--- /dev/null
+++ b/modules_v3/googlemap/images/icon3.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon3L.png b/modules_v3/googlemap/images/icon3L.png
new file mode 100644
index 0000000000..f5c4545c0d
--- /dev/null
+++ b/modules_v3/googlemap/images/icon3L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon3Ls.png b/modules_v3/googlemap/images/icon3Ls.png
new file mode 100644
index 0000000000..58ab0a08ce
--- /dev/null
+++ b/modules_v3/googlemap/images/icon3Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon3R.png b/modules_v3/googlemap/images/icon3R.png
new file mode 100644
index 0000000000..3648b84ca4
--- /dev/null
+++ b/modules_v3/googlemap/images/icon3R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon3Rs.png b/modules_v3/googlemap/images/icon3Rs.png
new file mode 100644
index 0000000000..5fa53c2d72
--- /dev/null
+++ b/modules_v3/googlemap/images/icon3Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon4.png b/modules_v3/googlemap/images/icon4.png
new file mode 100644
index 0000000000..01c3771375
--- /dev/null
+++ b/modules_v3/googlemap/images/icon4.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon4L.png b/modules_v3/googlemap/images/icon4L.png
new file mode 100644
index 0000000000..f765bdce70
--- /dev/null
+++ b/modules_v3/googlemap/images/icon4L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon4Ls.png b/modules_v3/googlemap/images/icon4Ls.png
new file mode 100644
index 0000000000..7a22aa6f87
--- /dev/null
+++ b/modules_v3/googlemap/images/icon4Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon4R.png b/modules_v3/googlemap/images/icon4R.png
new file mode 100644
index 0000000000..8258234e2d
--- /dev/null
+++ b/modules_v3/googlemap/images/icon4R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon4Rs.png b/modules_v3/googlemap/images/icon4Rs.png
new file mode 100644
index 0000000000..efd252fb69
--- /dev/null
+++ b/modules_v3/googlemap/images/icon4Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon5.png b/modules_v3/googlemap/images/icon5.png
new file mode 100644
index 0000000000..50c3eb4aa1
--- /dev/null
+++ b/modules_v3/googlemap/images/icon5.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon5L.png b/modules_v3/googlemap/images/icon5L.png
new file mode 100644
index 0000000000..3c7d171e7c
--- /dev/null
+++ b/modules_v3/googlemap/images/icon5L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon5Ls.png b/modules_v3/googlemap/images/icon5Ls.png
new file mode 100644
index 0000000000..0f31e5eb20
--- /dev/null
+++ b/modules_v3/googlemap/images/icon5Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon5R.png b/modules_v3/googlemap/images/icon5R.png
new file mode 100644
index 0000000000..1c02b3fb80
--- /dev/null
+++ b/modules_v3/googlemap/images/icon5R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon5Rs.png b/modules_v3/googlemap/images/icon5Rs.png
new file mode 100644
index 0000000000..c824449d9f
--- /dev/null
+++ b/modules_v3/googlemap/images/icon5Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon6.png b/modules_v3/googlemap/images/icon6.png
new file mode 100644
index 0000000000..c6d804fb05
--- /dev/null
+++ b/modules_v3/googlemap/images/icon6.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon6L.png b/modules_v3/googlemap/images/icon6L.png
new file mode 100644
index 0000000000..23b5219459
--- /dev/null
+++ b/modules_v3/googlemap/images/icon6L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon6Ls.png b/modules_v3/googlemap/images/icon6Ls.png
new file mode 100644
index 0000000000..197d77bdcf
--- /dev/null
+++ b/modules_v3/googlemap/images/icon6Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon6R.png b/modules_v3/googlemap/images/icon6R.png
new file mode 100644
index 0000000000..016b631cee
--- /dev/null
+++ b/modules_v3/googlemap/images/icon6R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon6Rs.png b/modules_v3/googlemap/images/icon6Rs.png
new file mode 100644
index 0000000000..352363403a
--- /dev/null
+++ b/modules_v3/googlemap/images/icon6Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon7.png b/modules_v3/googlemap/images/icon7.png
new file mode 100644
index 0000000000..b5654c0aaa
--- /dev/null
+++ b/modules_v3/googlemap/images/icon7.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon7L.png b/modules_v3/googlemap/images/icon7L.png
new file mode 100644
index 0000000000..b888b88b27
--- /dev/null
+++ b/modules_v3/googlemap/images/icon7L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon7Ls.png b/modules_v3/googlemap/images/icon7Ls.png
new file mode 100644
index 0000000000..f762c83555
--- /dev/null
+++ b/modules_v3/googlemap/images/icon7Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon7R.png b/modules_v3/googlemap/images/icon7R.png
new file mode 100644
index 0000000000..a49b672802
--- /dev/null
+++ b/modules_v3/googlemap/images/icon7R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon7Rs.png b/modules_v3/googlemap/images/icon7Rs.png
new file mode 100644
index 0000000000..8d84594086
--- /dev/null
+++ b/modules_v3/googlemap/images/icon7Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon8.png b/modules_v3/googlemap/images/icon8.png
new file mode 100644
index 0000000000..9c5458370c
--- /dev/null
+++ b/modules_v3/googlemap/images/icon8.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon8L.png b/modules_v3/googlemap/images/icon8L.png
new file mode 100644
index 0000000000..c9631bfdfa
--- /dev/null
+++ b/modules_v3/googlemap/images/icon8L.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon8Ls.png b/modules_v3/googlemap/images/icon8Ls.png
new file mode 100644
index 0000000000..ec1008d7ad
--- /dev/null
+++ b/modules_v3/googlemap/images/icon8Ls.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon8R.png b/modules_v3/googlemap/images/icon8R.png
new file mode 100644
index 0000000000..bc0d304231
--- /dev/null
+++ b/modules_v3/googlemap/images/icon8R.png
Binary files differ
diff --git a/modules_v3/googlemap/images/icon8Rs.png b/modules_v3/googlemap/images/icon8Rs.png
new file mode 100644
index 0000000000..8c1bb53bf7
--- /dev/null
+++ b/modules_v3/googlemap/images/icon8Rs.png
Binary files differ
diff --git a/modules_v3/googlemap/images/marker_green.png b/modules_v3/googlemap/images/marker_green.png
new file mode 100644
index 0000000000..4a0c14c74c
--- /dev/null
+++ b/modules_v3/googlemap/images/marker_green.png
Binary files differ
diff --git a/modules_v3/googlemap/images/marker_yellow.png b/modules_v3/googlemap/images/marker_yellow.png
new file mode 100644
index 0000000000..67ce5c0c45
--- /dev/null
+++ b/modules_v3/googlemap/images/marker_yellow.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-0.png b/modules_v3/googlemap/images/panda-icons/panda-0.png
new file mode 100644
index 0000000000..f4ae1a8f62
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-0.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-1.png b/modules_v3/googlemap/images/panda-icons/panda-1.png
new file mode 100644
index 0000000000..85fde481a6
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-1.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-10.png b/modules_v3/googlemap/images/panda-icons/panda-10.png
new file mode 100644
index 0000000000..afeb3fc61c
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-10.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-11.png b/modules_v3/googlemap/images/panda-icons/panda-11.png
new file mode 100644
index 0000000000..c9678601e4
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-11.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-12.png b/modules_v3/googlemap/images/panda-icons/panda-12.png
new file mode 100644
index 0000000000..e0d6fc659b
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-12.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-13.png b/modules_v3/googlemap/images/panda-icons/panda-13.png
new file mode 100644
index 0000000000..9993413139
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-13.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-14.png b/modules_v3/googlemap/images/panda-icons/panda-14.png
new file mode 100644
index 0000000000..a273460347
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-14.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-15.png b/modules_v3/googlemap/images/panda-icons/panda-15.png
new file mode 100644
index 0000000000..2ada4400be
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-15.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-16.png b/modules_v3/googlemap/images/panda-icons/panda-16.png
new file mode 100644
index 0000000000..811bf9be24
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-16.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-17.png b/modules_v3/googlemap/images/panda-icons/panda-17.png
new file mode 100644
index 0000000000..f901cf535b
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-17.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-18.png b/modules_v3/googlemap/images/panda-icons/panda-18.png
new file mode 100644
index 0000000000..074288fff2
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-18.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-19.png b/modules_v3/googlemap/images/panda-icons/panda-19.png
new file mode 100644
index 0000000000..0dab7c5eb7
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-19.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-2.png b/modules_v3/googlemap/images/panda-icons/panda-2.png
new file mode 100644
index 0000000000..52b23a64cf
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-2.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-20.png b/modules_v3/googlemap/images/panda-icons/panda-20.png
new file mode 100644
index 0000000000..d01e0d73ca
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-20.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-3.png b/modules_v3/googlemap/images/panda-icons/panda-3.png
new file mode 100644
index 0000000000..420d1a1587
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-3.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-4.png b/modules_v3/googlemap/images/panda-icons/panda-4.png
new file mode 100644
index 0000000000..d15a396c4a
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-4.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-5.png b/modules_v3/googlemap/images/panda-icons/panda-5.png
new file mode 100644
index 0000000000..2860649caa
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-5.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-6.png b/modules_v3/googlemap/images/panda-icons/panda-6.png
new file mode 100644
index 0000000000..0d3e6e74b2
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-6.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-7.png b/modules_v3/googlemap/images/panda-icons/panda-7.png
new file mode 100644
index 0000000000..58e001ec73
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-7.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-8.png b/modules_v3/googlemap/images/panda-icons/panda-8.png
new file mode 100644
index 0000000000..49ed379dde
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-8.png
Binary files differ
diff --git a/modules_v3/googlemap/images/panda-icons/panda-9.png b/modules_v3/googlemap/images/panda-icons/panda-9.png
new file mode 100644
index 0000000000..cc8b2681e8
--- /dev/null
+++ b/modules_v3/googlemap/images/panda-icons/panda-9.png
Binary files differ
diff --git a/modules_v3/googlemap/images/pedigree_map.gif b/modules_v3/googlemap/images/pedigree_map.gif
new file mode 100644
index 0000000000..9aa4139fe9
--- /dev/null
+++ b/modules_v3/googlemap/images/pedigree_map.gif
Binary files differ
diff --git a/modules_v3/googlemap/images/shadow-left-large.png b/modules_v3/googlemap/images/shadow-left-large.png
new file mode 100644
index 0000000000..ad45ef8f90
--- /dev/null
+++ b/modules_v3/googlemap/images/shadow-left-large.png
Binary files differ
diff --git a/modules_v3/googlemap/images/shadow-left-small.png b/modules_v3/googlemap/images/shadow-left-small.png
new file mode 100644
index 0000000000..219a8a7ae5
--- /dev/null
+++ b/modules_v3/googlemap/images/shadow-left-small.png
Binary files differ
diff --git a/modules_v3/googlemap/images/shadow-right-large.png b/modules_v3/googlemap/images/shadow-right-large.png
new file mode 100644
index 0000000000..6454cd6b69
--- /dev/null
+++ b/modules_v3/googlemap/images/shadow-right-large.png
Binary files differ
diff --git a/modules_v3/googlemap/images/shadow-right-small.png b/modules_v3/googlemap/images/shadow-right-small.png
new file mode 100644
index 0000000000..15e58b979e
--- /dev/null
+++ b/modules_v3/googlemap/images/shadow-right-small.png
Binary files differ
diff --git a/modules_v3/googlemap/images/shadow50.png b/modules_v3/googlemap/images/shadow50.png
new file mode 100644
index 0000000000..cc0e630cb9
--- /dev/null
+++ b/modules_v3/googlemap/images/shadow50.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq1.png b/modules_v3/googlemap/images/sq1.png
new file mode 100644
index 0000000000..74c8463e3b
--- /dev/null
+++ b/modules_v3/googlemap/images/sq1.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq2.png b/modules_v3/googlemap/images/sq2.png
new file mode 100644
index 0000000000..263a3b5cd3
--- /dev/null
+++ b/modules_v3/googlemap/images/sq2.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq3.png b/modules_v3/googlemap/images/sq3.png
new file mode 100644
index 0000000000..60a43243af
--- /dev/null
+++ b/modules_v3/googlemap/images/sq3.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq4.png b/modules_v3/googlemap/images/sq4.png
new file mode 100644
index 0000000000..4d8f977e42
--- /dev/null
+++ b/modules_v3/googlemap/images/sq4.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq5.png b/modules_v3/googlemap/images/sq5.png
new file mode 100644
index 0000000000..ce3891db66
--- /dev/null
+++ b/modules_v3/googlemap/images/sq5.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq6.png b/modules_v3/googlemap/images/sq6.png
new file mode 100644
index 0000000000..7633df6f18
--- /dev/null
+++ b/modules_v3/googlemap/images/sq6.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq7.png b/modules_v3/googlemap/images/sq7.png
new file mode 100644
index 0000000000..480e5edc0f
--- /dev/null
+++ b/modules_v3/googlemap/images/sq7.png
Binary files differ
diff --git a/modules_v3/googlemap/images/sq8.png b/modules_v3/googlemap/images/sq8.png
new file mode 100644
index 0000000000..b7c5497ece
--- /dev/null
+++ b/modules_v3/googlemap/images/sq8.png
Binary files differ
diff --git a/modules_v3/googlemap/images/transparent-left-large.png b/modules_v3/googlemap/images/transparent-left-large.png
new file mode 100644
index 0000000000..aeb07694ea
--- /dev/null
+++ b/modules_v3/googlemap/images/transparent-left-large.png
Binary files differ
diff --git a/modules_v3/googlemap/images/transparent-left-small.png b/modules_v3/googlemap/images/transparent-left-small.png
new file mode 100644
index 0000000000..9bdddc48e7
--- /dev/null
+++ b/modules_v3/googlemap/images/transparent-left-small.png
Binary files differ
diff --git a/modules_v3/googlemap/images/transparent-right-large.png b/modules_v3/googlemap/images/transparent-right-large.png
new file mode 100644
index 0000000000..f483d86724
--- /dev/null
+++ b/modules_v3/googlemap/images/transparent-right-large.png
Binary files differ
diff --git a/modules_v3/googlemap/images/transparent-right-small.png b/modules_v3/googlemap/images/transparent-right-small.png
new file mode 100644
index 0000000000..8a53069f73
--- /dev/null
+++ b/modules_v3/googlemap/images/transparent-right-small.png
Binary files differ
diff --git a/modules_v3/googlemap/index.php b/modules_v3/googlemap/index.php
new file mode 100644
index 0000000000..82232675e1
--- /dev/null
+++ b/modules_v3/googlemap/index.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Entry point for Google map module
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2002 to 2008 PGV Development Team. All rights reserved.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage GoogleMap
+ * @author Johan Borkhuis
+ * $Id$
+ */
+
+header("Location: ../../index.php");
+exit;
+
+?> \ No newline at end of file
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
new file mode 100644
index 0000000000..d1b1eb2062
--- /dev/null
+++ b/modules_v3/googlemap/module.php
@@ -0,0 +1,182 @@
+<?php
+// Classes and libraries for module system
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2010 John Finlay
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+// http://www.google.com/permissions/guidelines.html
+//
+// "... an unregistered Google Brand Feature should be followed by
+// the superscripted letters TM or SM ..."
+//
+// Hence, use "Google Mapsâ„¢"
+//
+// "... Use the trademark only as an adjective"
+//
+// "... Use a generic term following the trademark, for example:
+// GOOGLE search engine, Google search"
+//
+// Hence, use "Google Mapsâ„¢ mapping service" where appropriate.
+
+class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Module_Tab {
+ // Extend WT_Module
+ public function getTitle() {
+ return /* I18N: The name of a module. Google Maps is a trademark. Do not translate it? http://en.wikipedia.org/wiki/Google_maps */ WT_I18N::translate('Google Mapsâ„¢');
+ }
+
+ // Extend WT_Module
+ public function getDescription() {
+ return /* I18N: Description of the "Google Mapsâ„¢" module */ WT_I18N::translate('Show the location of places and events using the Google Mapsâ„¢ mapping service.');
+ }
+
+ // Extend WT_Module
+ public function modAction($mod_action) {
+ switch($mod_action) {
+ case 'admin_editconfig':
+ case 'flags':
+ case 'pedigree_map':
+ case 'admin_placecheck':
+ case 'admin_places':
+ case 'places_edit':
+ // 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';
+ break;
+ default:
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
+ // Implement WT_Module_Config
+ public function getConfigLink() {
+ return 'module.php?mod='.$this->getName().'&mod_action=admin_editconfig';
+ }
+
+ // Implement WT_Module_Tab
+ public function defaultTabOrder() {
+ return 80;
+ }
+
+ // Implement WT_Module_Tab
+ public function getPreLoadContent() {
+ ob_start();
+ require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php';
+ require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+ setup_map();
+ return ob_get_clean();
+ }
+
+ // Implement WT_Module_Tab
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement WT_Module_Tab
+ public function getTabContent() {
+ global $SEARCH_SPIDER, $WT_IMAGES;
+ global $GOOGLEMAP_MAP_TYPE, $GOOGLEMAP_MIN_ZOOM, $GOOGLEMAP_MAX_ZOOM, $GEDCOM;
+ global $GOOGLEMAP_XSIZE, $GOOGLEMAP_YSIZE, $SHOW_LIVING_NAMES;
+ global $TEXT_DIRECTION, $GM_DEFAULT_TOP_VALUE, $GOOGLEMAP_COORD, $GOOGLEMAP_PH_CONTROLS;
+ global $GM_MARKER_COLOR, $GM_MARKER_SIZE, $GM_PREFIX, $GM_POSTFIX, $GM_PRE_POST_MODE;
+
+ ob_start();
+ require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php';
+ require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+
+ echo '<table border="0" width="100%"><tr><td>';
+ if (!$this->controller->indi->canDisplayName()) {
+ echo '<table class="facts_table">';
+ echo '<tr><td class="facts_value">';
+ print_privacy_error();
+ echo '</td></tr>';
+ echo '</table><br />';
+ echo WT_JS_START, 'function ResizeMap () {}', WT_JS_END;
+ } else {
+ echo '<table width="100%" border="0" class="facts_table">';
+ echo '<tr><td valign="top">';
+ echo '<div id="googlemap_left">';
+ echo '<img src="images/hline.gif" width="', $GOOGLEMAP_XSIZE, '" height="0" alt="" />';
+ echo '<div id="map_pane" style="border: 1px solid gray; color: black; width: 100%; height: ', $GOOGLEMAP_YSIZE, 'px"></div>';
+ if (WT_USER_IS_ADMIN) {
+ echo '<table style="font-size:13px;" width="100%"><tr>';
+ echo '<td width="40%" align="left">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>';
+ echo '</td>';
+ echo '<td width="35%" align="center">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_places">', WT_I18N::translate('Edit geographic place locations'), '</a>';
+ echo '</td>';
+ echo '<td width="25%" align="right">';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place Check'),'</a>';
+ echo '</td>';
+ echo '</tr></table>';
+ }
+ echo '</div>';
+ echo '</td>';
+ echo '<td valign="top" width="30%">';
+ echo '<div id="map_content">';
+ $famids = array();
+ $families = $this->controller->indi->getSpouseFamilies();
+ foreach ($families as $family) {
+ $famids[] = $family->getXref();
+ }
+ $this->controller->indi->add_family_facts(false);
+// create_indiv_buttons();
+ build_indiv_map($this->controller->indi->getIndiFacts(), $famids);
+ echo '</div>';
+ echo '</td>';
+ echo '</tr></table>';
+ }
+ // start
+ echo '<img src="', $WT_IMAGES['spacer'], '" id="marker6" width="1" height="1" alt="" />';
+ // end
+ echo '</td></tr></table>';
+ return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
+ }
+
+ // Implement WT_Module_Tab
+ public function hasTabContent() {
+ global $SEARCH_SPIDER;
+ return !$SEARCH_SPIDER && (array_key_exists('googlemap', WT_Module::getActiveModules()) || WT_USER_IS_ADMIN);
+ }
+
+ // Implement WT_Module_Tab
+ public function isGrayedOut() {
+ return false;
+ }
+ // Implement WT_Module_Tab
+ public function getJSCallback() {
+ global $GOOGLEMAP_PH_CONTROLS;
+ $out=
+ 'if (jQuery("#tabs li:eq("+jQuery("#tabs").tabs("option", "selected")+") a").attr("title")=="'.$this->getName().'") {'.
+ 'loadMap();'.
+ '}'.
+ 'jQuery("html, body").animate({scrollTop: jQuery("#header").offset().top});'. // scroll the page to top
+ '';
+ return $out;
+ }
+}
diff --git a/modules_v3/googlemap/pedigree_map.php b/modules_v3/googlemap/pedigree_map.php
new file mode 100644
index 0000000000..aca9790ab0
--- /dev/null
+++ b/modules_v3/googlemap/pedigree_map.php
@@ -0,0 +1,288 @@
+<?php
+// Print pedigree map using Googlemaps.
+// It requires that your place coordinates are stored on the Google Map
+// 'place_locations' table. It will NOT find coordinates stored only as tags in
+// your GEDCOM file. As in the Google Maps module, it can only display place
+// markers where the location exists with identical spelling in both your
+// GEDCOM '2 PLAC' tag (within the '1 BIRT' event) and the place_locations table.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License or,
+// at your discretion, any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+
+global $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES;
+
+// Default is show for both of these.
+$hideflags = safe_GET('hideflags');
+$hidelines = safe_GET('hidelines');
+
+$controller = new WT_Controller_Pedigree();
+$controller->init();
+
+// Default of 5
+$clustersize = 5;
+if (!empty($_REQUEST['clustersize'])) {
+ if ($_REQUEST['clustersize'] == '3')
+ $clustersize = 3;
+ else if ($_REQUEST['clustersize'] == '1')
+ $clustersize = 1;
+}
+
+// Start of internal configuration variables
+
+// Limit this to match available number of icons.
+// 8 generations equals 255 individuals
+$MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
+
+// End of internal configuration variables
+
+global $TEXT_DIRECTION;
+
+print_header(/* I18N: %s is a person's name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()));
+
+echo '<link type="text/css" href ="', WT_MODULES_DIR, 'googlemap/css/googlemap_style.css" rel="stylesheet" />';
+
+if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
+echo '<div><table><tr><td valign="middle">';
+echo '<h2>', WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()), '</h2>';
+
+// -- print the form to change the number of displayed generations
+?>
+<script type="text/javascript">
+ <!--
+ var pastefield;
+ function paste_id(value) {
+ pastefield.value=value;
+ }
+ //-->
+</script>
+</td><td width="50px">&nbsp;</td><td>
+ <form name="people" method="get" action="module.php?ged=<?php echo WT_GEDURL; ?>&amp;mod=googlemap&amp;mod_action=pedigree_map">
+ <input type="hidden" name="mod" value="googlemap" />
+ <input type="hidden" name="mod_action" value="pedigree_map" />
+ <table class="pedigree_table <?php echo $TEXT_DIRECTION; ?>" width="555">
+ <tr>
+ <td class="descriptionbox wrap">
+ <?php echo WT_I18N::translate('Root Person ID'), help_link('rootid'); ?>
+ </td>
+ <td class="descriptionbox wrap">
+ <?php echo WT_I18N::translate('Generations'), help_link('PEDIGREE_GENERATIONS'); ?>
+ </td>
+ <td class="descriptionbox wrap">
+ <?php echo WT_I18N::translate('Cluster size'), help_link('PEDIGREE_MAP_clustersize','googlemap'); ?>
+ </td>
+ <td class="descriptionbox wrap">
+ <?php
+ echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags','googlemap');
+ ?>
+ </td>
+ <td class="descriptionbox wrap">
+ <?php
+ echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines','googlemap');
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="optionbox">
+ <input class="pedigree_form" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->rootid; ?>" />
+ <?php print_findindi_link("rootid",""); ?>
+ </td>
+ <td class="optionbox">
+ <select name="PEDIGREE_GENERATIONS">
+ <?php
+ for ($p=3; $p<=$MAX_PEDIGREE_GENERATIONS; $p++) {
+ echo "<option value=\"".$p."\" " ;
+ if ($p == $controller->PEDIGREE_GENERATIONS) echo "selected=\"selected\" ";
+ echo ">".$p."</option>";
+ }
+ ?>
+ </select>
+ </td>
+ <td class="optionbox">
+ <select name="clustersize">
+ <?php
+ for ($p=1; $p<6; $p = $p+2) {
+ echo "<option value=\"".$p."\" " ;
+ if ($p == $clustersize) echo "selected=\"selected\" ";
+ echo ">".$p."</option>";
+ }
+ ?>
+ </select>
+ </td>
+ <td class="optionbox">
+ <?php
+ echo "<input name=\"hideflags\" type=\"checkbox\"";
+ if ($hideflags) {echo " checked=\"checked\"";}
+ echo " />";
+ ?>
+ </td>
+ <td class="optionbox">
+ <?php
+ echo "<input name=\"hidelines\" type=\"checkbox\"";
+ if ($hidelines) {echo " checked=\"checked\"";}
+ echo " />";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="topbottombar" colspan="5">
+ <input type="submit" value="<?php echo WT_I18N::translate('View'); ?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </td></tr>
+</table>
+
+<!-- end of form -->
+
+<!-- count records by type -->
+<?php
+$curgen=1;
+$priv=0;
+$count=0;
+$miscount=0;
+$missing = "";
+
+for ($i=0; $i<($controller->treesize); $i++) {
+ // -- check to see if we have moved to the next generation
+ if ($i+1 >= pow(2, $curgen)) {$curgen++;}
+ $person = WT_Person::getInstance($controller->treeid[$i]);
+ if (!empty($person)) {
+ $pid = $controller->treeid[$i];
+ $name = $person->getFullName();
+ if ($name == WT_I18N::translate('Private')) $priv++;
+ $place = $person->getBirthPlace();
+ if (empty($place)) {
+ $latlongval[$i] = NULL;
+ } else {
+ $latlongval[$i] = get_lati_long_placelocation($person->getBirthPlace());
+ if ($latlongval[$i] != NULL && $latlongval[$i]["lati"]=='0' && $latlongval[$i]["long"]=='0') {
+ $latlongval[$i] = NULL;
+ }
+ }
+ if ($latlongval[$i] != NULL) {
+ $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]["lati"]);
+ $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]["long"]);
+ if (($lat[$i] != NULL) && ($lon[$i] != NULL)) {
+ $count++;
+ }
+ else { // The place is in the table but has empty values
+ if (!empty($name)) {
+ if (!empty($missing)) $missing .= ",\n ";
+ $addlist = '<a href="'.$person->getHtmlUrl().'">'. $name . '</a>';
+ $missing .= $addlist;
+ $miscount++;
+ }
+ }
+ }
+ else { // There was no place, or not listed in the map table
+ if (!empty($name)) {
+ if (!empty($missing)) $missing .= ",\n ";
+ $addlist = '<a href="'.$person->getHtmlUrl().'">'. $name . '</a>';
+ $missing .= $addlist;
+ $miscount++;
+ }
+ }
+ }
+}
+//<!-- end of count records by type -->
+
+//<!-- start of map display -->
+echo '<table class="tabs_table" cellspacing="0" cellpadding="0" border="0" width="100%">';
+echo "<tr>\n";
+echo "<td valign=\"top\">\n";
+echo "<img src=\"images/spacer.gif\" width=\"".$GOOGLEMAP_XSIZE."\" height=\"0\" alt=\"\" border=\"0\"/>\n";
+echo "<div id=\"pm_map\" style=\"border: 1px solid gray; height: ".$GOOGLEMAP_YSIZE."px; font-size: 0.9em;";
+echo " background-image: url('images/loading.gif'); background-position: center; background-repeat: no-repeat; overflow: hidden;\"></div>\n";
+if (WT_USER_IS_ADMIN) {
+ echo "<table width=\"100%\">";
+ echo "<tr><td align=\"left\">\n";
+ echo "<a href=\"module.php?mod=googlemap&mod_action=admin_editconfig\">", WT_I18N::translate('Google Maps configuration'), "</a>";
+ echo "</td>\n";
+ echo "<td align=\"center\">\n";
+ echo "<a href=\"module.php?mod=googlemap&mod_action=admin_places\">", WT_I18N::translate('Edit geographic place locations'), "</a>";
+ echo "</td>\n";
+ echo "<td align=\"right\">\n";
+ echo "<a href=\"module.php?mod=googlemap&mod_action=admin_placecheck\">", WT_I18N::translate('Place Check'), "</a>";
+ echo "</td></tr>\n";
+ echo "</table>\n";
+}
+echo "</td><td width=\"15px\">&nbsp;</td>\n";
+echo "<td width=\"310px\" valign=\"top\">\n";
+echo "<div id=\"side_bar\" style=\"width: 300px; font-size: 0.9em; overflow: auto; overflow-x: hidden; overflow-y: auto; height: ".$GOOGLEMAP_YSIZE."px; \"></div></td>\n";
+echo "</tr>\n";
+echo "</table>\n";
+// display info under map
+echo "<hr />";
+echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">";
+echo " <tr>";
+echo " <td valign=\"top\">";
+// print summary statistics
+if (isset($curgen)) {
+ $total=pow(2,$curgen)-1;
+ $miss=$total-$count-$priv;
+ echo WT_I18N::plural(
+ '%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.',
+ '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.',
+ $count,
+ $count, $total, $curgen
+ ), '<br/>';
+ echo "</td>\n";
+ echo " </tr>\n";
+ echo " <tr>\n";
+ echo " <td valign=\"top\">\n";
+ if ($priv) {
+ echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br/>';
+ }
+ if ($count+$priv != $total) {
+ if ($miscount == 0) {
+ echo WT_I18N::translate('No ancestors in the database.'), "<br />\n";
+ } else {
+ // I18N: %1$d is a count of individuals, %2$s is a list of their names
+ echo " ".WT_I18N::plural(
+ '%1$d individual is missing birthplace map coordinates: %2$s.',
+ '%1$d individuals are missing birthplace map coordinates: %2$s.',
+ $miscount, $miscount, $missing),
+ '<br />';
+ }
+ }
+}
+echo " </td>\n";
+echo " </tr>\n";
+echo "</table>\n";
+echo "</div>";
+?>
+<!-- end of map display -->
+
+<!-- Start of map scripts -->
+<?php
+echo '<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>';
+require_once WT_ROOT.WT_MODULES_DIR.'googlemap/wt_v3_pedigree_map.js.php';
+
+print_footer();
diff --git a/modules_v3/googlemap/placehierarchy.php b/modules_v3/googlemap/placehierarchy.php
new file mode 100644
index 0000000000..101b11204e
--- /dev/null
+++ b/modules_v3/googlemap/placehierarchy.php
@@ -0,0 +1,666 @@
+<?php
+// Displays a place hierachy
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+require WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php';
+if (file_exists(WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php')) {
+ require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php';
+}
+
+$stats = new WT_Stats($GEDCOM);
+
+function place_id_to_hierarchy($id) {
+ $statement=
+ WT_DB::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?");
+ $arr=array();
+ while ($id!=0) {
+ $row=$statement->execute(array($id))->fetchOneRow();
+ $arr=array($id=>$row->pl_place)+$arr;
+ $id=$row->pl_parent_id;
+ }
+ return $arr;
+}
+
+function get_placeid($place) {
+ $par = explode (",", $place);
+ $par = array_reverse($par);
+ $place_id = 0;
+ for ($i=0; $i<count($par); $i++) {
+ $par[$i] = trim($par[$i]);
+ if (empty($par[$i])) $par[$i]="unknown";
+ $placelist = create_possible_place_names($par[$i], $i+1);
+ foreach ($placelist as $key => $placename) {
+ $pl_id=
+ WT_DB::prepare("SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
+ ->execute(array($i, $place_id, $placename))
+ ->fetchOne();
+ if (!empty($pl_id)) break;
+ }
+ if (empty($pl_id)) break;
+ $place_id = $pl_id;
+ }
+ return $place_id;
+}
+
+function get_p_id($place) {
+ $par = explode (",", $place);
+ $par = array_reverse($par);
+ $place_id = 0;
+ for ($i=0; $i<count($par); $i++) {
+ $par[$i] = trim($par[$i]);
+ $placelist = create_possible_place_names($par[$i], $i+1);
+ foreach ($placelist as $key => $placename) {
+ $pl_id=
+ WT_DB::prepare("SELECT p_id FROM `##places` WHERE p_level=? AND p_parent_id=? AND p_file=? AND p_place LIKE ? ORDER BY p_place")
+ ->execute(array($i, $place_id, WT_GED_ID, $placename))
+ ->fetchOne();
+ if (!empty($pl_id)) break;
+ }
+ if (empty($pl_id)) break;
+ $place_id = $pl_id;
+ }
+ return $place_id;
+}
+
+function set_placeid_map($level, $parent) {
+ if (!isset($levelm)) {
+ $levelm=0;
+ }
+ $fullplace = "";
+ if ($level==0)
+ $levelm=0;
+ else {
+ for ($i=1; $i<=$level; $i++) {
+ $fullplace .= $parent[$level-$i].", ";
+ }
+ $fullplace = substr($fullplace, 0, -2);
+ $levelm = get_p_id($fullplace);
+ }
+ return $levelm;
+}
+
+function set_levelm($level, $parent) {
+ if (!isset($levelm)) {
+ $levelm=0;
+ }
+ $fullplace = "";
+ if ($level==0)
+ $levelm=0;
+ else {
+ for ($i=1; $i<=$level; $i++) {
+ if ($parent[$level-$i]!="")
+ $fullplace .= $parent[$level-$i].", ";
+ else
+ $fullplace .= "Unknown, ";
+ }
+ $fullplace = substr($fullplace, 0, -2);
+ $levelm = get_placeid($fullplace);
+ }
+ return $levelm;
+}
+
+function create_map($placelevels) {
+ $level = safe_GET('level');
+ global $GOOGLEMAP_PH_XSIZE, $GOOGLEMAP_PH_YSIZE, $GOOGLEMAP_MAP_TYPE, $TEXT_DIRECTION, $levelm;
+
+ // *** ENABLE STREETVIEW *** (boolean) =========================================================
+ $STREETVIEW = get_module_setting('googlemap', 'GM_USE_STREETVIEW');
+ // =============================================================================================
+ $parent = safe_GET('parent');
+
+ // create the map
+ echo '<table class="center" style="margin-top:20px;"><tr valign="top"><td>';
+ //<!-- start of map display -->
+ echo '<table><tr valign="top">';
+ echo '<td class="center" width="200px">';
+
+ $levelm = set_levelm($level, $parent);
+ $latlng =
+ WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($levelm))
+ ->fetch(PDO::FETCH_ASSOC);
+ if ($STREETVIEW && $level!=0 ) {
+ echo '<div id="place_map" style=" margin-top: 20px; border:1px solid gray; width: ', $GOOGLEMAP_PH_XSIZE, 'px; height: ', $GOOGLEMAP_PH_YSIZE, 'px;" ';
+ } else {
+ echo '<div id="place_map" style="border:1px solid gray; width: ', $GOOGLEMAP_PH_XSIZE, 'px; height: ', $GOOGLEMAP_PH_YSIZE, 'px;" ';
+ }
+ echo "background-image: url('images/loading.gif'); background-position: center; background-repeat: no-repeat; overflow: hidden;\"></div>";
+ echo '<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>';
+ echo '</td>';
+
+ if (WT_USER_IS_ADMIN) {
+ $placecheck_url = 'module.php?mod=googlemap&amp;mod_action=admin_placecheck';
+ if ($parent && isset($parent[0]) ) {
+ $placecheck_url .= '&amp;country='.$parent[0];
+ if (isset($parent[1])) {
+ $placecheck_url .= '&amp;state='.$parent[1];
+ }
+ }
+ $adminplaces_url = 'module.php?mod=googlemap&amp;mod_action=admin_places';
+ if ($latlng && isset($latlng['pl_id'])) {
+ $adminplaces_url .= '&amp;parent='.$latlng['pl_id'];
+ }
+ echo '</tr><tr><td>';
+ echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_editconfig">', WT_I18N::translate('Google Maps configuration'), '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="'.$adminplaces_url.'">', WT_I18N::translate('Edit geographic place locations'), '</a>';
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="'.$placecheck_url.'">', WT_I18N::translate('Place Check'), '</a>';
+ if (array_key_exists('batch_update', WT_Module::getActiveModules())) {
+ $placelevels=preg_replace('/, '.WT_I18N::translate('unknown').'/', ', ', $placelevels); // replace ", unknown" with ", "
+ $placelevels=substr($placelevels, 2); // remove the leading ", "
+ if ($placelevels) {
+ $batchupdate_url='module.php?mod=batch_update&amp;mod_action=admin_batch_update&amp;plugin=search_replace_bu_plugin&amp;method=exact&amp;GEDCOM='.WT_GEDCOM.'&amp;search='.urlencode($placelevels); // exact match
+ echo '&nbsp;|&nbsp;';
+ echo '<a href="'.$batchupdate_url.'">', WT_I18N::translate('Batch Update'), '</a>';
+ }
+ }
+ }
+ echo '</td></tr></table>';
+ echo '</td>';
+ echo '<td style="margin-left:15px; float:right; ">';
+
+ if ($STREETVIEW) {
+ ?>
+ <script>
+ function update_sv_params(placeid) {
+ var svlati = document.getElementById('sv_latiText').value.slice(0, -1);
+ var svlong = document.getElementById('sv_longText').value.slice(0, -1);
+ var svbear = document.getElementById('sv_bearText').value.slice(0, -1);
+ var svelev = document.getElementById('sv_elevText').value.slice(0, -1);
+ var svzoom = document.getElementById('sv_zoomText').value;
+ win03 = window.open('module.php?mod=googlemap&mod_action=places_edit&action=update_sv_params&placeid='+placeid+"&"+sessionname+"="+sessionid+
+ '&svlati='+svlati+
+ '&svlong='+svlong+
+ '&svbear='+svbear+
+ '&svelev='+svelev+
+ '&svzoom='+svzoom,
+ 'win03', 'top=50, left=50, width=680, height=550, resizable=1, scrollbars=1' );
+ if (window.focus) {win03.focus();}
+ }
+ </script>
+ <?php
+
+ $parent = safe_GET('parent');
+ global $TBLPREFIX, $pl_lati, $pl_long;
+ if ($level>=1) {
+ $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati
+ $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long
+
+ // Check if Streetview location parameters are stored in database
+ $placeid = $latlng['pl_id']; // Placelocation place id
+ $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude
+ $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude
+ $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North)
+ $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
+ $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3)
+
+ // Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------
+ if (($latlng['sv_lati']==null && $latlng['sv_long']==null) || ($latlng['sv_lati']==0 && $latlng['sv_long']==0)) {
+ $sv_lat = $pl_lati;
+ $sv_lng = $pl_long;
+ }
+ // Set Street View parameters to numeric value if NULL (avoids problem with Google Street View Pane not rendering)
+ if ($sv_dir==null) {
+ $sv_dir=0;
+ }
+ if ($sv_pitch==null) {
+ $sv_pitch=0;
+ }
+ if ($sv_zoom==null) {
+ $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_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>
+ </div>
+
+ <?php
+ $list_latlon = (
+ WT_Gedcom_Tag::getLabel('LATI')."<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lat."' />".
+ WT_Gedcom_Tag::getLabel('LONG')."<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lng."' />".
+ /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing')."<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='".$sv_dir."' />".
+ /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation')."<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='".$sv_pitch."' />".
+ WT_I18N::translate('Zoom')."<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='".$sv_zoom."' />
+ ");
+ if (WT_USER_IS_ADMIN) {
+ echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">";
+ } else {
+ echo "<table align=\"center\" style=\"display:none; \">";
+ }
+ echo "<tr><td>\n";
+ echo "<form style=\"text-align:left; margin-left:5px; font:11px verdana; color:blue;\" method=\"post\" action=\"\">";
+ echo $list_latlon;
+ echo "<input type=\"submit\" name=\"Submit\" onClick=\"update_sv_params($placeid);\" value=\"", WT_I18N::translate('Save'), "\">";
+ echo "</form>";
+ echo "</td></tr>\n";
+ echo "</table>\n";
+ }
+ // Next line puts Place hierarchy on new row -----
+ echo '</td></tr><tr>';
+ } // End Streetview window ===================================================================
+}
+
+function check_were_am_i($numls, $levelm) {
+ $where_am_i=place_id_to_hierarchy($levelm);
+ $i=$numls+1;
+ if (!isset($levelo)) {
+ $levelo[0]=0;
+ }
+ foreach (array_reverse($where_am_i, true) as $id=>$place2) {
+ $levelo[$i]=$id;
+ $i--;
+ }
+ return $levelo;
+}
+
+function check_place($place_names, $place) {
+ if ($place == "Unknown") $place="";
+ if (in_array($place, $place_names)) {
+ return true;
+ }
+}
+
+function print_how_many_people($level, $parent) {
+ global $GEDCOM, $stats;
+
+ $place_count_indi = 0;
+ $place_count_fam = 0;
+ if (!isset($parent[$level-1])) $parent[$level-1]="";
+ $p_id = set_placeid_map($level, $parent);
+ $indi = $stats->_statsPlaces('INDI', false, $p_id);
+ $fam = $stats->_statsPlaces('FAM', false, $p_id);
+ if (!empty($indi)) {
+ foreach ($indi as $place) {
+ $place_count_indi=$place['tot'];
+ }
+ }
+ if (!empty($fam)) {
+ foreach ($fam as $place) {
+ $place_count_fam=$place['tot'];
+ }
+ }
+ echo "<br /><br />", WT_I18N::translate('Individuals'), ": ", $place_count_indi, ", ", WT_I18N::translate('Families'), ": ", $place_count_fam;
+}
+
+function print_gm_markers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel=false) {
+ global $GOOGLEMAP_COORD, $GOOGLEMAP_PH_MARKER, $GM_DISP_SHORT_PLACE, $GM_DISP_COUNT;
+
+ if (($place2['lati'] == NULL) || ($place2['long'] == NULL) || (($place2['lati'] == "0") && ($place2['long'] == "0"))) {
+ echo "var icon_type = new google.maps.MarkerImage();\n";
+ echo ' icon_type.image = "', WT_MODULES_DIR, 'googlemap/images/marker_yellow.png";';
+ echo ' icon_type.shadow = "', WT_MODULES_DIR, 'googlemap/images/shadow50.png";';
+ echo " icon_type.iconSize = google.maps.Size(20, 34);\n";
+ echo " icon_type.shadowSize = google.maps.Size(37, 34);\n";
+ echo "var point = new google.maps.LatLng(0, 0);\n";
+ if ($lastlevel)
+ echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?level=", $level, $linklevels, "'><br />";
+ else {
+ echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?level=", ($level+1), $linklevels, "&amp;parent[{$level}]=";
+ if ($place2['place'] == "Unknown") echo "'><br />";
+ else echo addslashes($place2['place']), "'><br />";
+ }
+ if (($place2["icon"] != NULL) && ($place2['icon'] != "")) {
+ echo '<img src=\"', WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\">&nbsp;&nbsp;';
+ }
+ if ($lastlevel) {
+ $placename = substr($placelevels, 2);
+ if ($place2['place'] == "Unknown") {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(substr($placelevels, 2));
+ } else {
+ echo WT_I18N::translate('unknown');
+ }
+ } else {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(substr($placelevels, 2));
+ } else {
+ echo addslashes($place2['place']);
+ }
+ }
+ } else {
+ $placename = $place2['place'].$placelevels;
+ if ($place2['place'] == "Unknown") {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(WT_I18N::translate('unknown').$placelevels);
+ } else {
+ echo WT_I18N::translate('unknown');
+ }
+ } else {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes($place2['place'].$placelevels);
+ } else {
+ echo addslashes($place2['place']);
+ }
+ }
+ }
+ echo "</a>";
+ if ($GM_DISP_COUNT) {
+ if ($lastlevel) {
+ print_how_many_people($level, $parent);
+ } else {
+ $parent[$level]=$place2['place'];
+ print_how_many_people($level+1, $parent);
+ }
+ }
+ echo "<br />", WT_I18N::translate('This place has no coordinates');
+ if (WT_USER_IS_ADMIN)
+ echo "<br /><a href='module.php?mod=googlemap&mod_action=admin_places&parent=", $levelm, "&display=inactive'>", WT_I18N::translate('Edit geographic location'), "</a>";
+ echo "</div>\", icon_type, \"", str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n";
+ } else {
+ $lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place2['lati']);
+ $long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place2['long']);
+ //delete leading zero
+ if ($lati >= 0) {
+ $lati = abs($lati);
+ } elseif ($lati < 0) {
+ $lati = "-".abs($lati);
+ }
+ if ($long >= 0) {
+ $long = abs($long);
+ } elseif ($long < 0) {
+ $long = "-".abs($long);
+ }
+
+ // flags by kiwi3685 ---
+ if (($place2["icon"] == NULL) || ($place2['icon'] == "") || ($GOOGLEMAP_PH_MARKER != "G_FLAG")) {
+ echo "var icon_type = new google.maps.MarkerImage();\n";
+ } else {
+ echo "var icon_type = new google.maps.MarkerImage();\n";
+ echo ' icon_type.image = "', WT_MODULES_DIR, 'googlemap/', $place2['icon'], '";';
+ echo ' icon_type.shadow = "', WT_MODULES_DIR, 'googlemap/images/flag_shadow.png";';
+ echo " icon_type.iconSize = new google.maps.Size(25, 15);\n";
+ echo " icon_type.shadowSize = new google.maps.Size(35, 45);\n";
+ }
+ echo "var point = new google.maps.LatLng({$lati}, {$long});\n";
+ if ($lastlevel) {
+ echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?level=", $level, $linklevels, "'><br />";
+ } else {
+ echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?level=", ($level+1), $linklevels, "&amp;parent[{$level}]=";
+ if ($place2['place'] == "Unknown") {
+ echo "'><br />";
+ } else {
+ echo addslashes($place2['place']), "'><br />";
+ }
+ }
+ if (($place2['icon'] != NULL) && ($place2['icon'] != "")) {
+ echo '<img src=\"', WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\">&nbsp;&nbsp;';
+ }
+ if ($lastlevel) {
+ $placename = substr($placelevels, 2);
+ if ($place2['place'] == "Unknown") {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(substr($placelevels, 2));
+ } else {
+ echo WT_I18N::translate('unknown');
+ }
+ } else {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(substr($placelevels, 2));
+ } else {
+ echo addslashes($place2['place']);
+ }
+ }
+ } else {
+ $placename = $place2['place'].$placelevels;
+ if ($place2['place'] == "Unknown") {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes(WT_I18N::translate('unknown').$placelevels);
+ } else {
+ echo WT_I18N::translate('unknown');
+ }
+ } else {
+ if (!$GM_DISP_SHORT_PLACE) {
+ echo addslashes($place2['place'].$placelevels);
+ } else {
+ echo addslashes($place2['place']);
+ }
+ }
+ }
+ echo "</a>";
+ if ($GM_DISP_COUNT) {
+ if ($lastlevel) {
+ print_how_many_people($level, $parent);
+ } else {
+ $parent[$level]=$place2['place'];
+ print_how_many_people($level+1, $parent);
+ }
+ }
+ $temp=addslashes($place2['place']);
+ $temp=str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), $temp);
+ if (!$GOOGLEMAP_COORD) {
+ echo "<br /><br /></div>\", icon_type, \"", $temp, "\");\n";
+ } else {
+ echo "<br /><br />", $place2['lati'], ", ", $place2['long'], "</div>\", icon_type, \"", $temp, "\");\n";
+ }
+ }
+}
+
+function map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names) {
+ global $GOOGLEMAP_MAP_TYPE, $GM_MAX_NOF_LEVELS, $GOOGLEMAP_PH_WHEEL, $GOOGLEMAP_PH_CONTROLS, $GOOGLEMAP_PH_MARKER;
+
+ echo '<link type="text/css" href ="', WT_MODULES_DIR, 'googlemap/css/googlemap_style.css" rel="stylesheet" />';
+ ?>
+ <script type="text/javascript">
+ // <![CDATA[
+
+ var infowindow = new google.maps.InfoWindow( {
+ // size: new google.maps.Size(150,50),
+ // maxWidth: 600
+ });
+
+ var map_center = new google.maps.LatLng(0,0);
+ var map = "";
+ var bounds = new google.maps.LatLngBounds ();
+ var markers = [];
+ var gmarkers = [];
+ var i = 0;
+
+ // Create the map and mapOptions
+ var mapOptions = {
+ zoom: 8,
+ center: map_center,
+ mapTypeId: google.maps.MapTypeId.<?php echo $GOOGLEMAP_MAP_TYPE; ?>, // ROADMAP, SATELLITE, HYBRID, TERRAIN
+ mapTypeControlOptions: {
+ 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: false
+ };
+ map = new google.maps.Map(document.getElementById("place_map"), mapOptions);
+
+ // Close any infowindow when map is clicked
+ google.maps.event.addListener(map, 'click', function() {
+ infowindow.close();
+ });
+
+ // Creates a marker whose info window displays the given name
+ function createMarker(point, html, icon, name) {
+ // Choose icon and shadow ============
+ <?php
+ echo "if (icon.image && $level<=3) {";
+ echo "if (icon.image!='", WT_MODULES_DIR, "googlemap/images/marker_yellow.png') {";
+ echo 'var iconImage = new google.maps.MarkerImage(icon.image,';
+ echo 'new google.maps.Size(25, 15),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(1, 45));';
+ echo 'var iconShadow = new google.maps.MarkerImage("', WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",';
+ echo 'new google.maps.Size(35, 45),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(1, 45));';
+ echo " } else { ";
+ echo 'var iconImage = new google.maps.MarkerImage(icon.image,';
+ echo 'new google.maps.Size(20, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+ echo 'var iconShadow = new google.maps.MarkerImage("http://www.google.com/mapfiles/shadow50.png",';
+ echo 'new google.maps.Size(37, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+ echo "}";
+ // *** Clickable area of icon - To be refined later *** ===================================
+ // echo 'var iconShape = {';
+ // echo 'coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],';
+ // echo 'type: "poly"';
+ // echo '};';
+ echo " } else { ";
+ echo 'var iconImage = new google.maps.MarkerImage("http://maps.google.com/mapfiles/marker.png",';
+ echo 'new google.maps.Size(20, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+ echo 'var iconShadow = new google.maps.MarkerImage("http://www.google.com/mapfiles/shadow50.png",';
+ echo 'new google.maps.Size(37, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+ // *** Clickable area of icon - To be refined later *** ===================================
+ // echo 'var iconShape = {';
+ // echo 'coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],';
+ // echo 'type: "poly"';
+ // echo '};';
+ echo "}";
+ ?>
+ var posn = new google.maps.LatLng(0,0);
+ var marker = new google.maps.Marker({
+ position: point,
+ icon: iconImage,
+ shadow: iconShadow,
+ map: map,
+ title: name,
+ });
+ // Show this markers name in the info window when it is clicked
+ google.maps.event.addListener(marker, 'click', function() {
+ infowindow.close();
+ infowindow.setContent(html);
+ infowindow.open(map, marker);
+ });
+ // === Store the tab, category and event info as marker properties ===
+ marker.mypoint = point;
+ marker.mytitle = name;
+ marker.myposn = posn;
+ gmarkers.push(marker);
+ bounds.extend(marker.position);
+ map.fitBounds(bounds);
+ return marker;
+ }
+
+ <?php
+ global $GOOGLEMAP_MAX_ZOOM;
+ $levelm = set_levelm($level, $parent);
+ if (isset($levelo[0])) $levelo[0]=0;
+ $numls = count($parent)-1;
+ $levelo=check_were_am_i($numls, $levelm);
+ if ($numfound<2 && ($level==1 || !(isset($levelo[($level-1)])))) {
+ echo "map.maxZoom=6;";
+ // echo "zoomlevel = map.getBoundsZoomLevel(bounds);\n";
+ // echo " map.setCenter(new google.maps.LatLng(0, 0), zoomlevel+5);\n";
+ } else if ($numfound<2 && !isset($levelo[($level-2)])) {
+ // echo "zoomlevel = map.getBoundsZoomLevel(bounds);\n";
+ // echo " map.setCenter(new google.maps.LatLng(0, 0), zoomlevel+6);\n";
+ } else if ($level==2) {
+ echo "map.maxZoom=10;";
+ // echo "zoomlevel = map.getBoundsZoomLevel(bounds);\n";
+ // echo " map.setCenter(new google.maps.LatLng(0, 0), zoomlevel+8);\n";
+ } else if ($numfound<2 && $level>1) {
+ echo "map.maxZoom=".$GOOGLEMAP_MAX_ZOOM.";";
+ // echo "zoomlevel = map.getBoundsZoomLevel(bounds);\n";
+ // echo " map.setCenter(new google.maps.LatLng(0, 0), zoomlevel+18);\n";
+ }
+ //create markers
+ if ($numfound==0 && $level>0) {
+ if (isset($levelo[($level-1)])) { // ** BH not sure yet what this if statement is for ... TODO **
+ // show the current place on the map
+
+ $place = WT_DB::prepare("SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($levelm))
+ ->fetch(PDO::FETCH_ASSOC);
+
+ if ($place) {
+ // re-calculate the hierarchy information required to display the current place
+ $thisloc = $parent;
+ $xx = array_pop($thisloc);
+ $thislevel = $level-1 ;
+ $thislinklevels = substr($linklevels,0,strrpos($linklevels,'&amp;'));
+ if (strpos($placelevels,',',1)) {
+ $thisplacelevels = substr($placelevels,strpos($placelevels,',',1));
+ } else {
+ // this is the top level, remove everything
+ $thisplacelevels = '';
+ }
+
+ print_gm_markers($place, $thislevel, $thisloc, $place['place_id'], $thislinklevels, $thisplacelevels);
+ }
+ }
+ }
+
+ // display any sub-places
+ $placeidlist=array();
+ foreach ($place_names as $placename) {
+ $thisloc = $parent;
+ $thisloc[] = $placename;
+ $this_levelm = set_levelm($level+1, $thisloc);
+ if ($this_levelm) $placeidlist[] = $this_levelm;
+ }
+
+ if ($placeidlist) {
+ // flip the array (thus removing duplicates)
+ $placeidlist=array_flip($placeidlist);
+ // remove entry for parent location
+ unset($placeidlist[$levelm]);
+ }
+ if ($placeidlist) {
+ // the keys are all we care about (this reverses the earlier array_flip, and ensures there are no "holes" in the array)
+ $placeidlist=array_keys($placeidlist);
+ // note: this implode/array_fill code generates one '?' for each entry in the $placeidlist array
+ $placelist =
+ WT_DB::prepare('SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id IN ('.implode(',', array_fill(0, count($placeidlist), '?')).')')
+ ->execute($placeidlist)
+ ->fetchAll(PDO::FETCH_ASSOC);
+
+ foreach ($placelist as $place) {
+ print_gm_markers($place, $level, $parent, $place['place_id'], $linklevels, $placelevels);
+ }
+ }
+
+ //end markers
+ ?>
+
+ //]]>
+ </script>
+ <?php
+}
+?>
diff --git a/modules_v3/googlemap/places_edit.php b/modules_v3/googlemap/places_edit.php
new file mode 100644
index 0000000000..a6cfe43df9
--- /dev/null
+++ b/modules_v3/googlemap/places_edit.php
@@ -0,0 +1,371 @@
+<?php
+/**
+ * Interface to edit place locations
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Edit
+ * @version $Id$
+ */
+
+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=safe_REQUEST($_REQUEST, 'action');
+if (isset($_REQUEST['placeid'])) $placeid = $_REQUEST['placeid'];
+if (isset($_REQUEST['place_name'])) $place_name = $_REQUEST['place_name'];
+
+print_simple_header(WT_I18N::translate('Edit geographic place locations'));
+
+if (!WT_USER_IS_ADMIN) {
+ echo "<table class=\"facts_table\">\n";
+ echo "<tr><td colspan=\"2\" class=\"facts_value\">", WT_I18N::translate('Page only for Administrators');
+ echo "</td></tr></table>\n";
+ echo "<br /><br /><br />\n";
+ print_simple_footer();
+ exit;
+}
+echo '<link type="text/css" href="', WT_MODULES_DIR, 'googlemap/css/googlemap_style.css" rel="stylesheet" />';
+?>
+<script type="text/javascript">
+<!--
+function edit_close(newurl) {
+ if (newurl) window.opener.location=newurl;
+ else if (window.opener.showchanges) window.opener.showchanges();
+ window.close();
+}
+function showchanges() {
+ updateMap();
+}
+//-->
+</script>
+<?php
+
+// Take a place id and find its place in the hierarchy
+// Input: place ID
+// Output: ordered array of id=>name values, starting with the Top Level
+// e.g. array(0=>"Top Level", 16=>"England", 19=>"London", 217=>"Westminster");
+// NB This function exists in both places.php and places_edit.php
+function place_id_to_hierarchy($id) {
+ $statement=
+ WT_DB::prepare("SELECT pl_parent_id, pl_place FROM `##placelocation` WHERE pl_id=?");
+ $arr=array();
+ while ($id!=0) {
+ $row=$statement->execute(array($id))->fetchOneRow();
+ $arr=array($id=>$row->pl_place)+$arr;
+ $id=$row->pl_parent_id;
+ }
+ return $arr;
+}
+
+// NB This function exists in both admin_places.php and places_edit.php
+function getHighestIndex() {
+ return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne();
+}
+
+$where_am_i=place_id_to_hierarchy($placeid);
+$level=count($where_am_i);
+$link = 'module.php?mod=googlemap&mod_action=admin_places&parent='.$placeid;
+
+if ($action=='addrecord' && WT_USER_IS_ADMIN) {
+ $statement=
+ WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
+
+ if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) {
+ $statement->execute(array(getHighestIndex()+1, $placeid, $level, stripLRMRLM($_POST['NEW_PLACE_NAME']), null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
+ } else {
+ $statement->execute(array(getHighestIndex()+1, $placeid, $level, stripLRMRLM($_POST['NEW_PLACE_NAME']), $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
+ }
+
+ // autoclose window when update successful unless debug on
+ if (!WT_DEBUG) {
+ echo "\n<script type=\"text/javascript\">\n<!--\nedit_close('');\n//-->\n</script>";
+ }
+ echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('');return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
+ print_simple_footer();
+ exit;
+}
+
+if ($action=='updaterecord' && WT_USER_IS_ADMIN) {
+ $statement=
+ WT_DB::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
+
+ if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) {
+ $statement->execute(array(stripLRMRLM($_POST['NEW_PLACE_NAME']), null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
+ } else {
+ $statement->execute(array(stripLRMRLM($_POST['NEW_PLACE_NAME']), $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
+ }
+
+ // autoclose window when update successful unless debug on
+ if (!WT_DEBUG) {
+ echo "\n<script type=\"text/javascript\">\n<!--\nedit_close('');\n//-->\n</script>";
+ }
+ echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close('');return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
+ print_simple_footer();
+ 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(stripLRMRLM($_REQUEST['svlati']), $_REQUEST['svlong'], $_REQUEST['svbear'], $_REQUEST['svelev'], $_REQUEST['svzoom'], $placeid));
+ if (!WT_DEBUG) {
+ echo "\n<script type=\"text/javascript\">\n<!--\nedit_close();\n//-->\n</script>";
+ }
+ echo "<div class=\"center\"><a href=\"javascript:;\" onclick=\"edit_close();return false;\">", WT_I18N::translate('Close Window'), "</a></div><br />\n";
+ print_simple_footer();
+ exit;
+}
+
+if ($action=="update") {
+ // --- find the place in the file
+ $row=
+ WT_DB::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($placeid))
+ ->fetchOneRow();
+ $place_name = $row->pl_place;
+ $place_icon = $row->pl_icon;
+ $selected_country = explode("/", $place_icon);
+ if (isset($selected_country[1]) && $selected_country[1]!="flags")
+ $selected_country = $selected_country[1];
+ else
+ $selected_country = "Countries";
+ $parent_id = $row->pl_parent_id;
+ $level = $row->pl_level;
+ $zoomfactor = $row->pl_zoom;
+ $parent_lati = "0.0";
+ $parent_long = "0.0";
+ if ($row->pl_lati!==null && $row->pl_long!==null) {
+ $place_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati));
+ $place_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long));
+ $show_marker = true;
+ } else {
+ $place_lati = null;
+ $place_long = null;
+ $zoomfactor = 1;
+ $show_marker = false;
+ }
+
+ do {
+ $row=
+ WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($parent_id))
+ ->fetchOneRow();
+ if (!$row) {
+ break;
+ }
+ if ($row->pl_lati!==null && $row->pl_long!==null) {
+ $parent_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati));
+ $parent_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long));
+ if ($zoomfactor == 1) {
+ $zoomfactor = $row->pl_zoom;
+ }
+ }
+ $parent_id = $row->pl_parent_id;
+ }
+ while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null);
+
+ $success = false;
+
+ echo "<b>", str_replace("Unknown", WT_I18N::translate('unknown'), PrintReady(implode(', ', array_reverse($where_am_i, true)))), "</b><br />\n";
+}
+
+if ($action=="add") {
+ // --- find the parent place in the file
+ if ($placeid != 0) {
+ if (!isset($place_name)) $place_name = "";
+ $place_lati = null;
+ $place_long = null;
+ $zoomfactor = 1;
+ $parent_lati = "0.0";
+ $parent_long = "0.0";
+ $place_icon = "";
+ $parent_id=$placeid;
+ do {
+ $row=
+ WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?")
+ ->execute(array($parent_id))
+ ->fetchOneRow();
+ if ($row->pl_lati!==null && $row->pl_long!==null) {
+ $parent_lati=str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati);
+ $parent_long=str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long);
+ $zoomfactor=$row->pl_zoom;
+ if ($zoomfactor>$GOOGLEMAP_MAX_ZOOM) {
+ $zoomfactor=$GOOGLEMAP_MAX_ZOOM;
+ }
+ $level=$row->pl_level+1;
+ }
+ $parent_id = $row->pl_parent_id;
+ } while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null);
+ }
+ else {
+ if (!isset($place_name)) $place_name = "";
+ $place_lati = null;
+ $place_long = null;
+ $parent_lati = "0.0";
+ $parent_long = "0.0";
+ $place_icon = "";
+ $parent_id = 0;
+ $level = 0;
+ $zoomfactor = $GOOGLEMAP_MIN_ZOOM;
+ }
+ $selected_country = "Countries";
+ $show_marker = false;
+ $success = false;
+
+ if (!isset($place_name) || $place_name=="") echo "<b>", WT_I18N::translate('unknown');
+ else echo "<b>", $place_name;
+ if (count($where_am_i)>0)
+ echo ", ", str_replace("Unknown", WT_I18N::translate('unknown'), PrintReady(implode(', ', array_reverse($where_am_i, true)))), "</b><br />\n";
+ echo "</b><br />";
+}
+
+echo '<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>';
+include_once 'wt_v3_places_edit.js.php';
+$api="v3";
+
+?>
+
+<form method="post" id="editplaces" name="editplaces" action="module.php?mod=googlemap&amp;mod_action=places_edit">
+ <input type="hidden" name="action" value="<?php echo $action; ?>record" />
+ <input type="hidden" name="placeid" value="<?php echo $placeid; ?>" />
+ <input type="hidden" name="level" value="<?php echo $level; ?>" />
+ <input type="hidden" name="icon" value="<?php echo $place_icon; ?>" />
+ <input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" />
+ <input type="hidden" name="place_long" value="<?php echo $place_long; ?>" />
+ <input type="hidden" name="place_lati" value="<?php echo $place_lati; ?>" />
+ <input type="hidden" name="parent_long" value="<?php echo $parent_long; ?>" />
+ <input type="hidden" name="parent_lati" value="<?php echo $parent_lati; ?>" />
+ <input name="save1" type="submit" value="<?php echo WT_I18N::translate('Save'); ?>" /><br />
+
+ <table class="facts_table">
+ <tr>
+ <td class="optionbox" colspan="2">
+ <center><div id="map_pane" style="width: 100%; height: 300px"></div></center>
+ </td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_Gedcom_Tag::getLabel('PLAC'), help_link('PLE_PLACES','googlemap'); ?></td>
+ <td class="optionbox"><input type="text" id="new_pl_name" name="NEW_PLACE_NAME" value="<?php echo htmlspecialchars($place_name); ?>" size="25" class="address_input" />
+ <div id="INDI_PLAC_pop" style="display: inline;">
+ <?php print_specialchar_link("NEW_PLACE_NAME", false); ?></div>
+ <label for="new_pl_name"><a href="javascript:;" onclick="showLocation_level(document.getElementById('new_pl_name').value); return false">&nbsp;<?php echo WT_I18N::translate('Search on this level'); ?></a></label>&nbsp;&nbsp;|
+ <label for="new_pl_name"><a href="javascript:;" onclick="showLocation_all(document.getElementById('new_pl_name').value); return false">&nbsp;<?php echo WT_I18N::translate('Search all'); ?></a></label>
+ </td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_I18N::translate('Precision'), help_link('PLE_PRECISION','googlemap'); ?></td>
+ <?php
+ $exp = explode(".", $place_lati);
+ if (isset($exp[1])) {
+ $precision1 = strlen($exp[1]);
+ } else {
+ $precision1 = -1;
+ }
+ $exp = explode(".", $place_long);
+ if (isset($exp[1])) {
+ $precision2 = strlen($exp[1]);
+ } else {
+ $precision2 = -1;
+ }
+ ($precision1 > $precision2) ? ($precision = $precision1) : ($precision = $precision2);
+ if ($precision == -1 ) ($level > 3) ? ($precision = 3) : ($precision = $level);
+ elseif ($precision > 5) {
+ $precision = 5;
+ }
+ ?>
+ <td class="optionbox">
+ <input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$GOOGLEMAP_PRECISION_0) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_0; ?>" />
+ <label for="new_prec_0"><?php echo WT_I18N::translate('Country'); ?></label>
+ <input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$GOOGLEMAP_PRECISION_1) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_1; ?>" />
+ <label for="new_prec_1"><?php echo WT_I18N::translate('State'); ?></label>
+ <input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$GOOGLEMAP_PRECISION_2) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_2; ?>" />
+ <label for="new_prec_2"><?php echo WT_I18N::translate('City'); ?></label>
+ <input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$GOOGLEMAP_PRECISION_3) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_3; ?>" />
+ <label for="new_prec_3"><?php echo WT_I18N::translate('Neighborhood'); ?></label>
+ <input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();"<?php if ($precision==$GOOGLEMAP_PRECISION_4) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_4; ?>" />
+ <label for="new_prec_4"><?php echo WT_I18N::translate('House'); ?></label>
+ <input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();"<?php if ($precision>$GOOGLEMAP_PRECISION_4) echo "checked=\"checked\""; ?> value="<?php echo $GOOGLEMAP_PRECISION_5; ?>" />
+ <label for="new_prec_5"><?php echo WT_I18N::translate('Max'); ?></label>
+ </td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_Gedcom_Tag::getLabel('LATI'), help_link('PLE_LATLON_CTRL','googlemap'); ?></td>
+ <td class="optionbox">
+ <select name="LATI_CONTROL" onchange="updateMap();">
+ <option value="" <?php if ($place_lati == null) echo " selected=\"selected\""; ?>></option>
+ <option value="PL_N" <?php if ($place_lati > 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate_c('North', 'N'); ?></option>
+ <option value="PL_S" <?php if ($place_lati < 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate_c('South', 'S'); ?></option>
+ </select>
+ <input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" value="<?php if ($place_lati != null) echo abs($place_lati); ?>" size="20" onchange="updateMap();" /></td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_Gedcom_Tag::getLabel('LONG'), help_link('PLE_LATLON_CTRL','googlemap'); ?></td>
+ <td class="optionbox">
+ <select name="LONG_CONTROL" onchange="updateMap();">
+ <option value="" <?php if ($place_long == null) echo " selected=\"selected\""; ?>></option>
+ <option value="PL_E" <?php if ($place_long > 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate_c('East', 'E'); ?></option>
+ <option value="PL_W" <?php if ($place_long < 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate_c('West', 'W'); ?></option>
+ </select>
+ <input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" value="<?php if ($place_long != null) echo abs($place_long); ?>" size="20" onchange="updateMap();" /></td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_I18N::translate('Zoom factor'), help_link('PLE_ZOOM','googlemap'); ?></td>
+ <td class="optionbox">
+ <input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php echo $zoomfactor; ?>" size="20" onchange="updateMap();" /></td>
+ </tr>
+ <tr>
+ <td class="descriptionbox"><?php echo WT_I18N::translate('Flag'), help_link('PLE_ICON','googlemap'); ?></td>
+ <td class="optionbox">
+ <div id="flagsDiv">
+<?php
+ if (($place_icon == NULL) || ($place_icon == "")) { ?>
+ <a href="javascript:;" onclick="change_icon();return false;"><?php echo WT_I18N::translate('Change flag'); ?></a>
+<?php }
+ else { ?>
+ <img alt="<?php echo /* I18N: The emblem of a country or region */ WT_I18N::translate('Flag'); ?>" src="<?php echo WT_MODULES_DIR, 'googlemap/', $place_icon; ?>"/>&nbsp;&nbsp;
+ <a href="javascript:;" onclick="change_icon();return false;"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;
+ <a href="javascript:;" onclick="remove_icon();return false;"><?php echo WT_I18N::translate('Remove flag'); ?></a>
+<?php } ?>
+ </div></td>
+ </tr>
+ </table>
+ <input name="save2" type="submit" value="<?php echo WT_I18N::translate('Save'); ?>" /><br />
+</form>
+<?php
+echo "<center><a href=\"javascript:;\" onclick=\"edit_close('')\">", WT_I18N::translate('Close Window'), "</a><br /></center>\n";
+
+print_simple_footer();
diff --git a/modules_v3/googlemap/util.js b/modules_v3/googlemap/util.js
new file mode 100644
index 0000000000..0e642fd6c0
--- /dev/null
+++ b/modules_v3/googlemap/util.js
@@ -0,0 +1,84 @@
+/**
+* Returns an XMLHttp instance to use for asynchronous
+* downloading. This method will never throw an exception, but will
+* return NULL if the browser does not support XmlHttp for any reason.
+* @return {XMLHttpRequest|Null}
+*/
+function createXmlHttpRequest() {
+ try {
+ if (typeof ActiveXObject != 'undefined') {
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ } else if (window["XMLHttpRequest"]) {
+ return new XMLHttpRequest();
+ }
+ } catch (e) {
+ changeStatus(e);
+ }
+ return null;
+};
+
+/**
+* This functions wraps XMLHttpRequest open/send function.
+* It lets you specify a URL and will call the callback if
+* it gets a status code of 200.
+* @param {String} url The URL to retrieve
+* @param {Function} callback The function to call once retrieved.
+*/
+function downloadUrl(url, callback) {
+ var status = -1;
+ var request = createXmlHttpRequest();
+ if (!request) {
+ return false;
+ }
+
+ request.onreadystatechange = function() {
+ if (request.readyState == 4) {
+ try {
+ status = request.status;
+ } catch (e) {
+ // Usually indicates request timed out in FF.
+ }
+ if (status == 200) {
+ callback(request.responseXML, request.status);
+ request.onreadystatechange = function() {};
+ }
+ }
+ }
+ request.open('GET', url, true);
+ try {
+ request.send(null);
+ } catch (e) {
+ changeStatus(e);
+ }
+};
+
+/**
+ * Parses the given XML string and returns the parsed document in a
+ * DOM data structure. This function will return an empty DOM node if
+ * XML parsing is not supported in this browser.
+ * @param {string} str XML string.
+ * @return {Element|Document} DOM.
+ */
+function xmlParse(str) {
+ if (typeof ActiveXObject != 'undefined' && typeof GetObject != 'undefined') {
+ var doc = new ActiveXObject('Microsoft.XMLDOM');
+ doc.loadXML(str);
+ return doc;
+ }
+
+ if (typeof DOMParser != 'undefined') {
+ return (new DOMParser()).parseFromString(str, 'text/xml');
+ }
+
+ return createElement('div', null);
+}
+
+/**
+ * Appends a JavaScript file to the page.
+ * @param {string} url
+ */
+function downloadScript(url) {
+ var script = document.createElement('script');
+ script.src = url;
+ document.body.appendChild(script);
+}
diff --git a/modules_v3/googlemap/wt_v3_googlemap.js.php b/modules_v3/googlemap/wt_v3_googlemap.js.php
new file mode 100644
index 0000000000..76fb6d31db
--- /dev/null
+++ b/modules_v3/googlemap/wt_v3_googlemap.js.php
@@ -0,0 +1,732 @@
+<?php
+/**
+ * Google map module for phpGedView
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 webtrees development team.
+ *
+ * Modifications Copyright (c) 2010 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Googlemaps v3
+ * $Id$
+ *
+ * @author Brian Holland
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+// *** ENABLE STREETVIEW ***
+$STREETVIEW=get_module_setting('googlemap', 'GM_USE_STREETVIEW');
+
+?>
+
+<script type="text/javascript">var ie = 0;</script>
+<!--[if IE]>
+<script type="text/javascript">ie = 1;</script>
+<![endif]-->
+<script type="text/javascript">
+
+//<![CDATA[
+
+ // this variable will collect the html which will eventually be placed in the side_bar
+ var side_bar_html = '';
+ var map_center = new google.maps.LatLng(0,0);
+ var gmarkers = [];
+ var gicons = [];
+ var map = null;
+ var head = '';
+ var dir = '';
+ var svzoom = '';
+
+ var infowindow = new google.maps.InfoWindow( {
+ // size: new google.maps.Size(150,50),
+ // maxWidth: 600
+ });
+
+ <?php
+ echo 'gicons["red"] = new google.maps.MarkerImage("http://maps.google.com/mapfiles/marker.png",';
+ echo 'new google.maps.Size(20, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+
+ echo 'var iconImage = new google.maps.MarkerImage("http://maps.google.com/mapfiles/marker.png",';
+ echo 'new google.maps.Size(20, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+
+ echo 'var iconShadow = new google.maps.MarkerImage("http://www.google.com/mapfiles/shadow50.png",';
+ echo 'new google.maps.Size(37, 34),';
+ echo 'new google.maps.Point(0,0),';
+ echo 'new google.maps.Point(9, 34));';
+
+ echo 'var iconShape = {';
+ echo 'coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],';
+ echo 'type: "poly"';
+ echo '};';
+ ?>
+
+ function getMarkerImage(iconColor) {
+ if ((typeof(iconColor)=='undefined') || (iconColor==null)) {
+ iconColor = 'red';
+ }
+ if (!gicons[iconColor]) {
+ gicons[iconColor] = new google.maps.MarkerImage('http://maps.google.com/mapfiles/marker'+ iconColor +'.png',
+ new google.maps.Size(20, 34),
+ new google.maps.Point(0,0),
+ new google.maps.Point(9, 34));
+ }
+ return gicons[iconColor];
+ }
+
+ function category2color(category) {
+ var color = 'red';
+ switch(category) {
+ case 'theatre': color = '';
+ break;
+ case 'golf': color = '_green';
+ break;
+ case 'info': color = '_yellow';
+ break;
+ default: color = '';
+ break;
+ }
+ return color;
+ }
+
+ gicons['theatre'] = getMarkerImage(category2color('theatre'));
+ gicons['golf'] = getMarkerImage(category2color('golf'));
+ gicons['info'] = getMarkerImage(category2color('info'));
+
+ var sv2_bear = null;
+ var sv2_elev = null;
+ var sv2_zoom = null;
+ var placer = null;
+
+ // A function to create the marker and set up the event window
+ function createMarker(i, latlng, event, html, category, placed, index, tab, address, media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, sv_point, marker_icon) {
+ var contentString = '<div id="iwcontent">'+html+'<\/div>';
+
+ // === Use flag icon (if defined) instead of regular marker icon ===
+ if (marker_icon) {
+ var icon_image = new google.maps.MarkerImage('<?php echo WT_MODULES_DIR; ?>googlemap/'+marker_icon,
+ new google.maps.Size(25, 15),
+ new google.maps.Point(0,0),
+ new google.maps.Point(0, 44));
+ var icon_shadow = new google.maps.MarkerImage('<?php echo WT_MODULES_DIR; ?>googlemap/images/flag_shadow.png',
+ new google.maps.Size(35, 45), // Shadow size
+ new google.maps.Point(0,0), // Shadow origin
+ new google.maps.Point(1, 45) // Shadow anchor is base of flagpole
+ );
+ } else {
+ var icon_image = gicons[category];
+ var icon_shadow = iconShadow;
+ }
+
+ // === Decide if marker point is Regular (latlng) or StreetView (sv_point) derived ===
+ if (sv_point == '(0, 0)' || sv_point == '(null, null)') {
+ placer = latlng;
+ } else {
+ placer = sv_point;
+ }
+
+ // === Define the marker ===
+ var marker = new google.maps.Marker({
+ position: placer,
+ icon: icon_image,
+ shadow: icon_shadow,
+ map: map,
+ title: address,
+ zIndex: Math.round(latlng.lat()*-100000)<<5
+ });
+
+ // === Store the tab, category and event info as marker properties ===
+ marker.myindex = index;
+ marker.mytab = tab;
+ marker.myplaced = placed;
+ marker.mycategory = category;
+ marker.myevent = event;
+ marker.myaddress = address;
+ marker.mymedia = media;
+ marker.sv_lati = sv_lati;
+ marker.sv_long = sv_long;
+ marker.sv_point = sv_point;
+
+ if (sv_bearing == '') {
+ marker.sv_bearing = 0;
+ } else {
+ marker.sv_bearing = sv_bearing;
+ }
+ if (sv_elevation == '') {
+ marker.sv_elevation = 5;
+ } else {
+ marker.sv_elevation = sv_elevation;
+ // marker.sv_elevation = 5;
+ }
+ if (sv_zoom == '' || sv_zoom == 0 || sv_zoom == 1) {
+ marker.sv_zoom = 1.2;
+ } else {
+ marker.sv_zoom = sv_zoom;
+ }
+
+ marker.sv_latlng = new google.maps.LatLng(sv_lati, sv_long);
+ gmarkers.push(marker);
+
+ var sv_dir = [];
+ sv_dir[i] = parseFloat(gmarkers[i].sv_bearing);
+ var sv_elev = [];
+ sv_elev[i] = parseFloat(gmarkers[i].sv_elevation);
+ var sv_zoom = [];
+ sv_zoom[i] = parseFloat(gmarkers[i].sv_zoom);
+
+ // == Open infowindow when marker is clicked ==
+ google.maps.event.addListener(marker, 'click', function() {
+ infowindow.close();
+ infowindow.setContent(contentString);
+ infowindow.open(map, marker);
+ var panoramaOptions = {
+ position: marker.position,
+ mode: 'html5',
+ // mode: 'webgl',
+ navigationControl: false,
+ linksControl: false,
+ addressControl: false,
+ pov: {
+ heading: sv_dir[i],
+ pitch: sv_elev[i],
+ // pitch: 5,
+ zoom: sv_zoom[i]
+ }
+ };
+
+ // === Use jquery for info window tabs ===
+ google.maps.event.addListener(infowindow, 'domready', function(){
+
+ //jQuery code here
+ jQuery('#EV').click(function() {
+ document.tabLayerEV = eval('document.getElementById("EV")');
+ document.tabLayerEV.style.background = '#ffffff';
+ document.tabLayerEV.style.paddingBottom = '1px';
+ <?php if ($STREETVIEW) { ?>
+ document.tabLayerSV = eval('document.getElementById("SV")');
+ document.tabLayerSV.style.background = '#cccccc';
+ document.tabLayerSV.style.paddingBottom = '0px';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.tabLayerPH = eval('document.getElementById("PH")');
+ // document.tabLayerPH.style.background = '#cccccc';
+ // document.tabLayerPH.style.paddingBottom = '0px';
+ // =====================================================================
+ document.panelLayer1 = eval('document.getElementById("pane1")');
+ document.panelLayer1.style.display = 'block';
+ <?php if ($STREETVIEW) { ?>
+ document.panelLayer2 = eval('document.getElementById("pane2")');
+ document.panelLayer2.style.display = 'none';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.panelLayer3 = eval('document.getElementById("pane3")');
+ // document.panelLayer3.style.display = 'none';
+ // =====================================================================
+ });
+
+ jQuery('#SV').click(function() {
+ document.tabLayerEV = eval('document.getElementById("EV")');
+ document.tabLayerEV.style.background = '#cccccc';
+ document.tabLayerEV.style.paddingBottom = '0px';
+ <?php if ($STREETVIEW) { ?>
+ document.tabLayerSV = eval('document.getElementById("SV")');
+ document.tabLayerSV.style.background = '#ffffff';
+ document.tabLayerSV.style.paddingBottom = '1px';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.tabLayerPH = eval('document.getElementById("PH")');
+ // document.tabLayerPH.style.background = '#cccccc';
+ // document.tabLayerPH.style.paddingBottom = '0px';
+ // =====================================================================
+ document.panelLayer1 = eval('document.getElementById("pane1")');
+ document.panelLayer1.style.display = 'none';
+ <?php if ($STREETVIEW) { ?>
+ document.panelLayer2 = eval('document.getElementById("pane2")');
+ document.panelLayer2.style.display = 'block';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.panelLayer3 = eval('document.getElementById("pane3")');
+ // document.panelLayer3.style.display = "none";
+ // =====================================================================
+ var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
+ setTimeout(function() { panorama.setVisible(true); }, 100);
+ setTimeout(function() { panorama.setVisible(true); }, 500);
+ });
+
+ jQuery('#PH').click(function() {
+ document.tabLayerEV = eval('document.getElementById("EV")');
+ document.tabLayerEV.style.background = '#cccccc';
+ document.tabLayerEV.style.paddingBottom = '0px';
+ <?php if ($STREETVIEW) { ?>
+ document.tabLayerSV = eval('document.getElementById("SV")');
+ document.tabLayerSV.style.background = '#cccccc';
+ document.tabLayerSV.style.paddingBottom = '0px';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.tabLayerPH = eval('document.getElementById("PH")');
+ // document.tabLayerPH.style.background = '#ffffff';
+ // document.tabLayerPH.style.paddingBottom = '1px';
+ // =================================================================
+ document.panelLayer1 = eval('document.getElementById("pane1")');
+ document.panelLayer1.style.display = 'none';
+ <?php if ($STREETVIEW) { ?>
+ document.panelLayer2 = eval('document.getElementById("pane2")');
+ document.panelLayer2.style.display = 'none';
+ <?php } ?>
+ // Please leave (windmillway) ==========================================
+ // document.panelLayer3 = eval('document.getElementById("pane3")');
+ // document.panelLayer3.style.display = 'block';
+ // =================================================================
+ });
+
+ });
+
+ });
+ }
+
+ // == shows all markers of a particular category, and ensures the checkbox is checked ==
+ function show(category) {
+ for (var i=0; i<gmarkers.length; i++) {
+ if (gmarkers[i].mycategory == category) {
+ gmarkers[i].setVisible(true);
+ }
+ }
+ // == close any info window for clarity
+ infowindow.close();
+ }
+
+ // == hides all markers of a particular category, and ensures the checkbox is cleared ==
+ function hide(category) {
+ for (var i=0; i<gmarkers.length; i++) {
+ if (gmarkers[i].mycategory == category) {
+ gmarkers[i].setVisible(false);
+ }
+ }
+ // == close the info window, in case its open on a marker that we just hid
+ infowindow.close();
+ }
+
+ // == a checkbox has been clicked ==
+ function boxclick(box,category) {
+ if (box.checked) {
+ show(category);
+ } else {
+ hide(category);
+ }
+ // == rebuild the side bar ==
+ makeSidebar();
+ loadMap();
+ }
+
+ // == Opens Marker infowindow when corresponding Sidebar item is clicked ==
+ function myclick(i, index, tab) {
+ infowindow.close();
+ google.maps.event.trigger(gmarkers[i], 'click');
+ }
+
+ // == rebuild sidebar (hidden item) when any marker's infowindow is closed ==
+ google.maps.event.addListener(infowindow, 'closeclick', function() {
+ makeSidebar();
+ });
+
+ // == rebuilds the sidebar (hidden item) to match the markers currently displayed ==
+ function makeSidebar(x) {
+ var html = '';
+ //var tab = gmarkers.mytab;
+ for (var i=0; i<gmarkers.length; i++) {
+ if (gmarkers[i].getVisible()) {
+ // if (x==gmarkers[i].myindex) {
+ if (x==i ) {
+ html += '<a style="text-decoration:none; color:black; background:white; " href="javascript:myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
+ } else if (gmarkers[i].mycategory=='theatre') {
+ html += '<a style="text-decoration:none; color:red;" href="javascript:myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
+ } else if (gmarkers[i].mycategory=='golf') {
+ html += '<a style="text-decoration:none; color:green;" href="javascript:myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
+ } else if (gmarkers[i].mycategory=='info') {
+ html += '<a style="text-decoration:none; color:yellow;" href="javascript:myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
+ } else {
+ html += '<a style="text-decoration:none; color:black;" href="javascript:myclick('+i+', '+gmarkers[i].mytab+')">'+ gmarkers[i].myevent + '<\/a><br>';
+ }
+ }
+ }
+ document.getElementById('side_bar').innerHTML = html;
+ x=null;
+ }
+
+ // Home control ====================================================================
+ // returns the user to the original map position ... loadMap() function
+ // This constructor takes the control DIV as an argument.
+ function HomeControl(controlDiv, map) {
+ // Set CSS styles for the DIV containing the control
+ // Setting padding to 5 px will offset the control from the edge of the map
+ controlDiv.style.paddingTop = '5px';
+ controlDiv.style.paddingRight = '0px';
+
+ // Set CSS for the control border
+ var controlUI = document.createElement('DIV');
+ controlUI.style.backgroundColor = 'white';
+ controlUI.style.borderStyle = 'solid';
+ controlUI.style.borderWidth = '2px';
+ controlUI.style.cursor = 'pointer';
+ controlUI.style.textAlign = 'center';
+ controlUI.title = '';
+ controlDiv.appendChild(controlUI);
+
+ // Set CSS for the control interior
+ var controlText = document.createElement('DIV');
+ controlText.style.fontFamily = 'Arial,sans-serif';
+ controlText.style.fontSize = '12px';
+ controlText.style.paddingLeft = '15px';
+ controlText.style.paddingRight = '15px';
+ controlText.innerHTML = '<b><?php echo WT_I18N::translate('Redraw map')?><\/b>';
+ controlUI.appendChild(controlText);
+
+ // Setup the click event listeners: simply set the map to original LatLng
+ google.maps.event.addDomListener(controlUI, 'click', function() {
+ loadMap();
+ });
+ }
+
+ function loadMap() {
+ <?php
+ global $GOOGLEMAP_MAP_TYPE, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES, $GEDCOM;
+ ?>
+
+ // Create the map and mapOptions
+ var mapOptions = {
+ zoom: 7,
+ center: map_center,
+ mapTypeId: google.maps.MapTypeId.<?php echo $GOOGLEMAP_MAP_TYPE; ?>, // ROADMAP, SATELLITE, HYBRID, TERRAIN
+ mapTypeControlOptions: {
+ 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: false
+ };
+ map = new google.maps.Map(document.getElementById('map_pane'), mapOptions);
+
+ // Close any infowindow when map is clicked
+ google.maps.event.addListener(map, 'click', function() {
+ infowindow.close();
+ // == rebuild sidebar (hidden item) ==
+ makeSidebar();
+ });
+
+ // Create the Home DIV and call the HomeControl() constructor in this DIV.
+ var homeControlDiv = document.createElement('DIV');
+ var homeControl = new HomeControl(homeControlDiv, map);
+ homeControlDiv.index = 1;
+ map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
+
+ // Add the markers to the map from the $gmarks array =======
+ var locations = [
+ <?php
+ foreach($gmarks as $gmark) {
+
+ // create thumbnail images of highlighted images ===
+ if (!empty($pid)) {
+ $this_person = WT_Person::getInstance($pid);
+ }
+ if (!empty($gmark['name'])) {
+ $person = WT_Person::getInstance($gmark['name']);
+ }
+
+ // The current indi ================================
+ if (!empty($this_person)) {
+ $class = 'pedigree_image_portrait';
+ if ($gmark['fact'] == 'Census') {
+ $image = "<img class='icon_cens' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Birth') {
+ $image = "<img class='icon_birt' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Baptism' || $gmark['fact'] == 'Christening') {
+ $image = "<img class='icon_bapm' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Military') {
+ $image = "<img class='icon_mili' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Occupation') {
+ $image = "<img class='icon_occu' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Residence') {
+ $image = "<img class='icon_resi' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Death') {
+ $image = "<img class='icon_deat' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Burial' || $gmark['fact'] == 'Cremation') {
+ $image = "<img class='icon_buri' src='././images/pix1.gif' />";
+ } else if ($gmark['fact'] == 'Retirement' ) {
+ $image = "<img class='icon_reti' src='././images/pix1.gif' />";
+ } else {
+ $indirec = $this_person->getGedcomRecord();
+ $image = '';
+ if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
+ if (!empty($pid)) {
+ $object = find_highlighted_object($pid, WT_GED_ID, $indirec);
+ }
+ if (!empty($object)) {
+ $mediaobject=WT_Media::getInstance($object['mid']);
+ $image=$mediaobject->displayMedia(array('display_type'=>'googlemap'));
+ } else {
+ $sex=$this_person->getSex();
+ $image=display_silhouette(array('sex'=>$sex,'display_type'=>'googlemap')); // may return ''
+ }
+ } // end of add image
+ }
+ }
+
+ // Other people ====================================
+ if (!empty($person)) {
+ $indirec2 = $person->getGedcomRecord();
+ $image2 = '';
+ if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
+ if (!empty($gmark['name'])) {
+ $object2 = find_highlighted_object($gmark['name'], WT_GED_ID, $indirec2);
+ }
+ if (!empty($object2)) {
+ $mediaobject=WT_Media::getInstance($object2['mid']);
+ $image2=$mediaobject->displayMedia(array('display_type'=>'googlemap'));
+ } else {
+ $sex=$person->getSex();
+ $image2=display_silhouette(array('sex'=>$sex,'display_type'=>'googlemap')); // may return ''
+ }
+ } // end of add image
+ }
+ ?>
+ [
+ // Elements 0-9. Basic parameters
+ "<?php echo $gmark['fact'].''; ?>",
+ "<?php echo $gmark['lati']; ?>",
+ "<?php echo $gmark['lng']; ?>",
+ "<?php if (!empty($gmark['date'])) { $date=new WT_Date($gmark['date']); echo addslashes($date->Display(true)); } else { echo WT_I18N::translate('Date not known'); } ?>",
+ "<?php if (!empty($gmark['info'])) { echo $gmark['info']; } else { echo NULL; } ?>",
+ "<?php if (!empty($gmark['name'])) { $person=WT_Person::getInstance($gmark['name']); if ($person) { echo '<a href=\"', $person->getHtmlUrl(), '\">', $person->canDisplayName() ? PrintReady(addcslashes($person->getFullName(), '"')) : WT_I18N::translate('Private'), '<\/a>'; } } ?>",
+ "<?php if (preg_match('/2 PLAC (.*)/', $gmark['placerec']) == 0) { print_address_structure_map($gmark['placerec'], 1); } else { echo preg_replace('/\"/', '\\\"', print_fact_place_map($gmark['placerec'])); } ?>",
+ "<?php echo $gmark['index'].''; ?>",
+ "<?php echo $gmark['tabindex'].''; ?>",
+ "<?php echo $gmark['placed'].''; ?>",
+
+ // Element 10. location marker tooltip - extra printable item for marker title.
+ "<?php echo strip_tags(preg_replace('/\"/', '\\\"', print_fact_place_map($gmark['placerec']))); ?>",
+
+ // Element 11. persons Name
+ "<?php if (!empty($gmark['name'])) { $person=WT_Person::getInstance($gmark['name']); if ($person) { echo $person->canDisplayName() ? PrintReady(addcslashes($person->getFullName(), '"')) : WT_I18N::translate('Private'); } } ?>",
+
+ // Element 12. Other people's Highlighted image.
+ "<?php if (!empty($gmark['name'])) { echo $image2; } else { echo ''; } ?>",
+
+ // Element 13. This Individual's Highlighted image.
+ "<?php if (!empty($pid)) { echo $image; } else { echo ''; } ?>",
+
+ // Elements 14-20 Streetview parameters
+ "<?php if (!empty($gmark['media'])) { echo $gmark['media']; } ?>",
+ "<?php if (!empty($gmark['sv_lati'])) { echo $gmark['sv_lati']; } ?>",
+ "<?php if (!empty($gmark['sv_long'])) { echo $gmark['sv_long']; } ?>",
+ "<?php if (!empty($gmark['sv_bearing'])) { echo $gmark['sv_bearing']; } ?>",
+ "<?php if (!empty($gmark['sv_elevation'])) { echo $gmark['sv_elevation']; } ?>",
+ "<?php if (!empty($gmark['sv_zoom'])) { echo $gmark['sv_zoom']; } ?>",
+ "<?php if (!empty($gmark['icon'])) { echo $gmark['icon']; } ?>"
+ ],
+
+ <?php } ?>
+ ];
+ // Fix IE bug reporting one too many in locations.length statement =====
+ if (ie==1) {
+ locations.length=locations.length - 1;
+ }
+
+ // Set the Marker bounds ===============================================
+ var bounds = new google.maps.LatLngBounds ();
+
+ // Calculate tabs to be placed for each marker =========================
+ var np = new Array();
+ var numtabs = new Array();
+ var npo = new Array();
+
+ for (var p = 0; p < locations.length; p++) {
+ np[p] = ''+p+'';
+ numtabs[p] = 0;
+ npo[p] = new Array();
+ for (var q = 0; q < locations.length; q++) {
+ if (jQuery.inArray(np[p], locations[q][7])==0) {
+ npo[p][numtabs[p]] = q;
+ numtabs[p]++;
+ }
+ }
+ }
+
+ // Loop through all location markers ===================================
+ for (var i = 0; i < locations.length; i++) {
+ // obtain the attributes of each marker
+ var event = locations[i][0]; // Event or Fact
+ var lat = locations[i][1]; // Latitude
+ var lng = locations[i][2]; // Longitude
+ var date = locations[i][3]; // Date of event or fact
+ var info = ''//locations[i][4]; // info on occupation, or
+ var name = locations[i][5]; // Persons name
+ var address = locations[i][6]; // Address of event or fact
+ var index = locations[i][7]; // index
+ var tab = locations[i][8]; // tab index
+ var placed = locations[i][9]; // Yes indicates multitab item
+ var name2 = locations[i][11]; // printable name for marker title
+ var point = new google.maps.LatLng(lat,lng); // Place Latitude, Longitude
+
+ var media = locations[i][14]; // media item
+ var sv_lati = locations[i][15]; // Street View latitude
+ var sv_long = locations[i][16]; // Street View longitude
+ var sv_bearing = locations[i][17]; // Street View bearing
+ var sv_elevation = locations[i][18]; // Street View elevation
+ var sv_zoom = locations[i][19]; // Street View zoom
+ var marker_icon = locations[i][20]; // Marker icon image (flag)
+ var sv_point = new google.maps.LatLng(sv_lati,sv_long); // StreetView Latitude and Longitide
+
+ // === Employ of image tab function using an information image =====
+ if (media == null || media == '') {
+ media = WT_MODULES_DIR+'googlemap/images/facts/v3_image_info.png';
+ } else {
+ media = media;
+ }
+
+ if (document.getElementById('golfbox').checked == false) {
+ var category = 'theatre'; // Category for future pedigree map use etc
+ var addr2 = locations[i][10]; // printable address for marker title
+ } else {
+ var category = 'golf';
+ var addr2 = locations[i][10]; // printable address for marker title
+ }
+
+ // If a fact with info or a persons name ===========================
+ var event_item ='';
+ var event_tab ='';
+ var tabcontid = '';
+ var divhead = '<h4 id="iwhead" >'+address+'<\/h4>';
+
+ for (var n = 0; n < locations.length; n++) {
+ //if (i==npo[n][i]) {
+ if (i==npo[n][0] || i==npo[n][1] || i==npo[n][2] || i==npo[n][3] || i==npo[n][4] || i==npo[n][5] || i==npo[n][6] || i==npo[n][7] || i==npo[n][8] || i==npo[n][9] || i==npo[n][10] || i==npo[n][11] || i==npo[n][12] || i==npo[n][13] || i==npo[n][14] || i==npo[n][15] || i==npo[n][16] || i==npo[n][17] || i==npo[n][18] || i==npo[n][19] || i==npo[n][20] || i==npo[n][21] || i==npo[n][22] || i==npo[n][23] || i==npo[n][24] || i==npo[n][25]) {
+ for (var x=0; x<numtabs[n]; x++) {
+ tabcontid=npo[n][x];
+ // If a fact with a persons name and extra info---
+ if (locations[tabcontid][4] && locations[tabcontid][5]) {
+ event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][12]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br />'+locations[tabcontid][4]+'<br /><b>'+locations[tabcontid][5]+'<\/b><br />'+locations[tabcontid][3]+'<br /><\/p><\/td><\/tr><\/table>' ];
+ // or if a fact with a persons name ---
+ } else if (locations[tabcontid][5]) {
+ event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][12]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br /><b>'+locations[tabcontid][5]+'<\/b><br />'+locations[tabcontid][3]+'<br /><\/p><\/td><\/tr><\/table>' ];
+ // or if a fact with extra info ---
+ } else if (locations[tabcontid][4]) {
+ event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][13]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br />'+locations[tabcontid][4]+'<br />'+locations[tabcontid][3]+'<br /><\/p><\/td><\/tr><\/table>' ];
+ // or just a simple fact ---
+ } else {
+ event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][13]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br />'+locations[tabcontid][3]+'<br /><\/p><\/td><\/tr><\/table>' ];
+ }
+ }
+ }
+ }
+ var multitabs = [
+ '<div class="infowindow">',
+ '<div id = "gmtabs">',
+
+ '<ul class="tabs" >',
+ '<li><a href="#event" id="EV"><?php echo WT_I18N::translate('Events'); ?><\/a><\/li>',
+ <?php if ($STREETVIEW) { ?>
+ '<li><a href="#sview" id="SV"><?php echo WT_I18N::translate('Google Street View'); ?><\/a><\/li>',
+ <?php } ?>
+
+ // === To be used later === Do not delete ==============
+ // '<li><a href="#image" id="PH">Image<\/a><\/li>',
+ // '<li><a href="#" id="SP">Aerial<\/a><\/li>',
+ // =====================================================
+
+ '<\/ul>',
+
+ '<div class="panes">',
+ '<div id = "pane1">',
+ divhead,
+ event_tab,
+ '<\/div>',
+ <?php if ($STREETVIEW) { ?>
+ '<div id = "pane2">',
+ divhead,
+ '<div id="pano"><\/div>',
+ '<\/div>',
+ <?php } ?>
+
+ // === To be used later === Do not delete ==============
+ // '<div id = "pane3">',
+ // divhead,
+ // '<div id = "pane3_text">',
+ // '<img style="margin-left: -10px; margin-top: 1px;" src="'+media+'" height= "216px" width= "298px" />',
+ // '<\/div>',
+ // '<\/div>',
+ // '<div id = "pane4">',
+ // divhead,
+ // '<div id = "pane4_text">',
+ // '<br />',
+ // '<br /> Spare Tab Content',
+ // '<br />',
+ // '<\/div>',
+ // '<\/div>',
+ // =====================================================
+
+ '<\/div>',
+ '<\/div>',
+ '<\/div>'
+ ].join('');
+
+ // create the marker ===============================================
+ var html = multitabs;
+ var zoomLevel = <?php echo $GOOGLEMAP_MAX_ZOOM; ?>;
+ var marker = createMarker(i, point, event, html, category, placed, index, tab, addr2, media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, sv_point, marker_icon);
+
+ // if streetview coordinates are available, use them for marker, ===
+ // else use the place coordinates =========
+ if (sv_point && sv_point != "(0, 0)") {
+ var myLatLng = sv_point;
+ } else {
+ var myLatLng = point;
+ }
+
+ // Correct zoom level when only one marker is present ==============
+ if (i < 1) {
+ bounds.extend(myLatLng);
+ map.setZoom(zoomLevel);
+ map.setCenter(myLatLng);
+ } else {
+ bounds.extend(myLatLng);
+ map.fitBounds(bounds);
+ // Correct zoom level when multiple markers have the same coordinates ==
+ var listener1 = google.maps.event.addListener(map, "idle", function() {
+ if (map.getZoom() > zoomLevel) {
+ map.setZoom(zoomLevel);
+ }
+ google.maps.event.removeListener(listener1);
+ });
+ }
+
+ } // end loop through location markers
+
+ } // end loadMap()
+
+//]]>
+</script>
diff --git a/modules_v3/googlemap/wt_v3_pedigree_map.js.php b/modules_v3/googlemap/wt_v3_pedigree_map.js.php
new file mode 100644
index 0000000000..ae85f1b645
--- /dev/null
+++ b/modules_v3/googlemap/wt_v3_pedigree_map.js.php
@@ -0,0 +1,681 @@
+<?php
+//
+// Script file for pedigree_map.php
+//
+// Print pedigree map using Googlemaps.
+// It requires that your place coordinates are stored on the Google Map
+// 'place_locations' table. It will NOT find coordinates stored only as tags in
+// your GEDCOM file. As in the Google Maps module, it can only display place
+// markers where the location exists with identical spelling in both your
+// GEDCOM '2 PLAC' tag (within the '1 BIRT' event) and the place_locations table.
+//
+// webtrees: Web based Family History software
+// Copyright (C) 2011 webtrees development team.
+//
+// Derived from PhpGedView
+// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+//
+// 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
+// the Free Software Foundation; either version 2 of the License or,
+// at your discretion, any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// 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
+//
+// $Id$
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+?>
+
+<script type="text/javascript">
+//<![CDATA[
+
+// The HomeControl returns the map to the original position and style ==============
+function HomeControl(controlDiv, pm_map) {
+ // Set CSS styles for the DIV containing the control
+ // Setting padding to 5 px will offset the control from the edge of the map
+ controlDiv.style.paddingTop = '5px';
+ controlDiv.style.paddingRight = '0px';
+
+ // Set CSS for the control border
+ var controlUI = document.createElement('DIV');
+ controlUI.style.backgroundColor = 'white';
+ controlUI.style.color = 'black';
+ controlUI.style.borderColor = 'black';
+ controlUI.style.borderColor = 'black';
+ controlUI.style.borderStyle = 'solid';
+ controlUI.style.borderWidth = '2px';
+ controlUI.style.cursor = 'pointer';
+ controlUI.style.textAlign = 'center';
+ controlUI.title = '';
+ controlDiv.appendChild(controlUI);
+
+ // Set CSS for the control interior
+ var controlText = document.createElement('DIV');
+ controlText.style.fontFamily = 'Arial,sans-serif';
+ controlText.style.fontSize = '12px';
+ controlText.style.paddingLeft = '15px';
+ controlText.style.paddingRight = '15px';
+ controlText.innerHTML = '<b><?php echo WT_I18N::translate('Redraw map')?><\/b>';
+ controlUI.appendChild(controlText);
+
+ // Setup the click event listeners: simply set the map to original LatLng
+ google.maps.event.addDomListener(controlUI, 'click', function() {
+ pm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN),
+ pm_map.fitBounds(bounds),
+ pm_map.setCenter(bounds.getCenter()),
+ infowindow.close()
+ if (document.getElementById(lastlinkid) != null) {
+ document.getElementById(lastlinkid).className = 'person_box:target';
+ }
+ });
+}
+
+// This function picks up the click and opens the corresponding info window
+function myclick(i) {
+ if (document.getElementById(lastlinkid) != null) {
+ document.getElementById(lastlinkid).className = 'person_box:target';
+ }
+ google.maps.event.trigger(gmarkers[i], 'click');
+}
+
+// this variable will collect the html which will eventually be placed in the side_bar
+var side_bar_html = '';
+
+// arrays to hold copies of the markers and html used by the side_bar
+// because the function closure trick doesnt work there
+var gmarkers = [];
+var i = 0;
+var lastlinkid;
+
+var infowindow = new google.maps.InfoWindow({
+ //
+});
+
+// === Create an associative array of GIcons() =====================================================
+var gicons = [];
+
+// -------------------------------------------------------------------------------------------------
+gicons['1'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon1.png')
+gicons['1'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['2'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon2.png')
+gicons['2'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['2L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon2L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['2L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['2R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon2R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['2R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['2Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon2Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['2Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon2Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['3'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon3.png')
+gicons['3'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['3L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon3L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['3L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['3R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon3R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['3R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['3Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon3Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['3Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon3Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['4'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon4.png')
+gicons['4'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['4L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon4L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['4L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['4R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon4R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['4R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['4Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon4Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['4Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon4Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['5'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon5.png')
+gicons['5'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['5L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon5L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['5L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['5R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon5R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['5R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['5Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon5Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['5Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon5Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['6'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon6.png')
+gicons['6'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['6L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon6L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['6L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['6R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon6R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['6R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['6Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon6Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['6Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon6Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['7'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon7.png')
+gicons['7'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['7L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon7L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['7L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['7R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon7R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['7R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['7Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon7Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['7Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon7Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+gicons['8'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon8.png')
+gicons['8'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow50.png',
+ new google.maps.Size(37, 34), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(10, 34) // Shadow anchor is base of image
+ );
+gicons['8L'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon8L.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(28, 28) // Image anchor
+ );
+gicons['8L'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-left-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(32, 27) // Shadow anchor is base of image
+ );
+gicons['8R'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon8R.png',
+ new google.maps.Size(32, 32), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(4, 28) // Image anchor
+ );
+gicons['8R'].shadow = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/shadow-right-large.png',
+ new google.maps.Size(49, 32), // Shadow size
+ new google.maps.Point(0, 0), // Shadow origin
+ new google.maps.Point(15, 27) // Shadow anchor is base of image
+ );
+gicons['8Ls'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon8Ls.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(22, 22) // Image anchor
+ );
+gicons['8Rs'] = new google.maps.MarkerImage(WT_MODULES_DIR+'googlemap/images/icon8Rs.png',
+ new google.maps.Size(24, 24), // Image size
+ new google.maps.Point(0, 0), // Image origin
+ new google.maps.Point(2, 22) // Image anchor
+ );
+// -------------------------------------------------------------------------------------------------
+
+// / A function to create the marker and set up the event window
+function createMarker(point, name, html, mhtml, icontype) {
+ // alert(i+'. '+name+', '+icontype);
+ var contentString = '<div id="iwcontent">'+mhtml+'<\/div>';
+ // === create a marker with the requested icon ===
+ var marker = new google.maps.Marker({
+ icon: gicons[icontype],
+ shadow: gicons[icontype].shadow,
+ map: pm_map,
+ position: point,
+ zIndex: 0
+ });
+ var linkid = 'link'+i;
+ google.maps.event.addListener(marker, 'click', function() {
+ infowindow.close();
+ infowindow.setContent(contentString);
+ infowindow.open(pm_map, marker);
+ document.getElementById(linkid).className = 'person_box';
+ if (document.getElementById(lastlinkid) != null) {
+ document.getElementById(lastlinkid).className = 'person_box:target';
+ }
+ lastlinkid=linkid;
+ });
+
+ // save the info we need to use later for the side_bar
+ gmarkers[i] = marker;
+ // add a line to the side_bar html
+ side_bar_html += '<br /><div id="'+linkid+'"><a href="javascript:myclick(' + i + ')">' + html +'</a><br></div>';
+ i++;
+ return marker;
+};
+
+// create the map
+var myOptions = {
+ zoom: 6,
+ center: new google.maps.LatLng(0, 0),
+ mapTypeId: google.maps.MapTypeId.TERRAIN, // ROADMAP, SATELLITE, HYBRID, TERRAIN
+ mapTypeControlOptions: {
+ style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
+ },
+ 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 pm_map = new google.maps.Map(document.getElementById('pm_map'), myOptions);
+
+google.maps.event.addListener(pm_map, 'maptypechanged', function() {
+ map_type.refresh();
+});
+
+google.maps.event.addListener(pm_map, 'click', function() {
+ if (document.getElementById(lastlinkid) != null) {
+ document.getElementById(lastlinkid).className = 'person_box:target';
+ }
+infowindow.close();
+});
+
+// Create the DIV to hold the control and call HomeControl() passing in this DIV. --
+var homeControlDiv = document.createElement('DIV');
+var homeControl = new HomeControl(homeControlDiv, pm_map);
+homeControlDiv.index = 1;
+pm_map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
+// ---------------------------------------------------------------------------------
+
+// create the map bounds
+var bounds = new google.maps.LatLngBounds();
+
+<?php
+// add the points
+$curgen=1;
+$priv=0;
+$count=0;
+$event = '<img src="'.WT_MODULES_DIR.'googlemap/images/sq1.png" width="10" height="10">' .
+ '<strong>&nbsp;'.WT_I18N::translate('Root').':&nbsp;</strong>';
+$colored_line = array('1'=>'#FF0000','2'=>'#0000FF','3'=>'#00FF00',
+ '4'=>'#FFFF00','5'=>'#00FFFF','6'=>'#FF00FF',
+ '7'=>'#C0C0FF','8'=>'#808000');
+
+for ($i=0; $i<($controller->treesize); $i++) {
+ // moved up to grab the sex of the individuals
+ $person = WT_Person::getInstance($controller->treeid[$i]);
+ if (!empty($person)) {
+ $pid = $controller->treeid[$i];
+ $indirec = $person->getGedcomRecord();
+ $sex = $person->getSex();
+ $bplace = trim($person->getBirthPlace());
+ $bdate = $person->getBirthDate();
+ $name = $person->getFullName();
+
+ // -- check to see if we have moved to the next generation
+ if ($i+1 >= pow(2, $curgen)) {
+ $curgen++;
+ }
+ $relationship=get_relationship_name(get_relationship($controller->rootid, $pid, false, 0, true));
+ if (empty($relationship)) $relationship=WT_I18N::translate('self');
+ $event = '<img src=\"'.WT_MODULES_DIR.'googlemap/images/sq'.$curgen.'.png\" width=\"10\" height=\"10\">'.
+ '<strong>&nbsp;'.$relationship.':&nbsp;</strong>';
+
+ // add thumbnail image
+ $image = '';
+ if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
+ $object = find_highlighted_object($pid, WT_GED_ID, $indirec);
+ if (!empty($object)) {
+ $mediaobject=WT_Media::getInstance($object['mid']);
+ $image=$mediaobject->displayMedia(array('display_type'=>'googlemap'));
+ } else {
+ $sex=$person->getSex();
+ $image=display_silhouette(array('sex'=>$sex,'display_type'=>'googlemap')); // may return ''
+ }
+ }
+ // end of add image
+
+ $dataleft = $image . $event . addslashes($name);
+ $datamid = " <span><a href='".$person->getHtmlUrl()."' id='alturl' title='" . WT_I18N::translate('Individual information') . "'>";
+
+ if ($TEXT_DIRECTION == 'rtl') $datamid .= PrintReady('('.WT_I18N::translate('View Person').')');
+ else $datamid .= '('.WT_I18N::translate('View Person').')';
+ $datamid .= '</a></span>';
+ $dataright = '<br /><strong>'. WT_I18N::translate('Birth:') . '&nbsp;</strong>' .
+ addslashes($bdate->Display(false)).'<br />'.$bplace;
+
+ $latlongval[$i] = get_lati_long_placelocation($person->getBirthPlace());
+ if ($latlongval[$i] != NULL) {
+ $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]['lati']);
+ $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]['long']);
+ if (!($lat[$i] == NULL && $lon[$i] == NULL) && !($lat[$i] == 0 && $lon[$i] == 0)) {
+ if ((!$hideflags) && ($latlongval[$i]['icon'] != NULL)) {
+ $flags[$i] = $latlongval[$i]['icon'];
+ $ffile = strrchr($latlongval[$i]['icon'], '/');
+ $ffile = substr($ffile,1, strpos($ffile, '.')-1);
+ if (empty($flags[$ffile])) {
+ $flags[$ffile] = $i; // Only generate the flag once
+ if (($lat[$i] != NULL) && ($lon[$i] != NULL)) {
+ echo 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i]. ');';
+ echo 'var Marker1_0_flag = new google.maps.MarkerImage();';
+ echo 'Marker1_0_flag.image = "', WT_MODULES_DIR, 'googlemap/', $flags[$i], '";';
+ echo 'Marker1_0_flag.shadow = "', WT_MODULES_DIR, 'googlemap/images/flag_shadow.png";';
+ echo 'Marker1_0_flag.iconSize = new google.maps.Size(25, 15);';
+ echo 'Marker1_0_flag.shadowSize = new google.maps.Size(35, 45);';
+ echo 'Marker1_0_flag.iconAnchor = new google.maps.Point(1, 45);';
+ //BH echo 'Marker1_0_flag.infoWindowAnchor = new google.maps.Point(5, 1);';
+ echo 'var Marker1_0 = new google.maps.LatLng(point, {icon:Marker1_0_flag});';
+ //BH echo 'pm_map.addOverlay(Marker1_0);';
+ }
+ }
+ }
+ $marker_number = $curgen;
+ $dups=0;
+ for ($k=0; $k<$i; $k++) {
+ if ($latlongval[$i] == $latlongval[$k]) {
+ if ($clustersize == 1) {
+ $lon[$i] = $lon[$i]+0.0025;
+ $lat[$i] = $lat[$i]+0.0025;
+ } else {
+ $dups++;
+ switch($dups) {
+ case 1: $marker_number = $curgen . 'L'; break;
+ case 2: $marker_number = $curgen . 'R'; break;
+ case 3: if ($clustersize==5) {
+ $marker_number = $curgen . 'Ls'; break;
+ }
+ case 4: if ($clustersize==5) {
+ $marker_number = $curgen . 'Rs'; break;
+ }
+ case 5: //adjust position where markers have same coodinates
+ default: $marker_number = $curgen;
+ $lon[$i] = $lon[$i]+0.0025;
+ $lat[$i] = $lat[$i]+0.0025;
+ break;
+ }
+ }
+ }
+ }
+ echo 'var point = new google.maps.LatLng(', $lat[$i], ',', $lon[$i], ');';
+ echo "var marker = createMarker(point, \"", addslashes($name), "\",\n\t\"<div>",$dataleft,$datamid,$dataright,"</div>\", \"";
+ echo "<div class='iwstyle'>";
+ echo "<a href='module.php?ged=", WT_GEDURL, "&mod=googlemap&mod_action=pedigree_map&rootid={$pid}&PEDIGREE_GENERATIONS={$PEDIGREE_GENERATIONS}";
+ if ($hideflags) echo '&hideflags=1';
+ if ($hidelines) echo '&hidelines=1';
+ if ($clustersize != 5) echo '&clustersize=', $clustersize; // ignoring the default of 5
+ echo "' title='", WT_I18N::translate('Pedigree map'), "'>", $dataleft, "</a>", $datamid, $dataright, "</div>\", \"", $marker_number, "\");\n";
+ //BH echo "pm_map.addOverlay(marker);\n";
+
+ // Construct the polygon lines ---------------------------------
+ if (!$hidelines) {
+ $to_child = (intval(($i-1)/2)); // Draw a line from parent to child
+ if (isset($lat[$to_child]) && isset($lon[$to_child])) {
+ ?>
+ var linecolor;
+ var plines;
+ var lines = [
+ <?php
+ echo 'new google.maps.LatLng(', $lat[$i], ',', $lon[$i], '), ';
+ echo 'new google.maps.LatLng(', $lat[$to_child], ',', $lon[$to_child], ')';
+ ?>
+ ];
+ linecolor = <?php echo "'$colored_line[$curgen]'"; ?>;
+ plines = new google.maps.Polygon({
+ paths: lines,
+ strokeColor: linecolor,
+ // strokeColor: <?php echo $colored_line[$curgen]; ?>,
+ strokeOpacity: 0.8,
+ strokeWeight: 3,
+ fillColor: '#FF0000',
+ //fillOpacity: 0.35
+ fillOpacity: 0.1
+ });
+ plines.setMap(pm_map);
+ <?php
+ }
+ }
+ // Extend and fit marker bounds---------------------------------
+ echo 'bounds.extend(point);';
+ echo 'pm_map.fitBounds(bounds);';
+ echo "\n";
+ $count++;
+ }
+ }
+ } else {
+ $latlongval[$i] = NULL;
+ }
+}
+?>
+
+pm_map.setCenter(bounds.getCenter());
+
+// Close the sidebar highlight when the infowindow is closed ------
+google.maps.event.addListener(infowindow, 'closeclick', function() {
+ document.getElementById(lastlinkid).className = 'person_box:target';
+});
+
+// put the assembled side_bar_html contents into the side_bar div
+document.getElementById('side_bar').innerHTML = side_bar_html;
+
+// === create the context menu div ===
+var contextmenu = document.createElement('div');
+ contextmenu.style.visibility='hidden';
+ contextmenu.innerHTML = '<a href="javascript:zoomIn()"><div class="optionbox">&nbsp;&nbsp;<?php echo WT_I18N::translate('Zoom in'); ?>&nbsp;&nbsp;</div></a>'
+ + '<a href="javascript:zoomOut()"><div class="optionbox">&nbsp;&nbsp;<?php echo WT_I18N::translate('Zoom out'); ?>&nbsp;&nbsp;</div></a>'
+ + '<a href="javascript:zoomInHere()"><div class="optionbox">&nbsp;&nbsp;<?php echo WT_I18N::translate('Zoom in here'); ?>&nbsp;&nbsp;</div></a>'
+ + '<a href="javascript:zoomOutHere()"><div class="optionbox">&nbsp;&nbsp;<?php echo WT_I18N::translate('Zoom out here'); ?>&nbsp;&nbsp;</div></a>'
+ + '<a href="javascript:centreMapHere()"><div class="optionbox">&nbsp;&nbsp;<?php echo WT_I18N::translate('Center map here'); ?>&nbsp;&nbsp;</div></a>';
+//BH pm_map.getContainer().appendChild(contextmenu);
+
+// === listen for singlerightclick ===
+google.maps.event.addListener(pm_map,'singlerightclick',function(pixel,tile) {
+ // store the 'pixel' info in case we need it later
+ // adjust the context menu location if near an egde
+ // create a GControlPosition
+ // apply it to the context menu, and make the context menu visible
+ clickedPixel = pixel;
+ var x=pixel.x;
+ var y=pixel.y;
+ if (x > pm_map.getSize().width - 120) { x = pm_map.getSize().width - 120 }
+ if (y > pm_map.getSize().height - 100) { y = pm_map.getSize().height - 100 }
+ var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y));
+ pos.apply(contextmenu);
+ contextmenu.style.visibility = 'visible';
+});
+
+// === functions that perform the context menu options ===
+function zoomIn() {
+ // perform the requested operation
+ pm_map.zoomIn();
+ // hide the context menu now that it has been used
+ contextmenu.style.visibility='hidden';
+}
+function zoomOut() {
+ // perform the requested operation
+ pm_map.zoomOut();
+ // hide the context menu now that it has been used
+ contextmenu.style.visibility='hidden';
+}
+function zoomInHere() {
+ // perform the requested operation
+ var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
+ pm_map.zoomIn(point,true);
+ // hide the context menu now that it has been used
+ contextmenu.style.visibility='hidden';
+}
+function zoomOutHere() {
+ // perform the requested operation
+ var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
+ pm_map.setCenter(point,pm_map.getZoom()-1); // There is no pm_map.zoomOut() equivalent
+ // hide the context menu now that it has been used
+ contextmenu.style.visibility='hidden';
+}
+function centreMapHere() {
+ // perform the requested operation
+ var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
+ pm_map.setCenter(point);
+ // hide the context menu now that it has been used
+ contextmenu.style.visibility='hidden';
+}
+
+// === If the user clicks on the map, close the context menu ===
+google.maps.event.addListener(pm_map, 'click', function() {
+ contextmenu.style.visibility='hidden';
+});
+
+//]]>
+</script>
diff --git a/modules_v3/googlemap/wt_v3_places_edit.js.php b/modules_v3/googlemap/wt_v3_places_edit.js.php
new file mode 100644
index 0000000000..57633eaa1b
--- /dev/null
+++ b/modules_v3/googlemap/wt_v3_places_edit.js.php
@@ -0,0 +1,463 @@
+<?php
+/**
+ * Included script file for Interface to edit place locations
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Edit
+ * @version $Id$
+ *
+ * @author Brian Holland (windmillway)
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+?>
+
+<head>
+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
+ <script type="text/javascript" src="<?php echo WT_MODULES_DIR; ?>googlemap/wt_v3_places_edit_overlays.js.php"></script>
+ <link type="text/css" href="<?php echo WT_MODULES_DIR; ?>googlemap/css/wt_v3_places_edit.css" rel="stylesheet" />
+
+ <script type="text/javascript">
+ var map;
+ var marker;
+ var zoom;
+ var pl_name = "<?php echo htmlspecialchars($place_name); ?>";
+ if (pl_name) {
+ var pl_lati = '<?php echo $place_lati; ?>';
+ var pl_long = '<?php echo $place_long; ?>';
+ } else {
+ var pl_lati = '<?php echo $parent_lati; ?>';
+ var pl_long = '<?php echo $parent_long; ?>';
+ }
+ var pl_zoom = <?php echo $zoomfactor; ?>;
+ var latlng = new google.maps.LatLng(pl_lati, pl_long);
+ var polygon1;
+ var geocoder;
+ var mapType;
+
+ var infowindow = new google.maps.InfoWindow({
+ //
+ });
+
+ 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.');
+ }
+ });
+ }
+
+ function updateMap(event) {
+ var point;
+ var zoom;
+ var latitude;
+ var longitude;
+ var i;
+
+ document.editplaces.save1.disabled = '';
+ document.editplaces.save2.disabled = '';
+ zoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);
+
+ prec = 20;
+ for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
+ if (document.editplaces.NEW_PRECISION[i].checked) {
+ prec = document.editplaces.NEW_PRECISION[i].value;
+ }
+ }
+ if ((document.editplaces.NEW_PLACE_LATI.value == '') ||
+ (document.editplaces.NEW_PLACE_LONG.value == '')) {
+ latitude = parseFloat(document.editplaces.parent_lati.value).toFixed(prec);
+ longitude = parseFloat(document.editplaces.parent_long.value).toFixed(prec);
+ point = new google.maps.LatLng(latitude, longitude);
+ } else {
+ latitude = parseFloat(document.editplaces.NEW_PLACE_LATI.value).toFixed(prec);
+ longitude = parseFloat(document.editplaces.NEW_PLACE_LONG.value).toFixed(prec);
+ document.editplaces.NEW_PLACE_LATI.value = latitude;
+ document.editplaces.NEW_PLACE_LONG.value = longitude;
+
+ if (event == 'flag_drag') {
+ if (longitude < 0.0 ) {
+ longitude = longitude * -1;
+ document.editplaces.NEW_PLACE_LONG.value = longitude;
+ document.editplaces.LONG_CONTROL.value = 'PL_W';
+ } else {
+ longitude = longitude ;
+ document.editplaces.NEW_PLACE_LONG.value = longitude;
+ document.editplaces.LONG_CONTROL.value = 'PL_E';
+ }
+ if (latitude < 0.0 ) {
+ latitude = latitude * -1;
+ document.editplaces.NEW_PLACE_LATI.value = latitude;
+ document.editplaces.LATI_CONTROL.value = 'PL_S';
+ } else {
+ latitude = latitude ;
+ document.editplaces.NEW_PLACE_LATI.value = latitude;
+ document.editplaces.LATI_CONTROL.value = 'PL_N';
+ }
+
+ if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
+ latitude = latitude * -1;
+ }
+ if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
+ longitude = longitude * -1;
+ }
+ point = new google.maps.LatLng(latitude, longitude);
+ } else {
+ if (latitude < 0.0) {
+ latitude = latitude * -1;
+ document.editplaces.NEW_PLACE_LATI.value = latitude;
+ }
+ if (longitude < 0.0) {
+ longitude = longitude * -1;
+ document.editplaces.NEW_PLACE_LONG.value = longitude;
+ }
+ if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
+ latitude = latitude * -1;
+ }
+ if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
+ longitude = longitude * -1;
+ }
+ point = new google.maps.LatLng(latitude, longitude);
+ }
+ }
+
+ map.setCenter(point);
+ map.setZoom(zoom);
+ marker.setPosition(point);
+
+ }
+
+ // The HomeControl returns user to original position and style =================
+ function HomeControl(controlDiv, map) {
+ // Set CSS styles for the DIV containing the control
+ // Setting padding to 5 px will offset the control from the edge of the map
+ controlDiv.style.paddingTop = '5px';
+ controlDiv.style.paddingRight = '0px';
+
+ // Set CSS for the control border
+ var controlUI = document.createElement('DIV');
+ controlUI.style.backgroundColor = 'white';
+ controlUI.style.color = 'black';
+ controlUI.style.borderColor = 'black';
+ controlUI.style.borderColor = 'black';
+ controlUI.style.borderStyle = 'solid';
+ controlUI.style.borderWidth = '2px';
+ controlUI.style.cursor = 'pointer';
+ controlUI.style.textAlign = 'center';
+ controlUI.title = '';
+ controlDiv.appendChild(controlUI);
+
+ // Set CSS for the control interior
+ var controlText = document.createElement('DIV');
+ controlText.style.fontFamily = 'Arial,sans-serif';
+ controlText.style.fontSize = '12px';
+ controlText.style.paddingLeft = '15px';
+ controlText.style.paddingRight = '15px';
+ controlText.innerHTML = '<b><?php echo WT_I18N::translate('Redraw map')?><\/b>';
+ controlUI.appendChild(controlText);
+
+ // Setup the click event listeners: simply set the map to original LatLng
+ google.maps.event.addDomListener(controlUI, 'click', function() {
+ map.setCenter(latlng),
+ map.setZoom(pl_zoom),
+ map.setMapTypeId(google.maps.MapTypeId.ROADMAP)
+ });
+ }
+
+ function loadMap(zoom, mapType) {
+ if (mapType) {
+ mapTyp = mapType;
+ } else {
+ mapTyp = google.maps.MapTypeId.ROADMAP;
+ }
+ geocoder = new google.maps.Geocoder();
+ if (zoom) {
+ zoom = zoom;
+ }else {
+ zoom = pl_zoom;
+ }
+ // Define map
+ var myOptions = {
+ zoom: zoom,
+ center: latlng,
+ mapTypeId: mapTyp, // 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
+ },
+ 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
+ };
+
+ map = new google.maps.Map(document.getElementById('map_pane'), myOptions);
+
+ // *** === NOTE *** This function creates the UK country overlays ==========================
+ overlays();
+ // === Above function is located in WT_MODULES_DIR/googlemap/wt_v3_placeOverlays.js.php ====
+
+
+ // Close any infowindow when map is clicked
+ google.maps.event.addListener(map, 'click', function() {
+ infowindow.close();
+ });
+
+ // Create the DIV to hold the control and call HomeControl() passing in this DIV. --
+ var homeControlDiv = document.createElement('DIV');
+ var homeControl = new HomeControl(homeControlDiv, map);
+ homeControlDiv.index = 1;
+ map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
+ // ---------------------------------------------------------------------------------
+
+ // Check for zoom changes
+ google.maps.event.addListener(map, 'zoom_changed', function() {
+ document.editplaces.NEW_ZOOM_FACTOR.value = map.zoom;
+ });
+
+ // Create the Main Location Marker
+ <?php
+ if ($level < 3 && $place_icon != '') {
+ echo 'var image = new google.maps.MarkerImage("', WT_MODULES_DIR, 'googlemap/',$place_icon,'",';
+ echo 'new google.maps.Size(25, 15),'; // Image size
+ echo 'new google.maps.Point(0, 0),'; // Image origin
+ echo 'new google.maps.Point(0, 44)'; // Image anchor
+ echo ');';
+ echo 'var iconShadow = new google.maps.MarkerImage("', WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",';
+ echo 'new google.maps.Size(35, 45),'; // Shadow size
+ echo 'new google.maps.Point(0,0),'; // Shadow origin
+ echo 'new google.maps.Point(1, 45)'; // Shadow anchor is base of flagpole
+ echo ');';
+ echo 'marker = new google.maps.Marker({';
+ echo 'icon: image,';
+ echo 'shadow: iconShadow,';
+ echo 'position: latlng,';
+ echo 'map: map,';
+ echo 'title: pl_name,';
+ echo 'draggable: true,';
+ echo 'zIndex:1';
+ echo '});';
+ } else {
+ echo 'marker = new google.maps.Marker({';
+ echo 'position: latlng,';
+ echo 'map: map,';
+ echo 'title: pl_name,';
+ echo 'draggable: true,';
+ echo 'zIndex: 1';
+ echo '});';
+ }
+ ?>
+
+ prec = 20;
+ for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
+ if (document.editplaces.NEW_PRECISION[i].checked) {
+ prec = document.editplaces.NEW_PRECISION[i].value;
+ }
+ }
+
+ // Set marker by clicking on map ---
+ clickset = google.maps.event.addListener(map, 'click', function(event) {
+ // alert(pos2);
+ clearMarks();
+ latlng = event.latLng;
+ <?php
+ echo 'marker = new google.maps.Marker({';
+ echo 'position: latlng,';
+ echo 'map: map,';
+ echo 'title: pl_name,';
+ echo 'draggable: true,';
+ echo 'zIndex: 1';
+ echo '});';
+ ?>
+ pos3 = marker.getPosition();
+ document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos3.lat()).toFixed(prec);
+ document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos3.lng()).toFixed(prec);
+ updateMap('flag_drag');
+ currzoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);
+ mapType = map.getMapTypeId();
+ loadMap(currzoom, mapType);
+ });
+
+ // Set marker by drag-n-drop on map ---
+ dragset = google.maps.event.addListener(marker, 'drag', function() {
+ pos1 = marker.getPosition();
+ document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos1.lat()).toFixed(prec);
+ document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos1.lng()).toFixed(prec);
+ });
+ dropset = google.maps.event.addListener(marker, 'dragend', function() {
+ pos2 = marker.getPosition();
+ document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos2.lat()).toFixed(prec);
+ document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos2.lng()).toFixed(prec);
+ updateMap('flag_drag');
+ });
+ }
+
+ function clearMarks() {
+ marker.setMap(null);
+ }
+
+ function edit_close() {
+ if (window.opener.showchanges) window.opener.showchanges();
+ window.close();
+ }
+
+ function setLoc(lat, lng) {
+ prec = 20;
+ for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
+ if (document.editplaces.NEW_PRECISION[i].checked) {
+ prec = document.editplaces.NEW_PRECISION[i].value;
+ }
+ }
+ if (lat < 0.0) {
+ document.editplaces.NEW_PLACE_LATI.value = (lat.toFixed(prec) * -1);
+ document.editplaces.LATI_CONTROL.value = 'PL_S';
+ } else {
+ document.editplaces.NEW_PLACE_LATI.value = lat.toFixed(prec);
+ document.editplaces.LATI_CONTROL.value = 'PL_N';
+ }
+ if (lng < 0.0) {
+ document.editplaces.NEW_PLACE_LONG.value = (lng.toFixed(prec) * -1);
+ document.editplaces.LONG_CONTROL.value = 'PL_W';
+ } else {
+ document.editplaces.NEW_PLACE_LONG.value = lng.toFixed(prec);
+ document.editplaces.LONG_CONTROL.value = 'PL_E';
+ }
+ newval = new google.maps.LatLng (lat.toFixed(prec), lng.toFixed(prec));
+ updateMap();
+ }
+
+ function createMarker(i, point, name) {
+ var contentString = '<div id="iwcontent">'+name+'<\/div>';
+ <?php
+ echo 'var image = new google.maps.MarkerImage("', WT_MODULES_DIR, 'googlemap/images/marker_yellow.png",';
+ echo 'new google.maps.Size(20, 34),'; // Image size
+ echo 'new google.maps.Point(0, 0),'; // Image origin
+ echo 'new google.maps.Point(10, 34)'; // Image anchor
+ echo ');';
+ echo 'var iconShadow = new google.maps.MarkerImage("', WT_MODULES_DIR, 'googlemap/images/shadow50.png",';
+ echo 'new google.maps.Size(37, 34),'; // Shadow size
+ echo 'new google.maps.Point(0, 0),'; // Shadow origin
+ echo 'new google.maps.Point(10, 34)'; // Shadow anchor is base of image
+ echo ');';
+ ?>
+ var marker = new google.maps.Marker({
+ icon: image,
+ shadow: iconShadow,
+ map: map,
+ position: point,
+ zIndex: 0
+ });
+
+ google.maps.event.addListener(marker, 'click', function() {
+ infowindow.close();
+ infowindow.setContent(contentString);
+ infowindow.open(map, marker);
+ });
+
+ google.maps.event.addListener(map, 'click', function() {
+ infowindow.close();
+ });
+
+ return marker;
+ }
+
+ function change_icon() {
+ window.open('module.php?mod=googlemap&mod_action=flags&countrySelected=<?php echo $selected_country; ?>', '_blank', 'top=50, left=50, width=600, height=500, resizable=1, scrollbars=1');
+ return false;
+ }
+
+ function remove_icon() {
+ document.editplaces.icon.value = '';
+ document.getElementById('flagsDiv').innerHTML = '<a href="javascript:;" onclick="change_icon();return false;"><?php echo WT_I18N::translate('Change flag'); ?></a>';
+ }
+
+ function addAddressToMap(response) {
+ var bounds = new google.maps.LatLngBounds();
+ if (!response ) {
+ alert('<?php echo WT_I18N::translate('No places found'); ?>');
+ } else {
+ if (response.length > 0) {
+ for (i=0; i<response.length; i++) {
+ var name = '<div id="gname" class="iwstyle">'+response[i].address_components[0].short_name+'<br /> '+response[i].geometry.location+''
+ name += '<br /><a href="javascript:;" onclick="setLoc(' + response[i].geometry.location.lat() + ', ' + response[i].geometry.location.lng() + ');"><div id="namelink"><?php echo PrintReady(WT_I18N::translate('Use this value')); ?></div></a>'
+ name += '</div>'
+ var point = response[i].geometry.location;
+ var marker = createMarker(i, point, name);
+ bounds.extend(response[i].geometry.location);
+ }
+
+ <?php if ($level > 0) { ?>
+ map.fitBounds(bounds);
+ <?php } ?>
+ zoomlevel = map.getZoom();
+
+ if (zoomlevel < <?php echo $GOOGLEMAP_MIN_ZOOM; ?>) {
+ zoomlevel = <?php echo $GOOGLEMAP_MIN_ZOOM; ?>;
+ }
+ if (zoomlevel > <?php echo $GOOGLEMAP_MAX_ZOOM; ?>) {
+ zoomlevel = <?php echo $GOOGLEMAP_MAX_ZOOM; ?>;
+ }
+ if (document.editplaces.NEW_ZOOM_FACTOR.value < zoomlevel) {
+ zoomlevel = document.editplaces.NEW_ZOOM_FACTOR.value;
+ if (zoomlevel < <?php echo $GOOGLEMAP_MIN_ZOOM; ?>) {
+ zoomlevel = <?php echo $GOOGLEMAP_MIN_ZOOM; ?>;
+ }
+ if (zoomlevel > <?php echo $GOOGLEMAP_MAX_ZOOM; ?>) {
+ zoomlevel = <?php echo $GOOGLEMAP_MAX_ZOOM; ?>;
+ }
+ }
+ map.setCenter(bounds.getCenter());
+ map.setZoom(zoomlevel);
+ }
+ }
+ }
+
+ function showLocation_level(address) {
+ address += '<?php if ($level>0) echo ', ', addslashes(PrintReady(implode(', ', array_reverse($where_am_i, true)))); ?>';
+ geocoder.geocode({'address': address}, addAddressToMap);
+ }
+
+ function showLocation_all(address) {
+ geocoder.geocode({'address': address}, addAddressToMap);
+ }
+
+ function paste_char(value, lang, mag) {
+ document.editplaces.NEW_PLACE_NAME.value += value;
+ language_filter = lang;
+ magnify = mag;
+ }
+</script>
+</head>
+<body onload="loadMap()" >
+<table><tr><td align="center">
+</td></tr></table>
+</body>
diff --git a/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php b/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php
new file mode 100644
index 0000000000..3b0323a6d7
--- /dev/null
+++ b/modules_v3/googlemap/wt_v3_places_edit_overlays.js.php
@@ -0,0 +1,125 @@
+<?php
+/**
+ * Overlays file for Interface to edit place locations
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Edit
+ * @version $Id$
+ *
+ * @author Brian Holland (windmillway)
+ */
+?>
+
+
+// === Create Borders for the UK Countries =========================================================
+function overlays() {
+
+ // Define place LatLng arrays
+ var polygon1;
+ var num_arrays = "";
+ if (pl_name == 'Scotland') {
+ var returnGeom1 = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611';
+ num_arrays = 1;
+ } else if (pl_name == 'England') {
+ var returnGeom1 = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; //|-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
+ var returnGeom2 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
+ num_arrays = 1;
+ } else if (pl_name == 'Wales') {
+ var returnGeom1 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
+ num_arrays = 1;
+ } else if (pl_name == 'Northern Ireland') {
+ var returnGeom1 = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388';
+ num_arrays = 1;
+ } else if (pl_name == 'NC') {
+ var returnGeom1 = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938';
+ num_arrays = 1;
+ } else {
+ // show nothing
+ }
+
+/*
+ // Set borders and fill parameters ------- Not finished yet. ---------------
+ if (map.mapTypeId == 'roadmap') {
+ var colorStroke = "#444444";
+ var weightStroke = 1.2;
+ var opacityFill = 0.1;
+ } else if (map.mapTypeId == 'satellite') {
+ var colorStroke = "#000000";
+ var weightStroke = 0.1;
+ var opacityFill = 0;
+ } else if (map.mapTypeId == 'hybrid') {
+ var colorStroke = "#ffffff";
+ var weightStroke = 1.2;
+ var opacityFill = 0;
+ } else if (map.mapTypeId == 'terrain') {
+ var colorStroke = "#ffffff";
+ var weightStroke = 1.2;
+ var opacityFill = 0;
+ }
+ // -------------------------------------------------------------------------
+*/
+
+ // Calculate polygon
+ if (num_arrays > 0) {
+ var geomAry1 = new Array();
+ geomAry1 = returnGeom1.split('|');
+ var XY1 = new Array();
+ var points1 = [];
+ for (var i = 0; i < geomAry1.length; i++) {
+ XY1 = geomAry1[i].split(',');
+ points1.push( new google.maps.LatLng(parseFloat(XY1[1]),parseFloat(XY1[0]))) ;
+ }
+ // Construct the polygon
+ polygon1 = new google.maps.Polygon({
+ paths: points1,
+ strokeColor: "#888888",
+ strokeOpacity: 0.8,
+ strokeWeight: 1,
+ fillColor: "#ff0000",
+ fillOpacity: 0.15
+ });
+ polygon1.setMap(map);
+ }
+
+ // If showing two countries at the same time (num_arrays > 1) --------------
+ if (num_arrays > 1) {
+ // Calculate polygon
+ var geomAry2 = new Array();
+ geomAry2 = returnGeom2.split('|');
+ var XY2 = new Array();
+ var points2 = [];
+ for (var i = 0; i < geomAry2.length; i++) {
+ XY2 = geomAry2[i].split(',');
+ points2.push( new google.maps.LatLng(parseFloat(XY2[1]),parseFloat(XY2[0]))) ;
+ }
+ // Construct the polygon
+ polygon2 = new google.maps.Polygon({
+ paths: points2,
+ strokeColor: "#888888",
+ strokeOpacity: 0.8,
+ strokeWeight: 1,
+ fillColor: "#ff0000",
+ fillOpacity: 0.15
+ });
+ polygon2.setMap(map);
+ }
+
+}
+
diff --git a/modules_v3/googlemap/wt_v3_street_view.php b/modules_v3/googlemap/wt_v3_street_view.php
new file mode 100644
index 0000000000..8cd145e297
--- /dev/null
+++ b/modules_v3/googlemap/wt_v3_street_view.php
@@ -0,0 +1,430 @@
+<?php
+/**
+ * Displays a streetview map
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2011 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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
+ *
+ * @package webtrees
+ * @subpackage Googlemaps v3
+ * @version $Id$
+ *
+ * @author Brian Holland (windmillway)
+ */
+
+header('Content-type: text/html; charset=UTF-8');
+
+?>
+
+<html>
+<head>
+<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
+<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
+
+<script type="text/javascript">
+
+ // 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();
+ // ---------------------------------------------------------------------------------------------
+
+
+ // ---------------------------------------------------------------------------------------------
+
+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.');
+ }
+ });
+}
+
+function updateMarkerStatus(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(', ');
+}
+
+function updateMarkerAddress(str) {
+ document.getElementById('address').innerHTML = str;
+}
+
+function roundNumber(num, dec) {
+ var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
+ return result;
+}
+
+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 latLng = new google.maps.LatLng(y, x);
+
+ // Create the map and mapOptions
+ var mapOptions = {
+ zoom: 16,
+ center: latLng,
+ mapTypeId: google.maps.MapTypeId.ROADMAP, // ROADMAP, SATELLITE, HYBRID, TERRAIN
+ mapTypeControlOptions: {
+ 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
+ };
+
+ 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 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 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. ===========================
+
+ // --- 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: false,
+ navigationControlOptions: {
+ position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc
+ style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN
+ },
+ linksControl: false,
+ addressControl: false,
+ addressControlOptions: {
+ style: {
+ // display: 'none', // USE CSS notation here
+ // 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;
+ if (parseInt(navigator.appVersion)>3) {
+ document.onmousedown = mouseDown;
+ if (navigator.appName=='Netscape')
+ document.captureEvents(Event.MOUSEDOWN);
+ }
+ };
+ panorama.controls[google.maps.ControlPosition.TOP_RIGHT].push(aLink);
+ // -----------------------------------------------------------------------------------------
+
+
+ // Update current position info.
+ updateMarkerPosition(latLng);
+ geocodePosition(latLng);
+
+ // 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, '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);
+ });
+
+ 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";
+ });
+
+
+ //==============================================================================================
+ // CREATE THE MAP PANE STREETVIEW BLUE STREETS
+ //======================================================================================
+ // 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';
+ },
+ tileSize: new google.maps.Size(256, 256),
+ isPng: true
+ });
+ //======================================================================================
+ // Now add the ImageMapType overlay to the map
+ //--------------------------------------------------------------------------------------
+ map.overlayMapTypes.push(traffic);
+ map.overlayMapTypes.push(null);
+ //======================================================================================
+ // 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
+ return 'http://cbk0.google.com/cbk?output=overlay&' +
+ 'zoom=' + zoom + '&x=' + X + '&y=' + coord.y + '&cb_client=api';
+ },
+ 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;
+ }
+}
+
+function toggleStreetViewControls() {
+ if (panorama.get('addressControl') == false) {
+ panorama.set('navigationControl', true);
+ panorama.set('addressControl', true);
+ panorama.set('linksControl', true);
+ document.myForm.butt0.value='SV controls OFF';
+ } else {
+ panorama.set('navigationControl', false);
+ panorama.set('addressControl', false);
+ panorama.set('linksControl', false);
+ document.myForm.butt0.value='SV controls ON ';
+ }
+}
+
+
+
+function resetview() {
+ initialize();
+ document.myForm.butt0.value='SV controls ON ';
+}
+
+// Onload handler to fire off the app.
+google.maps.event.addDomListener(window, 'load', initialize);
+
+</script>
+</head>
+
+<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">
+<!--
+ <input type="button" value="street" name="sv_btn" onClick="addStreetViewOverlay()"></input>
+-->
+
+ <?php
+ $map = $_GET['map'];
+ $reset = $_GET['reset'];
+ echo '<input id="butt0" name ="butt0" type="button" value="SV controls ON " onclick="toggleStreetViewControls();"></input>';
+ 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="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>
+
+</body>
+</html>