Version18.123

This commit is contained in:
Antonio Cañas Vargas 2019-05-22 09:36:18 +02:00
parent b3d9b1cdb2
commit 24e2bbde64
12 changed files with 491 additions and 302 deletions

View File

@ -6,7 +6,7 @@
and used to support university teaching. and used to support university teaching.
This file is part of SWAD core. This file is part of SWAD core.
Copyright (C) 1999-2019 Antonio Cañas Vargas Copyright (C) 1999-2019 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General 3 License as it under the terms of the GNU Affero General 3 License as
@ -1459,38 +1459,6 @@ a:hover /* Default ==> underlined */
background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2));
} }
.BT_A {background-color:#e21c3d; border-color:#a9152d;} /* red */
.BT_B {background-color:#1369ce; border-color:#0e519c;} /* blue */
.BT_C {background-color:#d89e00; border-color:#a27600;} /* yellow */
.BT_D {background-color:#2b9010; border-color:#206c0c;} /* green */
.BT_E {background-color:#e30087; border-color:#aa0064;} /* pink */
.BT_F {background-color:#00b5e9; border-color:#0089b0;} /* light blue */
.BT_G {background-color:#f58700; border-color:#b86400;} /* orange */
.BT_H {background-color:#b3d00a; border-color:#869d07;} /* light green */
.BT_I {background-color:#642075; border-color:#4b1858;} /* purple */
.BT_J {background-color:#f5e800; border-color:#b8ad00;} /* light yellow */
.BT_GAME
{
box-sizing:border-box;
width:64px;
margin:8px;
padding:8px;
border-radius:4px;
border-width:1px;
border-style:solid;
box-shadow:0 1px 0 rgba(255,255,255,0.15) inset;
color:white;
font-size:36px;
font-weight:bold;
line-height:normal;
white-space:nowrap;
}
.BT_GAME:hover
{
background-image:-webkit-linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); /* Safari */
background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2));
}
/********************************** Notice ***********************************/ /********************************** Notice ***********************************/
.NOTICE_HIGHLIGHT .NOTICE_HIGHLIGHT
{ {
@ -2133,13 +2101,13 @@ a:hover img.CENTRE_PHOTO_SHOW
.NOWRAP {white-space:nowrap;} .NOWRAP {white-space:nowrap;}
/****************************** Placing of objects ***************************/ /****************************** Placing of objects ***************************/
.LEFT_TOP {text-align:left; vertical-align:top;} .LEFT_TOP {text-align:left; vertical-align:top;}
.LEFT_MIDDLE {text-align:left; vertical-align:middle;} .LEFT_MIDDLE {text-align:left; vertical-align:middle;}
.LEFT_BOTTOM {text-align:left; vertical-align:bottom;} .LEFT_BOTTOM {text-align:left; vertical-align:bottom;}
.CENTER_TOP {text-align:center; vertical-align:top;} .CENTER_TOP {text-align:center; vertical-align:top;}
.CENTER_MIDDLE {text-align:center; vertical-align:middle;} .CENTER_MIDDLE {text-align:center; vertical-align:middle;}
.CENTER_BOTTOM {text-align:center; vertical-align:bottom;} .CENTER_BOTTOM {text-align:center; vertical-align:bottom;}
.RIGHT_TOP {text-align:right; vertical-align:top;} .RIGHT_TOP {text-align:right; vertical-align:top;}
.RIGHT_MIDDLE {text-align:right; vertical-align:middle;} .RIGHT_MIDDLE {text-align:right; vertical-align:middle;}
.RIGHT_BOTTOM {text-align:right; vertical-align:bottom;} .RIGHT_BOTTOM {text-align:right; vertical-align:bottom;}
@ -2596,54 +2564,132 @@ a:hover img.CENTRE_PHOTO_SHOW
} }
/********************************** Games ************************************/ /********************************** Games ************************************/
.GAM_PLAY_CONTAINER .GAM_PLAY_TCH_CONTAINER
{ {
box-sizing:border-box; box-sizing:border-box;
display:table; display:table;
margin:5%; margin:5%;
width:90%; width:90%;
} }
.GAM_PLAY_NUM_QST .GAM_PLAY_TCH_NUM_QST
{ {
width:10%; width:15%;
float:left; float:left;
/* position:relative; */
padding-bottom:24pt; padding-bottom:24pt;
color:#808080; color:#808080;
font-size:48pt; font-size:48pt;
font-weight:bold; font-weight:bold;
} }
.GAM_PLAY_QST_CONTAINER .GAM_PLAY_TCH_QST_CONTAINER
{ {
width:80%; width:70%;
float:left; float:left;
/* position:relative; */
} }
.GAM_PLAY_NXT_CONTAINER .GAM_PLAY_TCH_NXT_CONTAINER
{ {
width:10%; width:15%;
float:left; float:left;
/* position:relative; */
} }
.GAM_PLAY_QST .GAM_PLAY_TCH_QST
{ {
color:#202020; color:#202020;
font-size:24pt; font-size:24pt;
} }
.GAM_PLAY_CONTINUE_CONTAINER .GAM_PLAY_TCH_CONTINUE_CONTAINER
{ {
clear:all; clear:all;
text-align:center; text-align:center;
} }
.GAM_PLAY_CONTINUE_CONTAINER a .GAM_PLAY_TCH_CONTINUE_CONTAINER a
{ {
text-decoration:none; text-decoration:none;
} }
.GAM_PLAY_CONTINUE .GAM_PLAY_TCH_CONTINUE
{ {
font-size:16pt; font-size:16pt;
} }
.GAM_PLAY_STD_CONTAINER
{
box-sizing:border-box;
display:table;
margin:5%;
width:90%;
}
.GAM_PLAY_STD_NUM_QST
{
width:15%;
float:left;
padding-bottom:24pt;
color:#808080;
font-size:48pt;
font-weight:bold;
}
.GAM_PLAY_STD_QST_CONTAINER
{
width:85%;
float:left;
}
.GAM_PLAY_STD_QST
{
color:#202020;
font-size:24pt;
}
.GAM_PLAY_TCH_BUTTON
{
box-sizing:border-box;
width:64px;
margin:8px;
padding:8px;
border-radius:4px;
border-width:1px;
border-style:solid;
box-shadow:0 1px 0 rgba(255,255,255,0.15) inset;
color:white;
font-size:36pt;
font-weight:bold;
line-height:normal;
white-space:nowrap;
}
.GAM_PLAY_STD_CELL
{
text-align:center;
vertical-align:middle;
}
.GAM_PLAY_STD_BUTTON
{
box-sizing:border-box;
width:80%;
margin:10px auto;
padding:20px;
border-radius:4px;
border-width:1px;
border-style:solid;
box-shadow:0 1px 0 rgba(255,255,255,0.15) inset;
color:white;
font-size:44pt;
font-weight:bold;
line-height:normal;
white-space:nowrap;
}
.GAM_PLAY_TCH_BUTTON:hover, .GAM_PLAY_STD_BUTTON:hover
{
background-image:-webkit-linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); /* Safari */
background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2));
}
.BT_A {background-color:#e21c3d; border-color:#a9152d;} /* red */
.BT_B {background-color:#1369ce; border-color:#0e519c;} /* blue */
.BT_C {background-color:#d89e00; border-color:#a27600;} /* yellow */
.BT_D {background-color:#2b9010; border-color:#206c0c;} /* green */
.BT_E {background-color:#e30087; border-color:#aa0064;} /* pink */
.BT_F {background-color:#00b5e9; border-color:#0089b0;} /* light blue */
.BT_G {background-color:#f58700; border-color:#b86400;} /* orange */
.BT_H {background-color:#b3d00a; border-color:#869d07;} /* light green */
.BT_I {background-color:#642075; border-color:#4b1858;} /* purple */
.BT_J {background-color:#f5e800; border-color:#b8ad00;} /* light yellow */
/******************************* Time table **********************************/ /******************************* Time table **********************************/
#timetable #timetable
{ {

View File

@ -4,7 +4,7 @@
SWAD (Shared Workspace At a Distance), SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
and used to support university teaching. and used to support university teaching.
Copyright (C) 1999-2019 Antonio Cañas-Vargas Copyright (C) 1999-2019 Antonio Ca<EFBFBD>as-Vargas
University of Granada (SPAIN) (acanas@ugr.es) University of Granada (SPAIN) (acanas@ugr.es)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@ -512,6 +512,40 @@ function readConnUsrsData () {
} }
} }
/*****************************************************************************/
/*********** Automatic refresh of current game question using AJAX ***********/
/*****************************************************************************/
// This function must be called from time to time
var objXMLHttpReqGam = false;
function refreshGame () {
objXMLHttpReqGam = AJAXCreateObject();
if (objXMLHttpReqGam) {
var RefreshParams = RefreshParamNxtActGam + '&' +
RefreshParamGamCod + '&' +
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);
}
}
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
var divGame = document.getElementById('game'); // Access to game DIV
if (divGame)
divGame.innerHTML = htmlGame; // Update game DIV
// Global delay variable is set initially in swad-core
setTimeout('refreshGame()',delayGame);
}
}
}
/*****************************************************************************/ /*****************************************************************************/
/**************** Automatic refresh of last clicks using AJAX ****************/ /**************** Automatic refresh of last clicks using AJAX ****************/
/*****************************************************************************/ /*****************************************************************************/
@ -521,13 +555,13 @@ var objXMLHttpReqLog = false;
function refreshLastClicks () { function refreshLastClicks () {
objXMLHttpReqLog = AJAXCreateObject(); objXMLHttpReqLog = AJAXCreateObject();
if (objXMLHttpReqLog) { if (objXMLHttpReqLog) {
var RefreshParams = RefreshParamNxtActLog + '&' + var RefreshParams = RefreshParamNxtActLstClk + '&' +
RefreshParamIdSes + '&' + RefreshParamIdSes + '&' +
RefreshParamCrsCod; RefreshParamCrsCod;
objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase
objXMLHttpReqLog.open('POST',ActionAJAX,true); objXMLHttpReqLog.open('POST',ActionAJAX,true);
objXMLHttpReqLog.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); objXMLHttpReqLog.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
objXMLHttpReqLog.send(RefreshParams); objXMLHttpReqLog.send(RefreshParams);
} }
} }
@ -564,7 +598,7 @@ function refreshNewTimeline () {
objXMLHttpReqNewTL.onreadystatechange = readNewTimelineData; // onreadystatechange must be lowercase objXMLHttpReqNewTL.onreadystatechange = readNewTimelineData; // onreadystatechange must be lowercase
objXMLHttpReqNewTL.open('POST',ActionAJAX,true); objXMLHttpReqNewTL.open('POST',ActionAJAX,true);
objXMLHttpReqNewTL.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); objXMLHttpReqNewTL.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
objXMLHttpReqNewTL.send(RefreshParams); objXMLHttpReqNewTL.send(RefreshParams);
} }
} }

View File

@ -93,10 +93,6 @@ extern struct Globals Gbl;
1. ActUnk Unknown action 1. ActUnk Unknown action
2. ActMnu Show menu of a tab 2. ActMnu Show menu of a tab
3. ActRefCon Refresh number of notifications and connected users via AJAX 3. ActRefCon Refresh number of notifications and connected users via AJAX
4. ActRefLstClk Refresh last clicks in log via AJAX
5. ActRefNewSocPubGbl Refresh recent social timeline via AJAX
6. ActRefOldSocPubGbl View old social timeline with users I follow via AJAX
7. ActRefOldSocPubUsr View old social timeline of a user via AJAX
8. ActWebSvc Call plugin function 8. ActWebSvc Call plugin function
Start: Start:
@ -117,6 +113,8 @@ Start:
22. ActSch Search for courses, teachers, documents... 22. ActSch Search for courses, teachers, documents...
5. ActRefNewSocPubGbl Refresh recent social timeline via AJAX
6. ActRefOldSocPubGbl View old social timeline with users I follow via AJAX
23. ActRcvSocPstGbl Receive a public social post to be displayed in the timeline (global) 23. ActRcvSocPstGbl Receive a public social post to be displayed in the timeline (global)
24. ActRcvSocComGbl Comment a social note in the timeline (global) 24. ActRcvSocComGbl Comment a social note in the timeline (global)
25. ActAllShaSocNotGbl Show all users who have shared a note in the timeline (global) 25. ActAllShaSocNotGbl Show all users who have shared a note in the timeline (global)
@ -135,6 +133,7 @@ Start:
38. ActReqOthPubPrf Request @nickname to show a public user's profile 38. ActReqOthPubPrf Request @nickname to show a public user's profile
7. ActRefOldSocPubUsr View old social timeline of a user via AJAX
39. ActRcvSocPstUsr Receive a public social post to be displayed in the timeline (user) 39. ActRcvSocPstUsr Receive a public social post to be displayed in the timeline (user)
40. ActRcvSocComUsr Comment a social note in the timeline (user) 40. ActRcvSocComUsr Comment a social note in the timeline (user)
41. ActAllShaSocNotUsr Show all users who have shared a note in the timeline (user) 41. ActAllShaSocNotUsr Show all users who have shared a note in the timeline (user)
@ -614,6 +613,7 @@ Assessment:
NEW. ActPlyGamStd Play a game (by a student) NEW. ActPlyGamStd Play a game (by a student)
NEW. ActGamStdCurQst Show current question when playing a game (by a student) NEW. ActGamStdCurQst Show current question when playing a game (by a student)
NEW. ActRefGamStd Refresh current question when playing a game (by a student)
459. ActAnsGam Answer a game 459. ActAnsGam Answer a game
460. ActFrmNewGam Form to create a new game 460. ActFrmNewGam Form to create a new game
@ -1504,7 +1504,8 @@ Statistics:
1279. ActSeeAccCrs Query clicks to current course 1279. ActSeeAccCrs Query clicks to current course
1280. ActSeeAllStaCrs Show statistics of courses 1280. ActSeeAllStaCrs Show statistics of courses
1281. ActLstClk List last clicks in real time 1281. ActLstClk List last clicks
4. ActRefLstClk Refresh last clicks in real time via AJAX
1282. ActSeeMyUsgRep Show my usage report 1282. ActSeeMyUsgRep Show my usage report
@ -1618,10 +1619,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActUnk */{ 194,-1,TabUnk,ActUnk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, /* ActUnk */{ 194,-1,TabUnk,ActUnk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL},
/* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL}, /* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,NULL ,NULL},
/* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,Lay_RefreshNotifsAndConnected ,NULL}, /* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,Lay_RefreshNotifsAndConnected ,NULL},
/* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,Lay_RefreshLastClicks ,NULL},
/* ActRefNewSocPubGbl*/{1509,-1,TabUnk,ActRefNewSocPubGbl ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,TL_RefreshNewTimelineGbl ,NULL},
/* ActRefOldSocPubGbl*/{1510,-1,TabUnk,ActRefOldSocPubGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineGbl ,NULL},
/* ActRefOldSocPubUsr*/{1511,-1,TabUnk,ActRefOldSocPubUsr ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineUsr ,NULL},
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_WEB_SERVICE,NULL ,API_WebService ,NULL}, /* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_WEB_SERVICE,NULL ,API_WebService ,NULL},
// TabStr ****************************************************************** // TabStr ******************************************************************
@ -1642,6 +1639,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActSch */{ 628,-1,TabUnk,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Sch_GetParamsSearch ,Sch_SysSearch ,NULL}, /* ActSch */{ 628,-1,TabUnk,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Sch_GetParamsSearch ,Sch_SysSearch ,NULL},
/* ActRefNewSocPubGbl*/{1509,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,TL_RefreshNewTimelineGbl ,NULL},
/* ActRefOldSocPubGbl*/{1510,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineGbl ,NULL},
/* ActRcvSocPstGbl */{1492,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ReceivePostGbl ,NULL}, /* ActRcvSocPstGbl */{1492,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ReceivePostGbl ,NULL},
/* ActRcvSocComGbl */{1503,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ReceiveCommentGbl ,NULL}, /* ActRcvSocComGbl */{1503,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ReceiveCommentGbl ,NULL},
/* ActAllShaSocNotGbl*/{1766,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_ShowAllSharersNoteGbl ,NULL}, /* ActAllShaSocNotGbl*/{1766,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_ShowAllSharersNoteGbl ,NULL},
@ -1660,6 +1659,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqOthPubPrf */{1401,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_RequestUserProfile ,NULL}, /* ActReqOthPubPrf */{1401,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_RequestUserProfile ,NULL},
/* ActRefOldSocPubUsr*/{1511,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineUsr ,NULL},
/* ActRcvSocPstUsr */{1498,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_ReceivePostUsr ,NULL}, /* ActRcvSocPstUsr */{1498,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_ReceivePostUsr ,NULL},
/* ActRcvSocComUsr */{1504,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_ReceiveCommentUsr ,NULL}, /* ActRcvSocComUsr */{1504,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_ReceiveCommentUsr ,NULL},
/* ActAllShaSocNotUsr*/{1769,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_ShowAllSharersNoteUsr ,NULL}, /* ActAllShaSocNotUsr*/{1769,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_ShowAllSharersNoteUsr ,NULL},
@ -2148,7 +2148,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActGamTchEnd */{1781,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchEnd ,NULL}, /* ActGamTchEnd */{1781,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_GameTchEnd ,NULL},
/* ActPlyGamStd */{1779,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGameStd ,NULL}, /* ActPlyGamStd */{1779,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGameStd ,NULL},
/* ActGamStdCurQst */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_GameStdCurrentQuestion ,NULL}, /* ActGamStdCurQst */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetGameBeingPlayed ,Gam_ShowNewGameToMeAsStd ,NULL},
/* ActRefGamStd */{1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Gam_GetGameBeingPlayed ,Gam_RefreshCurrentGameStd ,NULL},
/* ActAnsGam */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveGameAnswers ,NULL}, /* ActAnsGam */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveGameAnswers ,NULL},
/* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL}, /* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
@ -3107,6 +3108,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActSeeAllStaCrs */{ 768,-1,TabUnk,ActReqAccGbl ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Ind_ShowIndicatorsCourses ,NULL}, /* ActSeeAllStaCrs */{ 768,-1,TabUnk,ActReqAccGbl ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Ind_ShowIndicatorsCourses ,NULL},
/* ActLstClk */{ 989,-1,TabUnk,ActReqAccGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sta_ShowLastClicks ,NULL}, /* ActLstClk */{ 989,-1,TabUnk,ActReqAccGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sta_ShowLastClicks ,NULL},
/* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,Lay_RefreshLastClicks ,NULL},
/* ActSeeMyUsgRep */{1582,-1,TabUnk,ActReqMyUsgRep ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rep_ShowMyUsageReport ,NULL}, /* ActSeeMyUsgRep */{1582,-1,TabUnk,ActReqMyUsgRep ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rep_ShowMyUsageReport ,NULL},
@ -4981,6 +4983,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActPlyGamStd, // #1779 ActPlyGamStd, // #1779
ActGamStdCurQst, // #1780 ActGamStdCurQst, // #1780
ActGamTchEnd, // #1781 ActGamTchEnd, // #1781
ActRefGamStd, // #1782
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@ -64,9 +64,9 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 166 + 437 + 176 + 169 + 15 + 67) #define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 167 + 437 + 176 + 169 + 16 + 67)
#define Act_MAX_ACTION_COD 1781 #define Act_MAX_ACTION_COD 1782
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -78,14 +78,9 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActUnk 1 #define ActUnk 1
#define ActMnu 2 #define ActMnu 2
// The following 5 actions use AJAX to refresh only a part of the page
#define ActRefCon 3 #define ActRefCon 3
#define ActRefLstClk 4
#define ActRefNewSocPubGbl 5
#define ActRefOldSocPubGbl 6
#define ActRefOldSocPubUsr 7
#define ActWebSvc 8 #define ActWebSvc 4
/*****************************************************************************/ /*****************************************************************************/
/********************************* Start tab *********************************/ /********************************* Start tab *********************************/
@ -109,59 +104,62 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActSch (ActWebSvc + 14) #define ActSch (ActWebSvc + 14)
#define ActRcvSocPstGbl (ActWebSvc + 15) #define ActRefNewSocPubGbl (ActWebSvc + 15)
#define ActRcvSocComGbl (ActWebSvc + 16) #define ActRefOldSocPubGbl (ActWebSvc + 16)
#define ActAllShaSocNotGbl (ActWebSvc + 17) #define ActRcvSocPstGbl (ActWebSvc + 17)
#define ActAllFavSocNotGbl (ActWebSvc + 18) #define ActRcvSocComGbl (ActWebSvc + 18)
#define ActAllFavSocComGbl (ActWebSvc + 19) #define ActAllShaSocNotGbl (ActWebSvc + 19)
#define ActShaSocNotGbl (ActWebSvc + 20) #define ActAllFavSocNotGbl (ActWebSvc + 20)
#define ActUnsSocNotGbl (ActWebSvc + 21) #define ActAllFavSocComGbl (ActWebSvc + 21)
#define ActFavSocNotGbl (ActWebSvc + 22) #define ActShaSocNotGbl (ActWebSvc + 22)
#define ActUnfSocNotGbl (ActWebSvc + 23) #define ActUnsSocNotGbl (ActWebSvc + 23)
#define ActFavSocComGbl (ActWebSvc + 24) #define ActFavSocNotGbl (ActWebSvc + 24)
#define ActUnfSocComGbl (ActWebSvc + 25) #define ActUnfSocNotGbl (ActWebSvc + 25)
#define ActReqRemSocPubGbl (ActWebSvc + 26) #define ActFavSocComGbl (ActWebSvc + 26)
#define ActRemSocPubGbl (ActWebSvc + 27) #define ActUnfSocComGbl (ActWebSvc + 27)
#define ActReqRemSocComGbl (ActWebSvc + 28) #define ActReqRemSocPubGbl (ActWebSvc + 28)
#define ActRemSocComGbl (ActWebSvc + 29) #define ActRemSocPubGbl (ActWebSvc + 29)
#define ActReqRemSocComGbl (ActWebSvc + 30)
#define ActRemSocComGbl (ActWebSvc + 31)
#define ActReqOthPubPrf (ActWebSvc + 30) #define ActReqOthPubPrf (ActWebSvc + 32)
#define ActRcvSocPstUsr (ActWebSvc + 31) #define ActRefOldSocPubUsr (ActWebSvc + 33)
#define ActRcvSocComUsr (ActWebSvc + 32) #define ActRcvSocPstUsr (ActWebSvc + 34)
#define ActAllShaSocNotUsr (ActWebSvc + 33) #define ActRcvSocComUsr (ActWebSvc + 35)
#define ActAllFavSocNotUsr (ActWebSvc + 34) #define ActAllShaSocNotUsr (ActWebSvc + 36)
#define ActAllFavSocComUsr (ActWebSvc + 35) #define ActAllFavSocNotUsr (ActWebSvc + 37)
#define ActShaSocNotUsr (ActWebSvc + 36) #define ActAllFavSocComUsr (ActWebSvc + 38)
#define ActUnsSocNotUsr (ActWebSvc + 37) #define ActShaSocNotUsr (ActWebSvc + 39)
#define ActFavSocNotUsr (ActWebSvc + 38) #define ActUnsSocNotUsr (ActWebSvc + 40)
#define ActUnfSocNotUsr (ActWebSvc + 39) #define ActFavSocNotUsr (ActWebSvc + 41)
#define ActFavSocComUsr (ActWebSvc + 40) #define ActUnfSocNotUsr (ActWebSvc + 42)
#define ActUnfSocComUsr (ActWebSvc + 41) #define ActFavSocComUsr (ActWebSvc + 43)
#define ActReqRemSocPubUsr (ActWebSvc + 42) #define ActUnfSocComUsr (ActWebSvc + 44)
#define ActRemSocPubUsr (ActWebSvc + 43) #define ActReqRemSocPubUsr (ActWebSvc + 45)
#define ActReqRemSocComUsr (ActWebSvc + 44) #define ActRemSocPubUsr (ActWebSvc + 46)
#define ActRemSocComUsr (ActWebSvc + 45) #define ActReqRemSocComUsr (ActWebSvc + 47)
#define ActRemSocComUsr (ActWebSvc + 48)
#define ActSeeOthPubPrf (ActWebSvc + 46) #define ActSeeOthPubPrf (ActWebSvc + 49)
#define ActCalFig (ActWebSvc + 47) #define ActCalFig (ActWebSvc + 50)
#define ActFolUsr (ActWebSvc + 48) #define ActFolUsr (ActWebSvc + 51)
#define ActUnfUsr (ActWebSvc + 49) #define ActUnfUsr (ActWebSvc + 52)
#define ActSeeFlg (ActWebSvc + 50) #define ActSeeFlg (ActWebSvc + 53)
#define ActSeeFlr (ActWebSvc + 51) #define ActSeeFlr (ActWebSvc + 54)
#define ActPrnCal (ActWebSvc + 52) #define ActPrnCal (ActWebSvc + 55)
#define ActChgCal1stDay (ActWebSvc + 53) #define ActChgCal1stDay (ActWebSvc + 56)
#define ActSeeNewNtf (ActWebSvc + 54) #define ActSeeNewNtf (ActWebSvc + 57)
#define ActMrkNtfSee (ActWebSvc + 55) #define ActMrkNtfSee (ActWebSvc + 58)
#define ActSeeMai (ActWebSvc + 56) #define ActSeeMai (ActWebSvc + 59)
#define ActEdiMai (ActWebSvc + 57) #define ActEdiMai (ActWebSvc + 60)
#define ActNewMai (ActWebSvc + 58) #define ActNewMai (ActWebSvc + 61)
#define ActRemMai (ActWebSvc + 59) #define ActRemMai (ActWebSvc + 62)
#define ActRenMaiSho (ActWebSvc + 60) #define ActRenMaiSho (ActWebSvc + 63)
#define ActRenMaiFul (ActWebSvc + 61) #define ActRenMaiFul (ActWebSvc + 64)
/*****************************************************************************/ /*****************************************************************************/
/******************************** System tab *********************************/ /******************************** System tab *********************************/
@ -616,51 +614,52 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActGamTchAns (ActChgCrsTT1stDay + 121) #define ActGamTchAns (ActChgCrsTT1stDay + 121)
#define ActPlyGamStd (ActChgCrsTT1stDay + 122) #define ActPlyGamStd (ActChgCrsTT1stDay + 122)
#define ActGamStdCurQst (ActChgCrsTT1stDay + 123) #define ActGamStdCurQst (ActChgCrsTT1stDay + 123)
#define ActAnsGam (ActChgCrsTT1stDay + 124) #define ActRefGamStd (ActChgCrsTT1stDay + 124)
#define ActFrmNewGam (ActChgCrsTT1stDay + 125) #define ActAnsGam (ActChgCrsTT1stDay + 125)
#define ActEdiOneGam (ActChgCrsTT1stDay + 126) #define ActFrmNewGam (ActChgCrsTT1stDay + 126)
#define ActNewGam (ActChgCrsTT1stDay + 127) #define ActEdiOneGam (ActChgCrsTT1stDay + 127)
#define ActChgGam (ActChgCrsTT1stDay + 128) #define ActNewGam (ActChgCrsTT1stDay + 128)
#define ActReqRemGam (ActChgCrsTT1stDay + 129) #define ActChgGam (ActChgCrsTT1stDay + 129)
#define ActRemGam (ActChgCrsTT1stDay + 130) #define ActReqRemGam (ActChgCrsTT1stDay + 130)
#define ActReqRstGam (ActChgCrsTT1stDay + 131) #define ActRemGam (ActChgCrsTT1stDay + 131)
#define ActRstGam (ActChgCrsTT1stDay + 132) #define ActReqRstGam (ActChgCrsTT1stDay + 132)
#define ActHidGam (ActChgCrsTT1stDay + 133) #define ActRstGam (ActChgCrsTT1stDay + 133)
#define ActShoGam (ActChgCrsTT1stDay + 134) #define ActHidGam (ActChgCrsTT1stDay + 134)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 135) #define ActShoGam (ActChgCrsTT1stDay + 135)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 136) #define ActAddOneGamQst (ActChgCrsTT1stDay + 136)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 137) #define ActGamLstTstQst (ActChgCrsTT1stDay + 137)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 138) #define ActAddTstQstToGam (ActChgCrsTT1stDay + 138)
#define ActRemGamQst (ActChgCrsTT1stDay + 139) #define ActReqRemGamQst (ActChgCrsTT1stDay + 139)
#define ActUp_GamQst (ActChgCrsTT1stDay + 140) #define ActRemGamQst (ActChgCrsTT1stDay + 140)
#define ActDwnGamQst (ActChgCrsTT1stDay + 141) #define ActUp_GamQst (ActChgCrsTT1stDay + 141)
#define ActDwnGamQst (ActChgCrsTT1stDay + 142)
#define ActSeeSvy (ActChgCrsTT1stDay + 142) #define ActSeeSvy (ActChgCrsTT1stDay + 143)
#define ActAnsSvy (ActChgCrsTT1stDay + 143) #define ActAnsSvy (ActChgCrsTT1stDay + 144)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 144) #define ActFrmNewSvy (ActChgCrsTT1stDay + 145)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 145) #define ActEdiOneSvy (ActChgCrsTT1stDay + 146)
#define ActNewSvy (ActChgCrsTT1stDay + 146) #define ActNewSvy (ActChgCrsTT1stDay + 147)
#define ActChgSvy (ActChgCrsTT1stDay + 147) #define ActChgSvy (ActChgCrsTT1stDay + 148)
#define ActReqRemSvy (ActChgCrsTT1stDay + 148) #define ActReqRemSvy (ActChgCrsTT1stDay + 149)
#define ActRemSvy (ActChgCrsTT1stDay + 149) #define ActRemSvy (ActChgCrsTT1stDay + 150)
#define ActReqRstSvy (ActChgCrsTT1stDay + 150) #define ActReqRstSvy (ActChgCrsTT1stDay + 151)
#define ActRstSvy (ActChgCrsTT1stDay + 151) #define ActRstSvy (ActChgCrsTT1stDay + 152)
#define ActHidSvy (ActChgCrsTT1stDay + 152) #define ActHidSvy (ActChgCrsTT1stDay + 153)
#define ActShoSvy (ActChgCrsTT1stDay + 153) #define ActShoSvy (ActChgCrsTT1stDay + 154)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 154) #define ActEdiOneSvyQst (ActChgCrsTT1stDay + 155)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 155) #define ActRcvSvyQst (ActChgCrsTT1stDay + 156)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 156) #define ActReqRemSvyQst (ActChgCrsTT1stDay + 157)
#define ActRemSvyQst (ActChgCrsTT1stDay + 157) #define ActRemSvyQst (ActChgCrsTT1stDay + 158)
#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 158) #define ActSeeOneExaAnn (ActChgCrsTT1stDay + 159)
#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 159) #define ActSeeDatExaAnn (ActChgCrsTT1stDay + 160)
#define ActEdiExaAnn (ActChgCrsTT1stDay + 160) #define ActEdiExaAnn (ActChgCrsTT1stDay + 161)
#define ActRcvExaAnn (ActChgCrsTT1stDay + 161) #define ActRcvExaAnn (ActChgCrsTT1stDay + 162)
#define ActPrnExaAnn (ActChgCrsTT1stDay + 162) #define ActPrnExaAnn (ActChgCrsTT1stDay + 163)
#define ActReqRemExaAnn (ActChgCrsTT1stDay + 163) #define ActReqRemExaAnn (ActChgCrsTT1stDay + 164)
#define ActRemExaAnn (ActChgCrsTT1stDay + 164) #define ActRemExaAnn (ActChgCrsTT1stDay + 165)
#define ActHidExaAnn (ActChgCrsTT1stDay + 165) #define ActHidExaAnn (ActChgCrsTT1stDay + 166)
#define ActShoExaAnn (ActChgCrsTT1stDay + 166) #define ActShoExaAnn (ActChgCrsTT1stDay + 167)
/*****************************************************************************/ /*****************************************************************************/
/******************************** Files tab **********************************/ /******************************** Files tab **********************************/
@ -1537,8 +1536,9 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActSeeAllStaCrs (ActMaiUsr + 13) #define ActSeeAllStaCrs (ActMaiUsr + 13)
#define ActLstClk (ActMaiUsr + 14) #define ActLstClk (ActMaiUsr + 14)
#define ActRefLstClk (ActMaiUsr + 15)
#define ActSeeMyUsgRep (ActMaiUsr + 15) #define ActSeeMyUsgRep (ActMaiUsr + 16)
/*****************************************************************************/ /*****************************************************************************/
/******************************** Profile tab ********************************/ /******************************** Profile tab ********************************/

