Compare commits

..

No commits in common. "master" and "push_ed_eventi" have entirely different histories.

19 changed files with 139 additions and 476 deletions

7
.gitignore vendored
View file

@ -1,10 +1,3 @@
#Specific Android sec file#
###########################
ilovexm24.keystore
myBuildConfig.json
# Compiled platform #
###################
platforms/

View file

@ -1,48 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10501" android:versionName="1.5.1" package="xm24.digitigrafo.it" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" />
</provider>
<activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" android:permission="${applicationId}.permission.PushHandlerActivity" />
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
<receiver android:exported="true" android:name="com.google.android.gms.gcm.GcmReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<service android:exported="false" android:name="com.adobe.phonegap.push.GCMIntentService">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service android:exported="false" android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service android:exported="false" android:name="com.adobe.phonegap.push.RegistrationIntentService" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="${applicationId}.permission.PushHandlerActivity" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<permission android:name="${applicationId}.permission.PushHandlerActivity" android:protectionLevel="signature" />
</manifest>

View file

@ -3,7 +3,6 @@ App per xm, prende i contenuti dal sito e te li salva nel cellulare.
<img src="https://git.lattuga.net/hacklabbo/Ilovexm24/raw/master/screenshot_post.png" style="width:300px;border:solid 1px black;border-radius:20px;" />
<img src="https://git.lattuga.net/hacklabbo/Ilovexm24/raw/master/screenshot_eventi.png" style="width:300px;border:solid 1px black;border-radius:20px;" />
<img src="https://git.lattuga.net/hacklabbo/Ilovexm24/raw/master/screenshot_menu.png" style="width:300px;border:solid 1px black;border-radius:20px;" />
<img src="https://git.lattuga.net/hacklabbo/Ilovexm24/raw/master/screenshot_lab.png" style="width:300px;border:solid 1px black;border-radius:20px;" />
## Environment ##
@ -88,46 +87,6 @@ Per installare il plugin sulla rete che non viene installato in automatico
Per lanciare l'emulatore Android con l'applicazione.
Ovviamente si deve aver configurato il proprio environment correttamente.
## Aggiornamento
Siam passati allal versione di Cordova 9 e la versione della piattaforma Android 8, per verificare, nella cartella del progetto IloveXM24:
$ cordova -v
9.0.0 (cordova-lib@9.0.1)
$ cordova platform list
Installed platforms:
android 8.0.0
I plugin così:
$ cordova plugin list
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-file 4.3.3 "File"
cordova-plugin-media 3.0.1 "Media"
cordova-plugin-network-information 1.3.4 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.1.8 "SocialSharing"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
es6-promise-plugin 4.2.2 "Promise"
phonegap-plugin-push 1.9.4 "PushPlugin"
E le API dell'sdk Android, ora hanno target 28!
Per aggiornarle, da linea di comando, nella cartella dove avete l'ambiente android, io ce l'ho in home/.android/
$ ./android update sdk
Accettate le malvagie licenze e scaricate.
Poi il build pare funzionare :) yhuuu!
Non ricordo se era bloccante o no, ma ci siamo fatte una copia dell AndroidManifest.xml dopo aver aggiunto la platform, così:
cd platforms/android/app/
cp src/main/AndroidManifest.xml AndroidManifest.xml
## build app
cordova build android --release --buildConfig=myBuildConfig.json
### iOS ###
Installando `phonegap-plugin-push` se si incontra questo errore:
@ -140,27 +99,7 @@ Error: CocoaPods was not found. Please install version 1.0.1 or greater from htt
Occore installare `CocoaPods` come descritto sulla [documentazione del plugin](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#ios-details)
## Download ##
## Google Play ##
Solo per chi ha un account google.
Sconsigliamo l'installazione dal Google Play perche' google come multinazionale profila ogni tuo gusto e l'utilizza a scopo commerciale. In pratica ti tratta come merce per accaparrarsi profitto. Se ti e' possibile quindi utilizza fdroid.
https://play.google.com/store/apps/details?id=xm24.digitigrafo.it
## Repository Privato Fdroid ##
Repository gestito da hacklabbo, non e' il repository fdroid ufficiale.
Per poter utilizzare questo repository devi comunque scaricare l'applicazione [fdroid](https://f-droid.org/) e aggiungere questo repository ed attivarlo nella configurazione dell'applicazaione. E' un operazione piuttosto semplice da effettuare.
https://fdroid.hacklabbo.indivia.net/
P.S. Per chi sviluppa: ad ogni commit sarebbe opportuno aumentare l'ultima cifra della versione in config.xml (riga 2: version=1.0.2 -> version=1.0.3) in modo che fdroid riconosca e proponga l'aggiornamento.
## TODO, ISSUE e FEATURE ##
Usiamo l'[issue tracker](https://git.lattuga.net/hacklabbo/Ilovexm24/issues) non il wiki.

BIN
android-debug.apk Normal file

Binary file not shown.

View file

@ -1,17 +1,19 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="xm24.digitigrafo.it" version="1.5.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>I love XM24</name>
<widget id="xm24.digitigrafo.it" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>I XM24</name>
<description>
Spazio Sociale Autogestito XM24, Bolognina (BO): info, eventi, comunicati.. I love XM24, iloveXM24
XM24
</description>
<author email="hacklabbo@indivia.net" href="http://hacklabbo.indivia.net">
hacklabbo.indivia.net
<author email="info@digitigrafo.it" href="http://hacklabbo.indivia.net">
hacklabbo.indivia.net - digitigrafo.it
</author>
<content src="index.html" />
<preference name="SplashScreen" value="res/splashscreen.png" />
<preference name = "SplashScreen" value = "res/splashscreen.png" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
@ -20,36 +22,28 @@
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<icon src="res/icon.png" />
<allow-intent href = "market:*" />
<icon src = "res/icon.png" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name = "SplashScreen" value = "res/splashscreen.png" />
<splash src = "res/splashscreen.png" />
<preference name = "AutoHideSplashScreen" value="false" />
<preference name = "SplashScreen" value = "splashscreen" />
<preference name = "SplashScreenDelay" value="3000" />
<preference name = "SplashMaintainAspectRatio" value="true" />
<preference name = "SplashShowOnlyFirstTime" value="false" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="SplashScreen" value="res/splashscreen.png" />
<splash src="res/splashscreen.png" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreen" value="splashscreen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-file" spec="~4.3.3" />
<plugin name="cordova-plugin-media" spec="~3.0.1" />
<plugin name="cordova-plugin-network-information" spec="~1.3.3">
<variable name="SENDER_ID" value="667898382143" />
</plugin>
<plugin name="cordova-plugin-splashscreen" spec="~4.0.3">
<variable name="SENDER_ID" value="667898382143" />
</plugin>
<plugin name="cordova-plugin-whitelist" spec="~1.3.2" />
<plugin name="cordova-plugin-x-socialsharing" spec="~5.1.8">
<variable name="SENDER_ID" value="667898382143" />
</plugin>
<plugin name="cordova-sqlite-storage" spec="~2.0.4" />
<plugin name="phonegap-plugin-push" spec="~1.9.4">
<variable name="SENDER_ID" value="667898382143" />
</plugin>
<engine name="android" spec="^8.0.0" />
<plugin name="cordova-sqlite-storage" spec="~2.0.2" />
<plugin name="cordova-plugin-media" spec="~3.0.0" />
<plugin name="cordova-plugin-splashscreen" />
</widget>

View file

@ -1,43 +0,0 @@
#!/usr/bin/env node
//
// This hook removes specific permissions from the AndroidManifest.xml
// The AndroidManifest is re-generated during the prepare stage,
// so this must be run on the "after_prepare" hook.
//
// Configure the permissions to be forcefully removed.
// NOTE: These permissions will be removed regardless of how many plugins
// require the permission. You can check the permission is only required
// by the plugin you *think* needs it, by looking at the "count" shown in
// your /plugins/android.json file.
// If the count is more than 1, you should search through
// the /plugins//plugin.xml files for <uses-permission> tags.
var permsToRm = [ "RECORD_AUDIO", "MODIFY_AUDIO_SETTINGS", "READ_PHONE_STATE" ];
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
var manifestFile = path.join(rootdir, "plugin/cordova-plugin-media/config.xml");
/*
"platforms/android/app/AndroidManifest.xml"
*/
fs.readFile( manifestFile, "utf8", function( err, data ) {
if (err)
return console.log( "Error reading plugin/cordova-plugin-media/config.xml", err );
var result = data;
for(var i = 0; i < permsToRm.length; i++) {
var search = '<uses-permission android:name="android.permission.' + permsToRm[i] + '" />';
result = result.replace(search, '');
}
fs.writeFile( manifestFile, result, "utf8", function( err ){
if (err)
return console.log( "Error writing AndroidManifest.xml", err );
});
} );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 131 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -56,7 +56,7 @@
<body>
<!--panel -->
<div data-role="panel" data-position="left" id="outside" data-theme="a" data-position-fixed="true" data-display="overlay" data-swipe-close="true">
<p><img src="image/xm-logo.png" class="panel_logo" /></p>
<p><img src="image/ilovexm24_menu.png" class="panel_logo" /></p>
<ul data-role="listview">
<li><a class="nav" href="#info">Home</a></li>
<li><a class="nav" href="#ilove">I love XM24</a></li>

View file

@ -54,12 +54,11 @@ EVENTS.getDataAndLoad = function (type) {
var evDesc = ai1ec.event.getDescription(event);
var evUrl = ai1ec.event.getUrl(event);
var evGeo = ai1ec.event.getGeo(event);
var evImg = ai1ec.event.getImage(event);
var evInitDate = EVENTS.formatDate(ai1ec.event.getInitDate(event), EVENTS.storeDateFormat);
var evEndDate = EVENTS.formatDate(ai1ec.event.getEndDate(event), EVENTS.storeDateFormat);
FONTE.dbHandler.executeSql('INSERT INTO ' + table + ' VALUES (?,?,?,?,?,?,?,?)', [evId, evTitle, evDesc, evInitDate, evEndDate, evUrl, evGeo, evImg],
FONTE.dbHandler.executeSql('INSERT INTO ' + table + ' VALUES (?,?,?,?,?,?,?)', [evId, evTitle, evDesc, evInitDate, evEndDate, evUrl, evGeo],
//onSuccess
function (resultSet) {
n_evs_ins++;

View file

@ -1,6 +1,6 @@
var ai1ec = (function(){
var API = {}, json = [], events = [];
//Categorie di eventi
API.cats = {
single: 34,
@ -12,60 +12,56 @@ var ai1ec = (function(){
endChar = uid.indexOf('@');
return uid.substr(initChar+1, uid.length - uid.substr(endChar -1).length - initChar );
};
};
//Parser di un evento dell'array tornato da getXmlData
API.event = {
getId : function(event) {
return event.properties.uid ? getCleanId(event.properties.uid.text) : null;
return event.uid ? getCleanId(event.uid) : null;
},
getTitle : function(event) {
return event.properties.summary.text || null;
return event.summary || null;
},
getDescription : function(event) {
return event.properties.description.text || "";
return event.description || "";
},
getInitDate : function(event) {
return event.properties.dtstart && event.properties.dtstart["date-time"] ? event.properties.dtstart["date-time"] : "";
return event.dtstart && event.dtstart._ ? event.dtstart._ : "";
},
getEndDate : function(event) {
return event.properties.dtend && event.properties.dtend["date-time"] ? event.properties.dtend["date-time"] : "";
return event.dtend && event.dtend._ ? event.dtend._ : "";
},
getCats : function(event) {
return event.properties.categories.text || "";
return event.categories || "";
},
getTags : function(event) {
return event.properties["x-tags"] && event.properties["x-tags"]._ ? event.properties["x-tags"]._ : "";
return event["x-tags"] && event["x-tags"]._ ? event["x-tags"]._ : "";
},
getUrl : function(event) {
return event.properties.url && event.properties.url.uri && event.properties.url.uri ? event.properties.url.uri : "";
return event.url && event.url.$ && event.url.$.uri ? event.url.$.uri : "";
},
getContact : function(event) {
return event.properties.contact || "";
return event.contact || "";
},
getGeo : function(event) {
return event.properties.location.text || "";
return event.geo || "";
},
//Regole per gli eventi ripetitivi
//Regole per gli evebti ripetitivi
getRule : function(event) {
return event.properties.rrule || "";
return event.rrule || "";
},
getImage : function(event){
return event.properties['x-wp-images-url'] && event.properties['x-wp-images-url'].unknown ? event.properties['x-wp-images-url'].unknown : "";
},
};
var getXmlData = function(url, catId, callback) {
$.ajax({
url: url,
@ -73,7 +69,7 @@ var ai1ec = (function(){
method: 'GET',
success: function(res) {
json[catId] = $.xml2json(res);
events[catId] = json[catId]["#document"].icalendar.vcalendar.components.vevent;
events[catId] = json[catId]["#document"].vcalendar.vevent;
console.log(events[catId]);
return callback(events[catId]);
},
@ -83,13 +79,13 @@ var ai1ec = (function(){
}
});
};
var getDefaultUrl = function(catId){
catId = catId || API.cats.single;
return API.remote.site + API.remote.q + "&" + API.remote.catq + catId + "&" + API.remote.xmlq;
};
}
//Oggetto che gestisce attività remote
API.remote = {
site : 'http://www.ecn.org/xm24',
@ -99,20 +95,20 @@ var ai1ec = (function(){
xmlq : 'xml=true',
win : 'window=true',
//post_ids
//Torna un array con tutti gli eventi organizzati da xm24, un array vuoto se errore.
getAllEvents : function(catId, callback) {
var url = getDefaultUrl(catId);
getXmlData(url, catId, callback);
},
},
//Torna un array con gli eventi tra -30 e +30 giorni da oggi, un array vuoto se errore.
getLastEvents : function(catId, callback) {
var url = getDefaultUrl(catId) + '&' + API.remote.win;
getXmlData(url, catId, callback);
},
},
}
return API;
})();

View file

@ -12,12 +12,12 @@ PROJECT.labs = [
old_event: "", //un vecchio evento
site: "http://ampioraggio.noblogs.org", //sito personale
contatto : "", //email
page: "http://www.ecn.org/xm24/ciclofficina-ampioraggio", //pagina su sito xm24
page: "http://www.ecn.org/xm24/?page_id=16", //pagina su sito xm24
sn: "", //social network
},
{ collettivo: "SIM",
dshort: '“Nessuno educa nessuno, nessuno educa se stesso, gli uomini'+
'si educano insieme, con la mediazione del mondo.” Paulo Freire',
'si educano insieme, con la mediazione del mondo.” Paulo Freire,',
dlong: "La Scuola dItaliano CON migranti del XM24 è una scuola "+
"autogestita che unisce al percorso linguistico un percorso politico, sia "+
"perchè si oppone alle leggi razziste dello stato, sia perchè concepisce "+
@ -25,33 +25,27 @@ PROJECT.labs = [
"di emancipazione, autodefinizione e socializzazione.",
when : [
{day: "Lun", hour: ["19:00", "21:00"], title:"Scuola Italiano con Migranti"},
{day: "Lun", hour: ["21:00", "23:00"], title:"Assemlea di gestione SIM"},
{day: "Mar", hour: ["19:00", "21:00"], title:"Scuola Italiano con Migranti"}
{day: "Mar", hour: ["19:00", "21:00"], title:"Scuola Italiano con Migranti"},
{day: "Mer", hour: ["19:00", "21:00"], title:"Scuola Italiano con Migranti"}
],
old_event: "", //un vecchio evento
site: "http://simxm24.noblogs.org", //sito personale
contatto : "", //email
page: "", //pagina su sito xm24
sn: "https://www.fb.com/infoschockxm24", //social network
sn: "", //social network
},
{ collettivo: "Hacklabbo",
dshort: "Serata di smanettamento collettivo, giochi, confronto. Sottoterra nascono idee, "+
"serpeggiano progetti, si condividono codice, saldatori e birrette.",
dlong: "Analizziamo e smontiamo e scardiniamoLe tecnologie invasive, limposizione "+
"di una socialita predigerita da parte dei colossi dellinformatica "+
"e dei media, la profilazione, la censura licenze limitanti e brevetti "+
"Rivendicando la libera circolazione "+
"(analogica e digitale) dellinformazione, il diritto alla privacy, "+
"allanonimato e alla liberta di espressione ed invenzione. Condividiamo "+
"conoscenza autoproducendo dal basso strumenti alternativi ed infrastrutture "+
"autonome di comunicazione per una partecipazione politica consapevole.",
dshort: "Serata di smanettamento collettivo, giochi, confronto. Sottoterra nascono idee, serpeggiano progetti, si condividono codice, saldatori e birrette.",
dlong: "Le tecnologie invasive, limposizione di una socialita predigerita da parte dei colossi dellinformatica e dei media, la profilazione pervasiva a scopo commerciale e di controllo sociale, la censura governativa ed aziendale e la commercializzazione di massa di prodotti hardware e software che utilizzano licenze limitanti e brevetti intellettuali come armi legali e dogane virtuali sono gabbie sociali in cui lutente viene rinchiuso." +
"Per uscirne analizziamo, smontiamo e scardiniamo le meccaniche in cui ci siamo fatti inscatolare rivendicando la libera circolazione (analogica e digitale) dellinformazione, il diritto alla privacy, allanonimato e alla liberta di espressione ed invenzione e condividiamo conoscenza autoproducendo dal basso strumenti alternativi ed infrastrutture autonome di comunicazione per una partecipazione politica consapevole.",
when : [
{day: "Mer", hour: ["21:00", "24:00"], title:"Hacklabbo" },
{day: "Mer", hour: ["20:00", "23:00"], title:"Hacklabbo" },
],
old_event: "", //un vecchio evento
site: "http://liste.indivia.net/listinfo/hacklabbo", //sito personale
contatto : "", //email
page: "http://www.ecn.org/xm24/hacklabbo/", //pagina su sito xm24
sn: "", //social network
},
{ collettivo: "Infoshock",
dshort: "L InfoShock di XM24 è uno spazio di consultazione e distribuzione "+
@ -60,7 +54,7 @@ PROJECT.labs = [
"sociale, di incontro, confronto e condivisione, un veicolo sperimentale e "+
"creativo per la trasmissione della cultura e della politica.",
when : [
{day: "Giov", hour: ["20:00", "23:00"], title:"Apertura spazio Infoshock" },
{day: "Giov", hour: ["18:00", "23:00"], title:"Apertura spazio Infoshock" },
],
old_event: "", //un vecchio evento
site: "https://infoshockxm24.noblogs.org", //sito personale
@ -74,9 +68,7 @@ PROJECT.labs = [
"applicare la creazione legata al mondo del visuale. La serigrafia come "+
"tecnica di stampa manuale legata al mondo d.i.y. si pone in maniera "+
"opposta alle logiche della produzione industriale massiva e omologante.",
when : [
{day: "Mer", hour: ["19:30", "22:00"], title:"Apertura serigrafia"},
],
when : [],
old_event: "", //un vecchio evento
site: "", //sito personale
contatto : "serixm@autistici.org", //email
@ -90,15 +82,14 @@ PROJECT.labs = [
"tecnica di stampa manuale legata al mondo d.i.y. si pone in maniera "+
"opposta alle logiche della produzione industriale massiva e omologante.",
when : [
{day: "Mar", hour: ["18:30", "20:00"], title:"Hata Yoga"},
{day: "Mer", hour: ["20:30", "22:30"], title:"Hata Yoga meditativa"},
{day: "Lun", hour: ["20:30", "22:30"], title:"Hata Yoga meditativa"},
{day: "Gio", hour: ["18:30", "20:00"], title:"Hata Yoga"},
{day: "Mar", hour: ["18:30", "20:30"], title:"Hata Yoga"},
{day: "Mer", hour: ["20:30", "22:30"], title:"Hata Yoga meditativa)"},
{day: "Gio", hour: ["18:30", "21:00"], title:"Hata Yoga"},
{day: "Lun", hour: ["19:00", "21:00"], title:"Tessuti aerei"},
{day: "Mer", hour: ["19:00", "21:00"], title:"Tessuti aerei"},
{day: "Ven", hour: ["19:00", "21:00"], title:"Tessuti aerei"},
{day: "Sab", hour: ["15:00", "17:00"], title:"Shiatsu"},
//{day: "Lun", hour: ["15:00", "17:00"], title:"Acrobalance"}
{day: "Lun", hour: ["15:00", "17:00"], title:"Acrobalance"}
],
old_event: "", //un vecchio evento
site: "http://liste.indivia.net/listinfo/pallestra", //sito personale
@ -113,15 +104,15 @@ PROJECT.labs = [
"di insegnare a praticare una disciplina che ha come principi luguaglianza "+
"e il rispetto reciproco",
when : [
{day: "Lun", hour: ["19:00", "21:00"], title:"Pugilato"},
{day: "Mer", hour: ["19:00", "21:00"], title:"Pugilato Principianti"},
{day: "Ven", hour: ["19:00", "21:00"], title:"Pugilato"},
{day: "Lun", hour: ["20:00", "22:00"], title:"Pugilato"},
{day: "Mer", hour: ["20:00", "22:00"], title:"Pugilato Principianti"},
{day: "Ven", hour: ["20:00", "22:00"], title:"Pugilato"},
],
old_event: "", //un vecchio evento
site: "http://liste.indivia.net/listinfo/pallestra", //sito personale
contatto : "palestrapopolarestevenson@autistici.org", //email
page: "http://www.ecn.org/xm24/palestrina-libera/", //pagina su sito xm24
sn: "https://www.fb.com/palestrapopolarestevenson", //social network
sn: "https://www.facebook.com/palestrapopolarestevenson", //social network
},
{ collettivo: "Lab57 Alchemica",
dshort: "Ascolto psicologico e punto di primo soccorso",
@ -135,7 +126,7 @@ PROJECT.labs = [
old_event: "", //un vecchio evento
site: "http://lab57.indivia.net", //sito personale
contatto : "lab57@indivia.net", //email
page: "http://www.ecn.org/xm24/alchemicalab57/", //pagina su sito xm24
page: "http://www.ecn.org/xm24/evento/sportello-consulenza-lab57alchemica/", //pagina su sito xm24
sn: "", //social network
},
{ collettivo: "Campi aperti",
@ -173,7 +164,11 @@ PROJECT.labs = [
when : [
{day: "Mar", hour: ["20.30", "24:30"], title:"Assemblea pubblica Xm24"},
],
old_event: "", //un vecchio evento
site: "http://www.ecn.org/xm24/", //sito personale
contatto : "", //email
page: "http://www.ecn.org/xm24/", //pagina su sito xm24
sn: "", //social network
},
{ collettivo: "No Borders",
dshort: "Lottiamo contro tutte le frontiere, fisiche e immaginarie, e siamo per la libertà di movimento di tutti e tutte.",
@ -241,26 +236,18 @@ var init = true;
PROJECT.hr = "<hr class='post-divider'>";
var getLabelUrl = function(url){
var label = url.replace(/(http|https):\/\/(www\.)*/,'')
.replace(/\/\s*$/, ""); //l'ultima barra
return label;
};
PROJECT.getHtmlA = function(label, url, _class, isMail) {
PROJECT.getHtmlA = function(label, url, _class) {
if(!url)
return "";
_class = _class || "";
var link = isMail ? "mailto:" + url : url;
return "<span class='e_link title "+_class+"'>" + label + "</span>"+
"<a class='e_link e_url"+_class+"' href='" + link + "' rel='external'>" +
getLabelUrl(url) +
"</a>" +
"<br>";
return "<span class='"+_class+"'>" + label + "</span>"+
"<a class='"+_class+"' href='" + url + "' rel='external'>" +
url +
"</a>";
};
PROJECT.getHtmlDate = function(evt, noDay) {
@ -278,28 +265,22 @@ PROJECT.getHtmlDate = function(evt, noDay) {
};
PROJECT.labOrder = function(lab){
var events = "";
var events = "<ul>";
for(var e = 0; e < lab.when.length; e++) {
events += "<li>" + PROJECT.getHtmlDate(lab.when[e]) + "</li>";
}
if(events !== '') {
events = "<small>Orari:</small>"+
"<ul>" +
events +
"</ul>";
events += "<ol>" + PROJECT.getHtmlDate(lab.when[e]) + "</ol>";
}
events += "</ul>";
var li = "<li>"+
"<p class='title'>" + lab.collettivo + "</p>"+
"<p class='dshort'>" + lab.dshort + "</p>"+
PROJECT.getHtmlA("Url: ", lab.page) +
PROJECT.getHtmlA("Sito: ", lab.site) +
PROJECT.getHtmlA("Email: ", lab.contatto, null, true) +
PROJECT.getHtmlA("Social: ", lab.sn)+
"<br>" +
events +
PROJECT.hr +
"<span class='title'>" + lab.collettivo + "</span>"+
"<br>"+
"<span class='dshort'>" + lab.dshort + "</span>"+
"<br>"+
PROJECT.getHtmlA("Sito:", lab.site)+
PROJECT.getHtmlA("Social Network", lab.sn)+
events+
//"<small>" + cleanTime + "</small>"+
"<hr class='post-divider'>"+
"</li>";
return li;
@ -393,4 +374,4 @@ PROJECT.render = function() {
$('#project p').html("<ul>" + lab + "</ul>");
init = false;
};
};

View file

@ -1,5 +1,6 @@
function myJsonCategory(Qcategory, div, addTagCategory) {
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
$.mobile.loading('show');
FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
var items = [];
for (var i = 0; i < resultSet.rows.length; i++) {
var val = JSON.parse(resultSet.rows.item(i).post);
@ -82,10 +83,7 @@ var drawListPost = function(div, resultSet, position) {
} else if(position == 'prepend'){
ul.prependTo(div);
}
setTimeout(function () {
$.mobile.loading('hide');
}, 1000);
$.mobile.loading('hide');
};
var appendPostList = function(div, resultSet, categories, fallback) {
@ -146,7 +144,7 @@ var getCategoryWhere = function(categories) {
var POST = POST || {};
POST.sql = {
init: "SELECT DISTINCT * FROM xm24_posts JOIN xm24_cats_to_posts USING(id) WHERE ",
init: "SELECT * FROM xm24_posts JOIN xm24_cats_to_posts USING(id) WHERE ",
end : "ORDER BY date COLLATE NOCASE DESC LIMIT ?"
};
@ -197,7 +195,7 @@ function myJsonLastPage(div) {
var firstTime = storage.getItem('db_lastnews_firsttime');
if (firstTime != 'yes') {
if (lastnewsDate) {
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE date > ? ORDER BY date COLLATE NOCASE DESC LIMIT 40;", [lastnewsDate], function (resultSet) {
FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE date > ? ORDER BY date COLLATE NOCASE DESC LIMIT 40;", [lastnewsDate], function (resultSet) {
var items = [];
$(div).empty();
if (resultSet.rows.length > 0) {
@ -234,7 +232,7 @@ function myJsonLastPage(div) {
function myJsonCategoryPaginated(Qcategory, div, pageNumber) {
$.mobile.loading('show');
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
var items = [];
$(div).empty();
for (var i = 0; i < resultSet.rows.length; i++) {
@ -300,15 +298,11 @@ function drawEvent(div_title, div_content, resultSet){
var id = val.id;
var title = val.title;
var url = val.url;
var content = entityToHtml(val.description);
var content = val.description;
var geo = val.geo;
var imgUrlThumb = getImageUrl(val.img, 'thumb');
$(div_title).html(title);
var img = imgUrlThumb != "" ? "<a href='" + getImageUrl(val.img, 'large') + "'>" +
"<img src='" + imgUrlThumb + "'/>" +
"</a><br>" : "";
$(div_content).html(img + "<small>" + evInitDate +"-" + evEndDate +"</small><p>" + content + "</p>");
$(div_content).html("<small>" + evInitDate +"-" + evEndDate +"</small><p>" + content + "</p>");
renderShareButton(div_content, title, url, evInitDate + " "+ evEndDate);
}
}
@ -319,7 +313,7 @@ function myJsonPost(Qid, div_title, div_content, _class) {
table = EVENTS.table.single;
}
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM " + table + " WHERE id = ?;", [Qid], function(resultSet) {
FONTE.dbHandler.executeSql("SELECT * FROM " + table + " WHERE id = ?;", [Qid], function(resultSet) {
if(!_class){
drawPost(div_title, div_content, resultSet);
} else {
@ -331,7 +325,7 @@ function myJsonPost(Qid, div_title, div_content, _class) {
function myJsonPage(Qid, div_title, div_content) {
$.mobile.loading('show');
var pageId = parseInt(Qid);
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_pages WHERE id = ?;", [pageId], function (resultSet) {
FONTE.dbHandler.executeSql("SELECT * FROM xm24_pages WHERE id = ?;", [pageId], function (resultSet) {
for (var i = 0; i < resultSet.rows.length; i++) {
var data = resultSet.rows.item(i);
var id = data.id;
@ -348,7 +342,7 @@ function myJsonPage(Qid, div_title, div_content) {
function myJsonRandomPost(div_title, div_content) {
$.mobile.loading('show');
FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts ORDER BY RANDOM() LIMIT 1;", [], function (resultSet) {
FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts ORDER BY RANDOM() LIMIT 1;", [], function (resultSet) {
for (var i = 0; i < resultSet.rows.length; i++) {
var val = JSON.parse(resultSet.rows.item(i).post);
var id = val.id;
@ -379,8 +373,7 @@ function createDB() {
//FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags (id INTEGER PRIMARY KEY, title, tag)');
//FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags_to_posts (id, tagid)');
//FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_pages (id INTEGER PRIMARY KEY, title, date, page)');
FONTE.dbHandler.executeSql('DROP TABLE IF EXISTS xm24_events_single');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_events_single (id INTEGER PRIMARY KEY, title, description, initDate, endDate, url, geo, img)');
FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_events_single (id INTEGER PRIMARY KEY, title, description, initDate, endDate, url, geo)');
//FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_tags_to_events (id, tagid)');
//FONTE.dbHandler.executeSql('CREATE TABLE IF NOT EXISTS xm24_events_repeat (id INTEGER PRIMARY KEY, title, description, initDate, endDate, url, geo)');
}, function () {

View file

@ -245,9 +245,9 @@ function getLastSinglePageRecur(url, pagenum, categories) {
});
});
// if (data.length === 0) {
// renderLastNews(FONTE.contentListClass, categories);
// }
if (data.length == 0) {
renderLastNews(FONTE.contentListClass, categories);
}
},
error: JSONErrorHandler
});

View file

@ -8,7 +8,7 @@ function initStorage() {
}
/*per network info*/
function checkConnection(code, msgConnect, print) {
function checkConnection(code, msgConnect) {
var msgTitle = "Non sei connesso";
msgConnect = msgConnect || "Occore essere connessi per poter ricevere i nuovi articoli";
@ -23,8 +23,7 @@ function checkConnection(code, msgConnect, print) {
states[Connection.CELL] = 'Cell generic connection';
states[Connection.NONE] = 'No network connection';
if (states[networkState] == 'Unknown connection' || states[networkState] == 'No network connection') {
if(! print)
toastr.warning(msgConnect, msgTitle);
toastr.warning(msgConnect, msgTitle);
console.log(code);
return false;
} else {
@ -59,15 +58,6 @@ function entityToHtml(string) {
return string;
}
function getImageUrl(str, dim) {
var sstr = str.split(";");
for(var i = 0; i < sstr.length; i++) {
if(sstr[i].indexOf(dim) > -1){
return sstr[i +1];
}
}
}
var entity_table = {
// 34: "&quot;", // Quotation mark. Not required
38: "&amp;", // Ampersand. Applied before everything else in the application

View file

@ -63,9 +63,6 @@
for (i = 0; i < xml.childNodes.length; i++) {
node = xml.childNodes[i];
if (node.nodeName === "#comment")
continue;
if (node.nodeType === 1) {
if (node.attributes.length === 0 && node.childElementCount === 0){
@ -119,7 +116,7 @@
}
var root = {};
if (xml.attributes && xml.attributes.length === 0 && xml.childElementCount === 0){
root[xml.nodeName] = normalize(xml.textContent, options);
} else {
@ -136,4 +133,4 @@
} else if (typeof window !== 'undefined') {
window.xml2json = xml2json;
}
})();
})();