From ba510a38e7cdf37685dcce6e09d5ab826410983b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 13 Dec 2019 01:04:09 +0100 Subject: [PATCH] Version19.90.2 --- swad_changelog.h | 3 +- swad_match.c | 126 ++++++++++++++++++++++++++++------------------- swad_text.c | 22 +++++++++ 3 files changed, 98 insertions(+), 53 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 4500a322b..af3ee1c3f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,13 +490,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.90.1 (2019-12-12)" +#define Log_PLATFORM_VERSION "SWAD 19.90.2 (2019-12-13)" #define CSS_FILE "swad19.90.1.css" #define JS_FILE "swad19.90.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. + Version 19.90.2: Dec 13, 2019 Code refactoring in matches. (248427 lines) Version 19.90.1: Dec 12, 2019 Changes in CSS. (248391 lines) Version 19.90: Dec 12, 2019 Hourglass to start countdown. (248373 lines) 2 changes necessary in database: diff --git a/swad_match.c b/swad_match.c index ad09a67b3..fd26c1cac 100644 --- a/swad_match.c +++ b/swad_match.c @@ -61,6 +61,10 @@ extern struct Globals Gbl; #define Mch_ICON_NEXT "fas fa-step-forward" #define Mch_ICON_RESULTS "fas fa-chart-bar" +#define Mch_COUNTDOWN_SECONDS_LARGE 60 +#define Mch_COUNTDOWN_SECONDS_MEDIUM 30 +#define Mch_COUNTDOWN_SECONDS_SMALL 10 + /*****************************************************************************/ /******************************* Private types *******************************/ /*****************************************************************************/ @@ -164,8 +168,8 @@ static void Mch_ShowRefreshablePartTch (struct Match *Match); static void Mch_WriteElapsedTimeInMch (struct Match *Match); static void Mch_WriteElapsedTimeInQst (struct Match *Match); static void Mch_WriteHourglass (struct Match *Match); -static void Mch_PutFormCountdown (struct Match *Match,long Countdown, - const char *Class,const char *Txt); +static void Mch_PutFormCountdown (struct Match *Match,long Countdown,const char *Color); +static void Mch_PutHourglassIconAndCountdown (struct Match *Match); static void Mch_WriteNumRespondersQst (struct Match *Match); static void Mch_ShowRightColumnTch (const struct Match *Match); @@ -2283,65 +2287,25 @@ static void Mch_WriteElapsedTimeInQst (struct Match *Match) static void Mch_WriteHourglass (struct Match *Match) { - const char *Class; - const char *Icon; - /***** Start container *****/ HTM_DIV_Begin ("class=\"MCH_SHOW_HOURGLASS\""); /***** Put forms to start countdown *****/ - Mch_PutFormCountdown (Match,-1L,"MCH_GREEN" ," ∞ "); - Mch_PutFormCountdown (Match,60L,"MCH_LIMEGREEN"," 60″" ); - Mch_PutFormCountdown (Match,30L,"MCH_YELLOW" ," 30″" ); - Mch_PutFormCountdown (Match,10L,"MCH_RED" ," 10″" ); + Mch_PutFormCountdown (Match,-1 ,"MCH_GREEN" ); + Mch_PutFormCountdown (Match,Mch_COUNTDOWN_SECONDS_LARGE ,"MCH_LIMEGREEN"); + Mch_PutFormCountdown (Match,Mch_COUNTDOWN_SECONDS_MEDIUM,"MCH_YELLOW" ); + Mch_PutFormCountdown (Match,Mch_COUNTDOWN_SECONDS_SMALL ,"MCH_RED" ); - /***** Set hourglass icon depending on countdown *****/ - if (Match->Status.Showing == Mch_END) // Match over - { - Class = "BT_LINK_OFF MCH_BUTTON_HIDDEN MCH_GREEN"; - Icon = "fa-hourglass-start"; - } - else if (Match->Status.Countdown < 0) // No countdown - { - Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_GREEN"; - Icon = "fa-hourglass-start"; - } - else if (Match->Status.Countdown > 30) // Countdown in progress - { - Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_LIMEGREEN"; - Icon = "fa-hourglass-start"; - } - else if (Match->Status.Countdown > 10) // Countdown in progress - { - Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_YELLOW"; - Icon = "fa-hourglass-half"; - } - else // Countdown about to end - { - Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_RED"; - Icon = "fa-hourglass-end"; - } - - /***** Put icon with link *****/ - HTM_BR (); - HTM_DIV_Begin ("class=\"MCH_BIGBUTTON_CONT\""); - HTM_BUTTON_BUTTON_Begin ("Cuenta atrás",Class,NULL); // TODO: Need translation!!!! - HTM_TxtF ("",Icon); - HTM_BR (); - if (Match->Status.Countdown > 0) - HTM_TxtF (" %02ld″",Match->Status.Countdown); - else - HTM_NBSP (); - HTM_BUTTON_End (); - HTM_DIV_End (); + /***** Put icon hourglass and write countdown *****/ + Mch_PutHourglassIconAndCountdown (Match); /***** End container *****/ HTM_DIV_End (); } -static void Mch_PutFormCountdown (struct Match *Match,long Countdown, - const char *Color,const char *Txt) +static void Mch_PutFormCountdown (struct Match *Match,long Countdown,const char *Color) { + extern const char *Txt_Countdown; char *Class; bool PutForm = Match->Status.Showing != Mch_END; @@ -2365,12 +2329,19 @@ static void Mch_PutFormCountdown (struct Match *Match,long Countdown, /***** Put icon *****/ HTM_DIV_Begin ("class=\"MCH_SMALLBUTTON_CONT\""); + if (PutForm) - HTM_BUTTON_OnMouseDown_Begin ("Cuenta atrás",Class); // TODO: Need translation!!!! + HTM_BUTTON_OnMouseDown_Begin (Txt_Countdown,Class); else HTM_BUTTON_BUTTON_Begin (NULL,Class,NULL); - HTM_Txt (Txt); + + if (Countdown >= 0) + HTM_TxtF (" %ld″",Countdown); + else + HTM_Txt (" ∞ "); + HTM_BUTTON_End (); + HTM_DIV_End (); /***** Free class *****/ @@ -2381,6 +2352,57 @@ static void Mch_PutFormCountdown (struct Match *Match,long Countdown, Frm_EndForm (); } +static void Mch_PutHourglassIconAndCountdown (struct Match *Match) + { + extern const char *Txt_Countdown; + const char *Class; + const char *Icon; + + /***** Set hourglass icon depending on countdown *****/ + if (Match->Status.Showing == Mch_END) // Match over + { + Class = "BT_LINK_OFF MCH_BUTTON_HIDDEN MCH_GREEN"; + Icon = "fa-hourglass-start"; + } + else if (Match->Status.Countdown < 0) // No countdown + { + Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_GREEN"; + Icon = "fa-hourglass-start"; + } + else if (Match->Status.Countdown > Mch_COUNTDOWN_SECONDS_MEDIUM) // Countdown in progress + { + Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_LIMEGREEN"; + Icon = "fa-hourglass-start"; + } + else if (Match->Status.Countdown > Mch_COUNTDOWN_SECONDS_SMALL) // Countdown in progress + { + Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_YELLOW"; + Icon = "fa-hourglass-half"; + } + else // Countdown about to end + { + Class = "BT_LINK_OFF MCH_BUTTON_OFF MCH_RED"; + Icon = "fa-hourglass-end"; + } + + /***** Put hourglass icon with countdown *****/ + HTM_BR (); + HTM_DIV_Begin ("class=\"MCH_BIGBUTTON_CONT\""); + HTM_BUTTON_BUTTON_Begin (Txt_Countdown,Class,NULL); + HTM_TxtF ("",Icon); + HTM_BR (); + if (Match->Status.Countdown > 0) + HTM_TxtF (" %02ld″",Match->Status.Countdown); + else + HTM_NBSP (); + HTM_BUTTON_End (); + HTM_DIV_End (); + } + +/*****************************************************************************/ +/*************** Write number of responders to a match question **************/ +/*****************************************************************************/ + static void Mch_WriteNumRespondersQst (struct Match *Match) { extern const char *Txt_MATCH_respond; diff --git a/swad_text.c b/swad_text.c index d964bf9d8..3d0863edb 100644 --- a/swad_text.c +++ b/swad_text.c @@ -4816,6 +4816,28 @@ const char *Txt_Could_not_detect_any_face_in_front_position_ = "Não foi possível detectar nenhum rosto na posição frontal."; #endif + +const char *Txt_Countdown = +#if L==1 // ca + "Compte enrere"; +#elif L==2 // de + "Countdown"; +#elif L==3 // en + "Countdown"; +#elif L==4 // es + "Cuenta atrás"; +#elif L==5 // fr + "Compte à rebours"; +#elif L==6 // gn + "Cuenta atrás"; // Okoteve traducción +#elif L==7 // it + "Conto alla rovescia"; +#elif L==8 // pl + "Odliczanie"; +#elif L==9 // pt + "Contagem regressiva"; +#endif + const char *Txt_Countries = #if L==1 // ca "Països";