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

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

rv_gmaps co;patible with piwigo trunk (future 2.2)

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