diff --git a/css/swad18.138.css b/css/swad18.138.css index 0f7560922..8d9b11805 100644 --- a/css/swad18.138.css +++ b/css/swad18.138.css @@ -2596,6 +2596,7 @@ a:hover img.CENTRE_PHOTO_SHOW width:100%; height:60px; font-size:18pt; + text-align:center; border:1px solid pink; } .MATCH_TOP_LEFT @@ -2658,25 +2659,44 @@ a:hover img.CENTRE_PHOTO_SHOW .MATCH_BUTTON_LEFT_CONTAINER { + display:table-cell; box-sizing:border-box; float:left; width:50%; + height:200px; margin:0 auto; text-align:center; - border:1px solid red; + vertical-align:middle; + border:1px solid black; + font-size:48pt; } .MATCH_BUTTON_RIGHT_CONTAINER { + display:table-cell; box-sizing:border-box; float:left; width:50%; + height:200px; margin:0 auto; text-align:center; + vertical-align:middle; border:1px solid blue; + font-size:48pt; } + .MATCH_BUTTON { - font-size:12pt; + display:table-cell; + width:100%; + font-size:48pt; + text-align:center; + vertical-align:middle; + background:red; + margin:auto; + } +.MATCH_BUTTON a + { + text-decoration:none; } .MATCH_TCH_QST diff --git a/swad_changelog.h b/swad_changelog.h index e9da5eeaa..433a37fd6 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -460,10 +460,13 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.139.1 (2019-08-03)" +#define Log_PLATFORM_VERSION "SWAD 18.139.2 (2019-09-05)" #define CSS_FILE "swad18.138.css" #define JS_FILE "swad18.130.2.js" /* + Version 18.139.2: Sep 05, 2019 Number of match players is not displayed for students. + Changes in layout of matches buttons (not finished). + Display match elapsed time. (244306 lines) Version 18.139.1: Aug 03, 2019 Get elapsed time in a question and in a match. (244216 lines) Version 18.139: Aug 03, 2019 Time of current match and current match question are stored in database. (244150 lines) 1 change necessary in database: @@ -9838,7 +9841,7 @@ INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1051','es','N','Camb -------------------------------- - Versión 0.9: 21/sep/1999 Comienzo de la versión inicial. + Versión 0.9: 21/sep/1999 Comienzo de la versión inicial. -------------------------------- Versión 1.0: 1999-2000 Primera versión, que sólo incluía las fichas,las calificaciones y la descarga de documentos. Versión 1.1: 2000-2001 Incluía el envío automático de la foto. diff --git a/swad_game.c b/swad_game.c index 9aa96612e..f713d1f86 100644 --- a/swad_game.c +++ b/swad_game.c @@ -193,6 +193,8 @@ static void Gam_GetElapsedTimeInQuestion (struct Match *Match, char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); static void Gam_GetElapsedTimeInMatch (struct Match *Match, char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); +static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, + char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]); static void Gam_SetMatchStatusToPrevQuestion (struct Match *Match); static void Gam_SetMatchStatusToNextQuestion (struct Match *Match); @@ -3376,29 +3378,17 @@ static void Gam_GetElapsedTimeInQuestion (struct Match *Match, char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) { MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumRows; + /***** Query database *****/ NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get elapsed time", "SELECT ElapsedTime" " FROM gam_time" " WHERE MchCod=%ld AND QstInd=%u", Match->MchCod,Match->Status.QstInd); - if (NumRows) - { - row = mysql_fetch_row (mysql_res); - /* Get the elapsed time (row[0]) */ - if (strlen (row[0]) > 2 + 1 + 2 + 1 + 2) - Str_Copy (HHHMMSS,"+99:59:59", - Gam_MAX_BYTES_TITLE); - else - Str_Copy (HHHMMSS,row[0], - Gam_MAX_BYTES_TITLE); - } - else - Str_Copy (HHHMMSS,"00:00:00", - Gam_MAX_BYTES_TITLE); + /***** Get elapsed time from query result *****/ + Gam_GetElapsedTime (NumRows,mysql_res,HHHMMSS); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -3412,13 +3402,30 @@ static void Gam_GetElapsedTimeInMatch (struct Match *Match, char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) { MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumRows; + /***** Query database *****/ NumRows = (unsigned) DB_QuerySELECT (&mysql_res,"can not get elapsed time", "SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(ElapsedTime)))" " FROM gam_time WHERE MchCod=%ld", Match->MchCod); + + /***** Get elapsed time from query result *****/ + Gam_GetElapsedTime (NumRows,mysql_res,HHHMMSS); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + +/*****************************************************************************/ +/*********************** Get elapsed time in a match *************************/ +/*****************************************************************************/ + +static void Gam_GetElapsedTime (unsigned NumRows,MYSQL_RES *mysql_res, + char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]) + { + MYSQL_ROW row; + if (NumRows) { row = mysql_fetch_row (mysql_res); @@ -3434,9 +3441,6 @@ static void Gam_GetElapsedTimeInMatch (struct Match *Match, else Str_Copy (HHHMMSS,"00:00:00", Gam_MAX_BYTES_TITLE); - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); } /*****************************************************************************/ @@ -3693,6 +3697,7 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) extern const char *Txt_Answers; extern const char *Txt_Start; extern const char *Txt_Resume; + char HHHMMSS[3 + 1 + 2 + 1 + 2 + 1]; unsigned PrvQstInd; // Previous question index unsigned NxtQstInd; // Next question index unsigned NumQsts; @@ -3702,7 +3707,13 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) fprintf (Gbl.F.Out,"
"); /***** Top *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); + + /* Write elapsed time in match */ + Gam_GetElapsedTimeInMatch (Match,HHHMMSS); + fprintf (Gbl.F.Out,"%s",HHHMMSS); + + fprintf (Gbl.F.Out,"
"); /***** Write number of question *****/ NumQsts = Gam_GetNumQstsGame (Match->GamCod); @@ -3727,8 +3738,10 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) { if (Match->Status.ShowingAnswers) /* Put button to hide answers */ + // Gam_PutBigButton (ActCurMchTch,Match->MchCod, + // "step-backward.svg",Txt_Stem); Gam_PutBigButton (ActCurMchTch,Match->MchCod, - "step-backward.svg",Txt_Stem); + "⇤",Txt_Stem); else { /* Get index of the previous question */ @@ -3736,12 +3749,16 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) Match->Status.QstInd); if (PrvQstInd == 0) // There is not a previous question /* Put button to resume match before first question */ + // Gam_PutBigButton (ActPrvMchTch,Match->MchCod, + // "step-backward.svg",Txt_MATCH_Start); Gam_PutBigButton (ActPrvMchTch,Match->MchCod, - "step-backward.svg",Txt_MATCH_Start); + "⇤",Txt_MATCH_Start); else // There is a previous question /* Put button to show previous question */ + // Gam_PutBigButton (ActPrvMchTch,Match->MchCod, + // "step-backward.svg",Txt_Previous_QUESTION); Gam_PutBigButton (ActPrvMchTch,Match->MchCod, - "step-backward.svg",Txt_Previous_QUESTION); + "⇤",Txt_Previous_QUESTION); } } else // Not being played @@ -3750,8 +3767,10 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) } else // Finished /* Put button to show last question */ + // Gam_PutBigButton (ActPrvMchTch,Match->MchCod, + // "step-backward.svg",Txt_Previous_QUESTION); Gam_PutBigButton (ActPrvMchTch,Match->MchCod, - "step-backward.svg",Txt_Previous_QUESTION); + "⇤",Txt_Previous_QUESTION); fprintf (Gbl.F.Out,"
"); @@ -3769,25 +3788,37 @@ static void Gam_ShowLeftColumnTch (struct Match *Match) Match->Status.QstInd); if (NxtQstInd >= Gam_AFTER_LAST_QUESTION) // No more questions /* Put button to finish */ + // Gam_PutBigButton (ActNxtMchTch,Match->MchCod, + // "step-forward.svg",Txt_Finish); Gam_PutBigButton (ActNxtMchTch,Match->MchCod, - "step-forward.svg",Txt_Finish); + "⇥",Txt_Finish); else // There are more questions /* Put button to show next question */ + // Gam_PutBigButton (ActNxtMchTch,Match->MchCod, + // "step-forward.svg",Txt_Next_QUESTION); Gam_PutBigButton (ActNxtMchTch,Match->MchCod, - "step-forward.svg",Txt_Next_QUESTION); + "⇥",Txt_Next_QUESTION); } else /* Put button to show answers */ + // Gam_PutBigButton (ActNxtMchTch,Match->MchCod, + // "step-forward.svg",Txt_Answers); Gam_PutBigButton (ActNxtMchTch,Match->MchCod, - "step-forward.svg",Txt_Answers); + "⇥",Txt_Answers); } else /* Put button to start / resume match */ + // Gam_PutBigButton (ActCurMchTch, + // Match->MchCod, + // "play.svg", + // Match->Status.QstInd == 0 ? Txt_Start : + // Txt_Resume); Gam_PutBigButton (ActCurMchTch, Match->MchCod, - "play.svg", + "▸", Match->Status.QstInd == 0 ? Txt_Start : - Txt_Resume); + Txt_Resume); + fprintf (Gbl.F.Out,""); /* End buttons container */ @@ -3856,7 +3887,7 @@ static void Gam_ShowLeftColumnStd (struct Match *Match) fprintf (Gbl.F.Out,""); /***** Number of players *****/ - Gam_ShowNumPlayers (Match); + // Gam_ShowNumPlayers (Match); /***** End left container *****/ fprintf (Gbl.F.Out,""); @@ -4078,18 +4109,18 @@ static void Gam_ShowQuestionAndAnswersStd (struct Match *Match) /*****************************************************************************/ /*********************** Put a big button to do action ***********************/ /*****************************************************************************/ - +/* static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, const char *Icon,const char *Txt) { - /***** Start form *****/ + ***** Start form ***** Frm_StartForm (NextAction); Gam_PutParamMatchCod (MchCod); - /***** Put icon with link *****/ - /* Submitting onmousedown instead of default onclick + ***** Put icon with link ***** + * Submitting onmousedown instead of default onclick is necessary in order to be fast - and not lose clicks due to refresh */ + and not lose clicks due to refresh * fprintf (Gbl.F.Out,""); + ***** End form ***** + Frm_EndForm (); + } +*/ + +static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod, + const char *Icon,const char *Txt) + { + /***** Start form *****/ + Frm_StartForm (NextAction); + Gam_PutParamMatchCod (MchCod); + + /***** Put icon with link *****/ + /* Submitting onmousedown instead of default onclick + is necessary in order to be fast + and not lose clicks due to refresh */ + fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"", + Gbl.Form.Id); + fprintf (Gbl.F.Out,"%s",Icon); + fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
"); + /***** End form *****/ Frm_EndForm (); } - +/* static void Gam_PutBigButtonClose (void) { extern const char *Txt_Close; - /***** Put icon with link *****/ - /* onmousedown instead of default onclick + ***** Put icon with link ***** + * onmousedown instead of default onclick is necessary in order to be fast - and not lose clicks due to refresh */ + and not lose clicks due to refresh * fprintf (Gbl.F.Out,""); } +*/ + +static void Gam_PutBigButtonClose (void) + { + extern const char *Txt_Close; + + /***** Put icon with link *****/ + /* onmousedown instead of default onclick + is necessary in order to be fast + and not lose clicks due to refresh */ + // fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"%s","×"); + fprintf (Gbl.F.Out,""); + // fprintf (Gbl.F.Out,"
"); + } /*****************************************************************************/ /**************************** Remove old players *****************************/