mirror of https://github.com/acanas/swad-core.git
Version 21.59: Nov 22, 2021 Code refactoring in timeline.
This commit is contained in:
parent
0c2299160f
commit
534f147a3c
|
@ -3444,7 +3444,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************* Timeline **********************************/
|
/********************************* Timeline **********************************/
|
||||||
#view_new_posts_container,#view_old_posts_container
|
#view_new_container,#view_old_pubs_container
|
||||||
{
|
{
|
||||||
display:table-cell;
|
display:table-cell;
|
||||||
height:50px;
|
height:50px;
|
|
@ -26,7 +26,7 @@
|
||||||
var Gbl_HTMLContent;
|
var Gbl_HTMLContent;
|
||||||
|
|
||||||
// Global variable used to call SWAD via AJAX
|
// Global variable used to call SWAD via AJAX
|
||||||
var ActionAJAX;
|
var actionAJAX;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** Handle match keystrokes **************************/
|
/************************** Handle match keystrokes **************************/
|
||||||
|
@ -493,20 +493,22 @@ var objXMLHttpReqCon = false;
|
||||||
function refreshConnected () {
|
function refreshConnected () {
|
||||||
objXMLHttpReqCon = AJAXCreateObject();
|
objXMLHttpReqCon = AJAXCreateObject();
|
||||||
if (objXMLHttpReqCon) {
|
if (objXMLHttpReqCon) {
|
||||||
var RefreshParams = RefreshParamNxtActCon + '&' +
|
var refreshParams = refreshParamNxtActCon + '&' +
|
||||||
RefreshParamIdSes + '&' +
|
refreshParamIdSes + '&' +
|
||||||
RefreshParamCrsCod;
|
refreshParamCrsCod;
|
||||||
|
|
||||||
objXMLHttpReqCon.onreadystatechange = readConnUsrsData; // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
objXMLHttpReqCon.open('POST',ActionAJAX,true);
|
objXMLHttpReqCon.onreadystatechange = readConnUsrsData;
|
||||||
objXMLHttpReqCon.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttpReqCon.open('POST',actionAJAX,true);
|
||||||
objXMLHttpReqCon.send(RefreshParams);
|
objXMLHttpReqCon.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqCon.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive and show connected users data
|
// Receive and show connected users data
|
||||||
function readConnUsrsData () {
|
function readConnUsrsData () {
|
||||||
if (objXMLHttpReqCon.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqCon.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqCon.status == 200) {
|
if (objXMLHttpReqCon.status == 200) {
|
||||||
var endOfDelay = objXMLHttpReqCon.responseText.indexOf('|',0); // Get separator position
|
var endOfDelay = objXMLHttpReqCon.responseText.indexOf('|',0); // Get separator position
|
||||||
var endOfNotif = objXMLHttpReqCon.responseText.indexOf('|',endOfDelay + 1); // Get separator position
|
var endOfNotif = objXMLHttpReqCon.responseText.indexOf('|',endOfDelay + 1); // Get separator position
|
||||||
|
@ -548,7 +550,6 @@ function readConnUsrsData () {
|
||||||
if (delay >= 60000) // If refresh slower than 1 time each 60 seconds, do refresh; else abort
|
if (delay >= 60000) // If refresh slower than 1 time each 60 seconds, do refresh; else abort
|
||||||
setTimeout('refreshConnected()',delay);
|
setTimeout('refreshConnected()',delay);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -590,8 +591,9 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,Language) {
|
||||||
objXMLHttp = AJAXCreateObject ();
|
objXMLHttp = AJAXCreateObject ();
|
||||||
if (objXMLHttp) {
|
if (objXMLHttp) {
|
||||||
/* Send request to server */
|
/* Send request to server */
|
||||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
objXMLHttp.onreadystatechange = function() {
|
||||||
|
if (objXMLHttp.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttp.status == 200) {
|
if (objXMLHttp.status == 200) {
|
||||||
// Response received
|
// Response received
|
||||||
clearTimeout (xmlHttpTimeout); // Clear timeout
|
clearTimeout (xmlHttpTimeout); // Clear timeout
|
||||||
|
@ -603,13 +605,11 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,Language) {
|
||||||
// Scripts in div got via AJAX are not executed ==> execute them
|
// Scripts in div got via AJAX are not executed ==> execute them
|
||||||
evalScriptsInElem (div);
|
evalScriptsInElem (div);
|
||||||
|
|
||||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
// Process maths; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||||
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,div]); // old versions
|
|
||||||
MathJax.typeset();
|
MathJax.typeset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var inputElem = document.getElementById(idInput);
|
var inputElem = document.getElementById(idInput);
|
||||||
|
@ -650,8 +650,9 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,Language) {
|
||||||
|
|
||||||
IHaveFinishedTxt = disableFinished (txtSaving[Language]); // Disable finished button on sending. When answer is saved and response received ==> the button will be reloaded
|
IHaveFinishedTxt = disableFinished (txtSaving[Language]); // Disable finished button on sending. When answer is saved and response received ==> the button will be reloaded
|
||||||
|
|
||||||
objXMLHttp.open('POST',ActionAJAX,true);
|
objXMLHttp.open('POST',actionAJAX,true);
|
||||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttp.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
objXMLHttp.send(Params);
|
objXMLHttp.send(Params);
|
||||||
|
|
||||||
/* Timeout to abort in 5 seconds.
|
/* Timeout to abort in 5 seconds.
|
||||||
|
@ -756,19 +757,21 @@ var objXMLHttpReqMchStd = false;
|
||||||
function refreshMatchStd () {
|
function refreshMatchStd () {
|
||||||
objXMLHttpReqMchStd = AJAXCreateObject();
|
objXMLHttpReqMchStd = AJAXCreateObject();
|
||||||
if (objXMLHttpReqMchStd) {
|
if (objXMLHttpReqMchStd) {
|
||||||
var RefreshParams = RefreshParamNxtActMch + '&' +
|
var refreshParams = refreshParamNxtActMch + '&' +
|
||||||
RefreshParamMchCod + '&' +
|
refreshParamMchCod + '&' +
|
||||||
RefreshParamIdSes;
|
refreshParamIdSes;
|
||||||
|
|
||||||
objXMLHttpReqMchStd.onreadystatechange = readMatchStdData; // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
objXMLHttpReqMchStd.open('POST',ActionAJAX,true);
|
objXMLHttpReqMchStd.onreadystatechange = readMatchStdData;
|
||||||
objXMLHttpReqMchStd.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
objXMLHttpReqMchStd.open('POST',actionAJAX,true);
|
||||||
objXMLHttpReqMchStd.send(RefreshParams);
|
objXMLHttpReqMchStd.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqMchStd.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readMatchStdData () {
|
function readMatchStdData () {
|
||||||
if (objXMLHttpReqMchStd.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqMchStd.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqMchStd.status == 200) {
|
if (objXMLHttpReqMchStd.status == 200) {
|
||||||
var htmlMatch = objXMLHttpReqMchStd.responseText; // Get HTML code
|
var htmlMatch = objXMLHttpReqMchStd.responseText; // Get HTML code
|
||||||
|
|
||||||
|
@ -778,7 +781,6 @@ function readMatchStdData () {
|
||||||
// Global delay variable is set initially in swad-core
|
// Global delay variable is set initially in swad-core
|
||||||
setTimeout('refreshMatchStd()',delayMatch);
|
setTimeout('refreshMatchStd()',delayMatch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -790,19 +792,21 @@ var objXMLHttpReqMchTch = false;
|
||||||
function refreshMatchTch () {
|
function refreshMatchTch () {
|
||||||
objXMLHttpReqMchTch = AJAXCreateObject();
|
objXMLHttpReqMchTch = AJAXCreateObject();
|
||||||
if (objXMLHttpReqMchTch) {
|
if (objXMLHttpReqMchTch) {
|
||||||
var RefreshParams = RefreshParamNxtActMch + '&' +
|
var refreshParams = refreshParamNxtActMch + '&' +
|
||||||
RefreshParamMchCod + '&' +
|
refreshParamMchCod + '&' +
|
||||||
RefreshParamIdSes;
|
refreshParamIdSes;
|
||||||
|
|
||||||
objXMLHttpReqMchTch.onreadystatechange = readMatchTchData; // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
objXMLHttpReqMchTch.open('POST',ActionAJAX,true);
|
objXMLHttpReqMchTch.onreadystatechange = readMatchTchData;
|
||||||
objXMLHttpReqMchTch.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
objXMLHttpReqMchTch.open('POST',actionAJAX,true);
|
||||||
objXMLHttpReqMchTch.send(RefreshParams);
|
objXMLHttpReqMchTch.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqMchTch.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readMatchTchData () {
|
function readMatchTchData () {
|
||||||
if (objXMLHttpReqMchTch.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqMchTch.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqMchTch.status == 200) {
|
if (objXMLHttpReqMchTch.status == 200) {
|
||||||
var endOfId = objXMLHttpReqMchTch.responseText.indexOf('|',0 ); // Get separator position
|
var endOfId = objXMLHttpReqMchTch.responseText.indexOf('|',0 ); // Get separator position
|
||||||
var endOfEv = objXMLHttpReqMchTch.responseText.indexOf('|',endOfId + 1); // Get separator position
|
var endOfEv = objXMLHttpReqMchTch.responseText.indexOf('|',endOfId + 1); // Get separator position
|
||||||
|
@ -819,8 +823,7 @@ function readMatchTchData () {
|
||||||
// Scripts in div got via AJAX are not executed ==> execute them
|
// Scripts in div got via AJAX are not executed ==> execute them
|
||||||
evalScriptsInElem (div);
|
evalScriptsInElem (div);
|
||||||
|
|
||||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
// Process maths; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||||
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,div]); // old versions
|
|
||||||
MathJax.typeset();
|
MathJax.typeset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -828,7 +831,6 @@ function readMatchTchData () {
|
||||||
// Global delay variable is set initially in swad-core
|
// Global delay variable is set initially in swad-core
|
||||||
setTimeout('refreshMatchTch()',delayMatch);
|
setTimeout('refreshMatchTch()',delayMatch);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -842,18 +844,19 @@ function updateMatchTch (id,Params) {
|
||||||
objXMLHttp = AJAXCreateObject ();
|
objXMLHttp = AJAXCreateObject ();
|
||||||
if (objXMLHttp) {
|
if (objXMLHttp) {
|
||||||
/* Send request to server */
|
/* Send request to server */
|
||||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
objXMLHttp.onreadystatechange = function() {
|
||||||
|
if (objXMLHttp.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttp.status == 200)
|
if (objXMLHttp.status == 200)
|
||||||
if (id) {
|
if (id) {
|
||||||
var div = document.getElementById(id); // Access to DIV
|
var div = document.getElementById(id); // Access to DIV
|
||||||
if (div)
|
if (div)
|
||||||
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
objXMLHttp.open('POST',ActionAJAX,true);
|
objXMLHttp.open('POST',actionAJAX,true);
|
||||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttp.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
objXMLHttp.send(Params);
|
objXMLHttp.send(Params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,19 +870,21 @@ var objXMLHttpReqLog = false;
|
||||||
function refreshLastClicks () {
|
function refreshLastClicks () {
|
||||||
objXMLHttpReqLog = AJAXCreateObject();
|
objXMLHttpReqLog = AJAXCreateObject();
|
||||||
if (objXMLHttpReqLog) {
|
if (objXMLHttpReqLog) {
|
||||||
var RefreshParams = RefreshParamNxtActLstClk + '&' +
|
var refreshParams = refreshParamNxtActLstClk + '&' +
|
||||||
RefreshParamIdSes + '&' +
|
refreshParamIdSes + '&' +
|
||||||
RefreshParamCrsCod;
|
refreshParamCrsCod;
|
||||||
|
|
||||||
objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
objXMLHttpReqLog.open('POST',ActionAJAX,true);
|
objXMLHttpReqLog.onreadystatechange = readLastClicksData;
|
||||||
objXMLHttpReqLog.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
objXMLHttpReqLog.open('POST',actionAJAX,true);
|
||||||
objXMLHttpReqLog.send(RefreshParams);
|
objXMLHttpReqLog.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqLog.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readLastClicksData () {
|
function readLastClicksData () {
|
||||||
if (objXMLHttpReqLog.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqLog.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqLog.status == 200) {
|
if (objXMLHttpReqLog.status == 200) {
|
||||||
var endOfDelay = objXMLHttpReqLog.responseText.indexOf('|',0); // Get separator position
|
var endOfDelay = objXMLHttpReqLog.responseText.indexOf('|',0); // Get separator position
|
||||||
|
|
||||||
|
@ -892,79 +897,82 @@ function readLastClicksData () {
|
||||||
if (delay > 200) // If refresh slower than 1 time each 0.2 seconds, do refresh; else abort
|
if (delay > 200) // If refresh slower than 1 time each 0.2 seconds, do refresh; else abort
|
||||||
setTimeout('refreshLastClicks()',delay);
|
setTimeout('refreshLastClicks()',delay);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Automatically refresh new publications in social timeline using AJAX ****/
|
/******* Automatically refresh new publications in timeline using AJAX *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
// This function must be called from time to time
|
// This function must be called from time to time
|
||||||
var objXMLHttpReqNewTL = false;
|
|
||||||
function refreshNewTL () {
|
|
||||||
objXMLHttpReqNewTL = AJAXCreateObject();
|
|
||||||
if (objXMLHttpReqNewTL) {
|
|
||||||
var RefreshParams = RefreshParamNxtActNewPub + '&' +
|
|
||||||
RefreshParamIdSes + '&' +
|
|
||||||
RefreshParamWho;
|
|
||||||
|
|
||||||
objXMLHttpReqNewTL.onreadystatechange = readNewTimelineData; // onreadystatechange must be lowercase
|
var objXMLHttpReqNewTml = false;
|
||||||
objXMLHttpReqNewTL.open('POST',ActionAJAX,true);
|
|
||||||
objXMLHttpReqNewTL.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
function refreshNewTimeline () {
|
||||||
objXMLHttpReqNewTL.send(RefreshParams);
|
objXMLHttpReqNewTml = AJAXCreateObject();
|
||||||
|
if (objXMLHttpReqNewTml) {
|
||||||
|
var refreshParams = refreshParamNxtActNewPub + '&' +
|
||||||
|
refreshParamIdSes + '&' +
|
||||||
|
refreshParamWho;
|
||||||
|
|
||||||
|
// onreadystatechange must be lowercase
|
||||||
|
objXMLHttpReqNewTml.onreadystatechange = readNewTimelineData;
|
||||||
|
objXMLHttpReqNewTml.open('POST',actionAJAX,true);
|
||||||
|
objXMLHttpReqNewTml.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqNewTml.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive and show new social timeline data
|
|
||||||
function readNewTimelineData () {
|
function readNewTimelineData () {
|
||||||
if (objXMLHttpReqNewTL.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqNewTml.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqNewTL.status == 200) {
|
if (objXMLHttpReqNewTml.status == 200) {
|
||||||
|
|
||||||
var justNowTimeline = document.getElementById('just_now_timeline_list');// Access to UL for the just received timeline
|
// Access to UL for just now timeline
|
||||||
|
var justNowTimeline = document.getElementById('just_now_timeline_list');
|
||||||
if (justNowTimeline) {
|
if (justNowTimeline) {
|
||||||
justNowTimeline.innerHTML = objXMLHttpReqNewTL.responseText; // Update list of publications in just now timeline
|
// Update list of publications in just now timeline
|
||||||
|
justNowTimeline.innerHTML = objXMLHttpReqNewTml.responseText;
|
||||||
|
|
||||||
var numNotesJustGot = justNowTimeline.childNodes.length;
|
var numNotesJustGot = justNowTimeline.childNodes.length;
|
||||||
if (numNotesJustGot) { // New notes just received
|
if (numNotesJustGot) { // New notes received
|
||||||
// Scripts in timeline got via AJAX are not executed ==> execute them
|
// Scripts in timeline got via AJAX not executed ==> execute them
|
||||||
evalScriptsInElem (justNowTimeline);
|
evalScriptsInElem (justNowTimeline);
|
||||||
|
|
||||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
// Process maths; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||||
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,justNowTimeline]); // old versions
|
|
||||||
MathJax.typeset();
|
MathJax.typeset();
|
||||||
|
|
||||||
// Move just received timeline to top of new timeline
|
// Move all the LI elements (notes) in UL 'just_now_timeline_list'...
|
||||||
// (move all the LI elements (notes) in UL 'just_now_timeline_list'...
|
// ...to the top of UL 'new_timeline_list'
|
||||||
// ...to the top of UL 'new_timeline_list')
|
var newTimeline = document.getElementById('new_timeline_list');
|
||||||
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
|
|
||||||
|
|
||||||
for (var i=0; i<numNotesJustGot; i++) {
|
for (var i=0; i<numNotesJustGot; i++) {
|
||||||
// Move node from just now timeline to new timeline
|
// Move node from just now timeline to new timeline
|
||||||
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.firstChild);
|
newTimeline.insertBefore(justNowTimeline.lastChild,newTimeline.firstChild);
|
||||||
newTimeline.firstChild.className += " Tml_NEW_PUB";
|
newTimeline.firstChild.className += " Tml_NEW_PUB";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update number of new posts
|
// Update number of notes in new timeline
|
||||||
var viewNewPostsCount = document.getElementById('view_new_posts_count');
|
var viewNewCount = document.getElementById('view_new_count');
|
||||||
viewNewPostsCount.innerHTML = newTimeline.childNodes.length;
|
viewNewCount.innerHTML = newTimeline.childNodes.length;
|
||||||
|
|
||||||
// Display message with new posts if hidden
|
// Unhide message with number of notes if hidden
|
||||||
var viewNewPostsContainer = document.getElementById('view_new_posts_container');
|
var viewNewContainer = document.getElementById('view_new_container');
|
||||||
viewNewPostsContainer.style.display = '';
|
viewNewContainer.style.display = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global delay variable is set initially in swad-core
|
// Global delay variable is set initially in swad-core
|
||||||
delayNewTL += 1000; // Increase 1 second
|
delayNewTml += 1000; // Increase one second on each call
|
||||||
setTimeout('refreshNewTL()',delayNewTL);
|
setTimeout('refreshNewTimeline()',delayNewTml);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* View new publication in timeline by moving new timeline to top of timeline */
|
/*** View new pubs. in timeline by moving new timeline to top of timeline ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
// This function is called when user clicks in 'See new activity (n)'
|
||||||
|
|
||||||
function moveNewTimelineToTimeline () {
|
function moveNewTimelineToTimeline () {
|
||||||
// Move the LI elements (notes) in UL 'new_timeline_list'...
|
// Move the LI elements (notes) in UL 'new_timeline_list'...
|
||||||
// ...to the top of UL 'timeline_list', only if not repeated before
|
// ...to the top of UL 'timeline_list', only if not repeated before
|
||||||
|
@ -989,7 +997,7 @@ function moveNewTimelineToTimeline () {
|
||||||
// Move or remove node from new timeline
|
// Move or remove node from new timeline
|
||||||
if (mostRecentOcurrenceOfNote) {
|
if (mostRecentOcurrenceOfNote) {
|
||||||
// Move node from new timeline to timeline
|
// Move node from new timeline to timeline
|
||||||
timeline.insertBefore(newTimeline.lastChild, timeline.firstChild);
|
timeline.insertBefore(newTimeline.lastChild,timeline.firstChild);
|
||||||
timeline.firstChild.className += " Tml_NEW_PUB";
|
timeline.firstChild.className += " Tml_NEW_PUB";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -998,74 +1006,80 @@ function moveNewTimelineToTimeline () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset number of new posts after moving
|
// Reset number of new publications after moving
|
||||||
var viewNewPostsCount = document.getElementById('view_new_posts_count');
|
var viewNewCount = document.getElementById('view_new_count');
|
||||||
viewNewPostsCount.innerHTML = 0;
|
viewNewCount.innerHTML = 0;
|
||||||
|
|
||||||
// Hide link to view new posts after moving
|
// Hide link to view new publications after moving
|
||||||
var viewNewPostsContainer = document.getElementById('view_new_posts_container');
|
var viewNewContainer = document.getElementById('view_new_container');
|
||||||
viewNewPostsContainer.style.display = 'none';
|
viewNewContainer.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********** Refresh old publications in social timeline using AJAX ***********/
|
/************* Refresh old publications in timeline using AJAX ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
// This function is called when user clicks in link
|
// This function is called when user clicks in 'See more'
|
||||||
var objXMLHttpReqOldTL = false;
|
|
||||||
|
var objXMLHttpReqOldTml = false;
|
||||||
|
|
||||||
function refreshOldTimeline () {
|
function refreshOldTimeline () {
|
||||||
objXMLHttpReqOldTL = AJAXCreateObject ();
|
objXMLHttpReqOldTml = AJAXCreateObject ();
|
||||||
if (objXMLHttpReqOldTL) {
|
if (objXMLHttpReqOldTml) {
|
||||||
var RefreshParams = RefreshParamNxtActOldPub + '&' +
|
var refreshParams = refreshParamNxtActOldPub + '&' +
|
||||||
RefreshParamIdSes;
|
refreshParamIdSes;
|
||||||
if (typeof RefreshParamUsr !== 'undefined') {
|
if (typeof refreshParamUsr !== 'undefined') {
|
||||||
if (RefreshParamUsr.length)
|
if (refreshParamUsr.length)
|
||||||
RefreshParams += '&' + RefreshParamUsr;
|
refreshParams += '&' + refreshParamUsr;
|
||||||
}
|
}
|
||||||
if (typeof RefreshParamWho !== 'undefined') {
|
if (typeof refreshParamWho !== 'undefined') {
|
||||||
if (RefreshParamWho.length)
|
if (refreshParamWho.length)
|
||||||
RefreshParams += '&' + RefreshParamWho;
|
refreshParams += '&' + refreshParamWho;
|
||||||
}
|
}
|
||||||
|
|
||||||
objXMLHttpReqOldTL.onreadystatechange = readOldTimelineData; // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
objXMLHttpReqOldTL.open('POST',ActionAJAX,true);
|
objXMLHttpReqOldTml.onreadystatechange = readOldTimelineData;
|
||||||
objXMLHttpReqOldTL.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttpReqOldTml.open('POST',actionAJAX,true);
|
||||||
objXMLHttpReqOldTL.send(RefreshParams);
|
objXMLHttpReqOldTml.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqOldTml.send(refreshParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive and show old social timeline data
|
|
||||||
function readOldTimelineData () {
|
function readOldTimelineData () {
|
||||||
if (objXMLHttpReqOldTL.readyState == 4) { // Check if data have been received
|
if (objXMLHttpReqOldTml.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttpReqOldTL.status == 200) {
|
if (objXMLHttpReqOldTml.status == 200) {
|
||||||
var oldTimeline = document.getElementById('old_timeline_list'); // Access to UL with the old timeline
|
// Access to UL with the old timeline
|
||||||
|
var oldTimeline = document.getElementById('old_timeline_list');
|
||||||
if (oldTimeline) {
|
if (oldTimeline) {
|
||||||
oldTimeline.innerHTML = objXMLHttpReqOldTL.responseText; // Fill list of publications in old timeline
|
// Fill list of publications in old timeline
|
||||||
|
oldTimeline.innerHTML = objXMLHttpReqOldTml.responseText;
|
||||||
|
|
||||||
var countOldTimeline = oldTimeline.childNodes.length;
|
var countOldTimeline = oldTimeline.childNodes.length;
|
||||||
if (countOldTimeline) {
|
if (countOldTimeline) {
|
||||||
// Scripts in timeline got via AJAX are not executed ==> execute them
|
// Scripts in timeline got via AJAX not executed ==> execute them
|
||||||
evalScriptsInElem (oldTimeline);
|
evalScriptsInElem (oldTimeline);
|
||||||
|
|
||||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
// Process maths; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||||
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,oldTimeline]); // old versions
|
|
||||||
MathJax.typeset();
|
MathJax.typeset();
|
||||||
|
|
||||||
// Move all the LI elements in UL 'old_timeline_list' to the bottom of UL 'timeline_list'
|
// Move all the LI elements in UL 'old_timeline_list'
|
||||||
|
// to the bottom of UL 'timeline_list'
|
||||||
var timeline = document.getElementById("timeline_list");
|
var timeline = document.getElementById("timeline_list");
|
||||||
for (var i=0; i<countOldTimeline; i++)
|
for (var i=0; i<countOldTimeline; i++)
|
||||||
timeline.appendChild(oldTimeline.firstChild);
|
timeline.appendChild(oldTimeline.firstChild);
|
||||||
|
|
||||||
// There may be more publications
|
// There may be more publications
|
||||||
document.getElementById('get_old_timeline').style.display=''; // Show icon to be hidden on click
|
// Unhide icon to be hidden on click
|
||||||
document.getElementById('getting_old_timeline').style.display='none'; // Hide icon to be shown on click
|
document.getElementById('get_old_timeline').style.display = '';
|
||||||
|
// Hide icon to be shown on click
|
||||||
|
document.getElementById('getting_old_timeline').style.display = 'none';
|
||||||
}
|
}
|
||||||
else // No old publications retrieved, so we have reached the oldest publication
|
else // No old publications retrieved, so we have reached the oldest pub.
|
||||||
// Hide container with link to get old publications
|
// Hide container with link to get old publications
|
||||||
document.getElementById("view_old_posts_container").style.display = 'none';
|
document.getElementById("view_old_pubs_container").style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1093,8 +1107,9 @@ function updateDivHiddenComments (form,Params) {
|
||||||
objXMLHttp = AJAXCreateObject ();
|
objXMLHttp = AJAXCreateObject ();
|
||||||
if (objXMLHttp) {
|
if (objXMLHttp) {
|
||||||
/* Send request to server */
|
/* Send request to server */
|
||||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
objXMLHttp.onreadystatechange = function() {
|
||||||
|
if (objXMLHttp.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttp.status == 200)
|
if (objXMLHttp.status == 200)
|
||||||
if (id) {
|
if (id) {
|
||||||
var div = document.getElementById(id); // Access to DIV
|
var div = document.getElementById(id); // Access to DIV
|
||||||
|
@ -1104,15 +1119,14 @@ function updateDivHiddenComments (form,Params) {
|
||||||
// Scripts in div got via AJAX are not executed ==> execute them
|
// Scripts in div got via AJAX are not executed ==> execute them
|
||||||
evalScriptsInElem (div);
|
evalScriptsInElem (div);
|
||||||
|
|
||||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
// Process maths; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||||
// MathJax.Hub.Queue(["Typeset",MathJax.Hub,div]); // old versions
|
|
||||||
MathJax.typeset();
|
MathJax.typeset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
objXMLHttp.open('POST',ActionAJAX,true);
|
objXMLHttp.open('POST',actionAJAX,true);
|
||||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttp.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
objXMLHttp.send(Params);
|
objXMLHttp.send(Params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1129,18 +1143,19 @@ function updateDivLockUnlockProject (form,Params) {
|
||||||
objXMLHttp = AJAXCreateObject ();
|
objXMLHttp = AJAXCreateObject ();
|
||||||
if (objXMLHttp) {
|
if (objXMLHttp) {
|
||||||
/* Send request to server */
|
/* Send request to server */
|
||||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
objXMLHttp.onreadystatechange = function() {
|
||||||
|
if (objXMLHttp.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttp.status == 200)
|
if (objXMLHttp.status == 200)
|
||||||
if (id) {
|
if (id) {
|
||||||
var div = document.getElementById(id); // Access to DIV
|
var div = document.getElementById(id); // Access to DIV
|
||||||
if (div)
|
if (div)
|
||||||
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
objXMLHttp.open('POST',ActionAJAX,true);
|
objXMLHttp.open('POST',actionAJAX,true);
|
||||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttp.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
objXMLHttp.send(Params);
|
objXMLHttp.send(Params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1157,18 +1172,19 @@ function updateDivFaversSharers (form,Params) {
|
||||||
objXMLHttp = AJAXCreateObject ();
|
objXMLHttp = AJAXCreateObject ();
|
||||||
if (objXMLHttp) {
|
if (objXMLHttp) {
|
||||||
/* Send request to server */
|
/* Send request to server */
|
||||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
// onreadystatechange must be lowercase
|
||||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
objXMLHttp.onreadystatechange = function() {
|
||||||
|
if (objXMLHttp.readyState == 4) // Check if data have been received
|
||||||
if (objXMLHttp.status == 200)
|
if (objXMLHttp.status == 200)
|
||||||
if (id) {
|
if (id) {
|
||||||
var div = document.getElementById(id); // Access to DIV
|
var div = document.getElementById(id); // Access to DIV
|
||||||
if (div)
|
if (div)
|
||||||
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
objXMLHttp.open('POST',ActionAJAX,true);
|
objXMLHttp.open('POST',actionAJAX,true);
|
||||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
objXMLHttp.setRequestHeader('Content-Type',
|
||||||
|
'application/x-www-form-urlencoded');
|
||||||
objXMLHttp.send(Params);
|
objXMLHttp.send(Params);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13551,7 +13551,8 @@ SELECT tml_pubs.PubCod,
|
||||||
"tml_pubs.PubType" // row[3]
|
"tml_pubs.PubType" // row[3]
|
||||||
" FROM tml_pubs%s"
|
" FROM tml_pubs%s"
|
||||||
" WHERE tml_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod
|
" WHERE tml_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod
|
||||||
AND "
|
AND tml_pubs.PubCod>Bottom AND "
|
||||||
|
AND tml_pubs.PubCod<Top AND "
|
||||||
" ORDER BY tml_pubs.PubCod DESC"
|
" ORDER BY tml_pubs.PubCod DESC"
|
||||||
" LIMIT 1",
|
" LIMIT 1",
|
||||||
SubQueries->Publishers.Table,
|
SubQueries->Publishers.Table,
|
||||||
|
@ -13559,4 +13560,9 @@ SELECT tml_pubs.PubCod,
|
||||||
SubQueries->RangeTop,
|
SubQueries->RangeTop,
|
||||||
SubQueries->Publishers.SubQuery,
|
SubQueries->Publishers.SubQuery,
|
||||||
SubQueries->AlreadyExists);
|
SubQueries->AlreadyExists);
|
||||||
|
|
||||||
|
|
||||||
|
SELECT MAX(PstCod) AS NewestPstCod FROM for_posts GROUP BY ThrCod ORDER BY NewestPstCod DESC LIMIT 10;
|
||||||
|
|
||||||
|
SELECT PstCod FROM for_posts ORDER BY PstCod DESC LIMIT 1;
|
||||||
|
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.58.2 (2021-11-21)"
|
#define Log_PLATFORM_VERSION "SWAD 21.59 (2021-11-22)"
|
||||||
#define CSS_FILE "swad21.57.css"
|
#define CSS_FILE "swad21.59.css"
|
||||||
#define JS_FILE "swad21.58.js"
|
#define JS_FILE "swad21.59.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 21.59: Nov 22, 2021 Code refactoring in timeline. (319149 lines)
|
||||||
Version 21.58.2: Nov 21, 2021 Code refactoring in timeline. (319135 lines)
|
Version 21.58.2: Nov 21, 2021 Code refactoring in timeline. (319135 lines)
|
||||||
Version 21.58.1: Nov 21, 2021 Code refactoring in timeline. (319131 lines)
|
Version 21.58.1: Nov 21, 2021 Code refactoring in timeline. (319131 lines)
|
||||||
Version 21.58: Nov 21, 2021 Code refactoring in timeline. (319140 lines)
|
Version 21.58: Nov 21, 2021 Code refactoring in timeline. (319140 lines)
|
||||||
|
|
|
@ -2013,7 +2013,7 @@ static void Fig_GetAndShowTestsStats (void)
|
||||||
/***** Get the stats about test questions from this location *****/
|
/***** Get the stats about test questions from this location *****/
|
||||||
Qst_GetTestStats (AnsType,&Stats);
|
Qst_GetTestStats (AnsType,&Stats);
|
||||||
|
|
||||||
/***** Write number of assignments *****/
|
/***** Write stats *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||||
|
@ -2062,7 +2062,7 @@ static void Fig_GetAndShowTestsStats (void)
|
||||||
/***** Get the stats about test questions from this location *****/
|
/***** Get the stats about test questions from this location *****/
|
||||||
Qst_GetTestStats (Qst_ANS_UNKNOWN,&Stats);
|
Qst_GetTestStats (Qst_ANS_UNKNOWN,&Stats);
|
||||||
|
|
||||||
/***** Write number of assignments *****/
|
/***** Write stats *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\"");
|
HTM_TD_Begin ("class=\"DAT_N LINE_TOP LM\"");
|
||||||
|
|
|
@ -795,33 +795,33 @@ static void Lay_WriteScriptInit (void)
|
||||||
Dat_WriteScriptMonths ();
|
Dat_WriteScriptMonths ();
|
||||||
|
|
||||||
if (RefreshNewTimeline) // Refresh new timeline via AJAX
|
if (RefreshNewTimeline) // Refresh new timeline via AJAX
|
||||||
HTM_TxtF ("\tvar delayNewTL = %lu;\n",Cfg_TIME_TO_REFRESH_TIMELINE);
|
HTM_TxtF ("\tvar delayNewTml = %lu;\n",Cfg_TIME_TO_REFRESH_TIMELINE);
|
||||||
else if (RefreshMatchStd) // Refresh match via AJAX
|
else if (RefreshMatchStd) // Refresh match via AJAX
|
||||||
HTM_TxtF ("\tvar delayMatch = %lu;\n",Cfg_TIME_TO_REFRESH_MATCH_STD);
|
HTM_TxtF ("\tvar delayMatch = %lu;\n",Cfg_TIME_TO_REFRESH_MATCH_STD);
|
||||||
else if (RefreshMatchTch) // Refresh match via AJAX
|
else if (RefreshMatchTch) // Refresh match via AJAX
|
||||||
HTM_TxtF ("\tvar delayMatch = %lu;\n",Cfg_TIME_TO_REFRESH_MATCH_TCH);
|
HTM_TxtF ("\tvar delayMatch = %lu;\n",Cfg_TIME_TO_REFRESH_MATCH_TCH);
|
||||||
|
|
||||||
/***** Function init () ******/
|
/***** Function init () ******/
|
||||||
HTM_Txt ("function init(){\n");
|
HTM_Txt ("function init() {\n");
|
||||||
|
|
||||||
HTM_TxtF ("\tActionAJAX = \"%s\";\n",Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
HTM_TxtF ("\tactionAJAX = \"%s\";\n",Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
|
|
||||||
if (RefreshConnected) // Refresh connected users via AJAX
|
if (RefreshConnected) // Refresh connected users via AJAX
|
||||||
{
|
{
|
||||||
Con_WriteScriptClockConnected ();
|
Con_WriteScriptClockConnected ();
|
||||||
HTM_TxtF ("\tsetTimeout(\"refreshConnected()\",%lu);\n",
|
HTM_TxtF ("\tsetTimeout('refreshConnected()',%lu);\n",
|
||||||
Gbl.Usrs.Connected.TimeToRefreshInMs);
|
Gbl.Usrs.Connected.TimeToRefreshInMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RefreshLastClicks) // Refresh last clicks via AJAX
|
if (RefreshLastClicks) // Refresh last clicks via AJAX
|
||||||
HTM_TxtF ("\tsetTimeout(\"refreshLastClicks()\",%lu);\n",
|
HTM_TxtF ("\tsetTimeout('refreshLastClicks()',%lu);\n",
|
||||||
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
||||||
else if (RefreshNewTimeline) // Refresh timeline via AJAX
|
else if (RefreshNewTimeline) // Refresh timeline via AJAX
|
||||||
HTM_Txt ("\tsetTimeout(\"refreshNewTL()\",delayNewTL);\n");
|
HTM_Txt ("\tsetTimeout('refreshNewTimeline()',delayNewTml);\n");
|
||||||
else if (RefreshMatchStd) // Refresh match for a student via AJAX
|
else if (RefreshMatchStd) // Refresh match for a student via AJAX
|
||||||
HTM_Txt ("\tsetTimeout(\"refreshMatchStd()\",delayMatch);\n");
|
HTM_Txt ("\tsetTimeout('refreshMatchStd()',delayMatch);\n");
|
||||||
else if (RefreshMatchTch) // Refresh match for a teacher via AJAX
|
else if (RefreshMatchTch) // Refresh match for a teacher via AJAX
|
||||||
HTM_Txt ("\tsetTimeout(\"refreshMatchTch()\",delayMatch);\n");
|
HTM_Txt ("\tsetTimeout('refreshMatchTch()',delayMatch);\n");
|
||||||
|
|
||||||
HTM_Txt ("}\n");
|
HTM_Txt ("}\n");
|
||||||
|
|
||||||
|
@ -839,15 +839,15 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
|
|
||||||
/***** Parameters with code of session and current course code *****/
|
/***** Parameters with code of session and current course code *****/
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamIdSes = \"ses=%s\";\n"
|
HTM_TxtF ("var refreshParamIdSes = \"ses=%s\";\n"
|
||||||
"var RefreshParamCrsCod = \"crs=%ld\";\n",
|
"var refreshParamCrsCod = \"crs=%ld\";\n",
|
||||||
Gbl.Session.Id,
|
Gbl.Session.Id,
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Parameter to refresh connected users *****/
|
/***** Parameter to refresh connected users *****/
|
||||||
if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB)
|
if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB)
|
||||||
// Refresh parameter
|
// Refresh parameter
|
||||||
HTM_TxtF ("var RefreshParamNxtActCon = \"act=%ld\";\n",
|
HTM_TxtF ("var refreshParamNxtActCon = \"act=%ld\";\n",
|
||||||
Act_GetActCod (ActRefCon));
|
Act_GetActCod (ActRefCon));
|
||||||
|
|
||||||
/***** Parameters related with expanding/contracting folders in file browsers *****/
|
/***** Parameters related with expanding/contracting folders in file browsers *****/
|
||||||
|
@ -855,8 +855,8 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
/* In all actions related to file browsers ==>
|
/* In all actions related to file browsers ==>
|
||||||
put parameters used by AJAX */
|
put parameters used by AJAX */
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamExpand = \"act=%ld\";\n"
|
HTM_TxtF ("var refreshParamExpand = \"act=%ld\";\n"
|
||||||
"var RefreshParamContract = \"act=%ld\";\n",
|
"var refreshParamContract = \"act=%ld\";\n",
|
||||||
Act_GetActCod (Brw_GetActionExpand ()),
|
Act_GetActCod (Brw_GetActionExpand ()),
|
||||||
Act_GetActCod (Brw_GetActionContract ()));
|
Act_GetActCod (Brw_GetActionContract ()));
|
||||||
|
|
||||||
|
@ -874,9 +874,9 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
/* In all actions related to view or editing global timeline ==>
|
/* In all actions related to view or editing global timeline ==>
|
||||||
put parameters used by AJAX */
|
put parameters used by AJAX */
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamNxtActNewPub = \"act=%ld\";\n"
|
HTM_TxtF ("var refreshParamNxtActNewPub = \"act=%ld\";\n"
|
||||||
"var RefreshParamNxtActOldPub = \"act=%ld\";\n"
|
"var refreshParamNxtActOldPub = \"act=%ld\";\n"
|
||||||
"var RefreshParamWho = \"Who=%u\";\n",
|
"var refreshParamWho = \"Who=%u\";\n",
|
||||||
Act_GetActCod (ActRefNewPubGblTL),
|
Act_GetActCod (ActRefNewPubGblTL),
|
||||||
Act_GetActCod (ActRefOldPubGblTL),
|
Act_GetActCod (ActRefOldPubGblTL),
|
||||||
(unsigned) Tml_Who_GetGlobalWho ()); // Global variable got in a priori function
|
(unsigned) Tml_Who_GetGlobalWho ()); // Global variable got in a priori function
|
||||||
|
@ -894,8 +894,8 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0)
|
if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0)
|
||||||
Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Other.UsrDat);
|
Usr_GetParamOtherUsrCodEncrypted (&Gbl.Usrs.Other.UsrDat);
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamNxtActOldPub = \"act=%ld\";\n"
|
HTM_TxtF ("var refreshParamNxtActOldPub = \"act=%ld\";\n"
|
||||||
"var RefreshParamUsr = \"OtherUsrCod=%s\";\n",
|
"var refreshParamUsr = \"OtherUsrCod=%s\";\n",
|
||||||
Act_GetActCod (ActRefOldPubUsrTL),
|
Act_GetActCod (ActRefOldPubUsrTL),
|
||||||
Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
||||||
break;
|
break;
|
||||||
|
@ -905,8 +905,8 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
case ActRemMchAnsQstStd:
|
case ActRemMchAnsQstStd:
|
||||||
case ActAnsMchQstStd:
|
case ActAnsMchQstStd:
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n"
|
HTM_TxtF ("var refreshParamNxtActMch = \"act=%ld\";\n"
|
||||||
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
"var refreshParamMchCod = \"MchCod=%ld\";\n",
|
||||||
Act_GetActCod (ActRefMchStd),
|
Act_GetActCod (ActRefMchStd),
|
||||||
Mch_GetMchCodBeingPlayed ());
|
Mch_GetMchCodBeingPlayed ());
|
||||||
break;
|
break;
|
||||||
|
@ -922,15 +922,15 @@ static void Lay_WriteScriptParamsAJAX (void)
|
||||||
// Handle keys in keyboard/presenter
|
// Handle keys in keyboard/presenter
|
||||||
HTM_Txt ("document.addEventListener(\"keydown\",handleMatchKeys);\n");
|
HTM_Txt ("document.addEventListener(\"keydown\",handleMatchKeys);\n");
|
||||||
// Refresh parameters
|
// Refresh parameters
|
||||||
HTM_TxtF ("var RefreshParamNxtActMch = \"act=%ld\";\n"
|
HTM_TxtF ("var refreshParamNxtActMch = \"act=%ld\";\n"
|
||||||
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
"var refreshParamMchCod = \"MchCod=%ld\";\n",
|
||||||
Act_GetActCod (ActRefMchTch),
|
Act_GetActCod (ActRefMchTch),
|
||||||
Mch_GetMchCodBeingPlayed ());
|
Mch_GetMchCodBeingPlayed ());
|
||||||
break;
|
break;
|
||||||
/* Parameter related with clicks refreshing */
|
/* Parameter related with clicks refreshing */
|
||||||
case ActLstClk:
|
case ActLstClk:
|
||||||
// Refresh parameter
|
// Refresh parameter
|
||||||
HTM_TxtF ("var RefreshParamNxtActLstClk = \"act=%ld\";\n",
|
HTM_TxtF ("var refreshParamNxtActLstClk = \"act=%ld\";\n",
|
||||||
Act_GetActCod (ActRefLstClk));
|
Act_GetActCod (ActRefLstClk));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -381,9 +381,9 @@ static void Tml_GetAndShowOldTimeline (struct Tml_Timeline *Timeline)
|
||||||
Hidden < __v__
|
Hidden < __v__
|
||||||
| |_____| new_timeline_list (Posts retrieved but hidden.
|
| |_____| new_timeline_list (Posts retrieved but hidden.
|
||||||
| |_____| When user clicks to view them,
|
| |_____| When user clicks to view them,
|
||||||
| |_____| they are transferred
|
| |_____| the most recent of each note is
|
||||||
\ |_____| to visible timeline_list.)
|
\ |_____| is transferred
|
||||||
|
|
| to visible timeline_list.)
|
||||||
__v__
|
__v__
|
||||||
/ |_____| timeline_list (Posts visible on page)
|
/ |_____| timeline_list (Posts visible on page)
|
||||||
| |_____|
|
| |_____|
|
||||||
|
@ -424,14 +424,14 @@ static void Tml_ShowTimeline (struct Tml_Timeline *Timeline,
|
||||||
/***** New publications refreshed dynamically via AJAX *****/
|
/***** New publications refreshed dynamically via AJAX *****/
|
||||||
if (GlobalTimeline)
|
if (GlobalTimeline)
|
||||||
{
|
{
|
||||||
/* Link to view new publications via AJAX */
|
|
||||||
Tml_Pub_PutLinkToViewNewPubs ();
|
|
||||||
|
|
||||||
/* Hidden lists to insert publications received via AJAX:
|
/* Hidden lists to insert publications received via AJAX:
|
||||||
1. just received (not visible) publications
|
1. just received (not visible) publications
|
||||||
2. new (not visible) publications */
|
2. new (not visible) publications */
|
||||||
Tml_PutHiddenList ("just_now_timeline_list");
|
Tml_PutHiddenList ("just_now_timeline_list");
|
||||||
Tml_PutHiddenList ("new_timeline_list");
|
Tml_PutHiddenList ("new_timeline_list");
|
||||||
|
|
||||||
|
/* Link to view new publications via AJAX */
|
||||||
|
Tml_Pub_PutLinkToViewNewPubs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** List recent publications in timeline.
|
/***** List recent publications in timeline.
|
||||||
|
|
|
@ -121,10 +121,10 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
|______| / |______| ->|______| ______
|
|______| / |______| ->|______| ______
|
||||||
|______| / |______| / |______| ->|______|
|
|______| / |______| / |______| ->|______|
|
||||||
|_Next_|-- |______| / |______| // |______|
|
|_Next_|-- |______| / |______| // |______|
|
||||||
|_Next_|-- |______| // |______|
|
more recent |_Next_|-- |______| // |______|
|
||||||
______ |_Next_|--/ |______|
|
______ |_Next_|--/ |______|
|
||||||
|______|---------------------------------------------- |_NULL_|
|
|______|---------------------------------------------- |_NULL_|
|
||||||
|
older
|
||||||
Timeline->Pubs.Bottom
|
Timeline->Pubs.Bottom
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -147,7 +147,8 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
SELECT MAX(PubCod) AS NewestPubCod
|
SELECT MAX(PubCod) AS NewestPubCod
|
||||||
FROM tml_pubs ...
|
FROM tml_pubs ...
|
||||||
GROUP BY NotCod
|
GROUP BY NotCod
|
||||||
ORDER BY NewestPubCod DESC LIMIT ...
|
ORDER BY NewestPubCod DESC
|
||||||
|
LIMIT 10
|
||||||
but this query is slow (several seconds) with a big table.
|
but this query is slow (several seconds) with a big table.
|
||||||
*/
|
*/
|
||||||
for (NumPub = 0;
|
for (NumPub = 0;
|
||||||
|
@ -462,8 +463,8 @@ void Tml_Pub_PutLinkToViewNewPubs (void)
|
||||||
|
|
||||||
/***** Link to view (show hidden) new publications *****/
|
/***** Link to view (show hidden) new publications *****/
|
||||||
/* Begin container */
|
/* Begin container */
|
||||||
// div is hidden. When new posts arrive to the client via AJAX, div is shown
|
// div is hidden. When new notes arrive to the client via AJAX, div is shown
|
||||||
HTM_DIV_Begin ("id=\"view_new_posts_container\""
|
HTM_DIV_Begin ("id=\"view_new_container\""
|
||||||
" class=\"Tml_WIDTH Tml_SEP VERY_LIGHT_BLUE\""
|
" class=\"Tml_WIDTH Tml_SEP VERY_LIGHT_BLUE\""
|
||||||
" style=\"display:none;\"");
|
" style=\"display:none;\"");
|
||||||
|
|
||||||
|
@ -474,7 +475,7 @@ void Tml_Pub_PutLinkToViewNewPubs (void)
|
||||||
|
|
||||||
/* Text */
|
/* Text */
|
||||||
HTM_TxtF ("%s (",Txt_See_new_activity);
|
HTM_TxtF ("%s (",Txt_See_new_activity);
|
||||||
HTM_SPAN_Begin ("id=\"view_new_posts_count\"");
|
HTM_SPAN_Begin ("id=\"view_new_count\"");
|
||||||
HTM_Unsigned (0);
|
HTM_Unsigned (0);
|
||||||
HTM_SPAN_End ();
|
HTM_SPAN_End ();
|
||||||
HTM_Txt (")");
|
HTM_Txt (")");
|
||||||
|
@ -497,7 +498,7 @@ void Tml_Pub_PutLinkToViewOldPubs (void)
|
||||||
|
|
||||||
/***** Animated link to view old publications *****/
|
/***** Animated link to view old publications *****/
|
||||||
/* Begin container */
|
/* Begin container */
|
||||||
HTM_DIV_Begin ("id=\"view_old_posts_container\""
|
HTM_DIV_Begin ("id=\"view_old_pubs_container\""
|
||||||
" class=\"Tml_WIDTH Tml_SEP VERY_LIGHT_BLUE\"");
|
" class=\"Tml_WIDTH Tml_SEP VERY_LIGHT_BLUE\"");
|
||||||
|
|
||||||
/* Begin anchor */
|
/* Begin anchor */
|
||||||
|
|
Loading…
Reference in New Issue