diff --git a/admin/js/travelermap-admin.js b/admin/js/travelermap-admin.js
index 4acc4e6..513f7e2 100644
--- a/admin/js/travelermap-admin.js
+++ b/admin/js/travelermap-admin.js
@@ -178,7 +178,7 @@
$('#tm_place_at_address').prop('disabled', false);
$('#tm_save_changes').prop('disabled', false);
- } else if (data.type === 'endsection') {
+ } else if (data.type === 'endsection' || data.type === 'startendsection') {
$('#tm_type').prop('disabled', false);
$('#tm_title').prop('disabled', false);
$('#tm_thumbnail').prop('disabled', false);
@@ -218,7 +218,7 @@
"arrival": $('#tm_arrival').val() !== '' ? Date.parse($('#tm_arrival').val()) : null,
"departure": $('#tm_departure').val() !== '' ? Date.parse($('#tm_departure').val()) : null
};
- if (data.type === 'startsection' || data.type === 'endsection' || data.type === 'waypoint') {
+ if (data.type === 'startsection' || data.type === 'endsection' || data.type === 'startendsection' || data.type === 'waypoint') {
data.excludeFromPath = false;
$('#tm_excludefrompath').prop('checked', data.excludeFromPath);
}
@@ -231,6 +231,7 @@
$(_currentSelection).removeClass('media');
$(_currentSelection).removeClass('post');
$(_currentSelection).removeClass('startsection');
+ $(_currentSelection).removeClass('startendsection');
$(_currentSelection).removeClass('endsection');
$(_currentSelection).addClass(data.type);
diff --git a/admin/travelermap-editmap.php b/admin/travelermap-editmap.php
index 1cbb898..52fd1dd 100644
--- a/admin/travelermap-editmap.php
+++ b/admin/travelermap-editmap.php
@@ -144,6 +144,7 @@ function travelermap_editmap() {
+
diff --git a/admin/travelermap-upgrade.php b/admin/travelermap-upgrade.php
index 296ae0c..ee664f2 100644
--- a/admin/travelermap-upgrade.php
+++ b/admin/travelermap-upgrade.php
@@ -29,6 +29,9 @@ function travelermap_upgrade() {
if( version_compare($currentVersion, '1.1.0', '<')) {
travelermap_upgrade_1_0_0_to_1_1_0();
}
+ if( version_compare($currentVersion, '1.2.0', '<')) {
+ travelermap_upgrade_1_1_0_to_1_2_0();
+ }
}
function travelermap_upgrade_1_0_0_to_1_1_0() {
@@ -40,8 +43,22 @@ function travelermap_upgrade_1_0_0_to_1_1_0() {
update_option('travelermap_settings', $settings);
}
- update_option("travelermap_version", TM_VERSION);
- update_option("travelermap_db_version", TM_VERSION);
+ update_option("travelermap_version", '1.1.0');
+ update_option("travelermap_db_version", '1.1.0');
+
+}
+
+function travelermap_upgrade_1_1_0_to_1_2_0() {
+ $settings = get_option('traverlermap_settings');
+
+ if (!$settings) {
+ $settings = array(
+ );
+ update_option('travelermap_settings', $settings);
+ }
+
+ update_option("travelermap_version", '1.2.0');
+ update_option("travelermap_db_version", '1.2.0');
}
diff --git a/frontend/js/travelermap-frontend.js b/frontend/js/travelermap-frontend.js
index 6dfe699..3301bfa 100644
--- a/frontend/js/travelermap-frontend.js
+++ b/frontend/js/travelermap-frontend.js
@@ -37,7 +37,8 @@
connectMaps : false,
height: 400,
spinner: true,
- dateFormat: "dd.MM.yyyy"
+ dateFormat: "dd.MM.yyyy",
+ zoomLevel: 3
};
var _currentMap = null;
@@ -71,7 +72,7 @@
_mapWrapper.css('height', _mapOptions.height + "px");
}
- _map = L.map(_mapWrapper[0]).setView([0,0], 3);;
+ _map = L.map(_mapWrapper[0]).setView([0,0], _mapOptions.zoomLevel);;
_map.on('popupopen', function(e) {
var px = _map.project(e.popup._latlng);
px.y -= e.popup._container.clientHeight/2;
@@ -225,8 +226,8 @@
currentLine.addLatLng([feature.lat, feature.lng]);
currentLine.bindPopup(feature.title);
currentLine['tm_data'] = feature;
- group.addLayer(currentLine);
feature['_lf_object'] = currentLine;
+ group.addLayer(currentLine);
currentLine = L.geodesicPolyline([],{color:lineColor});
currentLine.addLatLng([feature.lat, feature.lng]); //add as starting point
isInSection = false;
@@ -236,6 +237,32 @@
isInFuture = true;
}
}
+ } else if(feature.type === 'startendsection') {
+ currentLine.addLatLng([feature.lat, feature.lng]);
+ currentLine.bindPopup(feature.title);
+ currentLine['tm_data'] = feature;
+ group.addLayer(currentLine);
+ feature['_lf_object'] = currentLine;
+ currentLine = L.geodesicPolyline([],{color:lineColor});
+ currentLine.on('mouseover', function(evt) {
+ evt.target.setStyle({opacity: 1});
+ });
+ currentLine.on('mouseout', function(evt) {
+ evt.target.setStyle({opacity: 0.5});
+ });
+ currentLine.on('popupopen', function(evt) {
+ evt.target.setStyle({opacity: 1});
+ });
+ currentLine.on('popupclose', function(evt) {
+ evt.target.setStyle({opacity: 0.5});
+ });
+ currentLine.addLatLng([feature.lat, feature.lng]); //add as starting point
+ var nextPoint = _findNextWaypointMarker(data,i+1);
+ if(nextPoint) {
+ if(nextPoint.arrival && nextPoint.arrival >= new Date().getTime()) {
+ isInFuture = true;
+ }
+ }
}
if(isInFuture) {
@@ -248,7 +275,16 @@
function _findStartSection(data, start) {
for(var i = start; i >= 0; i--) {
- if(data[i].type === 'startsection') {
+ if(data[i].type === 'startsection' || data[i].type === 'startendsection') {
+ return data[i];
+ }
+ }
+ return null;
+ }
+
+ function _findEndSection(data, start) {
+ for(var i = start; i < data.length; i++) {
+ if(data[i].type === 'startendsection' || data[i].type === 'endsection') {
return data[i];
}
}
@@ -257,7 +293,7 @@
function _findNextWaypointMarker(data, start) {
for(var i = start; i < data.length; i++) {
- if((data[i].type === "waypoint" || data[i].type === "startsection" || data[i].type === "endsection" || data[i].type==='marker' || data[i].type === 'media' || data[i].type === 'post') && !data[i].excludeFromPath) {
+ if((data[i].type === "waypoint" || data[i].type === "startsection" || data[i].type === "startendsection" || data[i].type === "endsection" || data[i].type==='marker' || data[i].type === 'media' || data[i].type === 'post') && !data[i].excludeFromPath) {
return data[i];
}
}
@@ -277,7 +313,7 @@
var wp = L.circleMarker([feature.lat, feature.lng], {radius: 5, fillOpacity:1, color:lineColor}).bindPopup(feature.title);
markerLayer.addLayer(wp);
}
- } else if(feature.type === 'startsection' || feature.type === 'endsection') {
+ } else if(feature.type === 'startsection' || feature.type === 'endsection' || feature.type === 'startendsection') {
var wp = L.circleMarker([feature.lat, feature.lng], {radius: 5, fillOpacity:1, color:lineColor});
if(feature.title) {
wp.bindPopup(feature.title)
@@ -316,15 +352,18 @@
wrapper.append(img);
}
var dateInfo = '';
- if(feature.type === 'endsection') {
- var start = _findStartSection(data, position);
- if(start && start.arrival) {
+ if(feature.type === 'endsection' || feature.type === 'startendsection') {
+ var start = _findStartSection(data, position-1);
+ if(start && start.departure) {
+ dateInfo += "Start: " + $.format.date(start.departure, _mapOptions.dateFormat) + ' | ';
+ } else if(start && start.arrival) {
dateInfo += "Start: " + $.format.date(start.arrival, _mapOptions.dateFormat) + ' | ';
}
- if(feature.departure) {
+ if(feature.arrival) {
+ dateInfo += "End: " + $.format.date(feature.arrival, _mapOptions.dateFormat) + ' | ';
+ } else if(feature.departure) {
dateInfo += "End: " + $.format.date(feature.departure, _mapOptions.dateFormat) + ' | ';
}
-
} else {
if(feature.date) {
dateInfo += 'Date: ' + $.format.date(feature.date, _mapOptions.dateFormat) + ' | ';
diff --git a/frontend/travelermap-frontend.php b/frontend/travelermap-frontend.php
index 3087b2c..df8f934 100644
--- a/frontend/travelermap-frontend.php
+++ b/frontend/travelermap-frontend.php
@@ -38,7 +38,8 @@ function travelermap_show_map($atts, $content = null) {
"height" => '400',
"id" => '',
"connectmaps" => 'false',
- 'spinner' => 'true'
+ 'spinner' => 'true',
+ 'zoomlevel' => '3'
), $atts ) );
$dateFormat = get_option('date_format');
@@ -71,7 +72,7 @@ function travelermap_show_map($atts, $content = null) {
$output .= ",";
$output .= "$('#tm_map_$map_id')";
$output .= ",";
- $output .= "{connectMaps:$connectmaps, height:$height, spinner:$spinner, dateFormat:'$dateFormat'}";
+ $output .= "{connectMaps:$connectmaps, height:$height, spinner:$spinner, dateFormat:'$dateFormat', zoomLevel:$zoomlevel}";
$output .= ');';
$output .= '});';
$output .= '})(jQuery);';
diff --git a/media/tm-admin.css b/media/tm-admin.css
index 8229d4b..9b098af 100644
--- a/media/tm-admin.css
+++ b/media/tm-admin.css
@@ -103,6 +103,10 @@ ul#tm_pointlist > li.endsection {
border-left: 1px solid #000;
}
+ul#tm_pointlist > li.startendsection {
+ border: 1px solid #000;
+}
+
ul#tm_pointlist > li.startsection > i:before {
content: "\f105";
}
@@ -111,6 +115,10 @@ ul#tm_pointlist > li.endsection > i:before {
content: "\f104";
}
+ul#tm_pointlist > li.startendsection > i:before {
+ content: "\f101";
+}
+
ul#tm_pointlist > li.media > i:before {
content: "\f030";
}
diff --git a/readme.txt b/readme.txt
index a47eb06..c1207cb 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: Mathis Zeiher
Donate link: http://bitschubser.org
Tags: travel, map, waypoints
Requires at least: 3.9.0
-Tested up to: 3.9.0
-Stable tag: 1.1.0
+Tested up to: 3.9.1
+Stable tag: 1.2.0
License: MIT
License URI: http://opensource.org/licenses/MIT
@@ -12,14 +12,14 @@ A simple Plugin to create travel routes and manage maps
== Description ==
-This Pluigin allow the creation of travel maps with routes and point of interests.
+This plugin allows the creation of travel maps with routes and point of interests.
The points or route section can be linked with posts or media attachments.
To place the maps within posts use the shortcode [tm_map id=""] where id is either the map id or
a comma separated list of map ids to display.
Additional parameters for the shortcode are: connectmaps="true|false" to connect the maps in the order
specified in the comma separated id list and spinner="true|false" to disable the spinner to navigate
-through markers.
+through markers, zoomlevel="0-16" to set the initial zoom level (0 min, 16 max level)
example:
[tm_map id="1"]
@@ -51,6 +51,11 @@ Go to http://blog.bitschubser.org and ask in the wp-travelermap section or here
== Changelog ==
+= 1.2.0 =
+* added zoomlevel to shortcode to set initial zoom level
+* added startendsection marker type to create consecutive sections
+* fixed some bugs
+
= 1.1.0 =
* added ability to place marker in admin menu to a specific address (no marker dragging anymore)
* fixed some bugs
diff --git a/wp-travelermap.php b/wp-travelermap.php
index 96c3276..a7e2629 100644
--- a/wp-travelermap.php
+++ b/wp-travelermap.php
@@ -3,7 +3,7 @@
Plugin Name: wp-travelermap
Plugin URI: http://bitschubser.org/projects/wp-travelermap
Description: A simple Plugin to create travel routes and manage maps
-Version: 1.1.0
+Version: 1.2.0
Author: Mathis Zeiher
Author URI: http://bitschubser.org/
@@ -31,7 +31,7 @@
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'TM_VERSION' ) )
- define( 'TM_VERSION', '1.1.0' );
+ define( 'TM_VERSION', '1.2.0' );
if ( ! defined( 'TM_URL' ) )
define( 'TM_URL', plugin_dir_url( __FILE__ ) );