From 1ae3517481072ecbc1943ff896f42e8237367e3d Mon Sep 17 00:00:00 2001 From: acanas Date: Wed, 20 Dec 2023 10:25:10 +0100 Subject: [PATCH] Version 23.54: Dec 20, 2023 Responsive design in games and matches. --- css/{swad23.53.6.css => swad23.54.css} | 8 ++ swad_changelog.h | 5 +- swad_game.c | 113 ++++++++++++++----------- swad_icon.c | 1 + swad_icon.h | 15 ++-- swad_match.c | 68 ++++++++------- 6 files changed, 121 insertions(+), 89 deletions(-) rename css/{swad23.53.6.css => swad23.54.css} (99%) diff --git a/css/swad23.53.6.css b/css/swad23.54.css similarity index 99% rename from css/swad23.53.6.css rename to css/swad23.54.css index 65830ee16..c075eb0c0 100644 --- a/css/swad23.53.6.css +++ b/css/swad23.54.css @@ -2164,6 +2164,14 @@ a:hover img.CENTER_PHOTO_SHOW .ICO_BLACK_PINK {filter: invert(26%) sepia(0%) saturate(1%) hue-rotate(288deg) brightness(97%) contrast(102%);} /* #404040 */ .ICO_BLACK_DARK {filter: invert(92%) sepia(44%) saturate(2%) hue-rotate(176deg) brightness(110%) contrast(88%);} /* #f0f0f0 */ +.ICO_BLUE_WHITE, +.ICO_BLUE_GREY, +.ICO_BLUE_PURPLE, +.ICO_BLUE_BLUE, +.ICO_BLUE_YELLOW, +.ICO_BLUE_PINK {filter: invert(50%) sepia(27%) saturate(624%) hue-rotate(153deg) brightness(93%) contrast(97%);} /* #4d88a1 */ +.ICO_BLUE_DARK {filter: invert(81%) sepia(15%) saturate(249%) hue-rotate(151deg) brightness(91%) contrast(95%);} /* #afc4cc */ + .ICO_GREEN_WHITE, .ICO_GREEN_GREY, .ICO_GREEN_PURPLE, diff --git a/swad_changelog.h b/swad_changelog.h index 78948ad86..0ea86d659 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.53.7 (2023-12-20)" -#define CSS_FILE "swad23.53.6.css" +#define Log_PLATFORM_VERSION "SWAD 23.54 (2023-12-20)" +#define CSS_FILE "swad23.54.css" #define JS_FILE "swad23.53.6.js" /* + 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) Version 23.53.5: Dec 19, 2023 Responsive design in calls for exams. (335874 lines) diff --git a/swad_game.c b/swad_game.c index 29328c9e4..736af829f 100644 --- a/swad_game.c +++ b/swad_game.c @@ -111,6 +111,8 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static void Gam_ListAllGamesHeading (const struct Gam_Games *Games); + static bool Gam_CheckIfICanEditGames (void); static bool Gam_CheckIfICanListGameQuestions (void); static void Gam_PutIconsListingGames (void *Games); @@ -230,11 +232,7 @@ void Gam_ListAllGames (struct Gam_Games *Games) { extern const char *Hlp_ASSESSMENT_Games; extern const char *Txt_Games; - extern const char *Txt_GAMES_ORDER_HELP[Gam_NUM_ORDERS]; - extern const char *Txt_GAMES_ORDER[Gam_NUM_ORDERS]; - extern const char *Txt_Matches; extern const char *Txt_No_games; - Gam_Order_t Order; struct Pag_Pagination Pagination; unsigned NumGame; @@ -255,52 +253,20 @@ void Gam_ListAllGames (struct Gam_Games *Games) Games->CurrentPage = (unsigned) Pagination.CurrentPage; /***** Begin box *****/ - Box_BoxBegin ("100%",Txt_Games, + Box_BoxBegin (NULL,Txt_Games, Gam_PutIconsListingGames,Games, Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE); /***** Write links to pages *****/ - Pag_WriteLinksToPagesCentered (Pag_GAMES,&Pagination, - Games,-1L); + Pag_WriteLinksToPagesCentered (Pag_GAMES,&Pagination,Games,-1L); if (Games->Num) { /***** Begin table *****/ - HTM_TABLE_BeginWideMarginPadding (5); + HTM_TABLE_Begin ("TBL_SCROLL"); /***** Table head *****/ - HTM_TR_Begin (NULL); - - HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons - - for (Order = (Gam_Order_t) 0; - Order <= (Gam_Order_t) (Gam_NUM_ORDERS - 1); - Order++) - { - HTM_TH_Begin (HTM_HEAD_LEFT); - - /* Form to change order */ - Frm_BeginForm (ActSeeAllGam); - Pag_PutParPagNum (Pag_GAMES,Games->CurrentPage); - Par_PutParUnsigned (NULL,"Order",(unsigned) Order); - - HTM_BUTTON_Submit_Begin (Txt_GAMES_ORDER_HELP[Order], - "class=\"BT_LINK\""); - if (Order == Games->SelectedOrder) - HTM_U_Begin (); - HTM_Txt (Txt_GAMES_ORDER[Order]); - if (Order == Games->SelectedOrder) - HTM_U_End (); - HTM_BUTTON_End (); - - Frm_EndForm (); - - HTM_TH_End (); - } - - HTM_TH (Txt_Matches,HTM_HEAD_RIGHT); - - HTM_TR_End (); + Gam_ListAllGamesHeading (Games); /***** Write all games *****/ for (NumGame = Pagination.FirstItemVisible; @@ -323,8 +289,7 @@ void Gam_ListAllGames (struct Gam_Games *Games) Ale_ShowAlert (Ale_INFO,Txt_No_games); /***** Write again links to pages *****/ - Pag_WriteLinksToPagesCentered (Pag_GAMES,&Pagination, - Games,-1L); + Pag_WriteLinksToPagesCentered (Pag_GAMES,&Pagination,Games,-1L); /***** End box *****/ Box_BoxEnd (); @@ -333,6 +298,52 @@ void Gam_ListAllGames (struct Gam_Games *Games) Gam_FreeListGames (Games); } +/*****************************************************************************/ +/**************** Write table heading when showing all games *****************/ +/*****************************************************************************/ + +static void Gam_ListAllGamesHeading (const struct Gam_Games *Games) + { + extern const char *Txt_GAMES_ORDER_HELP[Gam_NUM_ORDERS]; + extern const char *Txt_GAMES_ORDER[Gam_NUM_ORDERS]; + extern const char *Txt_Matches; + + Gam_Order_t Order; + + HTM_TR_Begin (NULL); + + HTM_TH_Span (NULL,HTM_HEAD_CENTER,1,1,"CONTEXT_COL"); // Column for contextual icons + + for (Order = (Gam_Order_t) 0; + Order <= (Gam_Order_t) (Gam_NUM_ORDERS - 1); + Order++) + { + HTM_TH_Begin (HTM_HEAD_LEFT); + + /* Form to change order */ + Frm_BeginForm (ActSeeAllGam); + Pag_PutParPagNum (Pag_GAMES,Games->CurrentPage); + Par_PutParUnsigned (NULL,"Order",(unsigned) Order); + + HTM_BUTTON_Submit_Begin (Txt_GAMES_ORDER_HELP[Order], + "class=\"BT_LINK\""); + if (Order == Games->SelectedOrder) + HTM_U_Begin (); + HTM_Txt (Txt_GAMES_ORDER[Order]); + if (Order == Games->SelectedOrder) + HTM_U_End (); + HTM_BUTTON_End (); + + Frm_EndForm (); + + HTM_TH_End (); + } + + HTM_TH (Txt_Matches,HTM_HEAD_RIGHT); + + HTM_TR_End (); + } + /*****************************************************************************/ /************************ Check if I can edit games **************************/ /*****************************************************************************/ @@ -444,7 +455,7 @@ void Gam_SeeOneGame (void) /***** Show game *****/ Gam_ShowOnlyOneGame (&Games, false, // Do not list game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -519,7 +530,7 @@ static void Gam_ShowGameMainData (struct Gam_Games *Games, /***** Begin box and table *****/ if (ShowOnlyThisGame) - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_Begin ("TBL_SCROLL"); /***** Begin first row of this game *****/ HTM_TR_Begin (NULL); @@ -1194,7 +1205,7 @@ void Gam_ListGame (void) /***** Show game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -1558,7 +1569,7 @@ void Gam_ReqSelectQstsToAddToGame (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -1865,7 +1876,7 @@ void Gam_AddQstsToGame (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -1935,7 +1946,7 @@ void Gam_ReqRemQstFromGame (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -1983,7 +1994,7 @@ void Gam_RemoveQstFromGame (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -2032,7 +2043,7 @@ void Gam_MoveUpQst (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ @@ -2085,7 +2096,7 @@ void Gam_MoveDownQst (void) /***** Show current game *****/ Gam_ShowOnlyOneGame (&Games, true, // List game questions - false); // Do not put form to start new match + Frm_DONT_PUT_FORM); // Do not put form to start new match } /*****************************************************************************/ diff --git a/swad_icon.c b/swad_icon.c index 5609e00c4..61a04b125 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -101,6 +101,7 @@ const char *Ico_GetPreffix (Ico_Color_t Color) { [Ico_UNCHANGED] = NULL, [Ico_BLACK ] = "BLACK", + [Ico_BLUE ] = "BLUE", [Ico_GREEN ] = "GREEN", [Ico_RED ] = "RED", [Ico_WHITE ] = "WHITE", diff --git a/swad_icon.h b/swad_icon.h index 7db5e4774..5480ae6c7 100644 --- a/swad_icon.h +++ b/swad_icon.h @@ -46,15 +46,16 @@ typedef enum } Ico_IconSet_t; #define Ico_ICON_SET_DEFAULT Ico_ICON_SET_AWESOME -#define Ico_NUM_COLORS 6 +#define Ico_NUM_COLORS 7 typedef enum { - Ico_UNCHANGED = 0, - Ico_BLACK = 1, - Ico_GREEN = 2, - Ico_RED = 3, - Ico_WHITE = 4, - Ico_YELLOW = 5, + Ico_UNCHANGED, + Ico_BLACK, + Ico_BLUE, + Ico_GREEN, + Ico_RED, + Ico_WHITE, + Ico_YELLOW, } Ico_Color_t; struct Ico_IconColor diff --git a/swad_match.c b/swad_match.c index e86e3cb77..384c09aea 100644 --- a/swad_match.c +++ b/swad_match.c @@ -280,7 +280,7 @@ void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch) NumMatches = Mch_DB_GetMatchesInGame (&mysql_res,Games->Game.GamCod); /***** Begin box *****/ - Box_BoxBegin ("100%",Txt_Matches, + Box_BoxBegin (NULL,Txt_Matches, Mch_PutIconsInListOfMatches,Games, Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE); @@ -309,17 +309,8 @@ void Mch_ListMatches (struct Gam_Games *Games,Frm_PutForm_t PutFormNewMatch) DB_FreeMySQLResult (&mysql_res); /***** Put button to play a new match in this game *****/ - switch (Gbl.Usrs.Me.Role.Logged) - { - case Rol_NET: - case Rol_TCH: - case Rol_SYS_ADM: - if (PutFormNewMatch == Frm_PUT_FORM) - Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match - break; - default: - break; - } + if (PutFormNewMatch == Frm_PUT_FORM) + Mch_PutFormNewMatch (&Games->Game); // Form to fill in data and start playing a new match /***** End box *****/ Box_BoxEnd (); @@ -394,7 +385,7 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, Mch_ResetMatch (&Match); /***** Begin table *****/ - HTM_TABLE_BeginWidePadding (2); + HTM_TABLE_Begin ("TBL_SCROLL"); /***** Write the heading *****/ Mch_ListOneOrMoreMatchesHeading (ICanEditMatches); @@ -421,9 +412,6 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, if (ICanEditMatches) Mch_ListOneOrMoreMatchesIcons (Games,&Match,Anchor); - /* Match author */ - Mch_ListOneOrMoreMatchesAuthor (Games,&Match); - /* Start/end date/time */ Mch_ListOneOrMoreMatchesTimes (Games,&Match,UniqueId); @@ -442,22 +430,32 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, /* End first row */ HTM_TR_End (); - /***** Second row for this match used for edition ****/ + /***** Second row for this match with author ****/ + /* Begin second row */ + 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 /***** Check if I can edit this match *****/ if (Mch_CheckIfICanEditThisMatch (&Match)) { - /* Begin second row */ + /* Begin third row */ HTM_TR_Begin (NULL); /* Form to edit match */ - HTM_TD_Begin ("colspan=\"8\" class=\"LT %s\"", + HTM_TD_Begin ("colspan=\"7\" class=\"LT %s\"", The_GetColorRows ()); Mch_PutFormExistingMatch (Games,&Match,Anchor); // Form to fill in data and edit this match HTM_TD_End (); - /* End second row */ + /* End third row */ HTM_TR_End (); } @@ -476,7 +474,6 @@ static void Mch_ListOneOrMoreMatches (struct Gam_Games *Games, static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches) { - 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_Match; extern const char *Txt_Players; @@ -491,11 +488,12 @@ static void Mch_ListOneOrMoreMatchesHeading (bool ICanEditMatches) 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[Gam_ORDER_BY_START_DATE] ,HTM_HEAD_LEFT ); HTM_TH (Txt_START_END_TIME[Gam_ORDER_BY_END_DATE ] ,HTM_HEAD_LEFT ); HTM_TH (Txt_Match ,HTM_HEAD_LEFT ); - HTM_TH (Txt_Players ,HTM_HEAD_RIGHT ); + HTM_TH_Begin (HTM_HEAD_RIGHT); + Ico_PutIconOn ("users.svg",Ico_BLUE,Txt_Players); + HTM_TH_End (); HTM_TH (Txt_Status ,HTM_HEAD_CENTER); HTM_TH (Txt_Results ,HTM_HEAD_CENTER); @@ -559,7 +557,7 @@ static void Mch_ListOneOrMoreMatchesIcons (struct Gam_Games *Games, const struct Mch_Match *Match, const char *Anchor) { - HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("rowspan=\"2\" class=\"BT %s\"",The_GetColorRows ()); if (Mch_CheckIfICanEditThisMatch (Match)) { @@ -588,7 +586,7 @@ static void Mch_ListOneOrMoreMatchesAuthor (const struct Gam_Games *Games, const struct Mch_Match *Match) { /***** Match author (teacher) *****/ - HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("colspan=\"2\" class=\"LT %s\"",The_GetColorRows ()); Usr_WriteAuthor1Line (Match->UsrCod,Games->Game.HiddenOrVisible); HTM_TD_End (); } @@ -644,7 +642,7 @@ static void Mch_ListOneOrMoreMatchesTitleGrps (const struct Gam_Games *Games, extern const char *Txt_Play; extern const char *Txt_Resume; - HTM_TD_Begin ("class=\"LT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("rowspan=\"2\" class=\"LT %s\"",The_GetColorRows ()); HTM_ARTICLE_Begin (Anchor); /***** Match title *****/ @@ -742,7 +740,7 @@ static void Mch_ListOneOrMoreMatchesNumPlayers (const struct Gam_Games *Games, extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE]; /***** Number of players who have answered any question in the match ******/ - HTM_TD_Begin ("class=\"RT %s_%s %s\"", + HTM_TD_Begin ("rowspan=\"2\" class=\"RT %s_%s %s\"", HidVis_DataClass[Games->Game.HiddenOrVisible],The_GetSuffix (), The_GetColorRows ()); HTM_Unsigned (Mch_DB_GetNumUsrsWhoHavePlayedMch (Match->MchCod)); @@ -759,7 +757,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Gam_Games *Games, { extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE]; - HTM_TD_Begin ("class=\"CT DAT_%s %s\"", + HTM_TD_Begin ("rowspan=\"2\" class=\"CT DAT_%s %s\"", The_GetSuffix (),The_GetColorRows ()); if (Match->Status.Showing != Mch_END) // Match not over @@ -809,7 +807,7 @@ static void Mch_ListOneOrMoreMatchesResult (struct Gam_Games *Games, [Rol_SYS_ADM] = Mch_ListOneOrMoreMatchesResultTch, }; - HTM_TD_Begin ("class=\"CT %s\"",The_GetColorRows ()); + HTM_TD_Begin ("rowspan=\"2\" class=\"CT %s\"",The_GetColorRows ()); if (Function[Gbl.Usrs.Me.Role.Logged]) Function[Gbl.Usrs.Me.Role.Logged] (Games,Match); @@ -1253,6 +1251,18 @@ static void Mch_PutFormNewMatch (const struct Gam_Game *Game) 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 *****/ HTM_SECTION_Begin (Mch_NEW_MATCH_SECTION_ID);