Version 15.194.1

This commit is contained in:
Antonio Cañas Vargas 2016-04-14 19:05:52 +02:00
parent 12b73a9206
commit 2cc8a82af1
7 changed files with 20 additions and 20 deletions

View File

@ -137,13 +137,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.194 (2016-04-14)"
#define Log_PLATFORM_VERSION "SWAD 15.194.1 (2016-04-14)"
#define CSS_FILE "swad15.193.css"
#define JS_FILE "swad15.193.js"
// 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
/*
Version 15.194.1: Apr 14, 2016 Code refactoring related to uploading images. (199391 lines)
Version 15.194: Apr 14, 2016 Code refactoring related to uploading images. (199391 lines)
Version 15.193: Apr 14, 2016 New layout of button used to upload images. (199357 lines)
Version 15.192.13:Apr 13, 2016 Fixed bug in file upload, reported by Christian Morillas Gutiérrez. (199341 lines)

View File

@ -3905,7 +3905,7 @@ void For_RecForumPst (void)
ParamUploadImg.Action = "ImgAct";
ParamUploadImg.File = "ImgFil";
ParamUploadImg.Title = "ImgTit";
Img_GetImageFromForm (0,&Image,NULL,
Img_GetImageFromForm (-1,&Image,NULL,
&ParamUploadImg,
For_IMAGE_SAVED_MAX_WIDTH,
For_IMAGE_SAVED_MAX_HEIGHT,

View File

@ -207,7 +207,7 @@ void Img_PutImageUploader (const char *ClassImgTit,
/*****************************************************************************/
void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
void (*GetImageFromDB) (unsigned NumOpt,struct Image *Image),
void (*GetImageFromDB) (int NumOpt,struct Image *Image),
struct ParamUploadImg *ParamUploadImg,
unsigned Width,unsigned Height,unsigned Quality)
{

View File

@ -112,7 +112,7 @@ void Img_GetImageNameAndTitleFromRow (const char *Name,const char *Title,
void Img_PutImageUploader (const char *ClassImgTit,
struct ParamUploadImg *ParamUploadImg);
void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
void Img_GetImageFromForm (int NumOpt,struct Image *Image,
void (*GetImageFromDB) (unsigned NumOpt,struct Image *Image),
struct ParamUploadImg *ParamUploadImg,
unsigned Width,unsigned Height,unsigned Quality);

View File

@ -780,7 +780,7 @@ void Msg_RecMsgFromUsr (void)
ParamUploadImg.Action = "ImgAct";
ParamUploadImg.File = "ImgFil";
ParamUploadImg.Title = "ImgTit";
Img_GetImageFromForm (0,&Image,NULL,
Img_GetImageFromForm (-1,&Image,NULL,
&ParamUploadImg,
Msg_IMAGE_SAVED_MAX_WIDTH,
Msg_IMAGE_SAVED_MAX_HEIGHT,

View File

@ -2096,7 +2096,7 @@ static long Soc_ReceiveSocialPost (void)
ParamUploadImg.Action = "ImgAct";
ParamUploadImg.File = "ImgFil";
ParamUploadImg.Title = "ImgTit";
Img_GetImageFromForm (0,&Image,NULL,
Img_GetImageFromForm (-1,&Image,NULL,
&ParamUploadImg,
Soc_IMAGE_SAVED_MAX_WIDTH,
Soc_IMAGE_SAVED_MAX_HEIGHT,
@ -2856,7 +2856,7 @@ static long Soc_ReceiveComment (void)
ParamUploadImg.Action = "ImgAct";
ParamUploadImg.File = "ImgFil";
ParamUploadImg.Title = "ImgTit";
Img_GetImageFromForm (0,&Image,NULL,
Img_GetImageFromForm (-1,&Image,NULL,
&ParamUploadImg,
Soc_IMAGE_SAVED_MAX_WIDTH,
Soc_IMAGE_SAVED_MAX_HEIGHT,

View File

@ -224,7 +224,7 @@ static void Tst_InitImagesOfQuestion (void);
static void Tst_FreeImagesOfQuestion (void);
static void Tst_GetQstDataFromDB (char *Stem,char *Feedback);
static void Tst_GetImageFromDB (unsigned NumOpt,struct Image *Image);
static void Tst_GetImageFromDB (int NumOpt,struct Image *Image);
static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *UnsignedStr);
static void Tst_GetQstFromForm (char *Stem,char *Feedback);
@ -5020,26 +5020,25 @@ static void Tst_GetQstDataFromDB (char *Stem,char *Feedback)
/*****************************************************************************/
/***** Get possible image associated with a test question from database ******/
/*****************************************************************************/
// NumOpt >= Tst_MAX_OPTIONS_PER_QUESTION ==> image associated to stem
// 0 <= NumOpt < Tst_MAX_OPTIONS_PER_QUESTION ==> image associated to answer
// NumOpt < 0 ==> image associated to stem
// NumOpt >= 0 ==> image associated to answer
static void Tst_GetImageFromDB (unsigned NumOpt,struct Image *Image)
static void Tst_GetImageFromDB (int NumOpt,struct Image *Image)
{
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
/***** Build query depending on NumOpt *****/
if (NumOpt < Tst_MAX_OPTIONS_PER_QUESTION)
// Get image associated to answer
sprintf (Query,"SELECT ImageName,ImageTitle FROM tst_answers"
" WHERE QstCod='%ld' AND AnsInd='%u'",
Gbl.Test.QstCod,NumOpt);
else
if (NumOpt < 0)
// Get image associated to stem
sprintf (Query,"SELECT ImageName,ImageTitle FROM tst_questions"
" WHERE QstCod='%ld' AND CrsCod='%ld'",
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod);
Gbl.Test.QstCod,Gbl.CurrentCrs.Crs.CrsCod); // Get image associated to answer
else
sprintf (Query,"SELECT ImageName,ImageTitle FROM tst_answers"
" WHERE QstCod='%ld' AND AnsInd='%u'",
Gbl.Test.QstCod,(unsigned) NumOpt);
/***** Query database *****/
DB_QuerySELECT (Query,&mysql_res,"can not get image name");
@ -5190,7 +5189,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
ParamUploadImg.Action = "ImgAct";
ParamUploadImg.File = "ImgFil";
ParamUploadImg.Title = "ImgTit";
Img_GetImageFromForm (Tst_MAX_OPTIONS_PER_QUESTION,&Gbl.Test.Image,
Img_GetImageFromForm (-1,&Gbl.Test.Image,
Tst_GetImageFromDB,
&ParamUploadImg,
Tst_IMAGE_SAVED_MAX_WIDTH,
@ -5254,7 +5253,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
ParamUploadImg.Action = ParamAction;
ParamUploadImg.File = ParamFile;
ParamUploadImg.Title = ParamTitle;
Img_GetImageFromForm (NumOpt,&Gbl.Test.Answer.Options[NumOpt].Image,
Img_GetImageFromForm ((int) NumOpt,&Gbl.Test.Answer.Options[NumOpt].Image,
Tst_GetImageFromDB,
&ParamUploadImg,
Tst_IMAGE_SAVED_MAX_WIDTH,