From c91a0758e1872d33cc217f8a030ef0e78f13cfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 29 Sep 2019 21:33:27 +0200 Subject: [PATCH] Version19.20 --- swad_action.c | 78 ++++++++++++++++++++++++------------------------ swad_action.h | 44 ++++++++++++++------------- swad_changelog.h | 20 ++++++++++++- swad_config.h | 2 +- swad_game.c | 4 +-- swad_game.h | 2 +- swad_layout.c | 28 ++++++++--------- swad_match.c | 56 +++++++++++++++++----------------- swad_match.h | 18 +++++------ 9 files changed, 137 insertions(+), 115 deletions(-) diff --git a/swad_action.c b/swad_action.c index fa6b81bd5..f6464137a 100644 --- a/swad_action.c +++ b/swad_action.c @@ -608,31 +608,30 @@ Assessment: 460. ActSeeGam Show one game - 461. ActReqRemMchTch Request the removal of a match (by a teacher) - 462. ActRemMchTch Confirm the removal of a match (by a teacher) - 463. ActReqNewMchTch Put form to create a new match (by a teacher) - 464. ActNewMchTch Create a new match showing first question in a new browser tab (by a teacher) - 465. ActResMchTch Resume an unfinished match showing current question in a new browser tab (by a teacher) - 466. ActPauMchTch Pause current match (by a teacher) - 467. ActPlyMchTch Play/resume current match (by a teacher) - - 468. ActBckMchTch Go back when playing a match (by a teacher) - 469. ActFwdMchTch Go forward when playing a match (by a teacher) + 461. ActReqRemMch Request the removal of a match + 462. ActRemMch Confirm the removal of a match + 463. ActReqNewMch Put form to create a new match + 464. ActNewMch Create a new match showing first question in a new browser tab + 465. ActResMch Resume an unfinished match showing current question in a new browser tab + 466. ActBckMch Go back when playing a match + 467. ActPlyMch Play current match (go from pause to play) + 468. ActPauMch Pause current match (go from play to pause) + 469. ActFwdMch Go forward when playing a match + 471. ActChgVisResMchQst Change visibility of question results when playing a match 470. ActRefMchTch Refresh current question when playing a match (as teacher) - 471. ActChgVisResMchQst Change visibility of question results when playing a match - 472. ActChgVisResMchUsr Change visibility of match results (exam with all questions for a student) - - 473. ActPlyMchStd Show current question when playing a game (as student) - 474. ActRefMchStd Refresh current question when playing a game (as student) - 475. ActAnsMchQstStd Answer a match question (as student) + 473. ActJoiMch Show current question when playing a game (as student) + 474. ActAnsMchQstStd Answer a match question (as student) + 475. ActRefMchStd Refresh current question when playing a game (as student) 476. ActReqSeeMyMchRes Select range of dates to see my matches results 477. ActSeeMyMchRes Show my matches results 478. ActReqSeeUsrMchRes Select users and range of dates to see matches results + 479. ActSeeUsrMchRes Show matches results of several users 480. ActSeeOneMchResMe Show one match result of me as student 481. ActSeeOneMchResOth Show one match result of other user + 472. ActChgVisResMchUsr Change visibility of match results for students 482. ActFrmNewGam Form to create a new game 483. ActEdiOneGam Edit one game @@ -2158,29 +2157,30 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeGam */{1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL}, - /* ActReqRemMchTch */{1783,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RequestRemoveMatchTch ,NULL}, - /* ActRemMchTch */{1784,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RemoveMatchTch ,NULL}, - /* 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,Mch_CreateNewMatchTch ,Mch_RequestStartResumeMatchTch ,NULL}, - /* ActResMchTch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_GetMatchBeingPlayed ,Mch_RequestStartResumeMatchTch ,NULL}, - /* ActPauMchTch */{1791,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_PauseMatchTch ,NULL}, - /* ActPlyMchTch */{1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ResumeMatchTch ,NULL}, - /* ActBckMchTch */{1790,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_BackMatchTch ,NULL}, - /* ActFwdMchTch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ForwardMatchTch ,NULL}, - /* ActRefMchTch */{1788,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchTch ,NULL}, + /* ActReqRemMch */{1783,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RequestRemoveMatch ,NULL}, + /* ActRemMch */{1784,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RemoveMatch ,NULL}, + /* ActReqNewMch */{1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestNewMatch ,NULL}, + /* ActNewMch */{1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_CreateNewMatchTch ,Mch_ResumeMatch ,NULL}, + /* ActResMch */{1785,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_GetMatchBeingPlayed ,Mch_ResumeMatch ,NULL}, + /* ActBckMch */{1790,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_BackMatch ,NULL}, + /* ActPlyMch */{1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_PlayMatch ,NULL}, + /* ActPauMch */{1791,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_PauseMatch ,NULL}, + /* ActFwdMch */{1672,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ForwardMatch ,NULL}, /* ActChgVisResMchQst*/{1794,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ToggleVisibilResultsMchQst ,NULL}, - /* ActChgVisResMchUsr*/{1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL}, + /* ActRefMchTch */{1788,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchTch ,NULL}, - /* ActPlyMchStd */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_GetMatchBeingPlayed ,Mch_ShowMatchToMeAsStd ,NULL}, + /* ActJoiMch */{1780,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_GetMatchBeingPlayed ,Mch_JoinMatchAsStd ,NULL}, + /* ActAnsMchQstStd */{1651,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ReceiveQuestionAnswer ,NULL}, /* ActRefMchStd */{1782,-1,TabUnk,ActSeeAllGam ,0x008, 0, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_AJAX_RFRESH,Mch_GetMatchBeingPlayed ,Mch_RefreshMatchStd ,NULL}, - /* ActAnsMchQstStd */{1651,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_ReceiveQstAnsFromStd ,NULL}, /* ActReqSeeMyMchRes */{1795,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Mch_SelDatesToSeeMyMchResults ,NULL}, /* ActSeeMyMchRes */{1796,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowMyMchResults ,NULL}, /* ActSeeOneMchResMe */{1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowOneMchResult ,NULL}, + /* ActReqSeeUsrMchRes*/{1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Mch_SelUsrsToViewUsrsMchResults,NULL}, /* ActSeeUsrMchRes */{1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowUsrsMchResults ,NULL}, /* ActSeeOneMchResOth*/{1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ShowOneMchResult ,NULL}, + /* ActChgVisResMchUsr*/{1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisibilResultsMchUsr ,NULL}, /* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL}, /* ActEdiOneGam */{1653,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL}, @@ -4900,9 +4900,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActAddTstQstToGam, // #1667 ActUp_GamQst, // #1668 ActDwnGamQst, // #1669 - ActReqNewMchTch, // #1670 - ActNewMchTch, // #1671 - ActFwdMchTch, // #1672 + ActReqNewMch, // #1670 + ActNewMch, // #1671 + ActFwdMch, // #1672 -1, // #1673 (obsolete action) ActSeePrj, // #1674 ActFrmNewPrj, // #1675 @@ -5010,18 +5010,18 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActLckAllPrj, // #1777 ActUnlAllPrj, // #1778 -1, // #1779 (obsolete action) - ActPlyMchStd, // #1780 + ActJoiMch, // #1780 -1, // #1781 (obsolete action) ActRefMchStd, // #1782 - ActReqRemMchTch, // #1783 - ActRemMchTch, // #1784 - ActResMchTch, // #1785 + ActReqRemMch, // #1783 + ActRemMch, // #1784 + ActResMch, // #1785 -1, // #1786 (obsolete action) ActCreMyAcc, // #1787 ActRefMchTch, // #1788 - ActPlyMchTch, // #1789 - ActBckMchTch, // #1790 - ActPauMchTch, // #1791 + ActPlyMch, // #1789 + ActBckMch, // #1790 + ActPauMch, // #1791 -1, // #1792 (obsolete action) -1, // #1793 (obsolete action) ActChgVisResMchQst, // #1794 diff --git a/swad_action.h b/swad_action.h index 3c56c9331..ca433a423 100644 --- a/swad_action.h +++ b/swad_action.h @@ -607,28 +607,30 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeOneTstResOth (ActChgCrsTT1stDay + 115) #define ActSeeGam (ActChgCrsTT1stDay + 116) -#define ActReqRemMchTch (ActChgCrsTT1stDay + 117) -#define ActRemMchTch (ActChgCrsTT1stDay + 118) -#define ActReqNewMchTch (ActChgCrsTT1stDay + 119) -#define ActNewMchTch (ActChgCrsTT1stDay + 120) -#define ActResMchTch (ActChgCrsTT1stDay + 121) -#define ActPauMchTch (ActChgCrsTT1stDay + 122) -#define ActPlyMchTch (ActChgCrsTT1stDay + 123) -#define ActBckMchTch (ActChgCrsTT1stDay + 124) -#define ActFwdMchTch (ActChgCrsTT1stDay + 125) -#define ActRefMchTch (ActChgCrsTT1stDay + 126) -#define ActChgVisResMchQst (ActChgCrsTT1stDay + 127) -#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 128) -#define ActPlyMchStd (ActChgCrsTT1stDay + 129) -#define ActRefMchStd (ActChgCrsTT1stDay + 130) -#define ActAnsMchQstStd (ActChgCrsTT1stDay + 131) +#define ActReqRemMch (ActChgCrsTT1stDay + 117) +#define ActRemMch (ActChgCrsTT1stDay + 118) +#define ActReqNewMch (ActChgCrsTT1stDay + 119) +#define ActNewMch (ActChgCrsTT1stDay + 120) +#define ActResMch (ActChgCrsTT1stDay + 121) +#define ActBckMch (ActChgCrsTT1stDay + 122) +#define ActPlyMch (ActChgCrsTT1stDay + 123) +#define ActPauMch (ActChgCrsTT1stDay + 124) +#define ActFwdMch (ActChgCrsTT1stDay + 125) +#define ActChgVisResMchQst (ActChgCrsTT1stDay + 126) +#define ActRefMchTch (ActChgCrsTT1stDay + 127) -#define ActReqSeeMyMchRes (ActChgCrsTT1stDay + 132) -#define ActSeeMyMchRes (ActChgCrsTT1stDay + 133) -#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 134) -#define ActReqSeeUsrMchRes (ActChgCrsTT1stDay + 135) -#define ActSeeUsrMchRes (ActChgCrsTT1stDay + 136) -#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 137) +#define ActJoiMch (ActChgCrsTT1stDay + 128) +#define ActAnsMchQstStd (ActChgCrsTT1stDay + 129) +#define ActRefMchStd (ActChgCrsTT1stDay + 130) + +#define ActReqSeeMyMchRes (ActChgCrsTT1stDay + 131) +#define ActSeeMyMchRes (ActChgCrsTT1stDay + 132) +#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 133) + +#define ActReqSeeUsrMchRes (ActChgCrsTT1stDay + 134) +#define ActSeeUsrMchRes (ActChgCrsTT1stDay + 135) +#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 136) +#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 137) #define ActFrmNewGam (ActChgCrsTT1stDay + 138) #define ActEdiOneGam (ActChgCrsTT1stDay + 139) diff --git a/swad_changelog.h b/swad_changelog.h index 278ddff40..1ab9dd3eb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -471,10 +471,28 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.19.5 (2019-09-29)" +#define Log_PLATFORM_VERSION "SWAD 19.20 (2019-09-29)" #define CSS_FILE "swad19.15.css" #define JS_FILE "swad19.15.js" /* + Version 19.20: Sep 29, 2019 Code refactoring in games and matches. (246631 lines) + 14 changes necessary in database: +UPDATE actions SET Txt='Solicitar eliminación partida' WHERE ActCod='1783' AND Language='es'; +UPDATE actions SET Txt='Eliminar partida' WHERE ActCod='1784' AND Language='es'; +UPDATE actions SET Txt='Solicitar nueva partida' WHERE ActCod='1670' AND Language='es'; +UPDATE actions SET Txt='Crear nueva partida' WHERE ActCod='1671' AND Language='es'; +UPDATE actions SET Txt='Reanudar partida' WHERE ActCod='1785' AND Language='es'; +UPDATE actions SET Txt='Ir hacia atrás en partida' WHERE ActCod='1790' AND Language='es'; +UPDATE actions SET Txt='Jugar partida' WHERE ActCod='1789' AND Language='es'; +UPDATE actions SET Txt='Pausar partida' WHERE ActCod='1791' AND Language='es'; +UPDATE actions SET Txt='Ir hacia delante en partida' WHERE ActCod='1672' AND Language='es'; +UPDATE actions SET Txt='Cambiar presentación de resultados de pregunta en partida' WHERE ActCod='1794' AND Language='es'; +UPDATE actions SET Txt='Refrescar partida (como profesor)' WHERE ActCod='1788' AND Language='es'; +UPDATE actions SET Txt='Unirse a partida' WHERE ActCod='1780' AND Language='es'; +UPDATE actions SET Txt='Responder pregunta en partida' WHERE ActCod='1651' AND Language='es'; +UPDATE actions SET Txt='Refrescar partida (como estudiante)' WHERE ActCod='1782' AND Language='es'; + + Version 19.19.6: Sep 29, 2019 Changes in behaviour of match playing for students. (? lines) Version 19.19.5: Sep 29, 2019 Code refactoring in games. (246612 lines) Version 19.19.4: Sep 29, 2019 Code refactoring in games. (246638 lines) Version 19.19.3: Sep 29, 2019 Students will not see matches results for groups to which they don't belong. (246645 lines) diff --git a/swad_config.h b/swad_config.h index b2a5f9b25..1a4407d0f 100644 --- a/swad_config.h +++ b/swad_config.h @@ -503,7 +503,7 @@ #define Cfg_TIME_TO_REFRESH_TIMELINE ((time_t)( 2UL * 1000UL)) // Initial refresh period of social timeline in miliseconds // This delay is increased 1 second on each refresh -#define Cfg_SECONDS_TO_REFRESH_MATCH 2 // Refresh period of game being played in seconds +#define Cfg_SECONDS_TO_REFRESH_MATCH 1 // Refresh period of game being played in seconds #define Cfg_TIME_TO_REFRESH_MATCH ((time_t)(Cfg_SECONDS_TO_REFRESH_MATCH * 1000UL)) // Refresh period of game being played in miliseconds #define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 1UL * 1000UL)) // Refresh period of last clicks in miliseconds diff --git a/swad_game.c b/swad_game.c index 4be5beb0a..f8b20c0d3 100644 --- a/swad_game.c +++ b/swad_game.c @@ -2207,7 +2207,7 @@ void Gam_PutButtonNewMatch (long GamCod) extern const char *Txt_New_match; Gam_CurrentGamCod = GamCod; - Frm_StartFormAnchor (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID); + Frm_StartFormAnchor (ActReqNewMch,Mch_NEW_MATCH_SECTION_ID); Gam_PutParams (); Btn_PutConfirmButton (Txt_New_match); Frm_EndForm (); @@ -2217,7 +2217,7 @@ void Gam_PutButtonNewMatch (long GamCod) /************* Request the creation of a new match as a teacher **************/ /*****************************************************************************/ -void Gam_RequestNewMatchTch (void) +void Gam_RequestNewMatch (void) { long GamCod; diff --git a/swad_game.h b/swad_game.h index dc5dc63f5..dfc4ddd81 100644 --- a/swad_game.h +++ b/swad_game.h @@ -119,7 +119,7 @@ void Gam_MoveUpQst (void); void Gam_MoveDownQst (void); void Gam_PutButtonNewMatch (long GamCod); -void Gam_RequestNewMatchTch (void); +void Gam_RequestNewMatch (void); unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope); unsigned Gam_GetNumGames (Hie_Level_t Scope); diff --git a/swad_layout.c b/swad_layout.c index 662e46327..c590f82d6 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -695,16 +695,16 @@ static void Lay_WriteScriptInit (void) case ActRemSocComGbl: RefreshNewTimeline = true; break; - case ActPlyMchStd: + case ActJoiMch: case ActAnsMchQstStd: RefreshMatchStd = true; break; - case ActNewMchTch: - case ActResMchTch: - case ActPauMchTch: - case ActPlyMchTch: - case ActBckMchTch: - case ActFwdMchTch: + case ActNewMch: + case ActResMch: + case ActBckMch: + case ActPlyMch: + case ActPauMch: + case ActFwdMch: case ActChgVisResMchQst: RefreshMatchTch = true; break; @@ -823,7 +823,7 @@ static void Lay_WriteScriptParamsAJAX (void) Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); break; /* Parameters related with match refreshing (for students) */ - case ActPlyMchStd: + case ActJoiMch: case ActAnsMchQstStd: fprintf (Gbl.F.Out,"var RefreshParamNxtActMch = \"act=%ld\";\n" "var RefreshParamMchCod = \"MchCod=%ld\";\n", @@ -831,12 +831,12 @@ static void Lay_WriteScriptParamsAJAX (void) Gbl.Games.MchCodBeingPlayed); break; /* Parameters related with match refreshing (for teachers) */ - case ActNewMchTch: - case ActResMchTch: - case ActPauMchTch: - case ActPlyMchTch: - case ActBckMchTch: - case ActFwdMchTch: + case ActNewMch: + case ActResMch: + case ActBckMch: + case ActPlyMch: + case ActPauMch: + case ActFwdMch: case ActChgVisResMchQst: fprintf (Gbl.F.Out,"var RefreshParamNxtActMch = \"act=%ld\";\n" "var RefreshParamMchCod = \"MchCod=%ld\";\n", diff --git a/swad_match.c b/swad_match.c index 27293c80a..62e31ee3a 100644 --- a/swad_match.c +++ b/swad_match.c @@ -366,7 +366,7 @@ static void Mch_PutIconToPlayNewMatch (void) extern const char *Txt_New_match; /***** Put form to create a new match *****/ - Ico_PutContextualIconToAdd (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID,Gam_PutParams, + Ico_PutContextualIconToAdd (ActReqNewMch,Mch_NEW_MATCH_SECTION_ID,Gam_PutParams, Txt_New_match); } @@ -515,7 +515,7 @@ static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match) /***** Put icon to remove the match *****/ Mch_CurrentMchCod = Match->MchCod; - Frm_StartForm (ActReqRemMchTch); + Frm_StartForm (ActReqRemMch); Mch_PutParams (); Ico_PutIconRemove (); Frm_EndForm (); @@ -685,7 +685,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N { /* Icon to play as student */ Mch_CurrentMchCod = Match->MchCod; - Lay_PutContextualLinkOnlyIcon (ActPlyMchStd,NULL, + Lay_PutContextualLinkOnlyIcon (ActJoiMch,NULL, Mch_PutParams, Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" : "flag-checkered.svg", @@ -697,7 +697,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N case Rol_SYS_ADM: /* Icon to resume */ Mch_CurrentMchCod = Match->MchCod; - Lay_PutContextualLinkOnlyIcon (ActResMchTch,NULL, + Lay_PutContextualLinkOnlyIcon (ActResMch,NULL, Mch_PutParams, Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" : "flag-checkered.svg", @@ -887,7 +887,7 @@ static Mch_Showing_t Mch_GetShowingFromStr (const char *Str) /************** Request the removal of a match (game instance) ***************/ /*****************************************************************************/ -void Mch_RequestRemoveMatchTch (void) +void Mch_RequestRemoveMatch (void) { extern const char *Txt_Do_you_really_want_to_remove_the_match_X; extern const char *Txt_Remove_match; @@ -903,7 +903,7 @@ void Mch_RequestRemoveMatchTch (void) /***** Show question and button to remove question *****/ Mch_CurrentMchCod = Match.MchCod; - Ale_ShowAlertAndButton (ActRemMchTch,NULL,NULL,Mch_PutParams, + Ale_ShowAlertAndButton (ActRemMch,NULL,NULL,Mch_PutParams, Btn_REMOVE_BUTTON,Txt_Remove_match, Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_match_X, Match.Title); @@ -919,7 +919,7 @@ void Mch_RequestRemoveMatchTch (void) /********************** Remove a match (game instance) ***********************/ /*****************************************************************************/ -void Mch_RemoveMatchTch (void) +void Mch_RemoveMatch (void) { extern const char *Txt_Match_X_removed; struct Match Match; @@ -1114,7 +1114,7 @@ static void Mch_PutFormNewMatch (struct Game *Game) Lay_StartSection (Mch_NEW_MATCH_SECTION_ID); /***** Start form *****/ - Frm_StartForm (ActNewMchTch); + Frm_StartForm (ActNewMch); Gam_PutParamGameCod (Game->GamCod); Gam_PutParamQstInd (0); // Start by first question in game @@ -1252,7 +1252,7 @@ void Mch_CreateNewMatchTch (void) /******* Show button to actually start / resume a match (by a teacher) *******/ /*****************************************************************************/ -void Mch_RequestStartResumeMatchTch (void) +void Mch_ResumeMatch (void) { struct Match Match; @@ -1666,7 +1666,7 @@ static void Mch_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, /********************* Pause current match (by a teacher) ********************/ /*****************************************************************************/ -void Mch_PauseMatchTch (void) +void Mch_PauseMatch (void) { struct Match Match; @@ -1694,7 +1694,7 @@ void Mch_PauseMatchTch (void) /** Show current match status (current question, answers...) (by a teacher) **/ /*****************************************************************************/ -void Mch_ResumeMatchTch (void) +void Mch_PlayMatch (void) { struct Match Match; @@ -1758,7 +1758,7 @@ void Mch_ToggleVisibilResultsMchQst (void) /************* Show previous question in a match (by a teacher) **************/ /*****************************************************************************/ -void Mch_BackMatchTch (void) +void Mch_BackMatch (void) { struct Match Match; @@ -1786,7 +1786,7 @@ void Mch_BackMatchTch (void) /*************** Show next question in a match (by a teacher) ****************/ /*****************************************************************************/ -void Mch_ForwardMatchTch (void) +void Mch_ForwardMatch (void) { struct Match Match; @@ -2126,21 +2126,23 @@ static void Mch_ShowRightColumnStd (struct Match *Match) Mch_ShowMatchTitle (Match); /***** Bottom row *****/ - if (Match->Status.QstInd < Mch_AFTER_LAST_QUESTION) // Unfinished + if (Match->Status.Playing) { - fprintf (Gbl.F.Out,"
"); + if (Match->Status.QstInd < Mch_AFTER_LAST_QUESTION) // Unfinished + { + fprintf (Gbl.F.Out,"
"); - /***** Update players ******/ - Mch_RegisterMeAsPlayerInMatch (Match->MchCod); + /***** Update players ******/ + Mch_RegisterMeAsPlayerInMatch (Match->MchCod); - if (Match->Status.Playing) /* Show current question and possible answers */ Mch_ShowQuestionAndAnswersStd (Match); - else // Not being played - Mch_ShowWaitImage (Txt_Please_wait_); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + } } + else // Not being played + Mch_ShowWaitImage (Txt_Please_wait_); /***** End right container *****/ fprintf (Gbl.F.Out,""); @@ -2188,7 +2190,7 @@ static void Mch_PutMatchControlButtons (struct Match *Match) Mch_PutBigButtonClose (); else /* Put button to go back */ - Mch_PutBigButton (ActBckMchTch,Match->MchCod, + Mch_PutBigButton (ActBckMch,Match->MchCod, Mch_ICON_PREVIOUS,Txt_Go_back); fprintf (Gbl.F.Out,""); @@ -2196,14 +2198,14 @@ static void Mch_PutMatchControlButtons (struct Match *Match) fprintf (Gbl.F.Out,"
"); if (Match->Status.Playing) // Being played /* Put button to pause match */ - Mch_PutBigButton (ActPauMchTch, + Mch_PutBigButton (ActPauMch, Match->MchCod, Mch_ICON_PAUSE,Txt_Pause); else // Paused { if (Match->Status.QstInd < Mch_AFTER_LAST_QUESTION) // Not finished /* Put button to play match */ - Mch_PutBigButton (ActPlyMchTch, + Mch_PutBigButton (ActPlyMch, Match->MchCod, Mch_ICON_PLAY,Match->Status.QstInd == 0 ? Txt_Start : Txt_Resume); @@ -2220,7 +2222,7 @@ static void Mch_PutMatchControlButtons (struct Match *Match) Mch_PutBigButtonClose (); else /* Put button to show answers */ - Mch_PutBigButton (ActFwdMchTch,Match->MchCod, + Mch_PutBigButton (ActFwdMch,Match->MchCod, Mch_ICON_NEXT,Txt_Go_forward); fprintf (Gbl.F.Out,"
"); @@ -2635,7 +2637,7 @@ void Mch_GetMatchBeingPlayed (void) /********* Show game being played to me as student in a new window ***********/ /*****************************************************************************/ -void Mch_ShowMatchToMeAsStd (void) +void Mch_JoinMatchAsStd (void) { struct Match Match; @@ -2751,7 +2753,7 @@ void Mch_GetQstAnsFromDB (long MchCod,long UsrCod,unsigned QstInd, /********* Receive question answer from student when playing a match *********/ /*****************************************************************************/ -void Mch_ReceiveQstAnsFromStd (void) +void Mch_ReceiveQuestionAnswer (void) { struct Match Match; unsigned QstInd; diff --git a/swad_match.h b/swad_match.h index 473d9ee8c..13a96a416 100644 --- a/swad_match.h +++ b/swad_match.h @@ -82,8 +82,8 @@ void Mch_GetDataOfMatchByCod (struct Match *Match); void Mch_ToggleVisibilResultsMchUsr (void); -void Mch_RequestRemoveMatchTch (void); -void Mch_RemoveMatchTch (void); +void Mch_RequestRemoveMatch (void); +void Mch_RemoveMatch (void); void Mch_RemoveMatchesInGameFromAllTables (long GamCod); void Mch_RemoveMatchInCourseFromAllTables (long CrsCod); @@ -92,31 +92,31 @@ void Mch_PutParamMchCod (long MchCod); long Mch_GetParamMchCod (void); void Mch_CreateNewMatchTch (void); -void Mch_RequestStartResumeMatchTch (void); +void Mch_ResumeMatch (void); void Mch_GetIndexes (long MchCod,unsigned QstInd, unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]); void Mch_RemoveGroup (long GrpCod); void Mch_RemoveGroupsOfType (long GrpTypCod); -void Mch_PauseMatchTch (void); -void Mch_ResumeMatchTch (void); +void Mch_PauseMatch (void); +void Mch_PlayMatch (void); void Mch_ToggleVisibilResultsMchQst (void); -void Mch_BackMatchTch (void); -void Mch_ForwardMatchTch (void); +void Mch_BackMatch (void); +void Mch_ForwardMatch (void); unsigned Mch_GetNumMchsInGame (long GamCod); bool Mch_CheckIfICanPlayThisMatchBasedOnGrps (long MchCod); void Mch_GetMatchBeingPlayed (void); -void Mch_ShowMatchToMeAsStd (void); +void Mch_JoinMatchAsStd (void); void Mch_RefreshMatchTch (void); void Mch_RefreshMatchStd (void); void Mch_GetQstAnsFromDB (long MchCod,long UsrCod,unsigned QstInd, struct Mch_UsrAnswer *UsrAnswer); -void Mch_ReceiveQstAnsFromStd (void); +void Mch_ReceiveQuestionAnswer (void); void Mch_GetAndDrawBarNumUsrsWhoHaveChosenAns (long MchCod,unsigned QstInd,unsigned AnsInd, unsigned NumAnswerersQst,bool Correct);