Maps API key

This commit is contained in:
Juan 2018-08-31 08:14:47 +02:00
parent 03dd6f94e4
commit c77373e772
3 changed files with 55 additions and 62 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.406.18) stable; urgency=low
hedera-web (1.406.19) stable; urgency=low
* Initial Release.

View File

@ -1,116 +1,109 @@
var gmapsIsLoaded = false;
Hedera.Location = new Class
({
Hedera.Location = new Class({
Extends: Hedera.Form
,locations: null
,activate: function ()
{
this.gui.loaderPush ();
,activate: function() {
this.gui.loaderPush();
var sql = 'SELECT lat, lng, title, address, postcode, city, province, phone, language FROM location';
this.conn.execQuery (sql, this.onLocationsDone.bind (this));
this.conn.execQuery(sql, this.onLocationsDone.bind(this));
if (!gmapsIsLoaded)
{
gmapsLoadedCallback = this.gmapsLoaded.bind (this);
Vn.includeJs ('https://maps.google.com/maps/api/js'+
'?sensor=false&callback=gmapsLoadedCallback', null, true);
}
else
this.gmapsLoaded ();
if (!gmapsIsLoaded) {
gmapsLoadedCallback = this.gmapsLoaded.bind(this);
Vn.includeJs('https://maps.google.com/maps/api/js'
+'?sensor=false&callback=gmapsLoadedCallback'
+'&key=AIzaSyBbunFsAFEkjtw-c7BUHNgkThSlKEKFxiE',
null, true
);
} else
this.gmapsLoaded();
}
,onLocationsDone: function (resultSet)
{
this.locations = resultSet.fetchResult ();
this.allLoaded ();
,onLocationsDone: function(resultSet) {
this.locations = resultSet.fetchResult();
this.allLoaded();
}
,gmapsLoaded: function ()
{
this.gui.loaderPop ();
,gmapsLoaded: function() {
this.gui.loaderPop();
gmapsIsLoaded = true;
this.allLoaded ();
this.allLoaded();
}
,allLoaded: function ()
{
,allLoaded: function() {
if (!this.locations || !gmapsIsLoaded)
return;
var options = {
zoom: 4
,mapTypeId: google.maps.MapTypeId.ROADMAP
,center: new google.maps.LatLng (46.0, 4.0)
,center: new google.maps.LatLng(46.0, 4.0)
};
var div = this.$('form');
var gmap = new google.maps.Map (div, options);
var gmap = new google.maps.Map(div, options);
if (this.locations)
while (this.locations.next ())
this.createMarker (this.locations, gmap);
while (this.locations.next())
this.createMarker(this.locations, gmap);
}
,createMarker: function (location, gmap)
{
var div = document.createElement ('div');
,createMarker: function(location, gmap) {
var div = document.createElement('div');
div.className = 'marker';
var h = document.createElement ('h3');
h.appendChild (document.createTextNode (location.get ('title')));
div.appendChild (h);
var h = document.createElement('h3');
h.appendChild(document.createTextNode(location.get('title')));
div.appendChild(h);
var p = document.createElement ('p');
p.appendChild (document.createTextNode (location.get ('address')));
div.appendChild (p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('address')));
div.appendChild(p);
var p = document.createElement ('p');
p.appendChild (document.createTextNode (location.get ('postcode') +' '+ location.get ('city')));
div.appendChild (p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('postcode') +' '+ location.get('city')));
div.appendChild(p);
var p = document.createElement ('p');
p.appendChild (document.createTextNode (location.get ('province')));
div.appendChild (p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('province')));
div.appendChild(p);
var p = document.createElement ('p');
p.appendChild (document.createTextNode (location.get ('phone')));
div.appendChild (p);
var p = document.createElement('p');
p.appendChild(document.createTextNode(location.get('phone')));
div.appendChild(p);
var lat = new google.maps.LatLng (
location.get ('lat'),
location.get ('lng')
var lat = new google.maps.LatLng(
location.get('lat'),
location.get('lng')
);
var marker = new google.maps.Marker ({
var marker = new google.maps.Marker({
position: lat
,tilte: location.title
,map: gmap
});
var infoWindow = new google.maps.InfoWindow ({
var infoWindow = new google.maps.InfoWindow({
content: div
});
google.maps.event.addListener (marker, 'click',
this.openInfoWindow.bind (this, infoWindow, gmap, marker));
google.maps.event.addListener(marker, 'click',
this.openInfoWindow.bind(this, infoWindow, gmap, marker));
if (Vn.Locale.language
&& Vn.Locale.language == location.get ('language'))
this.openInfoWindow (infoWindow, gmap, marker);
&& Vn.Locale.language == location.get('language'))
this.openInfoWindow(infoWindow, gmap, marker);
}
,openInfoWindow: function (infoWindow, gmap, marker)
{
,openInfoWindow: function(infoWindow, gmap, marker) {
if (this.openedWindow)
this.openedWindow.close ();
this.openedWindow.close();
infoWindow.open (gmap, marker);
infoWindow.open(gmap, marker);
this.openedWindow = infoWindow;
}
});

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.406.18",
"version": "1.406.19",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {