Version 20.69: Apr 30, 2021 Changes in timeline to not repeat notes in new activity.

This commit is contained in:
acanas 2021-04-30 13:11:07 +02:00
parent f296981e43
commit ca72dc3069
3 changed files with 40 additions and 15 deletions

View File

@ -924,8 +924,8 @@ function readNewTimelineData () {
if (justNowTimeline) { if (justNowTimeline) {
justNowTimeline.innerHTML = objXMLHttpReqNewTL.responseText; // Update list of publications in just now timeline justNowTimeline.innerHTML = objXMLHttpReqNewTL.responseText; // Update list of publications in just now timeline
var countJustNowTimeline = justNowTimeline.childNodes.length; var numNotesJustGot = justNowTimeline.childNodes.length;
if (countJustNowTimeline) { // New pubs just retrieved if (numNotesJustGot) { // New notes just received
// Scripts in timeline got via AJAX are not executed ==> execute them // Scripts in timeline got via AJAX are not executed ==> execute them
evalScriptsInElem (justNowTimeline); evalScriptsInElem (justNowTimeline);
@ -934,10 +934,10 @@ function readNewTimelineData () {
MathJax.typeset(); MathJax.typeset();
// Move just received timeline to top of new timeline // Move just received timeline to top of new timeline
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline // (move all the LI elements (notes) in UL 'just_now_timeline_list'...
// ...to the top of UL 'new_timeline_list')
// Move all the LI elements in UL 'just_now_timeline_list' to the top of UL 'new_timeline_list' var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
for (var i=0; i<countJustNowTimeline; i++) for (var i=0; i<numNotesJustGot; i++)
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.childNodes[0]); newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.childNodes[0]);
// Update number of new posts // Update number of new posts
@ -962,14 +962,35 @@ function readNewTimelineData () {
/*****************************************************************************/ /*****************************************************************************/
function moveNewTimelineToTimeline () { function moveNewTimelineToTimeline () {
// Move all the LI elements in UL 'new_timeline_list' to the top of UL 'timeline_list' // Move the LI elements (notes) in UL 'new_timeline_list'...
// ...to the top of UL 'timeline_list', only if not repeated before
var newTimeline = document.getElementById('new_timeline_list'); var newTimeline = document.getElementById('new_timeline_list');
var countNewTimeline = newTimeline.childNodes.length; var numNewNotes = newTimeline.childNodes.length;
if (countNewTimeline) {
if (numNewNotes) {
var timeline = document.getElementById("timeline_list"); var timeline = document.getElementById("timeline_list");
for (var i=0; i<countNewTimeline; i++) {
timeline.insertBefore(newTimeline.lastChild, timeline.childNodes[0]); for (var i=1; i<=numNewNotes; i++) {
timeline.childNodes[0].className += " TL_NEW_PUB"; // Check if the last child (the oldest) in the new timeline...
// ...is the last ocurrence of the note
var mostRecentOcurrenceOfNote = true;
var lastChildIndex = numNewNotes - i;
for (var j=0; j<lastChildIndex; j++)
if (newTimeline.childNodes[j].dataset.noteCode == newTimeline.lastChild.dataset.noteCode) {
mostRecentOcurrenceOfNote = false;
break;
}
// Move or remove node from new timeline
if (mostRecentOcurrenceOfNote) {
// Move node from new timeline to timeline
timeline.insertBefore(newTimeline.lastChild, timeline.childNodes[0]);
timeline.childNodes[0].className += " TL_NEW_PUB";
}
else
// Remove last child (because is repeated in more recent pubs)
newTimeline.removeChild(newTimeline.lastChild);
} }
} }

View File

@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.68.8 (2021-04-30)" #define Log_PLATFORM_VERSION "SWAD 20.69 (2021-04-30)"
#define CSS_FILE "swad20.45.css" #define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.69.js"
/* /*
TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.69: Apr 30, 2021 Changes in timeline to not repeat notes in new activity. (309773 lines)
Version 20.68.8: Apr 30, 2021 Code refactoring in timeline. (309751 lines) Version 20.68.8: Apr 30, 2021 Code refactoring in timeline. (309751 lines)
Version 20.68.7: Apr 29, 2021 Code refactoring in timeline. (309749 lines) Version 20.68.7: Apr 29, 2021 Code refactoring in timeline. (309749 lines)
Version 20.68.6: Apr 29, 2021 Code refactoring in timeline. (309738 lines) Version 20.68.6: Apr 29, 2021 Code refactoring in timeline. (309738 lines)

View File

@ -363,7 +363,10 @@ void Tml_Pub_InsertNewPubsInTimeline (struct Tml_Timeline *Timeline)
Tml_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\""); HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\""
" data-note-code=\"%ld\"", // Note code to be read later...
Not.NotCod); // ...from JavaScript...
// ...to avoid repeating notes
Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
Tml_Pub_GetTopMessage (Pub->PubType), Tml_Pub_GetTopMessage (Pub->PubType),
Pub->PublisherCod); Pub->PublisherCod);