Version18.135.7

This commit is contained in:
Antonio Cañas Vargas 2019-07-17 22:45:20 +02:00
parent 03cef107c6
commit 8826e77a50
5 changed files with 131 additions and 119 deletions

View File

@ -2563,20 +2563,20 @@ a:hover img.CENTRE_PHOTO_SHOW
vertical-align:top;
}
/********************************** Games ************************************/
.GAM_PLAY_CONTAINER
/********************************** Matches **********************************/
.MATCH_CONT
{
box-sizing:border-box;
display:table;
margin:5%;
width:90%;
}
.GAM_PLAY_CONTAINER_TOP
.MATCH_CONT_TOP
{
box-sizing:border-box;
}
.GAM_PLAY_TCH_NUM_QST
.MATCH_TCH_NUM_QST
{
width:15%;
float:left;
@ -2585,47 +2585,47 @@ a:hover img.CENTRE_PHOTO_SHOW
font-size:48pt;
font-weight:bold;
}
.GAM_PLAY_TCH_QST_CONTAINER
.MATCH_TCH_QST_CONTAINER
{
width:70%;
float:left;
}
.GAM_PLAY_TCH_NXT_CONTAINER
.MATCH_TCH_NXT_CONTAINER
{
width:15%;
float:left;
}
.GAM_PLAY_TCH_QST
.MATCH_TCH_QST
{
color:#202020;
font-size:24pt;
}
.GAM_PLAY_TCH_CONTINUE_CONTAINER
.MATCH_TCH_CONTINUE_CONTAINER
{
clear:all;
text-align:center;
}
.GAM_PLAY_TCH_CONTINUE_CONTAINER a
.MATCH_TCH_CONTINUE_CONTAINER a
{
text-decoration:none;
}
.GAM_PLAY_TCH_CONTINUE
.MATCH_TCH_CONTINUE
{
font-size:16pt;
}
.GAM_PLAY_STD_WAIT_CONTAINER
.MATCH_STD_WAIT_CONTAINER
{
box-sizing:border-box;
text-align:center;
}
.GAM_PLAY_STD_WAIT_IMAGE
.MATCH_STD_WAIT_IMAGE
{
box-sizing:border-box;
width:50%;
}
.GAM_PLAY_STD_NUM_QST
.MATCH_STD_NUM_QST
{
width:15%;
float:left;
@ -2634,18 +2634,18 @@ a:hover img.CENTRE_PHOTO_SHOW
font-size:48pt;
font-weight:bold;
}
.GAM_PLAY_STD_QST_CONTAINER
.MATCH_STD_QST_CONTAINER
{
width:85%;
float:left;
}
.GAM_PLAY_STD_QST
.MATCH_STD_QST
{
color:#202020;
font-size:24pt;
}
.GAM_PLAY_TCH_BUTTON
.MATCH_TCH_BUTTON
{
box-sizing:border-box;
width:64px;
@ -2661,12 +2661,12 @@ a:hover img.CENTRE_PHOTO_SHOW
line-height:normal;
white-space:nowrap;
}
.GAM_PLAY_STD_CELL
.MATCH_STD_CELL
{
text-align:center;
vertical-align:middle;
}
.GAM_PLAY_STD_BUTTON
.MATCH_STD_BUTTON
{
box-sizing:border-box;
width:80%;
@ -2682,7 +2682,7 @@ a:hover img.CENTRE_PHOTO_SHOW
line-height:normal;
white-space:nowrap;
}
.GAM_PLAY_STD_ANSWER_SELECTED
.MATCH_STD_ANSWER_SELECTED
{
box-shadow: 0px 0px 18px 12px rgba(0,128,0,1);
}

View File

