diff options
| author | Łukasz Wilenski <wooc@gazeta.pl> | 2011-02-22 18:36:21 +0000 |
|---|---|---|
| committer | Łukasz Wilenski <wooc@gazeta.pl> | 2011-02-22 18:36:21 +0000 |
| commit | 2174bb15596cb7dcbbc9b74b4964392703c113df (patch) | |
| tree | 7dbbdea898a705916b05318483db8e0b13e30d6b | |
| parent | f57f4ff9b99ff99e628fe46a30f0f545125fad64 (diff) | |
| download | webtrees-2174bb15596cb7dcbbc9b74b4964392703c113df.tar.gz webtrees-2174bb15596cb7dcbbc9b74b4964392703c113df.tar.bz2 webtrees-2174bb15596cb7dcbbc9b74b4964392703c113df.zip | |
tidy up googlemap module
| -rw-r--r-- | modules/googlemap/googlemap.php | 369 | ||||
| -rw-r--r-- | modules/googlemap/wt_v3_googlemap.js.php | 179 | ||||
| -rw-r--r-- | modules/googlemap/wt_v3_googlemap.js_noSV.php | 679 |
3 files changed, 268 insertions, 959 deletions
diff --git a/modules/googlemap/googlemap.php b/modules/googlemap/googlemap.php index 2d1849f083..dd08d18f88 100644 --- a/modules/googlemap/googlemap.php +++ b/modules/googlemap/googlemap.php @@ -40,22 +40,22 @@ if (!defined('WT_WEBTREES')) { function print_fact_place_map($factrec) { $ct = preg_match("/2 PLAC (.*)/", $factrec, $match); if ($ct>0) { - $retStr = " "; - $levels = explode(",", $match[1]); + $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&"; + $retStr .= '<a href="placelist.php?action=show&'; foreach ($levels as $pindex=>$ppart) { // routine for replacing ampersands $ppart = preg_replace("/amp\%3B/", "", trim($ppart)); $retStr .= "parent[$pindex]=".PrintReady($ppart)."&"; } - $retStr .= "level=".count($levels); - $retStr .= "\"> ".PrintReady($place)."</a>"; + $retStr .= 'level='.count($levels); + $retStr .= '"> '.PrintReady($place).'</a>'; return $retStr; } - return ""; + return ''; } @@ -73,18 +73,18 @@ function print_address_structure_map($factrec, $level) { $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 = ""; + $resultText = ''; $cn = preg_match("/$nlevel _NAME (.*)/", $arec, $cmatch); - if ($cn>0) $resultText .= str_replace("/", "", $cmatch[1])."<br />"; + 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 "), array(" ", "<br "), PrintReady($cont)); + if (!empty($cont)) $resultText .= str_replace(array(' ', "<br "), array(" ", "<br "), PrintReady($cont)); else { - if (strlen(trim($omatch[$i][1])) > 0) echo "<br />"; + if (strlen(trim($omatch[$i][1])) > 0) echo '<br />'; $cs = preg_match("/$nlevel ADR1 (.*)/", $arec, $cmatch); if ($cs>0) { if ($cn==0) { - $resultText .= "<br />"; + $resultText .= '<br />'; $cn=0; } $resultText .= PrintReady($cmatch[1]); @@ -92,7 +92,7 @@ function print_address_structure_map($factrec, $level) { $cs = preg_match("/$nlevel ADR2 (.*)/", $arec, $cmatch); if ($cs>0) { if ($cn==0) { - $resultText .= "<br />"; + $resultText .= '<br />'; $cn=0; } $resultText .= PrintReady($cmatch[1]); @@ -100,57 +100,57 @@ function print_address_structure_map($factrec, $level) { if ($POSTAL_CODE) { if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch)) - $resultText.=" ".PrintReady($cmatch[1]); + $resultText.=' '.PrintReady($cmatch[1]); if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch)) - $resultText.=", ".PrintReady($cmatch[1]); + $resultText.=', '.PrintReady($cmatch[1]); if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch)) - $resultText.="<br />".PrintReady($cmatch[1]); + $resultText.='<br />'.PrintReady($cmatch[1]); } else { if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch)) - $resultText.="<br />".PrintReady($cmatch[1]); + $resultText.='<br />'.PrintReady($cmatch[1]); if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch)) - $resultText.=" ".PrintReady($cmatch[1]); + $resultText.=' '.PrintReady($cmatch[1]); if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch)) - $resultText.=", ".PrintReady($cmatch[1]); + $resultText.=', '.PrintReady($cmatch[1]); } } if (preg_match("/$nlevel CTRY (.*)/", $arec, $cmatch)) - $resultText.="<br />".PrintReady($cmatch[1]); - $resultText.= "<br />"; + $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>".translate_fact('PHON').": </b></span></td><td><span class=\"field\">"; + $resultText .= '<tr><td><span class="label"><b>'.translate_fact('PHON').': </b></span></td><td><span class="field">'; $resultText .= getLRM() . $omatch[$i][1]. getLRM(); - $resultText .= "</span></td></tr>"; + $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>".translate_fact('FAX').": </b></span></td><td><span class=\"field\">"; + $resultText .= '<tr><td><span class="label"><b>'.translate_fact('FAX').': </b></span></td><td><span class="field">'; $resultText .= getLRM() . $omatch[$i][1] . getLRM(); - $resultText .= "</span></td></tr>"; + $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>".translate_fact('EMAIL').": </b></span></td><td><span class=\"field\">"; - $resultText .= "<a href=\"mailto:".$omatch[$i][1]."\">".$omatch[$i][1]."</a>"; - $resultText .= "</span></td></tr>"; + $resultText .= '<tr><td><span class="label"><b>'.translate_fact('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>".translate_fact('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 .= '<tr><td><span class="label"><b>'.translate_fact('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); + $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); + $prefix_split = explode(';', $prefix_list); foreach ($prefix_split as $prefix) { if (!empty($prefix)) { if (preg_match('/^'.$prefix.' (.*)/', $place, $matches) != 0) { @@ -162,7 +162,7 @@ function rem_prefix_from_placename($prefix_list, $place, $placelist) { } function rem_postfix_from_placename($postfix_list, $place, $placelist) { - $postfix_split = explode (";", $postfix_list); + $postfix_split = explode (';', $postfix_list); foreach ($postfix_split as $postfix) { if (!empty($postfix)) { if (preg_match('/^(.*) '.$postfix.'$/', $place, $matches) != 0) { @@ -241,21 +241,23 @@ function create_possible_place_names ($placename, $level) { 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)); + 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 = 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 , , + 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= @@ -286,11 +288,9 @@ function setup_map() { return; } ?> - <!-- V3 ============ --> - <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false" type="text/javascript"></script> + <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false" type="text/javascript"></script> <!-- V3 ============ --> - <script type="text/javascript"> var minZoomLevel = <?php echo $GOOGLEMAP_MIN_ZOOM;?>; var maxZoomLevel = <?php echo $GOOGLEMAP_MAX_ZOOM;?>; @@ -303,26 +303,23 @@ 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===================================================== $placelocation=WT_DB::table_exists("##placelocation"); //-- sort the facts into date order - sort_facts($indifacts); + 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); + if ($value->getPlace()!=null) { + $placerec = get_sub_record(2, '2 PLAC', $factrec); $addrFound = false; } else { if (preg_match("/\d ADDR (.*)/", $factrec, $match)) { @@ -333,7 +330,7 @@ function build_indiv_map($indifacts, $famids) { 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); + $spouserec = get_sub_record(2, '2 _WTS', $factrec); $ctlp = preg_match("/\d _WTS @(.*)@/", $spouserec, $spouseid); if ($ctlp>0) { $useThisItem = canDisplayRecord(WT_GED_ID, find_family_record($spouseid[1], WT_GED_ID)); @@ -344,84 +341,81 @@ function build_indiv_map($indifacts, $famids) { $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); + $eventrec = get_sub_record(1, '2 TYPE', $factrec); if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) { - $markers[$i]["fact"]=$match3[1]; + $markers[$i]['fact']=$match3[1]; } else { - $markers[$i]["fact"]=translate_fact($fact); + $markers[$i]['fact']=translate_fact($fact); } } else { - $markers[$i]["fact"]=translate_fact($fact); + $markers[$i]['fact']=translate_fact($fact); } if (!empty($fact_data) && $fact_data!='Y') { - $markers[$i]["info"] = $fact_data; + $markers[$i]['info'] = $fact_data; } - $markers[$i]["placerec"] = $placerec; + $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]); - + $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]; + $markers[$i]['date'] = $match[1]; } if ($ctlp>0) { - $markers[$i]["name"]=$spouseid[1]; + $markers[$i]['name']=$spouseid[1]; } } else { if (($placelocation == true) && ($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; + $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)) { + 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); + $eventrec = get_sub_record(1, '2 TYPE', $factrec); if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) { - $markers[$i]["fact"]=$match3[1]; + $markers[$i]['fact']=$match3[1]; } else { - $markers[$i]["fact"]=translate_fact($fact); + $markers[$i]['fact']=translate_fact($fact); } } else { - $markers[$i]["fact"]=translate_fact($fact); + $markers[$i]['fact']=translate_fact($fact); } if (!empty($fact_data) && $fact_data!='Y') { - $markers[$i]["info"] = $fact_data; + $markers[$i]['info'] = $fact_data; } - $markers[$i]["icon"] = $latlongval["icon"]; - $markers[$i]["placerec"] = $placerec; - if ($zoomLevel > $latlongval["zoom"]) { - $zoomLevel = $latlongval["zoom"]; + $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"]; - + $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]; + $markers[$i]['date'] = $match[1]; } if ($ctlp>0) { - $markers[$i]["name"]=$spouseid[1]; + $markers[$i]['name']=$spouseid[1]; } } } } - } + } } // Add children to the markers list array ====================================================== @@ -440,7 +434,7 @@ function build_indiv_map($indifacts, $famids) { $placerec = ''; foreach ($person->getAllFactsByType('BIRT') as $sEvent) { $birthrec = $sEvent->getGedcomRecord(); - $placerec = get_sub_record(2, "2 PLAC", $birthrec); + $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); @@ -449,69 +443,67 @@ function build_indiv_map($indifacts, $famids) { $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 + $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"; + $markers[$i]['fact'] = WT_I18N::translate('Son'); + $markers[$i]['class'] = 'person_box'; } else { - $markers[$i]["fact"] = translate_fact('CHIL'); - $markers[$i]["class"] = "person_boxNN"; + $markers[$i]['fact'] = translate_fact('CHIL'); + $markers[$i]['class'] = 'person_boxNN'; } - $markers[$i]["placerec"] = $placerec; + } + $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]); + $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]['date'] = $matchd[1]; } - $markers[$i]["name"] = $smatch[$j][1]; - + $markers[$i]['name'] = $smatch[$j][1]; } else { if ($placelocation == true) { $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; + $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)) { + if ((count($latlongval) != 0) && ($latlongval['lati'] != NULL) && ($latlongval['long'] != NULL)) { $i = $i + 1; $markers[$i]=array('index'=>'', 'tabindex'=>'', 'placed'=>'no'); - $markers[$i]["fact"] = translate_fact('CHIL'); - $markers[$i]["class"] = "option_boxNN"; + $markers[$i]['fact'] = translate_fact('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"; + $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]['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]['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]['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]['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"]; - + $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']; } } } @@ -523,61 +515,58 @@ function build_indiv_map($indifacts, $famids) { } } } - + // 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>"; + 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>"; + 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") { + 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"])) + 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"; + // --- 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; + $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; + $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 (($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; + $markers[$k]['index'] = $indexcounter; + $markers[$k]['tabindex'] = $tabcounter; $tabcounter = $tabcounter + 1; } } @@ -586,64 +575,52 @@ function build_indiv_map($indifacts, $famids) { } } - // === add $gmarks array to the required wt_v3_googlemap.js.php ============================ + // === add $gmarks array to the required wt_v3_googlemap.js.php ============================ $gmarks = $markers; - + global $controller; $pid=$controller->indi->getXref(); - - - // *** ENABLE STREETVIEW *** (boolean) ====================================================== - $STREETVIEW=get_module_setting('googlemap', 'GM_USE_STREETVIEW'); - // ========================================================================================= - + // === Include css and js files ============================================================ echo '<link type="text/css" href="', WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet" />'; - if ($STREETVIEW) { - require_once WT_ROOT.WT_MODULES_DIR.'googlemap/wt_v3_googlemap.js.php'; - } else { - require_once WT_ROOT.WT_MODULES_DIR.'googlemap/wt_v3_googlemap.js_noSV.php'; - } + 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\">"; + 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 />"; + 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"])) { + 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); + if (preg_match("/2 PLAC (.*)/", $marker['placerec']) == 0) { + print_address_structure_map($marker['placerec'], 1); } else { - echo print_fact_place_map($marker["placerec"]), "<br />"; + echo print_fact_place_map($marker['placerec']), '<br />'; } if (!empty($marker['date'])) { $date=new WT_Date($marker['date']); - echo $date->Display(true), "<br />"; + echo $date->Display(true), '<br />'; } - echo "</td>"; - echo "</tr>"; + echo '</td>'; + echo '</tr>'; } - echo "</table></div><br />"; - + echo '</table></div><br />'; } // end prepare markers array ================================================================= - - - // ======= More V3 api stuff (not displayed now) but will be sorted later ========== + + // ======= More V3 api stuff (not displayed now) but will be sorted later ========== ?> <table id="s_bar" style="display:none;"> <tr> @@ -656,14 +633,13 @@ function build_indiv_map($indifacts, $famids) { <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 /> --> Street View Only:<input name= "radio2" type="checkbox" id="golfbox" onclick="boxclick(this,'golf')" /> <!-- 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 /> @@ -672,8 +648,7 @@ function build_indiv_map($indifacts, $famids) { Great Grandparents: <input type="checkbox" id="ggparentsbox" onclick="boxclick(this,'gen3')" /><br /> */ ?> - - </form> + </form> </td> <td style="width: 200px;"> </td> @@ -681,8 +656,6 @@ function build_indiv_map($indifacts, $famids) { </table> <?php // ================================================================================= - - echo "<br />"; + echo '<br />'; return $i; - } // end build_indiv_map function diff --git a/modules/googlemap/wt_v3_googlemap.js.php b/modules/googlemap/wt_v3_googlemap.js.php index 6a06836999..9b481c2033 100644 --- a/modules/googlemap/wt_v3_googlemap.js.php +++ b/modules/googlemap/wt_v3_googlemap.js.php @@ -27,6 +27,10 @@ * * @author Brian Holland */ + +// *** ENABLE STREETVIEW *** +$STREETVIEW=get_module_setting('googlemap', 'GM_USE_STREETVIEW'); + ?> <script type="text/javascript">var ie = 0;</script> @@ -36,23 +40,23 @@ <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(53.8403,-2.0377); + + // 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(53.8403,-2.0377); var gmarkers = []; var gicons = []; var map = null; - var head = ""; - var dir = ""; - var svzoom = ""; + var head = ''; + var dir = ''; + var svzoom = ''; - var infowindow = new google.maps.InfoWindow( { + var infowindow = new google.maps.InfoWindow( { // size: new google.maps.Size(150,50), // maxWidth: 600 }); - - <?php + + <?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),'; @@ -62,31 +66,31 @@ 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 ((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) { @@ -105,23 +109,23 @@ 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; - + 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) { var contentString = '<div id="iwcontent">'+html+'<\/div>'; - + // === Decide if marker point is Regular (latlng) or StreetView (sv_point) derived === if (sv_point == "(0, 0)") { placer = latlng; } else { placer = sv_point; } - + // === Define the marker === var marker = new google.maps.Marker({ position: placer, @@ -131,7 +135,7 @@ 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; @@ -143,7 +147,7 @@ marker.sv_lati = sv_lati; marker.sv_long = sv_long; marker.sv_point = sv_point; - + if (sv_bearing == '') { marker.sv_bearing = 0; } else { @@ -178,7 +182,7 @@ infowindow.open(map, marker); var panoramaOptions = { position: marker.position, - mode: 'html5', + mode: 'html5', // mode: 'webgl', navigationControl: false, linksControl: false, @@ -194,60 +198,72 @@ // === Use jquery for tabs === // var $fred = jQuery("#gmtabs").tabs("div.panes > div"); // jQuery("#gmtabs").tabs('select', '#SV'); - + 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 } ?> // 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 } ?> // document.panelLayer3 = eval('document.getElementById("pane3")'); // document.panelLayer3.style.display = "none"; - - }); - - jQuery('#SV').click(function() { + + }); + + 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 } ?> // 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 } ?> // document.panelLayer3 = eval('document.getElementById("pane3")'); // document.panelLayer3.style.display = "none"; var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions); // map.setStreetView(panorama); // **** If you uncomment this, the pegman will appear **** - }); - + }); + 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 } ?> // 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 } ?> // document.panelLayer3 = eval('document.getElementById("pane3")'); // document.panelLayer3.style.display = "block"; }); @@ -286,19 +302,19 @@ // == rebuild the side bar == makeSidebar(); loadMap(); - } - + } + // == Opens Marker infowindow when corresponding Sidebar item is clicked == - function myclick(i, index, tab) { + 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 = ""; @@ -322,11 +338,11 @@ 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 @@ -358,12 +374,12 @@ loadMap(); }); } - - function loadMap() { + + function loadMap() { <?php global $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES, $GEDCOM; ?> - + // Create the map and mapOptions var mapOptions = { zoom: 7, @@ -379,7 +395,6 @@ }, streetViewControl: false, // Show Pegman or not scrollwheel: false - }; map = new google.maps.Map(document.getElementById("map_pane"), mapOptions); @@ -398,9 +413,8 @@ // Add the markers to the map from the $gmarks array var locations = [ - - <?php - foreach($gmarks as $gmark) { + <?php + foreach($gmarks as $gmark) { // create thumbnail images of highlighted images =========================== if (!empty($pid)) { @@ -433,7 +447,7 @@ $image = "<img class='icon_reti' src='././images/pix1.gif' />"; } else { $indirec = $this_person->getGedcomRecord(); - $image = ""; + $image = ""; if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) { if (!empty($pid)) { $object = find_highlighted_object($pid, WT_GED_ID, $indirec); @@ -459,11 +473,11 @@ } // end of add image } } - + // Other people ---------------------------- if (!empty($person)) { $indirec2 = $person->getGedcomRecord(); - $image2 = ""; + $image2 = ""; if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) { if (!empty($gmark['name'])) { $object2 = find_highlighted_object($gmark['name'], WT_GED_ID, $indirec2); @@ -488,36 +502,34 @@ $image2 .="\' align=\'left\' class=\'".$class."\' border=\'none\' alt=\'\' />"; } } // 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>'; } } ?>", + // 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['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-19 Streetview parameters + + // Elements 14-19 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']; } ?>", @@ -527,23 +539,23 @@ // "<?php if (!empty($gmark['sv_point'])) { echo $gmark['sv_point']; } ?>" ], - <?php } ?> - ]; + <?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+''; + np[p] = ''+p+''; numtabs[p] = 0; npo[p] = new Array(); for (var q = 0; q < locations.length; q++) { @@ -552,7 +564,7 @@ numtabs[p]++; } } - } + } // Loop through all location markers ----------------------------------- for (var i = 0; i < locations.length; i++) { @@ -561,7 +573,7 @@ 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 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 @@ -576,7 +588,7 @@ 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 - + // Employ of image tab function using an information image ----- if (media == null || media == "") { media = WT_MODULES_DIR+'googlemap/images/facts/v3_image_info.png'; @@ -584,9 +596,9 @@ media = media; } // ------------------------------------------------------------- - + var sv_point = new google.maps.LatLng(sv_lati,sv_long); // StreetView Latitude and Longitide - if (document.getElementById("golfbox").checked == false) { + 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 { @@ -600,7 +612,7 @@ 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]) { @@ -621,28 +633,31 @@ } } } - } + } 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 } ?> // '<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 } ?> /* '<div id = "pane3">', divhead, @@ -651,7 +666,7 @@ '<\/div>', '<\/div>', */ - /* + /* '<div id = "pane4">', divhead, '<div id = "pane4_text">', @@ -660,7 +675,7 @@ '<br />', '<\/div>', '<\/div>', - */ + */ '<\/div>', '<\/div>', '<\/div>' diff --git a/modules/googlemap/wt_v3_googlemap.js_noSV.php b/modules/googlemap/wt_v3_googlemap.js_noSV.php deleted file mode 100644 index c4af478fbc..0000000000 --- a/modules/googlemap/wt_v3_googlemap.js_noSV.php +++ /dev/null @@ -1,679 +0,0 @@ -<?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 - */ -?> - -<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(53.8403,-2.0377); - 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) { - var contentString = '<div id="iwcontent">'+html+'<\/div>'; - - // === Decide if marker point is Regular (latlng) or StreetView (sv_point) derived === - if (sv_point == "(0, 0)") { - placer = latlng; - } else { - placer = sv_point; - } - - // === Define the marker === - var marker = new google.maps.Marker({ - position: placer, - icon: gicons[category], - shadow: iconShadow, - 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 tabs === - // var $fred = jQuery("#gmtabs").tabs("div.panes > div"); - // jQuery("#gmtabs").tabs('select', '#SV'); - - jQuery('#EV').click(function() { - document.tabLayerEV = eval('document.getElementById("EV")'); - document.tabLayerEV.style.background = "#ffffff"; - document.tabLayerEV.style.paddingBottom = "1px"; - // document.tabLayerSV = eval('document.getElementById("SV")'); - // document.tabLayerSV.style.background = "#cccccc"; - // document.tabLayerSV.style.paddingBottom = "0px"; - // 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"; - // document.panelLayer2 = eval('document.getElementById("pane2")'); - // document.panelLayer2.style.display = "none"; - // 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"; - // document.tabLayerSV = eval('document.getElementById("SV")'); - // document.tabLayerSV.style.background = "#ffffff"; - // document.tabLayerSV.style.paddingBottom = "1px"; - // 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"; - // document.panelLayer2 = eval('document.getElementById("pane2")'); - // document.panelLayer2.style.display = "block"; - // document.panelLayer3 = eval('document.getElementById("pane3")'); - // document.panelLayer3.style.display = "none"; - var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions); - // map.setStreetView(panorama); // **** If you uncomment this, the pegman will appear **** - }); - - jQuery('#PH').click(function() { - document.tabLayerEV = eval('document.getElementById("EV")'); - document.tabLayerEV.style.background = "#cccccc"; - document.tabLayerEV.style.paddingBottom = "0px"; - // document.tabLayerSV = eval('document.getElementById("SV")'); - // document.tabLayerSV.style.background = "#cccccc"; - // document.tabLayerSV.style.paddingBottom = "0px"; - // 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"; - // document.panelLayer2 = eval('document.getElementById("pane2")'); - // document.panelLayer2.style.display = "none"; - // 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 = '<?php echo WT_I18N::translate('Click to reset the map to the original view')?>'; - 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 $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.TERRAIN, // 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); - } else { - $object = ""; - } - if (!empty($object["thumb"])) { - $size = findImageSize($object["thumb"]); - $class = "pedigree_image_portrait"; - if ($size[0]>$size[1]) $class = "pedigree_image_landscape"; - if ($TEXT_DIRECTION=="rtl") $class .= "_rtl"; - $image = "<img src='{$object["thumb"]}' vspace='0' hspace='0' class='{$class}' alt ='' title='' >"; - } else { - $class = "pedigree_image_portrait"; - if ($TEXT_DIRECTION == "rtl") $class .= "_rtl"; - $sex = $this_person->getSex(); - $image = "<img src=\'./"; - if ($sex == 'F') { $image .= $WT_IMAGES["default_image_F"]; } - elseif ($sex == 'M') { $image .= $WT_IMAGES["default_image_M"]; } - else { $image .= $WT_IMAGES["default_image_U"]; } - $image .="\' align=\'left\' class=\'".$class."\' border=\'none\' alt=\'\' />"; - } - } // 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); - } else { - $object2 = ""; - } - - if (!empty($object2["thumb"])) { - $size = findImageSize($object2["thumb"]); - $class = "pedigree_image_portrait"; - if ($size[0]>$size[1]) $class = "pedigree_image_landscape"; - if ($TEXT_DIRECTION=="rtl") $class .= "_rtl"; - $image2 = "<img src='{$object2["thumb"]}' vspace='0' hspace='0' class='{$class}' alt ='' title='' >"; - } else { - $class = "pedigree_image_portrait"; - if ($TEXT_DIRECTION == "rtl") $class .= "_rtl"; - $sex = $person->getSex(); - $image2 = "<img src=\'./"; - if ($sex == 'F') { $image2 .= $WT_IMAGES["default_image_F"]; } - elseif ($sex == 'M') { $image2 .= $WT_IMAGES["default_image_M"]; } - else { $image2 .= $WT_IMAGES["default_image_U"]; } - $image2 .="\' align=\'left\' class=\'".$class."\' border=\'none\' alt=\'\' />"; - } - } // 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-19 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['sv_point'])) { echo $gmark['sv_point']; } ?>" - ], - - <?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); // 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 - - // 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; - } - // ------------------------------------------------------------- - - var sv_point = new google.maps.LatLng(sv_lati,sv_long); // StreetView Latitude and Longitide - 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 - } - - // === Use this variable if a multitab marker === - // 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>', - // '<li><a href="#sview" id="SV"><?php echo WT_I18N::translate('Google Street View'); ?><\/a><\/li>', - // '<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>', - /* - '<div id = "pane2">', - divhead, - '<div id="pano"><\/div>', - '<\/div>', - */ - /* - '<div id = "pane3">', - divhead, - '<div id = "pane3_text">', - '<img style="margin-left: -10px;" src="'+media+'" height= "217px" 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 marker = createMarker(i, point, event, html, category, placed, index, tab, addr2, media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, sv_point); - var myLatLng = new google.maps.LatLng(locations[i][1], locations[i][2]); - bounds.extend(myLatLng); - map.fitBounds(bounds); - } // end loop through location markers - } // end loadMap() -//]]> -</script> |
