mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-18 14:35:46 +02:00
Version19.14.6
This commit is contained in:
parent
55b7d0a883
commit
6c5b219252
|
@ -513,35 +513,35 @@ function readConnUsrsData () {
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Automatic refresh of current game question using AJAX ***********/
|
||||
/********** Automatic refresh of current match question using AJAX ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
// This function must be called from time to time
|
||||
var objXMLHttpReqGam = false;
|
||||
function refreshGame () {
|
||||
objXMLHttpReqGam = AJAXCreateObject();
|
||||
if (objXMLHttpReqGam) {
|
||||
var RefreshParams = RefreshParamNxtActGam + '&' +
|
||||
var objXMLHttpReqMch = false;
|
||||
function refreshMatch () {
|
||||
objXMLHttpReqMch = AJAXCreateObject();
|
||||
if (objXMLHttpReqMch) {
|
||||
var RefreshParams = RefreshParamNxtActMch + '&' +
|
||||
RefreshParamMchCod + '&' +
|
||||
RefreshParamIdSes;
|
||||
|
||||
objXMLHttpReqGam.onreadystatechange = readGameData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqGam.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqGam.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
||||
objXMLHttpReqGam.send(RefreshParams);
|
||||
objXMLHttpReqMch.onreadystatechange = readMatchData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqMch.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqMch.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
||||
objXMLHttpReqMch.send(RefreshParams);
|
||||
}
|
||||
}
|
||||
|
||||
function readGameData () {
|
||||
if (objXMLHttpReqGam.readyState == 4) { // Check if data have been received
|
||||
if (objXMLHttpReqGam.status == 200) {
|
||||
var htmlGame = objXMLHttpReqGam.responseText; // Get HTML code for last clicks
|
||||
function readMatchData () {
|
||||
if (objXMLHttpReqMch.readyState == 4) { // Check if data have been received
|
||||
if (objXMLHttpReqMch.status == 200) {
|
||||
var htmlMatch = objXMLHttpReqMch.responseText; // Get HTML code for match
|
||||
|
||||
var divGame = document.getElementById('game'); // Access to game DIV
|
||||
var divGame = document.getElementById('match'); // Access to game DIV
|
||||
if (divGame)
|
||||
divGame.innerHTML = htmlGame; // Update game DIV
|
||||
divGame.innerHTML = htmlMatch; // Update game DIV
|
||||
// Global delay variable is set initially in swad-core
|
||||
setTimeout('refreshGame()',delayGame);
|
||||
setTimeout('refreshMatch()',delayMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -470,13 +470,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.14.5 (2019-09-26)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.14.6 (2019-09-26)"
|
||||
#define CSS_FILE "swad19.3.css"
|
||||
#define JS_FILE "swad18.130.2.js"
|
||||
/*
|
||||
// Version 19.*: Sep 26, 2019 TODO: Make it impossible to edit (create/delete/move) questions from a game when it has matches. (? lines)
|
||||
|
||||
Version 19.15: Sep 26, 2019 Refresh only left part of the teacher's screen when playing a match. (? lines)
|
||||
Version 19.14.6: Sep 26, 2019 Code refactoring related to match refreshing. (246294 lines)
|
||||
Version 19.14.5: Sep 26, 2019 Code refactoring related to match playing. (246291 lines)
|
||||
Version 19.14.4: Sep 26, 2019 Fixed bug creating a new match. (246273 lines)
|
||||
6 changes necessary in database:
|
||||
|
|
|
@ -677,7 +677,7 @@ static void Lay_WriteScriptInit (void)
|
|||
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
|
||||
bool RefreshConnected;
|
||||
bool RefreshNewTimeline = false;
|
||||
bool RefreshGame = false;
|
||||
bool RefreshMatch = false;
|
||||
bool RefreshLastClicks = false;
|
||||
|
||||
RefreshConnected = Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB &&
|
||||
|
@ -701,9 +701,11 @@ static void Lay_WriteScriptInit (void)
|
|||
case ActBckMchTch:
|
||||
case ActFwdMchTch:
|
||||
case ActChgVisResMchQst:
|
||||
RefreshMatch = true;
|
||||
break;
|
||||
case ActPlyMchStd:
|
||||
case ActAnsMchQstStd:
|
||||
RefreshGame = true;
|
||||
RefreshMatch = true;
|
||||
break;
|
||||
case ActLstClk:
|
||||
RefreshLastClicks = true;
|
||||
|
@ -719,8 +721,8 @@ static void Lay_WriteScriptInit (void)
|
|||
if (RefreshNewTimeline)
|
||||
fprintf (Gbl.F.Out,"\tvar delayNewTimeline = %lu;\n",
|
||||
Cfg_TIME_TO_REFRESH_TIMELINE);
|
||||
else if (RefreshGame) // Refresh game via AJAX
|
||||
fprintf (Gbl.F.Out,"\tvar delayGame = %lu;\n",
|
||||
else if (RefreshMatch) // Refresh match via AJAX
|
||||
fprintf (Gbl.F.Out,"\tvar delayMatch = %lu;\n",
|
||||
Cfg_TIME_TO_REFRESH_GAME);
|
||||
|
||||
fprintf (Gbl.F.Out,"function init(){\n");
|
||||
|
@ -738,8 +740,8 @@ static void Lay_WriteScriptInit (void)
|
|||
if (RefreshLastClicks) // Refresh last clicks via AJAX
|
||||
fprintf (Gbl.F.Out,"\tsetTimeout(\"refreshLastClicks()\",%lu);\n",
|
||||
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
||||
else if (RefreshGame) // Refresh game via AJAX
|
||||
fprintf (Gbl.F.Out,"\tsetTimeout(\"refreshGame()\",delayGame);\n");
|
||||
else if (RefreshMatch) // Refresh match via AJAX
|
||||
fprintf (Gbl.F.Out,"\tsetTimeout(\"refreshMatch()\",delayMatch);\n");
|
||||
else if (RefreshNewTimeline) // Refresh timeline via AJAX
|
||||
fprintf (Gbl.F.Out,"\tsetTimeout(\"refreshNewTimeline()\",delayNewTimeline);\n");
|
||||
|
||||
|
@ -824,7 +826,7 @@ static void Lay_WriteScriptParamsAJAX (void)
|
|||
case ActBckMchTch:
|
||||
case ActFwdMchTch:
|
||||
case ActChgVisResMchQst:
|
||||
fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n"
|
||||
fprintf (Gbl.F.Out,"var RefreshParamNxtActMch = \"act=%ld\";\n"
|
||||
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
||||
Act_GetActCod (ActRefMchTch),
|
||||
Gbl.Games.MchCodBeingPlayed);
|
||||
|
@ -832,7 +834,7 @@ static void Lay_WriteScriptParamsAJAX (void)
|
|||
/* Parameters related with match refreshing (for students) */
|
||||
case ActPlyMchStd:
|
||||
case ActAnsMchQstStd:
|
||||
fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n"
|
||||
fprintf (Gbl.F.Out,"var RefreshParamNxtActMch = \"act=%ld\";\n"
|
||||
"var RefreshParamMchCod = \"MchCod=%ld\";\n",
|
||||
Act_GetActCod (ActRefMchStd),
|
||||
Gbl.Games.MchCodBeingPlayed);
|
||||
|
|
16
swad_match.c
16
swad_match.c
|
@ -1284,7 +1284,7 @@ void Mch_RequestStartResumeMatchTch (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -1672,7 +1672,7 @@ void Mch_PauseMatchTch (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -1705,7 +1705,7 @@ void Mch_ResumeMatchTch (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -1736,7 +1736,7 @@ void Mch_ToggleVisibilResultsMchQst (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -1764,7 +1764,7 @@ void Mch_BackMatchTch (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -1792,7 +1792,7 @@ void Mch_ForwardMatchTch (void)
|
|||
Mch_UpdateMatchStatusInDB (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForTch (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -2611,7 +2611,7 @@ void Mch_ShowMatchToMeAsStd (void)
|
|||
Mch_GetDataOfMatchByCod (&Match);
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForStd (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
@ -2822,7 +2822,7 @@ void Mch_ReceiveQstAnsFromStd (void)
|
|||
}
|
||||
|
||||
/***** Show current match status *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
|
||||
fprintf (Gbl.F.Out,"<div id=\"match\" class=\"MATCH_CONT\">");
|
||||
Mch_ShowMatchStatusForStd (&Match);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user