@ -458,10 +458,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.135.5 (2019-07-17)"
#define CSS_FILE "swad18.132.2.css"
#define Log_PLATFORM_VERSION "SWAD 18.135.7 (2019-07-17)"
#define CSS_FILE "swad18.135.7.css"
#define JS_FILE "swad18.130.2.js"
/*
Version 18.135.7: Jul 17, 2019 CSS refactoring and translation in match playing. (243699 lines)
Version 18.135.6: Jul 17, 2019 Code refactoring in match playing. (243654 lines)
Version 18.135.5: Jul 17, 2019 Changes while removing a match. (243692 lines)
Version 18.135.4: Jul 17, 2019 Changes and bug fixing while removing a match. (243682 lines)
Version 18.135.3: Jul 17, 2019 Removed unused code in games.

View File

@ -151,7 +151,6 @@ static void Gam_RemAnswersOfAQuestion (long GamCod,unsigned QstInd);
static long Gam_GetQstCodFromQstInd (long GamCod,unsigned QstInd);
static unsigned Gam_GetMaxQuestionIndexInGame (long GamCod);
static unsigned Gam_GetFirstQuestionIndexInGame (long GamCod);
static unsigned Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd);
static unsigned Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd);
static void Gam_ListGameQuestions (struct Game *Game);
@ -186,6 +185,7 @@ static void Gam_PutFormNewMatch (struct Game *Game);
static long Gam_CreateMatch (long GamCod,char Title[Gam_MAX_BYTES_TITLE + 1]);
static void Gam_UpdateMatchBeingPlayed (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_PlayGameShowQuestionAndAnswers (struct Match *Match);
@ -1826,16 +1826,6 @@ static unsigned Gam_GetMaxQuestionIndexInGame (long GamCod)
return QstInd;
}
/*****************************************************************************/
/******************** Get first question index in a game *********************/
/*****************************************************************************/
static unsigned Gam_GetFirstQuestionIndexInGame (long GamCod)
{
return Gam_GetNextQuestionIndexInGame (GamCod,
0); // First index > 0
}
/*****************************************************************************/
/*********** Get previous question index to a given index in a game **********/
/*****************************************************************************/
@ -3281,9 +3271,9 @@ void Gam_RequestStartResumeMatchTch (void)
Gam_GetDataOfMatchByCod (&Match);
/***** Show current match status *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_CONT\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_CONTAINER_TOP\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT_TOP\">");
Gam_GetAndShowNumPlayersInMatch (Match.MchCod);
fprintf (Gbl.F.Out,"</div>");
@ -3372,7 +3362,6 @@ static void Gam_UpdateMatchBeingPlayed (struct Match *Match)
void Gam_ResumeMatchTch (void)
{
struct Match Match;
long NxtQstInd;
/***** Get data of the match from database *****/
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
@ -3382,33 +3371,18 @@ void Gam_ResumeMatchTch (void)
if (!Match.Status.Finished)
{
if (Match.Status.QstInd == 0) // Match has been created, but it has not started
{
/* Get index of the first question */
NxtQstInd = Gam_GetFirstQuestionIndexInGame (Match.GamCod);
if (NxtQstInd) // Not last question
{
Match.Status.QstInd = NxtQstInd; // Go to the next question
Match.Status.QstCod = Gam_GetQstCodFromQstInd (Match.GamCod,
Match.Status.QstInd);
Match.Status.Finished = false; // Match is not finished
}
else // No more questions
{
Match.Status.QstInd = 0; // No more questions
Match.Status.QstCod = -1L; // No more questions
Match.Status.Finished = true; // Match is finished
}
}
Match.Status.ShowingAnswers = false; // Don't show answers
Gam_SetMatchStatusToNextQuestion (&Match);
Match.Status.ShowingAnswers = false; // Don't show answers in any case
/* Update match status in database */
Gam_UpdateMatchBeingPlayed (&Match);
}
/***** Show current match status *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_CONT\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_CONTAINER_TOP\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT_TOP\">");
Gam_GetAndShowNumPlayersInMatch (Match.MchCod);
fprintf (Gbl.F.Out,"</div>");
@ -3424,7 +3398,6 @@ void Gam_ResumeMatchTch (void)
void Gam_NextStatusMatchTch (void)
{
struct Match Match;
long NxtQstInd;
/***** Get data of the match from database *****/
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
@ -3434,46 +3407,11 @@ void Gam_NextStatusMatchTch (void)
if (!Match.Status.Finished)
{
if (Match.Status.QstInd == 0) // Match has been created, but it has not started
{
/* Get index of the first question */
NxtQstInd = Gam_GetFirstQuestionIndexInGame (Match.GamCod);
if (NxtQstInd) // Not last question
{
Match.Status.QstInd = NxtQstInd; // Go to the next question
Match.Status.QstCod = Gam_GetQstCodFromQstInd (Match.GamCod,
Match.Status.QstInd);
Match.Status.Finished = false; // Match is not finished
}
else // No more questions
{
Match.Status.QstInd = 0; // No more questions
Match.Status.QstCod = -1L; // No more questions
Match.Status.Finished = true; // Match is finished
}
Match.Status.ShowingAnswers = false; // Don't show answers
}
Gam_SetMatchStatusToNextQuestion (&Match);
else // Match has started
{
if (Match.Status.ShowingAnswers) // Showing answers currently
{
/* Get index of the next question */
NxtQstInd = Gam_GetNextQuestionIndexInGame (Match.GamCod,
Match.Status.QstInd);
if (NxtQstInd) // Not last question
{
Match.Status.QstInd = NxtQstInd; // Go to the next question
Match.Status.QstCod = Gam_GetQstCodFromQstInd (Match.GamCod,
Match.Status.QstInd);
Match.Status.Finished = false; // Match is not finished
}
else // No more questions
{
Match.Status.QstInd = 0; // No more questions
Match.Status.QstCod = -1L; // No more questions
Match.Status.Finished = true; // Match is finished
}
Match.Status.ShowingAnswers = false; // Don't show answers
}
Gam_SetMatchStatusToNextQuestion (&Match);
else
{
Match.Status.Finished = false; // Match is not finished
@ -3486,9 +3424,9 @@ void Gam_NextStatusMatchTch (void)
}
/***** Show current match status *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_CONT\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_CONTAINER_TOP\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT_TOP\">");
Gam_GetAndShowNumPlayersInMatch (Match.MchCod);
fprintf (Gbl.F.Out,"</div>");
@ -3497,6 +3435,31 @@ void Gam_NextStatusMatchTch (void)
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/********************* Set match status to next question *********************/
/*****************************************************************************/
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match)
{
/***** Get index of the next question *****/
Match->Status.QstInd = Gam_GetNextQuestionIndexInGame (Match->GamCod,
Match->Status.QstInd);
if (Match->Status.QstInd) // Not last question
{
Match->Status.QstCod = Gam_GetQstCodFromQstInd (Match->GamCod,
Match->Status.QstInd);
Match->Status.Finished = false; // Match is not finished
}
else // No more questions
{
Match->Status.QstCod = -1L; // No more questions
Match->Status.Finished = true; // Match is finished
}
Match->Status.ShowingAnswers = false; // Don't show answers
}
/*****************************************************************************/
/******* Show current match status (number, question, answers, button) *******/
/*****************************************************************************/
@ -3524,12 +3487,13 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match)
static void Gam_ShowAlertFinishedMatch (void)
{
extern const char *Txt_Finished_match;
extern const char *Txt_Close;
/***** Show alert *****/
Ale_ShowAlert (Ale_INFO,Txt_Finished_match);
/***** Button to close browser tab *****/
Btn_PutCloseTabButton ("Cerrar"); // TODO: Need translation!!!!!
Btn_PutCloseTabButton (Txt_Close);
}
/*****************************************************************************/
@ -3561,17 +3525,17 @@ static void Gam_PlayGameShowQuestionAndAnswers (struct Match *Match)
/***** Show question *****/
/* Write number of question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_NUM_QST\">%u</div>",
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_NUM_QST\">%u</div>",
Match->Status.QstInd);
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_QST_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_QST_CONTAINER\">");
/* Get answer type (row[0]) */
Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[0]);
// TODO: Check that answer type is correct (unique choice)
/* Write stem (row[1]) */
Tst_WriteQstStem (row[1],"GAM_PLAY_TCH_QST");
Tst_WriteQstStem (row[1],"MATCH_TCH_QST");
/* Get media (row[2]) */
Gbl.Test.Media.MedCod = Str_ConvertStrCodToLongCod (row[2]);
@ -3588,12 +3552,12 @@ static void Gam_PlayGameShowQuestionAndAnswers (struct Match *Match)
Tst_WriteAnswersGameResult (Match->GamCod,
Match->Status.QstInd,
Match->Status.QstCod,
"GAM_PLAY_TCH_QST",false); // Don't show result
"MATCH_TCH_QST",false); // Don't show result
fprintf (Gbl.F.Out,"</div>");
/***** Put button to continue *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_NXT_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_NXT_CONTAINER\">");
if (Match->Status.ShowingAnswers)
{
/* Get index of the next question */
@ -3623,14 +3587,14 @@ static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod,
const char *Icon,const char *Txt)
{
/***** Start container for button *****/
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_TCH_CONTINUE_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_CONTINUE_CONTAINER\">");
/***** Start form *****/
Frm_StartForm (NextAction);
Gam_PutParamMatchCod (MchCod);
/***** Put icon with link *****/
Frm_LinkFormSubmit (Txt,"GAM_PLAY_TCH_CONTINUE ICO_HIGHLIGHT",NULL);
Frm_LinkFormSubmit (Txt,"MATCH_TCH_CONTINUE ICO_HIGHLIGHT",NULL);
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
" alt=\"%s\" title=\"%s\" class=\"ICO64x64\" />"
"<br />"
@ -3709,6 +3673,7 @@ static void Gam_RegisterMeAsPlayerInMatch (long MchCod)
static void Gam_GetAndShowNumPlayersInMatch (long MchCod)
{
extern const char *Txt_Players;
unsigned NumPlayers;
/***** Remove old players *****/
@ -3718,7 +3683,7 @@ static void Gam_GetAndShowNumPlayersInMatch (long MchCod)
NumPlayers = Gam_GetNumPlayers (MchCod);
/***** Show number of players *****/
fprintf (Gbl.F.Out,"Players: %u",NumPlayers); // TODO: Need translation!!!!!
fprintf (Gbl.F.Out,"%s: %u",Txt_Players,NumPlayers);
}
static unsigned Gam_GetNumPlayers (long MchCod)
@ -3764,7 +3729,7 @@ void Gam_ShowMatchToMeAsStd (void)
Gam_GetDataOfMatchByCod (&Match);
/***** Show current match status *****/
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_CONTAINER\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
Gam_ShowMatchStatusForStd (&Match);
fprintf (Gbl.F.Out,"</div>");
}
@ -3817,6 +3782,7 @@ void Gam_RefreshMatchStd (void)
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;
@ -3846,10 +3812,10 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
{
/***** Show question *****/
/* Write number of question */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_NUM_QST\">%u</div>",
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_NUM_QST\">%u</div>",
Match->Status.QstInd);
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_QST_CONTAINER\">");
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_QST_CONTAINER\">");
/* Write buttons for answers? */
if (Match->Status.ShowingAnswers)
@ -3904,7 +3870,7 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
/***** Write letter for this option *****/
/* Start table cell */
fprintf (Gbl.F.Out,"<td class=\"GAM_PLAY_STD_CELL\">");
fprintf (Gbl.F.Out,"<td class=\"MATCH_STD_CELL\">");
/* Form with button.
Sumitting onmousedown instead of default onclick
@ -3919,8 +3885,8 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
"return false;\" class=\"",
Gbl.Form.Id);
if (StdAnsInd == (int) NumOpt) // Student's answer
fprintf (Gbl.F.Out,"GAM_PLAY_STD_ANSWER_SELECTED ");
fprintf (Gbl.F.Out,"GAM_PLAY_STD_BUTTON BT_%c\">"
fprintf (Gbl.F.Out,"MATCH_STD_ANSWER_SELECTED ");
fprintf (Gbl.F.Out,"MATCH_STD_BUTTON BT_%c\">"
"%c"
"</button>",
'A' + (char) NumOpt,
@ -3945,12 +3911,14 @@ static void Gam_ShowMatchStatusForStd (struct Match *Match)
fprintf (Gbl.F.Out,"</div>");
}
else // Not being played
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_STD_WAIT_CONTAINER\">"
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_WAIT_CONTAINER\">"
"<img src=\"%s/wait.gif\""
" alt=\"Please wait...\" title=\"Please wait...\"" // TODO: Need translation!!!!!
" class=\"GAM_PLAY_STD_WAIT_IMAGE\" />"
" alt=\"%s\" title=\"%s\""
" class=\"MATCH_STD_WAIT_IMAGE\" />"
"</div>",
Cfg_URL_ICON_PUBLIC);
Cfg_URL_ICON_PUBLIC,
Txt_Please_wait_,
Txt_Please_wait_);
}
}
@ -4040,7 +4008,7 @@ void Gam_ReceiveQstAnsFromStd (void)
}
/***** Show current match status *****/
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"GAM_PLAY_CONTAINER\">");
fprintf (Gbl.F.Out,"<div id=\"game\" class=\"MATCH_CONT\">");
Gam_ShowMatchStatusForStd (&Match);
fprintf (Gbl.F.Out,"</div>");
}

