Version 17.0.4

This commit is contained in:
Antonio Cañas Vargas 2017-09-15 11:39:02 +02:00
parent f63a0c9b90
commit e9e23d3fdf
5 changed files with 72 additions and 38 deletions

View File

@ -2258,9 +2258,9 @@ a:hover img.CENTRE_PHOTO_SHOW
.TAG_SEL {box-sizing:border-box; width:346px;} .TAG_SEL {box-sizing:border-box; width:346px;}
.TAG_TXT {box-sizing:border-box; width:346px;} .TAG_TXT {box-sizing:border-box; width:346px;}
.STEM {box-sizing:border-box; width:700px;} .STEM {box-sizing:border-box; width:700px;}
.ANS {color:#404040; font-size:13pt; font-weight:bold;} .ANS {color:#404040; font-size:12pt;}
.ANS_OK {color:#008000; font-size:13pt; font-weight:bold;} .ANS_OK {color:#008000; font-size:12pt; font-weight:bold;}
.ANS_BAD {color:red; font-size:13pt; font-weight:bold;} .ANS_BAD {color:red; font-size:12pt; font-weight:bold;}
.ANS_STR {box-sizing:border-box; width:600px;} .ANS_STR {box-sizing:border-box; width:600px;}
.TEST_SUBTITLE .TEST_SUBTITLE
{ {
@ -2271,7 +2271,6 @@ a:hover img.CENTRE_PHOTO_SHOW
vertical-align:middle; vertical-align:middle;
} }
.TEST_NUM_QST {color:#808080; font-size:20pt; font-weight:bold;} .TEST_NUM_QST {color:#808080; font-size:20pt; font-weight:bold;}
.TEST {color:#404040; font-size:12pt;}
.TEST_EXA {color:#404040; font-size:12pt;} .TEST_EXA {color:#404040; font-size:12pt;}
.TEST_EXA_LIGHT {color:#A0A0A0; font-size:12pt;} .TEST_EXA_LIGHT {color:#A0A0A0; font-size:12pt;}
.TEST_EDI {color:#404040; font-size:12pt;} .TEST_EDI {color:#404040; font-size:12pt;}

View File

@ -232,6 +232,8 @@
// TODO: Cuando sólo se cambian los grupos y no el rol de un profesor ya existente, no sale ningún mensaje. se haga lo que se haga en la edición debería salir un mensaje del tipo "Cambios realizados" // TODO: Cuando sólo se cambian los grupos y no el rol de un profesor ya existente, no sale ningún mensaje. se haga lo que se haga en la edición debería salir un mensaje del tipo "Cambios realizados"
// TODO: Debería haber un modo "ver" en las actividades, como en los documentos, para que el profesor tenga la visión del estudiante.
// TODO: "Solicitar inscripción" como superusuario: "Usted no tiene permiso para realizar esta acción" // TODO: "Solicitar inscripción" como superusuario: "Usted no tiene permiso para realizar esta acción"
// TODO: Poner icono con enlace a días festivos en calendario de centro, titulación y asignatura, además del actual calendario de institución // TODO: Poner icono con enlace a días festivos en calendario de centro, titulación y asignatura, además del actual calendario de institución
@ -250,13 +252,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 17.0.3 (2017-09-14)" #define Log_PLATFORM_VERSION "SWAD 17.0.4 (2017-09-15)"
#define CSS_FILE "swad17.0.css" #define CSS_FILE "swad17.0.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 17.0.4: Sep 14, 2017 Show current question with answers when playing a game. (227379 lines)
Version 17.0.3: Sep 14, 2017 Action to show current question with answers when playing a game. (227350 lines) Version 17.0.3: Sep 14, 2017 Action to show current question with answers when playing a game. (227350 lines)
1 change necessary in database: 1 change necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1673','es','N','Mostrar respuestas de pregunta juego'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1673','es','N','Mostrar respuestas de pregunta juego');

View File

@ -2954,7 +2954,8 @@ static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game,
"TEST_IMG_EDIT_LIST_STEM_CONTAINER", "TEST_IMG_EDIT_LIST_STEM_CONTAINER",
"TEST_IMG_EDIT_LIST_STEM"); "TEST_IMG_EDIT_LIST_STEM");
Tst_WriteQstFeedback (row[3],"TEST_EDI_LIGHT"); Tst_WriteQstFeedback (row[3],"TEST_EDI_LIGHT");
Tst_WriteAnswersGameResult (Game,NumQst,QstCod); Tst_WriteAnswersGameResult (Game,NumQst,QstCod,
"TEST_EDI",true); // Show result
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
@ -3535,12 +3536,13 @@ void Gam_PlayGameShowAnswers (void)
static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers) static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
{ {
char Query[256]; char Query[512];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
struct Game Game; struct Game Game;
unsigned QstInd; unsigned QstInd;
int NxtQstInd; int NxtQstInd;
long QstCod;
/***** Get parameters *****/ /***** Get parameters *****/
/* Get game code */ /* Get game code */
@ -3552,14 +3554,17 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
/***** Get data of question from database *****/ /***** Get data of question from database *****/
/* /*
row[0] QstCod row[0] AnsType
row[1] Stem row[1] QstCod
row[2] ImageName row[2] Stem
row[3] ImageTitle row[3] ImageName
row[4] ImageURL row[4] ImageTitle
row[5] ImageURL
*/ */
sprintf (Query,"SELECT tst_questions.QstCod," sprintf (Query,"SELECT "
"tst_questions.Stem," "tst_questions.QstCod,"
"tst_questions.AnsType,"
"tst_questions.Stem,"
"tst_questions.ImageName," "tst_questions.ImageName,"
"tst_questions.ImageTitle," "tst_questions.ImageTitle,"
"tst_questions.ImageURL" "tst_questions.ImageURL"
@ -3580,15 +3585,28 @@ static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers)
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_NUM_QST\">%u</div>", fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_NUM_QST\">%u</div>",
QstInd + 1); QstInd + 1);
/* Write the stem (row[1]) and the image (row[2], row[3], row[4]) */ /* Write the stem (row[2]) and the image (row[3], row[4], row[5]) */
fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">"); fprintf (Gbl.F.Out,"<div class=\"GAM_PLAY_QST_CONTAINER\">");
Tst_WriteQstStem (row[1],"GAM_PLAY_QST"); Tst_WriteQstStem (row[2],"GAM_PLAY_QST");
Img_GetImageNameTitleAndURLFromRow (row[2],row[3],row[4],&Gbl.Test.Image); Img_GetImageNameTitleAndURLFromRow (row[3],row[4],row[5],&Gbl.Test.Image);
Img_ShowImage (&Gbl.Test.Image, Img_ShowImage (&Gbl.Test.Image,
"TEST_IMG_EDIT_LIST_STEM_CONTAINER", "TEST_IMG_EDIT_LIST_STEM_CONTAINER",
"TEST_IMG_EDIT_LIST_STEM"); "TEST_IMG_EDIT_LIST_STEM");
/* Write answers? */
if (ShowAnswers) if (ShowAnswers)
fprintf (Gbl.F.Out,"answers"); {
/* Get question code (row[0]) */
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Lay_ShowErrorAndExit ("Error: wrong question code.");
/* Get answer type (row[1]) */
Gbl.Test.AnswerType = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
/* Write answers */
Tst_WriteAnswersGameResult (&Game,QstInd,QstCod,
"GAM_PLAY_QST",false); // Don't show result
}
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
/* End container for number and question */ /* End container for number and question */

View File

@ -204,7 +204,10 @@ static void Tst_WriteTFAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle); static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle);
static void Tst_WriteChoiceAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res, static void Tst_WriteChoiceAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
double *ScoreThisQst,bool *AnswerIsNotBlank); double *ScoreThisQst,bool *AnswerIsNotBlank);
static void Tst_WriteChoiceAnsViewGame (struct Game *Game,unsigned NumQst,long QstCod); static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
unsigned NumQst,long QstCod,
const char *Class,
bool ShowResult);
static void Tst_WriteTextAnsViewTest (unsigned NumQst); static void Tst_WriteTextAnsViewTest (unsigned NumQst);
static void Tst_WriteTextAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res, static void Tst_WriteTextAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
@ -1038,11 +1041,12 @@ void Tst_WriteQstAndAnsTest (Tst_ActionToDoWithQuestions_t ActionToDoWithQuestio
case Tst_SELECT_QUESTIONS_FOR_GAME: case Tst_SELECT_QUESTIONS_FOR_GAME:
break; break;
case Tst_SHOW_GAME_TO_ANSWER: case Tst_SHOW_GAME_TO_ANSWER:
// TODO: Change this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Tst_WriteAnswersGameResult (Game,NumQst,QstCod,
Tst_WriteAnswersTestToAnswer (NumQst,QstCod,(row[3][0] == 'Y')); "GAM_PLAY_QST",false); // Don't show result
break; break;
case Tst_SHOW_GAME_RESULT: case Tst_SHOW_GAME_RESULT:
Tst_WriteAnswersGameResult (Game,NumQst,QstCod); Tst_WriteAnswersGameResult (Game,NumQst,QstCod,
"GAM_PLAY_QST",true); // Show result
break; break;
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -3537,10 +3541,11 @@ static void Tst_WriteAnswersTestResult (unsigned NumQst,long QstCod,
/************** Write answers of a question when viewing a game **************/ /************** Write answers of a question when viewing a game **************/
/*****************************************************************************/ /*****************************************************************************/
void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod) void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod,
const char *Class,bool ShowResult)
{ {
/***** Write parameter with question code *****/ /***** Write parameter with question code *****/
Tst_WriteParamQstCod (NumQst,QstCod); // Tst_WriteParamQstCod (NumQst,QstCod);
/***** Write answer depending on type *****/ /***** Write answer depending on type *****/
switch (Gbl.Test.AnswerType) switch (Gbl.Test.AnswerType)
@ -3553,7 +3558,8 @@ void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod)
break; break;
case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_UNIQUE_CHOICE:
case Tst_ANS_MULTIPLE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE:
Tst_WriteChoiceAnsViewGame (Game,NumQst,QstCod); Tst_WriteChoiceAnsViewGame (Game,NumQst,QstCod,
Class,ShowResult);
break; break;
default: default:
break; break;
@ -3765,7 +3771,7 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
NumQst,NumOpt, NumQst,NumOpt,
NumQst,Index); NumQst,Index);
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"
"<label for=\"Ans%06u_%u\" class=\"TEST\">" "<label for=\"Ans%06u_%u\" class=\"ANS\">"
"%c)&nbsp;" "%c)&nbsp;"
"</label>" "</label>"
"</td>", "</td>",
@ -3774,7 +3780,7 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
/***** Write the option text *****/ /***** Write the option text *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"
"<label for=\"Ans%06u_%u\" class=\"TEST_EXA\">" "<label for=\"Ans%06u_%u\" class=\"ANS\">"
"%s" "%s"
"</label>", "</label>",
NumQst,NumOpt, NumQst,NumOpt,
@ -3940,14 +3946,14 @@ static void Tst_WriteChoiceAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
/* Answer letter (a, b, c,...) */ /* Answer letter (a, b, c,...) */
fprintf (Gbl.F.Out,"<td class=\"TEST LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"ANS LEFT_TOP\">"
"%c)&nbsp;" "%c)&nbsp;"
"</td>", "</td>",
'a' + (char) NumOpt); 'a' + (char) NumOpt);
/* Answer text and feedback */ /* Answer text and feedback */
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"
"<div class=\"TEST_EXA\">" "<div class=\"ANS\">"
"%s", "%s",
Gbl.Test.Answer.Options[Indexes[NumOpt]].Text); Gbl.Test.Answer.Options[Indexes[NumOpt]].Text);
Img_ShowImage (&Gbl.Test.Answer.Options[Indexes[NumOpt]].Image, Img_ShowImage (&Gbl.Test.Answer.Options[Indexes[NumOpt]].Image,
@ -4037,7 +4043,10 @@ static void Tst_WriteChoiceAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
/******** Write single or multiple choice answer when viewing a test *********/ /******** Write single or multiple choice answer when viewing a test *********/
/*****************************************************************************/ /*****************************************************************************/
static void Tst_WriteChoiceAnsViewGame (struct Game *Game,unsigned NumQst,long QstCod) static void Tst_WriteChoiceAnsViewGame (struct Game *Game,
unsigned NumQst,long QstCod,
const char *Class,
bool ShowResult)
{ {
unsigned NumOpt; unsigned NumOpt;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -4097,27 +4106,31 @@ static void Tst_WriteChoiceAnsViewGame (struct Game *Game,unsigned NumQst,long Q
/***** Write letter of this option *****/ /***** Write letter of this option *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_TOP\">" "<td class=\"LEFT_TOP\">"
"<label for=\"Ans%06u_%u\" class=\"TEST\">" "<label for=\"Ans%06u_%u\" class=\"%s\">"
"%c)&nbsp;" "%c)&nbsp;"
"</label>" "</label>"
"</td>", "</td>",
NumQst,NumOpt, NumQst,NumOpt,Class,
'a' + (char) NumOpt); 'a' + (char) NumOpt);
/***** Write the option text *****/ /***** Write the option text *****/
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP\">"
"<label for=\"Ans%06u_%u\" class=\"TEST_EXA\">" "<label for=\"Ans%06u_%u\" class=\"%s\">"
"%s" "%s"
"</label>", "</label>",
NumQst,NumOpt, NumQst,NumOpt,Class,
Gbl.Test.Answer.Options[NumOpt].Text); Gbl.Test.Answer.Options[NumOpt].Text);
Img_ShowImage (&Gbl.Test.Answer.Options[NumOpt].Image, Img_ShowImage (&Gbl.Test.Answer.Options[NumOpt].Image,
"TEST_IMG_SHOW_ANS_CONTAINER", "TEST_IMG_SHOW_ANS_CONTAINER",
"TEST_IMG_SHOW_ANS"); "TEST_IMG_SHOW_ANS");
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
/* Get number of users who selected this answer and draw proportional bar */ /***** Show result (number of users who answered? *****/
Gam_GetAndDrawBarNumUsrsWhoAnswered (Game,QstCod,AnsInd); if (ShowResult)
/* Get number of users who selected this answer
and draw proportional bar */
Gam_GetAndDrawBarNumUsrsWhoAnswered (Game,QstCod,AnsInd);
fprintf (Gbl.F.Out,"</tr>"); fprintf (Gbl.F.Out,"</tr>");
} }
@ -4259,7 +4272,7 @@ static void Tst_WriteTextAnsAssessTest (unsigned NumQst,MYSQL_RES *mysql_res,
NumOpt++) NumOpt++)
{ {
/* Answer letter (a, b, c,...) */ /* Answer letter (a, b, c,...) */
fprintf (Gbl.F.Out,"<td class=\"TEST LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"ANS LEFT_TOP\">"
"%c)&nbsp;" "%c)&nbsp;"
"</td>", "</td>",
'a' + (char) NumOpt); 'a' + (char) NumOpt);

View File

@ -158,7 +158,8 @@ void Tst_ListQuestionsToSelect (void);
bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res); bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res);
void Tst_WriteParamEditQst (void); void Tst_WriteParamEditQst (void);
unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle); unsigned Tst_GetAnswersQst (long QstCod,MYSQL_RES **mysql_res,bool Shuffle);
void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod); void Tst_WriteAnswersGameResult (struct Game *Game,unsigned NumQst,long QstCod,
const char *Class,bool ShowResult);
void Tst_WriteAnsTF (char AnsTF); void Tst_WriteAnsTF (char AnsTF);
void Tst_CheckIfNumberOfAnswersIsOne (void); void Tst_CheckIfNumberOfAnswersIsOne (void);