Plugin Directory

Changeset 940336


Ignore:
Timestamp:
06/29/2014 11:44:59 AM (12 years ago)
Author:
der_maddis
Message:

added startendsection, fixed bugs, added zoomlevel shortcode

Location:
wp-travelermap/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wp-travelermap/trunk/admin/js/travelermap-admin.js

    r940307 r940336  
    179179                $('#tm_place_at_address').prop('disabled', false);
    180180                $('#tm_save_changes').prop('disabled', false);
    181             } else if (data.type === 'endsection') {
     181            } else if (data.type === 'endsection' || data.type === 'startendsection') {
    182182                $('#tm_type').prop('disabled', false);
    183183                $('#tm_title').prop('disabled', false);
     
    219219                "departure": $('#tm_departure').val() !== '' ? Date.parse($('#tm_departure').val()) : null
    220220            };
    221             if (data.type === 'startsection' || data.type === 'endsection' || data.type === 'waypoint') {
     221            if (data.type === 'startsection' || data.type === 'endsection' || data.type === 'startendsection' || data.type === 'waypoint') {
    222222                data.excludeFromPath = false;
    223223                $('#tm_excludefrompath').prop('checked', data.excludeFromPath);
     
    232232            $(_currentSelection).removeClass('post');
    233233            $(_currentSelection).removeClass('startsection');
     234            $(_currentSelection).removeClass('startendsection');
    234235            $(_currentSelection).removeClass('endsection');
    235236
  • wp-travelermap/trunk/admin/travelermap-editmap.php

    r940307 r940336  
    145145                <option value="waypoint">Waypoint</option>
    146146                <option value="startsection">Start Section</option>
     147                <option value="startendsection">Start-End Section</option>
    147148                <option value="endsection">End Section</option>
    148149            </select><br />
  • wp-travelermap/trunk/admin/travelermap-upgrade.php

    r940307 r940336  
    3030        travelermap_upgrade_1_0_0_to_1_1_0();
    3131    }
     32    if( version_compare($currentVersion, '1.2.0', '<')) {
     33        travelermap_upgrade_1_1_0_to_1_2_0();
     34    }
    3235}
    3336
     
    4144    }
    4245
    43     update_option("travelermap_version", TM_VERSION);
    44     update_option("travelermap_db_version", TM_VERSION);
     46    update_option("travelermap_version", '1.1.0');
     47    update_option("travelermap_db_version", '1.1.0');
     48
     49}
     50
     51function travelermap_upgrade_1_1_0_to_1_2_0() {
     52    $settings = get_option('traverlermap_settings');
     53   
     54    if (!$settings) {
     55        $settings = array(
     56        );
     57        update_option('travelermap_settings', $settings);
     58    }
     59
     60    update_option("travelermap_version", '1.2.0');
     61    update_option("travelermap_db_version", '1.2.0');
    4562
    4663}
  • wp-travelermap/trunk/frontend/js/travelermap-frontend.js

    r940307 r940336  
    3838                height: 400,
    3939                spinner: true,
    40                 dateFormat: "dd.MM.yyyy"
     40                dateFormat: "dd.MM.yyyy",
     41                zoomLevel: 3
    4142            };
    4243           
     
    7273                }
    7374               
    74                 _map = L.map(_mapWrapper[0]).setView([0,0], 3);;
     75                _map = L.map(_mapWrapper[0]).setView([0,0], _mapOptions.zoomLevel);;
    7576                _map.on('popupopen', function(e) {
    7677                    var px = _map.project(e.popup._latlng);
     
    226227                        currentLine.bindPopup(feature.title);
    227228                        currentLine['tm_data'] = feature;
     229                        feature['_lf_object'] = currentLine;
    228230                        group.addLayer(currentLine);
    229                         feature['_lf_object'] = currentLine;
    230231                        currentLine = L.geodesicPolyline([],{color:lineColor});
    231232                        currentLine.addLatLng([feature.lat, feature.lng]); //add as starting point
     
    237238                            }
    238239                        }
     240                    } else if(feature.type === 'startendsection') {
     241                        currentLine.addLatLng([feature.lat, feature.lng]);
     242                        currentLine.bindPopup(feature.title);
     243                        currentLine['tm_data'] = feature;
     244                        group.addLayer(currentLine);
     245                        feature['_lf_object'] = currentLine;
     246                        currentLine = L.geodesicPolyline([],{color:lineColor});
     247                        currentLine.on('mouseover', function(evt) {
     248                            evt.target.setStyle({opacity: 1});
     249                        });
     250                        currentLine.on('mouseout', function(evt) {
     251                            evt.target.setStyle({opacity: 0.5});
     252                        });
     253                        currentLine.on('popupopen', function(evt) {
     254                            evt.target.setStyle({opacity: 1});
     255                        });
     256                        currentLine.on('popupclose', function(evt) {
     257                            evt.target.setStyle({opacity: 0.5});
     258                        });
     259                        currentLine.addLatLng([feature.lat, feature.lng]); //add as starting point
     260                        var nextPoint = _findNextWaypointMarker(data,i+1);
     261                        if(nextPoint) {
     262                            if(nextPoint.arrival && nextPoint.arrival >= new Date().getTime()) {
     263                                isInFuture = true;
     264                            }
     265                        }
    239266                    }
    240267                   
     
    249276            function _findStartSection(data, start) {
    250277                for(var i = start; i >= 0; i--) {
    251                     if(data[i].type === 'startsection') {
     278                    if(data[i].type === 'startsection' || data[i].type === 'startendsection') {
     279                        return data[i];
     280                    }
     281                }
     282                return null;
     283            }
     284
     285            function _findEndSection(data, start) {
     286                for(var i = start; i < data.length; i++) {
     287                    if(data[i].type === 'startendsection' || data[i].type === 'endsection') {
    252288                        return data[i];
    253289                    }
     
    258294            function _findNextWaypointMarker(data, start) {
    259295                for(var i = start; i < data.length; i++) {
    260                     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) {
     296                    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) {
    261297                        return data[i];
    262298                    }
     
    278314                            markerLayer.addLayer(wp);
    279315                        }
    280                     } else if(feature.type === 'startsection' || feature.type === 'endsection') {
     316                    } else if(feature.type === 'startsection' || feature.type === 'endsection' || feature.type === 'startendsection') {
    281317                        var wp = L.circleMarker([feature.lat, feature.lng], {radius: 5, fillOpacity:1, color:lineColor});
    282318                        if(feature.title) {
     
    317353                }
    318354                var dateInfo = '<span>';
    319                 if(feature.type === 'endsection') {
    320                     var start = _findStartSection(data, position);
    321                     if(start && start.arrival) {
     355                if(feature.type === 'endsection' || feature.type === 'startendsection') {
     356                    var start = _findStartSection(data, position-1);
     357                    if(start && start.departure) {
     358                        dateInfo += "Start: " + $.format.date(start.departure, _mapOptions.dateFormat) + ' | ';
     359                    } else if(start && start.arrival) {
    322360                        dateInfo += "Start: " + $.format.date(start.arrival, _mapOptions.dateFormat) + ' | ';
    323361                    }
    324                     if(feature.departure) {
     362                    if(feature.arrival) {
     363                        dateInfo += "End: " + $.format.date(feature.arrival, _mapOptions.dateFormat) + ' | ';
     364                    } else if(feature.departure) {
    325365                        dateInfo += "End: " + $.format.date(feature.departure, _mapOptions.dateFormat) + ' | ';
    326366                    }
    327 
    328367                } else {
    329368                    if(feature.date) {
  • wp-travelermap/trunk/frontend/travelermap-frontend.php

    r940307 r940336  
    3939        "id"      => '',
    4040        "connectmaps" => 'false',
    41         'spinner' => 'true'
     41        'spinner' => 'true',
     42        'zoomlevel' => '3'
    4243    ), $atts ) );
    4344   
     
    7273    $output .= "$('#tm_map_$map_id')";
    7374    $output .= ",";
    74     $output .= "{connectMaps:$connectmaps, height:$height, spinner:$spinner, dateFormat:'$dateFormat'}";
     75    $output .= "{connectMaps:$connectmaps, height:$height, spinner:$spinner, dateFormat:'$dateFormat', zoomLevel:$zoomlevel}";
    7576    $output .= ');';
    7677    $output .= '});';
  • wp-travelermap/trunk/media/tm-admin.css

    r940307 r940336  
    104104}
    105105
     106ul#tm_pointlist > li.startendsection {
     107    border: 1px solid #000;
     108}
     109
    106110ul#tm_pointlist > li.startsection > i:before {
    107111    content: "\f105";
     
    110114ul#tm_pointlist > li.endsection > i:before {
    111115    content: "\f104";
     116}
     117
     118ul#tm_pointlist > li.startendsection > i:before {
     119    content: "\f101";
    112120}
    113121
  • wp-travelermap/trunk/readme.txt

    r940307 r940336  
    44Tags: travel, map, waypoints
    55Requires at least: 3.9.0
    6 Tested up to: 3.9.0
    7 Stable tag: 1.1.0
     6Tested up to: 3.9.1
     7Stable tag: 1.2.0
    88License: MIT
    99License URI: http://opensource.org/licenses/MIT
     
    1313== Description ==
    1414
    15 This Pluigin allow the creation of travel maps with routes and point of interests.
     15This plugin allows the creation of travel maps with routes and point of interests.
    1616The points or route section can be linked with posts or media attachments.
    1717
     
    2020Additional parameters for the shortcode are: connectmaps="true|false" to connect the maps in the order
    2121specified in the comma separated id list and spinner="true|false" to disable the spinner to navigate
    22 through markers.
     22through markers, zoomlevel="0-16" to set the initial zoom level (0 min, 16 max level)
    2323
    2424example:
     
    5151
    5252== Changelog ==
     53
     54= 1.2.0 =
     55* added zoomlevel to shortcode to set initial zoom level
     56* added startendsection marker type to create consecutive sections
     57* fixed some bugs
    5358
    5459= 1.1.0 =
  • wp-travelermap/trunk/wp-travelermap.php

    r940307 r940336  
    44Plugin URI: http://bitschubser.org/projects/wp-travelermap
    55Description: A simple Plugin to create travel routes and manage maps
    6 Version: 1.1.0
     6Version: 1.2.0
    77Author: Mathis Zeiher
    88Author URI: http://bitschubser.org/
     
    3232
    3333if ( ! defined( 'TM_VERSION' ) )   
    34     define( 'TM_VERSION', '1.1.0' );
     34    define( 'TM_VERSION', '1.2.0' );
    3535   
    3636if ( ! defined( 'TM_URL' ) )
Note: See TracChangeset for help on using the changeset viewer.