mirror of https://github.com/acanas/swad-core.git
Version 15.175.7
This commit is contained in:
parent
42b7ba6655
commit
f00686f2cf
|
@ -134,7 +134,6 @@
|
||||||
// TODO: In Statistics > Degrees, show only degrees with students
|
// TODO: In Statistics > Degrees, show only degrees with students
|
||||||
|
|
||||||
// TODO: Ask for confirmation when removing a test question?
|
// TODO: Ask for confirmation when removing a test question?
|
||||||
// TODO: Fix bug when clicking on Export test questions
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
|
@ -147,7 +146,8 @@
|
||||||
// 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 15.175.7: Apr 03, 2016 Code refactoring related to image associated to a test question. (? lines)
|
Version 15.175.7: Apr 03, 2016 Code refactoring related to image associated to a test question.
|
||||||
|
Fixed bug while exporting test questions. (197923 lines)
|
||||||
Version 15.175.6: Apr 03, 2016 Remove image associated to a test question. (197926 lines)
|
Version 15.175.6: Apr 03, 2016 Remove image associated to a test question. (197926 lines)
|
||||||
Version 15.175.5: Apr 03, 2016 Changes in reception of form to edit one test question. (197930 lines)
|
Version 15.175.5: Apr 03, 2016 Changes in reception of form to edit one test question. (197930 lines)
|
||||||
Version 15.175.4: Apr 03, 2016 Changes in form to edit one test question. (197897 lines)
|
Version 15.175.4: Apr 03, 2016 Changes in form to edit one test question. (197897 lines)
|
||||||
|
|
|
@ -431,6 +431,7 @@ void Gbl_InitializeGlobals (void)
|
||||||
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
|
Gbl.Imported.ExternalRole = Rol_UNKNOWN;
|
||||||
|
|
||||||
/* Related to images uploaded in a form */
|
/* Related to images uploaded in a form */
|
||||||
|
Gbl.Image.Action = Img_ACTION_NO_IMAGE;
|
||||||
Gbl.Image.Status = Img_NONE;
|
Gbl.Image.Status = Img_NONE;
|
||||||
|
|
||||||
Gbl.WebService.Function = Svc_unknown;
|
Gbl.WebService.Function = Svc_unknown;
|
||||||
|
|
|
@ -166,32 +166,19 @@ void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res)
|
||||||
extern const char *Tst_StrAnswerTypesXML[Tst_NUM_ANS_TYPES];
|
extern const char *Tst_StrAnswerTypesXML[Tst_NUM_ANS_TYPES];
|
||||||
extern const char *Txt_NEW_LINE;
|
extern const char *Txt_NEW_LINE;
|
||||||
extern const char *Txt_XML_file;
|
extern const char *Txt_XML_file;
|
||||||
char PathFileBrowserTmp[PATH_MAX+1];
|
|
||||||
char PathPubDirTmp[PATH_MAX+1];
|
|
||||||
char PathPubFile[PATH_MAX+1];
|
char PathPubFile[PATH_MAX+1];
|
||||||
unsigned long NumRow;
|
unsigned long NumRow;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
long QstCod;
|
long QstCod;
|
||||||
|
|
||||||
/***** Create a temporary public directory used to download the XML file *****/
|
/***** Create a temporary public directory
|
||||||
/* If the public directory does not exist, create it */
|
used to download the XML file *****/
|
||||||
sprintf (PathFileBrowserTmp,"%s/%s",Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP);
|
Brw_CreateDirDownloadTmp ();
|
||||||
Fil_CreateDirIfNotExists (PathFileBrowserTmp);
|
|
||||||
|
|
||||||
/* First of all, we remove the oldest temporary directories.
|
|
||||||
Such temporary directories have been created by me or by other users.
|
|
||||||
This is a bit sloppy, but they must be removed by someone.
|
|
||||||
Here "oldest" means more than x time from their creation */
|
|
||||||
Fil_RemoveOldTmpFiles (PathFileBrowserTmp,Cfg_TIME_TO_DELETE_BROWSER_TMP_FILES,false);
|
|
||||||
|
|
||||||
/* Create a new temporary directory */
|
|
||||||
strcpy (Gbl.FileBrowser.TmpPubDir,Gbl.UniqueNameEncrypted);
|
|
||||||
sprintf (PathPubDirTmp,"%s/%s",PathFileBrowserTmp,Gbl.FileBrowser.TmpPubDir);
|
|
||||||
if (mkdir (PathPubDirTmp,(mode_t) 0xFFF))
|
|
||||||
Lay_ShowErrorAndExit ("Can not create a temporary folder for download.");
|
|
||||||
|
|
||||||
/***** Create public XML file with the questions *****/
|
/***** Create public XML file with the questions *****/
|
||||||
sprintf (PathPubFile,"%s/test.xml",PathPubDirTmp);
|
sprintf (PathPubFile,"%s/%s/%s/test.xml",
|
||||||
|
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
|
||||||
|
Gbl.FileBrowser.TmpPubDir);
|
||||||
if ((Gbl.Test.XML.FileXML = fopen (PathPubFile,"wb")) == NULL)
|
if ((Gbl.Test.XML.FileXML = fopen (PathPubFile,"wb")) == NULL)
|
||||||
Lay_ShowErrorAndExit ("Can not open target file.");
|
Lay_ShowErrorAndExit ("Can not open target file.");
|
||||||
|
|
||||||
|
@ -205,7 +192,18 @@ void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res)
|
||||||
NumRow++)
|
NumRow++)
|
||||||
{
|
{
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
/*
|
||||||
|
row[0] QstCod
|
||||||
|
row[1] UNIX_TIMESTAMP(EditTime)
|
||||||
|
row[2] AnsType
|
||||||
|
row[3] Shuffle
|
||||||
|
row[4] Stem
|
||||||
|
row[5] Image
|
||||||
|
row[6] Feedback
|
||||||
|
row[7] NumHits
|
||||||
|
row[8] NumHitsNotBlank
|
||||||
|
row[9] Score
|
||||||
|
*/
|
||||||
/* row[0] holds the code of the question */
|
/* row[0] holds the code of the question */
|
||||||
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_ShowErrorAndExit ("Wrong code of question.");
|
||||||
|
@ -224,11 +222,11 @@ void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res)
|
||||||
fprintf (Gbl.Test.XML.FileXML,"<stem>%s</stem>%s",
|
fprintf (Gbl.Test.XML.FileXML,"<stem>%s</stem>%s",
|
||||||
row[4],Txt_NEW_LINE);
|
row[4],Txt_NEW_LINE);
|
||||||
|
|
||||||
/* Write the feedback (row[5]), that is in HTML format */
|
/* Write the feedback (row[6]), that is in HTML format */
|
||||||
if (row[5])
|
if (row[6])
|
||||||
if (row[5][0])
|
if (row[6][0])
|
||||||
fprintf (Gbl.Test.XML.FileXML,"<feedback>%s</feedback>%s",
|
fprintf (Gbl.Test.XML.FileXML,"<feedback>%s</feedback>%s",
|
||||||
row[5],Txt_NEW_LINE);
|
row[6],Txt_NEW_LINE);
|
||||||
|
|
||||||
/* Write the answers of this question.
|
/* Write the answers of this question.
|
||||||
Shuffle can be enabled or disabled (row[3]) */
|
Shuffle can be enabled or disabled (row[3]) */
|
||||||
|
@ -243,7 +241,8 @@ void TsI_CreateXML (unsigned long NumRows,MYSQL_RES *mysql_res)
|
||||||
fprintf (Gbl.Test.XML.FileXML,"</answer>%s",Txt_NEW_LINE);
|
fprintf (Gbl.Test.XML.FileXML,"</answer>%s",Txt_NEW_LINE);
|
||||||
|
|
||||||
/* End question */
|
/* End question */
|
||||||
fprintf (Gbl.Test.XML.FileXML,"</question>%s%s",Txt_NEW_LINE,Txt_NEW_LINE);
|
fprintf (Gbl.Test.XML.FileXML,"</question>%s%s",
|
||||||
|
Txt_NEW_LINE,Txt_NEW_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End XML file *****/
|
/***** End XML file *****/
|
||||||
|
|
Loading…
Reference in New Issue