mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-10 10:45:23 +02:00
Version 16.56
This commit is contained in:
parent
1dd9989f45
commit
1568e5b965
|
@ -156,13 +156,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.55 (2016-11-13)"
|
#define Log_PLATFORM_VERSION "SWAD 16.56 (2016-11-13)"
|
||||||
#define CSS_FILE "swad16.51.css"
|
#define CSS_FILE "swad16.51.css"
|
||||||
#define JS_FILE "swad16.46.1.js"
|
#define JS_FILE "swad16.46.1.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 16.56: Nov 13, 2016 Contextual help on tests.
|
||||||
|
Change in layout of test import. (206935 lines)
|
||||||
Version 16.55: Nov 13, 2016 Contextual help on file zones. (206912 lines)
|
Version 16.55: Nov 13, 2016 Contextual help on file zones. (206912 lines)
|
||||||
Version 16.54.23: Nov 13, 2016 Contextual help on pending institutions, centres, degrees and courses. (206846 lines)
|
Version 16.54.23: Nov 13, 2016 Contextual help on pending institutions, centres, degrees and courses. (206846 lines)
|
||||||
Version 16.54.22: Nov 13, 2016 Contextual help on course information. (206832 lines)
|
Version 16.54.22: Nov 13, 2016 Contextual help on course information. (206832 lines)
|
||||||
|
|
|
@ -84,6 +84,9 @@ const char *Hlp_COURSE_Shared = WIKI "COURSE.Shared";
|
||||||
/***** ASSESSMENT tab *****/
|
/***** ASSESSMENT tab *****/
|
||||||
|
|
||||||
const char *Hlp_ASSESSMENT_Works = WIKI "ASSESSMENT.Works";
|
const char *Hlp_ASSESSMENT_Works = WIKI "ASSESSMENT.Works";
|
||||||
|
|
||||||
|
const char *Hlp_ASSESSMENT_Tests = WIKI "ASSESSMENT.Tests";
|
||||||
|
|
||||||
const char *Hlp_ASSESSMENT_Marks = WIKI "ASSESSMENT.Marks";
|
const char *Hlp_ASSESSMENT_Marks = WIKI "ASSESSMENT.Marks";
|
||||||
|
|
||||||
/***** STATS tab *****/
|
/***** STATS tab *****/
|
||||||
|
|
50
swad_test.c
50
swad_test.c
|
@ -275,6 +275,7 @@ static void Tst_GetExamQuestionsFromDB (long TstCod);
|
||||||
|
|
||||||
void Tst_ShowFormAskTst (void)
|
void Tst_ShowFormAskTst (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Take_a_test;
|
extern const char *Txt_Take_a_test;
|
||||||
extern const char *Txt_No_of_questions;
|
extern const char *Txt_No_of_questions;
|
||||||
|
@ -301,7 +302,8 @@ void Tst_ShowFormAskTst (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Take_a_test,Tst_PutIconsTests,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Take_a_test,
|
||||||
|
Tst_PutIconsTests,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Get tags *****/
|
/***** Get tags *****/
|
||||||
if ((NumRows = Tst_GetEnabledTagsFromThisCrs (&mysql_res)) != 0)
|
if ((NumRows = Tst_GetEnabledTagsFromThisCrs (&mysql_res)) != 0)
|
||||||
|
@ -380,6 +382,7 @@ static void Tst_PutFormToSeeResultsOfUsersTests (Act_Action_t Action)
|
||||||
|
|
||||||
void Tst_ShowNewTestExam (void)
|
void Tst_ShowNewTestExam (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_No_questions_found_matching_your_search_criteria;
|
extern const char *Txt_No_questions_found_matching_your_search_criteria;
|
||||||
extern const char *Txt_Test;
|
extern const char *Txt_Test;
|
||||||
|
@ -411,7 +414,7 @@ void Tst_ShowNewTestExam (void)
|
||||||
Tst_UpdateMyNumAccessTst (NumAccessesTst);
|
Tst_UpdateMyNumAccessTst (NumAccessesTst);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Test,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Test,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
@ -471,6 +474,7 @@ void Tst_ShowNewTestExam (void)
|
||||||
|
|
||||||
void Tst_AssessTestExam (void)
|
void Tst_AssessTestExam (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Test_result;
|
extern const char *Txt_Test_result;
|
||||||
extern const char *Txt_Test_No_X_that_you_make_in_this_course;
|
extern const char *Txt_Test_No_X_that_you_make_in_this_course;
|
||||||
extern const char *Txt_The_test_X_has_already_been_assessed_previously;
|
extern const char *Txt_The_test_X_has_already_been_assessed_previously;
|
||||||
|
@ -506,7 +510,7 @@ void Tst_AssessTestExam (void)
|
||||||
TstCod = Tst_CreateTestExamInDB ();
|
TstCod = Tst_CreateTestExamInDB ();
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Test_result,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Test_result,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
@ -612,6 +616,7 @@ static void Tst_ShowTstTotalMark (double TotalScore)
|
||||||
|
|
||||||
static bool Tst_CheckIfNextTstAllowed (void)
|
static bool Tst_CheckIfNextTstAllowed (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Test;
|
extern const char *Txt_Test;
|
||||||
extern const char *Txt_You_can_not_make_a_new_test_in_the_course_X_until;
|
extern const char *Txt_You_can_not_make_a_new_test_in_the_course_X_until;
|
||||||
extern const char *Txt_Today;
|
extern const char *Txt_Today;
|
||||||
|
@ -653,7 +658,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
|
||||||
if (NumSecondsFromNowToNextAccTst > 0)
|
if (NumSecondsFromNowToNextAccTst > 0)
|
||||||
{
|
{
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Test,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Test,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
@ -1236,6 +1241,7 @@ void Tst_SetIniEndDates (void)
|
||||||
|
|
||||||
void Tst_ShowFormAskEditTsts (void)
|
void Tst_ShowFormAskEditTsts (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_No_test_questions;
|
extern const char *Txt_No_test_questions;
|
||||||
extern const char *Txt_List_edit_questions;
|
extern const char *Txt_List_edit_questions;
|
||||||
extern const char *Txt_Show_questions;
|
extern const char *Txt_Show_questions;
|
||||||
|
@ -1248,7 +1254,8 @@ void Tst_ShowFormAskEditTsts (void)
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_List_edit_questions,Tst_PutIconsTests,NULL);
|
Lay_StartRoundFrame (NULL,Txt_List_edit_questions,
|
||||||
|
Tst_PutIconsTests,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Get tags already present in the table of questions *****/
|
/***** Get tags already present in the table of questions *****/
|
||||||
if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
|
if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
|
||||||
|
@ -1689,6 +1696,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
|
||||||
|
|
||||||
static void Tst_ShowFormEditTags (void)
|
static void Tst_ShowFormEditTags (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_No_test_questions;
|
extern const char *Txt_No_test_questions;
|
||||||
extern const char *Txt_Tags;
|
extern const char *Txt_Tags;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -1700,7 +1708,8 @@ static void Tst_ShowFormEditTags (void)
|
||||||
if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
|
if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
|
||||||
{
|
{
|
||||||
/***** Start table *****/
|
/***** Start table *****/
|
||||||
Lay_StartRoundFrameTable (NULL,2,Txt_Tags);
|
Lay_StartRoundFrame (NULL,Txt_Tags,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
|
||||||
|
|
||||||
/***** Show tags *****/
|
/***** Show tags *****/
|
||||||
for (NumRow = 0;
|
for (NumRow = 0;
|
||||||
|
@ -1792,6 +1801,7 @@ static void Tst_PutIconDisable (long TagCod,const char *TagTxt)
|
||||||
|
|
||||||
static void Tst_ShowFormConfigTst (void)
|
static void Tst_ShowFormConfigTst (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Configure_tests;
|
extern const char *Txt_Configure_tests;
|
||||||
extern const char *Txt_Plugins;
|
extern const char *Txt_Plugins;
|
||||||
|
@ -1811,7 +1821,8 @@ static void Tst_ShowFormConfigTst (void)
|
||||||
Tst_GetConfigTstFromDB ();
|
Tst_GetConfigTstFromDB ();
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Configure_tests,Tst_PutIconsTests,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Configure_tests,
|
||||||
|
Tst_PutIconsTests,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
Act_FormStart (ActRcvCfgTst);
|
Act_FormStart (ActRcvCfgTst);
|
||||||
|
@ -2640,6 +2651,7 @@ static bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res)
|
||||||
|
|
||||||
static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *mysql_res)
|
static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *mysql_res)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Questions;
|
extern const char *Txt_Questions;
|
||||||
extern const char *Txt_No_INDEX;
|
extern const char *Txt_No_INDEX;
|
||||||
extern const char *Txt_Code;
|
extern const char *Txt_Code;
|
||||||
|
@ -2662,7 +2674,8 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
|
||||||
double TotalScoreThisQst;
|
double TotalScoreThisQst;
|
||||||
|
|
||||||
/***** Table start *****/
|
/***** Table start *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Questions,Tst_PutIconsTests,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Questions,
|
||||||
|
Tst_PutIconsTests,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Write the heading *****/
|
||||||
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE_MARGIN CELLS_PAD_2\">"
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE_MARGIN CELLS_PAD_2\">"
|
||||||
|
@ -4408,6 +4421,7 @@ void Tst_ShowFormEditOneQst (void)
|
||||||
|
|
||||||
static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Question_code_X;
|
extern const char *Txt_Question_code_X;
|
||||||
extern const char *Txt_New_question;
|
extern const char *Txt_New_question;
|
||||||
|
@ -4445,10 +4459,11 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
||||||
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
|
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
|
||||||
{
|
{
|
||||||
sprintf (Title,Txt_Question_code_X,Gbl.Test.QstCod);
|
sprintf (Title,Txt_Question_code_X,Gbl.Test.QstCod);
|
||||||
Lay_StartRoundFrame (NULL,Title,Tst_PutIconToRemoveOneQst,NULL);
|
Lay_StartRoundFrame (NULL,Title,
|
||||||
|
Tst_PutIconToRemoveOneQst,Hlp_ASSESSMENT_Tests);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Lay_StartRoundFrame (NULL,Txt_New_question,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_New_question,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Start form *****/
|
/***** Start form *****/
|
||||||
Act_FormStart (ActRcvTstQst);
|
Act_FormStart (ActRcvTstQst);
|
||||||
|
@ -6917,6 +6932,7 @@ void Tst_SelUsrsToSeeUsrsExams (void)
|
||||||
|
|
||||||
void Tst_SelDatesToSeeMyExams (void)
|
void Tst_SelDatesToSeeMyExams (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Exams;
|
extern const char *Txt_Exams;
|
||||||
extern const char *Txt_See_exams;
|
extern const char *Txt_See_exams;
|
||||||
|
|
||||||
|
@ -6924,7 +6940,8 @@ void Tst_SelDatesToSeeMyExams (void)
|
||||||
Act_FormStart (ActSeeMyTstExa);
|
Act_FormStart (ActSeeMyTstExa);
|
||||||
|
|
||||||
/***** Starting and ending dates in the search *****/
|
/***** Starting and ending dates in the search *****/
|
||||||
Lay_StartRoundFrameTable (NULL,2,Txt_Exams);
|
Lay_StartRoundFrame (NULL,Txt_Exams,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
|
||||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
|
@ -6979,6 +6996,7 @@ static void Tst_StoreScoreOfTestExamInDB (long TstCod,
|
||||||
|
|
||||||
void Tst_ShowUsrsExams (void)
|
void Tst_ShowUsrsExams (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Exams;
|
extern const char *Txt_Exams;
|
||||||
extern const char *Txt_You_must_select_one_ore_more_users;
|
extern const char *Txt_You_must_select_one_ore_more_users;
|
||||||
const char *Ptr;
|
const char *Ptr;
|
||||||
|
@ -6993,7 +7011,8 @@ void Tst_ShowUsrsExams (void)
|
||||||
if (Usr_CountNumUsrsInListOfSelectedUsrs ()) // If some users are selected...
|
if (Usr_CountNumUsrsInListOfSelectedUsrs ()) // If some users are selected...
|
||||||
{
|
{
|
||||||
/***** Header of the table with the list of users *****/
|
/***** Header of the table with the list of users *****/
|
||||||
Lay_StartRoundFrameTable (NULL,2,Txt_Exams);
|
Lay_StartRoundFrame (NULL,Txt_Exams,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
|
||||||
Tst_ShowHeaderTestResults ();
|
Tst_ShowHeaderTestResults ();
|
||||||
|
|
||||||
/***** List the assignments and works of the selected users *****/
|
/***** List the assignments and works of the selected users *****/
|
||||||
|
@ -7079,13 +7098,15 @@ static void Tst_ShowHeaderTestResults (void)
|
||||||
|
|
||||||
void Tst_ShowMyExams (void)
|
void Tst_ShowMyExams (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Exams;
|
extern const char *Txt_Exams;
|
||||||
|
|
||||||
/***** Get starting and ending dates *****/
|
/***** Get starting and ending dates *****/
|
||||||
Dat_GetIniEndDatesFromForm ();
|
Dat_GetIniEndDatesFromForm ();
|
||||||
|
|
||||||
/***** Header of the table with the list of users *****/
|
/***** Header of the table with the list of users *****/
|
||||||
Lay_StartRoundFrameTable (NULL,2,Txt_Exams);
|
Lay_StartRoundFrame (NULL,Txt_Exams,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
|
||||||
Tst_ShowHeaderTestResults ();
|
Tst_ShowHeaderTestResults ();
|
||||||
|
|
||||||
/***** List my results in test exams *****/
|
/***** List my results in test exams *****/
|
||||||
|
@ -7424,6 +7445,7 @@ static long Tst_GetParamTstCod (void)
|
||||||
|
|
||||||
void Tst_ShowOneExam (void)
|
void Tst_ShowOneExam (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_Test_result;
|
extern const char *Txt_Test_result;
|
||||||
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
||||||
extern const char *Txt_Date;
|
extern const char *Txt_Date;
|
||||||
|
@ -7474,7 +7496,7 @@ void Tst_ShowOneExam (void)
|
||||||
Tst_GetExamQuestionsFromDB (TstCod);
|
Tst_GetExamQuestionsFromDB (TstCod);
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Test_result,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Test_result,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
Lay_WriteHeaderClassPhoto (false,false,
|
Lay_WriteHeaderClassPhoto (false,false,
|
||||||
Gbl.CurrentIns.Ins.InsCod,
|
Gbl.CurrentIns.Ins.InsCod,
|
||||||
Gbl.CurrentDeg.Deg.DegCod,
|
Gbl.CurrentDeg.Deg.DegCod,
|
||||||
|
|
|
@ -72,7 +72,6 @@ static Tst_AnswerType_t TsI_ConvertFromStrAnsTypXMLToAnsTyp (const char *StrAnsT
|
||||||
static bool TsI_CheckIfQuestionExistsInDB (void);
|
static bool TsI_CheckIfQuestionExistsInDB (void);
|
||||||
static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem);
|
static void TsI_GetAnswerFromXML (struct XMLElement *AnswerElem);
|
||||||
static void TsI_WriteHeadingListImportedQst (void);
|
static void TsI_WriteHeadingListImportedQst (void);
|
||||||
static void TsI_WriteEndingListImportedQst (void);
|
|
||||||
static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
|
static void TsI_WriteRowImportedQst (struct XMLElement *StemElem,
|
||||||
struct XMLElement *FeedbackElem,
|
struct XMLElement *FeedbackElem,
|
||||||
bool QuestionExists);
|
bool QuestionExists);
|
||||||
|
@ -129,13 +128,14 @@ void TsI_PutFormToImportQuestions (void)
|
||||||
|
|
||||||
void TsI_ShowFormImportQstsFromXML (void)
|
void TsI_ShowFormImportQstsFromXML (void)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Import_questions;
|
extern const char *Txt_Import_questions;
|
||||||
extern const char *Txt_You_need_an_XML_file_containing_a_list_of_questions;
|
extern const char *Txt_You_need_an_XML_file_containing_a_list_of_questions;
|
||||||
extern const char *Txt_XML_file;
|
extern const char *Txt_XML_file;
|
||||||
|
|
||||||
/***** Start frame *****/
|
/***** Start frame *****/
|
||||||
Lay_StartRoundFrame (NULL,Txt_Import_questions,NULL,NULL);
|
Lay_StartRoundFrame (NULL,Txt_Import_questions,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Write help message *****/
|
/***** Write help message *****/
|
||||||
Lay_ShowAlert (Lay_INFO,Txt_You_need_an_XML_file_containing_a_list_of_questions);
|
Lay_ShowAlert (Lay_INFO,Txt_You_need_an_XML_file_containing_a_list_of_questions);
|
||||||
|
@ -485,6 +485,7 @@ static void TsI_ReadQuestionsFromXMLFileAndStoreInDB (const char *FileNameXML)
|
||||||
|
|
||||||
static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
||||||
{
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Tests;
|
||||||
extern const char *Txt_XML_file_content;
|
extern const char *Txt_XML_file_content;
|
||||||
extern const char *Txt_Imported_questions;
|
extern const char *Txt_Imported_questions;
|
||||||
struct XMLElement *RootElem;
|
struct XMLElement *RootElem;
|
||||||
|
@ -504,9 +505,13 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
||||||
/***** Allocate and get XML tree *****/
|
/***** Allocate and get XML tree *****/
|
||||||
XML_GetTree (XMLBuffer,&RootElem);
|
XML_GetTree (XMLBuffer,&RootElem);
|
||||||
|
|
||||||
|
/***** Table start *****/
|
||||||
|
Lay_StartRoundFrame (NULL,Txt_Imported_questions,NULL,Hlp_ASSESSMENT_Tests);
|
||||||
|
|
||||||
/***** Print XML tree *****/
|
/***** Print XML tree *****/
|
||||||
Lay_WriteTitle (Txt_XML_file_content);
|
Lay_WriteTitle (Txt_XML_file_content);
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\""
|
||||||
|
" style=\"padding-bottom:20px;\">"
|
||||||
"<textarea cols=\"60\" rows=\"5\""
|
"<textarea cols=\"60\" rows=\"5\""
|
||||||
" spellcheck=\"false\" readonly>");
|
" spellcheck=\"false\" readonly>");
|
||||||
XML_PrintTree (RootElem);
|
XML_PrintTree (RootElem);
|
||||||
|
@ -521,148 +526,151 @@ static void TsI_ImportQuestionsFromXMLBuffer (const char *XMLBuffer)
|
||||||
if (strcmp (TestElem->TagName,"test")) // <test> must be at level 1
|
if (strcmp (TestElem->TagName,"test")) // <test> must be at level 1
|
||||||
TestElem = NULL;
|
TestElem = NULL;
|
||||||
}
|
}
|
||||||
if (!TestElem)
|
if (TestElem)
|
||||||
Lay_ShowErrorAndExit ("Root element <test> not found.");
|
|
||||||
|
|
||||||
/* Current element is <test> */
|
|
||||||
|
|
||||||
/***** Write heading of list of imported questions *****/
|
|
||||||
Lay_WriteTitle (Txt_Imported_questions);
|
|
||||||
TsI_WriteHeadingListImportedQst ();
|
|
||||||
|
|
||||||
/***** For each question... *****/
|
|
||||||
for (QuestionElem = TestElem->FirstChild;
|
|
||||||
QuestionElem != NULL;
|
|
||||||
QuestionElem = QuestionElem->NextBrother)
|
|
||||||
{
|
{
|
||||||
if (!strcmp (QuestionElem->TagName,"question"))
|
/* Current element is <test> */
|
||||||
{
|
|
||||||
/***** Create test question *****/
|
|
||||||
Tst_QstConstructor ();
|
|
||||||
|
|
||||||
/* Get type of questions (in mandatory attribute "type") */
|
/***** Write heading of list of imported questions *****/
|
||||||
AnswerTypeFound = false;
|
TsI_WriteHeadingListImportedQst ();
|
||||||
for (Attribute = QuestionElem->FirstAttribute;
|
|
||||||
Attribute != NULL;
|
|
||||||
Attribute = Attribute->Next)
|
|
||||||
if (!strcmp (Attribute->AttributeName,"type"))
|
|
||||||
{
|
|
||||||
Gbl.Test.AnswerType = TsI_ConvertFromStrAnsTypXMLToAnsTyp (Attribute->Content);
|
|
||||||
AnswerTypeFound = true;
|
|
||||||
break; // Only first attribute "type"
|
|
||||||
}
|
|
||||||
if (!AnswerTypeFound)
|
|
||||||
Lay_ShowErrorAndExit ("Wrong type of answer.");
|
|
||||||
|
|
||||||
/* Get tags */
|
/***** For each question... *****/
|
||||||
for (TagsElem = QuestionElem->FirstChild, Gbl.Test.Tags.Num = 0;
|
for (QuestionElem = TestElem->FirstChild;
|
||||||
TagsElem != NULL;
|
QuestionElem != NULL;
|
||||||
TagsElem = TagsElem->NextBrother)
|
QuestionElem = QuestionElem->NextBrother)
|
||||||
if (!strcmp (TagsElem->TagName,"tags"))
|
{
|
||||||
{
|
if (!strcmp (QuestionElem->TagName,"question"))
|
||||||
for (TagElem = TagsElem->FirstChild;
|
{
|
||||||
TagElem != NULL && Gbl.Test.Tags.Num < Tst_MAX_TAGS_PER_QUESTION;
|
/***** Create test question *****/
|
||||||
TagElem = TagElem->NextBrother)
|
Tst_QstConstructor ();
|
||||||
if (!strcmp (TagElem->TagName,"tag"))
|
|
||||||
{
|
|
||||||
if (TagElem->Content)
|
|
||||||
{
|
|
||||||
strncpy (Gbl.Test.Tags.Txt[Gbl.Test.Tags.Num],TagElem->Content,Tst_MAX_BYTES_TAG);
|
|
||||||
Gbl.Test.Tags.Txt[Gbl.Test.Tags.Num][Tst_MAX_BYTES_TAG] = '\0';
|
|
||||||
Gbl.Test.Tags.Num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break; // Only first element "tags"
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get stem (mandatory) */
|
/* Get type of questions (in mandatory attribute "type") */
|
||||||
for (StemElem = QuestionElem->FirstChild;
|
AnswerTypeFound = false;
|
||||||
StemElem != NULL;
|
for (Attribute = QuestionElem->FirstAttribute;
|
||||||
StemElem = StemElem->NextBrother)
|
Attribute != NULL;
|
||||||
if (!strcmp (StemElem->TagName,"stem"))
|
Attribute = Attribute->Next)
|
||||||
{
|
if (!strcmp (Attribute->AttributeName,"type"))
|
||||||
if (StemElem->Content)
|
{
|
||||||
{
|
Gbl.Test.AnswerType = TsI_ConvertFromStrAnsTypXMLToAnsTyp (Attribute->Content);
|
||||||
/* Convert stem from text to HTML (in database stem is stored in HTML) */
|
AnswerTypeFound = true;
|
||||||
strncpy (Stem,StemElem->Content,Cns_MAX_BYTES_TEXT);
|
break; // Only first attribute "type"
|
||||||
Stem[Cns_MAX_BYTES_TEXT] = '\0';
|
}
|
||||||
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
|
if (!AnswerTypeFound)
|
||||||
Stem,Cns_MAX_BYTES_TEXT,true);
|
Lay_ShowErrorAndExit ("Wrong type of answer.");
|
||||||
|
|
||||||
Gbl.Test.Stem.Text = Stem;
|
/* Get tags */
|
||||||
Gbl.Test.Stem.Length = strlen (Stem);
|
for (TagsElem = QuestionElem->FirstChild, Gbl.Test.Tags.Num = 0;
|
||||||
}
|
TagsElem != NULL;
|
||||||
break; // Only first element "stem"
|
TagsElem = TagsElem->NextBrother)
|
||||||
}
|
if (!strcmp (TagsElem->TagName,"tags"))
|
||||||
|
{
|
||||||
|
for (TagElem = TagsElem->FirstChild;
|
||||||
|
TagElem != NULL && Gbl.Test.Tags.Num < Tst_MAX_TAGS_PER_QUESTION;
|
||||||
|
TagElem = TagElem->NextBrother)
|
||||||
|
if (!strcmp (TagElem->TagName,"tag"))
|
||||||
|
{
|
||||||
|
if (TagElem->Content)
|
||||||
|
{
|
||||||
|
strncpy (Gbl.Test.Tags.Txt[Gbl.Test.Tags.Num],TagElem->Content,Tst_MAX_BYTES_TAG);
|
||||||
|
Gbl.Test.Tags.Txt[Gbl.Test.Tags.Num][Tst_MAX_BYTES_TAG] = '\0';
|
||||||
|
Gbl.Test.Tags.Num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break; // Only first element "tags"
|
||||||
|
}
|
||||||
|
|
||||||
/* Get feedback (optional) */
|
/* Get stem (mandatory) */
|
||||||
for (FeedbackElem = QuestionElem->FirstChild;
|
for (StemElem = QuestionElem->FirstChild;
|
||||||
FeedbackElem != NULL;
|
StemElem != NULL;
|
||||||
FeedbackElem = FeedbackElem->NextBrother)
|
StemElem = StemElem->NextBrother)
|
||||||
if (!strcmp (FeedbackElem->TagName,"feedback"))
|
if (!strcmp (StemElem->TagName,"stem"))
|
||||||
{
|
{
|
||||||
if (FeedbackElem->Content)
|
if (StemElem->Content)
|
||||||
{
|
{
|
||||||
/* Convert feedback from text to HTML (in database feedback is stored in HTML) */
|
/* Convert stem from text to HTML (in database stem is stored in HTML) */
|
||||||
strncpy (Feedback,FeedbackElem->Content,Cns_MAX_BYTES_TEXT);
|
strncpy (Stem,StemElem->Content,Cns_MAX_BYTES_TEXT);
|
||||||
Feedback[Cns_MAX_BYTES_TEXT] = '\0';
|
Stem[Cns_MAX_BYTES_TEXT] = '\0';
|
||||||
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
|
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
|
||||||
Feedback,Cns_MAX_BYTES_TEXT,true);
|
Stem,Cns_MAX_BYTES_TEXT,true);
|
||||||
|
|
||||||
Gbl.Test.Feedback.Text = Feedback;
|
Gbl.Test.Stem.Text = Stem;
|
||||||
Gbl.Test.Feedback.Length = strlen (Feedback);
|
Gbl.Test.Stem.Length = strlen (Stem);
|
||||||
}
|
}
|
||||||
break; // Only first element "feedback"
|
break; // Only first element "stem"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get shuffle. By default, shuffle is false. */
|
/* Get feedback (optional) */
|
||||||
Gbl.Test.Shuffle = false;
|
for (FeedbackElem = QuestionElem->FirstChild;
|
||||||
for (AnswerElem = QuestionElem->FirstChild;
|
FeedbackElem != NULL;
|
||||||
AnswerElem != NULL;
|
FeedbackElem = FeedbackElem->NextBrother)
|
||||||
AnswerElem = AnswerElem->NextBrother)
|
if (!strcmp (FeedbackElem->TagName,"feedback"))
|
||||||
if (!strcmp (AnswerElem->TagName,"answer"))
|
{
|
||||||
{
|
if (FeedbackElem->Content)
|
||||||
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
|
{
|
||||||
Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE)
|
/* Convert feedback from text to HTML (in database feedback is stored in HTML) */
|
||||||
/* Get whether shuffle answers (in attribute "shuffle") */
|
strncpy (Feedback,FeedbackElem->Content,Cns_MAX_BYTES_TEXT);
|
||||||
for (Attribute = AnswerElem->FirstAttribute;
|
Feedback[Cns_MAX_BYTES_TEXT] = '\0';
|
||||||
Attribute != NULL;
|
Str_ChangeFormat (Str_FROM_TEXT,Str_TO_HTML,
|
||||||
Attribute = Attribute->Next)
|
Feedback,Cns_MAX_BYTES_TEXT,true);
|
||||||
if (!strcmp (Attribute->AttributeName,"shuffle"))
|
|
||||||
{
|
|
||||||
Gbl.Test.Shuffle = XML_GetAttributteYesNoFromXMLTree (Attribute);
|
|
||||||
break; // Only first attribute "shuffle"
|
|
||||||
}
|
|
||||||
break; // Only first element "answer"
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get answer (mandatory) */
|
Gbl.Test.Feedback.Text = Feedback;
|
||||||
TsI_GetAnswerFromXML (AnswerElem);
|
Gbl.Test.Feedback.Length = strlen (Feedback);
|
||||||
|
}
|
||||||
|
break; // Only first element "feedback"
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure that tags, text and answer are not empty */
|
/* Get shuffle. By default, shuffle is false. */
|
||||||
if (Tst_CheckIfQstFormatIsCorrectAndCountNumOptions ())
|
Gbl.Test.Shuffle = false;
|
||||||
{
|
for (AnswerElem = QuestionElem->FirstChild;
|
||||||
/* Check if question already exists in database */
|
AnswerElem != NULL;
|
||||||
QuestionExists = TsI_CheckIfQuestionExistsInDB ();
|
AnswerElem = AnswerElem->NextBrother)
|
||||||
|
if (!strcmp (AnswerElem->TagName,"answer"))
|
||||||
|
{
|
||||||
|
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
|
||||||
|
Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE)
|
||||||
|
/* Get whether shuffle answers (in attribute "shuffle") */
|
||||||
|
for (Attribute = AnswerElem->FirstAttribute;
|
||||||
|
Attribute != NULL;
|
||||||
|
Attribute = Attribute->Next)
|
||||||
|
if (!strcmp (Attribute->AttributeName,"shuffle"))
|
||||||
|
{
|
||||||
|
Gbl.Test.Shuffle = XML_GetAttributteYesNoFromXMLTree (Attribute);
|
||||||
|
break; // Only first attribute "shuffle"
|
||||||
|
}
|
||||||
|
break; // Only first element "answer"
|
||||||
|
}
|
||||||
|
|
||||||
/* Write row with this imported question */
|
/* Get answer (mandatory) */
|
||||||
TsI_WriteRowImportedQst (StemElem,FeedbackElem,QuestionExists);
|
TsI_GetAnswerFromXML (AnswerElem);
|
||||||
|
|
||||||
/***** If a new question ==> insert question, tags and answer in the database *****/
|
/* Make sure that tags, text and answer are not empty */
|
||||||
if (!QuestionExists)
|
if (Tst_CheckIfQstFormatIsCorrectAndCountNumOptions ())
|
||||||
{
|
{
|
||||||
Gbl.Test.QstCod = -1L;
|
/* Check if question already exists in database */
|
||||||
Tst_InsertOrUpdateQstTagsAnsIntoDB ();
|
QuestionExists = TsI_CheckIfQuestionExistsInDB ();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Destroy test question *****/
|
/* Write row with this imported question */
|
||||||
Tst_QstDestructor ();
|
TsI_WriteRowImportedQst (StemElem,FeedbackElem,QuestionExists);
|
||||||
}
|
|
||||||
|
/***** If a new question ==> insert question, tags and answer in the database *****/
|
||||||
|
if (!QuestionExists)
|
||||||
|
{
|
||||||
|
Gbl.Test.QstCod = -1L;
|
||||||
|
Tst_InsertOrUpdateQstTagsAnsIntoDB ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Destroy test question *****/
|
||||||
|
Tst_QstDestructor ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out,"</table>");
|
||||||
}
|
}
|
||||||
|
else // TestElem not found
|
||||||
|
Lay_ShowAlert (Lay_ERROR,"Root element <test> not found.");
|
||||||
|
|
||||||
/***** Write ending of list of imported questions *****/
|
/***** End table *****/
|
||||||
TsI_WriteEndingListImportedQst ();
|
Lay_EndRoundFrame ();
|
||||||
|
|
||||||
/***** Free XML tree *****/
|
/***** Free XML tree *****/
|
||||||
XML_FreeTree (RootElem);
|
XML_FreeTree (RootElem);
|
||||||
|
@ -956,11 +964,9 @@ static void TsI_WriteHeadingListImportedQst (void)
|
||||||
extern const char *Txt_Shuffle;
|
extern const char *Txt_Shuffle;
|
||||||
extern const char *Txt_Question;
|
extern const char *Txt_Question;
|
||||||
|
|
||||||
/***** Table start *****/
|
|
||||||
Lay_StartRoundFrameTable (NULL,2,NULL);
|
|
||||||
|
|
||||||
/***** Write the heading *****/
|
/***** Write the heading *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
|
||||||
|
"<tr>"
|
||||||
"<th></th>"
|
"<th></th>"
|
||||||
"<th class=\"CENTER_TOP\">"
|
"<th class=\"CENTER_TOP\">"
|
||||||
"%s"
|
"%s"
|
||||||
|
@ -985,16 +991,6 @@ static void TsI_WriteHeadingListImportedQst (void)
|
||||||
Txt_Question);
|
Txt_Question);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Write end of list of imported test questions ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void TsI_WriteEndingListImportedQst (void)
|
|
||||||
{
|
|
||||||
/***** End table *****/
|
|
||||||
Lay_EndRoundFrameTable ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Write a row with one imported test question ****************/
|
/**************** Write a row with one imported test question ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user