git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@46 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+2
-1
@@ -11,7 +11,8 @@ define(['jquery'], function ($) {
|
|||||||
$.mobile.buttonMarkup.hoverDelay = 0;
|
$.mobile.buttonMarkup.hoverDelay = 0;
|
||||||
// Remove page from DOM when it's being replaced
|
// Remove page from DOM when it's being replaced
|
||||||
$(document).on("pagecontainerhide", function (event, ui) {
|
$(document).on("pagecontainerhide", function (event, ui) {
|
||||||
$("div[data-role='page'][stay-in-page='false']:not(.ui-page-active)").remove();
|
ui.prevPage.remove();
|
||||||
|
//$("div[data-role='page'][stay-in-page='false']:not(.ui-page-active)").remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
var myManifest = {
|
var myManifest = {
|
||||||
Debug: (window.location.port !== ""),
|
Debug: (window.location.port !== ""),
|
||||||
Name: "Il Lievitario",
|
Name: "Il Lievitario",
|
||||||
Version: "2.9.3.0",
|
Version: "2.9.3.2",
|
||||||
Author: "Denis Ironi",
|
Author: "Denis Ironi",
|
||||||
Settings: {
|
Settings: {
|
||||||
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
|
DefaultURL: (window.location.port === "" ? "http://" + window.location.host + "/Service": "http://" + window.location.hostname + ":" + window.location.port + "/Service_Manut"),
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
//"click #goFbGroup": "goFbGroup"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
freeWall: null,
|
freeWall: null,
|
||||||
@@ -132,9 +131,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
|||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$( window ).on( "orientationchange", function( event ) {
|
|
||||||
});
|
|
||||||
|
|
||||||
self.setupFreeWall();
|
self.setupFreeWall();
|
||||||
|
|
||||||
if (Profile.data.picture !== null)
|
if (Profile.data.picture !== null)
|
||||||
@@ -143,8 +139,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/home/homeViewTemplate.
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.writeMessage(myManifest.Agent.ua);
|
Debug.writeMessage(myManifest.Agent.ua);
|
||||||
//if (window.localStorage.getItem("goFbGroup") !== "1")
|
|
||||||
// this.$el.find("#nuovoGruppo").popup("open");
|
|
||||||
},
|
},
|
||||||
onClosing: function () {
|
onClosing: function () {
|
||||||
if (this.freeWall !== null)
|
if (this.freeWall !== null)
|
||||||
|
|||||||
+53
-25
@@ -9,8 +9,13 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
template: _.template(mapsViewTemplate),
|
template: _.template(mapsViewTemplate),
|
||||||
infoWindowtemplate: _.template(infoWindowTemplate),
|
infoWindowtemplate: _.template(infoWindowTemplate),
|
||||||
defaultLatLng: new google.maps.LatLng(45.4654219, 9.1859243), // Default to Milan
|
defaultLatLng: new google.maps.LatLng(45.4654219, 9.1859243), // Default to Milan
|
||||||
|
iconPM: {
|
||||||
|
url: "http://app.gruppolapastamadre.it/icon.png",
|
||||||
|
scaledSize: new google.maps.Size(24, 24)
|
||||||
|
},
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.id = "MapsView";
|
this.id = "MapsView";
|
||||||
|
this.markers = [];
|
||||||
MapsView.__super__.initialize.call(this);
|
MapsView.__super__.initialize.call(this);
|
||||||
},
|
},
|
||||||
_centerControl: function(controlDiv, map) {
|
_centerControl: function(controlDiv, map) {
|
||||||
@@ -56,7 +61,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
_drawMap: function(LatLng){
|
_drawMap: function(LatLng){
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -75,7 +79,8 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
self.map = new google.maps.Map($("#map-canvas")[0], myOptions);
|
self.map = new google.maps.Map($("#map-canvas")[0], myOptions);
|
||||||
|
|
||||||
// Create the search box and link it to the UI element.
|
// Create the search box and link it to the UI element.
|
||||||
var input = $("#pac-input")[0];
|
var input = $('<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">')[0];
|
||||||
|
self.$el.find('div[data-role="content"]')[0].appendChild(input);
|
||||||
var searchBox = new google.maps.places.SearchBox(input);
|
var searchBox = new google.maps.places.SearchBox(input);
|
||||||
self.map.controls[google.maps.ControlPosition.TOP_CENTER].push(input);
|
self.map.controls[google.maps.ControlPosition.TOP_CENTER].push(input);
|
||||||
var centerControlDiv = document.createElement('div');
|
var centerControlDiv = document.createElement('div');
|
||||||
@@ -129,11 +134,6 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
self.map.fitBounds(bounds);
|
self.map.fitBounds(bounds);
|
||||||
});
|
});
|
||||||
|
|
||||||
var iconPM = {
|
|
||||||
url: "http://app.gruppolapastamadre.it/icon.png",
|
|
||||||
scaledSize: new google.maps.Size(24, 24)
|
|
||||||
};
|
|
||||||
|
|
||||||
self.map.addListener('bounds_changed', function() {
|
self.map.addListener('bounds_changed', function() {
|
||||||
var bound = self.map.getBounds();
|
var bound = self.map.getBounds();
|
||||||
searchBox.setBounds(bound);
|
searchBox.setBounds(bound);
|
||||||
@@ -144,26 +144,18 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
//dataType: "json",
|
//dataType: "json",
|
||||||
//async: false,
|
//async: false,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
success: function (resp) {
|
success: function (resp) {
|
||||||
resp.forEach(function(ele, index){
|
resp.forEach(function(ele, index){
|
||||||
if(!self.markers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"])
|
var key = "|" + ele.Latitudine+ "|" + ele.Longitudine+ "|";
|
||||||
|
if(!self.markers[key])
|
||||||
{
|
{
|
||||||
var marker = new google.maps.Marker({
|
self._makeMarker(ele, key);
|
||||||
position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine),
|
}
|
||||||
icon: iconPM,
|
else if(!self.markers[key][ele.ID])
|
||||||
//label: ele.Name,
|
{
|
||||||
title: ele.Name,
|
ele.Latitudine = parseFloat(ele.Latitudine) + (Math.random() / 500);
|
||||||
map: self.map
|
ele.Longitudine = parseFloat(ele.Longitudine) + (Math.random() / 500);
|
||||||
});
|
self._makeMarker(ele, key);
|
||||||
self.markers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"] = marker;
|
|
||||||
|
|
||||||
var infowindow = new google.maps.InfoWindow({
|
|
||||||
content: self.infoWindowtemplate({item: ele})
|
|
||||||
});
|
|
||||||
|
|
||||||
marker.addListener('click', function() {
|
|
||||||
infowindow.open(self.map, marker);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -171,7 +163,33 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
});
|
});
|
||||||
$("#pac-input").show();
|
$("#pac-input").show();
|
||||||
},
|
},
|
||||||
|
_makeMarker: function(ele,key){
|
||||||
|
var self = this;
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine),
|
||||||
|
icon: self.iconPM,
|
||||||
|
//label: ele.Name,
|
||||||
|
title: ele.Name,
|
||||||
|
map: self.map
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!self.markers[key])
|
||||||
|
self.markers[key] = [];
|
||||||
|
|
||||||
|
self.markers[key][ele.ID] = marker;
|
||||||
|
|
||||||
|
var infowindow = new google.maps.InfoWindow({
|
||||||
|
content: self.infoWindowtemplate({item: ele})
|
||||||
|
});
|
||||||
|
|
||||||
|
marker.addListener('click', function() {
|
||||||
|
infowindow.open(self.map, marker);
|
||||||
|
});
|
||||||
|
},
|
||||||
onShowed: function(){
|
onShowed: function(){
|
||||||
|
if(this.map)
|
||||||
|
return;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$( window ).resize( function(){
|
$( window ).resize( function(){
|
||||||
@@ -193,6 +211,16 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
|
|||||||
self._drawMap(self.defaultLatLng); // No geolocation support, show default map
|
self._drawMap(self.defaultLatLng); // No geolocation support, show default map
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onClosing: function(){
|
||||||
|
var self = this;
|
||||||
|
Object.keys(self.markers).forEach(function(key, i){
|
||||||
|
Object.keys(self.markers[key]).forEach(function(ID, k){
|
||||||
|
self.markers[key][ID].setMap(null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
self.markers = [];
|
||||||
|
},
|
||||||
//render the content into div of view
|
//render the content into div of view
|
||||||
render: function () {
|
render: function () {
|
||||||
if (this.created === true)
|
if (this.created === true)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
<div id="searchPanel">
|
<div id="searchPanel">
|
||||||
<h3>Mappa Spacciatori</h3>
|
<h3>Mappa Spacciatori</h3>
|
||||||
</div>
|
</div>
|
||||||
<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">
|
|
||||||
<div id="map-canvas">
|
<div id="map-canvas">
|
||||||
<!-- map loads here... -->
|
<!-- map loads here... -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
|||||||
Profile.data.dataSpacc.cap === "" ||
|
Profile.data.dataSpacc.cap === "" ||
|
||||||
Profile.data.dataSpacc.tipopm === "")
|
Profile.data.dataSpacc.tipopm === "")
|
||||||
{
|
{
|
||||||
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> devono essere settate tutte i campi</center>");
|
self.$el.find('#titlePopup').html("Campi obbligatori");
|
||||||
|
this.$el.find('#messaggio').html("<center><h1 style='color: red;'>ATTENZIONE</h1> devono essere settate tutte i campi</center>");
|
||||||
this.$el.find('#popupDialog').popup("open");
|
this.$el.find('#popupDialog').popup("open");
|
||||||
self._flagSave = false;
|
self._flagSave = false;
|
||||||
return;
|
return;
|
||||||
@@ -54,7 +55,8 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
|||||||
|
|
||||||
if(Profile.data.dataSpacc.privacy==="0")
|
if(Profile.data.dataSpacc.privacy==="0")
|
||||||
{
|
{
|
||||||
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> per proseguire si DEVE accettare l'informativa privacy</center>");
|
self.$el.find('#titlePopup').html("Informativa privacy");
|
||||||
|
this.$el.find('#messaggio').html("<center><h1 style='color: red;'>ATTENZIONE</h1> per proseguire è obbligatorio accettare l'informativa privacy</center>");
|
||||||
this.$el.find('#popupDialog').popup("open");
|
this.$el.find('#popupDialog').popup("open");
|
||||||
self._flagSave = false;
|
self._flagSave = false;
|
||||||
return;
|
return;
|
||||||
@@ -72,8 +74,10 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
|||||||
Profile.data.dataSpacc.lat = response.results[0].geometry.location.lat;
|
Profile.data.dataSpacc.lat = response.results[0].geometry.location.lat;
|
||||||
Profile.data.dataSpacc.long = response.results[0].geometry.location.lng;
|
Profile.data.dataSpacc.long = response.results[0].geometry.location.lng;
|
||||||
Profile.updateProfile(function(){
|
Profile.updateProfile(function(){
|
||||||
self._flagSave = false;
|
self._flagSave = false;
|
||||||
Backbone.history.loadUrl(Backbone.history.getFragment());
|
self.$el.find('#titlePopup').html("Salvataggio");
|
||||||
|
self.$el.find('#messaggio').html("Impostazioni salvate con successo");
|
||||||
|
self.$el.find('#popupDialog').popup("open");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -83,7 +87,10 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
|
|||||||
{
|
{
|
||||||
Profile.updateProfile(function(){
|
Profile.updateProfile(function(){
|
||||||
self._flagSave = false;
|
self._flagSave = false;
|
||||||
Backbone.history.loadUrl(Backbone.history.getFragment());
|
self.$el.find('#titlePopup').html("Salvataggio");
|
||||||
|
self.$el.find('#messaggio').html("Impostazioni salvate con successo");
|
||||||
|
self.$el.find('#popupDialog').popup("open");
|
||||||
|
//Backbone.history.loadUrl(Backbone.history.getFragment());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ segnalazione inoltrata.</label>
|
|||||||
</div>
|
</div>
|
||||||
<div data-role="popup" id="popupDialog">
|
<div data-role="popup" id="popupDialog">
|
||||||
<div data-role="header">
|
<div data-role="header">
|
||||||
<h1>Avvertimento</h1>
|
<h3 id="titlePopup"></h3>
|
||||||
</div>
|
</div>
|
||||||
<div role="main" class="ui-content">
|
<div role="main" class="ui-content">
|
||||||
<p id="messaggio" style="text-align: center;font-style: italic;">
|
<p id="messaggio" style="text-align: center;font-style: italic;">
|
||||||
|
|||||||
@@ -0,0 +1,235 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Mappa Spacciatori</title>
|
||||||
|
<meta charset="ISO-8859-1" />
|
||||||
|
<meta name="google" value="notranslate" />
|
||||||
|
<meta http-equiv="expires" content="0">
|
||||||
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="format-detection" content="telephone=no">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"/>
|
||||||
|
<meta http-equiv="Access-Control-Allow-Origin" content="*"/>
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||||
|
<script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
.controls {
|
||||||
|
margin-top: 10px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 2px 0 0 2px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
height: 32px;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
#pac-input {
|
||||||
|
background-color: #fff;
|
||||||
|
font-family: Roboto;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 300;
|
||||||
|
margin-left: 12px;
|
||||||
|
padding: 0 11px 0 13px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
#pac-input:focus {
|
||||||
|
border-color: #4d90fe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pac-container {
|
||||||
|
font-family: Roboto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
var map = undefined;
|
||||||
|
|
||||||
|
var defaultLatLng = new google.maps.LatLng(45.4654219, 9.1859243); // Default to Milan
|
||||||
|
var myMakers = [];
|
||||||
|
function _centerControl(controlDiv, map) {
|
||||||
|
var self = this;
|
||||||
|
// Set CSS for the control border.
|
||||||
|
var controlUI = document.createElement('div');
|
||||||
|
controlUI.style.backgroundColor = '#fff';
|
||||||
|
controlUI.style.border = '2px solid #fff';
|
||||||
|
controlUI.style.borderRadius = '3px';
|
||||||
|
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
|
||||||
|
controlUI.style.cursor = 'pointer';
|
||||||
|
controlUI.style.marginTop = '10px';
|
||||||
|
controlUI.style.marginLeft = '15px';
|
||||||
|
controlUI.style.textAlign = 'center';
|
||||||
|
controlUI.title = 'Click to recenter the map';
|
||||||
|
controlDiv.appendChild(controlUI);
|
||||||
|
|
||||||
|
// Set CSS for the control interior.
|
||||||
|
var controlText = document.createElement('div');
|
||||||
|
controlText.style.color = 'rgb(25,25,25)';
|
||||||
|
controlText.style.fontFamily = 'Roboto,Arial,sans-serif';
|
||||||
|
controlText.style.fontSize = '16px';
|
||||||
|
//controlText.style.lineHeight = '32px';
|
||||||
|
controlText.style.padding = '4px';
|
||||||
|
// controlText.style.paddingRight = '5px';
|
||||||
|
controlText.innerHTML = 'Mia Posizione';
|
||||||
|
controlUI.appendChild(controlText);
|
||||||
|
|
||||||
|
// Setup the click event listeners: simply set the map to Chicago.
|
||||||
|
controlUI.addEventListener('click', function() {
|
||||||
|
if ( navigator.geolocation ) {
|
||||||
|
function success(pos) {
|
||||||
|
// Location found, show map with these coordinates
|
||||||
|
map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
|
||||||
|
}
|
||||||
|
function fail(error) {
|
||||||
|
map.setCenter(defaultLatLng); // Failed to find location, show default map
|
||||||
|
}
|
||||||
|
// Find the users current position. Cache the location for 5 minutes, timeout after 6 seconds
|
||||||
|
navigator.geolocation.getCurrentPosition(success, fail, {maximumAge: 500000, enableHighAccuracy:true, timeout: 6000});
|
||||||
|
} else {
|
||||||
|
map.setCenter(defaultLatLng); // Failed to find location, show default map
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
function _drawMap(LatLng){
|
||||||
|
var myOptions = {
|
||||||
|
zoom: 10,
|
||||||
|
center: LatLng,
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
|
streetViewControl: false,
|
||||||
|
mapTypeControl: false,
|
||||||
|
zoomControlOptions: {
|
||||||
|
position: google.maps.ControlPosition.RIGHT_CENTER
|
||||||
|
},
|
||||||
|
};
|
||||||
|
$("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
||||||
|
$("#map-canvas").height(document.documentElement.clientHeight - 151 - $('#searchPanel').height());
|
||||||
|
map = new google.maps.Map($("#map-canvas")[0], myOptions);
|
||||||
|
|
||||||
|
// Create the search box and link it to the UI element.
|
||||||
|
var input = $("#pac-input")[0];
|
||||||
|
var searchBox = new google.maps.places.SearchBox(input);
|
||||||
|
self.map.controls[google.maps.ControlPosition.TOP_CENTER].push(input);
|
||||||
|
var centerControlDiv = document.createElement('div');
|
||||||
|
var centerControl = self._centerControl(centerControlDiv, self.map);
|
||||||
|
|
||||||
|
//centerControlDiv.index = 4;
|
||||||
|
map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(centerControlDiv);
|
||||||
|
var markers = [];
|
||||||
|
// [START region_getplaces]
|
||||||
|
// Listen for the event fired when the user selects a prediction and retrieve
|
||||||
|
// more details for that place.
|
||||||
|
searchBox.addListener('places_changed', function() {
|
||||||
|
var places = searchBox.getPlaces();
|
||||||
|
|
||||||
|
if (places.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear out the old markers.
|
||||||
|
markers.forEach(function(marker) {
|
||||||
|
marker.setMap(null);
|
||||||
|
});
|
||||||
|
markers = [];
|
||||||
|
|
||||||
|
// For each place, get the icon, name and location.
|
||||||
|
var bounds = new google.maps.LatLngBounds();
|
||||||
|
places.forEach(function(place) {
|
||||||
|
var icon = {
|
||||||
|
url: place.icon,
|
||||||
|
size: new google.maps.Size(71, 71),
|
||||||
|
origin: new google.maps.Point(0, 0),
|
||||||
|
anchor: new google.maps.Point(17, 34),
|
||||||
|
scaledSize: new google.maps.Size(25, 25)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create a marker for each place.
|
||||||
|
markers.push(new google.maps.Marker({
|
||||||
|
map: self.map,
|
||||||
|
icon: icon,
|
||||||
|
title: place.name,
|
||||||
|
position: place.geometry.location
|
||||||
|
}));
|
||||||
|
|
||||||
|
if (place.geometry.viewport) {
|
||||||
|
// Only geocodes have viewport.
|
||||||
|
bounds.union(place.geometry.viewport);
|
||||||
|
} else {
|
||||||
|
bounds.extend(place.geometry.location);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.fitBounds(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
|
var iconPM = {
|
||||||
|
url: "http://app.gruppolapastamadre.it/icon.png",
|
||||||
|
scaledSize: new google.maps.Size(24, 24)
|
||||||
|
};
|
||||||
|
|
||||||
|
self.map.addListener('bounds_changed', function() {
|
||||||
|
var bound = map.getBounds();
|
||||||
|
searchBox.setBounds(bound);
|
||||||
|
var latLngFrom = bound.getNorthEast();
|
||||||
|
var latLngTo = bound.getSouthWest();
|
||||||
|
$.ajax({
|
||||||
|
url: "http://dev.gruppolapastamadre.it/Service/api/spacciatori/bound/" + latLngFrom.lat() + "/"+ latLngFrom.lng() + "/" + latLngTo.lat() + "/"+ latLngTo.lng(),
|
||||||
|
//dataType: "json",
|
||||||
|
//async: false,
|
||||||
|
type: 'GET',
|
||||||
|
success: function (resp) {
|
||||||
|
resp.forEach(function(ele, index){
|
||||||
|
if(!myMakers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"])
|
||||||
|
{
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: new google.maps.LatLng(ele.Latitudine, ele.Longitudine),
|
||||||
|
icon: iconPM,
|
||||||
|
//label: ele.Name,
|
||||||
|
title: ele.Name,
|
||||||
|
map: self.map
|
||||||
|
});
|
||||||
|
myMakers["|" + ele.Latitudine+ "|" + ele.Longitudine+ "|"] = marker;
|
||||||
|
var tipopm = "";
|
||||||
|
if(ele.TipoPM==1){tipopm = "Pasta Madre Solida"} else if(ele.TipoPM==2){tipopm = 'Li.Co.Li.'}else{tipopm = 'Entrambi'}
|
||||||
|
var infowindow = new google.maps.InfoWindow({
|
||||||
|
content: '<div id="content"><div id="siteNotice"></div><h3 id="firstHeading" class="firstHeading"> ' + ele.Name + '</h3><div id="bodyContent"><p><i>Località:</i> '+ ele.Indirizzo +'<br><i>Tipo di Lievito:</i> ' + tipopm + '<br><i>Contatta:</i> <a href="mailto:'+ele.Email+'">'+ ele.Email + '</a></p></div></div>'
|
||||||
|
});
|
||||||
|
|
||||||
|
marker.addListener('click', function() {
|
||||||
|
infowindow.open(self.map, marker);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#pac-input").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
$( window ).resize( function(){
|
||||||
|
$("#map-canvas").width(document.documentElement.clientWidth - 32/*Padding content*/);
|
||||||
|
$("#map-canvas").height(document.documentElement.clientHeight - 151 - self.$el.find('#searchPanel').height());
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( navigator.geolocation ) {
|
||||||
|
function success(pos) {
|
||||||
|
// Location found, show map with these coordinates
|
||||||
|
_drawMap(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
|
||||||
|
}
|
||||||
|
function fail(error) {
|
||||||
|
_drawMap(defaultLatLng); // Failed to find location, show default map
|
||||||
|
}
|
||||||
|
// Find the users current position. Cache the location for 5 minutes, timeout after 6 seconds
|
||||||
|
navigator.geolocation.getCurrentPosition(success, fail, {maximumAge: 500000, enableHighAccuracy:true, timeout: 6000});
|
||||||
|
} else {
|
||||||
|
_drawMap(defaultLatLng); // No geolocation support, show default map
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">
|
||||||
|
<div id="map-canvas">
|
||||||
|
<!-- map loads here... -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user