Version18.75

This commit is contained in:
Antonio Cañas Vargas 2019-03-13 09:55:23 +01:00
parent 4b602e2f83
commit 3eba689e80
5 changed files with 48 additions and 41 deletions

View File

@ -465,7 +465,7 @@ function refreshConnected () {
}
}
// Receives and show connected users data
// Receive and show connected users data
function readConnUsrsData () {
if (objXMLHttpReqCon.readyState == 4) { // Check if data have been received
if (objXMLHttpReqCon.status == 200) {
@ -550,7 +550,7 @@ function readLastClicksData () {
}
/*****************************************************************************/
/**** Automatic refresh of new publications in social timeline using AJAX ****/
/*** Automatically refresh new publications in social timeline using AJAX ****/
/*****************************************************************************/
// This function must be called from time to time
@ -569,19 +569,16 @@ function refreshNewTimeline () {
}
}
// Receives and show new social timeline data
// Receive and show new social timeline data
function readNewTimelineData () {
if (objXMLHttpReqNewTL.readyState == 4) { // Check if data have been received
if (objXMLHttpReqNewTL.status == 200) {
var endOfDelay = objXMLHttpReqNewTL.responseText.indexOf('|',0); // Get separator position
var delay = parseInt(objXMLHttpReqNewTL.responseText.substring(0,endOfDelay)); // Get refresh delay
var htmlJustNowTimeline = objXMLHttpReqNewTL.responseText.substring(endOfDelay + 1); // Get HTML code for timeline
var justNowTimeline = document.getElementById('just_now_timeline_list');// Access to UL for the just received timeline
if (justNowTimeline) {
justNowTimeline.innerHTML = htmlJustNowTimeline; // Update list of publications in just now timeline
var countJustNowTimeline = justNowTimeline.childNodes.length;
justNowTimeline.innerHTML = objXMLHttpReqNewTL.responseText; // Update list of publications in just now timeline
var countJustNowTimeline = justNowTimeline.childNodes.length;
if (countJustNowTimeline) { // New pubs just retrieved
// Scripts in timeline got via AJAX are not executed ==> execute them
evalScriptsInElem (justNowTimeline);
@ -605,9 +602,10 @@ function readNewTimelineData () {
viewNewPostsContainer.style.display = '';
}
}
if (delay >= 10000) // If refresh slower than 1 time each 10 seconds, do refresh; else abort
setTimeout('refreshNewTimeline()',delay);
// Global delay variable is set initially in swad-core
delayNewTimeline += 1000; // Increase 1 second
setTimeout('refreshNewTimeline()',delayNewTimeline);
}
}
}
@ -638,7 +636,7 @@ function moveNewTimelineToTimeline () {
}
/*****************************************************************************/
/******** Refresh of old publications in social timeline using AJAX **********/
/********** Refresh old publications in social timeline using AJAX ***********/
/*****************************************************************************/
// This function is called when user clicks in link
@ -664,7 +662,7 @@ function refreshOldTimeline () {
}
}
// Receives and show old social timeline data
// Receive and show old social timeline data
function readOldTimelineData () {
if (objXMLHttpReqOldTL.readyState == 4) { // Check if data have been received
if (objXMLHttpReqOldTL.status == 200) {

View File

@ -431,6 +431,8 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así
// TODO: En Timeline cambiar "Comentario eliminado" para los posts por "Publicación eliminada"
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -450,10 +452,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.74.4 (2019-03-13)"
#define Log_PLATFORM_VERSION "SWAD 18.75 (2019-03-13)"
#define CSS_FILE "swad18.68.3.css"
#define JS_FILE "swad18.74.4.js"
#define JS_FILE "swad18.75.js"
/*
Version 18.75: Mar 13, 2019 Timeline refresh rate is increased on each refresh. (239633 lines)
Version 18.74.4: Mar 13, 2019 Fixed bug in JavaScript related to timeline. (239628 lines)
Version 18.74.3: Mar 13, 2019 Fixed bug in JavaScript related to timeline. (239628 lines)
Version 18.74.2: Mar 13, 2019 Fixed bug in JavaScript related to timeline. (239628 lines)

View File

@ -455,7 +455,8 @@
#define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 1UL * 1000UL)) // Refresh period of last clicks in miliseconds
#define Cfg_TIME_TO_REFRESH_TIMELINE ((time_t)( 10UL * 1000UL)) // Refresh period of social timeline in miliseconds
#define Cfg_TIME_TO_REFRESH_TIMELINE ((time_t)( 1UL * 1000UL)) // Initial refresh period of social timeline in miliseconds
// This delay is increased 1 second on each refresh
#define Cfg_TIME_TO_CHANGE_BANNER ((time_t)( 2UL * 60UL)) // After these seconds, change banner
#define Cfg_NUMBER_OF_BANNERS 1 // Number of banners to show simultaneously

View File

@ -651,11 +651,37 @@ static void Lay_WriteScriptMathJax (void)
static void Lay_WriteScriptInit (void)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
bool RefreshLastClicks = false;
bool RefreshNewTimeline = false;
switch (Gbl.Action.Act)
{
case ActLstClk:
RefreshLastClicks = true;
break;
case ActSeeSocTmlGbl:
case ActRcvSocPstGbl:
case ActRcvSocComGbl:
case ActShaSocNotGbl:
case ActUnsSocNotGbl:
case ActReqRemSocPubGbl:
case ActRemSocPubGbl:
case ActReqRemSocComGbl:
case ActRemSocComGbl:
RefreshNewTimeline = true;
break;
default:
break;
}
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n");
Dat_WriteScriptMonths ();
if (RefreshNewTimeline)
fprintf (Gbl.F.Out,"var delayNewTimeline = %lu;\n",
Cfg_TIME_TO_REFRESH_TIMELINE);
fprintf (Gbl.F.Out,"function init(){\n");
if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN)) // Right column visible
@ -667,29 +693,12 @@ static void Lay_WriteScriptInit (void)
Lan_STR_LANG_ID[Gbl.Prefs.Language],
Gbl.Usrs.Connected.TimeToRefreshInMs);
if (Gbl.Action.Act == ActLstClk)
// Refresh fav button via AJAX
if (RefreshLastClicks) // Refresh last clicks via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n",
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
else
switch (Gbl.Action.Act)
{
case ActSeeSocTmlGbl:
case ActRcvSocPstGbl:
case ActRcvSocComGbl:
case ActShaSocNotGbl:
case ActUnsSocNotGbl:
case ActReqRemSocPubGbl:
case ActRemSocPubGbl:
case ActReqRemSocComGbl:
case ActRemSocComGbl:
// Refresh timeline via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshNewTimeline()\",%lu);\n",
Cfg_TIME_TO_REFRESH_TIMELINE);
break;
default:
break;
}
else if (RefreshNewTimeline) // Refresh timeline via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshNewTimeline()\",delayNewTimeline);\n");
fprintf (Gbl.F.Out,"}\n"
"</script>\n");
}

View File

@ -440,10 +440,6 @@ void TL_RefreshNewTimelineGbl (void)
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything
{
/***** Send, before the HTML, the refresh time *****/
fprintf (Gbl.F.Out,"%lu|",
Cfg_TIME_TO_REFRESH_TIMELINE);
/***** Get which users *****/
TL_GetParamsWhichUsrs ();