Version 22.107.7: May 06, 2023 Changes in edition of game.

This commit is contained in:
acanas 2023-05-06 15:04:59 +02:00
parent 63705c66a2
commit 6e5a3456e3
3 changed files with 127 additions and 123 deletions

View File

@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/ */
#define Log_PLATFORM_VERSION "SWAD 22.107.6 (2023-05-06)" #define Log_PLATFORM_VERSION "SWAD 22.107.7 (2023-05-06)"
#define CSS_FILE "swad22.107.css" #define CSS_FILE "swad22.107.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 22.107.7: May 06, 2023 Changes in edition of game. (338025 lines)
Version 22.107.6: May 06, 2023 Code refactoring in edition of exam. (338023 lines) Version 22.107.6: May 06, 2023 Code refactoring in edition of exam. (338023 lines)
Version 22.107.5: May 06, 2023 Changes in edition of rubric. (338027 lines) Version 22.107.5: May 06, 2023 Changes in edition of rubric. (338027 lines)
Version 22.107.4: May 06, 2023 Changes in edition of exam. (338040 lines) Version 22.107.4: May 06, 2023 Changes in edition of exam. (338040 lines)

View File

@ -106,16 +106,6 @@ extern struct Globals Gbl;
*/ */
#define Gam_MAX_GRADE_DEFAULT 1.0 #define Gam_MAX_GRADE_DEFAULT 1.0
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
typedef enum
{
Gam_EXISTING_GAME,
Gam_NEW_GAME,
} Gam_ExistingNewGame_t;
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -1261,27 +1251,67 @@ void Gam_ReqCreatOrEditGame (void)
Gam_DB_GetGameTxt (Games.Game.GamCod,Txt); Gam_DB_GetGameTxt (Games.Game.GamCod,Txt);
break; break;
case Gam_NEW_GAME: case Gam_NEW_GAME:
/* Initialize to empty game */
Gam_ResetGame (&Games.Game);
Txt[0] = '\0'; Txt[0] = '\0';
break; break;
} }
/***** Put forms to create/edit a game *****/ /***** Put form to create/edit a game and show questions *****/
Gam_PutFormEditionGame (&Games,Txt,ExistingNewGame); Gam_PutFormsOneGame (&Games,ExistingNewGame);
}
/***** Show games or questions *****/ /*****************************************************************************/
/********************* Put forms to create/edit a game ***********************/
/*****************************************************************************/
void Gam_PutFormsOneGame (struct Gam_Games *Games,
Gam_ExistingNewGame_t ExistingNewGame)
{
extern const char *Hlp_ASSESSMENT_Games_edit_game;
extern const char *Hlp_ASSESSMENT_Games_new_game;
extern const char *Txt_Game;
static void (*FunctionToDrawContextualIcons[]) (void *Args) =
{
[Gam_EXISTING_GAME] = Gam_PutIconsEditingOneGame,
[Gam_NEW_GAME ] = NULL,
};
static const char **HelpLink[] =
{
[Gam_EXISTING_GAME] = &Hlp_ASSESSMENT_Games_edit_game,
[Gam_NEW_GAME ] = &Hlp_ASSESSMENT_Games_new_game,
};
char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Initialize text / get text from database *****/
switch (ExistingNewGame) switch (ExistingNewGame)
{ {
case Gam_EXISTING_GAME: case Gam_EXISTING_GAME:
/* Show questions of the game ready to be edited */ Gam_DB_GetGameTxt (Games->Game.GamCod,Txt);
Gam_ListGameQuestions (&Games);
break; break;
case Gam_NEW_GAME: case Gam_NEW_GAME:
/* Show games again */ Txt[0] = '\0';
Gam_ListAllGames (&Games);
break; break;
} }
/***** Begin box *****/
Box_BoxBegin (NULL,
Games->Game.Title[0] ? Games->Game.Title :
Txt_Game,
FunctionToDrawContextualIcons[ExistingNewGame],Games,
*HelpLink[ExistingNewGame],Box_NOT_CLOSABLE);
/***** Put form to create/edit a game *****/
Gam_PutFormEditionGame (Games,Txt,ExistingNewGame);
/***** Show list of questions inside box *****/
if (ExistingNewGame == Gam_EXISTING_GAME)
Gam_ListGameQuestions (Games);
/***** End box ****/
Box_BoxEnd ();
/***** Show games again outside box *****/
if (ExistingNewGame == Gam_NEW_GAME)
Gam_ListAllGames (Games);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1294,18 +1324,12 @@ static void Gam_PutFormEditionGame (struct Gam_Games *Games,
{ {
extern const char *Hlp_ASSESSMENT_Games_edit_game; extern const char *Hlp_ASSESSMENT_Games_edit_game;
extern const char *Hlp_ASSESSMENT_Games_new_game; extern const char *Hlp_ASSESSMENT_Games_new_game;
extern const char *Txt_Game;
extern const char *Txt_Title; extern const char *Txt_Title;
extern const char *Txt_Maximum_grade; extern const char *Txt_Maximum_grade;
extern const char *Txt_Result_visibility; extern const char *Txt_Result_visibility;
extern const char *Txt_Description; extern const char *Txt_Description;
extern const char *Txt_Save_changes; extern const char *Txt_Save_changes;
extern const char *Txt_Create_game; extern const char *Txt_Create_game;
static void (*FunctionToDrawContextualIcons[]) (void *Args) =
{
[Gam_EXISTING_GAME] = Gam_PutIconsEditingOneGame,
[Gam_NEW_GAME ] = NULL,
};
static Act_Action_t NextAction[] = static Act_Action_t NextAction[] =
{ {
[Gam_EXISTING_GAME] = ActChgGam, [Gam_EXISTING_GAME] = ActChgGam,
@ -1316,24 +1340,12 @@ static void Gam_PutFormEditionGame (struct Gam_Games *Games,
[Gam_EXISTING_GAME] = Btn_CONFIRM_BUTTON, [Gam_EXISTING_GAME] = Btn_CONFIRM_BUTTON,
[Gam_NEW_GAME ] = Btn_CREATE_BUTTON, [Gam_NEW_GAME ] = Btn_CREATE_BUTTON,
}; };
const char *HelpLink[] =
{
[Gam_EXISTING_GAME] = Hlp_ASSESSMENT_Games_edit_game,
[Gam_NEW_GAME ] = Hlp_ASSESSMENT_Games_new_game,
};
const char *TxtButton[] = const char *TxtButton[] =
{ {
[Gam_EXISTING_GAME] = Txt_Save_changes, [Gam_EXISTING_GAME] = Txt_Save_changes,
[Gam_NEW_GAME ] = Txt_Create_game, [Gam_NEW_GAME ] = Txt_Create_game,
}; };
/***** Begin box *****/
Box_BoxBegin (NULL,
Games->Game.Title[0] ? Games->Game.Title :
Txt_Game,
FunctionToDrawContextualIcons[ExistingNewGame],Games,
HelpLink[ExistingNewGame],Box_NOT_CLOSABLE);
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginForm (NextAction[ExistingNewGame]); Frm_BeginForm (NextAction[ExistingNewGame]);
Gam_PutPars (Games); Gam_PutPars (Games);
@ -1414,9 +1426,6 @@ static void Gam_PutFormEditionGame (struct Gam_Games *Games,
/***** End form *****/ /***** End form *****/
Frm_EndForm (); Frm_EndForm ();
/***** End box ****/
Box_BoxEnd ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1462,21 +1471,8 @@ void Gam_ReceiveFormGame (void)
/***** Show pending alerts */ /***** Show pending alerts */
Ale_ShowAlerts (NULL); Ale_ShowAlerts (NULL);
/***** Put forms to create/edit the game *****/ /***** Show current game and its questions *****/
Gam_PutFormEditionGame (&Games,Txt,ExistingNewGame); Gam_PutFormsOneGame (&Games,ExistingNewGame);
/***** Show games or questions *****/
switch (ExistingNewGame)
{
case Gam_EXISTING_GAME:
/* Show questions of the game ready to be edited */
Gam_ListGameQuestions (&Games);
break;
case Gam_NEW_GAME:
/* Show games again */
Gam_ListAllGames (&Games);
break;
}
} }
static void Gam_ReceiveGameFieldsFromForm (struct Gam_Game *Game, static void Gam_ReceiveGameFieldsFromForm (struct Gam_Game *Game,

View File

@ -56,6 +56,12 @@ typedef enum
} Gam_AnswerType_t; } Gam_AnswerType_t;
#define Gam_ANSWER_TYPE_DEFAULT Gam_ANS_UNIQUE_CHOICE #define Gam_ANSWER_TYPE_DEFAULT Gam_ANS_UNIQUE_CHOICE
typedef enum
{
Gam_EXISTING_GAME,
Gam_NEW_GAME,
} Gam_ExistingNewGame_t;
struct Gam_GameSelected struct Gam_GameSelected
{ {
long GamCod; // Game code long GamCod; // Game code
@ -136,7 +142,8 @@ void Gam_UnhideGame (void);
void Gam_ListGame (void); void Gam_ListGame (void);
void Gam_ReqCreatOrEditGame (void); void Gam_ReqCreatOrEditGame (void);
void Gam_PutFormsOneGame (struct Gam_Games *Games,
Gam_ExistingNewGame_t ExistingNewGame);
void Gam_ReceiveFormGame (void); void Gam_ReceiveFormGame (void);
void Gam_ReqSelectQstsToAddToGame (void); void Gam_ReqSelectQstsToAddToGame (void);