Changeset 955 for trunk/templates

Show
Ignore:
Timestamp:
03/20/07 12:10:39 (20 months ago)
Author:
kake
Message:

Fix "Link to this page" on index maps to remember the map type and the thing it's indexing (ticket #190).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/templates/map_index.tt

    r872 r955  
    1 [% INCLUDE header.tt page_title = "Map of all nodes" %] 
     1[% INCLUDE header.tt page_title = criterion.name || "Map of all nodes" %] 
    22[% INCLUDE banner.tt %] 
    33<div id="content"> 
     
    3030      map.addControl(new GMapTypeControl()); 
    3131      map.centerAndZoom(new GPoint([% IF long %][% long %][% ELSE %][% centre_long %][% END %],[% IF lat %][% lat %][% ELSE %][% centre_lat %][% END %]), [% IF zoom %][% zoom %][% ELSE %][% default_gmaps_zoom %][% END %]); 
     32      [% IF map_type == "satellite" %] 
     33        map.setMapType( G_SATELLITE_TYPE ); 
     34      [% ELSIF map_type == "hybrid" %] 
     35        map.setMapType( G_HYBRID_TYPE ); 
     36      [% END %] 
    3237 
    3338      [% i = 0 %] 
     
    5055        [% END %] 
    5156      [% END %] 
    52       function map_recenter() { 
     57      function map_change() { 
    5358        var center = map.getCenterLatLng(); 
    5459        var link = document.getElementById('permalink'); 
    5560        var zoom = map.getZoomLevel(); 
    56         link.href = "?action=index;format=map;long="+center.x+";lat="+center.y+";zoom="+zoom; 
     61        var type = map.getCurrentMapType(); 
     62        var map_type; 
     63        if ( type == G_SATELLITE_TYPE ) { 
     64          map_type = "satellite"; 
     65        } else if ( type == G_HYBRID_TYPE ) { 
     66          map_type = "hybrid"; 
     67        } else { 
     68          map_type = ""; 
    5769      } 
    58       GEvent.addListener(map, "moveend", map_recenter ); 
     70      link.href = "?action=index;format=map;long="+center.x+";lat="+center.y+";zoom="+zoom+";map_type="+map_type[% IF criterion.type %][% IF criterion.value %]+";index_type="+encodeURIComponent("[% criterion.type %]")+";index_value="+encodeURIComponent("[% criterion.value %]")[% END %][% END %]; 
     71      } 
     72      GEvent.addListener(map, "moveend", map_change ); 
     73      GEvent.addListener(map, "maptypechanged", map_change ); 
    5974    //]]> 
    6075  </script>