From 942cdc551c0a0f2f60d434166836366f2fe12237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 10 Jan 2016 23:00:15 +0100 Subject: [PATCH] Version 15.107.1 --- js/{swad15.107.js => swad15.107.1.js} | 27 +++++++++++++++++++++------ swad_changelog.h | 7 +++++-- swad_layout.c | 2 +- swad_social.c | 27 +++++++++++++++++---------- 4 files changed, 44 insertions(+), 19 deletions(-) rename js/{swad15.107.js => swad15.107.1.js} (98%) diff --git a/js/swad15.107.js b/js/swad15.107.1.js similarity index 98% rename from js/swad15.107.js rename to js/swad15.107.1.js index 752314731..4e2465995 100644 --- a/js/swad15.107.js +++ b/js/swad15.107.1.js @@ -473,15 +473,17 @@ function readNewTimelineData() { if (newTimeline) { newTimeline.innerHTML = htmlNewTimeline + newTimeline.innerHTML; // Update list of publishings in new timeline var countNewTimeline = newTimeline.childNodes.length; - + if (countNewTimeline) { - var viewNewPostsContainer = document.getElementById('view_new_posts_container'); - var viewNewPostsCount = document.getElementById('view_new_posts_count'); + // Scripts in timeline got via AJAX are not executed ==> execute them + evalScriptsInElem (newTimeline); // Update number of new posts + var viewNewPostsCount = document.getElementById('view_new_posts_count'); viewNewPostsCount.innerHTML = countNewTimeline; // Display message with new posts if hidden + var viewNewPostsContainer = document.getElementById('view_new_posts_container'); viewNewPostsContainer.style.display = ''; } } @@ -506,12 +508,14 @@ function readOldTimelineData() { var countOldTimeline = oldTimeline.childNodes.length; if (countOldTimeline) { - var timeline = document.getElementById("timeline_list"); + // Scripts in timeline got via AJAX are not executed ==> execute them + evalScriptsInElem (oldTimeline); // Move all the LI elements in UL 'old_timeline_list' to the bottom of UL 'timeline_list' + var timeline = document.getElementById("timeline_list"); for (var i=0; i execute them +function evalScriptsInElem(elem) { + var scrs = elem.getElementsByTagName("script"); + var s; + for (var i=0; i\n" "
" - "\"\"" "
" diff --git a/swad_social.c b/swad_social.c index 3c0379f6c..0d7d6e79d 100644 --- a/swad_social.c +++ b/swad_social.c @@ -946,22 +946,29 @@ static void Soc_WriteDateTime (time_t TimeUTC) { extern const char *Txt_Today; static unsigned UniqueId = 0; + char Id[32+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1]; UniqueId++; - /***** Start cell *****/ - fprintf (Gbl.F.Out,"
", - UniqueId); + /***** Create Id. The id must be unique in timeline, + but the timeline is updated via AJAX. + So, Id uses: + - a name for this execution (Gbl.UniqueNameEncrypted) + - an extension for the current element (UniqueId) *****/ + sprintf (Id,"date_%s_%u",Gbl.UniqueNameEncrypted,UniqueId); - /***** Write date and time *****/ + /***** Container where the date-time is written *****/ + fprintf (Gbl.F.Out,"
", + Id); + + /***** Script to write date and time in browser local time *****/ + // This must be out of the div where the output is written + // because it will be evaluated in a loop in JavaScript fprintf (Gbl.F.Out,"", - UniqueId,(long) TimeUTC,Txt_Today); - - /***** End cell *****/ - fprintf (Gbl.F.Out,"
"); + Id,(long) TimeUTC,Txt_Today); } /*****************************************************************************/