diff --git a/css/swad23.54.css b/css/swad23.55.css similarity index 99% rename from css/swad23.54.css rename to css/swad23.55.css index c075eb0c..76d0cfdd 100644 --- a/css/swad23.54.css +++ b/css/swad23.55.css @@ -1779,7 +1779,7 @@ a:hover img.CENTER_PHOTO_SHOW .PRG_DATE { box-sizing:border-box; - max-width:80px; + max-width:72px; overflow:hidden; text-overflow:ellipsis; } @@ -1798,7 +1798,7 @@ a:hover img.CENTER_PHOTO_SHOW .PRG_DATE { box-sizing:border-box; - max-width:132px; + max-width:120px; overflow:hidden; text-overflow:ellipsis; } @@ -1813,7 +1813,7 @@ a:hover img.CENTER_PHOTO_SHOW .PRG_DATE { box-sizing:border-box; - max-width:132px; + max-width:120px; overflow:hidden; text-overflow:ellipsis; } @@ -2216,7 +2216,6 @@ a:hover img.CENTER_PHOTO_SHOW box-sizing:border-box; width:100%; text-align:center; - vertical-align:middle; } .FRAME @@ -3258,21 +3257,21 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .REC_C1_BOT { box-sizing:border-box; - width:170px; - max-width:170px; + width:150px; + max-width:150px; overflow:hidden; } .REC_C2_BOT { box-sizing:border-box; - width:366px; - max-width:366px; + width:386px; + max-width:386px; overflow:hidden; } .REC_C2_BOT_INPUT { box-sizing:border-box; - width:362px; + width:382px; } } @@ -3427,48 +3426,48 @@ legend {font-size:12pt;} .DATE_RED_PURPLE, .DATE_RED_BLUE, .DATE_RED_YELLOW, -.DATE_RED_PINK {color:#660000; font-size:12pt;} -.DATE_RED_DARK {color:#f98a8a; font-size:12pt;} +.DATE_RED_PINK {color:#660000; font-size:10pt;} +.DATE_RED_DARK {color:#f98a8a; font-size:10pt;} .DATE_RED_LIGHT_WHITE, .DATE_RED_LIGHT_GREY, .DATE_RED_LIGHT_PURPLE, .DATE_RED_LIGHT_BLUE, .DATE_RED_LIGHT_YELLOW, -.DATE_RED_LIGHT_PINK {color:rgba(102, 0, 0,0.3); font-size:12pt;} -.DATE_RED_LIGHT_DARK {color:rgba(249,138,138,0.3); font-size:12pt;} +.DATE_RED_LIGHT_PINK {color:rgba(102, 0, 0,0.3); font-size:10pt;} +.DATE_RED_LIGHT_DARK {color:rgba(249,138,138,0.3); font-size:10pt;} .DATE_GREEN_WHITE, .DATE_GREEN_GREY, .DATE_GREEN_PURPLE, .DATE_GREEN_BLUE, .DATE_GREEN_YELLOW, -.DATE_GREEN_PINK {color:#246600; font-size:12pt;} -.DATE_GREEN_DARK {color:#80c040; font-size:12pt;} +.DATE_GREEN_PINK {color:#246600; font-size:10pt;} +.DATE_GREEN_DARK {color:#80c040; font-size:10pt;} .DATE_GREEN_LIGHT_WHITE, .DATE_GREEN_LIGHT_GREY, .DATE_GREEN_LIGHT_PURPLE, .DATE_GREEN_LIGHT_BLUE, .DATE_GREEN_LIGHT_YELLOW, -.DATE_GREEN_LIGHT_PINK {color:rgba( 36,100, 0,0.3); font-size:12pt;} -.DATE_GREEN_LIGHT_DARK {color:rgba(128,196, 64,0.3); font-size:12pt;} +.DATE_GREEN_LIGHT_PINK {color:rgba( 36,100, 0,0.3); font-size:10pt;} +.DATE_GREEN_LIGHT_DARK {color:rgba(128,196, 64,0.3); font-size:10pt;} .DATE_BLUE_WHITE, .DATE_BLUE_GREY, .DATE_BLUE_PURPLE, .DATE_BLUE_BLUE, .DATE_BLUE_YELLOW, -.DATE_BLUE_PINK {color:#4d88a1; font-size:12pt;} -.DATE_BLUE_DARK {color:#afc4cc; font-size:12pt;} +.DATE_BLUE_PINK {color:#4d88a1; font-size:10pt;} +.DATE_BLUE_DARK {color:#afc4cc; font-size:10pt;} .DATE_BLUE_LIGHT_WHITE, .DATE_BLUE_LIGHT_GREY, .DATE_BLUE_LIGHT_PURPLE, .DATE_BLUE_LIGHT_BLUE, .DATE_BLUE_LIGHT_YELLOW, -.DATE_BLUE_LIGHT_PINK {color:rgba( 77,136,161,0.3); font-size:12pt;} -.DATE_BLUE_LIGHT_DARK {color:rgba(175,196,204,0.3); font-size:12pt;} +.DATE_BLUE_LIGHT_PINK {color:rgba( 77,136,161,0.3); font-size:10pt;} +.DATE_BLUE_LIGHT_DARK {color:rgba(175,196,204,0.3); font-size:10pt;} .ASG_LST_DATE_GREEN_WHITE, .ASG_LST_DATE_GREEN_GREY, diff --git a/swad_HTML.c b/swad_HTML.c index 67901c01..1908aa2e 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -2073,7 +2073,7 @@ void HTM_TD_Txt_Right (const char *Txt) void HTM_TD_TxtColon (const char *Txt) { - HTM_TD_Begin ("class=\"REC_C1_BOT RT FORM_IN_%s\"",The_GetSuffix ()); + HTM_TD_Begin ("class=\"RT FORM_IN_%s\"",The_GetSuffix ()); HTM_TxtColon (Txt); HTM_TD_End (); } diff --git a/swad_action_list.c b/swad_action_list.c index 63077c30..61a9ec24 100644 --- a/swad_action_list.c +++ b/swad_action_list.c @@ -762,7 +762,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] = [ActInvSetQst ] = {1910,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_InvalidateQst ,NULL}, [ActReqNewExaSes ] = {1852,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReqCreatOrEditSes ,NULL}, - [ActEdiOneExaSes ] = {1902,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReqCreatOrEditSes ,NULL}, + [ActReqChgExaSes ] = {1902,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReqCreatOrEditSes ,NULL}, [ActNewExaSes ] = {1853,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReceiveFormSession ,NULL}, [ActChgExaSes ] = {1903,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReceiveFormSession ,NULL}, [ActReqRemExaSes ] = {1850,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ReqRemSession ,NULL}, @@ -789,12 +789,12 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] = [ActSeeOneGam ] = {1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL}, + [ActReqNewMch ] = {1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ReqCreatOrEditMatch ,NULL}, + [ActReqChgMch ] = {1913,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ReqCreatOrEditMatch ,NULL}, + [ActNewMch ] = {1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_CreateNewMatch ,Mch_ResumeMatch ,NULL}, + [ActChgMch ] = {1914,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ChangeMatch ,NULL}, [ActReqRemMch ] = {1783,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ReqRemMatch ,NULL}, [ActRemMch ] = {1784,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_RemoveMatch ,NULL}, - [ActEdiMch ] = {1913,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_EditMatch ,NULL}, - [ActChgMch ] = {1914,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ChangeMatch ,NULL}, - [ActReqNewMch ] = {1670,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReqNewMatch ,NULL}, - [ActNewMch ] = {1671,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,Mch_CreateNewMatch ,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}, [ActPlyPauMch ] = {1789,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_2ND_TAB,Mch_GetMatchBeingPlayed ,Mch_PlayPauseMatch ,NULL}, @@ -3797,7 +3797,7 @@ Act_Action_t ActLst_FromActCodToAction[1 + ActLst_MAX_ACTION_COD] = // Do not re ActChgNumQstExaSet, // #1899 ActHidExaSes, // #1900 ActUnhExaSes, // #1901 - ActEdiOneExaSes, // #1902 + ActReqChgExaSes, // #1902 ActChgExaSes, // #1903 ActSeeExaPrn, // #1904 -1, // #1905 (obsolete action) @@ -3808,7 +3808,7 @@ Act_Action_t ActLst_FromActCodToAction[1 + ActLst_MAX_ACTION_COD] = // Do not re ActInvSetQst, // #1910 ActChgRooMAC, // #1911 ActLstOneGam, // #1912 - ActEdiMch, // #1913 + ActReqChgMch, // #1913 ActChgMch, // #1914 -1, // #1915 (obsolete action) -1, // #1916 (obsolete action) diff --git a/swad_action_list.h b/swad_action_list.h index ef5ed6ea..2b009592 100644 --- a/swad_action_list.h +++ b/swad_action_list.h @@ -687,7 +687,7 @@ #define ActInvSetQst (ActChgCrsTT1stDay + 153) #define ActReqNewExaSes (ActChgCrsTT1stDay + 154) -#define ActEdiOneExaSes (ActChgCrsTT1stDay + 155) +#define ActReqChgExaSes (ActChgCrsTT1stDay + 155) #define ActNewExaSes (ActChgCrsTT1stDay + 156) #define ActChgExaSes (ActChgCrsTT1stDay + 157) #define ActReqRemExaSes (ActChgCrsTT1stDay + 158) @@ -711,12 +711,12 @@ #define ActChgVisExaRes (ActChgCrsTT1stDay + 174) #define ActSeeOneGam (ActChgCrsTT1stDay + 175) -#define ActReqRemMch (ActChgCrsTT1stDay + 176) -#define ActRemMch (ActChgCrsTT1stDay + 177) -#define ActEdiMch (ActChgCrsTT1stDay + 178) +#define ActReqNewMch (ActChgCrsTT1stDay + 176) +#define ActReqChgMch (ActChgCrsTT1stDay + 177) +#define ActNewMch (ActChgCrsTT1stDay + 178) #define ActChgMch (ActChgCrsTT1stDay + 179) -#define ActReqNewMch (ActChgCrsTT1stDay + 180) -#define ActNewMch (ActChgCrsTT1stDay + 181) +#define ActReqRemMch (ActChgCrsTT1stDay + 180) +#define ActRemMch (ActChgCrsTT1stDay + 181) #define ActResMch (ActChgCrsTT1stDay + 182) #define ActBckMch (ActChgCrsTT1stDay + 183) #define ActPlyPauMch (ActChgCrsTT1stDay + 184) diff --git a/swad_changelog.h b/swad_changelog.h index 0ea86d65..fca2409f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -633,10 +633,11 @@ Me sale este error, no s "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') */ -#define Log_PLATFORM_VERSION "SWAD 23.54 (2023-12-20)" -#define CSS_FILE "swad23.54.css" +#define Log_PLATFORM_VERSION "SWAD 23.55 (2024-01-16)" +#define CSS_FILE "swad23.55.css" #define JS_FILE "swad23.53.6.js" /* + Version 23.55: Jan 16, 2024 Responsive design in exams. Changes in exam sessions and matches. (335819 lines) Version 23.54: Dec 20, 2023 Responsive design in games and matches. (335906 lines) Version 23.53.7: Dec 20, 2023 Layout changes in hierarchy edition. (335883 lines) Version 23.53.6: Dec 19, 2023 Responsive design in questions. (335874 lines) diff --git a/swad_date.c b/swad_date.c index 2a56bab0..6b301011 100644 --- a/swad_date.c +++ b/swad_date.c @@ -1793,7 +1793,7 @@ void Dat_WriteLocalDateHMSFromUTC (const char *Id,time_t TimeUTC, static const char *SeparatorStr[Dat_NUM_SEPARATORS] = { [Dat_SEPARATOR_NONE ] = "", - [Dat_SEPARATOR_COMMA] = ", ", + [Dat_SEPARATOR_COMMA] = ", ", [Dat_SEPARATOR_BREAK] = "
", }; diff --git a/swad_exam.c b/swad_exam.c index daf6d8f9..13ae8b6a 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -239,7 +239,7 @@ void Exa_ListAllExams (struct Exa_Exams *Exams) Exams->CurrentPage = (unsigned) Pagination.CurrentPage; /***** Begin box *****/ - Box_BoxBegin ("100%",Txt_Exams, + Box_BoxBegin (NULL,Txt_Exams, Exa_PutIconsListExams,Exams, Hlp_ASSESSMENT_Exams,Box_NOT_CLOSABLE); @@ -250,7 +250,7 @@ void Exa_ListAllExams (struct Exa_Exams *Exams) if (Exams->Num) { /***** Table head *****/ - HTM_TABLE_BeginWideMarginPadding (5); + HTM_TABLE_Begin ("TBL_SCROLL"); HTM_TR_Begin (NULL); HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons @@ -406,23 +406,20 @@ void Exa_SeeOneExam (void) Exa_GetExamDataByCod (&Exams.Exam); /***** Show exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ /******************************* Show one exam *******************************/ /*****************************************************************************/ -void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, - Frm_PutForm_t PutFormSession) +void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,Frm_PutForm_t PutFormSession) { - Exa_ShowOnlyOneExamBegin (Exams,Session,PutFormSession); + Exa_ShowOnlyOneExamBegin (Exams,PutFormSession); Exa_ShowOnlyOneExamEnd (); } void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, Frm_PutForm_t PutFormSession) { extern const char *Hlp_ASSESSMENT_Exams; @@ -439,7 +436,7 @@ void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, true); // Show only this exam /***** List sessions *****/ - ExaSes_ListSessions (Exams,Session,PutFormSession); + ExaSes_ListSessions (Exams,PutFormSession); } void Exa_ShowOnlyOneExamEnd (void) @@ -472,7 +469,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,bool ShowOnlyThisExam) /***** Begin box and table *****/ if (ShowOnlyThisExam) - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_Begin ("TBL_SCROLL"); /***** Begin first row of this exam *****/ HTM_TR_Begin (NULL); diff --git a/swad_exam.h b/swad_exam.h index 56be42aa..48d7547e 100644 --- a/swad_exam.h +++ b/swad_exam.h @@ -42,11 +42,8 @@ void Exa_ListAllExams (struct Exa_Exams *Exams); bool Exa_CheckIfICanEditExams (void); void Exa_SeeOneExam (void); -void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, - Frm_PutForm_t PutFormSession); +void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,Frm_PutForm_t PutFormSession); void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, Frm_PutForm_t PutFormSession); void Exa_ShowOnlyOneExamEnd (void); diff --git a/swad_exam_result.c b/swad_exam_result.c index 8ff34387..103cf5bf 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -79,7 +79,7 @@ struct ExaRes_ICanView static void ExaRes_ListMyResultsInCrs (struct Exa_Exams *Exams); static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams); -static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod); +static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams); static void ExaRes_PutFormToSelUsrsToViewResults (__attribute__((unused)) void *Args); static void ExaRes_ShowAllResultsInSelectedExams (void *Exams); @@ -186,13 +186,11 @@ void ExaRes_ShowMyResultsInExa (void) { extern const char *Txt_Results_of_exam_X; struct Exa_Exams Exams; - struct ExaSes_Session Session; char *Title; /***** Reset exams context *****/ Exa_ResetExams (&Exams); Exa_ResetExam (&Exams.Exam); - ExaSes_ResetSession (&Session); /***** Get parameters *****/ Exa_GetPars (&Exams,Exa_CHECK_EXA_COD); @@ -201,7 +199,7 @@ void ExaRes_ShowMyResultsInExa (void) Exa_GetExamDataByCod (&Exams.Exam); /***** Exam begin *****/ - Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExamBegin (&Exams,Frm_DONT_PUT_FORM); /***** List my sessions results in exam *****/ if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0) @@ -243,33 +241,33 @@ void ExaRes_ShowMyResultsInSes (void) /***** Get parameters *****/ Exa_GetPars (&Exams,Exa_CHECK_EXA_COD); - Session.SesCod = ParCod_GetAndCheckPar (ParCod_Ses); + Exams.SesCod = Session.SesCod = ParCod_GetAndCheckPar (ParCod_Ses); Exa_GetExamDataByCod (&Exams.Exam); ExaSes_GetSessionDataByCod (&Session); /***** Exam begin *****/ - Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExamBegin (&Exams,Frm_DONT_PUT_FORM); /***** List my sessions results in session *****/ if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0) Err_NotEnoughMemoryExit (); ExaRes_ShowResultsBegin (&Exams,Title,false); // Do not list exams to select free (Title); - ExaRes_ListMyResultsInSes (&Exams,Session.SesCod); + ExaRes_ListMyResultsInSes (&Exams); ExaRes_ShowResultsEnd (); /***** Exam end *****/ Exa_ShowOnlyOneExamEnd (); } -static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod) +static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams) { /***** Table header *****/ ExaRes_ShowHeaderResults (Usr_ME); /***** List my sessions results in exam *****/ TstCfg_GetConfig (); // Get feedback type - ExaRes_ShowResults (Exams,Usr_ME,SesCod,-1L,NULL); + ExaRes_ShowResults (Exams,Usr_ME,Exams->SesCod,-1L,NULL); } /*****************************************************************************/ @@ -391,7 +389,7 @@ void ExaRes_ShowAllResultsInExa (void) Exa_GetExamDataByCod (&Exams.Exam); /***** Exam begin *****/ - Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExamBegin (&Exams,Frm_DONT_PUT_FORM); /***** List sessions results in exam *****/ if (asprintf (&Title,Txt_Results_of_exam_X,Exams.Exam.Title) < 0) @@ -455,14 +453,14 @@ void ExaRes_ShowAllResultsInSes (void) /***** Get parameters *****/ Exa_GetPars (&Exams,Exa_CHECK_EXA_COD); - Session.SesCod = ParCod_GetAndCheckPar (ParCod_Ses); + Exams.SesCod = Session.SesCod = ParCod_GetAndCheckPar (ParCod_Ses); /***** Get exam data and session *****/ Exa_GetExamDataByCod (&Exams.Exam); ExaSes_GetSessionDataByCod (&Session); /***** Exam begin *****/ - Exa_ShowOnlyOneExamBegin (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExamBegin (&Exams,Frm_DONT_PUT_FORM); /***** List sessions results in session *****/ if (asprintf (&Title,Txt_Results_of_session_X,Session.Title) < 0) diff --git a/swad_exam_session.c b/swad_exam_session.c index 24e67cc3..32f05ab4 100644 --- a/swad_exam_session.c +++ b/swad_exam_session.c @@ -69,7 +69,7 @@ static void ExaSes_PutIconsInListOfSessions (void *Exams); static void ExaSes_PutIconToCreateNewSession (struct Exa_Exams *Exams); static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, - long SesCodToBeEdited, + Frm_PutForm_t PutFormSession, unsigned NumSessions, MYSQL_RES *mysql_res); static void ExaSes_ListOneOrMoreSessionsHeading (bool ICanEditSessions); @@ -136,7 +136,6 @@ void ExaSes_ResetSession (struct ExaSes_Session *Session) /*****************************************************************************/ void ExaSes_ListSessions (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, Frm_PutForm_t PutFormSession) { extern const char *Hlp_ASSESSMENT_Exams_sessions; @@ -144,61 +143,28 @@ void ExaSes_ListSessions (struct Exa_Exams *Exams, MYSQL_RES *mysql_res; unsigned NumSessions; + /***** Get data of sessions from database *****/ + NumSessions = Exa_DB_GetSessions (&mysql_res,Exams->Exam.ExaCod); + /***** Begin box *****/ - Box_BoxBegin ("100%",Txt_Sessions, + Box_BoxBegin (NULL,Txt_Sessions, ExaSes_PutIconsInListOfSessions,Exams, Hlp_ASSESSMENT_Exams_sessions,Box_NOT_CLOSABLE); - /***** Select whether show only my groups or all groups *****/ - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_NET: - case Rol_TCH: - case Rol_SYS_ADM: - if (Gbl.Crs.Grps.NumGrps) - { - Set_BeginSettingsHead (); + /***** Select whether show only my groups or all groups *****/ + if (Gbl.Crs.Grps.NumGrps && ExaSes_CheckIfICanEditSessions ()) + { + Set_BeginSettingsHead (); Grp_ShowFormToSelWhichGrps (ActSeeOneExa,Exa_PutPars,Exams); - Set_EndSettingsHead (); - } - break; - default: - break; - } + Set_EndSettingsHead (); + } - /***** Show the table with the sessions *****/ - if ((NumSessions = Exa_DB_GetSessions (&mysql_res,Exams->Exam.ExaCod))) - ExaSes_ListOneOrMoreSessions (Exams, - PutFormSession && - Session->SesCod > 0 ? Session->SesCod : - -1L, - NumSessions,mysql_res); + /***** Show the table with the sessions *****/ + ExaSes_ListOneOrMoreSessions (Exams,PutFormSession, + NumSessions,mysql_res); - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - - /***** Put button to create a new exam session in this exam *****/ - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_NET: - case Rol_TCH: - case Rol_SYS_ADM: - if (PutFormSession == Frm_PUT_FORM && Session->SesCod <= 0) - { - /* Reset session */ - ExaSes_ResetSession (Session); - Session->ExaCod = Exams->Exam.ExaCod; - Session->TimeUTC[Dat_STR_TIME] = Dat_GetStartExecutionTimeUTC (); // Now - Session->TimeUTC[Dat_END_TIME] = Session->TimeUTC[Dat_STR_TIME] + (1 * 60 * 60); // Now + 1 hour - Str_Copy (Session->Title,Exams->Exam.Title,sizeof (Session->Title) - 1); - - /* Put form to create new session */ - ExaSes_PutFormSession (Session); // Form to create session - } - break; - default: - break; - } + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); /***** End box *****/ Box_BoxEnd (); @@ -264,28 +230,28 @@ static void ExaSes_PutIconToCreateNewSession (struct Exa_Exams *Exams) /*****************************************************************************/ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, - long SesCodToBeEdited, + Frm_PutForm_t PutFormSession, unsigned NumSessions, MYSQL_RES *mysql_res) { unsigned NumSession; unsigned UniqueId; - char *Anchor; struct ExaSes_Session Session; + char *Anchor; bool ICanEditSessions = ExaSes_CheckIfICanEditSessions (); - - /***** Trivial check *****/ - if (!NumSessions) - return; + long SesCodToBeEdited = PutFormSession == Frm_PUT_FORM && + Exams->SesCod > 0 ? Exams->SesCod : + -1L; /***** Reset session *****/ ExaSes_ResetSession (&Session); /***** Begin table with sessions *****/ - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_Begin ("TBL_SCROLL"); /***** Write the heading *****/ - ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions); + if (NumSessions) + ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions); /***** Write rows *****/ for (NumSession = 0, UniqueId = 1, The_ResetRowColor (); @@ -301,16 +267,13 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, if (asprintf (&Anchor,"evt_%ld_%ld",Exams->Exam.ExaCod,Session.SesCod) < 0) Err_NotEnoughMemoryExit (); - /***** Begin row for this exam session ****/ + /***** First row for this session ****/ HTM_TR_Begin (NULL); /* Icons */ if (ICanEditSessions) ExaSes_ListOneOrMoreSessionsIcons (Exams,&Session,Anchor); - /* Session participant */ - ExaSes_ListOneOrMoreSessionsAuthor (&Session); - /* Start/end date/time */ ExaSes_ListOneOrMoreSessionsTimes (&Session,UniqueId); @@ -320,16 +283,21 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, /* Session result visible? */ ExaSes_ListOneOrMoreSessionsResult (Exams,&Session); - /***** End row for this session ****/ HTM_TR_End (); - /***** For to edit this session ****/ - if (Session.SesCod == SesCodToBeEdited) + /***** Second row: session author */ + HTM_TR_Begin (NULL); + ExaSes_ListOneOrMoreSessionsAuthor (&Session); + HTM_TR_End (); + + /***** Third row: form to edit this session ****/ + if (ICanEditSessions && PutFormSession == Frm_PUT_FORM && // Editing... + Session.SesCod == SesCodToBeEdited) // ...this session { HTM_TR_Begin (NULL); - HTM_TD_Begin ("colspan=\"6\" class=\"CT %s\"", + HTM_TD_Begin ("colspan=\"5\" class=\"LT %s\"", The_GetColorRows ()); - ExaSes_PutFormSession (&Session); // Form to edit existing session + ExaSes_PutFormSession (&Session); // Form to edit this session HTM_TD_End (); HTM_TR_End (); } @@ -339,6 +307,25 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, } } + /***** Put form to create a new exam session in this exam *****/ + if (ICanEditSessions && PutFormSession == Frm_PUT_FORM && + SesCodToBeEdited <= 0) + { + /* Reset session */ + ExaSes_ResetSession (&Session); + Session.ExaCod = Exams->Exam.ExaCod; + Session.TimeUTC[Dat_STR_TIME] = Dat_GetStartExecutionTimeUTC (); // Now + Session.TimeUTC[Dat_END_TIME] = Session.TimeUTC[Dat_STR_TIME] + (1 * 60 * 60); // Now + 1 hour + Str_Copy (Session.Title,Exams->Exam.Title,sizeof (Session.Title) - 1); + + /* Put form to create new session */ + HTM_TR_Begin (NULL); + HTM_TD_Begin ("colspan=\"5\" class=\"LT %s\"",The_GetColorRows ()); + ExaSes_PutFormSession (&Session); // Form to create session + HTM_TD_End (); + HTM_TR_End (); + } + /***** End table with sessions *****/ HTM_TABLE_End (); } @@ -349,7 +336,6 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams, static void ExaSes_ListOneOrMoreSessionsHeading (bool ICanEditSessions) { - extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Session; extern const char *Txt_Results; @@ -362,7 +348,6 @@ static void ExaSes_ListOneOrMoreSessionsHeading (bool ICanEditSessions) HTM_TH_Empty (1); /***** The rest of columns *****/ - HTM_TH (Txt_ROLES_SINGUL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],HTM_HEAD_LEFT ); HTM_TH (Txt_START_END_TIME[Exa_ORDER_BY_START_DATE] ,HTM_HEAD_LEFT ); HTM_TH (Txt_START_END_TIME[Exa_ORDER_BY_END_DATE ] ,HTM_HEAD_LEFT ); HTM_TH (Txt_Session ,HTM_HEAD_LEFT ); @@ -438,7 +423,7 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams, Exams->SesCod = Session->SesCod; /***** Begin cell *****/ - HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("rowspan=\"2\" class=\"BT %s\"",The_GetColorRows ()); if (ExaSes_CheckIfICanEditThisSession (Session->UsrCod)) { @@ -452,7 +437,7 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams, Session->HiddenOrVisible); /***** Icon to edit the exam session *****/ - Ico_PutContextualIconToEdit (ActEdiOneExaSes,Anchor, + Ico_PutContextualIconToEdit (ActReqChgExaSes,Anchor, ExaSes_PutParsEdit,Exams); } @@ -467,7 +452,7 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams, static void ExaSes_ListOneOrMoreSessionsAuthor (const struct ExaSes_Session *Session) { /***** Session author (teacher) *****/ - HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ()); Usr_WriteAuthor1Line (Session->UsrCod,Session->HiddenOrVisible); HTM_TD_End (); } @@ -516,7 +501,7 @@ static void ExaSes_ListOneOrMoreSessionsTitleGrps (struct Exa_Exams *Exams, extern const char *Txt_Resume; extern const char *HidVis_TitleClass[HidVis_NUM_HIDDEN_VISIBLE]; - HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("rowspan=\"2\" class=\"LT %s\"",The_GetColorRows ()); /***** Session title *****/ HTM_ARTICLE_Begin (Anchor); @@ -627,7 +612,7 @@ static void ExaSes_ListOneOrMoreSessionsResult (struct Exa_Exams *Exams, [Rol_SYS_ADM] = ExaSes_ListOneOrMoreSessionsResultTch, }; - HTM_TD_Begin ("class=\"CT DAT_%s %s\"", + HTM_TD_Begin ("rowspan=\"2\" class=\"CT DAT_%s %s\"", The_GetSuffix (),The_GetColorRows ()); if (Function[Gbl.Usrs.Me.Role.Logged]) @@ -720,7 +705,7 @@ void ExaSes_ToggleVisResultsSesUsr (void) Exa_DB_ToggleVisResultsSesUsr (&Session); /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ @@ -808,7 +793,7 @@ void ExaSes_ReqRemSession (void) Session.Title); /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ @@ -853,7 +838,7 @@ void ExaSes_RemoveSession (void) Exa_GetExamDataByCod (&Exams.Exam); /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ @@ -891,7 +876,7 @@ static void ExaSes_HideUnhideSession (HidVis_HiddenOrVisible_t HiddenOrVisible) Exa_DB_HideUnhideSession (&Session,HiddenOrVisible); /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ @@ -945,10 +930,10 @@ static void ExaSes_PutFormSession (struct ExaSes_Session *Session) }; bool ItsANewSession = (Session->SesCod <= 0); - /***** Begin section for a new exam session *****/ + /***** Begin section for exam session *****/ HTM_SECTION_Begin (ExaSes_NEW_SESSION_SECTION_ID); - /***** Begin form to create *****/ + /***** Begin form to create/edit *****/ Frm_BeginFormTable (ItsANewSession ? ActNewExaSes : ActChgExaSes, ExaSes_NEW_SESSION_SECTION_ID, @@ -964,7 +949,7 @@ static void ExaSes_PutFormSession (struct ExaSes_Session *Session) HTM_TD_Begin ("class=\"LT\""); HTM_INPUT_TEXT ("Title",ExaSes_MAX_CHARS_TITLE,Session->Title, HTM_DONT_SUBMIT_ON_CHANGE, - "id=\"Title\" size=\"45\" class=\"INPUT_%s\"" + "id=\"Title\" class=\"REC_C2_BOT_INPUT INPUT_%s\"" " required=\"required\"", The_GetSuffix ()); HTM_TD_End (); @@ -983,7 +968,7 @@ static void ExaSes_PutFormSession (struct ExaSes_Session *Session) Frm_EndFormTable (ItsANewSession ? Btn_CREATE_BUTTON : Btn_CONFIRM_BUTTON); - /***** End section for a new exam session *****/ + /***** End section for exam session *****/ HTM_SECTION_End (); } @@ -1012,7 +997,7 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod) HTM_TR_Begin (NULL); HTM_TD_TxtColon (Txt_Groups); HTM_TD_Begin ("class=\"LT\""); - Box_BoxTableBegin ("95%",NULL, + Box_BoxTableBegin ("100%",NULL, NULL,NULL, NULL,Box_NOT_CLOSABLE,0); @@ -1055,7 +1040,7 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod) } /*****************************************************************************/ -/****************** Request the creation of a new session ********************/ +/*************** Request the creation or edition of a session ****************/ /*****************************************************************************/ void ExaSes_ReqCreatOrEditSes (void) @@ -1094,7 +1079,7 @@ void ExaSes_ReqCreatOrEditSes (void) } /***** Show exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_PUT_FORM); // Put form for session + Exa_ShowOnlyOneExam (&Exams,Frm_PUT_FORM); // Put form for session } /*****************************************************************************/ @@ -1176,7 +1161,7 @@ void ExaSes_ReceiveFormSession (void) Exa_GetExamDataByCod (&Exams.Exam); /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Session,Frm_DONT_PUT_FORM); + Exa_ShowOnlyOneExam (&Exams,Frm_DONT_PUT_FORM); } /*****************************************************************************/ diff --git a/swad_exam_session.h b/swad_exam_session.h index 39c22fcb..ee7e9be6 100644 --- a/swad_exam_session.h +++ b/swad_exam_session.h @@ -51,7 +51,6 @@ struct ExaSes_UsrAnswer void ExaSes_ResetSession (struct ExaSes_Session *Session); void ExaSes_ListSessions (struct Exa_Exams *Exams, - struct ExaSes_Session *Session, Frm_PutForm_t PutFormSession); void ExaSes_GetSessionDataByCod (struct ExaSes_Session *Session); diff --git a/swad_game.c b/swad_game.c index 736af829..9799bbfe 100644 --- a/swad_game.c +++ b/swad_game.c @@ -180,8 +180,7 @@ void Gam_ResetGames (struct Gam_Games *Games) Games->ListQuestions = NULL; Games->GamCodsSelected = NULL; // String with selected game codes separated by separator multiple Games->Game.GamCod = -1L; // Current/selected game code - Games->MchCod.Current = - Games->MchCod.Selected = -1L; // Current/selected match code + Games->MchCod = -1L; // Current/selected match code Games->QstInd = 0; // Current question index } @@ -2158,31 +2157,6 @@ static bool Gam_CheckIfEditable (const struct Gam_Game *Game) return false; // Questions are not editable } -/*****************************************************************************/ -/************* Request the creation of a new match as a teacher **************/ -/*****************************************************************************/ - -void Gam_ReqNewMatch (void) - { - struct Gam_Games Games; - - /***** Reset games context *****/ - Gam_ResetGames (&Games); - - /***** Reset game *****/ - Gam_ResetGame (&Games.Game); - - /***** Get parameters *****/ - if ((Games.Game.GamCod = Gam_GetPars (&Games)) <= 0) - Err_WrongGameExit (); - Gam_GetGameDataByCod (&Games.Game); - - /***** Show game *****/ - Gam_ShowOnlyOneGame (&Games, - false, // Do not list game questions - Frm_PUT_FORM); - } - /*****************************************************************************/ /************************* Show test tags in a game **************************/ /*****************************************************************************/ diff --git a/swad_game.h b/swad_game.h index 6ea26ab1..cb499ae8 100644 --- a/swad_game.h +++ b/swad_game.h @@ -97,11 +97,7 @@ struct Gam_Games char *ListQuestions; char *GamCodsSelected; // String with selected game codes separated by separator multiple struct Gam_Game Game; // Selected/current game - struct - { - long Selected; // Current match code - long Current; - } MchCod; + long MchCod; // Selected/current match unsigned QstInd; // Current question index }; @@ -160,8 +156,6 @@ void Gam_RemoveQstFromGame (void); void Gam_MoveUpQst (void); void Gam_MoveDownQst (void); -void Gam_ReqNewMatch (void); - void Gam_ShowTstTagsPresentInAGame (long GamCod); void Gam_GetScoreRange (long GamCod,double *MinScore,double *MaxScore); diff --git a/swad_match.c b/swad_match.c index 384c09ae..25e1f85d 100644 --- a/swad_match.c +++ b/swad_match.c @@ -100,6 +100,7 @@ static void Mch_PutIconsInListOfMatches (void *Games); static void Mch_PutIconToCreateNewMatch (struct Gam_Games *Games); static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, + Frm_PutForm_t PutFormMatch, unsigned NumMatches, MYSQL_RES *mysql_res); static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches); @@ -135,10 +136,8 @@ static void Mch_ListOneOrMoreMatchesResultTch (struct Gam_Games *Games, static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res, struct Mch_Match *Match); -static void Mch_PutFormExistingMatch (struct Gam_Games *Games, - const struct Mch_Match *Match, - const char *Anchor); -static void Mch_PutFormNewMatch (const struct Gam_Game *Game); +static void Mch_PutFormMatch (struct Mch_Match *Match); +static void Mch_ParsFormMatch (void *Match); static void Mch_ShowLstGrpsToEditMatch (long MchCod); static void Mch_UpdateMatchTitleAndGrps (const struct Mch_Match *Match); @@ -269,7 +268,8 @@ void Mch_ResetMatch (struct Mch_Match *Match) /************************* List the matches of a game ************************/ /*****************************************************************************/ -void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch) +void Mch_ListMatches (struct Gam_Games *Games, + Frm_PutForm_t PutFormNewMatch) { extern const char *Hlp_ASSESSMENT_Games_matches; extern const char *Txt_Matches; @@ -285,33 +285,20 @@ void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch) Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE); /***** Select whether show only my groups or all groups *****/ - switch (Gbl.Usrs.Me.Role.Logged) + if (Gbl.Crs.Grps.NumGrps && Mch_CheckIfICanEditMatches ()) { - case Rol_NET: - case Rol_TCH: - case Rol_SYS_ADM: - if (Gbl.Crs.Grps.NumGrps) - { - Set_BeginSettingsHead (); - Grp_ShowFormToSelWhichGrps (ActSeeOneGam,Gam_PutPars,Games); - Set_EndSettingsHead (); - } - break; - default: - break; + Set_BeginSettingsHead (); + Grp_ShowFormToSelWhichGrps (ActSeeOneGam,Gam_PutPars,Games); + Set_EndSettingsHead (); } /***** Show the table with the matches *****/ - if (NumMatches) - Mch_ListOneOrMoreMatches (Games,NumMatches,mysql_res); + Mch_ListOneOrMoreMatches (Games,PutFormNewMatch, + NumMatches,mysql_res); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - /***** Put button to play a new match in this game *****/ - if (PutFormNewMatch == Frm_PUT_FORM) - Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match - /***** End box *****/ Box_BoxEnd (); } @@ -368,6 +355,7 @@ static void Mch_PutIconToCreateNewMatch (struct Gam_Games *Games) /*****************************************************************************/ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, + Frm_PutForm_t PutFormMatch, unsigned NumMatches, MYSQL_RES *mysql_res) { @@ -376,10 +364,9 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, struct Mch_Match Match; char *Anchor; bool ICanEditMatches = Mch_CheckIfICanEditMatches (); - - /***** Trivial check *****/ - if (!NumMatches) - return; + long MchCodToBeEdited = PutFormMatch == Frm_PUT_FORM && + Games->MchCod > 0 ? Games->MchCod : + -1L; /***** Reset match *****/ Mch_ResetMatch (&Match); @@ -388,7 +375,8 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, HTM_TABLE_Begin ("TBL_SCROLL"); /***** Write the heading *****/ - Mch_ListOneOrMoreMatchesHeading (ICanEditMatches); + if (NumMatches) + Mch_ListOneOrMoreMatchesHeading (ICanEditMatches); /***** Write rows *****/ for (NumMatch = 0, UniqueId = 1, The_ResetRowColor (); @@ -405,7 +393,6 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, Err_NotEnoughMemoryExit (); /***** First row for this match with match data ****/ - /* Begin first row */ HTM_TR_Begin (NULL); /* Icons */ @@ -427,35 +414,24 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, /* Match result visible? */ Mch_ListOneOrMoreMatchesResult (Games,&Match); - /* End first row */ HTM_TR_End (); - /***** Second row for this match with author ****/ - /* Begin second row */ + /***** Second row: match author ****/ HTM_TR_Begin (NULL); - - /* Match author */ Mch_ListOneOrMoreMatchesAuthor (Games,&Match); - - /* End second row */ HTM_TR_End (); /***** Third row for this match used for edition ****/ - if (Gbl.Action.Act == ActEdiMch && // Editing... - Match.MchCod == Games->MchCod.Selected) // ...this match + if (ICanEditMatches && PutFormMatch == Frm_PUT_FORM && // Editing... + Match.MchCod == MchCodToBeEdited) // ...this match /***** Check if I can edit this match *****/ if (Mch_CheckIfICanEditThisMatch (&Match)) { - /* Begin third row */ HTM_TR_Begin (NULL); - - /* Form to edit match */ HTM_TD_Begin ("colspan=\"7\" class=\"LT %s\"", The_GetColorRows ()); - Mch_PutFormExistingMatch (Games,&Match,Anchor); // Form to fill in data and edit this match + Mch_PutFormMatch (&Match); // Form to edit this match HTM_TD_End (); - - /* End third row */ HTM_TR_End (); } @@ -464,6 +440,23 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, } } + /***** Put button to play a new match in this game *****/ + if (ICanEditMatches && PutFormMatch == Frm_PUT_FORM && + MchCodToBeEdited <= 0) + { + /* Reset match */ + Mch_ResetMatch (&Match); + Match.GamCod = Games->Game.GamCod; + Str_Copy (Match.Title,Games->Game.Title,sizeof (Match.Title) - 1); + + /* Put form to create new match */ + HTM_TR_Begin (NULL); + HTM_TD_Begin ("colspan=\"7\" class=\"LT %s\"",The_GetColorRows ()); + Mch_PutFormMatch (&Match); // Form to create match + HTM_TD_End (); + HTM_TR_End (); + } + /***** End table *****/ HTM_TABLE_End (); } @@ -523,6 +516,9 @@ static bool Mch_CheckIfICanEditMatches (void) static bool Mch_CheckIfICanEditThisMatch (const struct Mch_Match *Match) { + if (Match->MchCod <= 0) + return true; + switch (Gbl.Usrs.Me.Role.Logged) { case Rol_NET: @@ -561,15 +557,14 @@ static void Mch_ListOneOrMoreMatchesIcons (struct Gam_Games *Games, if (Mch_CheckIfICanEditThisMatch (Match)) { - // Games->Game.GamCod = Match->GamCod; - Games->MchCod.Current = Match->MchCod; + Games->MchCod = Match->MchCod; /***** Put icon to remove the match *****/ Ico_PutContextualIconToRemove (ActReqRemMch,NULL, Mch_PutParsEdit,Games); /***** Put icon to edit the match *****/ - Ico_PutContextualIconToEdit (ActEdiMch,Anchor, + Ico_PutContextualIconToEdit (ActReqChgMch,Anchor, Mch_PutParsEdit,Games); } else @@ -820,16 +815,14 @@ static void Mch_ListOneOrMoreMatchesResult (struct Gam_Games *Games, static void Mch_ListOneOrMoreMatchesResultStd (struct Gam_Games *Games, const struct Mch_Match *Match) { + Games->MchCod = Match->MchCod; + /***** Is match result visible or hidden? *****/ if (Match->Status.ShowUsrResults) - { /* Result is visible by me */ - Games->Game.GamCod = Match->GamCod; - Games->MchCod.Current = Match->MchCod; Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResMch,MchRes_RESULTS_BOX_ID, Mch_PutParsEdit,Games, "trophy.svg",Ico_BLACK); - } else /* Result is forbidden to me */ Ico_PutIconNotVisible (); @@ -841,8 +834,7 @@ static void Mch_ListOneOrMoreMatchesResultTch (struct Gam_Games *Games, extern const char *Txt_Visible_results; extern const char *Txt_Hidden_results; - Games->Game.GamCod = Match->GamCod; - Games->MchCod.Current = Match->MchCod; + Games->MchCod = Match->MchCod; /***** Show match results *****/ if (Mch_CheckIfICanEditThisMatch (Match)) @@ -1118,10 +1110,10 @@ void Mch_RemoveMatchesMadeByUsrInCrs (long UsrCod,long CrsCod) } /*****************************************************************************/ -/************************ Edit a match (game instance) ***********************/ +/**************** Request the creation or edition of a match *****************/ /*****************************************************************************/ -void Mch_EditMatch (void) +void Mch_ReqCreatOrEditMatch (void) { struct Gam_Games Games; struct Mch_Match Match; @@ -1138,10 +1130,10 @@ void Mch_EditMatch (void) if (!Mch_CheckIfICanEditThisMatch (&Match)) Err_NoPermissionExit (); - /***** Show current game *****/ + /***** Show game *****/ Gam_ShowOnlyOneGame (&Games, false, // Do not list game questions - Frm_DONT_PUT_FORM); + Frm_PUT_FORM); } /*****************************************************************************/ @@ -1153,7 +1145,7 @@ void Mch_PutParsEdit (void *Games) if (Games) { Gam_PutPars (Games); - ParCod_PutPar (ParCod_Mch,((struct Gam_Games *) Games)->MchCod.Current); + ParCod_PutPar (ParCod_Mch,((struct Gam_Games *) Games)->MchCod); } } @@ -1162,7 +1154,7 @@ void Mch_PutParsEdit (void *Games) /*****************************************************************************/ void Mch_GetAndCheckPars (struct Gam_Games *Games, - struct Mch_Match *Match) + struct Mch_Match *Match) { /***** Get parameters *****/ /* Get parameters of game */ @@ -1170,150 +1162,76 @@ void Mch_GetAndCheckPars (struct Gam_Games *Games, Err_WrongGameExit (); Grp_GetParWhichGroups (); Gam_GetGameDataByCod (&Games->Game); - - /* Get match code */ - Match->MchCod = ParCod_GetAndCheckPar (ParCod_Mch); - Mch_GetMatchDataByCod (Match); - - /***** Ensure parameters are correct *****/ - if (Games->Game.GamCod != Match->GamCod) - Err_WrongGameExit (); if (Games->Game.CrsCod != Gbl.Hierarchy.Node[Hie_CRS].HieCod) Err_WrongGameExit (); + /* Get match code */ + if ((Match->MchCod = ParCod_GetPar (ParCod_Mch)) > 0) + { + Mch_GetMatchDataByCod (Match); + if (Games->Game.GamCod != Match->GamCod) + Err_WrongGameExit (); + } + else + Mch_ResetMatch (Match); + /***** Initialize context *****/ - Games->MchCod.Current = - Games->MchCod.Selected = Match->MchCod; + Games->MchCod = Match->MchCod; } /*****************************************************************************/ /******************* Put a form to change and existing match *****************/ /*****************************************************************************/ -static void Mch_PutFormExistingMatch (struct Gam_Games *Games, - const struct Mch_Match *Match, - const char *Anchor) +static void Mch_PutFormMatch (struct Mch_Match *Match) { extern const char *Hlp_ASSESSMENT_Games_matches; extern const char *Txt_Title; - extern const char *Txt_Save_changes; + bool ItsANewMatch = (Match->MchCod <= 0); - /***** Begin form *****/ - Frm_BeginFormAnchor (ActChgMch,Anchor); - Mch_PutParsEdit (Games); - - /***** Begin box and table *****/ - Box_BoxTableBegin (NULL,Match->Title, - NULL,NULL, - Hlp_ASSESSMENT_Games_matches,Box_CLOSABLE,2); - - /***** Match title *****/ - HTM_TR_Begin (NULL); - - /* Label */ - Frm_LabelColumn ("RT","Title",Txt_Title); - - /* Data */ - HTM_TD_Begin ("class=\"LT\""); - HTM_INPUT_TEXT ("Title",Mch_MAX_CHARS_TITLE,Match->Title, - HTM_DONT_SUBMIT_ON_CHANGE, - "id=\"Title\" size=\"45\" class=\"INPUT_%s\"" - " required=\"required\"", - The_GetSuffix ()); - HTM_TD_End (); - - HTM_TR_End (); - - /***** Groups *****/ - Mch_ShowLstGrpsToEditMatch (Match->MchCod); - - /***** End table *****/ - HTM_TABLE_End (); - - /***** Put button to submit the form *****/ - Btn_PutConfirmButton (Txt_Save_changes); - - /***** End box *****/ - Box_BoxEnd (); - - /***** End form *****/ - Frm_EndForm (); - } - -/*****************************************************************************/ -/********************** Put a form to create a new match *********************/ -/*****************************************************************************/ - -static void Mch_PutFormNewMatch (const struct Gam_Game *Game) - { - extern const char *Hlp_ASSESSMENT_Games_matches; - extern const char *Txt_Match; - extern const char *Txt_Title; - extern const char *Txt_Play; - - /***** Trivial check: roles allowed *****/ - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_NET: - case Rol_TCH: - case Rol_SYS_ADM: - break; - default: - Err_NoPermissionExit (); - break; - } - - /***** Begin section for a new match *****/ + /***** Begin section for match *****/ HTM_SECTION_Begin (Mch_NEW_MATCH_SECTION_ID); - /***** Begin form *****/ - Frm_BeginForm (ActNewMch); - ParCod_PutPar (ParCod_Gam,Game->GamCod); - Gam_PutParQstInd (0); // Start by first question in game + /***** Begin form to create/edit *****/ + Frm_BeginFormTable (ItsANewMatch ? ActNewMch : + ActChgMch, + Mch_NEW_MATCH_SECTION_ID, + Mch_ParsFormMatch,Match); - /***** Begin box and table *****/ - Box_BoxTableBegin (NULL,Txt_Match, - NULL,NULL, - Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE,2); + /***** Match title *****/ + HTM_TR_Begin (NULL); - /***** Match title *****/ - HTM_TR_Begin (NULL); + /* Label */ + Frm_LabelColumn ("RT","Title",Txt_Title); - /* Label */ - Frm_LabelColumn ("RT","Title",Txt_Title); - - /* Data */ - HTM_TD_Begin ("class=\"LT\""); - HTM_INPUT_TEXT ("Title",Mch_MAX_CHARS_TITLE,Game->Title, + /* Data */ + HTM_TD_Begin ("class=\"LT\""); + HTM_INPUT_TEXT ("Title",Mch_MAX_CHARS_TITLE,Match->Title, HTM_DONT_SUBMIT_ON_CHANGE, "id=\"Title\" size=\"45\" class=\"INPUT_%s\"" " required=\"required\"", The_GetSuffix ()); - HTM_TD_End (); + HTM_TD_End (); - HTM_TR_End (); + HTM_TR_End (); - /***** Groups *****/ - Mch_ShowLstGrpsToEditMatch (-1L); + /***** Groups *****/ + Mch_ShowLstGrpsToEditMatch (Match->MchCod); - /***** End table *****/ - HTM_TABLE_End (); + /***** End form to create *****/ + Frm_EndFormTable (ItsANewMatch ? Btn_CREATE_BUTTON : + Btn_CONFIRM_BUTTON); - /***** Put icon to submit the form *****/ - HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"play.svg", - Txt_Play, - "class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO64x64\""); - - /***** End box *****/ - Box_BoxEnd (); - - /***** End form *****/ - Frm_EndForm (); - - /***** End section for a new match *****/ + /***** End section for exam session *****/ HTM_SECTION_End (); } +static void Mch_ParsFormMatch (void *Match) + { + ParCod_PutPar (ParCod_Gam,((struct Mch_Match *) Match)->GamCod); + ParCod_PutPar (ParCod_Mch,((struct Mch_Match *) Match)->MchCod); + } + /*****************************************************************************/ /***************** Show list of groups to create a new match *****************/ /*****************************************************************************/ @@ -1334,7 +1252,7 @@ static void Mch_ShowLstGrpsToEditMatch (long MchCod) HTM_TD_TxtColon (Txt_Groups); HTM_TD_Begin ("class=\"LT\""); - Box_BoxTableBegin ("95%",NULL, + Box_BoxTableBegin ("100%",NULL, NULL,NULL, NULL,Box_NOT_CLOSABLE,0); @@ -2759,7 +2677,7 @@ static void Mch_PutIfAnswered (const struct Mch_Match *Match,bool Answered) } /*****************************************************************************/ -/***************** Put checkbox to select if show results ********************/ +/******************** Put checkbox to remove my answer ***********************/ /*****************************************************************************/ static void Mch_PutIconToRemoveMyAnswer (const struct Mch_Match *Match) @@ -2771,7 +2689,7 @@ static void Mch_PutIconToRemoveMyAnswer (const struct Mch_Match *Match) /***** Begin form *****/ Frm_BeginForm (ActRemMchAnsQstStd); - ParCod_PutPar (ParCod_Mch,Match->MchCod); // Current match being played + ParCod_PutPar (ParCod_Mch,Match->MchCod); // Current match being played Gam_PutParQstInd (Match->Status.QstInd); // Current question index shown /***** Put icon with link *****/ @@ -3027,9 +2945,9 @@ static void Mch_ShowQuestionAndAnswersStd (const struct Mch_Match *Match, is necessary in order to be fast and not lose clicks due to refresh */ Frm_BeginForm (ActAnsMchQstStd); - ParCod_PutPar (ParCod_Mch,Match->MchCod); // Current match being played + ParCod_PutPar (ParCod_Mch,Match->MchCod); // Current match being played Gam_PutParQstInd (Match->Status.QstInd); // Current question index shown - Mch_PutParNumOpt (NumOpt); // Number of button + Mch_PutParNumOpt (NumOpt); // Number of button HTM_BUTTON_Submit_Begin (NULL, "class=\"MCH_STD_BUTTON%s BT_%c\"" diff --git a/swad_match.h b/swad_match.h index 4e5004f7..893ab592 100644 --- a/swad_match.h +++ b/swad_match.h @@ -94,7 +94,8 @@ long Mch_GetMchCodBeingPlayed (void); void Mch_ResetMatch (struct Mch_Match *Match); -void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch); +void Mch_ListMatches (struct Gam_Games *Games, + Frm_PutForm_t PutFormNewMatch); void Mch_GetMatchDataByCod (struct Mch_Match *Match); void Mch_ToggleVisResultsMchUsr (void); @@ -107,11 +108,11 @@ void Mch_RemoveMatchesInCourseFromAllTables (long CrsCod); void Mch_RemoveMatchesMadeByUsrInAllCrss (long UsrCod); void Mch_RemoveMatchesMadeByUsrInCrs (long UsrCod,long CrsCod); -void Mch_EditMatch (void); +void Mch_ReqCreatOrEditMatch (void); void Mch_PutParsEdit (void *Games); void Mch_GetAndCheckPars (struct Gam_Games *Games, - struct Mch_Match *Match); + struct Mch_Match *Match); void Mch_CreateNewMatch (void); void Mch_ChangeMatch (void); diff --git a/swad_match_result.c b/swad_match_result.c index 9823505a..25d73248 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -874,8 +874,8 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games, The_GetColorRows ()); if (ICanView.Result) { - Games->Game.GamCod = Match.GamCod; - Games->MchCod.Current = Match.MchCod; + Games->Game.GamCod = Match.GamCod; + Games->MchCod = Match.MchCod; switch (MeOrOther) { case Usr_ME: diff --git a/swad_survey.c b/swad_survey.c index 599606fa..776cc092 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -1822,7 +1822,7 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod) HTM_TR_Begin (NULL); HTM_TD_TxtColon (Txt_Groups); HTM_TD_Begin ("class=\"LT\""); - Box_BoxTableBegin ("95%",NULL, + Box_BoxTableBegin ("100%",NULL, NULL,NULL, NULL,Box_NOT_CLOSABLE,0); diff --git a/swad_text_action.c b/swad_text_action.c index 57b53cfb..f9d37bc8 100644 --- a/swad_text_action.c +++ b/swad_text_action.c @@ -12459,7 +12459,7 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] = "Request new exam session" // Çeviri lazim! #endif , - [ActEdiOneExaSes] = + [ActReqChgExaSes] = #if L==1 // ca "Edit exam session" // Necessita traducció #elif L==2 // de @@ -12940,52 +12940,6 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] = "See game" // Precisa de tradução #elif L==10 // tr "See game" // Çeviri lazim! -#endif - , - [ActReqRemMch] = -#if L==1 // ca - "Request removal of match" // Necessita traducció -#elif L==2 // de - "Request removal of match" // Need Übersetzung -#elif L==3 // en - "Request removal of match" -#elif L==4 // es - "Solicitar eliminación de partida" -#elif L==5 // fr - "Request removal of match" // Besoin de traduction -#elif L==6 // gn - "Solicitar eliminación de partida" // Okoteve traducción -#elif L==7 // it - "Request removal of match" // Bisogno di traduzione -#elif L==8 // pl - "Request removal of match" // Potrzebujesz tlumaczenie -#elif L==9 // pt - "Request removal of match" // Precisa de tradução -#elif L==10 // tr - "Request removal of match" // Çeviri lazim! -#endif - , - [ActRemMch] = -#if L==1 // ca - "Eliminar partida" -#elif L==2 // de - "Spiel entfernen" -#elif L==3 // en - "Remove match" -#elif L==4 // es - "Eliminar partida" -#elif L==5 // fr - "Supprimer match" -#elif L==6 // gn - "Eliminar partida" // Okoteve traducción -#elif L==7 // it - "Rimuovere partita" -#elif L==8 // pl - "Usuń mecz" -#elif L==9 // pt - "Remover jogo" -#elif L==10 // tr - "Eşleşmeyi kaldır" #endif , [ActReqNewMch] = @@ -13009,6 +12963,29 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] = "Request creation of new match" // Precisa de tradução #elif L==10 // tr "Request creation of new match" // Çeviri lazim! +#endif + , + [ActReqChgMch] = +#if L==1 // ca + "Request edition of match" // Necessita traducció +#elif L==2 // de + "Request edition of match" // Need Übersetzung +#elif L==3 // en + "Request edition of match" +#elif L==4 // es + "Solicitar creación de nueva partida" +#elif L==5 // fr + "Request edition of match" // Besoin de traduction +#elif L==6 // gn + "Solicitar creación de nueva partida" // Okoteve traducción +#elif L==7 // it + "Request edition of match" // Bisogno di traduzione +#elif L==8 // pl + "Request edition of match" // Potrzebujesz tlumaczenie +#elif L==9 // pt + "Request edition of match" // Precisa de tradução +#elif L==10 // tr + "Request edition of match" // Çeviri lazim! #endif , [ActNewMch] = @@ -13055,6 +13032,52 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] = "Change match" // Precisa de tradução #elif L==10 // tr "Change match" // Çeviri lazim! +#endif + , + [ActReqRemMch] = +#if L==1 // ca + "Request removal of match" // Necessita traducció +#elif L==2 // de + "Request removal of match" // Need Übersetzung +#elif L==3 // en + "Request removal of match" +#elif L==4 // es + "Solicitar eliminación de partida" +#elif L==5 // fr + "Request removal of match" // Besoin de traduction +#elif L==6 // gn + "Solicitar eliminación de partida" // Okoteve traducción +#elif L==7 // it + "Request removal of match" // Bisogno di traduzione +#elif L==8 // pl + "Request removal of match" // Potrzebujesz tlumaczenie +#elif L==9 // pt + "Request removal of match" // Precisa de tradução +#elif L==10 // tr + "Request removal of match" // Çeviri lazim! +#endif + , + [ActRemMch] = +#if L==1 // ca + "Eliminar partida" +#elif L==2 // de + "Spiel entfernen" +#elif L==3 // en + "Remove match" +#elif L==4 // es + "Eliminar partida" +#elif L==5 // fr + "Supprimer match" +#elif L==6 // gn + "Eliminar partida" // Okoteve traducción +#elif L==7 // it + "Rimuovere partita" +#elif L==8 // pl + "Usuń mecz" +#elif L==9 // pt + "Remover jogo" +#elif L==10 // tr + "Eşleşmeyi kaldır" #endif , [ActResMch] =