git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@25 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
1 parent
1b92a374cc
commit
d0d55ee8e5
19 files changed
+517
-292
No files matched your search
@@ -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
|
REM node r.js -o app.build_dev.js
|
||||||
node r.js -o app.build_prod.js
|
node r.js -o app.build_prod.js
|
||||||
REM call cleancss -o .\css\loadingStyle.min.css .\css\loadingStyle.css
|
REM call cleancss -o .\css\loadingStyle.min.css .\css\loadingStyle.css
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -18,22 +18,10 @@
|
|||||||
<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 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'>
|
||||||
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";
|
|
||||||
}
|
|
||||||
<?php echo file_get_contents("js/manifest.js"); ?>
|
<?php echo file_get_contents("js/manifest.js"); ?>
|
||||||
</script>
|
</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>
|
</head>
|
||||||
<body style="background-color: #1d1d1d;">
|
<body style="background-color: #1d1d1d;">
|
||||||
<?php include_once("analyticstracking.php") ?>
|
<?php include_once("analyticstracking.php") ?>
|
||||||
|
|||||||
@@ -1,29 +1,78 @@
|
|||||||
define(['jquery','underscore', 'backbone', 'router', 'classes/profile'],function
|
define(['jquery', 'underscore', 'backbone', 'router', 'classes/profile', 'classes/cache'], function
|
||||||
($, _, Backbone,Router, Profile) {
|
($, _, Backbone, Router, Profile, Cache) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var init=function(){
|
var init = function () {
|
||||||
//create backbone router
|
//create backbone router
|
||||||
var router=new Router();
|
var router = new Router();
|
||||||
Backbone.history.start();
|
Backbone.history.start();
|
||||||
Backbone.emulateJSON = true;
|
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();
|
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', '');
|
$('body').css('background-color', '');
|
||||||
$('#loadingFrm').remove();
|
$('#loadingFrm').remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initialize:init
|
initialize: init
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -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;
|
||||||
|
});
|
||||||
@@ -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;
|
||||||
|
});
|
||||||
@@ -73,12 +73,12 @@ define(['jquery', 'backbone'],
|
|||||||
},
|
},
|
||||||
|
|
||||||
isGPlusConnected: function(){
|
isGPlusConnected: function(){
|
||||||
if(this.data.type == "gplus")
|
if(this.data.type === "google")
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
isFbConnected: function(){
|
isFbConnected: function(){
|
||||||
if(this.data.type == "fb")
|
if(this.data.type === "facebook")
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
var hello=function(e){return hello.use(e)};hello.utils={extend:function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0;n<t.length;n++){var o=t[n];if(e instanceof Object&&o instanceof Object&&e!==o)for(var i in o)e[i]=hello.utils.extend(e[i],o[i]);else e=o}return e}},hello.utils.extend(hello,{settings:{redirect_uri:window.location.href.split("#")[0],response_type:"token",display:"popup",state:"",oauth_proxy:"https://auth-server.herokuapp.com/proxy",timeout:2e4,default_service:null,force:!0,page_uri:window.location.href},service:function(e){return"undefined"!=typeof e?this.utils.store("sync_service",e):this.utils.store("sync_service")},services:{},use:function(e){var t=this.utils.objectCreate(this);return t.settings=this.utils.objectCreate(this.settings),e&&(t.settings.default_service=e),t.utils.Event.call(t),t},init:function(e,t){var n=this.utils;if(!e)return this.services;for(var o in e)e.hasOwnProperty(o)&&"object"!=typeof e[o]&&(e[o]={id:e[o]});n.extend(this.services,e);for(o in this.services)this.services.hasOwnProperty(o)&&(this.services[o].scope=this.services[o].scope||{});return t&&(n.extend(this.settings,t),"redirect_uri"in t&&(this.settings.redirect_uri=n.url(t.redirect_uri).href)),this},login:function(){var e=this.use(),t=e.utils,n=t.args({network:"s",options:"o",callback:"f"},arguments);e.args=n;var o,i=n.options=t.merge(e.settings,n.options||{});if(n.network=e.settings.default_service=n.network||e.settings.default_service,e.on("complete",n.callback),"string"!=typeof n.network||!(n.network in e.services))return e.emitAfter("error complete",{error:{code:"invalid_network",message:"The provided network was not recognized"}}),e;var a=e.services[n.network],r=!1,s=t.globalEvent(function(n){var o;o=n?JSON.parse(n):{error:{code:"cancelled",message:"The authentication was not completed"}},r=!0,o.error?e.emit("complete error failed auth.failed",{error:o.error}):(t.store(o.network,o),e.emit("complete success login auth.login auth",{network:o.network,authResponse:o}))}),l=t.url(i.redirect_uri).href,u=a.oauth.response_type||i.response_type;"code"!==u||a.oauth.grant||(u="token"),n.qs={client_id:a.id,response_type:u,redirect_uri:l,display:i.display,scope:"basic",state:{client_id:a.id,network:n.network,display:i.display,callback:s,state:i.state,redirect_uri:l}};var c=t.store(n.network),d=(i.scope||"").toString();if(d=(d?d+",":"")+n.qs.scope,c&&"scope"in c&&c.scope instanceof String&&(d+=","+c.scope),n.qs.state.scope=t.unique(d.split(/[,\s]+/)).join(","),n.qs.scope=d.replace(/[^,\s]+/gi,function(t){if(t in a.scope)return a.scope[t];for(var n in e.services){var o=e.services[n].scope;if(o&&t in o)return""}return t}).replace(/[,\s]+/gi,","),n.qs.scope=t.unique(n.qs.scope.split(/,+/)).join(a.scope_delim||","),i.force===!1&&c&&"access_token"in c&&c.access_token&&"expires"in c&&c.expires>(new Date).getTime()/1e3){var f=t.diff(c.scope||[],n.qs.state.scope||[]);if(0===f.length)return e.emitAfter("complete success login",{unchanged:!0,network:n.network,authResponse:c}),e}if("page"===i.display&&i.page_uri&&(n.qs.state.page_uri=t.url(i.page_uri).href),"login"in a&&"function"==typeof a.login&&a.login(n),("token"!==u||parseInt(a.oauth.version,10)<2||"none"===i.display&&a.oauth.grant&&c&&c.refresh_token)&&(n.qs.state.oauth=a.oauth,n.qs.state.oauth_proxy=i.oauth_proxy),n.qs.state=JSON.stringify(n.qs.state),1===parseInt(a.oauth.version,10)?o=t.qs(i.oauth_proxy,n.qs):"none"===i.display&&a.oauth.grant&&c&&c.refresh_token?(n.qs.refresh_token=c.refresh_token,o=t.qs(i.oauth_proxy,n.qs)):o=t.qs(a.oauth.auth,n.qs),e.emit("notice","Authorization URL "+o),"none"===i.display)t.iframe(o);else if("popup"===i.display)var p=t.popup(o,l,i.window_width||500,i.window_height||550),m=setInterval(function(){if((!p||p.closed)&&(clearInterval(m),!r)){var t={code:"cancelled",message:"Login has been cancelled"};p||(t={code:"blocked",message:"Popup was blocked"}),e.emit("complete failed error",{error:t,network:n.network})}},100);else window.location=o;return e},logout:function(){var e=this.use(),t=e.utils,n=t.args({name:"s",options:"o",callback:"f"},arguments);if(n.options=n.options||{},e.on("complete",n.callback),n.name=n.name||e.settings.default_service,!n.name||n.name in e.services)if(n.name&&t.store(n.name)){var o=function(t){e.utils.store(n.name,""),e.emitAfter("complete logout success auth.logout auth",hello.utils.merge({network:n.name},t||{}))},i={};if(n.options.force){var a=e.services[n.name].logout;if(a)if("function"==typeof a&&(a=a(o)),"string"==typeof a)t.iframe(a),i.force=null,i.message="Logout success on providers site was indeterminate";else if(void 0===a)return e}o(i)}else if(n.name)e.emitAfter("complete error",{error:{code:"invalid_session",message:"There was no session to remove"}});else{for(var r in e.services)e.services.hasOwnProperty(r)&&e.logout(r);e.service(!1)}else e.emitAfter("complete error",{error:{code:"invalid_network",message:"The network was unrecognized"}});return e},getAuthResponse:function(e){return e=e||this.sLine truncated
|
||||||
|
}function r(e){e&&e.stat&&"ok"!=e.stat.toLowerCase()&&(e.error={code:"invalid_request",message:e.message})}function s(e){if(e.photoset||e.photos){var t="photoset"in e?"photoset":"photos";e=l(e,t),c(e),e.data=e.photo,delete e.photo;for(var n=0;n<e.data.length;n++){var o=e.data[n];o.name=o.title,o.picture=a(o.id,o.farm,o.server,o.secret,""),o.source=a(o.id,o.farm,o.server,o.secret,"b"),o.thumbnail=a(o.id,o.farm,o.server,o.secret,"m")}}return e}function l(e,t){return t in e?e=e[t]:"error"in e||(e.error={code:"invalid_request",message:e.message||"Failed to get data from Flickr"}),e}function u(e){if(r(e),e.contacts){e=l(e,"contacts"),c(e),e.data=e.contact,delete e.contact;for(var t=0;t<e.data.length;t++){var n=e.data[t];n.id=n.nsid,n.name=n.realname||n.username,n.thumbnail=i(n,"m")}}return e}function c(e){e.page&&e.pages&&e.page!==e.pages&&(e.paging={next:"?page="+ ++e.page})}e.init({flickr:{name:"Flickr",oauth:{version:"1.0a",auth:"https://www.flickr.com/services/oauth/authorize?perms=read",request:"https://www.flickr.com/services/oauth/request_token",token:"https://www.flickr.com/services/oauth/access_token"},base:"https://api.flickr.com/services/rest",get:{me:o("flickr.people.getInfo"),"me/friends":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/following":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/followers":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/albums":o("flickr.photosets.getList",{per_page:"@{limit|50}"}),"me/photos":o("flickr.people.getPhotos",{per_page:"@{limit|50}"})},wrap:{me:function(e){if(r(e),e=l(e,"person"),e.id){if(e.realname){e.name=e.realname._content;var t=e.name.split(" ");e.first_name=t[0],e.last_name=t[1]}e.thumbnail=i(e,"l"),e.picture=i(e,"l")}return e},"me/friends":u,"me/followers":u,"me/following":u,"me/albums":function(e){if(r(e),e=l(e,"photosets"),c(e),e.photoset){e.data=e.photoset,delete e.photoset;for(var n=0;n<e.data.length;n++){var o=e.data[n];o.name=o.title._content,o.photos="https://api.flickr.com/services/rest"+t("flickr.photosets.getPhotos",{photoset_id:o.id},!0)}}return e},"me/photos":function(e){return r(e),s(e)},"default":function(e){return r(e),s(e)}},xhr:!1,jsonp:function(e,t){"get"==e.method&&(delete t.callback,t.jsoncallback=e.callbackID)}}})}(hello),function(e){function t(e){!e.meta||400!==e.meta.code&&401!==e.meta.code||(e.error={code:"access_denied",message:e.meta.errorDetail})}function n(e){e&&e.id&&(e.thumbnail=e.photo.prefix+"100x100"+e.photo.suffix,e.name=e.firstName+" "+e.lastName,e.first_name=e.firstName,e.last_name=e.lastName,e.contact&&e.contact.email&&(e.email=e.contact.email))}function o(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t.v=20121125,!0}e.init({foursquare:{name:"FourSquare",oauth:{version:2,auth:"https://foursquare.com/oauth2/authenticate",grant:"https://foursquare.com/oauth2/access_token"},refresh:!0,base:"https://api.foursquare.com/v2/",get:{me:"users/self","me/friends":"users/self/friends","me/followers":"users/self/friends","me/following":"users/self/friends"},wrap:{me:function(e){return t(e),e&&e.response&&(e=e.response.user,n(e)),e},"default":function(e){if(t(e),e&&"response"in e&&"friends"in e.response&&"items"in e.response.friends){e.data=e.response.friends.items,delete e.response;for(var o=0;o<e.data.length;o++)n(e.data[o])}return e}},xhr:o,jsonp:o}})}(hello),function(e){function t(e,t){var n=t?t.statusCode:e&&"meta"in e&&"status"in e.meta&&e.meta.status;(401===n||403===n)&&(e.error={code:"access_denied",message:e.message||(e.data?e.data.message:"Could not get response")},delete e.message)}function n(e){e.id&&(e.thumbnail=e.picture=e.avatar_url,e.name=e.login)}function o(e,t){if(e.data&&e.data.length&&t&&t.Link){var n=t.Link.match(/<(.*?)>;\s*rel=\"next\"/);n&&(e.paging={next:n[1]})}}e.init({github:{name:"GitHub",oauth:{version:2,auth:"https://github.com/login/oauth/authorize",grant:"https://github.com/login/oauth/access_token",response_type:"code"},scope:{basic:"",email:"user:email"},base:"https://api.github.com/",get:{me:"user","me/friends":"user/following?per_page=@{limit|100}","me/following":"user/following?per_page=@{limit|100}","me/followers":"user/followers?per_page=@{limit|100}","me/like":"user/starred?per_page=@{limit|100}"},wrap:{me:function(e,o){return t(e,o),n(e),e},"default":function(e,i,a){if(t(e,i),"[object Array]"===Object.prototype.toString.call(e)){e={data:e},o(e,i,a);for(var r=0;r<e.data.length;r++)n(e.data[r])}return e}},xhr:function(e){return"get"!==e.method&&e.data&&(e.headers=e.headers||{},e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data))),!0}}})}(hello),function(e){"use strict";function t(e){return parseInt(e,10)}function n(e){e.error||(e.name||(e.name=e.title||e.message),e.picture||(e.picture=e.thumbnailLink),e.thumbnail||(e.thumbnail=e.thumbnailLink),"application/vnd.google-apps.folder"===e.mimeType&&(e.type="folder",e.files="https://www.googleapis.com/drive/v2/files?q=%22"+e.id+"%22+in+parenLine truncated
|
||||||
|
var UAParser=function(uastring,extensions){if(!(this instanceof UAParser)){return new UAParser(uastring,extensions).getResult()}var ua=uastring||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:EMPTY);var rgxmap=extensions?util.extend(regexes,extensions):regexes;this.getBrowser=function(){return mapper.rgx.apply(this,rgxmap.browser)};this.getCPU=function(){return mapper.rgx.apply(this,rgxmap.cpu)};this.getDevice=function(){return mapper.rgx.apply(this,rgxmap.device)};this.getEngine=function(){return mapper.rgx.apply(this,rgxmap.engine)};this.getOS=function(){return mapper.rgx.apply(this,rgxmap.os)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return ua};this.setUA=function(uastring){ua=uastring;return this};this.setUA(ua)};UAParser.VERSION=LIBVERSION;UAParser.BROWSER={NAME:NAME,MAJOR:MAJOR,VERSION:VERSION};UAParser.CPU={ARCHITECTURE:ARCHITECTURE};UAParser.DEVICE={MODEL:MODEL,VENDOR:VENDOR,TYPE:TYPE,CONSOLE:CONSOLE,MOBILE:MOBILE,SMARTTV:SMARTTV,TABLET:TABLET,WEARABLE:WEARABLE,EMBEDDED:EMBEDDED};UAParser.ENGINE={NAME:NAME,VERSION:VERSION};UAParser.OS={NAME:NAME,VERSION:VERSION};if(typeof exports!==UNDEF_TYPE){if(typeof module!==UNDEF_TYPE&&module.exports){exports=module.exports=UAParser}exports.UAParser=UAParser}else{window.UAParser=UAParser;if(typeof define===FUNC_TYPE&&define.amd){define(function(){return UAParser})}var $=window.jQuery||window.Zepto;if(typeof $!==UNDEF_TYPE){var parser=new UAParser;$.ua=parser.getResult();$.ua.get=function(){return parser.getUA()};$.ua.set=function(uastring){parser.setUA(uastring);var result=parser.getResult();for(var prop in result){$.ua[prop]=result[prop]}}}}})(this);
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
var hello=function(e){return hello.use(e)};hello.utils={extend:function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0;n<t.length;n++){var o=t[n];if(e instanceof Object&&o instanceof Object&&e!==o)for(var i in o)e[i]=hello.utils.extend(e[i],o[i]);else e=o}return e}},hello.utils.extend(hello,{settings:{redirect_uri:window.location.href.split("#")[0],response_type:"token",display:"popup",state:"",oauth_proxy:"https://auth-server.herokuapp.com/proxy",timeout:2e4,default_service:null,force:!0,page_uri:window.location.href},service:function(e){return"undefined"!=typeof e?this.utils.store("sync_service",e):this.utils.store("sync_service")},services:{},use:function(e){var t=this.utils.objectCreate(this);return t.settings=this.utils.objectCreate(this.settings),e&&(t.settings.default_service=e),t.utils.Event.call(t),t},init:function(e,t){var n=this.utils;if(!e)return this.services;for(var o in e)e.hasOwnProperty(o)&&"object"!=typeof e[o]&&(e[o]={id:e[o]});n.extend(this.services,e);for(o in this.services)this.services.hasOwnProperty(o)&&(this.services[o].scope=this.services[o].scope||{});return t&&(n.extend(this.settings,t),"redirect_uri"in t&&(this.settings.redirect_uri=n.url(t.redirect_uri).href)),this},login:function(){var e=this.use(),t=e.utils,n=t.args({network:"s",options:"o",callback:"f"},arguments);e.args=n;var o,i=n.options=t.merge(e.settings,n.options||{});if(n.network=e.settings.default_service=n.network||e.settings.default_service,e.on("complete",n.callback),"string"!=typeof n.network||!(n.network in e.services))return e.emitAfter("error complete",{error:{code:"invalid_network",message:"The provided network was not recognized"}}),e;var a=e.services[n.network],r=!1,s=t.globalEvent(function(n){var o;o=n?JSON.parse(n):{error:{code:"cancelled",message:"The authentication was not completed"}},r=!0,o.error?e.emit("complete error failed auth.failed",{error:o.error}):(t.store(o.network,o),e.emit("complete success login auth.login auth",{network:o.network,authResponse:o}))}),l=t.url(i.redirect_uri).href,u=a.oauth.response_type||i.response_type;"code"!==u||a.oauth.grant||(u="token"),n.qs={client_id:a.id,response_type:u,redirect_uri:l,display:i.display,scope:"basic",state:{client_id:a.id,network:n.network,display:i.display,callback:s,state:i.state,redirect_uri:l}};var c=t.store(n.network),d=(i.scope||"").toString();if(d=(d?d+",":"")+n.qs.scope,c&&"scope"in c&&c.scope instanceof String&&(d+=","+c.scope),n.qs.state.scope=t.unique(d.split(/[,\s]+/)).join(","),n.qs.scope=d.replace(/[^,\s]+/gi,function(t){if(t in a.scope)return a.scope[t];for(var n in e.services){var o=e.services[n].scope;if(o&&t in o)return""}return t}).replace(/[,\s]+/gi,","),n.qs.scope=t.unique(n.qs.scope.split(/,+/)).join(a.scope_delim||","),i.force===!1&&c&&"access_token"in c&&c.access_token&&"expires"in c&&c.expires>(new Date).getTime()/1e3){var f=t.diff(c.scope||[],n.qs.state.scope||[]);if(0===f.length)return e.emitAfter("complete success login",{unchanged:!0,network:n.network,authResponse:c}),e}if("page"===i.display&&i.page_uri&&(n.qs.state.page_uri=t.url(i.page_uri).href),"login"in a&&"function"==typeof a.login&&a.login(n),("token"!==u||parseInt(a.oauth.version,10)<2||"none"===i.display&&a.oauth.grant&&c&&c.refresh_token)&&(n.qs.state.oauth=a.oauth,n.qs.state.oauth_proxy=i.oauth_proxy),n.qs.state=JSON.stringify(n.qs.state),1===parseInt(a.oauth.version,10)?o=t.qs(i.oauth_proxy,n.qs):"none"===i.display&&a.oauth.grant&&c&&c.refresh_token?(n.qs.refresh_token=c.refresh_token,o=t.qs(i.oauth_proxy,n.qs)):o=t.qs(a.oauth.auth,n.qs),e.emit("notice","Authorization URL "+o),"none"===i.display)t.iframe(o);else if("popup"===i.display)var p=t.popup(o,l,i.window_width||500,i.window_height||550),m=setInterval(function(){if((!p||p.closed)&&(clearInterval(m),!r)){var t={code:"cancelled",message:"Login has been cancelled"};p||(t={code:"blocked",message:"Popup was blocked"}),e.emit("complete failed error",{error:t,network:n.network})}},100);else window.location=o;return e},logout:function(){var e=this.use(),t=e.utils,n=t.args({name:"s",options:"o",callback:"f"},arguments);if(n.options=n.options||{},e.on("complete",n.callback),n.name=n.name||e.settings.default_service,!n.name||n.name in e.services)if(n.name&&t.store(n.name)){var o=function(t){e.utils.store(n.name,""),e.emitAfter("complete logout success auth.logout auth",hello.utils.merge({network:n.name},t||{}))},i={};if(n.options.force){var a=e.services[n.name].logout;if(a)if("function"==typeof a&&(a=a(o)),"string"==typeof a)t.iframe(a),i.force=null,i.message="Logout success on providers site was indeterminate";else if(void 0===a)return e}o(i)}else if(n.name)e.emitAfter("complete error",{error:{code:"invalid_session",message:"There was no session to remove"}});else{for(var r in e.services)e.services.hasOwnProperty(r)&&e.logout(r);e.service(!1)}else e.emitAfter("complete error",{error:{code:"invalid_network",message:"The network was unrecognized"}});return e},getAuthResponse:function(e){return e=e||this.sLine truncated
|
||||||
|
}function r(e){e&&e.stat&&"ok"!=e.stat.toLowerCase()&&(e.error={code:"invalid_request",message:e.message})}function s(e){if(e.photoset||e.photos){var t="photoset"in e?"photoset":"photos";e=l(e,t),c(e),e.data=e.photo,delete e.photo;for(var n=0;n<e.data.length;n++){var o=e.data[n];o.name=o.title,o.picture=a(o.id,o.farm,o.server,o.secret,""),o.source=a(o.id,o.farm,o.server,o.secret,"b"),o.thumbnail=a(o.id,o.farm,o.server,o.secret,"m")}}return e}function l(e,t){return t in e?e=e[t]:"error"in e||(e.error={code:"invalid_request",message:e.message||"Failed to get data from Flickr"}),e}function u(e){if(r(e),e.contacts){e=l(e,"contacts"),c(e),e.data=e.contact,delete e.contact;for(var t=0;t<e.data.length;t++){var n=e.data[t];n.id=n.nsid,n.name=n.realname||n.username,n.thumbnail=i(n,"m")}}return e}function c(e){e.page&&e.pages&&e.page!==e.pages&&(e.paging={next:"?page="+ ++e.page})}e.init({flickr:{name:"Flickr",oauth:{version:"1.0a",auth:"https://www.flickr.com/services/oauth/authorize?perms=read",request:"https://www.flickr.com/services/oauth/request_token",token:"https://www.flickr.com/services/oauth/access_token"},base:"https://api.flickr.com/services/rest",get:{me:o("flickr.people.getInfo"),"me/friends":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/following":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/followers":o("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/albums":o("flickr.photosets.getList",{per_page:"@{limit|50}"}),"me/photos":o("flickr.people.getPhotos",{per_page:"@{limit|50}"})},wrap:{me:function(e){if(r(e),e=l(e,"person"),e.id){if(e.realname){e.name=e.realname._content;var t=e.name.split(" ");e.first_name=t[0],e.last_name=t[1]}e.thumbnail=i(e,"l"),e.picture=i(e,"l")}return e},"me/friends":u,"me/followers":u,"me/following":u,"me/albums":function(e){if(r(e),e=l(e,"photosets"),c(e),e.photoset){e.data=e.photoset,delete e.photoset;for(var n=0;n<e.data.length;n++){var o=e.data[n];o.name=o.title._content,o.photos="https://api.flickr.com/services/rest"+t("flickr.photosets.getPhotos",{photoset_id:o.id},!0)}}return e},"me/photos":function(e){return r(e),s(e)},"default":function(e){return r(e),s(e)}},xhr:!1,jsonp:function(e,t){"get"==e.method&&(delete t.callback,t.jsoncallback=e.callbackID)}}})}(hello),function(e){function t(e){!e.meta||400!==e.meta.code&&401!==e.meta.code||(e.error={code:"access_denied",message:e.meta.errorDetail})}function n(e){e&&e.id&&(e.thumbnail=e.photo.prefix+"100x100"+e.photo.suffix,e.name=e.firstName+" "+e.lastName,e.first_name=e.firstName,e.last_name=e.lastName,e.contact&&e.contact.email&&(e.email=e.contact.email))}function o(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t.v=20121125,!0}e.init({foursquare:{name:"FourSquare",oauth:{version:2,auth:"https://foursquare.com/oauth2/authenticate",grant:"https://foursquare.com/oauth2/access_token"},refresh:!0,base:"https://api.foursquare.com/v2/",get:{me:"users/self","me/friends":"users/self/friends","me/followers":"users/self/friends","me/following":"users/self/friends"},wrap:{me:function(e){return t(e),e&&e.response&&(e=e.response.user,n(e)),e},"default":function(e){if(t(e),e&&"response"in e&&"friends"in e.response&&"items"in e.response.friends){e.data=e.response.friends.items,delete e.response;for(var o=0;o<e.data.length;o++)n(e.data[o])}return e}},xhr:o,jsonp:o}})}(hello),function(e){function t(e,t){var n=t?t.statusCode:e&&"meta"in e&&"status"in e.meta&&e.meta.status;(401===n||403===n)&&(e.error={code:"access_denied",message:e.message||(e.data?e.data.message:"Could not get response")},delete e.message)}function n(e){e.id&&(e.thumbnail=e.picture=e.avatar_url,e.name=e.login)}function o(e,t){if(e.data&&e.data.length&&t&&t.Link){var n=t.Link.match(/<(.*?)>;\s*rel=\"next\"/);n&&(e.paging={next:n[1]})}}e.init({github:{name:"GitHub",oauth:{version:2,auth:"https://github.com/login/oauth/authorize",grant:"https://github.com/login/oauth/access_token",response_type:"code"},scope:{basic:"",email:"user:email"},base:"https://api.github.com/",get:{me:"user","me/friends":"user/following?per_page=@{limit|100}","me/following":"user/following?per_page=@{limit|100}","me/followers":"user/followers?per_page=@{limit|100}","me/like":"user/starred?per_page=@{limit|100}"},wrap:{me:function(e,o){return t(e,o),n(e),e},"default":function(e,i,a){if(t(e,i),"[object Array]"===Object.prototype.toString.call(e)){e={data:e},o(e,i,a);for(var r=0;r<e.data.length;r++)n(e.data[r])}return e}},xhr:function(e){return"get"!==e.method&&e.data&&(e.headers=e.headers||{},e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data))),!0}}})}(hello),function(e){"use strict";function t(e){return parseInt(e,10)}function n(e){e.error||(e.name||(e.name=e.title||e.message),e.picture||(e.picture=e.thumbnailLink),e.thumbnail||(e.thumbnail=e.thumbnailLink),"application/vnd.google-apps.folder"===e.mimeType&&(e.type="folder",e.files="https://www.googleapis.com/drive/v2/files?q=%22"+e.id+"%22+in+parenLine truncated
|
||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
var myManifest = {
|
var myManifest = {
|
||||||
Debug: false,
|
Debug: false,
|
||||||
Name: "Il Lievitario",
|
Name: "Il Lievitario",
|
||||||
Version: "2.3.0",
|
Version: "2.5.0",
|
||||||
Author: "Denis Ironi",
|
Author: "Denis Ironi",
|
||||||
Settings: {
|
Settings: {
|
||||||
DefaultURL: "http://localhost:8081/Service_Manut",
|
//DefaultURL: "http://localhost:8081/Service_Manut",
|
||||||
//DefaultURL: "http://app.gruppolapastamadre.it/Service",
|
DefaultURL: "http://app.gruppolapastamadre.it/Service",
|
||||||
JQueryVersion: "1.11.1",
|
JQueryVersion: "1.11.1",
|
||||||
JQueryMobileVersion: "1.4.3",
|
JQueryMobileVersion: "1.4.3",
|
||||||
Device:{
|
Device:{
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel'],
|
define(['app', 'jquery', 'underscore', 'backbone', 'model/category/categoryModel', 'classes/cachedCollection'],
|
||||||
function (app, $, _, Backbone, Category){
|
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
|
return Categories;
|
||||||
model:Category,
|
});
|
||||||
|
|
||||||
url: function() {
|
|
||||||
return myManifest.Settings.DefaultURL + "/api/categories";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return Categories;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel'],
|
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel', 'classes/cachedCollection'],
|
||||||
function (app, $, _, Backbone, Category){
|
function (app, $, _, Backbone, Category, CachedCollection){
|
||||||
|
|
||||||
var CategoryItems=Backbone.Collection.extend({
|
var CategoryItems=CachedCollection.extend({
|
||||||
|
|
||||||
categoryId: null,
|
categoryId: null,
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
this.categoryId = options.categoryId;
|
this.categoryId = options.categoryId;
|
||||||
|
this.cacheName = "Category" + this.categoryId;
|
||||||
},
|
},
|
||||||
// Book is the model of the collection
|
// Book is the model of the collection
|
||||||
model:Category,
|
model:Category,
|
||||||
|
|||||||
@@ -1,66 +1,62 @@
|
|||||||
define(['jquery', 'underscore', 'backbone','text!modules/category/categoryViewTemplate.html', 'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView'],
|
define(['jquery', 'underscore', 'backbone', 'text!modules/category/categoryViewTemplate.html', 'text!modules/category/categoryItemTemplate.html', 'modules/base/baseView'],
|
||||||
function($, _, Backbone, categoryViewTemplate, categoryItemTemplate, 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,
|
var items = this.itemtemplate({data: this.collection.toJSON()});
|
||||||
categoryName: null,
|
|
||||||
//initialize template
|
$ul.html(items);
|
||||||
template:_.template(categoryViewTemplate),
|
$ul.listview("refresh");
|
||||||
itemtemplate:_.template(categoryItemTemplate),
|
$ul.trigger("updatelayout");
|
||||||
|
|
||||||
initialize: function (options) {
|
$ul.find('input[type=radio].star').rating({
|
||||||
var self = this;
|
callback: function (value, link) {
|
||||||
CategoryView.__super__.initialize.call(this);
|
var tip = $('#hover-test');
|
||||||
this.collection = options.collection;
|
if (value === undefined)
|
||||||
this.categoryName = options.categoryName;
|
{
|
||||||
this.collection.fetch({
|
$('#hover-test').html("Nessuna" || 'value: ');
|
||||||
success: function(data, textStatus, jqXHR){
|
}
|
||||||
self.renderItem();
|
else
|
||||||
}
|
$('#hover-test').html(link.title || 'value: ' + value);
|
||||||
//success: function(){ self.renderItem(); }
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
$.mobile.loading('hide');
|
||||||
renderItem: function(){
|
//$( '[data-alpha="true"]' ).alphascroll();
|
||||||
var $ul = $('#allRicette');
|
},
|
||||||
|
//render the content into div of view
|
||||||
var items = this.itemtemplate({data:this.collection.toJSON()});
|
render: function () {
|
||||||
|
//this.header.title = "pippo";
|
||||||
$ul.html( items );
|
CategoryView.__super__.render.call(this);
|
||||||
$ul.listview( "refresh" );
|
//this.el is the root element of Backbone.View. By default, it is a div.
|
||||||
$ul.trigger( "updatelayout");
|
//$el is cached jQuery object for the view's element.
|
||||||
|
//append the compiled template into view div container
|
||||||
$ul.find('input[type=radio].star').rating({
|
this.$el.append(this.header.$el);
|
||||||
callback: function (value, link) {
|
this.$el.append(this.template({categoryName: this.categoryName}));
|
||||||
var tip = $('#hover-test');
|
this.$el.append(this.footer.$el);
|
||||||
if (value === undefined)
|
//return to enable chained calls
|
||||||
{
|
this.$el.find("#indexBtn").addClass("ui-btn-active");
|
||||||
$('#hover-test').html("Nessuna" || 'value: ');
|
return this;
|
||||||
}
|
}
|
||||||
else
|
});
|
||||||
$('#hover-test').html(link.title || 'value: ' + value);
|
return CategoryView;
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$.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;
|
|
||||||
});
|
|
||||||
+129
-158
@@ -1,164 +1,135 @@
|
|||||||
define(['jquery', 'underscore', 'backbone','text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
define(['jquery', 'underscore', 'backbone', 'text!modules/sync/syncViewTemplate.html', 'modules/base/baseView', 'classes/profile'],
|
||||||
function($, _, Backbone, syncViewTemplate, BaseView, Profile){
|
function ($, _, Backbone, syncViewTemplate, BaseView, Profile) {
|
||||||
|
|
||||||
var SyncView = BaseView.extend({
|
var SyncView = BaseView.extend({
|
||||||
|
//initialize template
|
||||||
//initialize template
|
template: _.template(syncViewTemplate),
|
||||||
template:_.template(syncViewTemplate),
|
initialize: function (options) {
|
||||||
|
SyncView.__super__.initialize.call(this);
|
||||||
initialize: function (options) {
|
if (options &&
|
||||||
SyncView.__super__.initialize.call(this);
|
options.tokenFound == 1)
|
||||||
if(options &&
|
|
||||||
options.tokenFound == 1)
|
|
||||||
{
|
|
||||||
if(window.localStorage.getItem("tryLogin")=="fb")
|
|
||||||
{
|
{
|
||||||
this.fbAfterLogin();
|
this.updateLoginBtn();
|
||||||
}
|
}
|
||||||
else if(window.localStorage.getItem("tryLogin")=="gplus")
|
window.localStorage.setItem("tryLogin", null);
|
||||||
{
|
},
|
||||||
this.gPlusAfterLogin();
|
events: {
|
||||||
}
|
"click #backBtn": "backBtn",
|
||||||
}
|
"click #fblogin": "fbLogin",
|
||||||
window.localStorage.setItem("tryLogin", null);
|
"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: {
|
hello('facebook').login();
|
||||||
"click #backBtn": "backBtn",
|
},
|
||||||
"click #fblogin": "fbLogin",
|
fbAfterLogin: function ()
|
||||||
"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
|
|
||||||
{
|
{
|
||||||
this.$el.find("#fblogin").removeClass("logoutfb");
|
/*
|
||||||
this.$el.find("#fblogin").addClass("loginfb");
|
var self = this;
|
||||||
this.$el.find("#gpluslogin").removeClass("logoutgplus");
|
openFB.api({
|
||||||
this.$el.find("#gpluslogin").addClass("logingplus");
|
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;
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
return SyncView;
|
||||||
//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;
|
|
||||||
});
|
|
||||||
+4
-2
@@ -4,14 +4,14 @@ define(['jquery', 'underscore', 'backbone',
|
|||||||
'modules/sync/sync', 'modules/converter/converter', 'modules/donation/donation', 'modules/settings/settings',
|
'modules/sync/sync', 'modules/converter/converter', 'modules/donation/donation', 'modules/settings/settings',
|
||||||
'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection',
|
'model/note/noteCollection', 'model/category/categoryCollection', 'model/categoryItem/categoryItemCollection',
|
||||||
'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection',
|
'model/item/itemCollection', 'model/item/ingredientiCollection', 'model/categoryItem/foundItemCollection',
|
||||||
'libs/fastclick', 'jqm', 'jQueryPlugins'],
|
'libs/fastclick', 'classes/cache', 'jqm', 'jQueryPlugins'],
|
||||||
function ($, _, Backbone,
|
function ($, _, Backbone,
|
||||||
HomeView, FaqView, IndexView, CategoryView, ItemView,
|
HomeView, FaqView, IndexView, CategoryView, ItemView,
|
||||||
AboutView, SearchView, FoundView, MoreView, NoteView,
|
AboutView, SearchView, FoundView, MoreView, NoteView,
|
||||||
SyncView, ConverterView, DonationView, SettingsView,
|
SyncView, ConverterView, DonationView, SettingsView,
|
||||||
NoteCollection, CategoryCollection, CategoryItemCollection,
|
NoteCollection, CategoryCollection, CategoryItemCollection,
|
||||||
ItemCollection, IngredientiCollection, FoundItemCollection,
|
ItemCollection, IngredientiCollection, FoundItemCollection,
|
||||||
FastClick) {
|
FastClick, Cache) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
var Router = Backbone.Router.extend({
|
var Router = Backbone.Router.extend({
|
||||||
@@ -84,6 +84,8 @@ define(['jquery', 'underscore', 'backbone',
|
|||||||
this.changePage(faqView);
|
this.changePage(faqView);
|
||||||
},
|
},
|
||||||
showIndex: function (actions) {
|
showIndex: function (actions) {
|
||||||
|
Cache.checkCacheFromServer();
|
||||||
|
|
||||||
var categories = new CategoryCollection();
|
var categories = new CategoryCollection();
|
||||||
// will render home view and navigate to homeView
|
// will render home view and navigate to homeView
|
||||||
var indexView = new IndexView({collection: categories});
|
var indexView = new IndexView({collection: categories});
|
||||||
|
|||||||
@@ -2,20 +2,6 @@
|
|||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<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">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<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>
|
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
+63
@@ -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, joost@yoast.com
|
||||||
|
*/
|
||||||
|
// 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
@@ -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>
|
||||||
@@ -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>
|
||||||
Reference in new issue
Block a user