mirror of https://github.com/acanas/swad-core.git
Version19.155.2
This commit is contained in:
parent
bb8f30db9f
commit
e928853ba0
|
@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.155 (2020-03-26)"
|
#define Log_PLATFORM_VERSION "SWAD 19.155.2 (2020-03-26)"
|
||||||
#define CSS_FILE "swad19.146.css"
|
#define CSS_FILE "swad19.146.css"
|
||||||
#define JS_FILE "swad19.153.js"
|
#define JS_FILE "swad19.153.js"
|
||||||
/*
|
/*
|
||||||
|
@ -526,6 +526,7 @@ Param
|
||||||
|
|
||||||
// TODO: URGENT: Fix bug while playing match.
|
// TODO: URGENT: Fix bug while playing match.
|
||||||
|
|
||||||
|
Version 19.155.2 Mar 25, 2020 Code refactoring in tests. (284414 lines)
|
||||||
Version 19.155.1 Mar 25, 2020 Code refactoring in tests. (284430 lines)
|
Version 19.155.1 Mar 25, 2020 Code refactoring in tests. (284430 lines)
|
||||||
Version 19.155: Mar 25, 2020 Big code refactoring in pass to parameters of functions. (284446 lines)
|
Version 19.155: Mar 25, 2020 Big code refactoring in pass to parameters of functions. (284446 lines)
|
||||||
Version 19.154: Mar 25, 2020 Code refactoring in tests. (283385 lines)
|
Version 19.154: Mar 25, 2020 Code refactoring in tests. (283385 lines)
|
||||||
|
|
|
@ -1088,11 +1088,14 @@ void Par_PutHiddenParamChar (const char *ParamName,char Value)
|
||||||
/************************ Put a string hidden parameter **********************/
|
/************************ Put a string hidden parameter **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Par_PutHiddenParamString (const char *Id,const char *ParamName,const char *Value)
|
void Par_PutHiddenParamString (const char *Id,const char *ParamName,
|
||||||
|
const char *Value)
|
||||||
{
|
{
|
||||||
HTM_Txt ("<input type=\"hidden\"");
|
HTM_Txt ("<input type=\"hidden\"");
|
||||||
if (Id)
|
if (Id)
|
||||||
if (Id[0])
|
if (Id[0])
|
||||||
HTM_TxtF (" id=\"%s\"",Id);
|
HTM_TxtF (" id=\"%s\"",Id);
|
||||||
HTM_TxtF (" name=\"%s\" value=\"%s\" />",ParamName,Value);
|
HTM_TxtF (" name=\"%s\" value=\"%s\" />",
|
||||||
|
ParamName,Value ? Value :
|
||||||
|
"");
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ void Par_PutHiddenParamUnsigned (const char *Id,const char *ParamName,unsigned V
|
||||||
void Par_PutHiddenParamUnsignedDisabled (const char *Id,const char *ParamName,unsigned Value);
|
void Par_PutHiddenParamUnsignedDisabled (const char *Id,const char *ParamName,unsigned Value);
|
||||||
void Par_PutHiddenParamLong (const char *Id,const char *ParamName,long Value);
|
void Par_PutHiddenParamLong (const char *Id,const char *ParamName,long Value);
|
||||||
void Par_PutHiddenParamChar (const char *ParamName,char Value);
|
void Par_PutHiddenParamChar (const char *ParamName,char Value);
|
||||||
void Par_PutHiddenParamString (const char *Id,const char *ParamName,const char *Value);
|
void Par_PutHiddenParamString (const char *Id,const char *ParamName,
|
||||||
|
const char *Value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
399
swad_test.c
399
swad_test.c
|
@ -118,14 +118,14 @@ extern struct Globals Gbl;
|
||||||
/************************* Private global variables **************************/
|
/************************* Private global variables **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
struct Tst_Test Tst_ParamGblTest; // Used to pass parameters to functions
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Private prototypes ****************************/
|
/***************************** Private prototypes ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_ResetTest (struct Tst_Test *Test);
|
static void Tst_TstConstructor (struct Tst_Test *Test);
|
||||||
|
static void Tst_TstDestructor (struct Tst_Test *Test);
|
||||||
static void Tst_ResetTags (struct Tst_Tags *Tags);
|
static void Tst_ResetTags (struct Tst_Tags *Tags);
|
||||||
|
static void Tst_FreeTagsList (struct Tst_Tags *Tags);
|
||||||
|
|
||||||
static void Tst_ShowFormRequestTest (struct Tst_Test *Test);
|
static void Tst_ShowFormRequestTest (struct Tst_Test *Test);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ static void Tst_UpdateLastAccTst (unsigned NumQsts);
|
||||||
static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test);
|
static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test);
|
||||||
static void Tst_ShowFormRequestSelectTestsForGame (struct Tst_Test *Test);
|
static void Tst_ShowFormRequestSelectTestsForGame (struct Tst_Test *Test);
|
||||||
static bool Tst_CheckIfICanEditTests (void);
|
static bool Tst_CheckIfICanEditTests (void);
|
||||||
static void Tst_PutIconsTests (void *Args);
|
static void Tst_PutIconsTests (void *TestPtr);
|
||||||
static void Tst_PutButtonToAddQuestion (void);
|
static void Tst_PutButtonToAddQuestion (void);
|
||||||
|
|
||||||
static long Tst_GetParamTagCode (void);
|
static long Tst_GetParamTagCode (void);
|
||||||
|
@ -173,20 +173,16 @@ static void Tst_PutInputFieldNumQst (const char *Field,const char *Label,
|
||||||
static void Tst_ShowFormAnswerTypes (const struct Tst_AnswerTypes *AnswerTypes);
|
static void Tst_ShowFormAnswerTypes (const struct Tst_AnswerTypes *AnswerTypes);
|
||||||
static void Tst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res);
|
static void Tst_GetQuestions (struct Tst_Test *Test,MYSQL_RES **mysql_res);
|
||||||
static void Tst_GetQuestionsForTest (struct Tst_Test *Test,MYSQL_RES **mysql_res);
|
static void Tst_GetQuestionsForTest (struct Tst_Test *Test,MYSQL_RES **mysql_res);
|
||||||
static void Tst_ListOneQstToEdit (struct Tst_Test *Test,
|
static void Tst_ListOneQstToEdit (struct Tst_Test *Test);
|
||||||
struct Tst_Question *Question);
|
static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
|
||||||
static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Test *Test,
|
|
||||||
MYSQL_RES *mysql_res);
|
MYSQL_RES *mysql_res);
|
||||||
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test);
|
static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test);
|
||||||
static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
static void Tst_WriteQuestionRowForEdition (struct Tst_Test *Test,
|
||||||
unsigned NumQst,
|
unsigned NumQst);
|
||||||
struct Tst_Question *Question);
|
|
||||||
static void Tst_ListOneOrMoreQuestionsForSelection (unsigned NumQsts,
|
static void Tst_ListOneOrMoreQuestionsForSelection (unsigned NumQsts,
|
||||||
MYSQL_RES *mysql_res);
|
MYSQL_RES *mysql_res);
|
||||||
static void Tst_WriteQuestionRowForSelection (unsigned NumQst,long QstCod);
|
static void Tst_WriteQuestionRowForSelection (unsigned NumQst,long QstCod);
|
||||||
|
|
||||||
static void Tst_ResetParamGblTest (void);
|
|
||||||
|
|
||||||
static void Tst_WriteAnswersTestToAnswer (unsigned NumQst,
|
static void Tst_WriteAnswersTestToAnswer (unsigned NumQst,
|
||||||
struct Tst_Question *Question,
|
struct Tst_Question *Question,
|
||||||
bool Shuffle);
|
bool Shuffle);
|
||||||
|
@ -261,8 +257,6 @@ static unsigned Tst_GetParamNumQsts (void);
|
||||||
static unsigned Tst_CountNumTagsInList (const struct Tst_Tags *Tags);
|
static unsigned Tst_CountNumTagsInList (const struct Tst_Tags *Tags);
|
||||||
static int Tst_CountNumAnswerTypesInList (const struct Tst_AnswerTypes *AnswerTypes);
|
static int Tst_CountNumAnswerTypesInList (const struct Tst_AnswerTypes *AnswerTypes);
|
||||||
|
|
||||||
static void Tst_FreeTagsList (struct Tst_Tags *Tags);
|
|
||||||
|
|
||||||
static void Tst_PutFormEditOneQst (const struct Tst_Question *Question,
|
static void Tst_PutFormEditOneQst (const struct Tst_Question *Question,
|
||||||
char Stem[Cns_MAX_BYTES_TEXT + 1],
|
char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||||
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
|
@ -294,10 +288,10 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt);
|
||||||
static long Tst_CreateNewTag (long CrsCod,const char *TagTxt);
|
static long Tst_CreateNewTag (long CrsCod,const char *TagTxt);
|
||||||
static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden);
|
static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden);
|
||||||
|
|
||||||
static void Tst_PutParamsRemoveSelectedQsts (void *Args);
|
static void Tst_PutParamsRemoveSelectedQsts (void *TestPtr);
|
||||||
static void Tst_PutIconToRemoveOneQst (void *QstCodPtr);
|
static void Tst_PutIconToRemoveOneQst (void *QstCodPtr);
|
||||||
static void Tst_PutParamsRemoveOnlyThisQst (void *QstCodPtr);
|
static void Tst_PutParamsRemoveOnlyThisQst (void *QstCodPtr);
|
||||||
static void Tst_PutParamsRemoveOneQstWhileEditing (void *QstCodPtr);
|
static void Tst_PutParamsRemoveOneQstWhileEditing (void *TestPtr);
|
||||||
static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod);
|
static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod);
|
||||||
|
|
||||||
static long Tst_GetQstCod (void);
|
static long Tst_GetQstCod (void);
|
||||||
|
@ -326,18 +320,21 @@ void Tst_RequestTest (void)
|
||||||
{
|
{
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
|
|
||||||
/***** Reset test *****/
|
/***** Create test *****/
|
||||||
Tst_ResetTest (&Test);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Show form to generate a self-assessment test *****/
|
/***** Show form to generate a self-assessment test *****/
|
||||||
Tst_ShowFormRequestTest (&Test);
|
Tst_ShowFormRequestTest (&Test);
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Reset answer types ****************************/
|
/***************************** Test constructor ******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_ResetTest (struct Tst_Test *Test)
|
static void Tst_TstConstructor (struct Tst_Test *Test)
|
||||||
{
|
{
|
||||||
/***** Reset tags *****/
|
/***** Reset tags *****/
|
||||||
Tst_ResetTags (&Test->Tags);
|
Tst_ResetTags (&Test->Tags);
|
||||||
|
@ -348,6 +345,22 @@ static void Tst_ResetTest (struct Tst_Test *Test)
|
||||||
|
|
||||||
/***** Reset selected order *****/
|
/***** Reset selected order *****/
|
||||||
Test->SelectedOrder = Tst_DEFAULT_ORDER;
|
Test->SelectedOrder = Tst_DEFAULT_ORDER;
|
||||||
|
|
||||||
|
/***** Question constructor *****/
|
||||||
|
Tst_QstConstructor (&Test->Question);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****************************** Test destructor ******************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Tst_TstDestructor (struct Tst_Test *Test)
|
||||||
|
{
|
||||||
|
/***** Question destructor *****/
|
||||||
|
Tst_QstDestructor (&Test->Question);
|
||||||
|
|
||||||
|
/***** Free tag list *****/
|
||||||
|
Tst_FreeTagsList (&Test->Tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -361,6 +374,19 @@ static void Tst_ResetTags (struct Tst_Tags *Tags)
|
||||||
Tags->List = NULL;
|
Tags->List = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Free memory allocated for the list of tags *****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Tst_FreeTagsList (struct Tst_Tags *Tags)
|
||||||
|
{
|
||||||
|
if (Tags->List)
|
||||||
|
{
|
||||||
|
free (Tags->List);
|
||||||
|
Tst_ResetTags (Tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************** Show form to generate a self-assessment test ****************/
|
/*************** Show form to generate a self-assessment test ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -378,9 +404,8 @@ static void Tst_ShowFormRequestTest (struct Tst_Test *Test)
|
||||||
TstCfg_GetConfigFromDB ();
|
TstCfg_GetConfigFromDB ();
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Tst_SetParamGblTest (Test);
|
|
||||||
Box_BoxBegin (NULL,Txt_Take_a_test,
|
Box_BoxBegin (NULL,Txt_Take_a_test,
|
||||||
Tst_PutIconsTests,(void *) &Gbl,
|
Tst_PutIconsTests,(void *) Test,
|
||||||
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Get tags *****/
|
/***** Get tags *****/
|
||||||
|
@ -457,6 +482,9 @@ void Tst_ShowNewTest (void)
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned NumAccessesTst;
|
unsigned NumAccessesTst;
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Read test configuration from database *****/
|
/***** Read test configuration from database *****/
|
||||||
TstCfg_GetConfigFromDB ();
|
TstCfg_GetConfigFromDB ();
|
||||||
|
|
||||||
|
@ -528,10 +556,10 @@ void Tst_ShowNewTest (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Tst_ShowFormRequestTest (&Test); // Show the form again
|
Tst_ShowFormRequestTest (&Test); // Show the form again
|
||||||
|
|
||||||
/***** Free memory used for by the list of tags *****/
|
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1373,11 +1401,14 @@ void Tst_RequestEditTests (void)
|
||||||
{
|
{
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
|
|
||||||
/***** Reset test *****/
|
/***** Create test *****/
|
||||||
Tst_ResetTest (&Test);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Show form to generate a self-assessment test *****/
|
/***** Show form to generate a self-assessment test *****/
|
||||||
Tst_ShowFormRequestEditTests (&Test);
|
Tst_ShowFormRequestEditTests (&Test);
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1403,9 +1434,8 @@ static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test)
|
||||||
Mnu_ContextMenuEnd ();
|
Mnu_ContextMenuEnd ();
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Tst_SetParamGblTest (Test);
|
|
||||||
Box_BoxBegin (NULL,Txt_List_edit_questions,
|
Box_BoxBegin (NULL,Txt_List_edit_questions,
|
||||||
Tst_PutIconsTests,(void *) &Gbl,
|
Tst_PutIconsTests,(void *) Test,
|
||||||
Hlp_ASSESSMENT_Tests_editing_questions,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests_editing_questions,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Get tags already present in the table of questions *****/
|
/***** Get tags already present in the table of questions *****/
|
||||||
|
@ -1455,11 +1485,14 @@ void Tst_RequestSelectTestsForGame (void)
|
||||||
{
|
{
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
|
|
||||||
/***** Reset test *****/
|
/***** Create test *****/
|
||||||
Tst_ResetTest (&Test);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Show form to select test for game *****/
|
/***** Show form to select test for game *****/
|
||||||
Tst_ShowFormRequestSelectTestsForGame (&Test); // No tags selected
|
Tst_ShowFormRequestSelectTestsForGame (&Test); // No tags selected
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1534,11 +1567,11 @@ static bool Tst_CheckIfICanEditTests (void)
|
||||||
/********************* Put contextual icons in tests *************************/
|
/********************* Put contextual icons in tests *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_PutIconsTests (void *Args)
|
static void Tst_PutIconsTests (void *TestPtr)
|
||||||
{
|
{
|
||||||
extern const char *Txt_New_question;
|
extern const char *Txt_New_question;
|
||||||
|
|
||||||
if (Args)
|
if (TestPtr)
|
||||||
{
|
{
|
||||||
if (Tst_CheckIfICanEditTests ())
|
if (Tst_CheckIfICanEditTests ())
|
||||||
{
|
{
|
||||||
|
@ -1551,7 +1584,7 @@ static void Tst_PutIconsTests (void *Args)
|
||||||
case ActChgShfTstQst: // Change shuffle of a question
|
case ActChgShfTstQst: // Change shuffle of a question
|
||||||
/***** Put form to remove selected test questions *****/
|
/***** Put form to remove selected test questions *****/
|
||||||
Ico_PutContextualIconToRemove (ActReqRemSevTstQst,
|
Ico_PutContextualIconToRemove (ActReqRemSevTstQst,
|
||||||
Tst_PutParamsRemoveSelectedQsts,(void *) &Gbl);
|
Tst_PutParamsRemoveSelectedQsts,TestPtr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -2115,16 +2148,19 @@ static void Tst_ShowFormConfigTst (void)
|
||||||
extern const char *Txt_Minimum_time_seconds_per_question_between_two_tests;
|
extern const char *Txt_Minimum_time_seconds_per_question_between_two_tests;
|
||||||
extern const char *Txt_Result_visibility;
|
extern const char *Txt_Result_visibility;
|
||||||
extern const char *Txt_Save_changes;
|
extern const char *Txt_Save_changes;
|
||||||
|
struct Tst_Test Test;
|
||||||
TstCfg_Pluggable_t Pluggable;
|
TstCfg_Pluggable_t Pluggable;
|
||||||
char StrMinTimeNxtTstPerQst[Cns_MAX_DECIMAL_DIGITS_ULONG + 1];
|
char StrMinTimeNxtTstPerQst[Cns_MAX_DECIMAL_DIGITS_ULONG + 1];
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Read test configuration from database *****/
|
/***** Read test configuration from database *****/
|
||||||
TstCfg_GetConfigFromDB ();
|
TstCfg_GetConfigFromDB ();
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Tst_ResetParamGblTest ();
|
|
||||||
Box_BoxBegin (NULL,Txt_Configure_tests,
|
Box_BoxBegin (NULL,Txt_Configure_tests,
|
||||||
Tst_PutIconsTests,(void *) &Gbl,
|
Tst_PutIconsTests,(void *) &Test,
|
||||||
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
|
@ -2218,6 +2254,9 @@ static void Tst_ShowFormConfigTst (void)
|
||||||
|
|
||||||
/***** End box *****/
|
/***** End box *****/
|
||||||
Box_BoxEnd ();
|
Box_BoxEnd ();
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2334,6 +2373,9 @@ void Tst_ListQuestionsToEdit (void)
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get parameters, query the database and list the questions *****/
|
/***** Get parameters, query the database and list the questions *****/
|
||||||
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
|
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
|
||||||
{
|
{
|
||||||
|
@ -2362,8 +2404,8 @@ void Tst_ListQuestionsToEdit (void)
|
||||||
/* Show the form again */
|
/* Show the form again */
|
||||||
Tst_ShowFormRequestEditTests (&Test);
|
Tst_ShowFormRequestEditTests (&Test);
|
||||||
|
|
||||||
/***** Free memory used by the list of tags *****/
|
/***** Destroy test *****/
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2375,6 +2417,9 @@ void Tst_ListQuestionsToSelect (void)
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get parameters, query the database and list the questions *****/
|
/***** Get parameters, query the database and list the questions *****/
|
||||||
if (Tst_GetParamsTst (&Test,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
|
if (Tst_GetParamsTst (&Test,Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
|
||||||
{
|
{
|
||||||
|
@ -2390,8 +2435,8 @@ void Tst_ListQuestionsToSelect (void)
|
||||||
/* Show the form again */
|
/* Show the form again */
|
||||||
Tst_ShowFormRequestSelectTestsForGame (&Test);
|
Tst_ShowFormRequestSelectTestsForGame (&Test);
|
||||||
|
|
||||||
/***** Free memory used by the list of tags *****/
|
/***** Destroy test *****/
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2668,8 +2713,7 @@ static void Tst_GetQuestionsForTest (struct Tst_Test *Test,MYSQL_RES **mysql_res
|
||||||
/*********************** List a test question for edition ********************/
|
/*********************** List a test question for edition ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_ListOneQstToEdit (struct Tst_Test *Test,
|
static void Tst_ListOneQstToEdit (struct Tst_Test *Test)
|
||||||
struct Tst_Question *Question)
|
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Tests;
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Questions;
|
extern const char *Txt_Questions;
|
||||||
|
@ -2678,9 +2722,8 @@ static void Tst_ListOneQstToEdit (struct Tst_Test *Test,
|
||||||
Test->NumQsts = 1;
|
Test->NumQsts = 1;
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Tst_SetParamGblTest (Test);
|
|
||||||
Box_BoxBegin (NULL,Txt_Questions,
|
Box_BoxBegin (NULL,Txt_Questions,
|
||||||
Tst_PutIconsTests,(void *) &Gbl,
|
Tst_PutIconsTests,(void *) Test,
|
||||||
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Write the heading *****/
|
||||||
|
@ -2688,7 +2731,7 @@ static void Tst_ListOneQstToEdit (struct Tst_Test *Test,
|
||||||
Tst_WriteHeadingRowQuestionsForEdition (Test);
|
Tst_WriteHeadingRowQuestionsForEdition (Test);
|
||||||
|
|
||||||
/***** Write question row *****/
|
/***** Write question row *****/
|
||||||
Tst_WriteQuestionRowForEdition (Test,0,Question);
|
Tst_WriteQuestionRowForEdition (Test,0);
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
|
@ -2727,19 +2770,17 @@ bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res)
|
||||||
/****************** List for edition one or more test questions **************/
|
/****************** List for edition one or more test questions **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Test *Test,
|
static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
|
||||||
MYSQL_RES *mysql_res)
|
MYSQL_RES *mysql_res)
|
||||||
{
|
{
|
||||||
extern const char *Hlp_ASSESSMENT_Tests;
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Questions;
|
extern const char *Txt_Questions;
|
||||||
unsigned NumQst;
|
unsigned NumQst;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
struct Tst_Question Question;
|
|
||||||
|
|
||||||
/***** Begin box *****/
|
/***** Begin box *****/
|
||||||
Tst_SetParamGblTest (Test);
|
|
||||||
Box_BoxBegin (NULL,Txt_Questions,
|
Box_BoxBegin (NULL,Txt_Questions,
|
||||||
Tst_PutIconsTests,(void *) &Gbl,
|
Tst_PutIconsTests,(void *) Test,
|
||||||
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Write the heading *****/
|
||||||
|
@ -2754,18 +2795,18 @@ static void Tst_ListOneOrMoreQuestionsForEdition (const struct Tst_Test *Test,
|
||||||
Gbl.RowEvenOdd = NumQst % 2;
|
Gbl.RowEvenOdd = NumQst % 2;
|
||||||
|
|
||||||
/***** Create test question *****/
|
/***** Create test question *****/
|
||||||
Tst_QstConstructor (&Question);
|
Tst_QstConstructor (&Test->Question);
|
||||||
|
|
||||||
/***** Get question code (row[0]) *****/
|
/***** Get question code (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Test->Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||||
|
|
||||||
/***** Write question row *****/
|
/***** Write question row *****/
|
||||||
Tst_WriteQuestionRowForEdition (Test,NumQst,&Question);
|
Tst_WriteQuestionRowForEdition (Test,NumQst);
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/***** Destroy test question *****/
|
||||||
Tst_QstDestructor (&Question);
|
Tst_QstDestructor (&Test->Question);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
|
@ -2818,8 +2859,7 @@ static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test)
|
||||||
{
|
{
|
||||||
Frm_StartForm (ActLstTstQst);
|
Frm_StartForm (ActLstTstQst);
|
||||||
Dat_WriteParamsIniEndDates ();
|
Dat_WriteParamsIniEndDates ();
|
||||||
Tst_SetParamGblTest (Test);
|
Tst_WriteParamEditQst (Test);
|
||||||
Tst_WriteParamEditQst ();
|
|
||||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order);
|
||||||
HTM_BUTTON_SUBMIT_Begin (Txt_TST_STR_ORDER_FULL[Order],"BT_LINK TIT_TBL",NULL);
|
HTM_BUTTON_SUBMIT_Begin (Txt_TST_STR_ORDER_FULL[Order],"BT_LINK TIT_TBL",NULL);
|
||||||
if (Order == Test->SelectedOrder)
|
if (Order == Test->SelectedOrder)
|
||||||
|
@ -2845,9 +2885,8 @@ static void Tst_WriteHeadingRowQuestionsForEdition (const struct Tst_Test *Test)
|
||||||
/********** Write question row in listing of questions for edition ***********/
|
/********** Write question row in listing of questions for edition ***********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
static void Tst_WriteQuestionRowForEdition (struct Tst_Test *Test,
|
||||||
unsigned NumQst,
|
unsigned NumQst)
|
||||||
struct Tst_Question *Question)
|
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
@ -2859,7 +2898,7 @@ static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
||||||
double TotalScoreThisQst;
|
double TotalScoreThisQst;
|
||||||
|
|
||||||
/***** Get and show question data *****/
|
/***** Get and show question data *****/
|
||||||
if (Tst_GetOneQuestionByCod (Question->QstCod,&mysql_res))
|
if (Tst_GetOneQuestionByCod (Test->Question.QstCod,&mysql_res))
|
||||||
{
|
{
|
||||||
/***** Get row from database *****/
|
/***** Get row from database *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -2883,31 +2922,30 @@ static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
||||||
|
|
||||||
/* Write icon to remove the question */
|
/* Write icon to remove the question */
|
||||||
Frm_StartForm (ActReqRemOneTstQst);
|
Frm_StartForm (ActReqRemOneTstQst);
|
||||||
Tst_PutParamQstCod ((void *) Question->QstCod);
|
Tst_PutParamQstCod ((void *) &Test->Question.QstCod);
|
||||||
if (Test->NumQsts == 1)
|
if (Test->NumQsts == 1)
|
||||||
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If there are only one row, don't list again after removing
|
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If there are only one row, don't list again after removing
|
||||||
Dat_WriteParamsIniEndDates ();
|
Dat_WriteParamsIniEndDates ();
|
||||||
Tst_SetParamGblTest (Test);
|
Tst_WriteParamEditQst (Test);
|
||||||
Tst_WriteParamEditQst ();
|
|
||||||
Ico_PutIconRemove ();
|
Ico_PutIconRemove ();
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/* Write icon to edit the question */
|
/* Write icon to edit the question */
|
||||||
Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL,
|
Ico_PutContextualIconToEdit (ActEdiOneTstQst,NULL,
|
||||||
Tst_PutParamQstCod,(void *) &Question->QstCod);
|
Tst_PutParamQstCod,(void *) &Test->Question.QstCod);
|
||||||
|
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Number of question and answer type (row[1]) */
|
/* Number of question and answer type (row[1]) */
|
||||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Tst_WriteNumQst (NumQst + 1);
|
Tst_WriteNumQst (NumQst + 1);
|
||||||
Question->Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
Test->Question.Answer.Type = Tst_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
|
||||||
Tst_WriteAnswerType (Question->Answer.Type);
|
Tst_WriteAnswerType (Test->Question.Answer.Type);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Question code */
|
/* Question code */
|
||||||
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
HTM_TxtF ("%ld ",Question->QstCod);
|
HTM_TxtF ("%ld ",Test->Question.QstCod);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Date (row[0] has the UTC date-time) */
|
/* Date (row[0] has the UTC date-time) */
|
||||||
|
@ -2924,19 +2962,18 @@ static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
||||||
|
|
||||||
/* Question tags */
|
/* Question tags */
|
||||||
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
Tst_GetAndWriteTagsQst (Question->QstCod);
|
Tst_GetAndWriteTagsQst (Test->Question.QstCod);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Shuffle (row[2]) */
|
/* Shuffle (row[2]) */
|
||||||
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||||
if (Question->Answer.Type == Tst_ANS_UNIQUE_CHOICE ||
|
if (Test->Question.Answer.Type == Tst_ANS_UNIQUE_CHOICE ||
|
||||||
Question->Answer.Type == Tst_ANS_MULTIPLE_CHOICE)
|
Test->Question.Answer.Type == Tst_ANS_MULTIPLE_CHOICE)
|
||||||
{
|
{
|
||||||
Frm_StartForm (ActChgShfTstQst);
|
Frm_StartForm (ActChgShfTstQst);
|
||||||
Tst_PutParamQstCod ((void *) Question->QstCod);
|
Tst_PutParamQstCod ((void *) &Test->Question.QstCod);
|
||||||
Dat_WriteParamsIniEndDates ();
|
Dat_WriteParamsIniEndDates ();
|
||||||
Tst_SetParamGblTest (Test);
|
Tst_WriteParamEditQst (Test);
|
||||||
Tst_WriteParamEditQst ();
|
|
||||||
if (Test->NumQsts == 1)
|
if (Test->NumQsts == 1)
|
||||||
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
|
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
|
||||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder);
|
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder);
|
||||||
|
@ -2954,15 +2991,15 @@ static void Tst_WriteQuestionRowForEdition (const struct Tst_Test *Test,
|
||||||
true); // Visible
|
true); // Visible
|
||||||
|
|
||||||
/***** Get and show media (row[5]) *****/
|
/***** Get and show media (row[5]) *****/
|
||||||
Question->Media.MedCod = Str_ConvertStrCodToLongCod (row[5]);
|
Test->Question.Media.MedCod = Str_ConvertStrCodToLongCod (row[5]);
|
||||||
Med_GetMediaDataByCod (&Question->Media);
|
Med_GetMediaDataByCod (&Test->Question.Media);
|
||||||
Med_ShowMedia (&Question->Media,
|
Med_ShowMedia (&Test->Question.Media,
|
||||||
"TEST_MED_EDIT_LIST_CONT",
|
"TEST_MED_EDIT_LIST_CONT",
|
||||||
"TEST_MED_EDIT_LIST");
|
"TEST_MED_EDIT_LIST");
|
||||||
|
|
||||||
/* Feedback (row[4]) and answers */
|
/* Feedback (row[4]) and answers */
|
||||||
Tst_WriteQstFeedback (row[4],"TEST_EDI_LIGHT");
|
Tst_WriteQstFeedback (row[4],"TEST_EDI_LIGHT");
|
||||||
Tst_WriteAnswersEdit (Question);
|
Tst_WriteAnswersEdit (&Test->Question);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Get number of hits
|
/* Get number of hits
|
||||||
|
@ -3212,62 +3249,15 @@ static void Tst_WriteQuestionRowForSelection (unsigned NumQst,long QstCod)
|
||||||
/*********** Write hidden parameters for edition of test questions ***********/
|
/*********** Write hidden parameters for edition of test questions ***********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tst_WriteParamEditQst (void)
|
void Tst_WriteParamEditQst (const struct Tst_Test *Test)
|
||||||
{
|
{
|
||||||
struct Tst_Test Test;
|
Par_PutHiddenParamChar ("AllTags",Test->Tags.All ? 'Y' :
|
||||||
|
'N');
|
||||||
Tst_GetParamGblTest (&Test);
|
Par_PutHiddenParamString (NULL,"ChkTag",Test->Tags.List ? Test->Tags.List :
|
||||||
|
"");
|
||||||
Par_PutHiddenParamChar ("AllTags",Test.Tags.All ? 'Y' :
|
Par_PutHiddenParamChar ("AllAnsTypes",Test->AnswerTypes.All ? 'Y' :
|
||||||
'N');
|
'N');
|
||||||
Par_PutHiddenParamString (NULL,"ChkTag",Test.Tags.List ? Test.Tags.List :
|
Par_PutHiddenParamString (NULL,"AnswerType",Test->AnswerTypes.List);
|
||||||
"");
|
|
||||||
Par_PutHiddenParamChar ("AllAnsTypes",Test.AnswerTypes.All ? 'Y' :
|
|
||||||
'N');
|
|
||||||
Par_PutHiddenParamString (NULL,"AnswerType",Test.AnswerTypes.List);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************* Function parameter with tags **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Tst_ResetParamGblTest (void)
|
|
||||||
{
|
|
||||||
Tst_ResetTest (&Tst_ParamGblTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tst_SetParamGblTest (const struct Tst_Test *TestSrc)
|
|
||||||
{
|
|
||||||
/***** Copy tags *****/
|
|
||||||
Tst_ParamGblTest.Tags.Num = TestSrc->Tags.Num;
|
|
||||||
Tst_ParamGblTest.Tags.All = TestSrc->Tags.All;
|
|
||||||
Tst_ParamGblTest.Tags.List = TestSrc->Tags.List;
|
|
||||||
/* It's not necessary to copy the Txt field */
|
|
||||||
|
|
||||||
/***** Copy answer types *****/
|
|
||||||
Tst_ParamGblTest.AnswerTypes.All = TestSrc->AnswerTypes.All;
|
|
||||||
Str_Copy (Tst_ParamGblTest.AnswerTypes.List,TestSrc->AnswerTypes.List,
|
|
||||||
Tst_MAX_BYTES_LIST_ANSWER_TYPES);
|
|
||||||
|
|
||||||
/***** Copy selected order *****/
|
|
||||||
Tst_ParamGblTest.SelectedOrder = TestSrc->SelectedOrder;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tst_GetParamGblTest (struct Tst_Test *TestDst)
|
|
||||||
{
|
|
||||||
/***** Copy tags *****/
|
|
||||||
TestDst->Tags.Num = Tst_ParamGblTest.Tags.Num;
|
|
||||||
TestDst->Tags.All = Tst_ParamGblTest.Tags.All;
|
|
||||||
TestDst->Tags.List = Tst_ParamGblTest.Tags.List;
|
|
||||||
/* It's not necessary to copy the Txt field */
|
|
||||||
|
|
||||||
/***** Copy answer types *****/
|
|
||||||
TestDst->AnswerTypes.All = Tst_ParamGblTest.AnswerTypes.All;
|
|
||||||
Str_Copy (TestDst->AnswerTypes.List,Tst_ParamGblTest.AnswerTypes.List,
|
|
||||||
Tst_MAX_BYTES_LIST_ANSWER_TYPES);
|
|
||||||
|
|
||||||
/***** Copy selected order *****/
|
|
||||||
TestDst->SelectedOrder = Tst_ParamGblTest.SelectedOrder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -5119,19 +5109,6 @@ static int Tst_CountNumAnswerTypesInList (const struct Tst_AnswerTypes *AnswerTy
|
||||||
return NumAnsTypes;
|
return NumAnsTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**************** Free memory allocated for the list of tags *****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Tst_FreeTagsList (struct Tst_Tags *Tags)
|
|
||||||
{
|
|
||||||
if (Tags->List)
|
|
||||||
{
|
|
||||||
free (Tags->List);
|
|
||||||
Tst_ResetTags (Tags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Show form to edit one test question ********************/
|
/******************** Show form to edit one test question ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -5212,7 +5189,7 @@ static void Tst_PutFormEditOneQst (const struct Tst_Question *Question,
|
||||||
if (Question->QstCod > 0) // The question already has assigned a code
|
if (Question->QstCod > 0) // The question already has assigned a code
|
||||||
{
|
{
|
||||||
Box_BoxBegin (NULL,Str_BuildStringLong (Txt_Question_code_X,Question->QstCod),
|
Box_BoxBegin (NULL,Str_BuildStringLong (Txt_Question_code_X,Question->QstCod),
|
||||||
Tst_PutIconToRemoveOneQst,NULL,
|
Tst_PutIconToRemoveOneQst,(void *) Question->QstCod,
|
||||||
Hlp_ASSESSMENT_Tests_writing_a_question,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Tests_writing_a_question,Box_NOT_CLOSABLE);
|
||||||
Str_FreeString ();
|
Str_FreeString ();
|
||||||
}
|
}
|
||||||
|
@ -5223,7 +5200,7 @@ static void Tst_PutFormEditOneQst (const struct Tst_Question *Question,
|
||||||
|
|
||||||
/***** Begin form *****/
|
/***** Begin form *****/
|
||||||
Frm_StartForm (ActRcvTstQst);
|
Frm_StartForm (ActRcvTstQst);
|
||||||
Tst_PutParamQstCod ((void *) Question->QstCod);
|
Tst_PutParamQstCod ((void *) &Question->QstCod);
|
||||||
|
|
||||||
/***** Begin table *****/
|
/***** Begin table *****/
|
||||||
HTM_TABLE_BeginPadding (2); // Table for this question
|
HTM_TABLE_BeginPadding (2); // Table for this question
|
||||||
|
@ -5677,7 +5654,7 @@ void Tst_QstDestructor (struct Tst_Question *Question)
|
||||||
|
|
||||||
bool Tst_AllocateTextChoiceAnswer (struct Tst_Question *Question,unsigned NumOpt)
|
bool Tst_AllocateTextChoiceAnswer (struct Tst_Question *Question,unsigned NumOpt)
|
||||||
{
|
{
|
||||||
Tst_FreeTagsList (&Question->Tags);
|
// Tst_FreeTagsList (&Question->Tags); // TODO: Necessary?
|
||||||
|
|
||||||
Tst_FreeTextChoiceAnswer (Question,NumOpt);
|
Tst_FreeTextChoiceAnswer (Question,NumOpt);
|
||||||
|
|
||||||
|
@ -6000,46 +5977,43 @@ static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *Unsigned
|
||||||
|
|
||||||
void Tst_ReceiveQst (void)
|
void Tst_ReceiveQst (void)
|
||||||
{
|
{
|
||||||
struct Tst_Question Question;
|
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
char Stem[Cns_MAX_BYTES_TEXT + 1];
|
char Stem[Cns_MAX_BYTES_TEXT + 1];
|
||||||
char Feedback[Cns_MAX_BYTES_TEXT + 1];
|
char Feedback[Cns_MAX_BYTES_TEXT + 1];
|
||||||
|
|
||||||
/***** Create test question *****/
|
/***** Create test *****/
|
||||||
Tst_QstConstructor (&Question);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get parameters of the question from form *****/
|
/***** Get parameters of the question from form *****/
|
||||||
Stem[0] = Feedback[0] = '\0';
|
Stem[0] = Feedback[0] = '\0';
|
||||||
Tst_GetQstFromForm (&Question,Stem,Feedback);
|
Tst_GetQstFromForm (&Test.Question,Stem,Feedback);
|
||||||
|
|
||||||
/***** Make sure that tags, text and answer are not empty *****/
|
/***** Make sure that tags, text and answer are not empty *****/
|
||||||
if (Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (&Question))
|
if (Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (&Test.Question))
|
||||||
{
|
{
|
||||||
/***** Move images to definitive directories *****/
|
/***** Move images to definitive directories *****/
|
||||||
Tst_MoveMediaToDefinitiveDirectories (&Question);
|
Tst_MoveMediaToDefinitiveDirectories (&Test.Question);
|
||||||
|
|
||||||
/***** Insert or update question, tags and answer in the database *****/
|
/***** Insert or update question, tags and answer in the database *****/
|
||||||
Tst_InsertOrUpdateQstTagsAnsIntoDB (&Question);
|
Tst_InsertOrUpdateQstTagsAnsIntoDB (&Test.Question);
|
||||||
|
|
||||||
/***** Show the question just inserted in the database *****/
|
/***** Show the question just inserted in the database *****/
|
||||||
Tst_ResetTest (&Test);
|
|
||||||
snprintf (Test.AnswerTypes.List,sizeof (Test.AnswerTypes.List),
|
snprintf (Test.AnswerTypes.List,sizeof (Test.AnswerTypes.List),
|
||||||
"%u",
|
"%u",
|
||||||
(unsigned) Question.Answer.Type);
|
(unsigned) Test.Question.Answer.Type);
|
||||||
Tst_ListOneQstToEdit (&Test,&Question);
|
Tst_ListOneQstToEdit (&Test);
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
|
||||||
}
|
}
|
||||||
else // Question is wrong
|
else // Question is wrong
|
||||||
{
|
{
|
||||||
/***** Whether images has been received or not, reset images *****/
|
/***** Whether images has been received or not, reset images *****/
|
||||||
Tst_ResetMediaOfQuestion (&Question);
|
Tst_ResetMediaOfQuestion (&Test.Question);
|
||||||
|
|
||||||
/***** Put form to edit question again *****/
|
/***** Put form to edit question again *****/
|
||||||
Tst_PutFormEditOneQst (&Question,Stem,Feedback);
|
Tst_PutFormEditOneQst (&Test.Question,Stem,Feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/***** Destroy test *****/
|
||||||
Tst_QstDestructor (&Question);
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6666,36 +6640,42 @@ void Tst_RequestRemoveSelectedQsts (void)
|
||||||
extern const char *Txt_Remove_questions;
|
extern const char *Txt_Remove_questions;
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
|
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters from the form
|
||||||
{
|
{
|
||||||
/***** Show question and button to remove question *****/
|
/***** Show question and button to remove question *****/
|
||||||
Tst_SetParamGblTest (&Test);
|
|
||||||
Ale_ShowAlertAndButton (ActRemSevTstQst,NULL,NULL,
|
Ale_ShowAlertAndButton (ActRemSevTstQst,NULL,NULL,
|
||||||
Tst_PutParamsRemoveSelectedQsts,(void *) &Gbl,
|
Tst_PutParamsRemoveSelectedQsts,(void *) &Test,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_questions,
|
Btn_REMOVE_BUTTON,Txt_Remove_questions,
|
||||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_selected_questions);
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_selected_questions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Ale_ShowAlert (Ale_ERROR,"Wrong parameters.");
|
Ale_ShowAlert (Ale_ERROR,"Wrong parameters.");
|
||||||
|
|
||||||
/***** Free memory used by the list of tags *****/
|
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
|
||||||
|
|
||||||
/***** Continue editing questions *****/
|
/***** Continue editing questions *****/
|
||||||
Tst_ListQuestionsToEdit ();
|
Tst_ListQuestionsToEdit ();
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Put parameters to remove selected questions ****************/
|
/**************** Put parameters to remove selected questions ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_PutParamsRemoveSelectedQsts (void *Args)
|
static void Tst_PutParamsRemoveSelectedQsts (void *TestPtr)
|
||||||
{
|
{
|
||||||
if (Args)
|
struct Tst_Test *Test;
|
||||||
|
|
||||||
|
if (TestPtr)
|
||||||
{
|
{
|
||||||
|
Test = (struct Tst_Test *) TestPtr;
|
||||||
|
|
||||||
Dat_WriteParamsIniEndDates ();
|
Dat_WriteParamsIniEndDates ();
|
||||||
Tst_WriteParamEditQst ();
|
Tst_WriteParamEditQst (Test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6712,6 +6692,9 @@ void Tst_RemoveSelectedQsts (void)
|
||||||
unsigned NumQst;
|
unsigned NumQst;
|
||||||
long QstCod;
|
long QstCod;
|
||||||
|
|
||||||
|
/***** Create test *****/
|
||||||
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters
|
if (Tst_GetParamsTst (&Test,Tst_EDIT_TEST)) // Get parameters
|
||||||
{
|
{
|
||||||
|
@ -6738,6 +6721,9 @@ void Tst_RemoveSelectedQsts (void)
|
||||||
/***** Write message *****/
|
/***** Write message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Questions_removed_X,Test.NumQsts);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Questions_removed_X,Test.NumQsts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Destroy test *****/
|
||||||
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6758,17 +6744,16 @@ void Tst_RequestRemoveOneQst (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
|
extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
|
||||||
extern const char *Txt_Remove_question;
|
extern const char *Txt_Remove_question;
|
||||||
struct Tst_Question Question;
|
|
||||||
bool EditingOnlyThisQst;
|
bool EditingOnlyThisQst;
|
||||||
struct Tst_Test Test;
|
struct Tst_Test Test;
|
||||||
|
|
||||||
/***** Create test question *****/
|
/***** Create test *****/
|
||||||
Tst_QstConstructor (&Question);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get main parameters from form *****/
|
/***** Get main parameters from form *****/
|
||||||
/* Get the question code */
|
/* Get the question code */
|
||||||
Question.QstCod = Tst_GetQstCod ();
|
Test.Question.QstCod = Tst_GetQstCod ();
|
||||||
if (Question.QstCod <= 0)
|
if (Test.Question.QstCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||||
|
|
||||||
/* Get a parameter that indicates whether it's necessary
|
/* Get a parameter that indicates whether it's necessary
|
||||||
|
@ -6781,26 +6766,23 @@ void Tst_RequestRemoveOneQst (void)
|
||||||
Lay_ShowErrorAndExit ("Wrong test parameters.");
|
Lay_ShowErrorAndExit ("Wrong test parameters.");
|
||||||
|
|
||||||
/***** Show question and button to remove question *****/
|
/***** Show question and button to remove question *****/
|
||||||
Tst_ResetParamGblTest ();
|
|
||||||
Ale_ShowAlertAndButton (ActRemOneTstQst,NULL,NULL,
|
Ale_ShowAlertAndButton (ActRemOneTstQst,NULL,NULL,
|
||||||
EditingOnlyThisQst ? Tst_PutParamsRemoveOnlyThisQst :
|
EditingOnlyThisQst ? Tst_PutParamsRemoveOnlyThisQst :
|
||||||
Tst_PutParamsRemoveOneQstWhileEditing,(void *) &Question.QstCod,
|
Tst_PutParamsRemoveOneQstWhileEditing,
|
||||||
|
EditingOnlyThisQst ? (void *) &Test.Question.QstCod :
|
||||||
|
(void *) &Test,
|
||||||
Btn_REMOVE_BUTTON,Txt_Remove_question,
|
Btn_REMOVE_BUTTON,Txt_Remove_question,
|
||||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
|
||||||
Question.QstCod);
|
Test.Question.QstCod);
|
||||||
|
|
||||||
/***** Continue editing questions *****/
|
/***** Continue editing questions *****/
|
||||||
if (EditingOnlyThisQst)
|
if (EditingOnlyThisQst)
|
||||||
{
|
Tst_ListOneQstToEdit (&Test);
|
||||||
Tst_ResetTest (&Test);
|
|
||||||
Tst_ListOneQstToEdit (&Test,&Question);
|
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Tst_ListQuestionsToEdit ();
|
Tst_ListQuestionsToEdit ();
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/***** Destroy test *****/
|
||||||
Tst_QstDestructor (&Question);
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6809,19 +6791,29 @@ void Tst_RequestRemoveOneQst (void)
|
||||||
|
|
||||||
static void Tst_PutParamsRemoveOnlyThisQst (void *QstCodPtr)
|
static void Tst_PutParamsRemoveOnlyThisQst (void *QstCodPtr)
|
||||||
{
|
{
|
||||||
Tst_PutParamQstCod (QstCodPtr);
|
if (QstCodPtr)
|
||||||
Par_PutHiddenParamChar ("OnlyThisQst",'Y');
|
{
|
||||||
|
Tst_PutParamQstCod (QstCodPtr);
|
||||||
|
Par_PutHiddenParamChar ("OnlyThisQst",'Y');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Put parameters to remove question when editing several questions ******/
|
/***** Put parameters to remove question when editing several questions ******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_PutParamsRemoveOneQstWhileEditing (void *QstCodPtr)
|
static void Tst_PutParamsRemoveOneQstWhileEditing (void *TestPtr)
|
||||||
{
|
{
|
||||||
Tst_PutParamQstCod (QstCodPtr);
|
struct Tst_Test *Test;
|
||||||
Dat_WriteParamsIniEndDates ();
|
|
||||||
Tst_WriteParamEditQst ();
|
if (TestPtr)
|
||||||
|
{
|
||||||
|
Test = (struct Tst_Test *) TestPtr;
|
||||||
|
|
||||||
|
Tst_PutParamQstCod ((void *) &Test->Question.QstCod);
|
||||||
|
Dat_WriteParamsIniEndDates ();
|
||||||
|
Tst_WriteParamEditQst (Test);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6895,17 +6887,16 @@ void Tst_ChangeShuffleQst (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled;
|
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled;
|
||||||
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling;
|
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling;
|
||||||
struct Tst_Question Question;
|
struct Tst_Test Test;
|
||||||
bool EditingOnlyThisQst;
|
bool EditingOnlyThisQst;
|
||||||
bool Shuffle;
|
bool Shuffle;
|
||||||
struct Tst_Test Test;
|
|
||||||
|
|
||||||
/***** Create test question *****/
|
/***** Create test *****/
|
||||||
Tst_QstConstructor (&Question);
|
Tst_TstConstructor (&Test);
|
||||||
|
|
||||||
/***** Get the question code *****/
|
/***** Get the question code *****/
|
||||||
Question.QstCod = Tst_GetQstCod ();
|
Test.Question.QstCod = Tst_GetQstCod ();
|
||||||
if (Question.QstCod <= 0)
|
if (Test.Question.QstCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||||
|
|
||||||
/***** Get a parameter that indicates whether it's necessary to continue listing the rest of questions ******/
|
/***** Get a parameter that indicates whether it's necessary to continue listing the rest of questions ******/
|
||||||
|
@ -6921,25 +6912,21 @@ void Tst_ChangeShuffleQst (void)
|
||||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
" WHERE QstCod=%ld AND CrsCod=%ld",
|
||||||
Shuffle ? 'Y' :
|
Shuffle ? 'Y' :
|
||||||
'N',
|
'N',
|
||||||
Question.QstCod,Gbl.Hierarchy.Crs.CrsCod);
|
Test.Question.QstCod,Gbl.Hierarchy.Crs.CrsCod);
|
||||||
|
|
||||||
/***** Write message *****/
|
/***** Write message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled :
|
Ale_ShowAlert (Ale_SUCCESS,Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled :
|
||||||
Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling,
|
Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling,
|
||||||
Question.QstCod);
|
Test.Question.QstCod);
|
||||||
|
|
||||||
/***** Continue editing questions *****/
|
/***** Continue editing questions *****/
|
||||||
if (EditingOnlyThisQst)
|
if (EditingOnlyThisQst)
|
||||||
{
|
Tst_ListOneQstToEdit (&Test);
|
||||||
Tst_ResetTest (&Test);
|
|
||||||
Tst_ListOneQstToEdit (&Test,&Question);
|
|
||||||
Tst_FreeTagsList (&Test.Tags);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Tst_ListQuestionsToEdit ();
|
Tst_ListQuestionsToEdit ();
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/***** Destroy test *****/
|
||||||
Tst_QstDestructor (&Question);
|
Tst_TstDestructor (&Test);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
22
swad_test.h
22
swad_test.h
|
@ -88,14 +88,6 @@ typedef enum
|
||||||
} Tst_QuestionsOrder_t;
|
} Tst_QuestionsOrder_t;
|
||||||
#define Tst_DEFAULT_ORDER Tst_ORDER_STEM
|
#define Tst_DEFAULT_ORDER Tst_ORDER_STEM
|
||||||
|
|
||||||
struct Tst_Test
|
|
||||||
{
|
|
||||||
struct Tst_Tags Tags;
|
|
||||||
struct Tst_AnswerTypes AnswerTypes;
|
|
||||||
Tst_QuestionsOrder_t SelectedOrder;
|
|
||||||
unsigned NumQsts;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Tst_Question
|
struct Tst_Question
|
||||||
{
|
{
|
||||||
long QstCod;
|
long QstCod;
|
||||||
|
@ -124,6 +116,15 @@ struct Tst_Question
|
||||||
} Answer;
|
} Answer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Tst_Test
|
||||||
|
{
|
||||||
|
struct Tst_Tags Tags; // Selected tags
|
||||||
|
struct Tst_AnswerTypes AnswerTypes; // Selected answer types
|
||||||
|
Tst_QuestionsOrder_t SelectedOrder; // Order for listing questions
|
||||||
|
unsigned NumQsts; // Number of questions
|
||||||
|
struct Tst_Question Question; // Selected / editing question
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Tst_SHOW_TEST_TO_ANSWER, // Showing a test to a student
|
Tst_SHOW_TEST_TO_ANSWER, // Showing a test to a student
|
||||||
|
@ -176,10 +177,7 @@ void Tst_RequestSelectTestsForGame (void);
|
||||||
void Tst_ListQuestionsToEdit (void);
|
void Tst_ListQuestionsToEdit (void);
|
||||||
void Tst_ListQuestionsToSelect (void);
|
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 (const struct Tst_Test *Test);
|
||||||
|
|
||||||
void Tst_SetParamGblTest (const struct Tst_Test *TestSrc);
|
|
||||||
void Tst_GetParamGblTest (struct Tst_Test *TestDst);
|
|
||||||
|
|
||||||
unsigned Tst_GetNumAnswersQst (long QstCod);
|
unsigned Tst_GetNumAnswersQst (long QstCod);
|
||||||
void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res,
|
void Tst_GetAnswersQst (struct Tst_Question *Question,MYSQL_RES **mysql_res,
|
||||||
|
|
|
@ -65,7 +65,7 @@ extern struct Globals Gbl;
|
||||||
/***************************** Private prototypes ****************************/
|
/***************************** Private prototypes ****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TsI_PutParamsExportQsts (void *Args);
|
static void TsI_PutParamsExportQsts (void *TestPtr);
|
||||||
static void TsI_PutCreateXMLParam (void);
|
static void TsI_PutCreateXMLParam (void);
|
||||||
|
|
||||||
static void TsI_ExportQuestion (long QstCod,FILE *FileXML);
|
static void TsI_ExportQuestion (long QstCod,FILE *FileXML);
|
||||||
|
@ -93,9 +93,8 @@ void TsI_PutFormToExportQuestions (const struct Tst_Test *Test)
|
||||||
extern const char *Txt_Export_questions;
|
extern const char *Txt_Export_questions;
|
||||||
|
|
||||||
/***** Put a link to create a file with questions *****/
|
/***** Put a link to create a file with questions *****/
|
||||||
Tst_SetParamGblTest (Test);
|
|
||||||
Lay_PutContextualLinkIconText (ActLstTstQst,NULL,
|
Lay_PutContextualLinkIconText (ActLstTstQst,NULL,
|
||||||
TsI_PutParamsExportQsts,(void *) &Gbl,
|
TsI_PutParamsExportQsts,(void *) &Test,
|
||||||
"file-import.svg",
|
"file-import.svg",
|
||||||
Txt_Export_questions);
|
Txt_Export_questions);
|
||||||
}
|
}
|
||||||
|
@ -104,17 +103,18 @@ void TsI_PutFormToExportQuestions (const struct Tst_Test *Test)
|
||||||
/****************** Put params to export test questions **********************/
|
/****************** Put params to export test questions **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TsI_PutParamsExportQsts (void *Args)
|
static void TsI_PutParamsExportQsts (void *TestPtr)
|
||||||
{
|
{
|
||||||
struct Tst_Test Test;
|
struct Tst_Test *Test;
|
||||||
|
|
||||||
if (Args)
|
if (TestPtr)
|
||||||
{
|
{
|
||||||
Tst_GetParamGblTest (&Test);
|
Test = (struct Tst_Test *) TestPtr;
|
||||||
|
|
||||||
Dat_WriteParamsIniEndDates ();
|
Dat_WriteParamsIniEndDates ();
|
||||||
Tst_WriteParamEditQst ();
|
Tst_WriteParamEditQst (Test);
|
||||||
Par_PutHiddenParamChar ("OnlyThisQst",'N');
|
Par_PutHiddenParamChar ("OnlyThisQst",'N');
|
||||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test.SelectedOrder);
|
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Test->SelectedOrder);
|
||||||
TsI_PutCreateXMLParam ();
|
TsI_PutCreateXMLParam ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue