mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-02 23:05:33 +02:00
Version19.21
This commit is contained in:
parent
c91a0758e1
commit
49d0c44847
|
@ -471,10 +471,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.20 (2019-09-29)"
|
#define Log_PLATFORM_VERSION "SWAD 19.21 (2019-09-29)"
|
||||||
#define CSS_FILE "swad19.15.css"
|
#define CSS_FILE "swad19.15.css"
|
||||||
#define JS_FILE "swad19.15.js"
|
#define JS_FILE "swad19.15.js"
|
||||||
/*
|
/*
|
||||||
|
Version 19.21: Sep 29, 2019 Code refactoring in games and matches. (246674 lines)
|
||||||
Version 19.20: Sep 29, 2019 Code refactoring in games and matches. (246631 lines)
|
Version 19.20: Sep 29, 2019 Code refactoring in games and matches. (246631 lines)
|
||||||
14 changes necessary in database:
|
14 changes necessary in database:
|
||||||
UPDATE actions SET Txt='Solicitar eliminación partida' WHERE ActCod='1783' AND Language='es';
|
UPDATE actions SET Txt='Solicitar eliminación partida' WHERE ActCod='1783' AND Language='es';
|
||||||
|
|
50
swad_game.c
50
swad_game.c
|
@ -100,7 +100,6 @@ static void Gam_WriteAuthor (struct Game *Game);
|
||||||
static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
||||||
const char *Anchor);
|
const char *Anchor);
|
||||||
|
|
||||||
static long Gam_GetParams (void);
|
|
||||||
static void Gam_PutHiddenParamOrder (void);
|
static void Gam_PutHiddenParamOrder (void);
|
||||||
static void Gam_GetParamOrder (void);
|
static void Gam_GetParamOrder (void);
|
||||||
|
|
||||||
|
@ -135,6 +134,8 @@ static void Gam_ExchangeQuestions (long GamCod,
|
||||||
|
|
||||||
static bool Gam_GetNumMchsGameAndCheckIfEditable (struct Game *Game);
|
static bool Gam_GetNumMchsGameAndCheckIfEditable (struct Game *Game);
|
||||||
|
|
||||||
|
static long Gam_GetParamCurrentGamCod (void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** List all games ********************************/
|
/***************************** List all games ********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -389,7 +390,6 @@ void Gam_ShowOneGame (long GamCod,
|
||||||
/***** Get data of this game *****/
|
/***** Get data of this game *****/
|
||||||
Game.GamCod = GamCod;
|
Game.GamCod = GamCod;
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
Gam_CurrentGamCod = Game.GamCod; // Used as parameter in contextual links
|
|
||||||
|
|
||||||
/***** Set anchor string *****/
|
/***** Set anchor string *****/
|
||||||
Frm_SetAnchorStr (Game.GamCod,&Anchor);
|
Frm_SetAnchorStr (Game.GamCod,&Anchor);
|
||||||
|
@ -446,7 +446,7 @@ void Gam_ShowOneGame (long GamCod,
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
/* Game title */
|
/* Game title */
|
||||||
Gam_CurrentGamCod = GamCod;
|
Gam_SetParamCurrentGamCod (GamCod); // Used to pass parameter
|
||||||
Lay_StartArticle (Anchor);
|
Lay_StartArticle (Anchor);
|
||||||
Frm_StartForm (ActSeeGam);
|
Frm_StartForm (ActSeeGam);
|
||||||
Gam_PutParams ();
|
Gam_PutParams ();
|
||||||
|
@ -473,7 +473,7 @@ void Gam_ShowOneGame (long GamCod,
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
||||||
fprintf (Gbl.F.Out,"\">");
|
fprintf (Gbl.F.Out,"\">");
|
||||||
|
|
||||||
Gam_CurrentGamCod = GamCod;
|
Gam_SetParamCurrentGamCod (GamCod); // Used to pass parameter
|
||||||
Frm_StartForm (ActSeeGam);
|
Frm_StartForm (ActSeeGam);
|
||||||
Gam_PutParams ();
|
Gam_PutParams ();
|
||||||
Frm_LinkFormSubmit (Txt_Matches,
|
Frm_LinkFormSubmit (Txt_Matches,
|
||||||
|
@ -566,6 +566,8 @@ void Gam_PutHiddenParamGameOrder (void)
|
||||||
static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
||||||
const char *Anchor)
|
const char *Anchor)
|
||||||
{
|
{
|
||||||
|
Gam_SetParamCurrentGamCod (Game->GamCod); // Used to pass parameter
|
||||||
|
|
||||||
/***** Put icon to remove game *****/
|
/***** Put icon to remove game *****/
|
||||||
Ico_PutContextualIconToRemove (ActReqRemGam,Gam_PutParams);
|
Ico_PutContextualIconToRemove (ActReqRemGam,Gam_PutParams);
|
||||||
|
|
||||||
|
@ -586,8 +588,11 @@ static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
|
||||||
|
|
||||||
void Gam_PutParams (void)
|
void Gam_PutParams (void)
|
||||||
{
|
{
|
||||||
if (Gam_CurrentGamCod > 0)
|
long CurrentGamCod = Gam_GetParamCurrentGamCod ();
|
||||||
Gam_PutParamGameCod (Gam_CurrentGamCod);
|
|
||||||
|
if (CurrentGamCod > 0)
|
||||||
|
Gam_PutParamGameCod (CurrentGamCod);
|
||||||
|
|
||||||
Gam_PutHiddenParamOrder ();
|
Gam_PutHiddenParamOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
Grp_PutParamWhichGrps ();
|
||||||
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage);
|
||||||
|
@ -597,7 +602,7 @@ void Gam_PutParams (void)
|
||||||
/******************* Get parameters used to edit a game **********************/
|
/******************* Get parameters used to edit a game **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static long Gam_GetParams (void)
|
long Gam_GetParams (void)
|
||||||
{
|
{
|
||||||
/***** Get other parameters *****/
|
/***** Get other parameters *****/
|
||||||
Gam_GetParamOrder ();
|
Gam_GetParamOrder ();
|
||||||
|
@ -913,7 +918,7 @@ void Gam_AskRemGame (void)
|
||||||
Lay_ShowErrorAndExit ("You can not remove this game.");
|
Lay_ShowErrorAndExit ("You can not remove this game.");
|
||||||
|
|
||||||
/***** Show question and button to remove game *****/
|
/***** Show question and button to remove game *****/
|
||||||
Gam_CurrentGamCod = Game.GamCod;
|
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
|
||||||
Ale_ShowAlertAndButton (ActRemGam,NULL,NULL,Gam_PutParams,
|
Ale_ShowAlertAndButton (ActRemGam,NULL,NULL,Gam_PutParams,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_game,
|
Btn_REMOVE_BUTTON,Txt_Remove_game,
|
||||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_game_X,
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_game_X,
|
||||||
|
@ -1111,7 +1116,7 @@ void Gam_RequestCreatOrEditGame (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
Gam_CurrentGamCod = Game.GamCod;
|
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
|
||||||
Frm_StartForm (ItsANewGame ? ActNewGam :
|
Frm_StartForm (ItsANewGame ? ActNewGam :
|
||||||
ActChgGam);
|
ActChgGam);
|
||||||
Gam_PutParams ();
|
Gam_PutParams ();
|
||||||
|
@ -1337,7 +1342,7 @@ void Gam_RequestNewQuestion (void)
|
||||||
if (Gam_GetNumMchsGameAndCheckIfEditable (&Game))
|
if (Gam_GetNumMchsGameAndCheckIfEditable (&Game))
|
||||||
{
|
{
|
||||||
/***** Show form to create a new question in this game *****/
|
/***** Show form to create a new question in this game *****/
|
||||||
Gam_CurrentGamCod = Game.GamCod;
|
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
|
||||||
Tst_ShowFormAskSelectTstsForGame ();
|
Tst_ShowFormAskSelectTstsForGame ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1364,7 +1369,7 @@ void Gam_ListTstQuestionsToSelect (void)
|
||||||
if (Gam_GetNumMchsGameAndCheckIfEditable (&Game))
|
if (Gam_GetNumMchsGameAndCheckIfEditable (&Game))
|
||||||
{
|
{
|
||||||
/***** List several test questions for selection *****/
|
/***** List several test questions for selection *****/
|
||||||
Gam_CurrentGamCod = Game.GamCod;
|
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
|
||||||
Tst_ListQuestionsToSelect ();
|
Tst_ListQuestionsToSelect ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1573,7 +1578,7 @@ static void Gam_ListGameQuestions (struct Game *Game)
|
||||||
Game->GamCod);
|
Game->GamCod);
|
||||||
|
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
Gam_CurrentGamCod = Game->GamCod;
|
Gam_SetParamCurrentGamCod (Game->GamCod); // Used to pass parameter
|
||||||
Box_StartBox (NULL,Txt_Questions,ICanEditGames ? Gam_PutIconToAddNewQuestions :
|
Box_StartBox (NULL,Txt_Questions,ICanEditGames ? Gam_PutIconToAddNewQuestions :
|
||||||
NULL,
|
NULL,
|
||||||
Hlp_ASSESSMENT_Games_questions,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Games_questions,Box_NOT_CLOSABLE);
|
||||||
|
@ -1674,13 +1679,12 @@ static void Gam_ListOneOrMoreQuestionsForEdition (long GamCod,unsigned NumQsts,
|
||||||
QstCod = Str_ConvertStrCodToLongCod (row[1]);
|
QstCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
|
||||||
/***** Icons *****/
|
/***** Icons *****/
|
||||||
Gam_CurrentGamCod = GamCod;
|
Gam_SetParamCurrentGamCod (GamCod); // Used to pass parameter
|
||||||
Gam_CurrentQstInd = QstInd;
|
Gam_CurrentQstInd = QstInd;
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"BT%u\">",Gbl.RowEvenOdd);
|
"<td class=\"BT%u\">",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/* Put icon to remove the question */
|
/* Put icon to remove the question */
|
||||||
Gam_CurrentGamCod = GamCod;
|
|
||||||
Frm_StartForm (ActReqRemGamQst);
|
Frm_StartForm (ActReqRemGamQst);
|
||||||
Gam_PutParams ();
|
Gam_PutParams ();
|
||||||
Gam_PutParamQstInd (QstInd);
|
Gam_PutParamQstInd (QstInd);
|
||||||
|
@ -1951,7 +1955,7 @@ void Gam_RequestRemoveQst (void)
|
||||||
QstInd = Gam_GetParamQstInd ();
|
QstInd = Gam_GetParamQstInd ();
|
||||||
|
|
||||||
/***** Show question and button to remove question *****/
|
/***** Show question and button to remove question *****/
|
||||||
Gam_CurrentGamCod = Game.GamCod;
|
Gam_SetParamCurrentGamCod (Game.GamCod); // Used to pass parameter
|
||||||
Gam_CurrentQstInd = QstInd;
|
Gam_CurrentQstInd = QstInd;
|
||||||
Ale_ShowAlertAndButton (ActRemGamQst,NULL,NULL,Gam_PutParamsOneQst,
|
Ale_ShowAlertAndButton (ActRemGamQst,NULL,NULL,Gam_PutParamsOneQst,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_question,
|
Btn_REMOVE_BUTTON,Txt_Remove_question,
|
||||||
|
@ -2206,7 +2210,7 @@ void Gam_PutButtonNewMatch (long GamCod)
|
||||||
{
|
{
|
||||||
extern const char *Txt_New_match;
|
extern const char *Txt_New_match;
|
||||||
|
|
||||||
Gam_CurrentGamCod = GamCod;
|
Gam_SetParamCurrentGamCod (GamCod); // Used to pass parameter
|
||||||
Frm_StartFormAnchor (ActReqNewMch,Mch_NEW_MATCH_SECTION_ID);
|
Frm_StartFormAnchor (ActReqNewMch,Mch_NEW_MATCH_SECTION_ID);
|
||||||
Gam_PutParams ();
|
Gam_PutParams ();
|
||||||
Btn_PutConfirmButton (Txt_New_match);
|
Btn_PutConfirmButton (Txt_New_match);
|
||||||
|
@ -2516,3 +2520,17 @@ void Gam_ShowTstTagsPresentInAGame (long GamCod)
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Access to variable used to pass parameter ******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Gam_SetParamCurrentGamCod (long GamCod)
|
||||||
|
{
|
||||||
|
Gam_CurrentGamCod = GamCod;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long Gam_GetParamCurrentGamCod (void)
|
||||||
|
{
|
||||||
|
return Gam_CurrentGamCod;
|
||||||
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ void Gam_PutHiddenParamGameOrder (void);
|
||||||
void Gam_RequestCreatOrEditGame (void);
|
void Gam_RequestCreatOrEditGame (void);
|
||||||
|
|
||||||
void Gam_PutParams (void);
|
void Gam_PutParams (void);
|
||||||
|
long Gam_GetParams (void);
|
||||||
|
|
||||||
void Gam_GetListGames (void);
|
void Gam_GetListGames (void);
|
||||||
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
||||||
|
@ -127,4 +128,6 @@ float Gam_GetNumQstsPerCrsGame (Hie_Level_t Scope);
|
||||||
|
|
||||||
void Gam_ShowTstTagsPresentInAGame (long GamCod);
|
void Gam_ShowTstTagsPresentInAGame (long GamCod);
|
||||||
|
|
||||||
|
void Gam_SetParamCurrentGamCod (long GamCod);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
132
swad_match.c
132
swad_match.c
|
@ -137,7 +137,8 @@ static void Mch_RemoveMatchFromTable (long MchCod,const char *TableName);
|
||||||
static void Mch_RemoveMatchesInGameFromTable (long GamCod,const char *TableName);
|
static void Mch_RemoveMatchesInGameFromTable (long GamCod,const char *TableName);
|
||||||
static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName);
|
static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName);
|
||||||
|
|
||||||
static void Mch_PutParams (void);
|
static void Mch_PutParamsEdit (void);
|
||||||
|
static void Mch_PutParamsPlay (void);
|
||||||
|
|
||||||
static void Mch_PutFormNewMatch (struct Game *Game);
|
static void Mch_PutFormNewMatch (struct Game *Game);
|
||||||
static void Mch_ShowLstGrpsToCreateMatch (void);
|
static void Mch_ShowLstGrpsToCreateMatch (void);
|
||||||
|
@ -205,6 +206,9 @@ static unsigned Mch_GetNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsi
|
||||||
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
|
static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
|
||||||
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
|
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
|
||||||
|
|
||||||
|
static void Mch_SetParamCurrentMchCod (long MchCod);
|
||||||
|
static long Mch_GetParamCurrentMchCod (void);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************* List the matches of a game ************************/
|
/************************* List the matches of a game ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -213,7 +217,6 @@ void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Games_matches;
|
extern const char *Hlp_ASSESSMENT_Games_matches;
|
||||||
extern const char *Txt_Matches;
|
extern const char *Txt_Matches;
|
||||||
extern long Gam_CurrentGamCod; // Used as parameter in contextual links;
|
|
||||||
char *SubQuery;
|
char *SubQuery;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned NumMatches;
|
unsigned NumMatches;
|
||||||
|
@ -261,7 +264,7 @@ void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch)
|
||||||
free ((void *) SubQuery);
|
free ((void *) SubQuery);
|
||||||
|
|
||||||
/***** Start box *****/
|
/***** Start box *****/
|
||||||
Gam_CurrentGamCod = Game->GamCod;
|
Gam_SetParamCurrentGamCod (Game->GamCod); // Used to pass parameter
|
||||||
Box_StartBox (NULL,Txt_Matches,Mch_PutIconToPlayNewMatch,
|
Box_StartBox (NULL,Txt_Matches,Mch_PutIconToPlayNewMatch,
|
||||||
Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
@ -514,9 +517,10 @@ static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match)
|
||||||
fprintf (Gbl.F.Out,"<td class=\"BT%u\">",Gbl.RowEvenOdd);
|
fprintf (Gbl.F.Out,"<td class=\"BT%u\">",Gbl.RowEvenOdd);
|
||||||
|
|
||||||
/***** Put icon to remove the match *****/
|
/***** Put icon to remove the match *****/
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
|
||||||
|
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||||
Frm_StartForm (ActReqRemMch);
|
Frm_StartForm (ActReqRemMch);
|
||||||
Mch_PutParams ();
|
Mch_PutParamsEdit ();
|
||||||
Ico_PutIconRemove ();
|
Ico_PutIconRemove ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
@ -684,9 +688,9 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N
|
||||||
if (ICanPlayThisMatchBasedOnGrps)
|
if (ICanPlayThisMatchBasedOnGrps)
|
||||||
{
|
{
|
||||||
/* Icon to play as student */
|
/* Icon to play as student */
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||||
Lay_PutContextualLinkOnlyIcon (ActJoiMch,NULL,
|
Lay_PutContextualLinkOnlyIcon (ActJoiMch,NULL,
|
||||||
Mch_PutParams,
|
Mch_PutParamsPlay,
|
||||||
Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
|
Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
|
||||||
"flag-checkered.svg",
|
"flag-checkered.svg",
|
||||||
Txt_Play);
|
Txt_Play);
|
||||||
|
@ -696,9 +700,9 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/* Icon to resume */
|
/* Icon to resume */
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||||
Lay_PutContextualLinkOnlyIcon (ActResMch,NULL,
|
Lay_PutContextualLinkOnlyIcon (ActResMch,NULL,
|
||||||
Mch_PutParams,
|
Mch_PutParamsPlay,
|
||||||
Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
|
Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" :
|
||||||
"flag-checkered.svg",
|
"flag-checkered.svg",
|
||||||
Txt_Resume);
|
Txt_Resume);
|
||||||
|
@ -731,8 +735,10 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
|
||||||
/* Match result visible or hidden? */
|
/* Match result visible or hidden? */
|
||||||
if (Match->Status.ShowUsrResults)
|
if (Match->Status.ShowUsrResults)
|
||||||
{
|
{
|
||||||
|
Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
|
||||||
|
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||||
Frm_StartForm (ActSeeOneMchResMe);
|
Frm_StartForm (ActSeeOneMchResMe);
|
||||||
Mch_PutParamMchCod (Match->MchCod);
|
Mch_PutParamsEdit ();
|
||||||
Ico_PutIconLink ("tasks.svg",Txt_Match_result);
|
Ico_PutIconLink ("tasks.svg",Txt_Match_result);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
@ -744,9 +750,10 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
|
||||||
case Rol_TCH:
|
case Rol_TCH:
|
||||||
case Rol_SYS_ADM:
|
case Rol_SYS_ADM:
|
||||||
/* Match result visible or hidden? */
|
/* Match result visible or hidden? */
|
||||||
Mch_CurrentMchCod = Match->MchCod;
|
Gam_SetParamCurrentGamCod (Match->GamCod); // Used to pass parameter
|
||||||
|
Mch_SetParamCurrentMchCod (Match->MchCod); // Used to pass parameter
|
||||||
Lay_PutContextualLinkOnlyIcon (ActChgVisResMchUsr,NULL,
|
Lay_PutContextualLinkOnlyIcon (ActChgVisResMchUsr,NULL,
|
||||||
Mch_PutParams,
|
Mch_PutParamsEdit,
|
||||||
Match->Status.ShowUsrResults ? "eye.svg" :
|
Match->Status.ShowUsrResults ? "eye.svg" :
|
||||||
"eye-slash.svg",
|
"eye-slash.svg",
|
||||||
Match->Status.ShowUsrResults ? Txt_Visible_result :
|
Match->Status.ShowUsrResults ? Txt_Visible_result :
|
||||||
|
@ -765,14 +772,11 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match,
|
||||||
|
|
||||||
void Mch_ToggleVisibilResultsMchUsr (void)
|
void Mch_ToggleVisibilResultsMchUsr (void)
|
||||||
{
|
{
|
||||||
|
struct Game Game;
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get and check parameters *****/
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
|
Mch_GetAndCheckParameters (&Game,&Match);
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
|
||||||
|
|
||||||
/***** Get data of the match and the game from database *****/
|
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
|
||||||
|
|
||||||
/***** Toggle visibility of match results *****/
|
/***** Toggle visibility of match results *****/
|
||||||
Match.Status.ShowUsrResults = !Match.Status.ShowUsrResults;
|
Match.Status.ShowUsrResults = !Match.Status.ShowUsrResults;
|
||||||
|
@ -891,19 +895,16 @@ void Mch_RequestRemoveMatch (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_match_X;
|
extern const char *Txt_Do_you_really_want_to_remove_the_match_X;
|
||||||
extern const char *Txt_Remove_match;
|
extern const char *Txt_Remove_match;
|
||||||
|
struct Game Game;
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get and check parameters *****/
|
||||||
/* Get match code */
|
Mch_GetAndCheckParameters (&Game,&Match);
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
|
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
|
||||||
|
|
||||||
/***** Show question and button to remove question *****/
|
/***** Show question and button to remove question *****/
|
||||||
Mch_CurrentMchCod = Match.MchCod;
|
Gam_SetParamCurrentGamCod (Match.GamCod); // Used to pass parameter
|
||||||
Ale_ShowAlertAndButton (ActRemMch,NULL,NULL,Mch_PutParams,
|
Mch_SetParamCurrentMchCod (Match.MchCod); // Used to pass parameter
|
||||||
|
Ale_ShowAlertAndButton (ActRemMch,NULL,NULL,Mch_PutParamsEdit,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_match,
|
Btn_REMOVE_BUTTON,Txt_Remove_match,
|
||||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_match_X,
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_match_X,
|
||||||
Match.Title);
|
Match.Title);
|
||||||
|
@ -922,24 +923,11 @@ void Mch_RequestRemoveMatch (void)
|
||||||
void Mch_RemoveMatch (void)
|
void Mch_RemoveMatch (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Match_X_removed;
|
extern const char *Txt_Match_X_removed;
|
||||||
struct Match Match;
|
|
||||||
struct Game Game;
|
struct Game Game;
|
||||||
|
struct Match Match;
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get and check parameters *****/
|
||||||
/* Get match code */
|
Mch_GetAndCheckParameters (&Game,&Match);
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
|
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
|
||||||
if (Match.MchCod < 0)
|
|
||||||
Lay_ShowErrorAndExit ("The match to be removed does not exist.");
|
|
||||||
|
|
||||||
/***** Ensure that the match belongs to this course *****/
|
|
||||||
Game.GamCod = Match.GamCod;
|
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
|
||||||
if (Game.CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
|
||||||
Lay_ShowErrorAndExit ("Match does not belong to this course.");
|
|
||||||
|
|
||||||
/***** Remove the match from all database tables *****/
|
/***** Remove the match from all database tables *****/
|
||||||
Mch_RemoveMatchFromAllTables (Match.MchCod);
|
Mch_RemoveMatchFromAllTables (Match.MchCod);
|
||||||
|
@ -1072,11 +1060,22 @@ static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName)
|
||||||
/*********************** Params used to edit a match *************************/
|
/*********************** Params used to edit a match *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Mch_PutParams (void)
|
static void Mch_PutParamsEdit (void)
|
||||||
{
|
{
|
||||||
if (Mch_CurrentMchCod > 0)
|
Gam_PutParams ();
|
||||||
Mch_PutParamMchCod (Mch_CurrentMchCod);
|
Mch_PutParamsPlay ();
|
||||||
Grp_PutParamWhichGrps ();
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********************** Params used to edit a match *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Mch_PutParamsPlay (void)
|
||||||
|
{
|
||||||
|
long CurrentMchCod = Mch_GetParamCurrentMchCod ();
|
||||||
|
|
||||||
|
if (CurrentMchCod > 0)
|
||||||
|
Mch_PutParamMchCod (CurrentMchCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1088,6 +1087,30 @@ void Mch_PutParamMchCod (long MchCod)
|
||||||
Par_PutHiddenParamLong ("MchCod",MchCod);
|
Par_PutHiddenParamLong ("MchCod",MchCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Get and check parameters *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Mch_GetAndCheckParameters (struct Game *Game,struct Match *Match)
|
||||||
|
{
|
||||||
|
/***** Get parameters *****/
|
||||||
|
/* Get parameters of game */
|
||||||
|
if ((Game->GamCod = Gam_GetParams ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of game is missing.");
|
||||||
|
Gam_GetDataOfGameByCod (Game);
|
||||||
|
|
||||||
|
/* Get match code */
|
||||||
|
if ((Match->MchCod = Mch_GetParamMchCod ()) == -1L)
|
||||||
|
Lay_ShowErrorAndExit ("Code of match is missing.");
|
||||||
|
Mch_GetDataOfMatchByCod (Match);
|
||||||
|
|
||||||
|
/***** Ensure parameters are correct *****/
|
||||||
|
if (Game->GamCod != Match->GamCod)
|
||||||
|
Lay_ShowErrorAndExit ("Wrong game code.");
|
||||||
|
if (Game->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
|
Lay_ShowErrorAndExit ("Match does not belong to this course.");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Get parameter with code of match **********************/
|
/********************* Get parameter with code of match **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3016,3 +3039,18 @@ static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQs
|
||||||
/***** End container *****/
|
/***** End container *****/
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Access to variable used to pass parameter ******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Mch_SetParamCurrentMchCod (long MchCod)
|
||||||
|
{
|
||||||
|
Mch_CurrentMchCod = MchCod;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long Mch_GetParamCurrentMchCod (void)
|
||||||
|
{
|
||||||
|
return Mch_CurrentMchCod;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ void Mch_RemoveMatchesInGameFromAllTables (long GamCod);
|
||||||
void Mch_RemoveMatchInCourseFromAllTables (long CrsCod);
|
void Mch_RemoveMatchInCourseFromAllTables (long CrsCod);
|
||||||
|
|
||||||
void Mch_PutParamMchCod (long MchCod);
|
void Mch_PutParamMchCod (long MchCod);
|
||||||
|
void Mch_GetAndCheckParameters (struct Game *Game,struct Match *Match);
|
||||||
long Mch_GetParamMchCod (void);
|
long Mch_GetParamMchCod (void);
|
||||||
|
|
||||||
void Mch_CreateNewMatchTch (void);
|
void Mch_CreateNewMatchTch (void);
|
||||||
|
|
|
@ -653,6 +653,7 @@ void Mch_ShowOneMchResult (void)
|
||||||
extern const char *Txt_Score;
|
extern const char *Txt_Score;
|
||||||
extern const char *Txt_out_of_PART_OF_A_SCORE;
|
extern const char *Txt_out_of_PART_OF_A_SCORE;
|
||||||
extern const char *Txt_Tags;
|
extern const char *Txt_Tags;
|
||||||
|
struct Game Game;
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
Usr_MeOrOther_t MeOrOther;
|
Usr_MeOrOther_t MeOrOther;
|
||||||
struct UsrData *UsrDat;
|
struct UsrData *UsrDat;
|
||||||
|
@ -668,12 +669,8 @@ void Mch_ShowOneMchResult (void)
|
||||||
bool ICanViewResult;
|
bool ICanViewResult;
|
||||||
bool ICanViewScore;
|
bool ICanViewScore;
|
||||||
|
|
||||||
/***** Get match code *****/
|
/***** Get and check parameters *****/
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) == -1L)
|
Mch_GetAndCheckParameters (&Game,&Match);
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
|
||||||
|
|
||||||
/***** Pointer to user's data *****/
|
/***** Pointer to user's data *****/
|
||||||
MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME :
|
MeOrOther = (Gbl.Action.Act == ActSeeOneMchResMe) ? Usr_ME :
|
||||||
|
|
Loading…
Reference in New Issue
Block a user