This commit is contained in:
bastianonm 2012-06-21 13:29:17 +00:00
parent d8c8b92e69
commit b3344dbd33
10 changed files with 238 additions and 78 deletions

View File

@ -42,7 +42,6 @@ function setup()
CustomMarker = function( map, latlng, src, img_w, img_h) {
this.latlng_ = latlng;
this.setMap(map);
this.src_ = src;
this.img_w_ = img_w;
@ -118,55 +117,6 @@ function setup()
}
function FullScreenControl(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.padding = '5px';
// 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 = 'Go full screen';
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 = '4px';
controlText.style.paddingRight = '4px';
controlText.innerHTML = '<b>Full Screen</b>';
controlUI.appendChild(controlText);
// Setup the click event listeners: simply set the map to
// Chicago
google.maps.event.addDomListener(controlUI, 'click', function(event) {
var isFullScreen = (controlUI.isfullscreen == true);
var fullScreenCss = "position: absolute;left:0;top:0;";
var mapDiv = map.getDiv();
if (isFullScreen)
{
jQuery(mapDiv).attr('oldStyle', jQuery(mapDiv).attr('style'));
jQuery(mapDiv).attr('style', fullScreenCss);
jQuery(controlUI).html("<b>Exit Full Screen</b>");
}
else
{
jQuery(mapDiv).attr('style', jQuery(mapDiv).attr('oldStyle'));
jQuery(controlUI).html("<b>Full Screen</b>");
}
controlUI.isfullscreen = !isFullScreen;
});
}
function _wpgpxmaps(params)
{
@ -191,9 +141,12 @@ function _wpgpxmaps(params)
var chartFrom2 = params.chartFrom2;
var chartTo2 = params.chartTo2;
var startIcon = params.startIcon;
var waypointIcon = params.waypointIcon;
var endIcon = params.endIcon;
var currentIcon = params.currentIcon;
var zoomOnScrollWheel = params.zoomOnScrollWheel;
var lng = params.langs;
var pluginUrl = params.pluginUrl;
var el = document.getElementById("wpgpxmaps_" + targetId);
var el_map = document.getElementById("map_" + targetId);
@ -256,16 +209,71 @@ function _wpgpxmaps(params)
maxZoom: 18
}));
//var fullScreenControlDiv = document.createElement('div');
//var fullScreenControl = new FullScreenControl(fullScreenControlDiv, map);
//fullScreenControlDiv.index = 1;
//map.controls[google.maps.ControlPosition.TOP_RIGHT].push(fullScreenControlDiv);
// FULL SCREEN BUTTON
var controlDiv = document.createElement('div');
controlDiv.style.padding = '5px';
// Set CSS for the control border
var controlUI = document.createElement('img');
controlUI.src = pluginUrl + "/wp-gpx-maps/img/expand.png";
controlUI.style.cursor = 'pointer';
controlUI.title = lng.gofullscreen;
controlDiv.appendChild(controlUI);
// Setup the click event listeners: simply set the map to
// Chicago
google.maps.event.addDomListener(controlUI, 'click', function(event) {
var isFullScreen = (controlUI.isfullscreen == true);
var fullScreenCss = "position: absolute;left:0;top:0;";
var mapDiv = map.getDiv();
var center = map.getCenter();
if (isFullScreen)
{
map.setOptions( { scrollwheel : (zoomOnScrollWheel == 'true') } );
jQuery(mapDiv).css("position", 'relative').
css('top', 0).
css("width", controlUI.googleMapWidth).
css("height", controlUI.googleMapHeight).
css("z-index", '');
google.maps.event.trigger(map, 'resize');
map.setCenter(center);
controlUI.src = pluginUrl + "/wp-gpx-maps/img/expand.png";
controlUI.title = lng.gofullscreen;
}
else
{
map.setOptions( { scrollwheel : true } );
controlUI.googleMapWidth = jQuery(mapDiv).css('width');
controlUI.googleMapHeight = jQuery(mapDiv).css('height');
jQuery(mapDiv).css("position", 'fixed').
css('top', 0).
css('left', 0).
css("width", '100%').
css("height", '100%').
css("z-index", '99999');
jQuery("#wpadminbar").each(function(){
jQuery(mapDiv).css('top', jQuery(this).height());
});
google.maps.event.trigger(map, 'resize');
map.setCenter(center);
controlUI.src = pluginUrl + "/wp-gpx-maps/img/redo.png";
controlUI.title = lng.exitfullscreen;
}
controlUI.isfullscreen = !isFullScreen;
return false;
});
controlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(controlDiv);
var bounds = new google.maps.LatLngBounds();
// Print WayPoints
if (waypoints != '')
{
var image = new google.maps.MarkerImage('http://maps.google.com/mapfiles/ms/micons/flag.png',
new google.maps.Size(32, 32),
new google.maps.Point(0,0),
@ -276,6 +284,13 @@ function _wpgpxmaps(params)
new google.maps.Point(0,0),
new google.maps.Point(16, 32)
);
if (waypointIcon!='')
{
image = new google.maps.MarkerImage(waypointIcon);
shadow = '';
}
for (i=0; i < waypoints.length; i++)
{
addWayPoint(map, image, shadow, waypoints[i][0], waypoints[i][1], waypoints[i][2], waypoints[i][3]);
@ -396,7 +411,7 @@ function _wpgpxmaps(params)
if (marker)
{
marker.setPosition(event.latLng);
marker.setTitle("Current Position");
marker.setTitle(lng.currentPosition);
if (hchart)
{
var tooltip = hchart.tooltip;
@ -485,7 +500,7 @@ function _wpgpxmaps(params)
{
var point = getItemFromArray(mapData,i)
marker.setPosition(new google.maps.LatLng(point[0],point[1]));
marker.setTitle("Current Position");
marker.setTitle(lng.currentPosition);
i+=10000000;
}
}
@ -563,7 +578,7 @@ function _wpgpxmaps(params)
hoptions.yAxis.push(yaxe);
hoptions.series.push({
name: 'Altitude',
name: lng.altitude,
lineWidth: 1,
marker: { radius: 0 },
data : eleData,
@ -624,7 +639,7 @@ function _wpgpxmaps(params)
hoptions.yAxis.push(yaxe);
hoptions.series.push({
name: 'Speed',
name: lng.speed,
lineWidth: 1,
marker: { radius: 0 },
data : speedData,
@ -663,7 +678,7 @@ function _wpgpxmaps(params)
hoptions.yAxis.push(yaxe);
hoptions.series.push({
name: 'Heart rate',
name: lng.heartRate,
lineWidth: 1,
marker: { radius: 0 },
data : hrData,
@ -702,7 +717,7 @@ function _wpgpxmaps(params)
hoptions.yAxis.push(yaxe);
hoptions.series.push({
name: 'Cadence',
name: lng.cadence,
lineWidth: 1,
marker: { radius: 0 },
data : cadData,

BIN
img/expand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/redo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

View File

@ -0,0 +1,56 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-21 14:24+0100\n"
"PO-Revision-Date: 2012-06-21 14:31+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: Italian\n"
"X-Poedit-Country: ITALY\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:348
msgid "Altitude"
msgstr "Altitudine"
#: ../wp-gpx-maps.php:349
msgid "Current Position"
msgstr "Posizione Corrente"
#: ../wp-gpx-maps.php:350
msgid "Speed"
msgstr "Velocità"
#: ../wp-gpx-maps.php:351
msgid "Heart rate"
msgstr "Battito Cardiaco"
#: ../wp-gpx-maps.php:352
msgid "Cadence"
msgstr "Cadenza"
#: ../wp-gpx-maps.php:353
msgid "Go Full Screen"
msgstr "Schermo intero"
#: ../wp-gpx-maps.php:354
msgid "Exit Full Screen"
msgstr "Torna a dimensioni originali"
#: ../wp-gpx-maps.php:370
msgid "Download"
msgstr "Scarica"
#: ../wp-gpx-maps_admin_settings.php:67
#: ../wp-gpx-maps_admin_settings.php:143
#: ../wp-gpx-maps_admin_settings.php:245
#: ../wp-gpx-maps_admin_settings.php:276
msgid "Save Changes"
msgstr "Salva"

54
languages/wp-gpx-maps.pot Normal file
View File

@ -0,0 +1,54 @@
msgid ""
msgstr ""
"Project-Id-Version: wp-gpx-maps\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-20 19:00+0100\n"
"PO-Revision-Date: 2012-06-20 19:00+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-gpx-maps.php:348
msgid "Altitude"
msgstr ""
#: ../wp-gpx-maps.php:349
msgid "Current Position"
msgstr ""
#: ../wp-gpx-maps.php:350
msgid "Speed"
msgstr ""
#: ../wp-gpx-maps.php:351
msgid "Heart rate"
msgstr ""
#: ../wp-gpx-maps.php:352
msgid "Cadence"
msgstr ""
#: ../wp-gpx-maps.php:353
msgid "Go Full Screen"
msgstr ""
#: ../wp-gpx-maps.php:354
msgid "Exit Full Screen"
msgstr ""
#: ../wp-gpx-maps.php:370
msgid "Download"
msgstr ""
#: ../wp-gpx-maps_admin_settings.php:67
#: ../wp-gpx-maps_admin_settings.php:143
#: ../wp-gpx-maps_admin_settings.php:245
#: ../wp-gpx-maps_admin_settings.php:276
msgid "Save Changes"
msgstr ""

View File

@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: maps, gpx, gps, graph, chart, google maps, highcharts, track, garmin, image, nextgen-gallery, nextgen, exif, OpenStreetMap, OpenCycleMap, Hike&Bike, heart rate, heartrate, cadence
Requires at least: 2.0.0
Tested up to: 3.4
Stable tag: 1.1.25
Stable tag: 1.1.26
License: GPLv2 or later
Draws a gpx track with altitude graph. You can also display your nextgen gallery images in the map.
@ -13,7 +13,11 @@ Draws a gpx track with altitude graph. You can also display your nextgen gallery
This plugin has, as input, the GPX file with the track you've made and as output it shows the map of the track and an interactive altitude graph (where available).
Fully configurable: custom colors and icons to make the map look like your site.
Fully configurable:
- Custom colors
- Custom icons
- multiple language Support
Display your NextGen Gallery images inside the map! Check nextgen gallery EXIF support..
@ -101,6 +105,8 @@ The attributes are:
1. currentIcon: Current position icon (when mouse hover)
1. waypointicon: waypoint custom icon
1. nggalleries: NextGen Gallery id or a list of Galleries id separated by a comma
1. ngimages: NextGen Image id or a list of Images id separated by a comma
@ -125,6 +131,10 @@ Yes!
1. Altitude & Speed & Hearth rate
== Changelog ==
= 1.1.26 =
* Multilanguage implementation (only front-end). I've implemented the italian one, I hope somebody will help me with other languages..
* Map Full screen mode (I'm sure it's not working in ie6. don't even ask!)
* Added waypoint custom icon
= 1.1.25 =
* Added possibility to download your gpx
= 1.1.23 =

View File

@ -3,7 +3,7 @@
Plugin Name: WP-GPX-Maps
Plugin URI: http://www.darwinner.it/
Description: Draws a gpx track with altitude graph
Version: 1.1.25
Version: 1.1.26
Author: Bastianon Massimo
Author URI: http://www.pedemontanadelgrappa.it/
License: GPL
@ -11,6 +11,8 @@ License: GPL
//error_reporting (E_ALL);
load_plugin_textdomain('wp-gpx-maps', "/wp-content/plugins/wp-gpx-maps/languages/");
include 'wp-gpx-maps_utils.php';
include 'wp-gpx-maps_admin.php';
@ -49,7 +51,7 @@ function enqueue_WP_GPX_Maps_scripts()
wp_enqueue_script( 'googleapis' );
wp_deregister_script( 'WP-GPX-Maps' );
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.21");
wp_register_script( 'WP-GPX-Maps', plugins_url('/WP-GPX-Maps.js', __FILE__), array('jquery'), "1.1.26");
wp_enqueue_script( 'WP-GPX-Maps' );
wp_deregister_script( 'highcharts' );
@ -83,7 +85,7 @@ function findValue($attr, $attributeName, $optionName, $defaultValue)
{
$val = get_option($optionName);
}
if ($val == '' && isset($_GET[$attributeName]))
if ($val == '' && isset($_GET[$attributeName]) && $attributeName != "download")
{
$val = $_GET[$attributeName];
}
@ -125,12 +127,15 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$startIcon = findValue($attr, "starticon", "wpgpxmaps_map_start_icon", "");
$endIcon = findValue($attr, "endicon", "wpgpxmaps_map_end_icon", "");
$currentIcon = findValue($attr, "currenticon", "wpgpxmaps_map_current_icon", "");
$waypointIcon = findValue($attr, "waypointicon", "wpgpxmaps_map_waypoint_icon", "");
$ngGalleries = findValue($attr, "nggalleries", "wpgpxmaps_map_ngGalleries", "");
$ngImages = findValue($attr, "ngimages", "wpgpxmaps_map_ngImages", "");
$download = findValue($attr, "download", "wpgpxmaps_download", "");
$r = rand(1,5000000);
$gpxurl = $gpx;
$cacheFileName = "$gpx,$w,$mh,$mt,$gh,$showW,$showHr,$showCad,$donotreducegpx,$pointsoffset,$showSpeed,$uom,v1.1.16";
$cacheFileName = md5($cacheFileName);
@ -173,7 +178,7 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
$gpx = trim($gpx);
if (strpos($gpx, "http://") !== 0 || strpos($gpx, "https://") !== 0)
if (strpos($gpxurl, "http://") === 0 || strpos($gpxurl, "https://") === 0)
{
$gpx = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $gpx);
$gpx = $sitePath . $gpx;
@ -341,22 +346,32 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='')
startIcon : "'.$startIcon.'",
endIcon : "'.$endIcon.'",
currentIcon : "'.$currentIcon.'",
zoomOnScrollWheel : "'.$zoomOnScrollWheel.'"
waypointIcon : "'.$waypointIcon.'",
zoomOnScrollWheel : "'.$zoomOnScrollWheel.'",
pluginUrl : "'.plugins_url().'",
langs : { altitude : "'.__("Altitude", "wp-gpx-maps").'",
currentPosition : "'.__("Current Position", "wp-gpx-maps").'",
speed : "'.__("Speed", "wp-gpx-maps").'",
heartRate : "'.__("Heart rate", "wp-gpx-maps").'",
cadence : "'.__("Cadence", "wp-gpx-maps").'",
gofullscreen : "'.__("Go Full Screen", "wp-gpx-maps").'",
exitfullscreen : "'.__("Exit Full Screen", "wp-gpx-maps").'"
}
});
});
</script>';
if ($download=='true' && $gpx != '')
if ($download=='true' && $gpxurl != '')
{
if (strpos($gpx, "http://") !== 0 || strpos($gpx, "https://") !== 0)
if (strpos($gpxurl, "http://") === 0 || strpos($gpxurl, "https://") === 0)
{
}
else
{
$gpx = get_bloginfo('url').$gpx;
$gpxurl = get_bloginfo('url').$gpxurl;
}
$output.="<a href='$gpx' target='_new'>Download</a>";
$output.="<a href='$gpxurl' target='_new'>".__("Download", "wp-gpx-maps")."</a>";
}
return $output;
@ -414,6 +429,7 @@ function WP_GPX_Maps_install() {
add_option("wpgpxmaps_map_start_icon", '', '', 'yes');
add_option("wpgpxmaps_map_end_icon", '', '', 'yes');
add_option("wpgpxmaps_map_current_icon", '', '', 'yes');
add_option("wpgpxmaps_map_waypoint_icon", '', '', 'yes');
add_option("wpgpxmaps_map_nggallery", '', '', 'yes');
add_option("wpgpxmaps_show_hr", '', '', 'yes');
add_option("wpgpxmaps_graph_line_color_hr", '#ff77bd', '', 'yes');
@ -443,6 +459,7 @@ function WP_GPX_Maps_remove() {
delete_option('wpgpxmaps_map_start_icon');
delete_option('wpgpxmaps_map_end_icon');
delete_option('wpgpxmaps_map_current_icon');
delete_option('wpgpxmaps_map_waypoint_icon');
delete_option('wpgpxmaps_map_nggallery');
delete_option('wpgpxmaps_show_hr');
delete_option('wpgpxmaps_graph_line_color_hr');

View File

@ -111,6 +111,7 @@ function WP_GPX_Maps_html_page() {
<li><b>chartFrom2</b>: minimun value for speed chart</li>
<li><b>chartTo2</b>: maxumin value for speed chart</li>
<li><b>startIcon</b>: Start track icon</li>
<li><b>waypointicon</b>: waypoint custom icon</li>
<li><b>endIcon</b>: End track icon</li>
<li><b>currentIcon</b>: Current position icon (when mouse hover)</li>
<li><b>nggalleries</b>: NextGen Gallery id or a list of Galleries id separated by a comma</li>

View File

@ -64,7 +64,7 @@
<p class="submit">
<input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_height,wpgpxmaps_graph_height,wpgpxmaps_width,wpgpxmaps_download" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p>
</form>
@ -128,12 +128,19 @@
</td>
</tr>
<tr>
<th scope="row">Custom Waypoint Icon:</th>
<td>
<input name="wpgpxmaps_map_waypoint_icon" value="<?php echo get_option('wpgpxmaps_map_waypoint_icon'); ?>" style="width:400px" /> <em>(Url to image) Leave empty for default</em>
</td>
</tr>
</table>
<p class="submit">
<input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_show_waypoint,wpgpxmaps_map_line_color,wpgpxmaps_map_type,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_zoomonscrollwheel" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
<input name="page_options" type="hidden" value="wpgpxmaps_show_waypoint,wpgpxmaps_map_line_color,wpgpxmaps_map_type,wpgpxmaps_map_start_icon,wpgpxmaps_map_end_icon,wpgpxmaps_map_current_icon,wpgpxmaps_zoomonscrollwheel,wpgpxmaps_map_waypoint_icon" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p>
</form>
@ -235,7 +242,7 @@
<p class="submit">
<input type="hidden" name="action" value="update" />
<input name="page_options" type="hidden" value="wpgpxmaps_unit_of_measure,wpgpxmaps_graph_line_color,wpgpxmaps_show_speed,wpgpxmaps_graph_line_color_speed,wpgpxmaps_show_hr,wpgpxmaps_graph_line_color_hr,wpgpxmaps_unit_of_measure_speed,wpgpxmaps_graph_offset_from1,wpgpxmaps_graph_offset_to1,wpgpxmaps_graph_offset_from2,wpgpxmaps_graph_offset_to2,wpgpxmaps_graph_line_color_cad,wpgpxmaps_show_cadence" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p>
</form>
@ -266,7 +273,7 @@
<input name="page_options" type="hidden" value="wpgpxmaps_pointsoffset,wpgpxmaps_donotreducegpx" />
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
<input type="submit" class="button-primary" value="<?php _e('Save Changes', "wp_gpx_maps") ?>" />
</p>
</form>