From 81b92b9d4aee0a45b5aac586161ca71e34e99b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 3 Apr 2016 17:49:09 +0200 Subject: [PATCH] Version 15.175.5 --- swad_changelog.h | 4 +++- swad_image.c | 19 ++++++++++++++++++- swad_image.h | 3 +++ swad_test.c | 44 +++++++++++++++++++++++++++++++------------- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 8dd8cc345..0d63e883c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -140,13 +140,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.175.4 (2016-04-03)" +#define Log_PLATFORM_VERSION "SWAD 15.175.5 (2016-04-03)" #define CSS_FILE "swad15.173.1.css" #define JS_FILE "swad15.131.3.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.175.6: Apr 03, 2016 Remove image associated to a test question. (? lines) + Version 15.175.5: Apr 03, 2016 Changes in reception of form to edit one test question. (197930 lines) Version 15.175.4: Apr 03, 2016 Changes in form to edit one test question. (197897 lines) Version 15.175.3: Apr 03, 2016 Change in edition of test question. (197804 lines) Version 15.175.2: Apr 03, 2016 Code refactoring related to deleting image file. (197773 lines) diff --git a/swad_image.c b/swad_image.c index 5c607fff2..d88f314a6 100644 --- a/swad_image.c +++ b/swad_image.c @@ -68,7 +68,24 @@ static void Img_ProcessImage (const char *FileNameImgOriginal, unsigned Width,unsigned Height,unsigned Quality); /*****************************************************************************/ -/****************** Get image of a test question from form *******************/ +/************************* Get image action from form ************************/ +/*****************************************************************************/ + +Img_Action_t Img_GetImageActionFromForm (void) + { + char UnsignedStr[10+1]; + unsigned UnsignedNum; + + Par_GetParToText ("ImgAct",UnsignedStr,10); + if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1) + Lay_ShowErrorAndExit ("Wrong action to perform on image."); + if (UnsignedNum >= Img_NUM_ACTIONS) + Lay_ShowErrorAndExit ("Wrong action to perform on image."); + return (Img_Action_t) UnsignedNum; + } + +/*****************************************************************************/ +/**************************** Get image from form ****************************/ /*****************************************************************************/ // Return true if image is created diff --git a/swad_image.h b/swad_image.h index e016a01cd..92ff11ff2 100644 --- a/swad_image.h +++ b/swad_image.h @@ -68,6 +68,7 @@ typedef enum } Img_Status_t; /***** Action to perform when editing a form with an image *****/ +#define Img_NUM_ACTIONS 3 typedef enum { Img_ACTION_NONE, // Do not use image (remove current image if exists) @@ -79,7 +80,9 @@ typedef enum /***************************** Public prototypes *****************************/ /*****************************************************************************/ +Img_Action_t Img_GetImageActionFromForm (void); void Img_GetImageFromForm (unsigned Width,unsigned Height,unsigned Quality); + void Img_MoveImageToDefinitiveDirectory (void); void Img_ShowImage (const char *Image,const char *ClassImg); void Img_RemoveImageFile (const char *ImageName); diff --git a/swad_test.c b/swad_test.c index 77fa114b7..bbfde06e4 100644 --- a/swad_test.c +++ b/swad_test.c @@ -1036,7 +1036,7 @@ static void Tst_PutFormToEditQstImage (void) extern const char *Txt_New_image; /***** No image *****/ - fprintf (Gbl.F.Out,"" + fprintf (Gbl.F.Out,"" "
", @@ -1061,7 +1061,7 @@ static void Tst_PutFormToEditQstImage (void) } /***** New image *****/ - fprintf (Gbl.F.Out,"", + fprintf (Gbl.F.Out,"", Img_ACTION_CHANGE); fprintf (Gbl.F.Out,"