diff --git a/www/js/crud.events.js b/www/js/crud.events.js index 85a2e52..bbd5a11 100644 --- a/www/js/crud.events.js +++ b/www/js/crud.events.js @@ -54,11 +54,12 @@ 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], + FONTE.dbHandler.executeSql('INSERT INTO ' + table + ' VALUES (?,?,?,?,?,?,?,?)', [evId, evTitle, evDesc, evInitDate, evEndDate, evUrl, evGeo, evImg], //onSuccess function (resultSet) { n_evs_ins++; diff --git a/www/js/events.js b/www/js/events.js index 79ea52e..450fefe 100644 --- a/www/js/events.js +++ b/www/js/events.js @@ -56,10 +56,14 @@ var ai1ec = (function(){ return event.geo || ""; }, - //Regole per gli evebti ripetitivi + //Regole per gli eventi ripetitivi getRule : function(event) { return event.rrule || ""; }, + + getImage : function(event){ + return event['x-wp-images-url'] || ""; + }, }; var getXmlData = function(url, catId, callback) { diff --git a/www/js/query.js b/www/js/query.js index 773e275..67bdeed 100644 --- a/www/js/query.js +++ b/www/js/query.js @@ -300,11 +300,15 @@ function drawEvent(div_title, div_content, resultSet){ var id = val.id; var title = val.title; var url = val.url; - var content = val.description; + var content = entityToHtml(val.description); var geo = val.geo; + var imgUrlThumb = getImageUrl(val.img, 'thumb'); $(div_title).html(title); - $(div_content).html("" + evInitDate +"-" + evEndDate +"
" + content + "
"); + var img = imgUrlThumb != "" ? "" + + "" + + "" + content + "
"); renderShareButton(div_content, title, url, evInitDate + " "+ evEndDate); } } @@ -375,7 +379,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('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_events_single (id INTEGER PRIMARY KEY, title, description, initDate, endDate, url, geo, img)'); //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 () { diff --git a/www/js/util.js b/www/js/util.js index ad149a3..f114326 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -59,6 +59,15 @@ 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: """, // Quotation mark. Not required 38: "&", // Ampersand. Applied before everything else in the application