Version 15.175.2

This commit is contained in:
Antonio Cañas Vargas 2016-04-03 14:18:43 +02:00
parent f87a296b67
commit 3b6bcef14c
4 changed files with 26 additions and 14 deletions

View File

@ -140,14 +140,15 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.175.1 (2016-04-03)"
#define Log_PLATFORM_VERSION "SWAD 15.175.2 (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.2: Apr 03, 2016 Check button to remove image when editing one test question. (? lines)
Version 15.175.3: Apr 03, 2016 Check button to remove image when editing one test question. (? lines)
Version 15.175.2: Apr 03, 2016 Code refactoring related to deleting image file. (197773 lines)
Version 15.175.1: Apr 03, 2016 Code refactoring related to deleting tests of a course. (197763 lines)
Version 15.175: Apr 03, 2016 Fixed bug when editing a test question.
Lot of code refactoring related to edition of questions.

View File

@ -265,3 +265,23 @@ void Img_ShowImage (const char *Image,const char *ClassImg)
URL,ClassImg);
}
/*****************************************************************************/
/** Remove private file with an image, given the image name (without .jpg) ***/
/*****************************************************************************/
void Img_RemoveImageFile (const char *ImageName)
{
char FullPathImgPriv[PATH_MAX+1];
/***** Build path to private file *****/
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s.jpg",
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
ImageName[0],
ImageName[1],
ImageName);
/***** Remove private file *****/
unlink (FullPathImgPriv);
// Public links are removed automatically after a period
}

View File

@ -74,5 +74,6 @@ typedef enum
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);
#endif

View File

@ -5476,7 +5476,6 @@ void Tst_RemoveImageFilesFromQstsInCrs (long CrsCod,
MYSQL_ROW row;
unsigned NumImages;
unsigned NumImg;
char FullPathImgPriv[PATH_MAX+1];
/***** Get names of images associated to test questions from database *****/
if (QstCod > 0) // Only one question
@ -5497,17 +5496,8 @@ void Tst_RemoveImageFilesFromQstsInCrs (long CrsCod,
/***** Get image name (row[0]) *****/
row = mysql_fetch_row (mysql_res);
/***** Build path to private file *****/
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s.jpg",
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
row[0][0],
row[0][1],
row[0]);
/***** Remove private file *****/
unlink (FullPathImgPriv);
// Public links are removed automatically after a period
/***** Remove image file *****/
Img_RemoveImageFile (row[0]);
}
/***** Free structure that stores the query result *****/