diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index 065568d..b975632 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -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 = 'Full Screen'; - 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("Exit Full Screen"); - } - else - { - jQuery(mapDiv).attr('style', jQuery(mapDiv).attr('oldStyle')); - jQuery(controlUI).html("Full Screen"); - } - 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, diff --git a/img/expand.png b/img/expand.png new file mode 100644 index 0000000..2686b14 Binary files /dev/null and b/img/expand.png differ diff --git a/img/redo.png b/img/redo.png new file mode 100644 index 0000000..ec80924 Binary files /dev/null and b/img/redo.png differ diff --git a/languages/wp-gpx-maps-it_IT.mo b/languages/wp-gpx-maps-it_IT.mo new file mode 100644 index 0000000..b000d39 Binary files /dev/null and b/languages/wp-gpx-maps-it_IT.mo differ diff --git a/languages/wp-gpx-maps-it_IT.po b/languages/wp-gpx-maps-it_IT.po new file mode 100644 index 0000000..23775bf --- /dev/null +++ b/languages/wp-gpx-maps-it_IT.po @@ -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" + diff --git a/languages/wp-gpx-maps.pot b/languages/wp-gpx-maps.pot new file mode 100644 index 0000000..897fb4a --- /dev/null +++ b/languages/wp-gpx-maps.pot @@ -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 "" + diff --git a/readme.txt b/readme.txt index 9b80f37..d8317f5 100644 --- a/readme.txt +++ b/readme.txt @@ -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 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 602db0a..379edf0 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -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").'" + } }); }); '; - - 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.="Download"; + $output.="".__("Download", "wp-gpx-maps").""; } 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'); diff --git a/wp-gpx-maps_admin.php b/wp-gpx-maps_admin.php index 197e3f2..b631479 100644 --- a/wp-gpx-maps_admin.php +++ b/wp-gpx-maps_admin.php @@ -111,6 +111,7 @@ function WP_GPX_Maps_html_page() {
  • chartFrom2: minimun value for speed chart
  • chartTo2: maxumin value for speed chart
  • startIcon: Start track icon
  • +
  • waypointicon: waypoint custom icon
  • endIcon: End track icon
  • currentIcon: Current position icon (when mouse hover)
  • nggalleries: NextGen Gallery id or a list of Galleries id separated by a comma
  • diff --git a/wp-gpx-maps_admin_settings.php b/wp-gpx-maps_admin_settings.php index e64d44a..b1d030b 100644 --- a/wp-gpx-maps_admin_settings.php +++ b/wp-gpx-maps_admin_settings.php @@ -64,7 +64,7 @@

    - + " />

    @@ -128,12 +128,19 @@ + + Custom Waypoint Icon: + + (Url to image) Leave empty for default + + +

    - - + + " />

    @@ -235,7 +242,7 @@

    - + " />

    @@ -266,7 +273,7 @@

    - + " />