mirror of https://github.com/acanas/swad-core.git
Version 15.194
This commit is contained in:
parent
3785f540b5
commit
12b73a9206
|
@ -137,13 +137,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.193 (2016-04-14)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.194 (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: 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)
|
||||
Version 15.192.12:Apr 12, 2016 Fixed bug in groups reported by user raistmaj in GitHub. (199339 lines)
|
||||
|
|
12
swad_forum.c
12
swad_forum.c
|
@ -3779,6 +3779,7 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
extern const char *Txt_MSG_Subject;
|
||||
extern const char *Txt_MSG_Message;
|
||||
extern const char *Txt_Send_message;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrame (NULL,
|
||||
|
@ -3835,7 +3836,10 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
Img_PutImageUploader ("FOR_IMG_TIT");
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_PutImageUploader ("FOR_IMG_TIT",&ParamUploadImg);
|
||||
|
||||
/***** Send button *****/
|
||||
Lay_PutCreateButton (Txt_Send_message);
|
||||
|
@ -3862,6 +3866,7 @@ void For_RecForumPst (void)
|
|||
struct SocialPublishing SocPub;
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
struct Image Image;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Get order type, degree and course of the forum *****/
|
||||
For_GetParamsForum ();
|
||||
|
@ -3897,8 +3902,11 @@ void For_RecForumPst (void)
|
|||
Img_ImageConstructor (&Image);
|
||||
|
||||
/***** Get attached image (action, file and title) *****/
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_GetImageFromForm (0,&Image,NULL,
|
||||
"ImgAct","ImgFil","ImgTit",
|
||||
&ParamUploadImg,
|
||||
For_IMAGE_SAVED_MAX_WIDTH,
|
||||
For_IMAGE_SAVED_MAX_HEIGHT,
|
||||
For_IMAGE_SAVED_QUALITY);
|
||||
|
|
22
swad_image.c
22
swad_image.c
|
@ -155,7 +155,8 @@ void Img_GetImageNameAndTitleFromRow (const char *Name,const char *Title,
|
|||
/************ Draw input fields to upload an image inside a form *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Img_PutImageUploader (const char *ClassImgTit)
|
||||
void Img_PutImageUploader (const char *ClassImgTit,
|
||||
struct ParamUploadImg *ParamUploadImg)
|
||||
{
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
|
@ -169,14 +170,14 @@ void Img_PutImageUploader (const char *ClassImgTit)
|
|||
fprintf (Gbl.F.Out,"<div class=\"IMG_UPLOAD_CONTAINER\">");
|
||||
|
||||
/***** Action to perform on image *****/
|
||||
Par_PutHiddenParamUnsigned ("ImgAct",(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
Par_PutHiddenParamUnsigned (ParamUploadImg->Action,(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
|
||||
/***** Image file *****/
|
||||
fprintf (Gbl.F.Out,"<label class=\"IMG_UPLOAD_BUTTON\">"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"IMG_UPLOAD_ICON\" />"
|
||||
"<input type=\"file\" name=\"ImgFil\" accept=\"image/*\""
|
||||
"<input type=\"file\" name=\"%s\" accept=\"image/*\""
|
||||
" class=\"IMG_UPLOAD_FILE\""
|
||||
" onchange=\"imageUploadOnSelectFile (this,'%s');\" />"
|
||||
"<span id=\"%s_fil\" class=\"IMG_UPLOAD_FILENAME\" />"
|
||||
|
@ -185,14 +186,15 @@ void Img_PutImageUploader (const char *ClassImgTit)
|
|||
"<br />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional,
|
||||
ParamUploadImg->File,
|
||||
Id,Id);
|
||||
|
||||
/***** Image title/attribution *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" id=\"%s_tit\" name=\"ImgTit\""
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" id=\"%s_tit\" name=\"%s\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"\""
|
||||
" style=\"display:none;\" />",
|
||||
Id,
|
||||
Id,ParamUploadImg->Title,
|
||||
Txt_Image_title_attribution,Txt_optional,
|
||||
ClassImgTit,Img_MAX_BYTES_TITLE);
|
||||
|
||||
|
@ -206,7 +208,7 @@ void Img_PutImageUploader (const char *ClassImgTit)
|
|||
|
||||
void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
||||
void (*GetImageFromDB) (unsigned NumOpt,struct Image *Image),
|
||||
const char *ParamAction,const char *ParamFile,const char *ParamTitle,
|
||||
struct ParamUploadImg *ParamUploadImg,
|
||||
unsigned Width,unsigned Height,unsigned Quality)
|
||||
{
|
||||
char Title[Img_MAX_BYTES_TITLE+1];
|
||||
|
@ -214,7 +216,7 @@ void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
|||
|
||||
/***** First, get action and initialize image
|
||||
(except title, that will be get after the image file) *****/
|
||||
Image->Action = Img_GetImageActionFromForm (ParamAction);
|
||||
Image->Action = Img_GetImageActionFromForm (ParamUploadImg->Action);
|
||||
Image->Status = Img_FILE_NONE;
|
||||
Image->Name[0] = '\0';
|
||||
|
||||
|
@ -223,7 +225,7 @@ void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
|||
{
|
||||
case Img_ACTION_NEW_IMAGE: // Upload new image
|
||||
/***** Get new image (if present ==> process and create temporary file) *****/
|
||||
Img_GetAndProcessImageFileFromForm (Image,ParamFile,
|
||||
Img_GetAndProcessImageFileFromForm (Image,ParamUploadImg->File,
|
||||
Width,Height,Quality);
|
||||
if (Image->Status != Img_FILE_PROCESSED) // No new image received-processed successfully
|
||||
{
|
||||
|
@ -239,7 +241,7 @@ void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
|||
break;
|
||||
case Img_ACTION_CHANGE_IMAGE: // Replace old image by new image
|
||||
/***** Get new image (if present ==> process and create temporary file) *****/
|
||||
Img_GetAndProcessImageFileFromForm (Image,ParamFile,
|
||||
Img_GetAndProcessImageFileFromForm (Image,ParamUploadImg->File,
|
||||
Width,Height,Quality);
|
||||
if (Image->Status != Img_FILE_PROCESSED && // No new image received-processed successfully
|
||||
GetImageFromDB != NULL)
|
||||
|
@ -251,7 +253,7 @@ void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
|||
}
|
||||
|
||||
/***** By last, get image title from form *****/
|
||||
Par_GetParToText (ParamTitle,Title,Img_MAX_BYTES_TITLE);
|
||||
Par_GetParToText (ParamUploadImg->Title,Title,Img_MAX_BYTES_TITLE);
|
||||
/* If the title coming from the form is empty, keep current image title unchanged
|
||||
If not empty, copy it to current image title */
|
||||
if ((Length = strlen (Title)) > 0)
|
||||
|
|
12
swad_image.h
12
swad_image.h
|
@ -91,6 +91,13 @@ struct Image
|
|||
// in order to not trying to free it when no memory allocated)
|
||||
};
|
||||
|
||||
struct ParamUploadImg
|
||||
{
|
||||
char *Action;
|
||||
char *File;
|
||||
char *Title;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -103,10 +110,11 @@ void Img_FreeImageTitle (struct Image *Image);
|
|||
void Img_GetImageNameAndTitleFromRow (const char *Name,const char *Title,
|
||||
struct Image *Image);
|
||||
|
||||
void Img_PutImageUploader (const char *ClassImgTit);
|
||||
void Img_PutImageUploader (const char *ClassImgTit,
|
||||
struct ParamUploadImg *ParamUploadImg);
|
||||
void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
||||
void (*GetImageFromDB) (unsigned NumOpt,struct Image *Image),
|
||||
const char *ParamAction,const char *ParamFile,const char *ParamTitle,
|
||||
struct ParamUploadImg *ParamUploadImg,
|
||||
unsigned Width,unsigned Height,unsigned Quality);
|
||||
Img_Action_t Img_GetImageActionFromForm (const char *ParamAction);
|
||||
void Img_GetAndProcessImageFileFromForm (struct Image *Image,const char *ParamFile,
|
||||
|
|
|
@ -285,6 +285,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
|||
extern const char *Txt_New_message;
|
||||
extern const char *Txt_MSG_To;
|
||||
extern const char *Txt_Send_message;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
char YN[1+1];
|
||||
|
||||
Gbl.Usrs.LstTchs.NumUsrs =
|
||||
|
@ -418,7 +419,10 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
Img_PutImageUploader ("MSG_IMG_TIT");
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_PutImageUploader ("MSG_IMG_TIT",&ParamUploadImg);
|
||||
|
||||
/***** Send button *****/
|
||||
Lay_PutCreateButton (Txt_Send_message);
|
||||
|
@ -706,6 +710,7 @@ void Msg_RecMsgFromUsr (void)
|
|||
bool NotifyByEmail;
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
struct Image Image;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
bool Error = false;
|
||||
|
||||
/***** Get data from form *****/
|
||||
|
@ -772,8 +777,11 @@ void Msg_RecMsgFromUsr (void)
|
|||
Img_ImageConstructor (&Image);
|
||||
|
||||
/***** Get attached image (action, file and title) *****/
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_GetImageFromForm (0,&Image,NULL,
|
||||
"ImgAct","ImgFil","ImgTit",
|
||||
&ParamUploadImg,
|
||||
Msg_IMAGE_SAVED_MAX_WIDTH,
|
||||
Msg_IMAGE_SAVED_MAX_HEIGHT,
|
||||
Msg_IMAGE_SAVED_QUALITY);
|
||||
|
|
|
@ -1997,6 +1997,7 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
const char *ClassTextArea,const char *ClassImgTit)
|
||||
{
|
||||
extern const char *Txt_Post;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
char IdDivImgButton[Act_MAX_LENGTH_ID];
|
||||
|
||||
/***** Set unique id for the hidden div *****/
|
||||
|
@ -2020,7 +2021,10 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
Img_PutImageUploader (ClassImgTit);
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_PutImageUploader (ClassImgTit,&ParamUploadImg);
|
||||
|
||||
/***** Submit button *****/
|
||||
fprintf (Gbl.F.Out,"<button type=\"submit\""
|
||||
|
@ -2079,6 +2083,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
char *Query;
|
||||
long PstCod;
|
||||
struct SocialPublishing SocPub;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Get the content of the new post *****/
|
||||
Par_GetParAndChangeFormat ("Content",Content,Cns_MAX_BYTES_LONG_TEXT,
|
||||
|
@ -2088,8 +2093,11 @@ static long Soc_ReceiveSocialPost (void)
|
|||
Img_ImageConstructor (&Image);
|
||||
|
||||
/***** Get attached image (action, file and title) *****/
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_GetImageFromForm (0,&Image,NULL,
|
||||
"ImgAct","ImgFil","ImgTit",
|
||||
&ParamUploadImg,
|
||||
Soc_IMAGE_SAVED_MAX_WIDTH,
|
||||
Soc_IMAGE_SAVED_MAX_HEIGHT,
|
||||
Soc_IMAGE_SAVED_QUALITY);
|
||||
|
@ -2829,6 +2837,7 @@ static long Soc_ReceiveComment (void)
|
|||
char *Query;
|
||||
struct SocialNote SocNot;
|
||||
struct SocialPublishing SocPub;
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Get data of social note *****/
|
||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||
|
@ -2844,8 +2853,11 @@ static long Soc_ReceiveComment (void)
|
|||
Img_ImageConstructor (&Image);
|
||||
|
||||
/***** Get attached image (action, file and title) *****/
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_GetImageFromForm (0,&Image,NULL,
|
||||
"ImgAct","ImgFil","ImgTit",
|
||||
&ParamUploadImg,
|
||||
Soc_IMAGE_SAVED_MAX_WIDTH,
|
||||
Soc_IMAGE_SAVED_MAX_HEIGHT,
|
||||
Soc_IMAGE_SAVED_QUALITY);
|
||||
|
|
97
swad_test.c
97
swad_test.c
|
@ -155,10 +155,9 @@ static void Tst_ShowTstResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank,
|
|||
static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row,
|
||||
double *ScoreThisQst,bool *AnswerIsNotBlank);
|
||||
static void Tst_PutFormToEditQstImage (struct Image *Image,
|
||||
const char *ClassImg,const char *ClassTitle,
|
||||
const char *ParamAction,
|
||||
const char *ParamFile,
|
||||
const char *ParamTitle,
|
||||
const char *ClassImg,
|
||||
const char *ClassImgTit,
|
||||
struct ParamUploadImg *ParamUploadImg,
|
||||
bool OptionsDisabled);
|
||||
static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotBlank);
|
||||
static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst);
|
||||
|
@ -1055,48 +1054,27 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Tst_PutFormToEditQstImage (struct Image *Image,
|
||||
const char *ClassImg,const char *ClassTitle,
|
||||
const char *ParamAction,
|
||||
const char *ParamFile,
|
||||
const char *ParamTitle,
|
||||
const char *ClassImg,
|
||||
const char *ClassImgTit,
|
||||
struct ParamUploadImg *ParamUploadImg,
|
||||
bool OptionsDisabled)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
extern const char *Txt_No_image;
|
||||
extern const char *Txt_Current_image;
|
||||
extern const char *Txt_Change_image;
|
||||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_optional;
|
||||
static unsigned UniqueId = 0;
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"TEST_IMG_EDIT_ONE_CONTAINER\">");
|
||||
|
||||
if (!Image->Name[0])
|
||||
if (Image->Name[0])
|
||||
{
|
||||
/* Action to perform on image */
|
||||
Par_PutHiddenParamUnsigned (ParamAction,(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"TEST_IMG_EDIT_ONE_CONTAINER\">");
|
||||
|
||||
/* File */
|
||||
fprintf (Gbl.F.Out,"<label>"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"ICON20x20\" />"
|
||||
"</label>"
|
||||
"<input type=\"file\" name=\"%s\" accept=\"image/*\"",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional,
|
||||
ParamFile);
|
||||
if (OptionsDisabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
}
|
||||
else
|
||||
{
|
||||
/***** Choice 1: No image *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"",
|
||||
ParamAction,Img_ACTION_NO_IMAGE);
|
||||
ParamUploadImg->Action,Img_ACTION_NO_IMAGE);
|
||||
if (OptionsDisabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
|
@ -1109,7 +1087,7 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,
|
|||
|
||||
/***** Choice 2: Current image *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\" checked=\"checked\"",
|
||||
ParamAction,Img_ACTION_KEEP_IMAGE);
|
||||
ParamUploadImg->Action,Img_ACTION_KEEP_IMAGE);
|
||||
if (OptionsDisabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
|
@ -1124,7 +1102,7 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,
|
|||
UniqueId++;
|
||||
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"chg_img_%u\" name=\"%s\""
|
||||
" value=\"%u\"",
|
||||
UniqueId,ParamAction,Img_ACTION_CHANGE_IMAGE); // Replace existing image by new image
|
||||
UniqueId,ParamUploadImg->Action,Img_ACTION_CHANGE_IMAGE); // Replace existing image by new image
|
||||
if (OptionsDisabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />"
|
||||
|
@ -1133,23 +1111,26 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,
|
|||
"</label>"
|
||||
"<input type=\"file\" name=\"%s\" accept=\"image/*\"",
|
||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Change_image,
|
||||
ParamFile);
|
||||
ParamUploadImg->File);
|
||||
if (OptionsDisabled)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," onchange=\"document.getElementById('chg_img_%u').checked = true;\" />",
|
||||
UniqueId);
|
||||
|
||||
/***** Image title/attribution *****/
|
||||
fprintf (Gbl.F.Out,"<br />"
|
||||
"<input type=\"text\" name=\"%s\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"%s\">",
|
||||
ParamUploadImg->Title,Txt_Image_title_attribution,Txt_optional,
|
||||
ClassImgTit,Img_MAX_BYTES_TITLE,Image->Title ? Image->Title : "");
|
||||
|
||||
/***** End container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/***** Image title/attribution *****/
|
||||
fprintf (Gbl.F.Out,"<br />"
|
||||
"<input type=\"text\" name=\"%s\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"%s\">",
|
||||
ParamTitle,Txt_Image_title_attribution,Txt_optional,
|
||||
ClassTitle,Img_MAX_BYTES_TITLE,Image->Title ? Image->Title : "");
|
||||
|
||||
/***** End container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
else // No current image
|
||||
/***** Attached image (optional) *****/
|
||||
Img_PutImageUploader (ClassImgTit,ParamUploadImg);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4383,6 +4364,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
|||
char ParamAction[32];
|
||||
char ParamFile[32];
|
||||
char ParamTitle[32];
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Start frame *****/
|
||||
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
|
||||
|
@ -4489,9 +4471,12 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
|||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Stem,
|
||||
Stem);
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Tst_PutFormToEditQstImage (&Gbl.Test.Image,"TEST_IMG_EDIT_ONE_STEM",
|
||||
"STEM", // Title / attribution
|
||||
"ImgAct","ImgFil","ImgTit",false);
|
||||
&ParamUploadImg,false);
|
||||
|
||||
/***** Feedback *****/
|
||||
fprintf (Gbl.F.Out,"<label class=\"%s\">"
|
||||
|
@ -4710,10 +4695,13 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
|
|||
sprintf (ParamAction,"ImgAct%u",NumOpt);
|
||||
sprintf (ParamFile ,"ImgFil%u",NumOpt);
|
||||
sprintf (ParamTitle ,"ImgTit%u",NumOpt);
|
||||
ParamUploadImg.Action = ParamAction;
|
||||
ParamUploadImg.File = ParamFile;
|
||||
ParamUploadImg.Title = ParamTitle;
|
||||
Tst_PutFormToEditQstImage (&Gbl.Test.Answer.Options[NumOpt].Image,
|
||||
"TEST_IMG_EDIT_ONE_ANS",
|
||||
"ANS_STR", // Title / attribution
|
||||
ParamAction,ParamFile,ParamTitle,
|
||||
&ParamUploadImg,
|
||||
OptionsDisabled);
|
||||
|
||||
/* Feedback */
|
||||
|
@ -5159,6 +5147,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
char ParamAction[32];
|
||||
char ParamFile[32];
|
||||
char ParamTitle[32];
|
||||
struct ParamUploadImg ParamUploadImg;
|
||||
|
||||
/***** Get question code *****/
|
||||
Gbl.Test.QstCod = Tst_GetQstCod ();
|
||||
|
@ -5198,9 +5187,12 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
Par_GetParToHTML ("Feedback",Feedback,Cns_MAX_BYTES_TEXT);
|
||||
|
||||
/***** Get image associated to the stem (action, file and title) *****/
|
||||
ParamUploadImg.Action = "ImgAct";
|
||||
ParamUploadImg.File = "ImgFil";
|
||||
ParamUploadImg.Title = "ImgTit";
|
||||
Img_GetImageFromForm (Tst_MAX_OPTIONS_PER_QUESTION,&Gbl.Test.Image,
|
||||
Tst_GetImageFromDB,
|
||||
"ImgAct","ImgFil","ImgTit",
|
||||
&ParamUploadImg,
|
||||
Tst_IMAGE_SAVED_MAX_WIDTH,
|
||||
Tst_IMAGE_SAVED_MAX_HEIGHT,
|
||||
Tst_IMAGE_SAVED_QUALITY);
|
||||
|
@ -5259,9 +5251,12 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
|
|||
sprintf (ParamAction,"ImgAct%u",NumOpt);
|
||||
sprintf (ParamFile ,"ImgFil%u",NumOpt);
|
||||
sprintf (ParamTitle ,"ImgTit%u",NumOpt);
|
||||
ParamUploadImg.Action = ParamAction;
|
||||
ParamUploadImg.File = ParamFile;
|
||||
ParamUploadImg.Title = ParamTitle;
|
||||
Img_GetImageFromForm (NumOpt,&Gbl.Test.Answer.Options[NumOpt].Image,
|
||||
Tst_GetImageFromDB,
|
||||
ParamAction,ParamFile,ParamTitle,
|
||||
&ParamUploadImg,
|
||||
Tst_IMAGE_SAVED_MAX_WIDTH,
|
||||
Tst_IMAGE_SAVED_MAX_HEIGHT,
|
||||
Tst_IMAGE_SAVED_QUALITY);
|
||||
|
|
Loading…
Reference in New Issue