git-svn-id: https://msi/svn/firstRepo/WebClient/branches/NewRelease@45 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2016-01-12 11:39:12 +00:00
parent 2c732a6081
commit 0762b4dfb0
7 changed files with 215 additions and 59 deletions
+7
View File
@@ -60,6 +60,13 @@ h1{
font-size: 1.5em; font-size: 1.5em;
} }
h3{
text-align: center;
font-size: 1em;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
/*--------- Fix per FAQ ---------*/ /*--------- Fix per FAQ ---------*/
h4.ui-collapsible-heading a{ h4.ui-collapsible-heading a{
white-space: normal; white-space: normal;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -18,7 +18,7 @@
<link rel="apple-touch-icon" sizes="144x144" href="https://dl.dropboxusercontent.com/s/pj3fk1lgc4cefwx/Icon~ipad%402x.png" /> <link rel="apple-touch-icon" sizes="144x144" href="https://dl.dropboxusercontent.com/s/pj3fk1lgc4cefwx/Icon~ipad%402x.png" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"/> <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"/>
<meta http-equiv="Access-Control-Allow-Origin" content="*"/> <meta http-equiv="Access-Control-Allow-Origin" content="*"/>
<script src="https://maps.googleapis.com/maps/api/js"></script> <script src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
<script type='text/javascript' src="js/common.min.<?php echo filemtime('js/common.min.js'); ?>.js"></script> <script type='text/javascript' src="js/common.min.<?php echo filemtime('js/common.min.js'); ?>.js"></script>
<script type='text/javascript'> <script type='text/javascript'>
<?php echo file_get_contents("js/manifest.js"); ?> <?php echo file_get_contents("js/manifest.js"); ?>
+1 -1
View File
@@ -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.2.0", Version: "2.9.3.0",
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"),
+4 -3
View File
@@ -1,10 +1,11 @@
<div id="content"> <div id="content">
<div id="siteNotice"> <div id="siteNotice">
</div> </div>
<h1 id="firstHeading" class="firstHeading"><%= item.Name%></h1> <h3 id="firstHeading" class="firstHeading"><%= item.Name%></h3>
<div id="bodyContent"> <div id="bodyContent">
<p>Tipo di Lievito: <% if(item.TipoPM==1){%>Pasta Madre Solida<%} else if(item.TipoPM==2){%>Li.Co.Li.<%}else{%>Entrambi<%}%><br> <p><i>Località:</i> <%= item.Indirizzo%><br>
Contatta a: <a href="mailto:<%= item.Email%>"><%= item.Email%></a> <i>Tipo di Lievito:</i> <% if(item.TipoPM==1){%>Pasta Madre Solida<%} else if(item.TipoPM==2){%>Li.Co.Li.<%}else{%>Entrambi<%}%><br>
<i>Contatta:</i> <a href="mailto:<%= item.Email%>"><%= item.Email%></a>
</p> </p>
</div> </div>
</div> </div>
+167 -52
View File
@@ -8,74 +8,189 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.
//initialize template //initialize template
template: _.template(mapsViewTemplate), template: _.template(mapsViewTemplate),
infoWindowtemplate: _.template(infoWindowTemplate), infoWindowtemplate: _.template(infoWindowTemplate),
defaultLatLng: new google.maps.LatLng(45.4654219, 9.1859243),  // Default to Milan
initialize: function () { initialize: function () {
this.id = "MapsView"; this.id = "MapsView";
MapsView.__super__.initialize.call(this); MapsView.__super__.initialize.call(this);
}, },
onShowed: function(){ _centerControl: function(controlDiv, map) {
var self = this; var self = this;
var drawMap = function(LatLng){ // Set CSS for the control border.
var myOptions = { var controlUI = document.createElement('div');
            zoom: 10, controlUI.style.backgroundColor = '#fff';
            center: LatLng, controlUI.style.border = '2px solid #fff';
            mapTypeId: google.maps.MapTypeId.ROADMAP controlUI.style.borderRadius = '3px';
        }; controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
self.map = new google.maps.Map($("#map-canvas")[0], myOptions); 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);
var iconPM = { // Set CSS for the control interior.
url: "http://app.gruppolapastamadre.it/icon.png", var controlText = document.createElement('div');
scaledSize: new google.maps.Size(24, 24) 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);
self.map.addListener('bounds_changed', function() { // Setup the click event listeners: simply set the map to Chicago.
var bound = self.map.getBounds(); controlUI.addEventListener('click', function() {
var latLngFrom = bound.getNorthEast();
var latLngTo = bound.getSouthWest();
$.ajax({
url: myManifest.Settings.DefaultURL + "/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(!self.markers["|" + 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
});
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);
});
}
});
}
});
});
};
var defaultLatLng = new google.maps.LatLng(34.0983425, -118.3267434);  // Default to Hollywood, CA when no geolocation support
if ( navigator.geolocation ) { if ( navigator.geolocation ) {
        function success(pos) {         function success(pos) {
            // Location found, show map with these coordinates             // Location found, show map with these coordinates
            drawMap(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude)); self.map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
        }         }
        function fail(error) {         function fail(error) {
            drawMap(defaultLatLng);  // Failed to find location, show default map self.map.setCenter(self.defaultLatLng);  // Failed to find location, show default map
        }         }
        // Find the users current position.  Cache the location for 5 minutes, timeout after 6 seconds         // 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});         navigator.geolocation.getCurrentPosition(success, fail, {maximumAge: 500000, enableHighAccuracy:true, timeout: 6000});
    } else {     } else {
        drawMap(defaultLatLng);  // No geolocation support, show default map self.map.setCenter(self.defaultLatLng);  // Failed to find location, show default map
    }
});
},
_drawMap: function(LatLng){
var self = this;
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 - self.$el.find('#searchPanel').height());
self.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;
self.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);
}
});
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() {
var bound = self.map.getBounds();
searchBox.setBounds(bound);
var latLngFrom = bound.getNorthEast();
var latLngTo = bound.getSouthWest();
$.ajax({
url: myManifest.Settings.DefaultURL + "/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(!self.markers["|" + 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
});
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);
});
}
});
}
});
});
$("#pac-input").show();
},
onShowed: function(){
var self = this;
$( 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
self._drawMap(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
        }
        function fail(error) {
self._drawMap(self.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 {
self._drawMap(self.defaultLatLng);  // No geolocation support, show default map
    }     }
}, },
//render the content into div of view //render the content into div of view
+34 -1
View File
@@ -1,5 +1,38 @@
<div data-role="content"> <div data-role="content">
<div id="map-canvas" style="height: 100%; width: 350px;"> <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>
<div id="searchPanel">
<h3>Mappa Spacciatori</h3>
</div>
<input id="pac-input" data-role="none" class="controls" type="text" placeholder="Ricerca località..." style="display:none;">
<div id="map-canvas">
        <!-- map loads here... -->         <!-- map loads here... -->
    </div>     </div>
</div> </div>