diff --git a/css/swad18.136.4.css b/css/swad18.138.css similarity index 99% rename from css/swad18.136.4.css rename to css/swad18.138.css index 64e7b7eb..a8d133c4 100644 --- a/css/swad18.136.4.css +++ b/css/swad18.138.css @@ -2641,28 +2641,46 @@ a:hover img.CENTRE_PHOTO_SHOW font-size:16pt; } -.MATCH_TCH_NXT_CONTAINER +.MATCH_BUTTONS_CONTAINER { + box-sizing:border-box; + display:table; + width:100%; + background:pink; } + +.MATCH_BUTTON_LEFT_CONTAINER + { + box-sizing:border-box; + float:left; + width:50%; + margin:0 auto; + text-align:center; + border:1px solid red; + } +.MATCH_BUTTON_RIGHT_CONTAINER + { + box-sizing:border-box; + float:left; + width:50%; + margin:0 auto; + text-align:center; + border:1px solid blue; + } +.MATCH_BUTTON_RIGHT_CONTAINER a + { + text-decoration:none; + } +.MATCH_BUTTON + { + font-size:12pt; + } + .MATCH_TCH_QST { color:#202020; font-size:24pt; } -.MATCH_TCH_CONTINUE_CONTAINER - { - clear:all; - margin:0 auto; - text-align:center; - } -.MATCH_TCH_CONTINUE_CONTAINER a - { - text-decoration:none; - } -.MATCH_TCH_CONTINUE - { - font-size:16pt; - } .MATCH_STD_WAIT_CONTAINER { @@ -2675,11 +2693,6 @@ a:hover img.CENTRE_PHOTO_SHOW width:50%; } -.MATCH_STD_QST_CONTAINER - { - width:85%; - float:left; - } .MATCH_STD_QST { color:#202020; @@ -2706,6 +2719,7 @@ a:hover img.CENTRE_PHOTO_SHOW { text-align:center; vertical-align:middle; + border:1px solid green; } .MATCH_STD_BUTTON { diff --git a/icon/step-backward.svg b/icon/step-backward.svg new file mode 100644 index 00000000..0834346e --- /dev/null +++ b/icon/step-backward.svg @@ -0,0 +1 @@ + diff --git a/icon/step-forward.svg b/icon/step-forward.svg index 48ae0d8d..e6b9eb5b 100644 --- a/icon/step-forward.svg +++ b/icon/step-forward.svg @@ -1 +1 @@ - + diff --git a/icon/step-forward320x320.png b/icon/step-forward320x320.png deleted file mode 100644 index 336ec529..00000000 Binary files a/icon/step-forward320x320.png and /dev/null differ diff --git a/icon/step-forward64x64.png b/icon/step-forward64x64.png deleted file mode 100644 index c2ea5426..00000000 Binary files a/icon/step-forward64x64.png and /dev/null differ diff --git a/swad_action.c b/swad_action.c index 98149cf4..a183bd1a 100644 --- a/swad_action.c +++ b/swad_action.c @@ -611,8 +611,9 @@ Assessment: 455. ActReqNewMchTch Put form to create a new match (by a teacher) 456. ActNewMchTch Create a new match showing first question in a new browser tab (by a teacher) NEW. ActResMchTch Resume an unfinished match showing current question in a new browser tab (by a teacher) - NEW. ActCurMchTch Show current question when playing a match (by a teacher) - 457. ActNxtMchTch Show next question when playing a match (by a teacher) + NEW. ActPrvMchTch Show previous question when playing a match (by a teacher) + NEW. ActCurMchTch Show current question when playing a match (by a teacher) + 457. ActNxtMchTch Show next question when playing a match (by a teacher) NEW. ActRefMchTch Refresh current question when playing a match (as teacher) NEW. ActShoMchTch Show finished match results @@ -2152,6 +2153,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActReqNewMchTch */{1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestNewMatchTch ,NULL}, /* ActNewMchTch */{1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_CreateNewMatchTch ,Gam_RequestStartResumeMatchTch ,NULL}, /* ActResMchTch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Gam_GetMatchBeingPlayed ,Gam_RequestStartResumeMatchTch ,NULL}, + /* ActPrvMchTch */{1790,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_PrevStatusMatchTch ,NULL}, /* ActCurMchTch */{1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_ResumeMatchTch ,NULL}, /* ActNxtMchTch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_NextStatusMatchTch ,NULL}, /* ActRefMchTch */{1788,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Gam_GetMatchBeingPlayed ,Gam_RefreshMatchTch ,NULL}, @@ -5001,6 +5003,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActCreMyAcc, // #1787 ActRefMchTch, // #1788 ActCurMchTch, // #1789 + ActPrvMchTch, // #1790 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index fda16fe7..c5cb0955 100644 --- a/swad_action.h +++ b/swad_action.h @@ -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 -#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 170 + 437 + 176 + 169 + 16 + 68) +#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 171 + 437 + 176 + 169 + 16 + 68) -#define Act_MAX_ACTION_COD 1789 +#define Act_MAX_ACTION_COD 1790 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -612,57 +612,58 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActReqNewMchTch (ActChgCrsTT1stDay + 119) #define ActNewMchTch (ActChgCrsTT1stDay + 120) #define ActResMchTch (ActChgCrsTT1stDay + 121) -#define ActCurMchTch (ActChgCrsTT1stDay + 122) -#define ActNxtMchTch (ActChgCrsTT1stDay + 123) -#define ActRefMchTch (ActChgCrsTT1stDay + 124) -#define ActShoMchTch (ActChgCrsTT1stDay + 125) -#define ActPlyMchStd (ActChgCrsTT1stDay + 126) -#define ActRefMchStd (ActChgCrsTT1stDay + 127) -#define ActAnsMchQstStd (ActChgCrsTT1stDay + 128) -#define ActFrmNewGam (ActChgCrsTT1stDay + 129) -#define ActEdiOneGam (ActChgCrsTT1stDay + 130) -#define ActNewGam (ActChgCrsTT1stDay + 131) -#define ActChgGam (ActChgCrsTT1stDay + 132) -#define ActReqRemGam (ActChgCrsTT1stDay + 133) -#define ActRemGam (ActChgCrsTT1stDay + 134) -#define ActReqRstGam (ActChgCrsTT1stDay + 135) -#define ActRstGam (ActChgCrsTT1stDay + 136) -#define ActHidGam (ActChgCrsTT1stDay + 137) -#define ActShoGam (ActChgCrsTT1stDay + 138) -#define ActAddOneGamQst (ActChgCrsTT1stDay + 139) -#define ActGamLstTstQst (ActChgCrsTT1stDay + 140) -#define ActAddTstQstToGam (ActChgCrsTT1stDay + 141) -#define ActReqRemGamQst (ActChgCrsTT1stDay + 142) -#define ActRemGamQst (ActChgCrsTT1stDay + 143) -#define ActUp_GamQst (ActChgCrsTT1stDay + 144) -#define ActDwnGamQst (ActChgCrsTT1stDay + 145) +#define ActPrvMchTch (ActChgCrsTT1stDay + 122) +#define ActCurMchTch (ActChgCrsTT1stDay + 123) +#define ActNxtMchTch (ActChgCrsTT1stDay + 124) +#define ActRefMchTch (ActChgCrsTT1stDay + 125) +#define ActShoMchTch (ActChgCrsTT1stDay + 126) +#define ActPlyMchStd (ActChgCrsTT1stDay + 127) +#define ActRefMchStd (ActChgCrsTT1stDay + 128) +#define ActAnsMchQstStd (ActChgCrsTT1stDay + 129) +#define ActFrmNewGam (ActChgCrsTT1stDay + 130) +#define ActEdiOneGam (ActChgCrsTT1stDay + 131) +#define ActNewGam (ActChgCrsTT1stDay + 132) +#define ActChgGam (ActChgCrsTT1stDay + 133) +#define ActReqRemGam (ActChgCrsTT1stDay + 134) +#define ActRemGam (ActChgCrsTT1stDay + 135) +#define ActReqRstGam (ActChgCrsTT1stDay + 136) +#define ActRstGam (ActChgCrsTT1stDay + 137) +#define ActHidGam (ActChgCrsTT1stDay + 138) +#define ActShoGam (ActChgCrsTT1stDay + 139) +#define ActAddOneGamQst (ActChgCrsTT1stDay + 140) +#define ActGamLstTstQst (ActChgCrsTT1stDay + 141) +#define ActAddTstQstToGam (ActChgCrsTT1stDay + 142) +#define ActReqRemGamQst (ActChgCrsTT1stDay + 143) +#define ActRemGamQst (ActChgCrsTT1stDay + 144) +#define ActUp_GamQst (ActChgCrsTT1stDay + 145) +#define ActDwnGamQst (ActChgCrsTT1stDay + 146) -#define ActSeeSvy (ActChgCrsTT1stDay + 146) -#define ActAnsSvy (ActChgCrsTT1stDay + 147) -#define ActFrmNewSvy (ActChgCrsTT1stDay + 148) -#define ActEdiOneSvy (ActChgCrsTT1stDay + 149) -#define ActNewSvy (ActChgCrsTT1stDay + 150) -#define ActChgSvy (ActChgCrsTT1stDay + 151) -#define ActReqRemSvy (ActChgCrsTT1stDay + 152) -#define ActRemSvy (ActChgCrsTT1stDay + 153) -#define ActReqRstSvy (ActChgCrsTT1stDay + 154) -#define ActRstSvy (ActChgCrsTT1stDay + 155) -#define ActHidSvy (ActChgCrsTT1stDay + 156) -#define ActShoSvy (ActChgCrsTT1stDay + 157) -#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 158) -#define ActRcvSvyQst (ActChgCrsTT1stDay + 159) -#define ActReqRemSvyQst (ActChgCrsTT1stDay + 160) -#define ActRemSvyQst (ActChgCrsTT1stDay + 161) +#define ActSeeSvy (ActChgCrsTT1stDay + 147) +#define ActAnsSvy (ActChgCrsTT1stDay + 148) +#define ActFrmNewSvy (ActChgCrsTT1stDay + 149) +#define ActEdiOneSvy (ActChgCrsTT1stDay + 150) +#define ActNewSvy (ActChgCrsTT1stDay + 151) +#define ActChgSvy (ActChgCrsTT1stDay + 152) +#define ActReqRemSvy (ActChgCrsTT1stDay + 153) +#define ActRemSvy (ActChgCrsTT1stDay + 154) +#define ActReqRstSvy (ActChgCrsTT1stDay + 155) +#define ActRstSvy (ActChgCrsTT1stDay + 156) +#define ActHidSvy (ActChgCrsTT1stDay + 157) +#define ActShoSvy (ActChgCrsTT1stDay + 158) +#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 159) +#define ActRcvSvyQst (ActChgCrsTT1stDay + 160) +#define ActReqRemSvyQst (ActChgCrsTT1stDay + 161) +#define ActRemSvyQst (ActChgCrsTT1stDay + 162) -#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 162) -#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 163) -#define ActEdiExaAnn (ActChgCrsTT1stDay + 164) -#define ActRcvExaAnn (ActChgCrsTT1stDay + 165) -#define ActPrnExaAnn (ActChgCrsTT1stDay + 166) -#define ActReqRemExaAnn (ActChgCrsTT1stDay + 167) -#define ActRemExaAnn (ActChgCrsTT1stDay + 168) -#define ActHidExaAnn (ActChgCrsTT1stDay + 169) -#define ActShoExaAnn (ActChgCrsTT1stDay + 170) +#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 163) +#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 164) +#define ActEdiExaAnn (ActChgCrsTT1stDay + 165) +#define ActRcvExaAnn (ActChgCrsTT1stDay + 166) +#define ActPrnExaAnn (ActChgCrsTT1stDay + 167) +#define ActReqRemExaAnn (ActChgCrsTT1stDay + 168) +#define ActRemExaAnn (ActChgCrsTT1stDay + 169) +#define ActHidExaAnn (ActChgCrsTT1stDay + 170) +#define ActShoExaAnn (ActChgCrsTT1stDay + 171) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 1a9c3950..8c345544 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -460,10 +460,22 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.136.5 (2019-07-25)" -#define CSS_FILE "swad18.136.4.css" +#define Log_PLATFORM_VERSION "SWAD 18.138 (2019-07-30)" +#define CSS_FILE "swad18.138.css" #define JS_FILE "swad18.130.2.js" /* + Version 18.138.3: Jul 30, 2019 Time of current match and current match question are stored in database. (? lines) + Version 18.138.2: Jul 30, 2019 Buttons backward and start on finished games. (? lines) + Version 18.138.1: Jul 30, 2019 Close button in games always present. (? lines) + Version 18.138: Jul 30, 2019 Button to go backward when playing a game. (244080 lines) + 1 change necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1790','es','N','Mostrar pregunta anterior en partida (como profesor)'); + + Copy the following icons to icon public directory: +sudo cp icon/step-backward.svg /var/www/html/swad/icon/ +sudo cp icon/step-forward.svg /var/www/html/swad/icon/ + + Version 18.136.6: Jul 25, 2019 Changes in layout of match for students. (243931 lines) Version 18.136.5: Jul 25, 2019 Changes in layout of match for students. (243936 lines) Version 18.136.4: Jul 19, 2019 Changes in layout of match for teachers. (243920 lines) Version 18.136.3: Jul 19, 2019 New icon to see answers in a match. (243924 lines) diff --git a/swad_game.c b/swad_game.c index e045533b..8ac0eb0a 100644 --- a/swad_game.c +++ b/swad_game.c @@ -187,6 +187,7 @@ static void Gam_PutFormNewMatch (struct Game *Game); static long Gam_CreateMatch (long GamCod,char Title[Gam_MAX_BYTES_TITLE + 1]); static void Gam_UpdateMatchStatusInDB (struct Match *Match); +static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match); static void Gam_SetMatchStatusToNextQuestion (struct Match *Match); static void Gam_ShowMatchStatusForTch (struct Match *Match); static void Gam_ShowMatchStatusForStd (struct Match *Match); @@ -3293,6 +3294,9 @@ void Gam_RequestStartResumeMatchTch (void) Match.MchCod = Gbl.Games.MchCodBeingPlayed; Gam_GetDataOfMatchByCod (&Match); + /***** Update match status in database *****/ + Gam_UpdateMatchStatusInDB (&Match); + /***** Show current match status *****/ fprintf (Gbl.F.Out,"
"); Gam_ShowMatchStatusForTch (&Match); @@ -3359,7 +3363,10 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match) 'N', Match->MchCod,Gbl.Hierarchy.Crs.CrsCod); - if (Match->Status.Finished) + if (Match->Status.BeingPlayed) + /* Update match as being played */ + Gam_UpdateMatchAsBeingPlayed (Match->MchCod); + else /* Update match as not being played */ Gam_SetMatchAsNotBeingPlayed (Match->MchCod); } @@ -3388,11 +3395,48 @@ void Gam_ResumeMatchTch (void) Match.Status.ShowingAnswers = false; // Don't show answers in any case Match.Status.BeingPlayed = true; // Resume match - - /* Update match status in database */ - Gam_UpdateMatchStatusInDB (&Match); } + /***** Update match status in database *****/ + Gam_UpdateMatchStatusInDB (&Match); + + /***** Show current match status *****/ + fprintf (Gbl.F.Out,"
"); + Gam_ShowMatchStatusForTch (&Match); + fprintf (Gbl.F.Out,"
"); + } + +/*****************************************************************************/ +/* Show previous match status (previous question, answers...) (by a teacher) */ +/*****************************************************************************/ + +void Gam_PrevStatusMatchTch (void) + { + struct Match Match; + + /***** Remove old players. + This function must be called before getting match status. *****/ + Gam_RemoveOldPlayers (); + + /***** Get data of the match from database *****/ + Match.MchCod = Gbl.Games.MchCodBeingPlayed; + Gam_GetDataOfMatchByCod (&Match); + + /***** If not yet finished, update status *****/ + if (!Match.Status.Finished) + { + if (Match.Status.ShowingAnswers) // Showing answers currently + { + Match.Status.Finished = false; // Match is not finished + Match.Status.ShowingAnswers = false; // Do not show answers + } + else + Gam_SetMatchStatusToPrevQuestion (&Match); + } + + /***** Update match status in database *****/ + Gam_UpdateMatchStatusInDB (&Match); + /***** Show current match status *****/ fprintf (Gbl.F.Out,"
"); Gam_ShowMatchStatusForTch (&Match); @@ -3430,17 +3474,43 @@ void Gam_NextStatusMatchTch (void) Match.Status.ShowingAnswers = true; // Show answers } } - - /* Update match status in database */ - Gam_UpdateMatchStatusInDB (&Match); } + /***** Update match status in database *****/ + Gam_UpdateMatchStatusInDB (&Match); + /***** Show current match status *****/ fprintf (Gbl.F.Out,"
"); Gam_ShowMatchStatusForTch (&Match); fprintf (Gbl.F.Out,"
"); } +/*****************************************************************************/ +/******************* Set match status to previous question *******************/ +/*****************************************************************************/ + +static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match) + { + /***** Get index of the previous question *****/ + Match->Status.QstInd = Gam_GetPrevQuestionIndexInGame (Match->GamCod, + Match->Status.QstInd); + + if (Match->Status.QstInd) // Not first question + { + Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod, + Match->Status.QstInd); + Match->Status.Finished = false; // Match is not finished + } + else // No previous question + { + Match->Status.QstCod = -1L; // No previous questions + Match->Status.BeingPlayed = false; // Match is not being played + Match->Status.Finished = false; // Match is not finished + } + + Match->Status.ShowingAnswers = false; // Don't show answers + } + /*****************************************************************************/ /********************* Set match status to next question *********************/ /*****************************************************************************/ @@ -3486,20 +3556,11 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match) Gam_ShowMatchTitleAndPlayers (Match); /***** Bottom row *****/ - fprintf (Gbl.F.Out,"
"); - if (!Match->Status.Finished && Match->Status.BeingPlayed) - { /* Show current question and possible answers */ Gam_ShowQuestionAndAnswersTch (Match); - /* Update match as being played */ - Gam_UpdateMatchAsBeingPlayed (Match->MchCod); - } - - fprintf (Gbl.F.Out,"
"); - /* End right container */ fprintf (Gbl.F.Out,"
"); } @@ -3533,9 +3594,10 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match) Gam_ShowMatchTitleAndPlayers (Match); /***** Bottom row *****/ - fprintf (Gbl.F.Out,"
"); if (!Match->Status.Finished) { + fprintf (Gbl.F.Out,"
"); + /***** Update players ******/ Gam_RegisterMeAsPlayerInMatch (Match->MchCod); @@ -3551,8 +3613,9 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match) Cfg_URL_ICON_PUBLIC, Txt_Please_wait_, Txt_Please_wait_); + + fprintf (Gbl.F.Out,"
"); } - fprintf (Gbl.F.Out,"
"); /* End right container */ fprintf (Gbl.F.Out,"
"); @@ -3565,12 +3628,16 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match) static void Gam_ShowLeftColumnTch (struct Match *Match) { extern const char *Txt_End; + extern const char *Txt_Stem; + extern const char *Txt_Previous_QUESTION; + extern const char *Txt_Start; extern const char *Txt_Next_QUESTION; extern const char *Txt_Finish; extern const char *Txt_Answers; extern const char *Txt_Start; extern const char *Txt_Resume; - unsigned NxtQstInd; + unsigned PrvQstInd; // Previous question index + unsigned NxtQstInd; // Next question index unsigned NumQsts; unsigned NumAnswerers; @@ -3589,9 +3656,44 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) fprintf (Gbl.F.Out,"%u/%u",Match->Status.QstInd,NumQsts); fprintf (Gbl.F.Out,""); - /***** Button *****/ - fprintf (Gbl.F.Out,"
" - "
"); + /***** Buttons *****/ + /* Start buttons container */ + fprintf (Gbl.F.Out,"
"); + + /* Left button */ + fprintf (Gbl.F.Out,"
"); + if (!Match->Status.Finished) // Not finished + { + if (Match->Status.BeingPlayed) + { + /* Put button to go backward */ + if (Match->Status.ShowingAnswers) + /* Put button to start current question */ + Gam_PutBigButton (ActCurMchTch,Match->MchCod, + "step-backward.svg",Txt_Stem); + else + { + /* Get index of the previous question */ + PrvQstInd = Gam_GetPrevQuestionIndexInGame (Match->GamCod, + Match->Status.QstInd); + if (PrvQstInd) // There is a previous question + /* Put button to show previous question */ + Gam_PutBigButton (ActPrvMchTch,Match->MchCod, + "step-backward.svg",Txt_Previous_QUESTION); + else // There is not a previous question + /* Put button to resume match before first question */ + Gam_PutBigButton (ActPrvMchTch,Match->MchCod, + "step-backward.svg",Txt_Start); + } + } + else // Not being played + /* Put button to close browser tab */ + Gam_PutBigButtonClose (); + } + fprintf (Gbl.F.Out,"
"); + + /* Right button */ + fprintf (Gbl.F.Out,"
"); if (Match->Status.Finished) /* Put button to close browser tab */ Gam_PutBigButtonClose (); @@ -3615,7 +3717,7 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) else /* Put button to show answers */ Gam_PutBigButton (ActNxtMchTch,Match->MchCod, - "list.svg",Txt_Answers); + "step-forward.svg",Txt_Answers); } else /* Put button to start / resume match */ @@ -3624,8 +3726,10 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) "play.svg", Match->Status.QstInd == 0 ? Txt_Start : Txt_Resume); - fprintf (Gbl.F.Out,"
" - "
"); + fprintf (Gbl.F.Out,"
"); + + /* End buttons container */ + fprintf (Gbl.F.Out,"
"); /***** Write number of users who have answered *****/ if (!Match->Status.Finished && @@ -3668,14 +3772,23 @@ static void Gam_ShowLeftColumnStd (struct Match *Match) fprintf (Gbl.F.Out,"%u/%u",Match->Status.QstInd,NumQsts); fprintf (Gbl.F.Out,""); - /***** Button *****/ - fprintf (Gbl.F.Out,"
" - "
"); + /***** Buttons *****/ + /* Start buttons container */ + fprintf (Gbl.F.Out,"
"); + + /* Left button */ + fprintf (Gbl.F.Out,"
" + "
"); + + /* Right button */ + fprintf (Gbl.F.Out,"
"); if (Match->Status.Finished) /* Put button to close browser tab */ Gam_PutBigButtonClose (); - fprintf (Gbl.F.Out,"
" - "
"); + fprintf (Gbl.F.Out,"
"); + + /* End buttons container */ + fprintf (Gbl.F.Out,"
"); /***** End left container *****/ fprintf (Gbl.F.Out,""); @@ -3735,6 +3848,8 @@ static void Gam_ShowQuestionAndAnswersTch (struct Match *Match) Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[0]); // TODO: Check that answer type is correct (unique choice) + fprintf (Gbl.F.Out,"
"); + /* Write stem (row[1]) */ Tst_WriteQstStem (row[1],"MATCH_TCH_QST"); @@ -3754,6 +3869,8 @@ static void Gam_ShowQuestionAndAnswersTch (struct Match *Match) Match->Status.QstInd, Match->Status.QstCod, "MATCH_TCH_QST",false); // Don't show result + + fprintf (Gbl.F.Out,"
"); } /*****************************************************************************/ @@ -3772,8 +3889,6 @@ static void Gam_ShowQuestionAndAnswersStd (struct Match *Match) bool ErrorInIndex = false; /***** Show question *****/ - fprintf (Gbl.F.Out,"
"); - /* Write buttons for answers? */ if (Match->Status.ShowingAnswers) { @@ -3864,8 +3979,6 @@ static void Gam_ShowQuestionAndAnswersStd (struct Match *Match) else Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game."); } - - fprintf (Gbl.F.Out,"
"); } /*****************************************************************************/ @@ -3885,7 +3998,7 @@ static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, and not lose clicks due to refresh */ fprintf (Gbl.F.Out,"", @@ -3913,7 +4026,7 @@ static void Gam_PutBigButtonClose (void) and not lose clicks due to refresh */ fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,"\"%s\"" @@ -3946,7 +4059,7 @@ static void Gam_RemoveOldPlayers (void) static void Gam_UpdateMatchAsBeingPlayed (long MchCod) { - /***** Insert me as match player *****/ + /***** Insert match as being played *****/ DB_QueryREPLACE ("can not set match as being played", "REPLACE gam_mch_being_played (MchCod) VALUE (%ld)", MchCod); @@ -4055,12 +4168,11 @@ void Gam_RefreshMatchTch (void) Match.MchCod = Gbl.Games.MchCodBeingPlayed; Gam_GetDataOfMatchByCod (&Match); + /***** Update match status in database *****/ + Gam_UpdateMatchStatusInDB (&Match); + /***** Show current match status *****/ Gam_ShowMatchStatusForTch (&Match); - - /***** Update match as being played *****/ - if (Match.Status.BeingPlayed) - Gam_UpdateMatchAsBeingPlayed (Match.MchCod); } /*****************************************************************************/ diff --git a/swad_game.h b/swad_game.h index 558a2d94..0451de25 100644 --- a/swad_game.h +++ b/swad_game.h @@ -123,6 +123,7 @@ void Gam_RequestNewMatchTch (void); void Gam_CreateNewMatchTch (void); void Gam_RequestStartResumeMatchTch (void); void Gam_ResumeMatchTch (void); +void Gam_PrevStatusMatchTch (void); void Gam_NextStatusMatchTch (void); void Gam_ShowFinishedMatchResults (void); diff --git a/swad_layout.c b/swad_layout.c index 313059b0..993ba560 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -684,6 +684,7 @@ static void Lay_WriteScriptInit (void) break; case ActNewMchTch: case ActResMchTch: + case ActPrvMchTch: case ActCurMchTch: case ActNxtMchTch: case ActPlyMchStd: @@ -804,6 +805,7 @@ static void Lay_WriteScriptParamsAJAX (void) /* Parameters related with match refreshing (for teachers) */ case ActNewMchTch: case ActResMchTch: + case ActPrvMchTch: case ActCurMchTch: case ActNxtMchTch: fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n" diff --git a/swad_text.c b/swad_text.c index dd9829ea..0b9d5a09 100644 --- a/swad_text.c +++ b/swad_text.c @@ -29668,6 +29668,27 @@ const char *Txt_Presents = "Presentes"; #endif +const char *Txt_Previous_QUESTION = +#if L==1 // ca + "Anterior"; +#elif L==2 // de + "Vorherige"; +#elif L==3 // en + "Previous"; +#elif L==4 // es + "Anterior"; +#elif L==5 // fr + "Précédente"; +#elif L==6 // gn + "Anterior"; // Okoteve traducción +#elif L==7 // it + "Precedente"; +#elif L==8 // pl + "Poprzednie"; +#elif L==9 // pt + "Anterior"; +#endif + const char *Txt_Print = #if L==1 // ca "Imprimir";