",
TxtButton);
}
+*/
diff --git a/swad_button.h b/swad_button.h
index 75de1d169..b69b7a5b1 100644
--- a/swad_button.h
+++ b/swad_button.h
@@ -55,6 +55,6 @@ void Btn_PutConfirmButton (const char *TxtButton);
void Btn_PutConfirmButtonInline (const char *TxtButton);
void Btn_PutRemoveButton (const char *TxtButton);
void Btn_PutRemoveButtonInline (const char *TxtButton);
-void Btn_PutCloseTabButton (const char *TxtButton);
+// void Btn_PutCloseTabButton (const char *TxtButton);
#endif
diff --git a/swad_changelog.h b/swad_changelog.h
index dd18777f6..999c4d7eb 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -458,10 +458,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 18.136.1 (2019-07-18)"
+#define Log_PLATFORM_VERSION "SWAD 18.136.2 (2019-07-18)"
#define CSS_FILE "swad18.136.css"
#define JS_FILE "swad18.130.2.js"
/*
+ Version 18.136.2: Jul 18, 2019 Changes in layout of match. (243895 lines)
Version 18.136.1: Jul 18, 2019 Changes in layout of match. (243853 lines)
Version 18.136: Jul 18, 2019 Changes in layout of match. (243767 lines)
Version 18.135.7: Jul 17, 2019 CSS refactoring and translation in match playing. (243699 lines)
diff --git a/swad_game.c b/swad_game.c
index 45f48b408..9f9b221bb 100644
--- a/swad_game.c
+++ b/swad_game.c
@@ -187,9 +187,12 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match);
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match);
static void Gam_ShowMatchStatusForTch (struct Match *Match);
-static void Gam_ShowAlertFinishedMatch (void);
+static void Gam_ShowMatchStatusForStd (struct Match *Match);
static void Gam_ShowBottonLeftColumnTch (struct Match *Match);
+static void Gam_ShowBottonLeftColumnStd (struct Match *Match);
static void Gam_ShowQuestionAndAnswersTch (struct Match *Match);
+static void Gam_ShowQuestionAndAnswersStd (struct Match *Match);
+
static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod,
const char *Icon,const char *Txt);
static void Gam_PutBigButtonClose (void);
@@ -2781,7 +2784,7 @@ static void Gam_ListOneOrMoreMatches (struct Game *Game,
extern const char *Txt_Match;
extern const char *Txt_Status;
extern const char *Txt_Play;
- extern const char *Txt_Resume_match;
+ extern const char *Txt_Resume;
extern const char *Txt_Today;
extern const char *Txt_View_game_results;
unsigned NumMatch;
@@ -2929,7 +2932,7 @@ static void Gam_ListOneOrMoreMatches (struct Game *Game,
Lay_PutContextualLinkOnlyIcon (ActResMchTch,NULL,
Gam_PutParamCurrentMchCod,
"play.svg",
- Txt_Resume_match);
+ Txt_Resume);
break;
default:
break;
@@ -3496,19 +3499,51 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match)
}
/*****************************************************************************/
-/********************* Show alert about finished match ***********************/
+/************ Show current question being played for a student ***************/
/*****************************************************************************/
-static void Gam_ShowAlertFinishedMatch (void)
+static void Gam_ShowMatchStatusForStd (struct Match *Match)
{
- extern const char *Txt_Finished_match;
- extern const char *Txt_Close;
+ extern const char *Txt_Please_wait_;
+ bool IBelongToGroups;
- /***** Show alert *****/
- Ale_ShowAlert (Ale_INFO,Txt_Finished_match);
+ /***** Do I belong to valid groups to play this match? *****/
+ IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
+ Gam_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
+ if (!IBelongToGroups)
+ Lay_ShowErrorAndExit ("You can not play this match!");
- /***** Button to close browser tab *****/
- Btn_PutCloseTabButton (Txt_Close);
+ /***** Bottom row *****/
+ /* Start bottom container */
+ fprintf (Gbl.F.Out,"
");
+
+ /* Show left column */
+ Gam_ShowBottonLeftColumnStd (Match);
+
+ /* Show right column */
+ fprintf (Gbl.F.Out,"
");
+ if (!Match->Status.Finished)
+ {
+ /***** Update players ******/
+ Gam_RegisterMeAsPlayerInMatch (Match->MchCod);
+
+ if (Match->Status.BeingPlayed)
+ /* Show current question and possible answers */
+ Gam_ShowQuestionAndAnswersStd (Match);
+ else // Not being played
+ fprintf (Gbl.F.Out,"
");
+ if (Match->Status.Finished)
+ /* Put button to close browser tab */
+ Gam_PutBigButtonClose ();
fprintf (Gbl.F.Out,"
"
"
");
@@ -3630,6 +3699,118 @@ static void Gam_ShowQuestionAndAnswersTch (struct Match *Match)
"MATCH_TCH_QST",false); // Don't show result
}
+/*****************************************************************************/
+/***** Show question and its answers when playing a match (as a student) *****/
+/*****************************************************************************/
+
+static void Gam_ShowQuestionAndAnswersStd (struct Match *Match)
+ {
+ bool Shuffle = false; // TODO: Read shuffle from question
+ MYSQL_RES *mysql_res;
+ MYSQL_ROW row;
+ int StdAnsInd;
+ unsigned NumOptions;
+ unsigned NumOpt;
+ unsigned Index;
+ bool ErrorInIndex = false;
+
+ /***** Show question *****/
+ fprintf (Gbl.F.Out,"
");
+
+ /* Write buttons for answers? */
+ if (Match->Status.ShowingAnswers)
+ {
+ if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
+ {
+ /***** Get student's answer to this question
+ (<0 ==> no answer) *****/
+ StdAnsInd = Gam_GetQstAnsFromDB (Match->MchCod,
+ Match->Status.QstInd);
+
+ /***** Get number of options in this question *****/
+ NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
+
+ /***** Get answers of question from database *****/
+ Shuffle = false;
+ NumOptions = Tst_GetAnswersQst (Match->Status.QstCod,&mysql_res,Shuffle);
+ /*
+ row[0] AnsInd
+ row[1] Answer
+ row[2] Feedback
+ row[3] MedCod
+ row[4] Correct
+ */
+
+ /***** Start table *****/
+ Tbl_StartTableWide (8);
+
+ for (NumOpt = 0;
+ NumOpt < NumOptions;
+ NumOpt++)
+ {
+ /***** Get next answer *****/
+ row = mysql_fetch_row (mysql_res);
+
+ /***** Assign index (row[0]).
+ Index is 0,1,2,3... if no shuffle
+ or 1,3,0,2... (example) if shuffle *****/
+ if (sscanf (row[0],"%u",&Index) == 1)
+ {
+ if (Index >= Tst_MAX_OPTIONS_PER_QUESTION)
+ ErrorInIndex = true;
+ }
+ else
+ ErrorInIndex = true;
+ if (ErrorInIndex)
+ Lay_ShowErrorAndExit ("Wrong index of answer when showing a test.");
+
+ /***** Start row *****/
+ // if (NumOpt % 2 == 0)
+ fprintf (Gbl.F.Out,"
");
+
+ /***** Write letter for this option *****/
+ /* Start table cell */
+ fprintf (Gbl.F.Out,"
");
+
+ /* Form with button.
+ Sumitting onmousedown instead of default onclick
+ is necessary in order to be fast
+ and not lose clicks due to refresh */
+ Frm_StartForm (ActAnsMchQstStd);
+ Gam_PutParamMatchCod (Match->MchCod); // Current match being played
+ Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
+ Gam_PutParamAnswer (Index); // Index for this option
+ fprintf (Gbl.F.Out,"",
+ 'A' + (char) NumOpt,
+ 'a' + (char) NumOpt);
+ Frm_EndForm ();
+
+ /* End table cell */
+ fprintf (Gbl.F.Out,"
");
+
+ /***** End row *****/
+ // if (NumOpt % 2 == 1)
+ fprintf (Gbl.F.Out,"
");
+ }
+
+ /***** End table *****/
+ Tbl_EndTable ();
+ }
+ else
+ Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
+ }
+
+ fprintf (Gbl.F.Out,"
");
+ }
+
/*****************************************************************************/
/*********************** Put a big button to do action ***********************/
/*****************************************************************************/
@@ -3797,6 +3978,10 @@ void Gam_ShowMatchToMeAsStd (void)
{
struct Match Match;
+ /***** Remove old players.
+ This function must be called before getting match status. *****/
+ Gam_RemoveOldPlayers ();
+
/***** Get data of the match from database *****/
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
Gam_GetDataOfMatchByCod (&Match);
@@ -3845,6 +4030,10 @@ void Gam_RefreshMatchStd (void)
if (!Gbl.Session.IsOpen) // If session has been closed, do not write anything
return;
+ /***** Remove old players.
+ This function must be called before getting match status. *****/
+ Gam_RemoveOldPlayers ();
+
/***** Get data of the match from database *****/
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
Gam_GetDataOfMatchByCod (&Match);
@@ -3853,151 +4042,6 @@ void Gam_RefreshMatchStd (void)
Gam_ShowMatchStatusForStd (&Match);
}
-/*****************************************************************************/
-/************ Show current question being played for a student ***************/
-/*****************************************************************************/
-
-static void Gam_ShowMatchStatusForStd (struct Match *Match)
- {
- extern const char *Txt_Please_wait_;
- bool IBelongToGroups;
- bool Shuffle = false; // TODO: Read shuffle from question
- MYSQL_RES *mysql_res;
- MYSQL_ROW row;
- int StdAnsInd;
- unsigned NumOptions;
- unsigned NumOpt;
- unsigned Index;
- bool ErrorInIndex = false;
-
- /***** Do I belong to valid groups to play this match? *****/
- IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
- Gam_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
- if (!IBelongToGroups)
- Lay_ShowErrorAndExit ("You can not play this match!");
-
- /***** Show current match status *****/
- if (Match->Status.Finished)
- Gam_ShowAlertFinishedMatch ();
- else // Unfinished match
- {
- /***** Update players ******/
- Gam_RegisterMeAsPlayerInMatch (Match->MchCod);
-
- if (Match->Status.BeingPlayed)
- {
- /***** Show question *****/
- /* Write number of question */
- fprintf (Gbl.F.Out,"
");
-
- /* Write buttons for answers? */
- if (Match->Status.ShowingAnswers)
- {
- if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
- {
- /***** Get student's answer to this question
- (<0 ==> no answer) *****/
- StdAnsInd = Gam_GetQstAnsFromDB (Match->MchCod,
- Match->Status.QstInd);
-
- /***** Get number of options in this question *****/
- NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
-
- /***** Get answers of question from database *****/
- Shuffle = false;
- NumOptions = Tst_GetAnswersQst (Match->Status.QstCod,&mysql_res,Shuffle);
- /*
- row[0] AnsInd
- row[1] Answer
- row[2] Feedback
- row[3] MedCod
- row[4] Correct
- */
-
- /***** Start table *****/
- Tbl_StartTableWide (8);
-
- for (NumOpt = 0;
- NumOpt < NumOptions;
- NumOpt++)
- {
- /***** Get next answer *****/
- row = mysql_fetch_row (mysql_res);
-
- /***** Assign index (row[0]).
- Index is 0,1,2,3... if no shuffle
- or 1,3,0,2... (example) if shuffle *****/
- if (sscanf (row[0],"%u",&Index) == 1)
- {
- if (Index >= Tst_MAX_OPTIONS_PER_QUESTION)
- ErrorInIndex = true;
- }
- else
- ErrorInIndex = true;
- if (ErrorInIndex)
- Lay_ShowErrorAndExit ("Wrong index of answer when showing a test.");
-
- /***** Start row *****/
- // if (NumOpt % 2 == 0)
- fprintf (Gbl.F.Out,"
");
-
- /***** Write letter for this option *****/
- /* Start table cell */
- fprintf (Gbl.F.Out,"
");
-
- /* Form with button.
- Sumitting onmousedown instead of default onclick
- is necessary in order to be fast
- and not lose clicks due to refresh */
- Frm_StartForm (ActAnsMchQstStd);
- Gam_PutParamMatchCod (Match->MchCod); // Current match being played
- Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
- Gam_PutParamAnswer (Index); // Index for this option
- fprintf (Gbl.F.Out,"",
- 'A' + (char) NumOpt,
- 'a' + (char) NumOpt);
- Frm_EndForm ();
-
- /* End table cell */
- fprintf (Gbl.F.Out,"
");
-
- /***** End row *****/
- // if (NumOpt % 2 == 1)
- fprintf (Gbl.F.Out,"
");
- }
-
- /***** End table *****/
- Tbl_EndTable ();
- }
- else
- Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
- }
-
- fprintf (Gbl.F.Out,"
");
- }
- else // Not being played
- fprintf (Gbl.F.Out,"
"
- ""
- "
",
- Cfg_URL_ICON_PUBLIC,
- Txt_Please_wait_,
- Txt_Please_wait_);
- }
- }
-
/*****************************************************************************/
/**** Receive previous question answer in a match question from database *****/
/*****************************************************************************/
@@ -4041,6 +4085,10 @@ void Gam_ReceiveQstAnsFromStd (void)
unsigned StdAnsInd;
int PreviousStdAnsInd;
+ /***** Remove old players.
+ This function must be called before getting match status. *****/
+ Gam_RemoveOldPlayers ();
+
/***** Get data of the match from database *****/
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
Gam_GetDataOfMatchByCod (&Match);
diff --git a/swad_text.c b/swad_text.c
index fea97047f..dd9829ead 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -12267,7 +12267,7 @@ const char *Txt_Finish =
#elif L==9 // pt
"Terminar";
#endif
-
+/*
const char *Txt_Finished_match =
#if L==1 // ca
"Partida finalitzada";
@@ -12288,7 +12288,7 @@ const char *Txt_Finished_match =
#elif L==9 // pt
"Jogo terminado";
#endif
-
+*/
const char *Txt_First_day_of_the_week =
#if L==1 // ca
"Primer dia de la setmana";
@@ -33193,25 +33193,25 @@ const char *Txt_results_per_page =
"resultados por página";
#endif
-const char *Txt_Resume_match =
+const char *Txt_Resume =
#if L==1 // ca
- "Reprendre partida";
+ "Reprendre";
#elif L==2 // de
- "Spiel fortsetzen";
+ "Fortsetzen";
#elif L==3 // en
- "Resume match";
+ "Resume";
#elif L==4 // es
- "Reanudar partida";
+ "Reanudar";
#elif L==5 // fr
- "Reprendre le match";
+ "Reprendre";
#elif L==6 // gn
- "Reanudar partida"; // Okoteve traducción
+ "Reanudar"; // Okoteve traducción
#elif L==7 // it
- "Riprendi la partita";
+ "Riprendi";
#elif L==8 // pl
- "Wznów mecz";
+ "Wznów";
#elif L==9 // pt
- "Retomar o jogo";
+ "Retomar";
#endif
const char *Txt_Retype_new_password =
@@ -41245,25 +41245,25 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
#endif
};
-const char *Txt_Start_match =
+const char *Txt_Start =
#if L==1 // ca
- "Començar partida";
+ "Començar";
#elif L==2 // de
- "Spiel starten";
+ "Starten";
#elif L==3 // en
- "Start match";
+ "Start";
#elif L==4 // es
- "Comenzar partida";
+ "Comenzar";
#elif L==5 // fr
- "Commencer le match";
+ "Commencer";
#elif L==6 // gn
- "Ñepyrũ ñembosarái";
+ "Ñepyrũ";
#elif L==7 // it
- "Inizia la partita";
+ "Inizia";
#elif L==8 // pl
- "Rozpocznij mecz";
+ "Rozpocznij";
#elif L==9 // pt
- "Começar o jogo";
+ "Começar";
#endif
const char *Txt_Statistic =