Ignore:
Timestamp:
03/16/2006 05:30:30 AM (6 years ago)
Author:
cirrus
Message:

Added: Custom maps support. Ability to enable/disable map types (e.g. satellite, hybrid, etc.). Closes #100
Bugfix: Fixed foreach array error. Closes #98
Change: Gearth now uses title_small for the filename.
Change: Gearth default zoom location now calculated from the config file min/max lon/lat options.
Change: Suggest search minor javascript change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/templates/basic/includes/pages/gmap/gmap_js.tpl

    r131 r159  
    128128 
    129129{literal} 
     130 
     131function copy_obj(o) { 
     132        var c = new Object(); for (var e in o) { c[e] = o[e]; } return c; 
     133} 
     134 
    130135function gmap_onload() { 
    131136        ch_p2p = document.getElementsByName("p2p")[0]; 
     
    134139        ch_unlinked = document.getElementsByName("unlinked")[0]; 
    135140        if (GBrowserIsCompatible()) { 
    136                 map = new GMap(document.getElementById("map")); 
     141{/literal} 
     142{foreach from=$maps_available item=map_enabled key=map_name} 
     143        {if $map_enabled===true} 
     144                {if $map_types != null} 
     145                        {assign var=map_types value="`$map_types`,"} 
     146                {/if} 
     147                {assign var=map_types value="`$map_types` G_`$map_name`_TYPE"} 
     148        {/if} 
     149{/foreach} 
     150{foreach from=$maps_available.custom_maps item=custom_type} 
     151        {if $custom_type.coordinates_type == "map"} 
     152                G_CUSTOM_{$custom_type.name|upper}_TYPE = copy_obj(G_MAP_TYPE); 
     153        {elseif $custom_type.coordinates_type == "satellite"} 
     154                G_CUSTOM_{$custom_type.name|upper}_TYPE = copy_obj(G_SATELLITE_TYPE); 
     155        {/if} 
     156        G_CUSTOM_{$custom_type.name|upper}_TYPE.baseUrls = new Array(); 
     157        G_CUSTOM_{$custom_type.name|upper}_TYPE.baseUrls[0] = "{$custom_type.url}"; 
     158        G_CUSTOM_{$custom_type.name|upper}_TYPE.lowResBaseUrls = new Array(); 
     159        G_CUSTOM_{$custom_type.name|upper}_TYPE.lowResBaseUrls[0] = "{$custom_type.url}"; 
     160        {literal} 
     161                G_CUSTOM_{/literal}{$custom_type.name|upper}{literal}_TYPE.getLinkText = function() { return '{/literal}{$custom_type.name}{literal}'; } 
     162        {/literal} 
     163        {if $map_types != null} 
     164                        {assign var=map_types value="`$map_types`,"} 
     165         {/if} 
     166         {assign var=map_types value="`$map_types` G_CUSTOM_`$custom_type.name`_TYPE"} 
     167{/foreach} 
     168{literal} 
     169                var map_types = [{/literal}{$map_types|upper}{literal}]; 
     170                map = new GMap(document.getElementById("map"), map_types); 
     171 
     172                if(map_types.length > 1) 
     173                        map.addControl(new GMapTypeControl()); 
     174 
     175                map.setMapType(G_CUSTOM_{/literal}{$maps_available.default|upper}{literal}_TYPE); 
     176 
    137177                var center = new GPoint({/literal}{$center_longitude}{literal},  
    138178                                                                {/literal}{$center_latitude}{literal}); 
     
    148188                map.centerAndZoom(center, zoom); 
    149189                map.addControl(new GLargeMapControl()); 
    150                 map.setMapType(G_SATELLITE_TYPE); 
    151190                GEvent.addListener(map, "moveend", gmap_reload); 
    152191                GEvent.addListener(map, "zoom", 
Note: See TracChangeset for help on using the changeset viewer.