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

This commit is contained in:
2016-01-11 17:05:00 +00:00
parent d5ada56dbd
commit 2c732a6081
14 changed files with 197 additions and 10 deletions
@@ -3,7 +3,7 @@
<%} else { for (var i = 0; i < data.length; i++) { %>
<% var item = data[i]; %>
<li><a href="#ricetta/<%= item.ricetta_id%>" class="ui-btn ui-btn-icon-right ui-icon-carat-r">
<img src="Resources\img\ricettaND_80.png">
<!--<img src="Resources\img\ricettaND_80.png">-->
<div class='ricettaTitolo'><%= unescape(item.titolo) %></div>
<div class='ricettaAutore'><%= unescape(item.autore) %></div>
<br><div class='ricettaAutore'>Diff.:&nbsp;&nbsp;</div>
@@ -1,5 +1,5 @@
<div id="categoryListContent" data-role="content">
<h1>Indice <%= categoryName %></h1>
<h1>Indice <%= categoryName %></h1>
<ul id="allRicette" data-role="listview" data-autodividers="true" data-alpha="true" data-inset="true">
</ul>
</div>
+8 -2
View File
@@ -1,8 +1,8 @@
<div data-role="content">
<div style="text-align: center;">
<% if(profile.data.name){ %>
<h2 id="benvenuto">Bentornat<% if(profile.data.gender=="male"){%>o<%}else{%>a<%}%><br><%=profile.data.name %></h2><% }else{ %>
<h2 id="benvenuto">Benarrivata/o nel nostro ricettario</h2>
<h3 id="benvenuto">Bentornat<% if(profile.data.gender=="male"){%>o<%}else{%>a<%}%> <%=profile.data.name %></h3><% }else{ %>
<h3 id="benvenuto">Benarrivata/o nel nostro ricettario</h3>
<% } %>
</div>
<div>
@@ -37,6 +37,12 @@
<span>Blog</span>
</div>
</div>
<div class="itemMenuHomeMetro <%= customClassTheme %> blogClass">
<div>
<a href="#mapsView" data-role="none"></a>
<span>Mappa Spacciatori</span>
</div>
</div>
</div>
</div>
</div>
+10
View File
@@ -0,0 +1,10 @@
<div id="content">
<div id="siteNotice">
</div>
<h1 id="firstHeading" class="firstHeading"><%= item.Name%></h1>
<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>
Contatta a: <a href="mailto:<%= item.Email%>"><%= item.Email%></a>
</p>
</div>
</div>
+101
View File
@@ -0,0 +1,101 @@
define(['jquery', 'underscore', 'backbone', 'text!modules/maps/mapsViewTemplate.html', 'text!modules/maps/infoWindowTemplate.html', 'modules/base/baseView', 'classes/profile'],
function ($, _, Backbone, mapsViewTemplate, infoWindowTemplate, BaseView, Profile) {
var MapsView = BaseView.extend({
map: null,
markers: [],
//initialize template
template: _.template(mapsViewTemplate),
infoWindowtemplate: _.template(infoWindowTemplate),
initialize: function () {
this.id = "MapsView";
MapsView.__super__.initialize.call(this);
},
onShowed: function(){
var self = this;
var drawMap = function(LatLng){
var myOptions = {
            zoom: 10,
            center: LatLng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
self.map = new google.maps.Map($("#map-canvas")[0], myOptions);
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();
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 ) {
        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
    }
},
//render the content into div of view
render: function () {
if (this.created === true)
{
//this.header.title = "pippo";
MapsView.__super__.render.call(this);
//this.el is the root element of Backbone.View. By default, it is a div.
//$el is cached jQuery object for the view's element.
//append the compiled template into view div container
this.$el.append(this.header.$el);
this.$el.append(this.template({app: myManifest, profile: Profile}));
this.$el.append(this.footer.$el);
this.$el.find("#infoBtn").addClass("ui-btn-active");
}
//$("#homeBtn").addClass("ui-btn-active");
//return to enable chained calls
return this;
}
});
return MapsView;
});
+5
View File
@@ -0,0 +1,5 @@
<div data-role="content">
<div id="map-canvas" style="height: 100%; width: 350px;">
        <!-- map loads here... -->
    </div>
</div>
+38 -2
View File
@@ -5,6 +5,7 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
//initialize template
template:_.template(settingsViewTemplate),
_flagSave: false,
initialize: function () {
var self = this;
@@ -18,6 +19,12 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
},
saveBtn:function(e){
var self = this;
if(self._flagSave)
return;
self._flagSave = true;
e.preventDefault();
Profile.data.risRic = this.$el.find('#nResult').val();
Profile.data.tema = this.$el.find('#theme').val();
@@ -33,6 +40,26 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
Profile.data.dataSpacc.tipopm = this.$el.find('#tPM').val();
Profile.data.dataSpacc.privacy = this.$el.find('#privacyChk').prop('checked')?"1":"0";
if(Profile.data.email === "" ||
Profile.data.dataSpacc.provincia === "" ||
Profile.data.dataSpacc.comune === "" ||
Profile.data.dataSpacc.cap === "" ||
Profile.data.dataSpacc.tipopm === "")
{
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> devono essere settate tutte i campi</center>");
this.$el.find('#popupDialog').popup("open");
self._flagSave = false;
return;
}
if(Profile.data.dataSpacc.privacy==="0")
{
this.$el.find('#messaggio').html("<center><h1>ATTENZIONE</h1> per proseguire si DEVE accettare l'informativa privacy</center>");
this.$el.find('#popupDialog').popup("open");
self._flagSave = false;
return;
}
$.ajax({
url: "http://maps.google.com/maps/api/geocode/json?address=" +
Profile.data.dataSpacc.comune + "+" +
@@ -40,14 +67,23 @@ define(['jquery', 'underscore', 'backbone','text!modules/settings/settingsViewTe
Profile.data.dataSpacc.provincia + "+italia&sensor=false",
                Type: "GET"
            }).then(function ( response ) {
if(response.results.length == 1)
{
Profile.data.dataSpacc.lat = response.results[0].geometry.location.lat;
Profile.data.dataSpacc.long = response.results[0].geometry.location.lng;
Profile.updateProfile(function(){
self._flagSave = false;
Backbone.history.loadUrl(Backbone.history.getFragment());
});
}
});
}
}
else
{
Profile.updateProfile(function(){
Backbone.history.loadUrl();
self._flagSave = false;
Backbone.history.loadUrl(Backbone.history.getFragment());
});
}
},
@@ -151,6 +151,7 @@
<select name="tPM" id="tPM">
<option value="1" selected="true">Solida</option>
<option value="2">Liquida/Licoli</option>
<option value="3">Entrambe</option>
</select>
<label>Infomativa privacy, AUTORIZZAZIONE DATI PERSONALI
ai sensi e per gli effetti degli artt. 13 e 23 del D.Lgs. n. 196/2003, acconsento al trattamento e alla pubblicazione dei dati personali forniti a seguito della
@@ -165,4 +166,16 @@ segnalazione inoltrata.</label>
Impostazione di sincronizzazione
<a id="syncBtn" href="#syncView" button="true" class="ui-link ui-btn ui-icon-custom ui-btn-icon-left">Sincronizzazione</a>
</div>
</div>
<div data-role="popup" id="popupDialog">
<div data-role="header">
<h1>Avvertimento</h1>
</div>
<div role="main" class="ui-content">
<p id="messaggio" style="text-align: center;font-style: italic;">
</p>
<p style="text-align: center;">
<a href="" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-check" data-rel="back">Ok</a>
</p>
</div>
</div>