Version20.3

This commit is contained in:
acanas 2020-09-30 20:23:52 +02:00
parent 48902a0d33
commit 90cd506f8e
9 changed files with 144 additions and 51 deletions

Binary file not shown.

View File

@ -779,6 +779,8 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisResultsMchUsr ,NULL},
[ActLstOneGam ] = {1912,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ListGame ,NULL},
[ActFrmNewGam ] = {1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
[ActEdiOneGam ] = {1653,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL},
[ActNewGam ] = {1654,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveFormGame ,NULL},
@ -3725,6 +3727,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActValSetQst, // #1909
ActInvSetQst, // #1910
ActChgRooMAC, // #1911
ActLstOneGam, // #1912
};
/*****************************************************************************/

View File

@ -64,7 +64,7 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_MAX_ACTION_COD 1911
#define Act_MAX_ACTION_COD 1912
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -741,38 +741,40 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 205)
#define ActFrmNewGam (ActChgCrsTT1stDay + 206)
#define ActEdiOneGam (ActChgCrsTT1stDay + 207)
#define ActNewGam (ActChgCrsTT1stDay + 208)
#define ActChgGam (ActChgCrsTT1stDay + 209)
#define ActReqRemGam (ActChgCrsTT1stDay + 210)
#define ActRemGam (ActChgCrsTT1stDay + 211)
#define ActHidGam (ActChgCrsTT1stDay + 212)
#define ActShoGam (ActChgCrsTT1stDay + 213)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 214)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 215)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 216)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 217)
#define ActRemGamQst (ActChgCrsTT1stDay + 218)
#define ActUp_GamQst (ActChgCrsTT1stDay + 219)
#define ActDwnGamQst (ActChgCrsTT1stDay + 220)
#define ActLstOneGam (ActChgCrsTT1stDay + 206)
#define ActSeeSvy (ActChgCrsTT1stDay + 221)
#define ActAnsSvy (ActChgCrsTT1stDay + 222)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 223)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 224)
#define ActNewSvy (ActChgCrsTT1stDay + 225)
#define ActChgSvy (ActChgCrsTT1stDay + 226)
#define ActReqRemSvy (ActChgCrsTT1stDay + 227)
#define ActRemSvy (ActChgCrsTT1stDay + 228)
#define ActReqRstSvy (ActChgCrsTT1stDay + 229)
#define ActRstSvy (ActChgCrsTT1stDay + 230)
#define ActHidSvy (ActChgCrsTT1stDay + 231)
#define ActShoSvy (ActChgCrsTT1stDay + 232)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 233)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 234)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 235)
#define ActRemSvyQst (ActChgCrsTT1stDay + 236)
#define ActFrmNewGam (ActChgCrsTT1stDay + 207)
#define ActEdiOneGam (ActChgCrsTT1stDay + 208)
#define ActNewGam (ActChgCrsTT1stDay + 209)
#define ActChgGam (ActChgCrsTT1stDay + 210)
#define ActReqRemGam (ActChgCrsTT1stDay + 211)
#define ActRemGam (ActChgCrsTT1stDay + 212)
#define ActHidGam (ActChgCrsTT1stDay + 213)
#define ActShoGam (ActChgCrsTT1stDay + 214)
#define ActAddOneGamQst (ActChgCrsTT1stDay + 215)
#define ActGamLstTstQst (ActChgCrsTT1stDay + 216)
#define ActAddTstQstToGam (ActChgCrsTT1stDay + 217)
#define ActReqRemGamQst (ActChgCrsTT1stDay + 218)
#define ActRemGamQst (ActChgCrsTT1stDay + 219)
#define ActUp_GamQst (ActChgCrsTT1stDay + 220)
#define ActDwnGamQst (ActChgCrsTT1stDay + 221)
#define ActSeeSvy (ActChgCrsTT1stDay + 222)
#define ActAnsSvy (ActChgCrsTT1stDay + 223)
#define ActFrmNewSvy (ActChgCrsTT1stDay + 224)
#define ActEdiOneSvy (ActChgCrsTT1stDay + 225)
#define ActNewSvy (ActChgCrsTT1stDay + 226)
#define ActChgSvy (ActChgCrsTT1stDay + 227)
#define ActReqRemSvy (ActChgCrsTT1stDay + 228)
#define ActRemSvy (ActChgCrsTT1stDay + 229)
#define ActReqRstSvy (ActChgCrsTT1stDay + 230)
#define ActRstSvy (ActChgCrsTT1stDay + 231)
#define ActHidSvy (ActChgCrsTT1stDay + 232)
#define ActShoSvy (ActChgCrsTT1stDay + 233)
#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 234)
#define ActRcvSvyQst (ActChgCrsTT1stDay + 235)
#define ActReqRemSvyQst (ActChgCrsTT1stDay + 236)
#define ActRemSvyQst (ActChgCrsTT1stDay + 237)
/*****************************************************************************/
/******************************** Files tab **********************************/

