diff --git a/swad_changelog.h b/swad_changelog.h index 28e2ebfaf..a8a90c845 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -456,14 +456,15 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.127.2 (2019-05-31)" +#define Log_PLATFORM_VERSION "SWAD 18.127.3 (2019-05-31)" #define CSS_FILE "swad18.123.css" #define JS_FILE "swad18.123.js" /* + Version 18.127.3: May 31, 2019 Code refactoring and cleaning in games. (243346 lines) Version 18.127.2: May 31, 2019 Question index is shown in match status. New action to show results of a finished match. (243493 lines) 1 change necessary in database: -INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1785','es','N','Ver resultados partida'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1786','es','N','Ver resultados partida'); Version 18.127.1: May 31, 2019 Removed action to end a match. (243464 lines) 1 change necessary in database: diff --git a/swad_game.c b/swad_game.c index 17981c9fc..b4d0e7165 100644 --- a/swad_game.c +++ b/swad_game.c @@ -129,6 +129,9 @@ static void Gam_PutParamCurrentMchCod (void); static void Gam_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); +static void Gam_PutParamMatchCod (long MchCod); +static long Gam_GetParamMatchCod (void); + static bool Gam_CheckIfSimilarGameExists (struct Game *Game); static void Gam_ShowLstGrpsToEditMatch (void); @@ -182,6 +185,7 @@ static void Gam_PutBigButtonToPlayMatchStd (long MchCod); static void Gam_CreateMatch (struct Match *Match); static void Gam_UpdateMatchBeingPlayed (struct Match *Match); +static void Gam_ShowAlertFinishedMatch (void); static void Gam_PlayGameShowQuestionAndAnswers (struct Match *Match); static void Gam_PutBigButtonToContinue (long MchCod); static void Gam_PutBigButtonToFinishMatch (long GamCod); @@ -220,7 +224,6 @@ static void Gam_ListAllGames (void) extern const char *Txt_START_END_TIME_HELP[Dat_NUM_START_END_TIME]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Game; - // extern const char *Txt_Status; extern const char *Txt_No_games; Gam_Order_t Order; struct Pagination Pagination; @@ -288,12 +291,8 @@ static void Gam_ListAllGames (void) fprintf (Gbl.F.Out,"" "%s" "" - // "" - // "%s" - // "" "", Txt_Game); - // Txt_Status); /***** Write all the games *****/ for (NumGame = Pagination.FirstItemVisible; @@ -453,7 +452,6 @@ static void Gam_ShowOneGame (long GamCod, extern const char *Txt_No_of_users; extern const char *Txt_Play; extern const char *Txt_New_match; -// extern const char *Txt_View_game_results; char *Anchor = NULL; static unsigned UniqueId = 0; struct Game Game; @@ -579,91 +577,6 @@ static void Gam_ShowOneGame (long GamCod, fprintf (Gbl.F.Out,""); - /***** Status of the game *****/ -/* - fprintf (Gbl.F.Out,""); - Gam_WriteStatus (&Game); - - if (ShowOnlyThisGame) - { - fprintf (Gbl.F.Out,"
"); - - * Possible button to play/start the game * - if (Game.Status.Open) - { - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_STD: - * Icon to play game * - Frm_StartForm (ActPlyMchStd); - Gam_PutParamGameCod (Game.GamCod); - Btn_PutCreateButtonInline (Txt_Play); - Frm_EndForm (); - break; - case Rol_NET: - case Rol_TCH: - * Icon to start game * - Frm_StartFormAnchor (ActFrmNewMch,Gam_NEW_MATCH_SECTION_ID); - Gam_PutParamGameCod (Game.GamCod); - Btn_PutCreateButtonInline (Txt_New_match); - Frm_EndForm (); - break; - default: - break; - } - } - - * Possible button to see the result of the game * - if (Game.Status.ICanViewResults) - { - Frm_StartForm (ActSeeGam); - Gam_PutParamGameCod (Game.GamCod); - Gam_PutHiddenParamGameOrder (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage); - Btn_PutConfirmButtonInline (Txt_View_game_results); - Frm_EndForm (); - } - - fprintf (Gbl.F.Out,"
"); - } - else // Show several games - { - fprintf (Gbl.F.Out,"
"); - - * Possible button to answer this game * - if (Game.Status.ICanAnswer) - { - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_STD: - * Icon to play game * - Frm_StartForm (ActPlyMchStd); - Gam_PutParamGameCod (Game.GamCod); - Btn_PutCreateButtonInline (Txt_Play); - Frm_EndForm (); - break; - case Rol_NET: - case Rol_TCH: - * Icon to start game * - Frm_StartFormAnchor (ActFrmNewMch,Gam_NEW_MATCH_SECTION_ID); - Gam_PutParamGameCod (Game.GamCod); - Btn_PutCreateButtonInline (Txt_New_match); - Frm_EndForm (); - break; - default: - break; - } - } - - fprintf (Gbl.F.Out,"
"); - } - - fprintf (Gbl.F.Out,""); -*/ /***** End 1st row of this game *****/ fprintf (Gbl.F.Out,""); @@ -742,72 +655,6 @@ static void Gam_WriteAuthor (struct Game *Game) Usr_WriteAuthor1Line (Game->UsrCod,!Game->Status.Visible); } -/*****************************************************************************/ -/************************ Write status of a game ***************************/ -/*****************************************************************************/ -/* -static void Gam_WriteStatus (struct Game *Game) - { - extern const char *Txt_Hidden_game; - extern const char *Txt_Visible_game; - extern const char *Txt_Closed_game; - extern const char *Txt_Open_game; - extern const char *Txt_GAME_You_belong_to_the_scope_of_the_game; - extern const char *Txt_GAME_You_dont_belong_to_the_scope_of_the_game; - extern const char *Txt_SURVEY_You_have_already_answered; - extern const char *Txt_SURVEY_You_have_not_answered; - - ***** Start list with items of status ***** - fprintf (Gbl.F.Out,""); - } -*/ /*****************************************************************************/ /********** Get parameter with the type or order in list of games ************/ /*****************************************************************************/ @@ -1124,7 +971,7 @@ long Gam_GetParamGameCod (void) /******************** Write parameter with code of match **********************/ /*****************************************************************************/ -void Gam_PutParamMatchCod (long MchCod) +static void Gam_PutParamMatchCod (long MchCod) { Par_PutHiddenParamLong ("MchCod",MchCod); } @@ -1133,7 +980,7 @@ void Gam_PutParamMatchCod (long MchCod) /********************* Get parameter with code of match **********************/ /*****************************************************************************/ -long Gam_GetParamMatchCod (void) +static long Gam_GetParamMatchCod (void) { /***** Get code of match *****/ return Par_GetParToLong ("MchCod"); @@ -1526,10 +1373,9 @@ static void Gam_ShowLstGrpsToEditMatch (void) "" "" "" @@ -1690,19 +1536,6 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt) Ale_ShowAlert (Ale_SUCCESS,Txt_The_game_has_been_modified); } -/*****************************************************************************/ -/*************** Check if a match is associated to any group *****************/ -/*****************************************************************************/ -/* -static bool Gam_CheckIfMatchIsAssociatedToGrps (long MchCod) - { - ***** Get if a match is associated to a group from database ***** - return (DB_QueryCOUNT ("can not check if a match is associated to groups", - "SELECT COUNT(*) FROM gam_grp" - " WHERE MchCod=%ld", - MchCod) != 0); - } -*/ /*****************************************************************************/ /************* Check if a match is associated to a given group ***************/ /*****************************************************************************/ @@ -3008,7 +2841,7 @@ static void Gam_ListOneOrMoreMatchesForEdition (struct Game *Game, extern const char *Txt_Status; extern const char *Txt_Resume; extern const char *Txt_Today; - extern const char *Txt_Finished_match; + extern const char *Txt_View_game_results; unsigned NumMatch; unsigned UniqueId; struct Match Match; @@ -3138,7 +2971,7 @@ static void Gam_ListOneOrMoreMatchesForEdition (struct Game *Game, Lay_PutContextualLinkOnlyIcon (ActShoMch,NULL, Gam_PutParamCurrentMchCod, "flag-checkered.svg", - Txt_Finished_match); + Txt_View_game_results); else // Unfinished match { /* Current question index / total of questions */ @@ -3554,7 +3387,6 @@ static void Gam_CreateMatch (struct Match *Match) void Gam_ResumeUnfinishedMatch (void) { - extern const char *Txt_Finished_match; struct Match Match; /***** Get parameters *****/ @@ -3566,13 +3398,7 @@ void Gam_ResumeUnfinishedMatch (void) Gam_GetDataOfMatchByCod (&Match); if (Match.Status.Finished) - { - /***** Show alert *****/ - Ale_ShowAlert (Ale_WARNING,Txt_Finished_match); - - /***** Button to close browser tab *****/ - Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!! - } + Gam_ShowAlertFinishedMatch (); else // Unfinished match { /***** In what question do we resume the match? *****/ @@ -3618,7 +3444,6 @@ static void Gam_UpdateMatchBeingPlayed (struct Match *Match) void Gam_NextStatusMatch (void) { - extern const char *Txt_Finished_match; struct Match Match; long NxtQstInd; @@ -3666,18 +3491,27 @@ void Gam_NextStatusMatch (void) /***** Show status and questions *****/ if (Match.Status.Finished) - { - /* Show alert */ - Ale_ShowAlert (Ale_WARNING,Txt_Finished_match); - - /* Button to close browser tab */ - Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!! - } + Gam_ShowAlertFinishedMatch (); else /* Show questions and possible answers */ Gam_PlayGameShowQuestionAndAnswers (&Match); } +/*****************************************************************************/ +/********************* Show alert about finished match ***********************/ +/*****************************************************************************/ + +static void Gam_ShowAlertFinishedMatch (void) + { + extern const char *Txt_Finished_match; + + /***** Show alert *****/ + Ale_ShowAlert (Ale_WARNING,Txt_Finished_match); + + /***** Button to close browser tab *****/ + Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!! + } + /*****************************************************************************/ /*********** Show question and its answers when playing a match **************/ /*****************************************************************************/ diff --git a/swad_game.h b/swad_game.h index 88cafc634..aa6dc5a4e 100644 --- a/swad_game.h +++ b/swad_game.h @@ -93,8 +93,6 @@ void Gam_FreeListGames (void); void Gam_PutParamGameCod (long GamCod); long Gam_GetParamGameCod (void); -void Gam_PutParamMatchCod (long MchCod); // TODO: Check if this function can be static -long Gam_GetParamMatchCod (void); // TODO: Check if this function can be static void Gam_AskRemGame (void); void Gam_RemoveGame (void); void Gam_AskResetGame (void); diff --git a/swad_text.c b/swad_text.c index ee80a59d4..067ac1e74 100644 --- a/swad_text.c +++ b/swad_text.c @@ -4119,7 +4119,7 @@ const char *Txt_Close = #elif L==9 // pt "Fechar"; #endif - +/* const char *Txt_Closed_game = #if L==1 // ca "Joc tancat"; @@ -4140,7 +4140,7 @@ const char *Txt_Closed_game = #elif L==9 // pt "Jogo fechado"; #endif - +*/ const char *Txt_Closed_survey = #if L==1 // ca "Enquesta tancada"; @@ -13593,7 +13593,7 @@ const char *Txt_Game_X_reset = // Warning: it is very important to include %s in #elif L==9 // pt "Jogo %s fixado em zero."; #endif - +/* const char *Txt_GAME_You_belong_to_the_scope_of_the_game = #if L==1 // ca "Pertany a l'àmbit del joc"; @@ -13635,7 +13635,7 @@ const char *Txt_GAME_You_dont_belong_to_the_scope_of_the_game = #elif L==9 // pt "Você não pertence ao âmbito do jogo"; #endif - +*/ const char *Txt_Games = #if L==1 // ca "Jocs"; @@ -14350,7 +14350,7 @@ const char *Txt_hidden_documents = #elif L==9 // pt "documentos ocultos"; #endif - +/* const char *Txt_Hidden_game = #if L==1 // ca "Joc ocult"; @@ -14371,7 +14371,7 @@ const char *Txt_Hidden_game = #elif L==9 // pt "Jogo oculto"; #endif - +*/ const char *Txt_Hidden_survey = #if L==1 // ca "Enquesta oculta"; @@ -27907,7 +27907,7 @@ const char *Txt_open_documents = #elif L==9 // pt "documentos abertos"; #endif - +/* const char *Txt_Open_game = #if L==1 // ca "Joc oberto"; @@ -27928,7 +27928,7 @@ const char *Txt_Open_game = #elif L==9 // pt "Jogo aberto"; #endif - +*/ const char *Txt_Open_survey = #if L==1 // ca "Enquesta oberta"; @@ -52667,7 +52667,7 @@ const char *Txt_Visible_by_BR_the_student = #elif L==9 // pt "Visível pelo
estudante?"; #endif - +/* const char *Txt_Visible_game = #if L==1 // ca "Joc visible"; @@ -52688,7 +52688,7 @@ const char *Txt_Visible_game = #elif L==9 // pt "Jogo visível"; #endif - +*/ const char *Txt_Visible_MALE_PLURAL = #if L==1 // ca "Visibles";