source: extensions/rv_gmaps/trunk/template/map.tpl @ 8220

Last change on this file since 8220 was 8220, checked in by rvelices, 13 years ago

rv_gmaps internal - prepare migration to api V3

  • Property svn:eol-style set to LF
File size: 8.5 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
3<head>
4<meta http-equiv="content-type" content="text/html; charset={$CONTENT_ENCODING}" />
5<meta name="robots" content="noindex,nofollow" />
6<title>{$GALLERY_TITLE}</title>
7<link rel="stylesheet" type="text/css" href="{$PLUGIN_ROOT_URL}/template/style.css?v={$RVM_PLUGIN_VERSION}" />
8<!--[if IE]>
9<style type="text/css">
10v\:* {ldelim}
11  behavior:url(#default#VML);
12}
13</style>
14<![endif]-->
15<!--[if lt IE 7]>
16<style type="text/css">
17        #map {ldelim} position:auto; height: 100%; }
18</style>
19<![endif]-->
20
21<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$GMAPS_API_KEY}&amp;hl={$lang_info.code}" type="text/javascript"></script>
22
23<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
24<script type="text/javascript">jQuery.noConflict();</script>
25<script src="{$PLUGIN_ROOT_URL}/template/nyroModal/jquery.nyroModal-1.6.2.js" type="text/javascript"></script>
26<link href="{$PLUGIN_ROOT_URL}/template/nyroModal/nyroModal.css" rel="stylesheet" type="text/css">
27
28<script src="{$PLUGIN_ROOT_URL}/template/data_loader.js?v={$RVM_PLUGIN_VERSION}" type="text/javascript"></script>
29<script src="{$PLUGIN_ROOT_URL}/template/data_handler.js?v={$RVM_PLUGIN_VERSION}" type="text/javascript"></script>
30<script src="{$PLUGIN_ROOT_URL}/template/page_linker.js?v={$RVM_PLUGIN_VERSION}" type="text/javascript"></script>
31
32<script src="{$ROOT_URL}themes/default/js/scripts.js" type="text/javascript"></script>
33
34<script type="text/javascript">{literal}
35//<![CDATA[
36var map;
37var geocoder;
38
39document.is_debug = false;
40if ( document.location.search.match(/[\?&]debug/) ) {
41        document.is_debug = true;
42        document._window = window;
43}
44 
45function load()
46{
47        if (!GBrowserIsCompatible())
48        return;
49
50        var mapElement = document.getElementById("map");
51        map = new google.maps.Map2( mapElement );
52
53        map.addMapType( G_PHYSICAL_MAP );
54        map.addControl(new google.maps.LargeMapControl3D());
55        map.addControl(new google.maps.HierarchicalMapTypeControl());
56        map.addControl(new google.maps.ScaleControl());
57
58        pwgPageLinker = new PageLinker(map, "aLinkToThisPage" );
59        if ( !map.isLoaded() )
60        {
61{/literal}
62                {if isset($initial_bounds)}
63                var bounds = new google.maps.LatLngBounds( new google.maps.LatLng({$initial_bounds.s},{$initial_bounds.w}), new google.maps.LatLng({$initial_bounds.n},{$initial_bounds.e}) );
64                map.setCenter( bounds.getCenter(), map.getBoundsZoomLevel( bounds ) );
65                {/if}
66{literal}
67                if ( !map.isLoaded() )
68                        map.setCenter( new google.maps.LatLng(0,0), 2 );
69        }
70
71        try {
72                // the overview must be added after setting map center
73                var ovcontrol = new google.maps.OverviewMapControl(new google.maps.Size(165,165));
74                map.addControl(ovcontrol);
75        }
76        catch(e){ alert( e.message ); }
77
78        map.enableScrollWheelZoom();
79        map.enableDoubleClickZoom();
80
81        var pwgMarkerIcon = (function(){ {/literal}{$MAP_MARKER_ICON_JS}{literal} }).call(null);
82
83        map.pwgDataLoader = new PwgDataLoader(map, {rectangle_of_confusion: pwgMarkerIcon.iconSize} );
84        google.maps.Event.addListener(map.pwgDataLoader, "dataloading", function() {
85                var pre = '<img src="{/literal}{$PLUGIN_ROOT_URL}{literal}/icons/progress_s.gif" width="16" height="16" alt="~" /> ';
86                document.getElementById("dataLoadStatus").innerHTML = pre + Localization.get("Loading");
87                }
88        );
89 
90        google.maps.Event.addListener(map.pwgDataLoader, "dataloadfailed", function(responseCode) {
91                document.getElementById("dataLoadStatus").innerHTML = Localization.get("Failed") + " "+responseCode;
92                }
93                );
94
95        map.pwgDataHandler = new PwgDataHandler(map, {icon: pwgMarkerIcon, show_all_img_src: "{/literal}{$PLUGIN_ROOT_URL}{literal}/icons/pic_s.gif" } );
96        google.maps.Event.addListener(map.pwgDataLoader, "dataloaded", pwgBind(map.pwgDataHandler, map.pwgDataHandler.handle) );
97
98        map.pwgDataLoader.start( "{/literal}{$U_MAP_DATA}{literal}" );
99
100        if (document.is_debug)
101        {
102                google.maps.Event.addListener(map, "moveend", function() { google.maps.Log.write("movend c:"+map.getCenter().toUrlValue());} );
103                google.maps.Event.addListener(map, "maptypechanged", function() { google.maps.Log.write("maptypechanged");} );
104                google.maps.Event.addListener(map, "infowindowopen", function() { google.maps.Log.write("infowindowopen");} );
105                google.maps.Event.addListener(map, "infowindowclose", function() { google.maps.Log.write("infowindowclose");} );
106        }
107}
108
109function unload()
110{
111        if (map)
112        {
113                !map.pwgDataLoader || map.pwgDataLoader.terminate();
114                !map.pwgDataHandler || map.pwgDataHandler.terminate();
115        }
116        GUnload();
117}
118
119function searchLocation(q)
120{
121        if (!q.length) return false;
122        if (!geocoder)
123                geocoder = new google.maps.ClientGeocoder();
124        geocoder.getLocations(q, function(resp)
125          {
126                if ( resp && resp.Status )
127                {
128                  document._geoResponse = resp;
129                  if (resp.Status.code==200)
130                  {
131                        var zoom = 2;
132                        switch (resp.Placemark[0].AddressDetails.Accuracy)
133                        {
134                          case 1: zoom=5; break; //country
135                          case 2: zoom=7; break; //region
136                          case 3: zoom=8; break; //county
137                          case 4: zoom=12; break; //town
138                          case 5: zoom=13; break; //post code
139                          case 6: zoom=14; break; //street
140                          case 7: case 8: zoom=16; break; //intersection/exact
141                        }
142                        map.setCenter( new google.maps.LatLng( resp.Placemark[0].Point.coordinates[1], resp.Placemark[0].Point.coordinates[0] ), zoom);
143                  }
144                  else
145                        alert("This address has not been found\nCode:"+resp.Status.code);
146                }
147          });
148        return false;
149}
150
151
152var Localization =
153{
154  _strings: {
155{/literal}
156"go to %s": "{'go to %s'|@translate|@escape:javascript}",
157"Next": "{'Next'|@translate|@escape:javascript}",
158"Prev": "{'Prev'|@translate|@escape:javascript}",
159"out of %d": "{'out of %d'|@translate|@escape:javascript}",
160"Loading": "{'Loading'|@translate|@escape:javascript}",
161"Failed": "{'Failed'|@translate|@escape:javascript}",
162"Show all": "{'Show all'|@translate|@escape:javascript}",
163"show all pictures around this location": "{'show all pictures around this location'|@translate|@escape:javascript}",
164"displays %s on a map" : "{'displays %s on a map'|@translate|@escape:javascript}",
165"opens %s in Google Earth" : "{'opens %s in Google Earth'|@translate|@escape:javascript}",
166"%d images" : "{'%d images'|@translate|@escape:javascript}",
167{literal}
168dontMindTheComma: ""
169    },
170
171  get: function( str ) {
172                var lang_str = this._strings[str];
173                if (lang_str == undefined)
174                {
175                        if (document.is_debug) google.maps.Log.write("Language string undefined '"+ str+"'");
176                        return str;
177                }
178                return lang_str;
179        },
180
181  getQ: function( str ) {
182                return '"'+this.get(str)+'"';
183        },
184
185  fmt1: function () {
186                var str = arguments[0];
187                str = this.get(str);
188                str = str.replace( '%s', "%" ).replace( '%d', "%" ).replace('%', arguments[1]);
189                return str;
190               
191        }
192}
193{/literal}
194//]]>
195</script>
196</head>
197
198<body onload="load()" onunload="unload()">
199
200<div id="titlebar">
201  <div class="titlebar_links" >
202    <span id="dataLoadStatus"></span>
203    <a id="aKml" href="" type="application/vnd.google-earth.kml+xml" class="gmnoprint"><img src="http://maps.google.com/mapfiles/ms/view_as_kml.png" width="16" height="16" alt="kml" /> <span>KML</span></a>
204    <a id="aLinkToThisPage" href="" class="gmnoprint"><img src="http://maps.google.com/mapfiles/bar_icon_link.gif" alt="&lt;-&gt;" width="16" height="16" /> <span>{'Link to this page'|@translate}</span></a>
205    <a id="aBlowup" href="" onclick="return PwgDataHandler.blowupUrl(this.href);" class="gmnoprint" title="{'show all pictures around this location'|@translate}">
206                        <img src="{$PLUGIN_ROOT_URL}/icons/pic_s.gif" alt="" title="{'show all pictures around this location'|@translate}" />
207                        <span>{'Show all'|@translate}</span>
208                </a>
209    <span class="gmnoprint">
210                        <form action="#" onsubmit="if (this.q.value!='' &amp;&amp; this.q.value!='{'Search a location...'|@translate|@escape:javascript}') searchLocation(this.q.value);return false;">
211                                <input type="text" size="32" name="q"
212                                        value="{'Search a location...'|@translate}"
213                                        onfocus="if (value=='{'Search a location...'|@translate|@escape:javascript}') value='';"
214                                        onblur="if (value=='') value='{'Search a location...'|@translate|@escape:javascript}'" />
215                                <input type="submit" value="{'Search'|@translate}"/>
216                        </form>
217                </span>
218  </div>
219  <div class="titlebar_title">
220    <a href="{$U_HOME}" title="{'return to homepage'|@translate}" class="gmnoprint">{'Home'|@translate}</a>
221    <a href="{$U_HOME_MAP}" title="{'displays all images on a map'|@translate}"><img src="{$PLUGIN_ROOT_URL}/icons/map_sw.gif" width="32" height="17" alt="map"/></a>
222    {'Viewing'|@translate}: <a id="aPageUrl" href=""></a>
223  </div>
224</div>
225
226<div id="map"> </div>
227</body>
228</html>
Note: See TracBrowser for help on using the repository browser.