v3 map, new fullscreen map

This commit is contained in:
flopp 2012-10-23 23:47:20 +02:00
parent 0e76c4ec20
commit 8980dae557
8 changed files with 3197 additions and 1068 deletions

View File

@ -64,11 +64,9 @@
else
$tpl->error($translate->t('There is no google maps key registered for this domain.', '', '', 0));
$tpl->add_header_javascript('http://maps.google.com/maps?file=api&v=2.x&key=' . urlencode($sGMKey));
$tpl->add_header_javascript('resource2/misc/map/dragzoom_packed.js');
$tpl->add_header_javascript('resource2/misc/map/LatLonDisplayControl.js');
//$tpl->add_header_javascript('https://maps.googleapis.com/maps/api/js?key=' . urlencode($sGMKey) . '&sensor=false');
$tpl->add_header_javascript('https://maps.googleapis.com/maps/api/js?sensor=false');
$tpl->add_header_javascript('resource2/misc/map/CacheMarker.js');
//$tpl->add_header_javascript('resource2/misc/map/MessageControl.js');
$tpl->add_body_load('mapLoad()');
$tpl->add_body_unload('GUnload()');
@ -268,7 +266,7 @@ function output_namesearch($sName, $nLat, $nLon, $nResultId)
`caches`.`name`, `caches`.`wp_oc`
FROM `map2_data`
INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id`
INNeR JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
WHERE `caches`.`name` LIKE '&1'
AND (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&3')
AND `map2_data`.`result_id`='&2'
@ -287,7 +285,7 @@ function output_namesearch($sName, $nLat, $nLon, $nResultId)
function output_searchresult($nResultId, $nLon1, $nLat1, $nLon2, $nLat2)
{
global $opt;
global $login, $opt;
// check if data is available and connect the right slave server
$nSlaveId = sql_value("SELECT `slave_id` FROM `map2_result` WHERE `result_id`='&1' AND DATE_ADD(`date_created`, INTERVAL '&2' SECOND)>NOW()", -2, $nResultId, $opt['map']['maxcacheage']);
@ -313,10 +311,16 @@ function output_searchresult($nResultId, $nLon1, $nLat1, $nLon2, $nLat2)
if ($bMaxRecordReached == false)
{
$rs = sql_slave("SELECT SQL_BUFFER_RESULT `caches`.`wp_oc`, `caches`.`longitude`, `caches`.`latitude`, `caches`.`type` FROM `map2_data` INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id` WHERE `map2_data`.`result_id`='&1' AND `caches`.`longitude`>'&2' AND `caches`.`longitude`<'&3' AND `caches`.`latitude`>'&4' AND `caches`.`latitude`<'&5' LIMIT " . ($opt['map']['maxrecords']+0), $nResultId, $nLon1, $nLon2, $nLat1, $nLat2);
$foundQuery = "(SELECT COUNT(*) FROM `cache_logs` WHERE `cache_logs`.`cache_id`=`caches`.`cache_id` AND `user_id`='" . $login->userid . "' AND `cache_logs`.`type` IN (1,7))";
$ownedQuery = "IF(`caches`.`user_id`='" . $login->userid . "', 1, 0 )";
$rs = sql_slave("SELECT SQL_BUFFER_RESULT `caches`.`wp_oc`, `caches`.`longitude`, `caches`.`latitude`, `caches`.`type`, " . $ownedQuery . " AS `owned`, " . $foundQuery . " AS `found` FROM `map2_data` INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id` WHERE `map2_data`.`result_id`='&1' AND `caches`.`longitude`>'&2' AND `caches`.`longitude`<'&3' AND `caches`.`latitude`>'&4' AND `caches`.`latitude`<'&5' LIMIT " . ($opt['map']['maxrecords']+0), $nResultId, $nLon1, $nLon2, $nLat1, $nLat2);
while ($r = sql_fetch_assoc($rs))
{
echo '<cache wp="' . xmlentities($r['wp_oc']) . '" lon="' . xmlentities($r['longitude']) . '" lat="' . xmlentities($r['latitude']) . '" type="' . xmlentities($r['type']) . '" />' . "\n";
$oc_wp = xmlentities($r['wp_oc']);
$owned = xmlentities($r['owned']);
$found = (xmlentities($r['found']) > 0 ? 1 : 0);
echo '<cache wp="' . $oc_wp . '" lon="' . xmlentities($r['longitude']) . '" lat="' . xmlentities($r['latitude']) . '" type="' . xmlentities($r['type']) . '" owned="' . $owned . '" found="' . $found . '" />' . "\n";
}
sql_free_result($rs);
}

331
htdocs/map2full.php Normal file
View File