View File

@ -448,10 +448,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.122.5 (2019-05-20)" #define Log_PLATFORM_VERSION "SWAD 18.123 (2019-05-22)"
#define CSS_FILE "swad18.122.5.css" #define CSS_FILE "swad18.123.css"
#define JS_FILE "swad18.116.5.js" #define JS_FILE "swad18.123.js"
/* /*
Version 18.123: May 22, 2019 Game is refreshed automatically.
Code refactoring in actions related to AJAX refreshing. (242770 lines)
Version 18.122.5: May 20, 2019 Buttons for options in games. (242596 lines) Version 18.122.5: May 20, 2019 Buttons for options in games. (242596 lines)
Version 18.122.4: May 20, 2019 Changes in buttons. (242563 lines) Version 18.122.4: May 20, 2019 Changes in buttons. (242563 lines)
Version 18.122.3: May 20, 2019 Changes in games. (242558 lines) Version 18.122.3: May 20, 2019 Changes in games. (242558 lines)

View File

@ -492,10 +492,11 @@
#define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_REFRESH ((time_t)(Cfg_MAX_TIME_TO_REFRESH_CONNECTED * 4)) // After these seconds without refresh of connected users, session is closed #define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_REFRESH ((time_t)(Cfg_MAX_TIME_TO_REFRESH_CONNECTED * 4)) // After these seconds without refresh of connected users, session is closed
#define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_CLICK ((time_t)( 8 * 60UL * 60UL)) // After these seconds without user's clicks, session is closed #define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_CLICK ((time_t)( 8 * 60UL * 60UL)) // After these seconds without user's clicks, session is closed
#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)( 2UL * 1000UL)) // Initial refresh period of social timeline in miliseconds #define Cfg_TIME_TO_REFRESH_TIMELINE ((time_t)( 2UL * 1000UL)) // Initial refresh period of social timeline in miliseconds
// This delay is increased 1 second on each refresh // This delay is increased 1 second on each refresh
#define Cfg_TIME_TO_REFRESH_GAME ((time_t)( 1UL * 1000UL)) // Refresh period of game being played in miliseconds
#define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 1UL * 1000UL)) // Refresh period of last clicks in miliseconds
#define Cfg_TIME_TO_CHANGE_BANNER ((time_t)( 2UL * 60UL)) // After these seconds, change banner #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 #define Cfg_NUMBER_OF_BANNERS 1 // Number of banners to show simultaneously

View File

@ -167,6 +167,8 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
long GamCod,unsigned QstInd); long GamCod,unsigned QstInd);
static void Gam_PutBigButtonToEnd (long GamCod); static void Gam_PutBigButtonToEnd (long GamCod);
static void Gam_ShowQuestionBeingPlayed (void);
static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod); static void Gam_ReceiveAndStoreUserAnswersToAGame (long GamCod);
static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd); static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
static void Gam_RegisterIHaveAnsweredGame (long GamCod); static void Gam_RegisterIHaveAnsweredGame (long GamCod);
@ -3169,20 +3171,20 @@ static void Gam_PlayGameShowQuestionAndAnswers (long GamCod,
/***** Show question *****/ /***** Show question *****/
/* Start container for number and question */ /* Start container for number and question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTAINER\">"); fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_CONTAINER\">");
/* Write number of question */ /* Write number of question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_NUM_QST\">%u</div>", fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_NUM_QST\">%u</div>",
QstInd + 1); QstInd + 1);
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">"); fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_QST_CONTAINER\">");
/* Get question code (row[0]) */ /* Get question code (row[0]) */
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0) if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Lay_ShowErrorAndExit ("Error: wrong question code."); Lay_ShowErrorAndExit ("Error: wrong question code.");
/* Write stem (row[2]) */ /* Write stem (row[2]) */
Tst_WriteQstStem (row[2],"GAM_PLAY_QST"); Tst_WriteQstStem (row[2],"GAM_PLAY_TCH_QST");
/* Get media (row[3]) */ /* Get media (row[3]) */
Gbl.Test.Media.MedCod = Str_ConvertStrCodToLongCod (row[3]); Gbl.Test.Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
@ -3201,15 +3203,13 @@ static void Gam_PlayGameShowQuestionAndAnswers (long GamCod,
/* Write answers */ /* Write answers */
Tst_WriteAnswersGameResult (&Game,QstInd,QstCod, Tst_WriteAnswersGameResult (&Game,QstInd,QstCod,
"GAM_PLAY_QST",false); // Don't show result "GAM_PLAY_TCH_QST",false); // Don't show result
} }
else
fprintf (Gbl.F.Out,"&nbsp;");
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/***** Put button to continue *****/ /***** Put button to continue *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_NXT_CONTAINER\">"); fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_NXT_CONTAINER\">");
if (ShowAnswers) if (ShowAnswers)
{ {
/* Get index of the next question */ /* Get index of the next question */
@ -3243,7 +3243,7 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
extern const char *Txt_Continue; extern const char *Txt_Continue;
/***** Start container *****/ /***** Start container *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTINUE_CONTAINER\">"); fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_CONTINUE_CONTAINER\">");
/***** Start form *****/ /***** Start form *****/
Frm_StartForm (NextAction); Frm_StartForm (NextAction);
@ -3251,7 +3251,7 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction,
Gam_PutParamQstInd (QstInd); Gam_PutParamQstInd (QstInd);
/***** Put icon with link *****/ /***** Put icon with link *****/
Frm_LinkFormSubmit (Txt_Continue,"GAM_PLAY_CONTINUE ICO_HIGHLIGHT",NULL); Frm_LinkFormSubmit (Txt_Continue,"GAM_PLAY_TCH_CONTINUE ICO_HIGHLIGHT",NULL);
fprintf (Gbl.F.Out,"<img src=\"%s/step-forward.svg\"" fprintf (Gbl.F.Out,"<img src=\"%s/step-forward.svg\""
" alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />" " alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />"
"<br />" "<br />"
@ -3326,83 +3326,133 @@ void Gam_GameTchEnd (void)
} }
/*****************************************************************************/ /*****************************************************************************/
/***** Show current question to a student when he/she is playing a game ******/ /********************** Get code of game being played ************************/
/*****************************************************************************/ /*****************************************************************************/
void Gam_GameStdCurrentQuestion (void) void Gam_GetGameBeingPlayed (void)
{
/***** Get game code ****/
if ((Gbl.Games.GamCodBeingPlayed = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
}
/*****************************************************************************/
/********* Show game being played to me as student in a new window ***********/
/*****************************************************************************/
void Gam_ShowNewGameToMeAsStd (void)
{
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_STD_CONTAINER\">");
Gam_ShowQuestionBeingPlayed ();
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/*************** Refresh current game for a student via AJAX *****************/
/*****************************************************************************/
void Gam_RefreshCurrentGameStd (void)
{
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything
/***** Get and show current question *****/
Gam_ShowQuestionBeingPlayed ();
}
/*****************************************************************************/
/************ Show current question being played for a student ***************/
/*****************************************************************************/
static void Gam_ShowQuestionBeingPlayed (void)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
struct Game Game; // struct Game Game;
unsigned QstInd; unsigned QstInd;
long QstCod; long QstCod;
bool ShowAnswers = true; // TODO: Get whether to show answers from a database table bool GameIsPlaying;
bool ShowAnswers;
unsigned NumOptions;
unsigned NumOpt;
/***** Get parameters *****/ /***** Get question being played from database *****/
/* Get game code */ GameIsPlaying = (DB_QuerySELECT (&mysql_res,"can not get question being played",
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) "SELECT QstInd," // row[0]
Lay_ShowErrorAndExit ("Code of game is missing."); "QstCod," // row[1]
"ShowingAnswers," // row[2]
/* Get question index */ "GamStart," // row[3]
QstInd = Gam_GetParamQstInd (); // TODO: Get current question from a database table "QstStart" // row[4]
" FROM gam_playing"
/***** Get data of question from database *****/ " WHERE GamCod=%ld",
if (!DB_QuerySELECT (&mysql_res,"can not get data of a question", Gbl.Games.GamCodBeingPlayed) != 0);
"SELECT tst_questions.QstCod," // row[0] if (GameIsPlaying)
"tst_questions.AnsType," // row[1]
"tst_questions.Stem," // row[2]
"tst_questions.MedCod" // row[3]
" FROM gam_questions,tst_questions"
" WHERE gam_questions.GamCod=%ld"
" AND gam_questions.QstInd=%u"
" AND gam_questions.QstCod=tst_questions.QstCod",
Game.GamCod,QstInd))
Ale_ShowAlert (Ale_ERROR,"Question doesn't exist.");
row = mysql_fetch_row (mysql_res);
/***** Show question *****/
/* Start container for number and question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTAINER\">");
/* Write number of question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_NUM_QST\">%u</div>",
QstInd + 1);
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">");
/* Write stem (row[2]) */
Tst_WriteQstStem (row[2],"GAM_PLAY_QST");
/* Get media (row[3]) */
Gbl.Test.Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
Med_GetMediaDataByCod (&Gbl.Test.Media);
/* Show media */
Med_ShowMedia (&Gbl.Test.Media,
"TEST_MED_EDIT_LIST_STEM_CONTAINER",
"TEST_MED_EDIT_LIST_STEM");
/* Write answers? */
if (ShowAnswers)
{ {
/* Get question code (row[0]) */ /* Get row */
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0) row = mysql_fetch_row (mysql_res);
/* Get question index (row[0]) */
if (sscanf (row[0],"%d",&QstInd) != 1)
Lay_ShowErrorAndExit ("Error when getting question index.");
/* Get question code (row[1]) */
if ((QstCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
Lay_ShowErrorAndExit ("Error: wrong question code."); Lay_ShowErrorAndExit ("Error: wrong question code.");
/* Get answer type (row[1]) */ /* Get whether the answers are being shown (row[2]) */
Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]); ShowAnswers = (row[2][0] == 'Y');
/* Write answers */
Tst_WriteAnswersGameResult (&Game,QstInd,QstCod,
"GAM_PLAY_QST",false); // Don't show result
} }
else
fprintf (Gbl.F.Out,"&nbsp;");
fprintf (Gbl.F.Out,"</div>"); /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
/***** End container for question *****/ /***** Show question *****/
fprintf (Gbl.F.Out,"</div>"); if (GameIsPlaying)
{
/***** Show question *****/
/* Write number of question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_NUM_QST\">%u</div>",
QstInd + 1);
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_QST_CONTAINER\">");
/* Write answers? */
if (ShowAnswers)
{
if (Tst_CheckIfQuestionIsValidForGame (QstCod))
{
/***** Start table *****/
Tbl_StartTableWide (8);
/***** Write answers *****/
NumOptions = Tst_GetNumAnswersQst (QstCod);
for (NumOpt = 0;
NumOpt < NumOptions;
NumOpt++)
{
// if (NumOpt % 2 == 0)
fprintf (Gbl.F.Out,"<tr>");
/***** Write letter for this option *****/
fprintf (Gbl.F.Out,"<td class=\"GAM_PLAY_STD_CELL\">"
"<div class=\"GAM_PLAY_STD_BUTTON BT_%c\">"
"%c"
"</div>"
"</td>",
'A' + (char) NumOpt,
'a' + (char) NumOpt);
// if (NumOpt % 2 == 1)
fprintf (Gbl.F.Out,"</tr>");
}
/***** End table *****/
Tbl_EndTable ();
}
else
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
}
fprintf (Gbl.F.Out,"</div>");
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -127,7 +127,9 @@ void Gam_GameTchNextQuestion (void);
void Gam_GameTchShowAnswers (void); void Gam_GameTchShowAnswers (void);
void Gam_GameTchEnd (void); void Gam_GameTchEnd (void);
void Gam_GameStdCurrentQuestion (void); void Gam_GetGameBeingPlayed (void);
void Gam_ShowNewGameToMeAsStd (void);
void Gam_RefreshCurrentGameStd (void);
unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope); unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope);
unsigned Gam_GetNumGames (Hie_Level_t Scope); unsigned Gam_GetNumGames (Hie_Level_t Scope);

