mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-28 11:25:43 +02:00
Version 15.173.4
This commit is contained in:
parent
a63acb8a77
commit
93cd2494f9
|
@ -144,14 +144,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.173.3 (2016-04-01)"
|
#define Log_PLATFORM_VERSION "SWAD 15.173.4 (2016-04-01)"
|
||||||
#define CSS_FILE "swad15.173.1.css"
|
#define CSS_FILE "swad15.173.1.css"
|
||||||
#define JS_FILE "swad15.131.3.js"
|
#define JS_FILE "swad15.131.3.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
Version 15.173.4: Apr 01, 2016 Old image in test question is removed when replaced by a new one. (? lines)
|
Version 15.173.4: Apr 01, 2016 Old image in test question is removed when replaced by a new one. (197481 lines)
|
||||||
Version 15.173.3: Apr 01, 2016 Changes in layout of class photo. (197447 lines)
|
Version 15.173.3: Apr 01, 2016 Changes in layout of class photo. (197447 lines)
|
||||||
Version 15.173.2: Apr 01, 2016 Changes in CSS related to tests. (197446 lines)
|
Version 15.173.2: Apr 01, 2016 Changes in CSS related to tests. (197446 lines)
|
||||||
Version 15.173.1: Apr 01, 2016 Changes in CSS related to tests. (197452 lines)
|
Version 15.173.1: Apr 01, 2016 Changes in CSS related to tests. (197452 lines)
|
||||||
|
|
43
swad_test.c
43
swad_test.c
|
@ -222,6 +222,7 @@ static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden);
|
||||||
static int Tst_GetQstCod (void);
|
static int Tst_GetQstCod (void);
|
||||||
|
|
||||||
static void Tst_InsertOrUpdateQstIntoDB (void);
|
static void Tst_InsertOrUpdateQstIntoDB (void);
|
||||||
|
static void Tst_RemoveImageFileCurrentQst (void);
|
||||||
static void Tst_InsertTagsIntoDB (void);
|
static void Tst_InsertTagsIntoDB (void);
|
||||||
static void Tst_InsertAnswersIntoDB (void);
|
static void Tst_InsertAnswersIntoDB (void);
|
||||||
|
|
||||||
|
@ -4814,7 +4815,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
||||||
/***** Get question feedback *****/
|
/***** Get question feedback *****/
|
||||||
Par_GetParToHTML ("Feedback",Feedback,Cns_MAX_BYTES_TEXT);
|
Par_GetParToHTML ("Feedback",Feedback,Cns_MAX_BYTES_TEXT);
|
||||||
|
|
||||||
/***** Get image *****/
|
/***** Get new image (if present ==> create file) *****/
|
||||||
Gbl.Test.ChangeImage = Tst_GetImageFromForm ();
|
Gbl.Test.ChangeImage = Tst_GetImageFromForm ();
|
||||||
|
|
||||||
/***** Get answers *****/
|
/***** Get answers *****/
|
||||||
|
@ -5481,6 +5482,11 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
||||||
{
|
{
|
||||||
/* Update question */
|
/* Update question */
|
||||||
if (Gbl.Test.ChangeImage)
|
if (Gbl.Test.ChangeImage)
|
||||||
|
{
|
||||||
|
/* Remove file with the current image */
|
||||||
|
Tst_RemoveImageFileCurrentQst ();
|
||||||
|
|
||||||
|
/* Update question in database */
|
||||||
sprintf (Query,"UPDATE tst_questions"
|
sprintf (Query,"UPDATE tst_questions"
|
||||||
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
||||||
"Stem='%s',Image='%s',Feedback='%s'"
|
"Stem='%s',Image='%s',Feedback='%s'"
|
||||||
|
@ -5492,6 +5498,7 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
||||||
Gbl.Test.Image,
|
Gbl.Test.Image,
|
||||||
Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "",
|
Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "",
|
||||||
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sprintf (Query,"UPDATE tst_questions"
|
sprintf (Query,"UPDATE tst_questions"
|
||||||
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
" SET EditTime=NOW(),AnsType='%s',Shuffle='%c',"
|
||||||
|
@ -5514,6 +5521,40 @@ static void Tst_InsertOrUpdateQstIntoDB (void)
|
||||||
free ((void *) Query);
|
free ((void *) Query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Remove the current image of a test question ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Tst_RemoveImageFileCurrentQst (void)
|
||||||
|
{
|
||||||
|
char Query[256];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
char FullPathImgPriv[PATH_MAX+1];
|
||||||
|
|
||||||
|
/***** Get name of image associated to test question from database *****/
|
||||||
|
sprintf (Query,"SELECT Image FROM tst_questions"
|
||||||
|
" WHERE QstCod='%ld' AND CrsCod='%ld'",
|
||||||
|
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get test image"))
|
||||||
|
{
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/***** Get image name (row[0]) *****/
|
||||||
|
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s.jpg",
|
||||||
|
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
|
||||||
|
row[0][0],
|
||||||
|
row[0][1],
|
||||||
|
row[0]);
|
||||||
|
|
||||||
|
/***** Remove file *****/
|
||||||
|
unlink (FullPathImgPriv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Insert tags in the tags table ***********************/
|
/*********************** Insert tags in the tags table ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user