@ -0,0 +1,331 @@
<?php
/***************************************************************************
* You can find the license in the docs directory
*
* Unicode Reminder メモ
***************************************************************************/
require('./lib2/web.inc.php');
require_once('./lib2/logic/cache.class.php');
require_once('./lib2/logic/attribute.class.php');
/* because the map does access some private info like
* ignored caches, we need to verify the login data
*/
$login->verify();
$sMode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : '';
if ($sMode == 'locate')
{
$nLat = isset($_REQUEST['lat']) ? $_REQUEST['lat']+0 : 0;
$nLon = isset($_REQUEST['lon']) ? $_REQUEST['lon']+0 : 0;
$nDistance = isset($_REQUEST['distance']) ? $_REQUEST['distance']+0 : 5;
if ($nDistance > 150) $nDistance = 150;
cache_locate($nLat, $nLon, $nDistance);
}
else if ($sMode == 'wpsearch')
{
$sWaypoint = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : '';
output_cachexml($sWaypoint);
}
else if ($sMode == 'namesearch')
{
$sName = isset($_REQUEST['name']) ? $_REQUEST['name'] : '';
$nLat = isset($_REQUEST['lat']) ? $_REQUEST['lat']+0 : 0;
$nLon = isset($_REQUEST['lon']) ? $_REQUEST['lon']+0 : 0;
$nResultId = isset($_REQUEST['resultid']) ? $_REQUEST['resultid']+0 : 0;
output_namesearch($sName, $nLat, $nLon, $nResultId);
}
else if ($sMode == 'searchresult')
{
$nResultId = isset($_REQUEST['resultid']) ? $_REQUEST['resultid']+0 : 0;
$nLon1 = isset($_REQUEST['lon1']) ? $_REQUEST['lon1']+0 : 0;
$nLon2 = isset($_REQUEST['lon2']) ? $_REQUEST['lon2']+0 : 0;
$nLat1 = isset($_REQUEST['lat1']) ? $_REQUEST['lat1']+0 : 0;
$nLat2 = isset($_REQUEST['lat2']) ? $_REQUEST['lat2']+0 : 0;
output_searchresult($nResultId, $nLon1, $nLat1, $nLon2, $nLat2);
}
else if ($sMode == 'fullscreen')
{
$tpl->popup = true;
$tpl->popupmargin = false;
}
$tpl->name = 'map2full';
$tpl->menuitem = MNU_MAP;
$tpl->nowpsearch = true;
// get the correct mapkey
$sHost = strtolower($_SERVER['HTTP_HOST']);
if (isset($opt['lib']['google']['mapkey'][$sHost]))
$sGMKey = $opt['lib']['google']['mapkey'][$sHost];
else
$tpl->error($translate->t('There is no google maps key registered for this domain.', '', '', 0));
//$tpl->add_header_javascript('https://maps.googleapis.com/maps/api/js?key=' . urlencode($sGMKey) . '&amp;sensor=false');
$tpl->add_header_javascript('https://maps.googleapis.com/maps/api/js?sensor=false');
$tpl->add_header_javascript('resource2/misc/map/CacheMarker.js');
$tpl->add_body_load('mapLoad()');
$tpl->add_body_unload('GUnload()');
// process start params
$bGMInitCookiePos = true;
if (isset($_REQUEST['lat']) &&
isset($_REQUEST['lon']) &&
isset($_REQUEST['zoom']))
{
$nGMInitLat = $_REQUEST['lat']+0;
$nGMInitLon = $_REQUEST['lon']+0;
$nGMInitZoom = $_REQUEST['zoom']+0;
$bGMInitCookiePos = false;
}
else
{
// init GM from user country selection
$rsCoords = sql("SELECT `gmLat`, `gmLon`, `gmZoom` FROM `countries_options` WHERE `country`='&1'", $login->getUserCountry());
$rCoord = sql_fetch_assoc($rsCoords);
sql_free_result($rsCoords);
if ($rCoord !== false)
{
$nGMInitLat = $rCoord['gmLat'];
$nGMInitLon = $rCoord['gmLon'];
$nGMInitZoom = $rCoord['gmZoom'];
}
else
{
// europe is the last fallback
$nGMInitLat = 52.74959372674114;
$nGMInitLon = 10.01953125;
$nGMInitZoom = 4;
}
}
$sGMInitWaypoint = isset($_REQUEST['wp']) ? $_REQUEST['wp'] : '';
if ($sGMInitWaypoint != '')
{
$cache = cache::fromWP($sGMInitWaypoint);
if ($cache == null)
$sGMInitWaypoint = '';
else
{
if ($cache->allowView())
{
$nGMInitLon = $cache->getLongitude();
$nGMInitLat = $cache->getLatitude();
$nGMInitZoom = 13;
$bGMInitCookiePos = false;
}
else
$sGMInitWaypoint = '';
}
}
$tpl->assign('nGMInitLon', $nGMInitLon);
$tpl->assign('nGMInitLat', $nGMInitLat);
$tpl->assign('nGMInitZoom', $nGMInitZoom);
$tpl->assign('bGMInitCookiePos', ($bGMInitCookiePos ? 1 : 0));
$tpl->assign('sGMInitWaypoint', $sGMInitWaypoint);
$tpl->assign('bFullscreen', ($sMode == 'fullscreen' ? 1 : 0));
$tpl->assign('bDisableFullscreen', $opt['map']['disablefullscreen']);
$rsCacheType = sql("SELECT `cache_type`.`id`, IFNULL(`sys_trans_text`.`text`, `cache_type`.`name`) AS `text` FROM `cache_type` LEFT JOIN `sys_trans` ON `cache_type`.`trans_id`=`sys_trans`.`id` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `cache_type`.`ordinal` ASC", $opt['template']['locale']);
$tpl->assign_rs('aCacheType', $rsCacheType);
sql_free_result($rsCacheType);
$rsCacheSize = sql("SELECT `cache_size`.`id`, IFNULL(`sys_trans_text`.`text`, `cache_size`.`name`) AS `text` FROM `cache_size` LEFT JOIN `sys_trans` ON `cache_size`.`trans_id`=`sys_trans`.`id` LEFT JOIN `sys_trans_text` ON `sys_trans`.`id`=`sys_trans_text`.`trans_id` AND `sys_trans_text`.`lang`='&1' ORDER BY `cache_size`.`ordinal` ASC", $opt['template']['locale']);
$tpl->assign_rs('aCacheSize', $rsCacheSize);
sql_free_result($rsCacheSize);
/* assign attributes */
$tpl->assign('aAttributes', attribute::getAttrbutesListArray());
$aAttributesDisabled = array();
$rs = sql("SELECT `id` FROM `cache_attrib`");
while ($r = sql_fetch_assoc($rs))
$aAttributesDisabled[] = $r['id'];
sql_free_result($rs);
$tpl->assign('aAttributesDisabled', $aAttributesDisabled);
$tpl->display();
function cache_locate($nLat, $nLon, $nDistance)
{
global $login;
$rsCache = sql_slave("SELECT " . geomath::getSqlDistanceFormula($nLon, $nLat, $nDistance) . " AS `distance`,
`caches`.`wp_oc`
FROM `caches`
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
WHERE `caches`.`latitude`>'&1' AND
`caches`.`latitude`<'&2' AND
`caches`.`longitude`>'&3' AND
`caches`.`longitude`<'&4' AND
(`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')
ORDER BY `distance` ASC LIMIT 1",
geomath::getMinLat($nLon, $nLat, $nDistance),
geomath::getMaxLat($nLon, $nLat, $nDistance),
geomath::getMinLon($nLon, $nLat, $nDistance),
geomath::getMaxLon($nLon, $nLat, $nDistance),
$login->userid);
$rCache = sql_fetch_assoc($rsCache);
sql_free_result($rsCache);
if ($rCache === false)
{
echo '<caches></caches>';
exit;
}
output_cachexml($rCache['wp_oc']);
}
function output_cachexml($sWaypoint)
{
global $opt, $login;
$rsCache = sql_slave("SELECT `caches`.`name`, `caches`.`wp_oc`, `caches`.`cache_id`, `caches`.`type`,
`caches`.`longitude`, `caches`.`latitude`,
IF(`caches`.`status`=2, 1, 0) AS `tna`,
IFNULL(`trans_status_text`.`text`, `cache_status`.`name`) AS `statustext`,
IFNULL(`trans_type_text`.`text`, `cache_type`.`name`) AS `type_text`, `cache_type`.`id` AS `type_id`,
IFNULL(`trans_size_text`.`text`, `cache_size`.`name`) AS `size`,
`caches`.`difficulty`, `caches`.`terrain`,
`caches`.`date_created`,
IFNULL(`stat_caches`.`toprating`, 0) AS `toprating`,
IF(`caches`.`user_id`='&1', 1, 0) AS `owner`,
`user`.`username`, `user`.`user_id`
FROM `caches`
INNER JOIN `cache_type` ON `caches`.`type`=`cache_type`.`id`
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
INNER JOIN `cache_size` ON `caches`.`size`=`cache_size`.`id`
LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`
LEFT JOIN `sys_trans` AS `trans_status` ON `cache_status`.`trans_id`=`trans_status`.`id` AND `cache_status`.`name`=`trans_status`.`text`
LEFT JOIN `sys_trans_text` AS `trans_status_text` ON `trans_status`.`id`=`trans_status_text`.`trans_id` AND `trans_status_text`.`lang`='&2'
LEFT JOIN `sys_trans` AS `trans_type` ON `cache_type`.`trans_id`=`trans_type`.`id` AND `cache_type`.`name`=`trans_type`.`text`
LEFT JOIN `sys_trans_text` AS `trans_type_text` ON `trans_type`.`id`=`trans_type_text`.`trans_id` AND `trans_type_text`.`lang`='&2'
LEFT JOIN `sys_trans` AS `trans_size` ON `cache_size`.`trans_id`=`trans_size`.`id` AND `cache_size`.`name`=`trans_size`.`text`
LEFT JOIN `sys_trans_text` AS `trans_size_text` ON `trans_size`.`id`=`trans_size_text`.`trans_id` AND `trans_size_text`.`lang`='&2'
WHERE (`caches`.`wp_oc`='&3' OR (`caches`.`wp_oc`!='&3' AND `caches`.`wp_gc`='&3') OR (`caches`.`wp_oc`!='&3' AND `caches`.`wp_nc`='&3')) AND
(`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&1')",
$login->userid, $opt['template']['locale'], $sWaypoint);
$rCache = sql_fetch_assoc($rsCache);
sql_free_result($rsCache);
if ($rCache === false)
{
echo '<caches></caches>';
exit;
}
$nGeokretyCount = sql_value_slave("SELECT COUNT(*) FROM `gk_item_waypoint` WHERE `wp`='&1'", 0, $sWaypoint);
$nNotFoundCount = $nAttendedCount = 0;
$nFoundCount = sql_value_slave("SELECT COUNT(*) FROM `cache_logs` WHERE `user_id`='&1' AND `cache_id`='&2' AND `type`=1", 0, $login->userid, $rCache['cache_id']);
if ($nFoundCount == 0)
$nNotFoundCount = sql_value_slave("SELECT COUNT(*) FROM `cache_logs` WHERE `user_id`='&1' AND `cache_id`='&2' AND `type`=2", 0, $login->userid, $rCache['cache_id']);
if ($rCache['type'] == 6)
$nAttendedCount = sql_value_slave("SELECT COUNT(*) FROM `cache_logs` WHERE `user_id`='&1' AND `cache_id`='&2' AND `type`=7", 0, $login->userid, $rCache['cache_id']);
echo '<caches>' . "\n";
echo ' <cache ';
echo 'name="' . xmlentities($rCache['name']) . '" ';
echo 'wpoc="' . xmlentities($rCache['wp_oc']) . '" ';
echo 'coords="' . $rCache['longitude'] . ',' . $rCache['latitude'] . '" ';
echo 'status_tna="' . xmlentities($rCache['tna']) . '" ';
echo 'status_text="' . xmlentities($rCache['statustext']) . '" ';
echo 'type_id="' . xmlentities($rCache['type_id']) . '" ';
echo 'type_text="' . xmlentities($rCache['type_text']) . '" ';
echo 'size="' . xmlentities($rCache['size']) . '" ';
echo 'difficulty="' . xmlentities($rCache['difficulty']/2) . '" ';
echo 'terrain="' . xmlentities($rCache['terrain']/2) . '" ';
echo 'listed_since="' . xmlentities(strftime($opt['locale'][$opt['template']['locale']]['format']['date'], strtotime($rCache['date_created']))) . '" ';
echo 'toprating="' . xmlentities($rCache['toprating']) . '" ';
echo 'geokreties="' . xmlentities($nGeokretyCount) . '" ';
echo 'found="' . xmlentities(($nFoundCount>0) ? 1 : 0) . '" ';
echo 'notfound="' . xmlentities(($nNotFoundCount>0) ? 1 : 0) . '" ';
echo 'attended="' . xmlentities(($nAttendedCount>0) ? 1 : 0) . '" ';
echo 'owner="' . xmlentities($rCache['owner']) . '" ';
echo 'username="' . xmlentities($rCache['username']) . '" ';
echo 'userid="' . xmlentities($rCache['user_id']) . '" />' . "\n";
echo '</caches>';
exit;
}
function output_namesearch($sName, $nLat, $nLon, $nResultId)
{
global $login;
$sName = '%' . $sName . '%';
echo '<caches>' . "\n";
$rs = sql_slave("SELECT " . geomath::getSqlDistanceFormula($nLon, $nLat, 0) . " AS `distance`,
`caches`.`name`, `caches`.`wp_oc`
FROM `map2_data`
INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id`
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
WHERE `caches`.`name` LIKE '&1'
AND (`cache_status`.`allow_user_view`=1 OR `caches`.`user_id`='&3')
AND `map2_data`.`result_id`='&2'
ORDER BY `distance` ASC LIMIT 30",
$sName,
$nResultId,
$login->userid);
while ($r = sql_fetch_assoc($rs))
{
echo '<cache name="' . xmlentities($r['name']) . '" wpoc="' . xmlentities($r['wp_oc']) . '" />' . "\n";
}
sql_free_result($rs);
echo '</caches>';
exit;
}
function output_searchresult($nResultId, $nLon1, $nLat1, $nLon2, $nLat2)
{
global $login, $opt;
// check if data is available and connect the right slave server
$nSlaveId = sql_value("SELECT `slave_id` FROM `map2_result` WHERE `result_id`='&1' AND DATE_ADD(`date_created`, INTERVAL '&2' SECOND)>NOW()", -2, $nResultId, $opt['map']['maxcacheage']);
if ($nSlaveId == -2)
{
echo '<searchresult count="0" available="0">';
echo '</searchresult>';
exit;
}
sql_connect_slave($nSlaveId);
sql("UPDATE `map2_result` SET `request_counter`=`request_counter`+1, `date_lastqueried`=NOW() WHERE `result_id`='&1'", $nResultId);
// execute query and return search result
$nRecordCount = sql_value_slave("SELECT COUNT(*) FROM `map2_data` INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id` WHERE `map2_data`.`result_id`='&1' AND `caches`.`longitude`>'&2' AND `caches`.`longitude`<'&3' AND `caches`.`latitude`>'&4' AND `caches`.`latitude`<'&5'", 0, $nResultId, $nLon1, $nLon2, $nLat1, $nLat2);
// TODO: SQL_CALC_FOUND_ROWS + $nRecordCount = sql_value_slave("SELECT FOUND_ROWS()", 0);
$bMaxRecordReached = false;
if ($nRecordCount > $opt['map']['maxrecords'])
$bMaxRecordReached = true;
echo '<searchresult count="' . $nRecordCount . '" available="1" maxrecordreached="' . ($bMaxRecordReached ? '1' : '0') . '">' . "\n";
if ($bMaxRecordReached == false)
{
$foundQuery = "(SELECT COUNT(*) FROM `cache_logs` WHERE `cache_logs`.`cache_id`=`caches`.`cache_id` AND `user_id`='" . $login->userid . "' AND `cache_logs`.`type` IN (1,7))";
$ownedQuery = "IF(`caches`.`user_id`='" . $login->userid . "', 1, 0 )";
$rs = sql_slave("SELECT SQL_BUFFER_RESULT `caches`.`wp_oc`, `caches`.`longitude`, `caches`.`latitude`, `caches`.`type`, " . $ownedQuery . " AS `owned`, " . $foundQuery . " AS `found` FROM `map2_data` INNER JOIN `caches` ON `map2_data`.`cache_id`=`caches`.`cache_id` WHERE `map2_data`.`result_id`='&1' AND `caches`.`longitude`>'&2' AND `caches`.`longitude`<'&3' AND `caches`.`latitude`>'&4' AND `caches`.`latitude`<'&5' LIMIT " . ($opt['map']['maxrecords']+0), $nResultId, $nLon1, $nLon2, $nLat1, $nLat2);
while ($r = sql_fetch_assoc($rs))
{
$oc_wp = xmlentities($r['wp_oc']);
$owned = xmlentities($r['owned']);
$found = (xmlentities($r['found']) > 0 ? 1 : 0);
echo '<cache wp="' . $oc_wp . '" lon="' . xmlentities($r['longitude']) . '" lat="' . xmlentities($r['latitude']) . '" type="' . xmlentities($r['type']) . '" owned="' . $owned . '" found="' . $found . '" />' . "\n";
}
sql_free_result($rs);
}
echo '</searchresult>';
exit;
}
?>

View File

@ -1,18 +1,30 @@
function CacheMarker(latlng, wp, type)
function CacheMarker(latlng, wp, type, owned, found, map)
{
this.latlng = latlng;
this.wp_ = wp;
if(found) {
this.image_ = 'resource2/ocstyle/images/map/24x24-found.png';
}
/*
else if(owned) {
this.image_ = 'resource2/ocstyle/images/map/24x24-owned.png';
}
*/
else {
this.image_ = 'resource2/ocstyle/images/map/24x24-cachetype-' + type + '.png';
}
this.height_ = 24;
this.width_ = 24;
this.map_ = map;
this.setMap( map );
}
CacheMarker.prototype = new GOverlay();
CacheMarker.prototype = new google.maps.OverlayView;
/* Creates the DIV representing this CacheMarker.
* @param map {GMap2} Map that bar overlay is added to.
*/
CacheMarker.prototype.initialize = function(map) {
CacheMarker.prototype.onAdd = function() {
var me = this;
// Create the DIV representing our CacheMarker
@ -28,43 +40,41 @@ CacheMarker.prototype.initialize = function(map) {
img.style.width = me.width_ + "px";
img.style.height = me.height_ + "px";
div.appendChild(img);
GEvent.addDomListener(div, "click", function()
google.maps.event.addDomListener(div, "click", function()
{
GEvent.trigger(me, "click", me.wp_);
google.maps.event.trigger(me, "click", me.wp_);
});
map.getPane(G_MAP_MARKER_PANE).appendChild(div);
//map.getPane(G_MAP_MARKER_PANE).appendChild(div);
var pane = this.getPanes().overlayImage;
pane.appendChild(div);
this.map_ = map;
this.div_ = div;
};
/* Remove the main DIV from the map pane
*/
CacheMarker.prototype.remove = function() {
CacheMarker.prototype.onRemove = function() {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
};
/* Redraw the CacheMarker based on the current projection and zoom level
* @param force {boolean} Helps decide whether to redraw overlay
*/
CacheMarker.prototype.redraw = function(force) {
// We only need to redraw if the coordinate system has changed
if (!force) return;
CacheMarker.prototype.draw = function() {
// Calculate the DIV coordinates of two opposite corners
// of our bounds to get the size and position of our CacheMarker
var divPixel = this.map_.fromLatLngToDivPixel(this.latlng);
var divPixel = this.getProjection().fromLatLngToDivPixel(this.latlng);
// Now position our DIV based on the DIV coordinates of our bounds
this.div_.style.width = this.width_ + "px";
this.div_.style.left = (divPixel.x) + "px"
this.div_.style.left = (divPixel.x-this.width_/2) + "px"
this.div_.style.height = (this.height_) + "px";
this.div_.style.top = (divPixel.y) - this.height_ + "px";
this.div_.style.top = (divPixel.y+this.height_/2) - this.height_ + "px";
};
CacheMarker.prototype.getZIndex = function(m) {
return GOverlay.getZIndex(marker.getPoint().lat())-m.clicked*10000;
return google.maps.Overlay.getZIndex(marker.getPoint().lat())-m.clicked*10000;
}
CacheMarker.prototype.getPoint = function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -38,18 +38,20 @@
<form onsubmit="javascript:mapsubmit_click(); return false;" id="cachemap">
<table class="mapsearch">
<tr>
<td class="mapsearch-a">
<input type="text" id="mapsearch" value="" onfocus="javascript:mapsearch_onfocus()" onblur="javascript:mapsearch_onblur()" class="searchfield" size="50" />
<td>
<input type="text" id="mapsearch" value="" onfocus="javascript:mapsearch_onfocus()" onblur="javascript:mapsearch_onblur()" size="50" />
</td>
<td class="mapsearch-b">
<input type="button" id="mapsubmit" value="{t}Search{/t}" onclick="javascript:mapsubmit_click()" class="searchbutton" />
<td>
<input type="button" id="mapsubmit" value="{t}Search{/t}" onclick="javascript:mapsubmit_click()" />
</td>
<td class="mapsearch-c">
<td>
<a href="#" onclick="javascript:showPermlinkBox_click()"><img src="resource2/{$opt.template.style}/images/map/35x35-star.png" align="right" style="margin-left:15px; margin-right: 0px;" height="35" width="35" alt="{t}Show link to this map{/t}" /></a>
{if !$bDisableFullscreen}
<a href="#" onclick="javascript:fullscreen_click()"><img src="resource2/{$opt.template.style}/images/map/35x35-fullscreen.png" align="right" style="margin-left:15px; margin-right: 0px;" height="35" width="35" alt="{t}Switch to full screen{/t}" /></a>
{/if}
<a href="#" onclick="javascript:fullscreen_click()"><img src="resource2/{$opt.template.style}/images/map/35x35-fullscreen.png" align="right" style="margin-left:15px; margin-right: 0px;" height="35" width="35" alt="{t}Switch to full screen{/t}" /></a>
<a href="#" onclick="javascript:download_gpx()"><img id="download_gpx_img" src="resource2/{$opt.template.style}/images/map/35x35-gpx-download.png" align="right" style="margin-left:15px; margin-right: 0px;" height="35" width="35" alt="{t}Download GPX file (max. 500){/t}" /></a>
<a href="#" onclick="javascript:center_home()"><img id="center_home_img" src="resource2/{$opt.template.style}/images/misc/32x32-home.png" align="right" style="margin-left:15px; margin-right: 0px;" height="35" width="35" alt="{t}Goto home coordinates{/t}" /></a>
</td>
</tr>
</table>
@ -279,6 +281,101 @@
{literal}
<script type="text/javascript">
<!--
function ajaxLoad( url, callback, postData )
{
var http_request = false;
if (window.XMLHttpRequest)
{ // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{ // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request)
{
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = function() {
if (http_request.readyState == 4)
{
if (http_request.status == 200)
{
callback(http_request.responseText, http_request.status);
}
else
{
alert('Request Failed: ' + http_request.status);
}
}
};
if (postData)
{ // POST
http_request.open('POST', url, true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send(postData);
}
else
{
http_request.open('GET', url, true);
http_request.send(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, postbody )
{
ajaxLoad( url, callback, postbody );
//GDownloadUrl( url, callback );
};
function downloadUrl2(url, callback, postbody) {
ajaxLoad( url, callback, postbody );
//GDownloadUrl( url, callback, postbody );
};
/**
* 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);
};
var mnInitLat = {/literal}{$nGMInitLat}{literal};
var mnInitLon = {/literal}{$nGMInitLon}{literal};
var mnInitZoom = {/literal}{$nGMInitZoom}{literal};
@ -298,12 +395,12 @@
msInitCookieConfigName = '';
}
var moGeocoder = new GClientGeocoder();
var moGeocoder = new google.maps.Geocoder();
var moSearchList = document.getElementById('mapselectlist');
var maSearchListCoords = new Array();
var moMapSearch = document.getElementById('mapsearch');
var moMap = null;
var moInfoWindow = null;
var moMarkerList = new Array();
var msPopupMarkerWP = '';
@ -317,7 +414,7 @@
var mbDataDownloadHaveSecondChance = false;
var mbDataDownloadStartTime;
var moDataLoadTimer = null;
var copyrightDiv = null;
var mnMaxDownloadCount = 500;
var mbDownloadEnabled = false;
@ -357,66 +454,98 @@
var nZoomLevel = moMap.getZoom();
var dCookieExp = new Date(2049, 12, 31);
document.cookie = msInitCookieConfigName + "=" + moMap.getCurrentMapType().getName(false) + ";expires=" + dCookieExp.toUTCString();
document.cookie = msInitCookieConfigName + "=" + moMap.getMapTypeId() + ";expires=" + dCookieExp.toUTCString();
document.cookie = msInitCookieLastPosName + "=" + nZoomLevel + ":" + oCenterPos.lng() + ":" + oCenterPos.lat() + ";expires=" + dCookieExp.toUTCString();
msPermalink = msURLMapPHP + "?lat=" + oCenterPos.lat() + "&lon=" + oCenterPos.lng() + "&zoom=" + nZoomLevel + "&map=" + encodeURI(moMap.getCurrentMapType().getName(false));
msPermalink = msURLMapPHP + "?lat=" + oCenterPos.lat() + "&lon=" + oCenterPos.lng() + "&zoom=" + nZoomLevel + "&map=" + encodeURI(moMap.getMapTypeId);
var oPermalinkTextBox = document.getElementById('permalink_text');
if (oPermalinkTextBox)
oPermalinkTextBox.value = "{/literal}{$opt.page.absolute_url}{literal}" + msPermalink;
}
function mapLoad()
{
if (GBrowserIsCompatible())
{
var aDragZoomOptions = {
buttonStartingStyle: {display:'block',color:'black',background:'white',width:'7em',textAlign:'center',fontFamily:'Verdana',fontSize:'8px',fontWeight:'bold',border:'1px solid gray',paddingBottom:'1px',cursor:'pointer'},
buttonHTML: '{t escape=js}Drag Zoom{/t}',
buttonZoomingHTML: '{t escape=js}Drag a region on the map (click here to reset){/t}',
buttonZoomingStyle: {background:'yellow'},
backButtonHTML: '{t escape=js}Drag Zoom Back{/t}',
backButtonStyle: {display:'none',marginTop:'3px',background:'#FFFFC8'},
backButtonEnabled: false
}
cookieLoad();
moMap = new GMap2(document.getElementById("map"));
moMap.addMapType(G_PHYSICAL_MAP);
var myOptions = {
zoom: mnInitZoom,
center: new google.maps.LatLng( mnInitLat, mnInitLon ),
mapTypeControlOptions: {
mapTypeIds: ['OSM', google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.TERRAIN],
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
moMap = new google.maps.Map( document.getElementById("map"), myOptions);
OSM_addMapType();
moMap.addControl(new GSmallZoomControl());
moMap.addControl(new GHierarchicalMapTypeControl());
moMap.addControl(new GOverviewMapControl());
moMap.addControl(new GScaleControl());
moMap.addControl(new DragZoomControl({}, aDragZoomOptions, {}), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(28,8)));
moMap.addControl(new LatLonDisplayControl());
//moMap.addControl(new MessageControl(250, 125));
moInfoWindow = new google.maps.InfoWindow();
rqc_initialize(moMap);
tmd_initialize(moMap);
moMap.enableScrollWheelZoom();
moMap.setCenter(new GLatLng(mnInitLat, mnInitLon), mnInitZoom, map_GetMapTypeByName(msInitType));
GEvent.addListener(moMap, "movestart", function(){map_movestart()});
GEvent.addListener(moMap, "moveend", function(){map_moveend()});
GEvent.addListener(moMap, "maptypechanged", function(){map_maptypechanged()});
// Create div for showing copyrights.
copyrightDiv = document.createElement("div");
copyrightDiv.id = "map-copyright";
copyrightDiv.style.fontSize = "11px";
copyrightDiv.style.fontFamily = "Arial, sans-serif";
copyrightDiv.style.margin = "0 2px 2px 0";
copyrightDiv.style.whiteSpace = "nowrap";
copyrightDiv.style.background = "#FFFFFF";
moMap.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(copyrightDiv);
moMap.setCenter(new google.maps.LatLng(mnInitLat, mnInitLon), mnInitZoom, map_GetMapTypeByName(msInitType));
google.maps.event.addListener(moMap, "dragstart", function(){map_movestart()});
google.maps.event.addListener(moMap, "dragend", function(){map_moveend()});
google.maps.event.addListener(moMap, "zoom_changed", function(){map_moveend()});
google.maps.event.addListener(moMap, "maptypeid_changed", function(){map_maptypechanged()});
if (msInitWaypoint != "")
{
show_cachepopup_wp(msInitWaypoint, true);
}
if (moMapSearch)
{
moMapSearch.value = msSearchHint;
}
updateCopyrights();
// built initial msPermalink
cookieSave();
moDataLoadTimer = window.setTimeout('data_load()', 2000);
}
function updateCopyrights()
{
if( copyrightDiv == null )
{
return;
}
newMapType = moMap.getMapTypeId();
if( newMapType == "OSM" )
{
copyrightDiv.innerHTML = "Map data (C) by <a href=\"http://www.openstreetmap.org/\">OpenStreetMap.org</a> and its contributors";
}
else
{
copyrightDiv.innerHTML = "";
}
}
function map_GetMapTypeByName(sName)
{
//TODO: doesn't work yet
var oMapTypeFound = null;
/*
// old gmaps v2 code
var aMapTypes = moMap.getMapTypes();
for (var nIndex=0; nIndex<aMapTypes.length; nIndex++)
@ -427,9 +556,10 @@
break;
}
}
*/
if (oMapTypeFound==null)
oMapTypeFound = G_HYBRID_MAP;
oMapTypeFound = google.maps.MapTypeId.HYBRID;
return oMapTypeFound;
}
@ -449,13 +579,13 @@
function map_maptypechanged()
{
updateCopyrights();
cookieSave();
}
function fullscreen_click()
{
// TODO
window.open(msPermalink.replace(/map2\.php/, 'map.php') + '&mode=fullscreen','ocgm','width=' + screen.width + ',height=' + screen.height + ',resizable=yes,scrollbars=1');
window.open(msPermalink.replace(/map2\.php/, 'map2full.php') + '&mode=fullscreen','_self');
}
function showPermlinkBox_click()
@ -463,7 +593,9 @@
var oBox = document.getElementById('permalink_box');
if (window.opera)
{
document.getElementById('permalink_addFavorites').style.display = 'none';
}
else
{
if ((typeof window.external.AddFavorite == 'undefined') &&
@ -561,12 +693,21 @@
var sText = maSearchListCoords[nIndex]['text'];
if (sWaypoint != '')
{
show_cachepopup_wp(sWaypoint, true);
data_load();
}
else
{
var oCoords = new GLatLng(nLat, nLon);
var oCoords = new google.maps.LatLng(nLat, nLon);
moMap.setCenter(oCoords, 13);
moMap.openInfoWindowHtml(oCoords, xmlentities(sText));
moInfoWindow.close();
moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: xmlentities(sText) });
moInfoWindow.open( moMap );
data_load();
}
}
@ -595,10 +736,10 @@
// do search on opencaching.de
// TODO: ensure mnResultId is set
var oCenterPos = moMap.getCenter();
GDownloadUrl(msURLMapPHP + "?mode=namesearch&name=" + encodeURI(sSearchText) + "&lat=" + oCenterPos.lat() + "&lon=" + oCenterPos.lng() + "&resultid=" + mnResultId,
function(data, responseCode)
{
var xml = GXml.parse(data);
ajaxLoad(msURLMapPHP + "?mode=namesearch&name=" + encodeURI(sSearchText) + "&lat=" + oCenterPos.lat() + "&lon=" + oCenterPos.lng() + "&resultid=" + mnResultId,
function(data, responseCode) {
var xml = xmlParse(data);
var caches = xml.documentElement.getElementsByTagName("cache");
// clear the result list
@ -606,6 +747,7 @@
if (caches.length>0)
{
//TODO: translate
oTempOption = new Option("Gefundene Geocaches", -1);
oTempOption.style.color = "gray";
moSearchList.options[moSearchList.length] = oTempOption;
@ -631,16 +773,16 @@
}
// do search on google
moGeocoder.setViewport(new GLatLngBounds(new GLatLng(56, 5), new GLatLng(47, 16)));
moGeocoder.getLocations(sSearchText,
function(retval)
moGeocoder.geocode( { 'address': sSearchText },
function(results, status)
{
if (retval["Status"]["code"] == 602)
if (status == google.maps.GeocoderStatus.ZERO_RESULTS)
{
// no result
}
else if (retval["Status"]["code"] != 200)
else if (status != google.maps.GeocoderStatus.OK)
{
//TODO: translate
alert("Fehler während der Suche!");
return;
}
@ -648,20 +790,21 @@
var nPlacemarksCount = 0;
var nPlacemarkIndex;
if (retval["Status"]["code"] == 200)
nPlacemarksCount = retval["Placemark"].length;
if (status == google.maps.GeocoderStatus.OK)
nPlacemarksCount = results.length;
if (nPlacemarksCount>0)
{
//TODO: translate
oTempOption = new Option("Gefundene Orte (Google)", -1);
oTempOption.style.color = "gray";
moSearchList.options[moSearchList.length] = oTempOption;
for (nPlacemarkIndex=0; nPlacemarkIndex<nPlacemarksCount; nPlacemarkIndex++)
{
var coord = retval["Placemark"][nPlacemarkIndex]["Point"]["coordinates"];
var text = retval["Placemark"][nPlacemarkIndex]["address"];
var value = add_searchlist_itemcoords(coord[1], coord[0], "", text);
var coord = results[nPlacemarkIndex].geometry.location;
var text = results[nPlacemarkIndex].formatted_address;
var value = add_searchlist_itemcoords(coord.lat(), coord.lng(), "", text);
var item = new Option(" " + text, value);
item.style.marginLeft = "20px";
moSearchList.options[moSearchList.length] = item;
@ -671,6 +814,7 @@
if (moSearchList.length==0)
{
mapselectlist_hide();
//TODO: translate
alert("'" + sSearchText + "' mit den unten ausgewählten Suchkriterien nicht gefunden!");
return;
}
@ -704,11 +848,10 @@
function show_cachepopup_url(sURL, sWaypoint, bAllowZoomChange)
{
moMap.closeInfoWindow();
moInfoWindow.close();
GDownloadUrl(sURL, function(data, responseCode)
{
var oXML = GXml.parse(data);
ajaxLoad(sURL, function(data, responseCode) {
var oXML = xmlParse(data);
var oCoords = parseXML_GetPoint(oXML);
if (!oCoords)
{
@ -718,6 +861,7 @@
sMessage = sMessage.replace(/%1/, sWaypoint);
alert(sMessage);
}
return;
}
@ -727,7 +871,9 @@
moMap.setCenter(oCoords, 13);
var oPopupHTML = parseXML_GetHTML(oXML);
moMap.openInfoWindowHtml(oCoords, oPopupHTML);
moInfoWindow = new google.maps.InfoWindow({ position: oCoords, content: oPopupHTML });
moInfoWindow.open( moMap );
});
}
@ -822,23 +968,22 @@
return false;
var oCoords = oCaches[0].getAttribute("coords").split(",");
var oCoordsYX = new GLatLng(oCoords[1],oCoords[0]);
var oCoordsYX = new google.maps.LatLng(oCoords[1],oCoords[0]);
return oCoordsYX;
}
function OSM_addMapType()
{
var oOSMCopyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-90,-180), new GLatLng(90,180)), 0, '(<a rel="license" href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>)');
var oCopyrightCollection = new GCopyrightCollection('{t escape=js}Maps &copy; 2009 <a href="http://www.openstreetmap.org/">OpenStreetMap</a> Contributors{/t}');
oCopyrightCollection.addCopyright(oOSMCopyright);
var aTileLayers = new Array();
aTileLayers[0] = new GTileLayer(oCopyrightCollection, 0, 18);
aTileLayers[0].getTileUrl = function(a,z) { return "http://tile.openstreetmap.org/" + z + "/" + a.x + "/" + a.y + ".png"; };
aTileLayers[0].isPng = function () { return true; };
aTileLayers[0].getOpacity = function () { return 1.0; };
var oOSMMapType = new GMapType(aTileLayers, new GMercatorProjection(19), "OSM", { urlArg: 'mapnik', linkColor: '#000000' });
moMap.addMapType(oOSMMapType);
moMap.mapTypes.set("OSM", new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "OSM",
alt: "OpenStreetMap",
maxZoom: 18
}));
}
function mapsearch_onfocus()
@ -1027,8 +1172,12 @@
if (msPopupMarkerWP == '')
{
// remove every waypoint and popups etc.
for (var nIndex=0; nIndex<moMarkerList.length; nIndex++)
{
moMarkerList[nIndex].setMap(null);
}
moMarkerList = new Array();
moMap.clearOverlays();
}
else
{
@ -1036,10 +1185,43 @@
{
var oMarker = moMarkerList[nIndex];
if (oMarker.getWaypoint() != msPopupMarkerWP)
moMap.removeOverlay(oMarker);
{
oMarker.setMap(null);
}
}
}
}
/* delete all markers, except those specified in "wpset". return the set of remaining markers */
function data_clear_except( wpset )
{
var existing = {};
document.getElementById('statCachesCount').firstChild.nodeValue = 0;
var newList = new Array();
for (var nIndex=0; nIndex<moMarkerList.length; nIndex++)
{
var oMarker = moMarkerList[nIndex];
var wp = oMarker.getWaypoint();
if( wp != msPopupMarkerWP && !( wp in wpset ) )
{
oMarker.setMap(null);
}
else
{
existing[wp] = true;
newList[newList.length] = oMarker;
}
}
moMarkerList = newList;
return existing;
}
function data_load()
{
@ -1050,11 +1232,11 @@
{
tmd_hide();
mbDataDownloadHaveSecondChance = true;
GDownloadUrl(msURLMapPHP, data_mapreceive, get_mapfilter_params());
ajaxLoad(msURLMapPHP, data_mapreceive, get_mapfilter_params());
}
else
{
GDownloadUrl(msURLSearchPHP, data_searchreceive, get_searchfilter_params('map2', true, false));
ajaxLoad(msURLSearchPHP, data_searchreceive, get_searchfilter_params('map2', true, false));
}
}
@ -1067,12 +1249,15 @@
alert(sMessage);
return;
}
var oXML = GXml.parse(data);
var oXML = xmlParse(data);
if (oXML.documentElement.getAttribute("available") == 0)
{
if (mbDataDownloadHaveSecondChance == true)
GDownloadUrl(msURLSearchPHP, data_searchreceive, get_searchfilter_params('map2', true, false));
{
ajaxLoad(msURLSearchPHP, data_searchreceive, get_searchfilter_params('map2', true, false));
}
else
{
alert('{t escape=js}Error: Unable to download the search result. The data was not available on the server.{/t}');
@ -1080,27 +1265,43 @@
return;
}
data_clear();
var record_count = oXML.documentElement.getAttribute("count");
download_enabled((record_count<=mnMaxDownloadCount) && (record_count>0));
/* nee too many markers -> clear all and display message */
if (oXML.documentElement.getAttribute("maxrecordreached") == 1)
{
data_clear();
tmd_show(record_count);
return;
}
/* compute set of markers to keep */
var wpset = {};
var oCachesList = oXML.documentElement.getElementsByTagName("cache");
for (var nIndex=0; nIndex<oCachesList.length; nIndex++)
{
var sWaypoint = oCachesList[nIndex].getAttribute("wp");
wpset[sWaypoint] = true;
}
/* delete unneeded markers */
var alreadythere = data_clear_except( wpset );
/* add new markers (skip existing) */
for (var nIndex=0; nIndex<oCachesList.length; nIndex++)
{
var sWaypoint = oCachesList[nIndex].getAttribute("wp");
if( !( sWaypoint in alreadythere ) )
{
var nLon = oCachesList[nIndex].getAttribute("lon");
var nLat = oCachesList[nIndex].getAttribute("lat");
var nType = oCachesList[nIndex].getAttribute("type");
var bOwned = ( oCachesList[nIndex].getAttribute("owned") > 0 );
var bFound = ( oCachesList[nIndex].getAttribute("found") > 0 );
addCacheToMap(sWaypoint, nLon, nLat, nType);
addCacheToMap(sWaypoint, nLon, nLat, nType, bOwned, bFound);
}
}
document.getElementById('statCachesCount').firstChild.nodeValue = oCachesList.length;
@ -1111,17 +1312,21 @@
{
mbDownloadEnabled = enabled;
if (enabled)
{
document.getElementById('download_gpx_img').src = 'resource2/ocstyle/images/map/35x35-gpx-download.png';
}
else
{
document.getElementById('download_gpx_img').src = 'resource2/ocstyle/images/map/35x35-no-gpx-download.png';
}
}
function getTimeDiff(dTime1, dTime2)
{
return ((dTime2-dTime1)/1000).toFixed(1);
}
function addCacheToMap(sWaypoint, nLon, nLat, nType)
function addCacheToMap(sWaypoint, nLon, nLat, nType, bOwned, bFound)
{
if (sWaypoint == msPopupMarkerWP)
{
@ -1129,13 +1334,14 @@
{
var oMarker = moMarkerList[nIndex];
if (oMarker.getWaypoint() == msPopupMarkerWP)
{
return;
}
}
}
var oMarker = new CacheMarker(new GLatLng(nLat, nLon), sWaypoint, nType);
GEvent.addListener(oMarker, "click", function(wp){CacheMarker_click(wp);});
moMap.addOverlay(oMarker);
var oMarker = new CacheMarker(new google.maps.LatLng(nLat, nLon), sWaypoint, nType, bOwned, bFound, moMap);
google.maps.event.addListener(oMarker, "click", function(wp){CacheMarker_click(wp);});
moMarkerList[moMarkerList.length] = oMarker;
}
@ -1150,14 +1356,19 @@
{
// TODO: check
if (responseCode == 200)
{
// TODO: make sure that data must is a numeric ID
mnResultId = data;
}
// continue with data download
tmd_hide();
mbDataDownloadHaveSecondChance = false;
GDownloadUrl(msURLMapPHP, data_mapreceive, get_mapfilter_params());
ajaxLoad(msURLMapPHP, data_mapreceive, get_mapfilter_params());
}
/* GM custom controls */
/* TooManyDataControl
@ -1204,7 +1415,12 @@
tmd_container.appendChild(textDiv);
textDiv.appendChild(tmd_text);
oMap.getContainer().appendChild(tmd_container);
// hack to put box above map
tmd_container.style.zIndex = 10;
boxDiv.style.zIndex = 11;
textDiv.style.zIndex = 12;
oMap.getDiv().appendChild(tmd_container);
tmd_hide();
return tmd_container;
@ -1247,6 +1463,8 @@
var okButton = document.createElement("button");
var okText = document.createTextNode("OK");
boxDiv.style.position = 'absolute';
boxDiv.style.height = rqc_height + 'px';
boxDiv.style.width = rqc_width + 'px';
@ -1289,7 +1507,13 @@
rqc_container.appendChild(boxDiv);
rqc_container.appendChild(textDiv);
oMap.getContainer().appendChild(rqc_container);
oMap.getDiv().appendChild(rqc_container);
// hack to put box above map
rqc_container.style.zIndex = 10;
boxDiv.style.zIndex = 11;
textDiv.style.zIndex = 12;
okButton.style.zIndex = 12;
rqc_hide();
@ -1323,6 +1547,7 @@
{
return (rqc_container.style.visibility == 'visible');
}
//-->
</script>
{/literal}

File diff suppressed because it is too large Load Diff