git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@25 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2015-01-25 13:57:37 +00:00
parent 1b92a374cc
commit d0d55ee8e5
19 changed files with 517 additions and 292 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
call uglifyjs .\js\openfb.js .\js\opengplus.js .\js\libs\ua-parser.min.js -o .\js\common.min.js
call uglifyjs .\js\libs\hello.min.js .\js\libs\ua-parser.min.js -o .\js\common.min.js
REM node r.js -o app.build_dev.js
node r.js -o app.build_prod.js
REM call cleancss -o .\css\loadingStyle.min.css .\css\loadingStyle.css
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+2 -14
View File
@@ -18,22 +18,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"/>
<meta http-equiv="Access-Control-Allow-Origin" content="*"/>
<script type='text/javascript' src="js/common.min.<?php echo filemtime('js/common.min.js'); ?>.js"></script>
<script type='text/javascript'>
if(openFB && window.location &&
window.location.href.indexOf("access_token") != -1 &&
window.localStorage.getItem("tryLogin")=="fb") {
openFB.oauthCallback(window.location.href);
window.location.href = "#syncView/tokenFound";
}
else if(openGPlus && window.location &&
window.location.href.indexOf("access_token") != -1 &&
window.localStorage.getItem("tryLogin")=="gplus") {
openGPlus.oauthCallback(window.location.href);
window.location.href = "#syncView/tokenFound";
}
<script type='text/javascript'>
<?php echo file_get_contents("js/manifest.js"); ?>
</script>
<script data-main="js/config.<?php echo filemtime('js/libs/require.js'); ?>" src="js/libs/require.<?php echo filemtime('js/libs/require.js'); ?>.js"></script>
<script data-main="js/config.<?php echo filemtime('js/config.js'); ?>" src="js/libs/require.<?php echo filemtime('js/libs/require.js'); ?>.js"></script>
</head>
<body style="background-color: #1d1d1d;">
<?php include_once("analyticstracking.php") ?>
+67 -18
View File
@@ -1,29 +1,78 @@
define(['jquery','underscore', 'backbone', 'router', 'classes/profile'],function
($, _, Backbone,Router, Profile) {
'use strict';
var init=function(){
define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache'], function
($, _, Backbone, Router, Profile, Cache) {
'use strict';
var init = function () {
//create backbone router
var router=new Router();
var router = new Router();
Backbone.history.start();
Backbone.emulateJSON = true;
var origin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + (location.pathname?location.pathname:'');
openFB.init('1466942266882168', origin, window.localStorage);
openGPlus.init('319140243944-qk0lfhgmi8shi4go97r83l69f1k0gdf4.apps.googleusercontent.com', origin, window.localStorage);
//console.log("Backbone history start");
// Trigger 'route' event on router instance.
router.on('route', function(name, args) {
//alert(name);
});
if( Profile.isConnected()) {
hello.init({
facebook: '1466942266882168',
google: '319140243944-qk0lfhgmi8shi4go97r83l69f1k0gdf4.apps.googleusercontent.com'
}, {display: 'page', scope: 'email'});
//console.log("Backbone history start");
// Trigger 'route' event on router instance.
router.on('route', function (name, args) {
//alert(name);
});
Cache.checkCacheFromServer();
if (Profile.isConnected()) {
Profile.loadProfile();
}
hello.on('auth.login', function (auth) {
if (!Profile.isConnected())
{
hello(auth.network).api("me").then(function (json) {
var id = "";
var displayName = "";
var email = "";
var gender = "";
if (auth.network === "google")
{
id = json.id;
displayName = json.displayName;
email = json.email;
gender = json.gender;
}
else if (auth.network === "facebook")
{
id = json.id;
displayName = json.name;
email = json.email;
gender = json.gender;
}
Profile.internalLoadProfile(id, function(retVal){
if(retVal === false)
{
Profile.createProfile(
id,
auth.network,
displayName,
email,
gender,
function () {
window.location.href = "#syncView/tokenFound";
}
);
}
else
window.location.href = "#syncView/tokenFound";
});
});
}
});
$('body').css('background-color', '');
$('#loadingFrm').remove();
};
return {
initialize:init
};
return {
initialize: init
};
});
+66
View File
@@ -0,0 +1,66 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
define(['jquery', 'backbone'],
function ($, Backbone) {
var Cache = {
convertToDate: function (mysql_string)
{
if (typeof mysql_string === 'string')
{
var t = mysql_string.split(/[- :]/);
//when t[3], t[4] and t[5] are missing they defaults to zero
return new Date(t[0], t[1] - 1, t[2], t[3] || 0, t[4] || 0, t[5] || 0);
}
return null;
},
prefix: "cacheItem",
get: function (name) {
var item = window.localStorage.getItem(this.prefix + name);
if(item === null)
return null;
item = JSON.parse(item);
return item.storeValue;
},
set: function (name, value) {
window.localStorage.setItem(this.prefix + name, JSON.stringify({setTime: new Date(), storeValue: value}));
},
isExpired: function (name, timeDiff) {
var item = window.localStorage.getItem(this.prefix + name);
if(item === null)
return true;
item = JSON.parse(item);
var time = item.setTime;
if(timeDiff.getTime() > Date.parse(time))
return true;
return false;
},
checkCacheFromServer: function ()
{
var self = this;
$.ajax({
url: myManifest.Settings.DefaultURL + "/api/profile/statusCache",
//dataType: "json",
type: 'GET',
success: function (msg) {
$(msg).each(function (index, element) {
var elemName = "Category" + element.ID_CATEGORIA;
if (self.isExpired(elemName, self.convertToDate(element.LastDateModified)))
{
self.set(elemName, null);
}
});
}
});
}
};
return Cache;
});
+54
View File
@@ -0,0 +1,54 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
define(['jquery', 'underscore', 'backbone', 'classes/cache'],
function ($, _, Backbone, Cache) {
var CachedCollection = Backbone.Collection.extend({
cacheName: null,
fetch: function (options) {
options = _.defaults(options || {}, {parse: true});
var deferred = new $.Deferred(),
self = this;
var cachedItem = Cache.get(this.cacheName);
if (cachedItem !== null)
{
window.setTimeout(function () {
self[options.reset ? 'reset' : 'set'](false, options);
deferred.resolve(cachedItem);
self.push(cachedItem);
self.trigger('sync', self, false, options);
if (_.isFunction(options.success)) {
options.success(self, false, options);
}
return deferred;
}, 0);
}
else
{
// Delegate to the actual fetch method and store the attributes in the cache
var jqXHR = Backbone.Collection.prototype.fetch.apply(this, arguments);
// resolve the returned promise when the AJAX call completes
jqXHR.done(_.bind(deferred.resolve, this, this))
// Set the new data in the cache
.done(_.bind(
function (a, b, c) {
Cache.set(self.cacheName, a);
}
, null, this, options))
// Reject the promise on fail
.fail(_.bind(deferred.reject, this, this));
deferred.abort = jqXHR.abort;
// return a promise which provides the same methods as a jqXHR object
return deferred;
}
}
});
return CachedCollection;
});
+2 -2
View File
@@ -73,12 +73,12 @@ define(['jquery', 'backbone'],
},
isGPlusConnected: function(){
if(this.data.type == "gplus")
if(this.data.type === "google")
return true;
return false;
},
isFbConnected: function(){
if(this.data.type == "fb")
if(this.data.type === "facebook")
return true;
return false;
},
+3
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,11 +1,11 @@
var myManifest = {
Debug: false,
Name: "Il Lievitario",
Version: "2.3.0",
Version: "2.5.0",
Author: "Denis Ironi",
Settings: {
DefaultURL: "http://localhost:8081/Service_Manut",
//DefaultURL: "http://app.gruppolapastamadre.it/Service",
//DefaultURL: "http://localhost:8081/Service_Manut",
DefaultURL: "http://app.gruppolapastamadre.it/Service",
JQueryVersion: "1.11.1",
JQueryMobileVersion: "1.4.3",
Device:{
+12 -13
View File
@@ -1,17 +1,16 @@
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel'],
function (app, $, _, Backbone, Category){
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel', 'classes/cachedCollection'],
function (app, $, _, Backbone, Category, CachedCollection) {
var Categories=Backbone.Collection.extend({
var Categories = CachedCollection.extend({
cacheName: "Category0",
// Book is the model of the collection
model: Category,
url: function () {
return myManifest.Settings.DefaultURL + "/api/categories";
}
});
// Book is the model of the collection
model:Category,
url: function() {
return myManifest.Settings.DefaultURL + "/api/categories";
}
});
return Categories;
});
return Categories;
});
@@ -1,11 +1,12 @@
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel'],
function (app, $, _, Backbone, Category){
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel', 'classes/cachedCollection'],
function (app, $, _, Backbone, Category, CachedCollection){
var CategoryItems=Backbone.Collection.extend({
var CategoryItems=CachedCollection.extend({
categoryId: null,
initialize: function (options) {
this.categoryId = options.categoryId;
this.cacheName = "Category" + this.categoryId;
},
// Book is the model of the collection
model:Category,
+59 -63
View File
@@ -1,66 +1,62 @@
define(['jquery', 'underscore', 'backbone','text!modules/category/categoryViewTemplate.html', 'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView'],
function($, _, Backbone, categoryViewTemplate, categoryItemTemplate, BaseView){
define(['jquery', 'underscore', 'backbone', 'text!modules/category/categoryViewTemplate.html', 'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView'],
function ($, _, Backbone, categoryViewTemplate, categoryItemTemplate, BaseView) {
var CategoryView = BaseView.extend({
var CategoryView = BaseView.extend({
collection: null,
categoryName: null,
//initialize template
template: _.template(categoryViewTemplate),
itemtemplate: _.template(categoryItemTemplate),
initialize: function (options) {
var self = this;
CategoryView.__super__.initialize.call(this);
this.collection = options.collection;
this.categoryName = options.categoryName;
this.collection.fetch({
success: function (data, textStatus, jqXHR) {
self.renderItem();
}
//success: function(){ self.renderItem(); }
});
},
renderItem: function () {
var $ul = $('#allRicette');
collection: null,
categoryName: null,
//initialize template
template:_.template(categoryViewTemplate),
itemtemplate:_.template(categoryItemTemplate),
initialize: function (options) {
var self = this;
CategoryView.__super__.initialize.call(this);
this.collection = options.collection;
this.categoryName = options.categoryName;
this.collection.fetch({
success: function(data, textStatus, jqXHR){
self.renderItem();
}
//success: function(){ self.renderItem(); }
});
},
renderItem: function(){
var $ul = $('#allRicette');
var items = this.itemtemplate({data:this.collection.toJSON()});
$ul.html( items );
$ul.listview( "refresh" );
$ul.trigger( "updatelayout");
$ul.find('input[type=radio].star').rating({
callback: function (value, link) {
var tip = $('#hover-test');
if (value === undefined)
{
$('#hover-test').html("Nessuna" || 'value: ');
var items = this.itemtemplate({data: this.collection.toJSON()});
$ul.html(items);
$ul.listview("refresh");
$ul.trigger("updatelayout");
$ul.find('input[type=radio].star').rating({
callback: function (value, link) {
var tip = $('#hover-test');
if (value === undefined)
{
$('#hover-test').html("Nessuna" || 'value: ');
}
else
$('#hover-test').html(link.title || 'value: ' + value);
}
});
$.mobile.loading('hide');
//$( '[data-alpha="true"]' ).alphascroll();
},
//render the content into div of view
render: function () {
//this.header.title = "pippo";
CategoryView.__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({categoryName: this.categoryName}));
this.$el.append(this.footer.$el);
//return to enable chained calls
this.$el.find("#indexBtn").addClass("ui-btn-active");
return this;
}
else
$('#hover-test').html(link.title || 'value: ' + value);
}
});
$.mobile.loading( 'hide' );
//$( '[data-alpha="true"]' ).alphascroll();
},
//render the content into div of view
render: function(){
//this.header.title = "pippo";
CategoryView.__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({ categoryName: this.categoryName }));
this.$el.append(this.footer.$el);
//return to enable chained calls
this.$el.find("#indexBtn").addClass("ui-btn-active");
return this;
}
});
return CategoryView;
});
});
return CategoryView;
});
+129 -158
View File
@@ -1,164 +1,135 @@
define(['jquery', 'underscore', 'backbone','text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
function($, _, Backbone, syncViewTemplate, BaseView, Profile){
define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
function ($, _, Backbone, syncViewTemplate, BaseView, Profile) {
var SyncView = BaseView.extend({
//initialize template
template:_.template(syncViewTemplate),
initialize: function (options) {
SyncView.__super__.initialize.call(this);
if(options &&
options.tokenFound == 1)
{
if(window.localStorage.getItem("tryLogin")=="fb")
var SyncView = BaseView.extend({
//initialize template
template: _.template(syncViewTemplate),
initialize: function (options) {
SyncView.__super__.initialize.call(this);
if (options &&
options.tokenFound == 1)
{
this.fbAfterLogin();
this.updateLoginBtn();
}
else if(window.localStorage.getItem("tryLogin")=="gplus")
{
this.gPlusAfterLogin();
}
}
window.localStorage.setItem("tryLogin", null);
},
window.localStorage.setItem("tryLogin", null);
},
events: {
"click #backBtn": "backBtn",
"click #fblogin": "fbLogin",
"click #gpluslogin": "gplusLogin",
"click #resetBtn": "resetBtn"
},
resetBtn: function (e) {
e.preventDefault();
Profile.setKeySave(null);
window.localStorage.setItem("hello", null);
Backbone.history.loadUrl();
},
backBtn: function (e) {
e.preventDefault();
window.history.back();
},
fbLogin: function (e) {
var self = this;
e.preventDefault();
events: {
"click #backBtn": "backBtn",
"click #fblogin": "fbLogin",
"click #gpluslogin": "gplusLogin",
"click #resetBtn": "resetBtn"
},
resetBtn:function(e){
e.preventDefault();
Profile.setKeySave(null);
Backbone.history.loadUrl();
},
backBtn:function(e){
e.preventDefault();
window.history.back();
},
fbLogin: function(e){
var self = this;
e.preventDefault();
if(!Profile.isConnected()) {
window.localStorage.setItem("tryLogin", "fb");
openFB.login('email');
}
else if(Profile.isConnected() && Profile.isFbConnected())
openFB.revokePermissions(function(){
Profile.setKeySave(null);
self.updateLoginBtn();
});
},
fbAfterLogin: function()
{
var self = this;
openFB.api({
path: '/me',
success: function (data) {
Profile.internalLoadProfile(data.id, function(retVal){
if(retVal == false)
Profile.createProfile(
data.id,
"fb",
data.name,
data.email,
data.gender,
function(){
//Backbone.history.loadUrl();
});
self.updateLoginBtn();
});
}});
},
gplusLogin: function(e){
var self = this;
e.preventDefault();
if(!Profile.isConnected()) {
window.localStorage.setItem("tryLogin", "gplus");
openGPlus.login('email');
}
else if(Profile.isConnected() && Profile.isGPlusConnected())
openGPlus.revokePermissions(function(){
Profile.setKeySave(null);
self.updateLoginBtn();
});
},
gPlusAfterLogin: function()
{
var self = this;
openGPlus.api({
path: 'people/me',
success: function (data) {
Profile.internalLoadProfile(data.id, function(retVal){
if(retVal == false)
Profile.createProfile(
data.id,
"gplus",
data.displayName,
data.emails[0].value,
data.gender,
function(){
//Backbone.history.loadUrl();
}
);
self.updateLoginBtn();
});
}});
},
updateLoginBtn: function()
{
if(Profile.isConnected()) {
if (Profile.isFbConnected()) {
this.$el.find("#fblogin").show();
this.$el.find("#gpluslogin").hide();
this.$el.find("#fblogin").removeClass("loginfb");
this.$el.find("#fblogin").addClass("logoutfb");
}
if (Profile.isGPlusConnected()) {
this.$el.find("#gpluslogin").show();
this.$el.find("#fblogin").hide();
this.$el.find("#gpluslogin").removeClass("logingplus");
this.$el.find("#gpluslogin").addClass("logoutgplus");
}
}
else
hello('facebook').login();
},
fbAfterLogin: function ()
{
this.$el.find("#fblogin").removeClass("logoutfb");
this.$el.find("#fblogin").addClass("loginfb");
this.$el.find("#gpluslogin").removeClass("logoutgplus");
this.$el.find("#gpluslogin").addClass("logingplus");
/*
var self = this;
openFB.api({
path: '/me',
success: function (data) {
Profile.internalLoadProfile(data.id, function(retVal){
if(retVal == false)
Profile.createProfile(
data.id,
"fb",
data.name,
data.email,
data.gender,
function(){
//Backbone.history.loadUrl();
});
self.updateLoginBtn();
});
}});
*/
},
gplusLogin: function (e) {
var self = this;
e.preventDefault();
hello('google').login();
},
gPlusAfterLogin: function ()
{
/*
var self = this;
openGPlus.api({
path: 'people/me',
success: function (data) {
Profile.internalLoadProfile(data.id, function(retVal){
if(retVal == false)
Profile.createProfile(
data.id,
"gplus",
data.displayName,
data.emails[0].value,
data.gender,
function(){
//Backbone.history.loadUrl();
}
);
self.updateLoginBtn();
});
}});
*/
},
updateLoginBtn: function ()
{
if (Profile.isConnected()) {
if (Profile.isFbConnected()) {
this.$el.find("#fblogin").show();
this.$el.find("#gpluslogin").hide();
this.$el.find("#fblogin").removeClass("loginfb");
this.$el.find("#fblogin").addClass("logoutfb");
}
if (Profile.isGPlusConnected()) {
this.$el.find("#gpluslogin").show();
this.$el.find("#fblogin").hide();
this.$el.find("#gpluslogin").removeClass("logingplus");
this.$el.find("#gpluslogin").addClass("logoutgplus");
}
}
else
{
this.$el.find("#fblogin").removeClass("logoutfb");
this.$el.find("#fblogin").addClass("loginfb");
this.$el.find("#gpluslogin").removeClass("logoutgplus");
this.$el.find("#gpluslogin").addClass("logingplus");
}
},
//render the content into div of view
render: function () {
var self = this;
//this.header.title = "pippo";
SyncView.__super__.render.call(this);
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"ui-btn-right\" data-icon=\"custom\">Indietro</a>");
this.$el.append(this.header.$el);
this.$el.append(this.template({app: myManifest}));
this.$el.append(this.footer.$el);
this.$el.find("#moreBtn").addClass("ui-btn-active");
this.updateLoginBtn();
return this;
}
},
//render the content into div of view
render: function(){
var self = this;
//this.header.title = "pippo";
SyncView.__super__.render.call(this);
this.header.$el.append("<a id=\"backBtn\" href=\"\" data-role=\"button\" class=\"ui-btn-right\" data-icon=\"custom\">Indietro</a>");
this.$el.append(this.header.$el);
this.$el.append(this.template( { app: myManifest }));
this.$el.append(this.footer.$el);
this.$el.find("#moreBtn").addClass("ui-btn-active");
this.updateLoginBtn();
return this;
}
});
return SyncView;
});
});
return SyncView;
});
+4 -2
View File
@@ -4,14 +4,14 @@ define(['jquery', 'underscore', 'backbone',
'modules/sync/sync', 'modules/converter/converter', 'modules/donation/donation', 'modules/settings/settings',
'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection',
'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection',
'libs/fastclick', 'jqm', 'jQueryPlugins'],
'libs/fastclick', 'classes/cache', 'jqm', 'jQueryPlugins'],
function ($, _, Backbone,
HomeView, FaqView, IndexView, CategoryView, ItemView,
AboutView, SearchView, FoundView, MoreView, NoteView,
SyncView, ConverterView, DonationView, SettingsView,
NoteCollection, CategoryCollection, CategoryItemCollection,
ItemCollection, IngredientiCollection, FoundItemCollection,
FastClick) {
FastClick, Cache) {
'use strict';
var Router = Backbone.Router.extend({
@@ -84,6 +84,8 @@ define(['jquery', 'underscore', 'backbone',
this.changePage(faqView);
},
showIndex: function (actions) {
Cache.checkCacheFromServer();
var categories = new CategoryCollection();
// will render home view and navigate to homeView
var indexView = new IndexView({collection: categories});
+1 -15
View File
@@ -2,20 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/router.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/category/category.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/model/category/categoryModel.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/css/base.style.css</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/sync/syncViewTemplate.html</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/css/jquery.rating.css</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/index.php</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/model/categoryItem/categoryItemModel.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/home/homeViewTemplate.html</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/manifest.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/category/categoryItemTemplate.html</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/sync/sync.js</file>
<file>file:/E:/Sviluppo/IlLievitario/WebClient_Manut/js/modules/item/itemViewTemplate.html</file>
</group>
<group/>
</open-files>
</project-private>
+63
View File
@@ -0,0 +1,63 @@
<?php
/**
* XML Sitemap PHP Script
* For more info, see: http://yoast.com/xml-sitemap-php-script/
* Copyright (C), 2011 - 2012 - Joost de Valk, [email protected]
*/
// inclusione del file contenente la classe
require_once "./Service/MySqlClass.php";
require_once "./Service/utility.php";
// Get the keys so we can check quickly
// Sent the correct header so browsers display properly, with or without XSL.
header( 'Content-Type: application/xml' );
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
$url = "http://app.gruppolapastamadre.it/";
$blog_timezone = 'UTC';
$timezone_offset = '+01:00';
$W3C_datetime_format_php = 'Y-m-d\Th:i:s'; // See http://www.w3.org/TR/NOTE-datetime
function dinamicSite() {
global $url, $blog_timezone, $timezone_offset, $W3C_datetime_format_php;
$mysqlconnetion = new MysqlClass;
//$mysqlconneti on->connetti();
$retObj = $mysqlconnetion->queryToObject("select ID as category_id, NAME as name from categorie order by name");
foreach ($retObj as $key => $value)
{
$catStr = "#category/". $value["name"] ."/" . $value["category_id"];
$lastModified = $mysqlconnetion->queryToObject("select MAX(Data_creazione) as lastModified from ricette where ID_CATEGORIA = ". $value["category_id"]);
$date = DateTime::createFromFormat('Y-m-d H:i:s', $lastModified[0]["lastModified"], new DateTimeZone("Europe/Rome"));
$lastDate = date_format($date, $W3C_datetime_format_php) . $timezone_offset;
?>
<url>
<loc><?php echo $url . $catStr; ?></loc>
<lastmod><?php echo $lastDate; ?></lastmod>
</url><?php
$query = "select ID as ricetta_id, titolo from ricette where ID_CATEGORIA = " . $value["category_id"] . " order by titolo, autore";
$ricItems = $mysqlconnetion->queryToObject($query);
foreach ($ricItems as $keyRic => $valueRic)
{
$itemStr= "#ricetta/" . $valueRic["ricetta_id"];
?>
<url>
<loc><?php echo $url . $itemStr; ?></loc>
</url><?php
}
}
$mysqlconnetion->disconnetti();
}
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><?php
dinamicSite();
?>
</urlset>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://app.gruppolapastamadre.it/</loc>
<lastmod>2014-04-09</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://app.gruppolapastamadre.it/</loc>
<lastmod>2014-04-09</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Il Lievitario</title>
<meta name="google" value="notranslate" />
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.css" >
<link rel="stylesheet" href="css/style.min.<?php echo filemtime('css/style.min.css'); ?>.css">
<link rel="shortcut icon" sizes="196x196" href="https://dl.dropboxusercontent.com/s/l26w7lk0zwnpehf/Icon_Android196.png">
<link rel="apple-touch-icon" href="https://dl.dropboxusercontent.com/s/9cc174ato4hckl5/Icon.png" />
<link rel="apple-touch-icon" sizes="72x72" href="https://dl.dropboxusercontent.com/s/onehseqh6cusbo0/Icon~ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="https://dl.dropboxusercontent.com/s/tcxl91zd502mapa/Icon%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 http-equiv="Access-Control-Allow-Origin" content="*"/>
</head>
<body style="background-color: #1d1d1d;">
<div id="loadingFrm" style="text-align: center;">
<div class="loadingSfondo">
<div class="loadingText">
<div style="color: #ffffff;"><b>Caricamento...</b></div>
</div>
</div>
</body>
</html>