From 450d45fb456d362181e82c3e9a14ef7d5a117afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 9 Sep 2019 19:55:50 +0200 Subject: [PATCH] Version18.141 --- css/swad18.138.css | 31 +++++++++++--- swad_action.c | 3 ++ swad_action.h | 103 +++++++++++++++++++++++---------------------- swad_changelog.h | 6 ++- swad_game.c | 65 +++++++++++++++++++++++++--- swad_game.h | 1 + swad_layout.c | 2 + swad_text.c | 21 +++++++++ 8 files changed, 169 insertions(+), 63 deletions(-) diff --git a/css/swad18.138.css b/css/swad18.138.css index 2be48fb5e..f2353442d 100644 --- a/css/swad18.138.css +++ b/css/swad18.138.css @@ -2592,7 +2592,6 @@ a:hover img.CENTRE_PHOTO_SHOW .MATCH_TOP { box-sizing:border-box; - /* display:table; */ width:100%; height:60px; font-size:18pt; @@ -2643,14 +2642,24 @@ a:hover img.CENTRE_PHOTO_SHOW display:table-cell; box-sizing:border-box; float:left; - width:50%; + width:33%; + /* border:1px solid green; */ + } +.MATCH_BUTTON_CENTER_CONTAINER + { + display:table-cell; + box-sizing:border-box; + float:left; + width:34%; + /* border:1px solid green; */ } .MATCH_BUTTON_RIGHT_CONTAINER { display:table-cell; box-sizing:border-box; float:left; - width:50%; + width:33%; + /* border:1px solid green; */ } .MATCH_BUTTON_CONTAINER @@ -2666,20 +2675,30 @@ a:hover img.CENTRE_PHOTO_SHOW text-decoration:none; color:#404040; } -.MATCH_BUTTON +.MATCH_BUTTON_ON { display:table-cell; width:100%; font-size:48pt; text-align:center; vertical-align:middle; - margin:auto; + /* margin:auto; */ opacity:0.7; } -.MATCH_BUTTON:hover +.MATCH_BUTTON_ON:hover { opacity:1; } +.MATCH_BUTTON_OFF + { + display:table-cell; + width:100%; + font-size:48pt; + text-align:center; + vertical-align:middle; + /* margin:auto; */ + opacity:0.1; + } .MATCH_TCH_QST { diff --git a/swad_action.c b/swad_action.c index a183bd1a6..56069f257 100644 --- a/swad_action.c +++ b/swad_action.c @@ -612,6 +612,7 @@ Assessment: 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. ActPrvMchTch Show previous question when playing a match (by a teacher) + NEW. ActPauMchTch Pause/hide current 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) @@ -2154,6 +2155,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* 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}, + /* ActPauMchTch */{1791,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Gam_GetMatchBeingPlayed ,Gam_PauseMatchTch ,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}, @@ -5004,6 +5006,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActRefMchTch, // #1788 ActCurMchTch, // #1789 ActPrvMchTch, // #1790 + ActPauMchTch, // #1791 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index c5cb09551..3e42bf6ac 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 + 171 + 437 + 176 + 169 + 16 + 68) +#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 172 + 437 + 176 + 169 + 16 + 68) -#define Act_MAX_ACTION_COD 1790 +#define Act_MAX_ACTION_COD 1791 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -613,57 +613,58 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActNewMchTch (ActChgCrsTT1stDay + 120) #define ActResMchTch (ActChgCrsTT1stDay + 121) #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 ActPauMchTch (ActChgCrsTT1stDay + 123) +#define ActCurMchTch (ActChgCrsTT1stDay + 124) +#define ActNxtMchTch (ActChgCrsTT1stDay + 125) +#define ActRefMchTch (ActChgCrsTT1stDay + 126) +#define ActShoMchTch (ActChgCrsTT1stDay + 127) +#define ActPlyMchStd (ActChgCrsTT1stDay + 128) +#define ActRefMchStd (ActChgCrsTT1stDay + 129) +#define ActAnsMchQstStd (ActChgCrsTT1stDay + 130) +#define ActFrmNewGam (ActChgCrsTT1stDay + 131) +#define ActEdiOneGam (ActChgCrsTT1stDay + 132) +#define ActNewGam (ActChgCrsTT1stDay + 133) +#define ActChgGam (ActChgCrsTT1stDay + 134) +#define ActReqRemGam (ActChgCrsTT1stDay + 135) +#define ActRemGam (ActChgCrsTT1stDay + 136) +#define ActReqRstGam (ActChgCrsTT1stDay + 137) +#define ActRstGam (ActChgCrsTT1stDay + 138) +#define ActHidGam (ActChgCrsTT1stDay + 139) +#define ActShoGam (ActChgCrsTT1stDay + 140) +#define ActAddOneGamQst (ActChgCrsTT1stDay + 141) +#define ActGamLstTstQst (ActChgCrsTT1stDay + 142) +#define ActAddTstQstToGam (ActChgCrsTT1stDay + 143) +#define ActReqRemGamQst (ActChgCrsTT1stDay + 144) +#define ActRemGamQst (ActChgCrsTT1stDay + 145) +#define ActUp_GamQst (ActChgCrsTT1stDay + 146) +#define ActDwnGamQst (ActChgCrsTT1stDay + 147) -#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 ActSeeSvy (ActChgCrsTT1stDay + 148) +#define ActAnsSvy (ActChgCrsTT1stDay + 149) +#define ActFrmNewSvy (ActChgCrsTT1stDay + 150) +#define ActEdiOneSvy (ActChgCrsTT1stDay + 151) +#define ActNewSvy (ActChgCrsTT1stDay + 152) +#define ActChgSvy (ActChgCrsTT1stDay + 153) +#define ActReqRemSvy (ActChgCrsTT1stDay + 154) +#define ActRemSvy (ActChgCrsTT1stDay + 155) +#define ActReqRstSvy (ActChgCrsTT1stDay + 156) +#define ActRstSvy (ActChgCrsTT1stDay + 157) +#define ActHidSvy (ActChgCrsTT1stDay + 158) +#define ActShoSvy (ActChgCrsTT1stDay + 159) +#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 160) +#define ActRcvSvyQst (ActChgCrsTT1stDay + 161) +#define ActReqRemSvyQst (ActChgCrsTT1stDay + 162) +#define ActRemSvyQst (ActChgCrsTT1stDay + 163) -#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) +#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 164) +#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 165) +#define ActEdiExaAnn (ActChgCrsTT1stDay + 166) +#define ActRcvExaAnn (ActChgCrsTT1stDay + 167) +#define ActPrnExaAnn (ActChgCrsTT1stDay + 168) +#define ActReqRemExaAnn (ActChgCrsTT1stDay + 169) +#define ActRemExaAnn (ActChgCrsTT1stDay + 170) +#define ActHidExaAnn (ActChgCrsTT1stDay + 171) +#define ActShoExaAnn (ActChgCrsTT1stDay + 172) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 792ab6d8f..6624b8cce 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -460,10 +460,14 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.140.1 (2019-09-09)" +#define Log_PLATFORM_VERSION "SWAD 18.141 (2019-09-09)" #define CSS_FILE "swad18.138.css" #define JS_FILE "swad18.130.2.js" /* + Version 18.141: Sep 09, 2019 New action to pause a match. (244312 lines) + 1 change necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1791','es','N','Pausar partida (como profesor)'); + Version 18.140.1: Sep 09, 2019 Fixed bug in matches. (244217 lines) Version 18.140: Sep 09, 2019 Font awesome used for matches. (244211 lines) Copy the following icons to public directory: diff --git a/swad_game.c b/swad_game.c index 67d0a66c3..919c8991c 100644 --- a/swad_game.c +++ b/swad_game.c @@ -85,8 +85,9 @@ const char *Gam_StrAnswerTypesDB[Gam_NUM_ANS_TYPES] = #define Gam_ICON_NEXT "⏩" // Alternatives: "⇥" #define Gam_ICON_ANSWERS "⏩" // Alternatives: "⇥" */ -#define Gam_ICON_CLOSE "fas fa-window-close" +#define Gam_ICON_CLOSE "fas fa-times" #define Gam_ICON_PLAY "fas fa-play" +#define Gam_ICON_PAUSE "fas fa-pause" #define Gam_ICON_STEM "fas fa-step-backward" #define Gam_ICON_START "fas fa-step-backward" #define Gam_ICON_PREVIOUS "fas fa-step-backward" @@ -228,6 +229,7 @@ static void Gam_ShowQuestionAndAnswersStd (struct Match *Match); static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, const char *Icon,const char *Txt); +static void Gam_PutBigButtonOff (const char *Icon); static void Gam_PutBigButtonClose (void); static void Gam_RemoveOldPlayers (void); @@ -3468,6 +3470,35 @@ static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, Gam_MAX_BYTES_TITLE); } +/*****************************************************************************/ +/********************* Pause current match (by a teacher) ********************/ +/*****************************************************************************/ + +void Gam_PauseMatchTch (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); + + /***** Update status *****/ + Match.Status.ShowingAnswers = false; // Don't show answers in any case + Match.Status.BeingPlayed = false; // Resume 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 current match status (current question, answers...) (by a teacher) **/ /*****************************************************************************/ @@ -3715,11 +3746,12 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) extern const char *Txt_Stem; extern const char *Txt_MATCH_Start; extern const char *Txt_Previous_QUESTION; + extern const char *Txt_Pause; + extern const char *Txt_Start; + extern const char *Txt_Resume; 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; char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]; unsigned PrvQstInd; // Previous question index unsigned NxtQstInd; // Next question index @@ -3780,6 +3812,18 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) fprintf (Gbl.F.Out,""); + /* Center button */ + fprintf (Gbl.F.Out,"
"); + if (Match->Status.BeingPlayed) + /* Put button to pause match */ + Gam_PutBigButton (ActPauMchTch, + Match->MchCod, + Gam_ICON_PAUSE,Txt_Pause); + else + /* Put inactive button to pause match */ + Gam_PutBigButtonOff (Gam_ICON_PAUSE); + fprintf (Gbl.F.Out,"
"); + /* Right button */ fprintf (Gbl.F.Out,"
"); if (Match->Status.QstInd >= Gam_AFTER_LAST_QUESTION) // Finished @@ -4079,7 +4123,7 @@ static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, is necessary in order to be fast and not lose clicks due to refresh */ fprintf (Gbl.F.Out,"
" - "" "" @@ -4093,6 +4137,17 @@ static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, Frm_EndForm (); } +static void Gam_PutBigButtonOff (const char *Icon) + { + /***** Put inactive icon *****/ + fprintf (Gbl.F.Out,"
" + "
" + "" + "
" + "
", + Icon); + } + static void Gam_PutBigButtonClose (void) { extern const char *Txt_Close; @@ -4102,7 +4157,7 @@ static void Gam_PutBigButtonClose (void) is necessary in order to be fast and not lose clicks due to refresh */ fprintf (Gbl.F.Out,"
" - "" "" diff --git a/swad_game.h b/swad_game.h index 550601a81..6a98fc568 100644 --- a/swad_game.h +++ b/swad_game.h @@ -121,6 +121,7 @@ void Gam_RequestNewMatchTch (void); void Gam_CreateNewMatchTch (void); void Gam_RequestStartResumeMatchTch (void); +void Gam_PauseMatchTch (void); void Gam_ResumeMatchTch (void); void Gam_PrevStatusMatchTch (void); void Gam_NextStatusMatchTch (void); diff --git a/swad_layout.c b/swad_layout.c index 5e9594348..2c019dbfd 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -697,6 +697,7 @@ static void Lay_WriteScriptInit (void) case ActNewMchTch: case ActResMchTch: case ActPrvMchTch: + case ActPauMchTch: case ActCurMchTch: case ActNxtMchTch: case ActPlyMchStd: @@ -818,6 +819,7 @@ static void Lay_WriteScriptParamsAJAX (void) case ActNewMchTch: case ActResMchTch: case ActPrvMchTch: + case ActPauMchTch: case ActCurMchTch: case ActNxtMchTch: fprintf (Gbl.F.Out,"var RefreshParamNxtActGam = \"act=%ld\";\n" diff --git a/swad_text.c b/swad_text.c index 019f9633b..2cd79d417 100644 --- a/swad_text.c +++ b/swad_text.c @@ -28650,6 +28650,27 @@ const char *Txt_Paste = "Colar"; #endif +const char *Txt_Pause = +#if L==1 // ca + "Fer una pausa"; +#elif L==2 // de + "Wiedergabe anzuhalten"; +#elif L==3 // en + "Pause"; +#elif L==4 // es + "Hacer una pausa"; +#elif L==5 // fr + "Faire une pause"; +#elif L==6 // gn + "Hacer una pausa"; // Okoteve traducción +#elif L==7 // it + "Mettere in pausa"; +#elif L==8 // pl + "Wstrzymać"; +#elif L==9 // pt + "Pausar"; +#endif + const char *Txt_PERCENT_of_users = #if L==1 // ca "% de usuarios"; // Necessita traduccio