View File

@ -1072,11 +1072,11 @@ static void Tst_WriteQstAndAnsTest (Tst_ActionToDoWithQuestions_t ActionToDoWith
break;
case Tst_SHOW_GAME_TO_ANSWER:
Tst_WriteAnswersGameResult (GamCod,NumQst,QstCod,
"GAM_PLAY_QST",false); // Don't show result
"MATCH_QST",false); // Don't show result
break;
case Tst_SHOW_GAME_RESULT:
Tst_WriteAnswersGameResult (GamCod,NumQst,QstCod,
"GAM_PLAY_QST",true); // Show result
"MATCH_QST",true); // Show result
break;
}
fprintf (Gbl.F.Out,"</td>"
@ -4113,7 +4113,7 @@ static void Tst_WriteChoiceAnsViewGame (long GamCod,unsigned QstInd,long QstCod,
Class,
'a' + (char) NumOpt);
else
fprintf (Gbl.F.Out,"GAM_PLAY_TCH_BUTTON BT_%c\">"
fprintf (Gbl.F.Out,"MATCH_TCH_BUTTON BT_%c\">"
"%c",
'A' + (char) NumOpt,
'a' + (char) NumOpt);

View File

@ -29051,7 +29051,7 @@ const char *Txt_PLACES_ORDER[Plc_NUM_ORDERS] =
#endif
};
const char *Txt_Play = // To play a game
const char *Txt_Play = // To play a game match
#if L==1 // ca
"Jugar";
#elif L==2 // de
@ -29072,6 +29072,27 @@ const char *Txt_Play = // To play a game
"Jogar";
#endif
const char *Txt_Players = // Match players
#if L==1 // ca
"Jugadors";
#elif L==2 // de
"Spieler";
#elif L==3 // en
"Players";
#elif L==4 // es
"Jugadores";
#elif L==5 // fr
"Joueurs";
#elif L==6 // gn
"Jugadores"; // Okoteve traducción
#elif L==7 // it
"Giocatori";
#elif L==8 // pl
"Gracze";
#elif L==9 // pt
"Jogadores";
#endif
const char *Txt_Please_check_your_email_address =
#if L==1 // ca
"Si us plau, comproveu la seva adre&ccedil;a de correu.";
@ -29415,6 +29436,27 @@ const char *Txt_Please_specify_if_you_allow_access_to_test_questions_from_mobile
" para perguntas de teste de aplicativos para dispositivos m&oacute;veis.";
#endif
const char *Txt_Please_wait_ =
#if L==1 // ca
"Espereu, si us plau&hellip;";
#elif L==2 // de
"Warten Sie bitte&hellip;";
#elif L==3 // en
"Please wait&hellip;";
#elif L==4 // es
"Espere, por favor&hellip;";
#elif L==5 // fr
"Attendez s'il vous pla&icirc;t&hellip;";
#elif L==6 // gn
"Espere, por favor&hellip;"; // Okoteve traducción
#elif L==7 // it
"Aspetta, per favore&hellip;";
#elif L==8 // pl
"Prosz&eogon; czeka&cacute;&hellip;";
#elif L==9 // pt
"Espere, por favor&hellip;";
#endif
const char *Txt_Plugin =
#if L==1 // ca
"Complement";