Changeset 841

Show
Ignore:
Timestamp:
08/29/08 04:42:32 (3 months ago)
Author:
ayunyan
Message:

plugin:googlemaps added map parameters (_size, _markers, _controls)

Location:
plugins/googlemaps/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/googlemaps/trunk/googlemaps.plugin.php

    r811 r841  
    2828            'license' => 'Apache License 2.0', 
    2929            'description' => 'easily/quickly insert Google Maps into your posts.', 
     30            'guid' => '14c8414f-6cdf-11dd-b14a-001b210f913f' 
    3031            ); 
    3132    } 
     
    7475    public function action_update_check() 
    7576    { 
    76         Update::add('Google Maps', '14c8414f-6cdf-11dd-b14a-001b210f913f', $this->info->version); 
     77        Update::add('Google Maps', $this->info->guid, $this->info->version); 
    7778    } 
    7879 
  • plugins/googlemaps/trunk/js/googlemaps.js

    r811 r841  
    4545            } 
    4646 
     47            var width = 0; 
     48            var height = 0; 
     49            var _size_r = query.match(/(\?|&|&)_size=(\d+)x(\d+)/); 
     50            if (_size_r) { 
     51                width = _size_r[2]; 
     52                height = _size_r[3]; 
     53            } 
     54 
     55            var controls = ''; 
     56            var _controls_r = query.match(/(\?|&|&)_controls=(none)/); 
     57            if (_controls_r) { 
     58                controls = _controls_r[2]; 
     59            } 
     60 
     61            var markers = []; 
     62            var _markers_r = query.match(/(\?|&|&)_markers=([\d\-\.\,\|]+)/); 
     63            if (_markers_r) { 
     64                $.each(_markers_r[2].split('|'), function(k, marker) { 
     65                    marker = marker.split(','); 
     66                    markers.push(new google.maps.LatLng(marker[0], marker[1])); 
     67                }); 
     68            } 
     69 
    4770            canvas = $('<div class="googlemaps-canvas"></div>'); 
    4871            $(this).replaceWith(canvas); 
    4972 
    5073            if (layer == 'c') { 
    51                 canvas.width(habari_googlemaps.streetview_width); 
    52                 canvas.height(habari_googlemaps.streetview_height); 
     74                if (width == 0 || height == 0) { 
     75                    width = habari_googlemaps.streetview_width; 
     76                    height = habari_googlemaps.streetview_height; 
     77                } 
     78                canvas.width(width); 
     79                canvas.height(height); 
    5380                var pov = { yaw: cbp[1], pitch: cbp[4], zoom: cbp[3] }; 
    5481                options = { latlng: new google.maps.LatLng(cblat, cblng), pov: pov }; 
     
    6188                }); 
    6289            } else { 
    63                 map = new google.maps.Map2(canvas.get(0), {size: new GSize(habari_googlemaps.map_width, habari_googlemaps.map_height)}); 
    64                 map.addControl(new google.maps.MapTypeControl()); 
    65                 map.addControl(new google.maps.LargeMapControl()); 
     90                if (width == 0 || height == 0) { 
     91                    width = habari_googlemaps.map_width; 
     92                    height = habari_googlemaps.map_height; 
     93                } 
     94                map = new google.maps.Map2(canvas.get(0), {size: new GSize(width, height)}); 
     95                if (controls != 'none') { 
     96                    map.addControl(new google.maps.MapTypeControl()); 
     97                    map.addControl(new google.maps.LargeMapControl()); 
     98                } 
    6699                map.enableScrollWheelZoom(); 
    67100                map.enableContinuousZoom(); 
     
    74107                    map.setMapType(G_NORMAL_MAP); 
    75108                } 
     109 
     110                $.each(markers, function(k, marker) { 
     111                    map.addOverlay(new google.maps.Marker(marker)); 
     112                }); 
    76113            } 
    77114        });