diff --git a/swad_changelog.h b/swad_changelog.h index c0523c4b2..eefe899e3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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) diff --git a/swad_forum.c b/swad_forum.c index c2fe002b6..724938ef4 100644 --- a/swad_forum.c +++ b/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); diff --git a/swad_image.c b/swad_image.c index e42575965..bc1fe0073 100644 --- a/swad_image.c +++ b/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,"
"); /***** 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,"
"); + 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,"