View File

@ -704,6 +704,7 @@ struct Globals
Gam_Order_t SelectedOrder; Gam_Order_t SelectedOrder;
unsigned CurrentPage; unsigned CurrentPage;
char *ListQuestions; char *ListQuestions;
long GamCodBeingPlayed; // Used to refresh game via AJAX
} Games; } Games;
struct struct
{ {

View File

@ -117,6 +117,7 @@ void Lay_WriteStartOfPage (void)
"main_horizontal", // Mnu_MENU_HORIZONTAL "main_horizontal", // Mnu_MENU_HORIZONTAL
"main_vertical", // Mnu_MENU_VERTICAL "main_vertical", // Mnu_MENU_VERTICAL
}; };
Act_BrowserTab_t BrowserTab;
/***** If, when this function is called, the head is being written /***** If, when this function is called, the head is being written
or the head is already written ==> don't do anything *****/ or the head is already written ==> don't do anything *****/
@ -252,23 +253,32 @@ void Lay_WriteStartOfPage (void)
fprintf (Gbl.F.Out,"</head>\n"); fprintf (Gbl.F.Out,"</head>\n");
/***** HTML body *****/ /***** HTML body *****/
if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB) BrowserTab = Act_GetBrowserTab (Gbl.Action.Act);
fprintf (Gbl.F.Out,"<body onload=\"init();\">\n" switch (BrowserTab)
"<div id=\"zoomLyr\" class=\"ZOOM\">"
"<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\""
" alt=\"\" title=\"\""
" class=\"IMG_USR\" />"
"<div id=\"zoomTxt\" class=\"CENTER_MIDDLE\">"
"</div>"
"</div>",
Cfg_URL_ICON_PUBLIC);
else
{ {
fprintf (Gbl.F.Out,"<body>\n"); case Act_BRW_1ST_TAB:
Gbl.Layout.WritingHTMLStart = false; fprintf (Gbl.F.Out,"<body onload=\"init();\">\n"
Gbl.Layout.HTMLStartWritten = "<div id=\"zoomLyr\" class=\"ZOOM\">"
Gbl.Layout.DivsEndWritten = true; "<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\""
return; " alt=\"\" title=\"\""
" class=\"IMG_USR\" />"
"<div id=\"zoomTxt\" class=\"CENTER_MIDDLE\">"
"</div>"
"</div>",
Cfg_URL_ICON_PUBLIC);
break;
case Act_BRW_NEW_TAB:
fprintf (Gbl.F.Out,"<body onload=\"init();\">\n");
Gbl.Layout.WritingHTMLStart = false;
Gbl.Layout.HTMLStartWritten =
Gbl.Layout.DivsEndWritten = true;
return;
default:
fprintf (Gbl.F.Out,"<body>\n");
Gbl.Layout.WritingHTMLStart = false;
Gbl.Layout.HTMLStartWritten =
Gbl.Layout.DivsEndWritten = true;
return;
} }
/***** Start box that contains the whole page except the foot *****/ /***** Start box that contains the whole page except the foot *****/
@ -652,14 +662,12 @@ static void Lay_WriteScriptMathJax (void)
static void Lay_WriteScriptInit (void) static void Lay_WriteScriptInit (void)
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
bool RefreshLastClicks = false;
bool RefreshNewTimeline = false; bool RefreshNewTimeline = false;
bool RefreshGame = false;
bool RefreshLastClicks = false;
switch (Gbl.Action.Act) switch (Gbl.Action.Act)
{ {
case ActLstClk:
RefreshLastClicks = true;
break;
case ActSeeSocTmlGbl: case ActSeeSocTmlGbl:
case ActRcvSocPstGbl: case ActRcvSocPstGbl:
case ActRcvSocComGbl: case ActRcvSocComGbl:
@ -669,6 +677,12 @@ static void Lay_WriteScriptInit (void)
case ActRemSocComGbl: case ActRemSocComGbl:
RefreshNewTimeline = true; RefreshNewTimeline = true;
break; break;
case ActGamStdCurQst:
RefreshGame = true;
break;
case ActLstClk:
RefreshLastClicks = true;
break;
default: default:
break; break;
} }
@ -680,6 +694,9 @@ static void Lay_WriteScriptInit (void)
if (RefreshNewTimeline) if (RefreshNewTimeline)
fprintf (Gbl.F.Out,"var delayNewTimeline = %lu;\n", fprintf (Gbl.F.Out,"var delayNewTimeline = %lu;\n",
Cfg_TIME_TO_REFRESH_TIMELINE); Cfg_TIME_TO_REFRESH_TIMELINE);
else if (RefreshGame) // Refresh game via AJAX
fprintf (Gbl.F.Out,"var delayGame = %lu;\n",
Cfg_TIME_TO_REFRESH_GAME);
fprintf (Gbl.F.Out,"function init(){\n"); fprintf (Gbl.F.Out,"function init(){\n");
@ -694,6 +711,8 @@ static void Lay_WriteScriptInit (void)
if (RefreshLastClicks) // Refresh last clicks via AJAX if (RefreshLastClicks) // Refresh last clicks via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n", fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n",
Cfg_TIME_TO_REFRESH_LAST_CLICKS); Cfg_TIME_TO_REFRESH_LAST_CLICKS);
else if (RefreshGame) // Refresh game via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshGame()\",delayGame);\n");
else if (RefreshNewTimeline) // Refresh timeline via AJAX else if (RefreshNewTimeline) // Refresh timeline via AJAX
fprintf (Gbl.F.Out," setTimeout(\"refreshNewTimeline()\",delayNewTimeline);\n"); fprintf (Gbl.F.Out," setTimeout(\"refreshNewTimeline()\",delayNewTimeline);\n");
@ -710,13 +729,16 @@ static void Lay_WriteScriptParamsAJAX (void)
/***** Start script *****/ /***** Start script *****/
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"); fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n");
/***** Parameter to refresh connected users *****/ /***** Parameters with code of session and current course code *****/
fprintf (Gbl.F.Out,"var RefreshParamNxtActCon = \"act=%ld\";\n", fprintf (Gbl.F.Out,"var RefreshParamIdSes = \"ses=%s\";\n"
Act_GetActCod (ActRefCon)); "var RefreshParamCrsCod = \"crs=%ld\";\n",
Gbl.Session.Id,
Gbl.Hierarchy.Crs.CrsCod);
/***** Parameter to refresh clicks in realtime *****/ /***** Parameter to refresh connected users *****/
fprintf (Gbl.F.Out,"var RefreshParamNxtActLog = \"act=%ld\";\n", if (Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB)
Act_GetActCod (ActRefLstClk)); fprintf (Gbl.F.Out,"var RefreshParamNxtActCon = \"act=%ld\";\n",
Act_GetActCod (ActRefCon));
/***** Parameters related with expanding/contracting folders in file browsers *****/ /***** Parameters related with expanding/contracting folders in file browsers *****/
if (Gbl.FileBrowser.Type != Brw_UNKNOWN) if (Gbl.FileBrowser.Type != Brw_UNKNOWN)
@ -724,12 +746,13 @@ static void Lay_WriteScriptParamsAJAX (void)
put parameters used by AJAX */ put parameters used by AJAX */
fprintf (Gbl.F.Out,"var RefreshParamExpand = \"act=%ld\";\n" fprintf (Gbl.F.Out,"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 ()));
/***** Parameters related with social timeline refreshing *****/ /***** Parameters related with other actions *****/
switch (Gbl.Action.Act) switch (Gbl.Action.Act)
{ {
/* Parameters related with global timeline refreshing */
case ActSeeSocTmlGbl: case ActSeeSocTmlGbl:
case ActRcvSocPstGbl: case ActRcvSocPstGbl:
case ActRcvSocComGbl: case ActRcvSocComGbl:
@ -746,6 +769,7 @@ static void Lay_WriteScriptParamsAJAX (void)
Act_GetActCod (ActRefOldSocPubGbl), Act_GetActCod (ActRefOldSocPubGbl),
(unsigned) Gbl.Timeline.WhichUsrs); (unsigned) Gbl.Timeline.WhichUsrs);
break; break;
/* Parameters related with user timeline refreshing */
case ActSeeOthPubPrf: case ActSeeOthPubPrf:
case ActRcvSocPstUsr: case ActRcvSocPstUsr:
case ActRcvSocComUsr: case ActRcvSocComUsr:
@ -765,16 +789,24 @@ static void Lay_WriteScriptParamsAJAX (void)
Act_GetActCod (ActRefOldSocPubUsr), Act_GetActCod (ActRefOldSocPubUsr),
Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); Gbl.Usrs.Other.UsrDat.EncryptedUsrCod);
break; break;
/* Parameters related with game refreshing */
case ActGamStdCurQst:
fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n"
"var RefreshParamGamCod = \"GamCod=%ld\";\n",
Act_GetActCod (ActRefGamStd),
Gbl.Games.GamCodBeingPlayed);
break;
/* Parameter related with clicks refreshing */
case ActLstClk:
fprintf (Gbl.F.Out,"var RefreshParamNxtActLstClk = \"act=%ld\";\n",
Act_GetActCod (ActRefLstClk));
break;
default: default:
break; break;
} }
/***** Parameters with code of session and current course code *****/ /***** End script *****/
fprintf (Gbl.F.Out,"var RefreshParamIdSes = \"ses=%s\";\n" fprintf (Gbl.F.Out,"</script>\n");
"var RefreshParamCrsCod = \"crs=%ld\";\n"
"</script>\n",
Gbl.Session.Id,
Gbl.Hierarchy.Crs.CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -3268,6 +3268,15 @@ void Tst_WriteParamEditQst (void)
/*************** Get answers of a test question from database ****************/ /*************** Get answers of a test question from database ****************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Tst_GetNumAnswersQst (long QstCod)
{
return (unsigned) DB_QueryCOUNT ("can not get number of answers of a question",
"SELECT COUNT(*)"
" FROM tst_answers"
" WHERE QstCod=%ld",
QstCod);
}
unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle) unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle)
{ {
unsigned long NumRows; unsigned long NumRows;
@ -3522,26 +3531,26 @@ static void Tst_WriteAnswersTestResult (struct UsrData *UsrDat,
void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod, void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod,
const char *Class,bool ShowResult) const char *Class,bool ShowResult)
{ {
/***** Write parameter with question code *****/
// Tst_WriteParamQstCod (NumQst,QstCod);
/***** Write answer depending on type *****/ /***** Write answer depending on type *****/
switch (Gbl.Test.AnswerType) if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE)
{ Tst_WriteChoiceAnsViewGame (Game,NumQst,QstCod,
case Tst_ANS_INT: Class,ShowResult);
case Tst_ANS_FLOAT: else
case Tst_ANS_TRUE_FALSE: Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
case Tst_ANS_TEXT: }
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
break; /*****************************************************************************/
case Tst_ANS_UNIQUE_CHOICE: /***************** Check if a question is valid for a game *******************/
case Tst_ANS_MULTIPLE_CHOICE: /*****************************************************************************/
Tst_WriteChoiceAnsViewGame (Game,NumQst,QstCod,
Class,ShowResult); bool Tst_CheckIfQuestionIsValidForGame (long QstCod)
break; {
default: /***** Check if a question is valid for a game from database *****/
break; return DB_QueryCOUNT ("can not check type of a question",
} "SELECT COUNT(*)"
" FROM tst_questions"
" WHERE QstCod=%ld AND AnsType='%s'",
QstCod,Tst_StrAnswerTypesDB[Tst_ANS_UNIQUE_CHOICE]) != 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4098,15 +4107,22 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
Gbl.Test.Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]); Gbl.Test.Answer.Options[NumOpt].Media.MedCod = Str_ConvertStrCodToLongCod (row[3]);
Med_GetMediaDataByCod (&Gbl.Test.Answer.Options[NumOpt].Media); Med_GetMediaDataByCod (&Gbl.Test.Answer.Options[NumOpt].Media);
/***** Write letter of this option *****/ /***** Write letter for this option *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"CENTER_MIDDLE\">" "<td class=\"CENTER_MIDDLE\">"
"<button class=\"BT_GAME BT_%c\">" "<div class=\"");
"%c" if (ShowResult)
"</button>" fprintf (Gbl.F.Out,"%s\">"
"</td>", "%c)&nbsp;",
'A' + (char) NumOpt, Class,
'a' + (char) NumOpt); 'a' + (char) NumOpt);
else
fprintf (Gbl.F.Out,"GAM_PLAY_TCH_BUTTON BT_%c\">"
"%c",
'A' + (char) NumOpt,
'a' + (char) NumOpt);
fprintf (Gbl.F.Out,"</div>"
"</td>");
/***** Write the option text *****/ /***** Write the option text *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"

View File

@ -152,9 +152,11 @@ void Tst_ListQuestionsToEdit (void);
void Tst_ListQuestionsToSelect (void); void Tst_ListQuestionsToSelect (void);
bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res); bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res);
void Tst_WriteParamEditQst (void); void Tst_WriteParamEditQst (void);
unsigned Tst_GetNumAnswersQst (long QstCod);
unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle); unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle);
void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod, void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod,
const char *Class,bool ShowResult); const char *Class,bool ShowResult);
bool Tst_CheckIfQuestionIsValidForGame (long QstCod);
void Tst_WriteAnsTF (char AnsTF); void Tst_WriteAnsTF (char AnsTF);
void Tst_CheckIfNumberOfAnswersIsOne (void); void Tst_CheckIfNumberOfAnswersIsOne (void);