View File

@ -573,6 +573,10 @@ TODO: Que al generar un examen s
TODO: Create module swad_test_result
"sudo apt install webp" en Ubuntu, y "yum install libwebp libwebp-tools" en CentOS, para decodificar imágenes Web/ug reportado por Javier Fernández Baldomero.
TODO: En los resultados de una partida, cuando la pregunta ha sido modificada, no calcular ni mostrar la puntuación de esa pregunta.
Por ejemplo una pregunta podria haber sido bien contestada con 1 punto, y se muestra en esa pregunta modificada aparece 0 en rojo.
Version 20.3: Sep 30, 2020 Non-editing teachers can list questions in a game. (304528 lines)
Version 20.2.2: Sep 27, 2020 Fixed bug in exam. (304448 lines)
Version 20.2.1: Sep 27, 2020 Fixed bug in exam, reported by Nuria Torres Rosell. (304442 lines)
Version 20.2: Sep 26, 2020 Removed unused action.

View File

@ -28,9 +28,9 @@
/** Uncomment one of the following installations of SWAD or create your own **/
/*****************************************************************************/
//#define LOCALHOST_UBUNTU // Comment this line if not applicable
#define LOCALHOST_UBUNTU // Comment this line if not applicable
//#define OPENSWAD_ORG // Comment this line if not applicable
#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWADBERRY_UGR_ES // Comment this line if not applicable
/*****************************************************************************/

View File

