diff --git a/swad_changelog.h b/swad_changelog.h index d154533a9..b82c6f1d7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -137,13 +137,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.194.2 (2016-04-14)" +#define Log_PLATFORM_VERSION "SWAD 15.195 (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.195: Apr 14, 2016 Code refactoring related to uploading images. (199355 lines) Version 15.194.2: Apr 14, 2016 Code refactoring related to uploading images. (199384 lines) 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) diff --git a/swad_forum.c b/swad_forum.c index 2029f0f64..97c1689ff 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -3779,7 +3779,6 @@ 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, @@ -3836,10 +3835,7 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject) Lay_HelpPlainEditor (); /***** Attached image (optional) *****/ - ParamUploadImg.Action = "ImgAct"; - ParamUploadImg.File = "ImgFil"; - ParamUploadImg.Title = "ImgTit"; - Img_PutImageUploader ("FOR_IMG_TIT",&ParamUploadImg); + Img_PutImageUploader (-1,"FOR_IMG_TIT"); /***** Send button *****/ Lay_PutCreateButton (Txt_Send_message); @@ -3866,7 +3862,6 @@ 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 (); @@ -3902,13 +3897,10 @@ void For_RecForumPst (void) Img_ImageConstructor (&Image); /***** Get attached image (action, file and title) *****/ - ParamUploadImg.Action = "ImgAct"; - ParamUploadImg.File = "ImgFil"; - ParamUploadImg.Title = "ImgTit"; Image.Width = For_IMAGE_SAVED_MAX_WIDTH; Image.Height = For_IMAGE_SAVED_MAX_HEIGHT; Image.Quality = For_IMAGE_SAVED_QUALITY; - Img_GetImageFromForm (-1,&Image,NULL,&ParamUploadImg); + Img_GetImageFromForm (-1,&Image,NULL); /***** Create a new message *****/ if (PstIsAReply) // This post is a reply to another posts in the thread diff --git a/swad_image.c b/swad_image.c index 3bcdaa18e..7619e3ccf 100644 --- a/swad_image.c +++ b/swad_image.c @@ -155,14 +155,17 @@ 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, - struct ParamUploadImg *ParamUploadImg) +void Img_PutImageUploader (int NumImgInForm,const char *ClassImgTit) { extern const char *Txt_Image; extern const char *Txt_optional; extern const char *Txt_Image_title_attribution; + struct ParamUploadImg ParamUploadImg; char Id[Act_MAX_LENGTH_ID]; + /***** Set names of parameters depending on number of image in form *****/ + Img_SetParamNames (&ParamUploadImg,NumImgInForm); + /***** Create unique id for this image uploader *****/ Act_SetUniqueId (Id); @@ -170,7 +173,7 @@ void Img_PutImageUploader (const char *ClassImgTit, fprintf (Gbl.F.Out,"
"); /***** Action to perform on image *****/ - Par_PutHiddenParamUnsigned (ParamUploadImg->Action,(unsigned) Img_ACTION_NEW_IMAGE); + Par_PutHiddenParamUnsigned (ParamUploadImg.Action,(unsigned) Img_ACTION_NEW_IMAGE); /***** Image file *****/ fprintf (Gbl.F.Out,"