@ -110,6 +110,7 @@ extern struct Globals Gbl;
static void Gam_ListAllGames (struct Gam_Games *Games);
static bool Gam_CheckIfICanEditGames (void);
static bool Gam_CheckIfICanListGameQuestions (void);
static void Gam_PutIconsListGames (void *Games);
static void Gam_PutIconToCreateNewGame (struct Gam_Games *Games);
static void Gam_PutButtonToCreateNewGame (struct Gam_Games *Games);
@ -275,7 +276,8 @@ static void Gam_ListAllGames (struct Gam_Games *Games)
/***** Table head *****/
HTM_TABLE_BeginWideMarginPadding (5);
HTM_TR_Begin (NULL);
if (Gam_CheckIfICanEditGames ())
if (Gam_CheckIfICanEditGames () ||
Gam_CheckIfICanListGameQuestions ())
HTM_TH (1,1,"CONTEXT_COL",NULL); // Column for contextual icons
for (Order = (Gam_Order_t) 0;
@ -357,6 +359,24 @@ static bool Gam_CheckIfICanEditGames (void)
return false;
}
/*****************************************************************************/
/**************** Check if I can list questions in games *********************/
/*****************************************************************************/
static bool Gam_CheckIfICanListGameQuestions (void)
{
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_NET:
case Rol_TCH:
case Rol_SYS_ADM:
return true;
default:
return false;
}
return false;
}
/*****************************************************************************/
/***************** Put contextual icons in list of games *******************/
/*****************************************************************************/
@ -517,6 +537,8 @@ static void Gam_ShowOneGame (struct Gam_Games *Games,
Dat_StartEndTime_t StartEndTime;
const char *Color;
char Txt[Cns_MAX_BYTES_TEXT + 1];
bool ICanEditGames = Gam_CheckIfICanEditGames ();
bool ICanListQuestions = Gam_CheckIfICanListGameQuestions ();
/***** Set anchor string *****/
Frm_SetAnchorStr (Game->GamCod,&Anchor);
@ -529,15 +551,23 @@ static void Gam_ShowOneGame (struct Gam_Games *Games,
HTM_TR_Begin (NULL);
/***** Icons related to this game *****/
if (Gam_CheckIfICanEditGames ())
if (ICanEditGames ||
ICanListQuestions)
{
Games->GamCod = Game->GamCod;
if (ShowOnlyThisGame)
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\"");
else
HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL COLOR%u\"",Gbl.RowEvenOdd);
/* Icons to remove/edit this game */
Gam_PutFormsToRemEditOneGame (Games,Game,Anchor);
if (ICanEditGames)
/* Icons to remove/edit this game */
Gam_PutFormsToRemEditOneGame (Games,Game,Anchor);
else
/* Put icon to view game listing its questions */
Ico_PutContextualIconToView (ActLstOneGam,
Gam_PutParams,Games);
HTM_TD_End ();
}
@ -717,8 +747,6 @@ static void Gam_PutFormsToRemEditOneGame (struct Gam_Games *Games,
const struct Gam_Game *Game,
const char *Anchor)
{
Games->GamCod = Game->GamCod;
/***** Put icon to remove game *****/
Ico_PutContextualIconToRemove (ActReqRemGam,
Gam_PutParams,Games);
@ -1331,6 +1359,40 @@ static bool Gam_CheckIfSimilarGameExists (const struct Gam_Game *Game)
Game->GamCod) != 0);
}
/*****************************************************************************/
/************************* List the questions in a game **********************/
/*****************************************************************************/
void Gam_ListGame (void)
{
struct Gam_Games Games;
struct Gam_Game Game;
char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Reset games context *****/
Gam_ResetGames (&Games);
/***** Reset game *****/
Gam_ResetGame (&Game);
/***** Check if I can list game questions *****/
if (!Gam_CheckIfICanListGameQuestions ())
Lay_NoPermissionExit ();
/***** Get parameters *****/
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Get game data *****/
Gam_GetDataOfGameByCod (&Game);
Gam_GetGameTxtFromDB (Game.GamCod,Txt);
/***** Show game *****/
Gam_ShowOnlyOneGame (&Games,&Game,
true, // List game questions
false); // Do not put form to start new match
}
/*****************************************************************************/
/**************** Request the creation or edition of a game ******************/
/*****************************************************************************/
@ -1379,7 +1441,6 @@ void Gam_RequestCreatOrEditGame (void)
else
/* Show questions of the game ready to be edited */
Gam_ListGameQuestions (&Games,&Game);
}
/*****************************************************************************/

View File

@ -131,6 +131,8 @@ void Gam_RemoveCrsGames (long CrsCod);
void Gam_HideGame (void);
void Gam_UnhideGame (void);
void Gam_ListGame (void);
void Gam_RequestCreatOrEditGame (void);
void Gam_ReceiveFormGame (void);

View File

@ -268,7 +268,7 @@ void Ico_PutContextualIconToView (Act_Action_t NextAction,
Lay_PutContextualLinkOnlyIcon (NextAction,NULL,
FuncParams,Args,
"eye.svg",
"list.svg",
Txt_View);
}

View File

@ -11757,6 +11757,27 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActLstOneGam] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"View one game and its questions"
#elif L==4 // es
"Ver un juego y sus preguntas"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"Ver un juego y sus preguntas" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActFrmNewGam] =
@ -11767,11 +11788,11 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
#elif L==3 // en
"Form to create a new game"
#elif L==4 // es
""
"Formulario para crear un nuevo juego"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
"Formulario para crear un nuevo juego" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
@ -11786,13 +11807,13 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Edit one game"
"Edit game"
#elif L==4 // es
""
"Editar juego"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
"Editar juego" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
@ -11809,11 +11830,11 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
#elif L==3 // en
"Create new game"
#elif L==4 // es
""
"Crear nuevo juego"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
"Crear nuevo juego" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
@ -11830,11 +11851,11 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
#elif L==3 // en
"Modify data of an existing game"
#elif L==4 // es
""
"Modificar datos de un juego existente"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
"Modificar datos de un juego existente" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl