Version 15.189.2

This commit is contained in:
Antonio Cañas Vargas 2016-04-08 20:21:33 +02:00
parent ca3ba405cd
commit ad46ffcbf1
6 changed files with 50 additions and 28 deletions

View File

@ -1945,7 +1945,8 @@ a:hover img.CENTRE_PHOTO_SHOW
.SOCIAL_IMG_TIT_POST
{
box-sizing:border-box;
width:480px;
width:440px;
margin-bottom:10px;
}
.SOCIAL_TXT
{
@ -2061,6 +2062,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
box-sizing:border-box;
width:440px;
margin-bottom:10px;
}
/*********************************** Messages ********************************/

View File

@ -635,13 +635,14 @@ function expandTextarea (textareaElem,idButton,rows) {
}
// Contract textarea when focus. Called from a textarea onblur
/*
function contractTextarea (textareaElem,idButton,rows) {
if (textareaElem.value == '') {
document.getElementById(idButton).style.display = 'none';
textareaElem.rows = rows;
}
}
*/
// Change display of a test answer
function toggleAnswer (option) {
toggleDisplay('ans_' + option);

View File

@ -133,14 +133,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.189.1 (2016-04-08)"
#define CSS_FILE "swad15.188.css"
#define Log_PLATFORM_VERSION "SWAD 15.189.2 (2016-04-08)"
#define CSS_FILE "swad15.189.2.css"
#define JS_FILE "swad15.186.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.189.2: Apr 08, 2016 Remove file of the image attached to a social post when the post is removed. (? lines)
Version 15.189.2: Apr 08, 2016 Remove file of the image attached to a social post when the post is removed. (199017 lines)
Version 15.189.1: Apr 08, 2016 Change in layout of form to write a new social post. (198997 lines)
Version 15.189: Apr 08, 2016 Get image attached to a social post. (198991 lines)
2 changes necessary in database:

View File

@ -231,14 +231,6 @@ struct Param *Fil_StartReceptionOfFile (const char *ParamFile,
/***** Get parameter *****/
Par_GetParameter (Par_PARAM_SINGLE,ParamFile,NULL,Fil_MAX_FILE_SIZE,&Param);
Lay_ShowAlert (Lay_ERROR,ParamFile); // !!!!!!!!!!!!!!
Lay_ShowAlert (Lay_ERROR,"Fil_StartReceptionOfFile () - 0"); // !!!!!!!!!!!!!!
sprintf (Gbl.Message,"Param->FileName.Start = %lu Param->FileName.Length = %lu",
Param->FileName.Start,Param->FileName.Length);
Lay_ShowAlert (Lay_ERROR,Gbl.Message); // !!!!!!!!!!!!!!
/***** Get filename *****/
/* Check if filename exists */
if (Param->FileName.Start == 0 ||
@ -249,14 +241,12 @@ struct Param *Fil_StartReceptionOfFile (const char *ParamFile,
}
if (Param->FileName.Length > PATH_MAX)
Lay_ShowErrorAndExit ("Error while getting filename.");
Lay_ShowAlert (Lay_ERROR,"Fil_StartReceptionOfFile () - 1"); // !!!!!!!!!!!!!!
/* Copy filename */
fseek (Gbl.F.Tmp,Param->FileName.Start,SEEK_SET);
if (fread (FileName,sizeof (char),Param->FileName.Length,Gbl.F.Tmp) !=
Param->FileName.Length)
Lay_ShowErrorAndExit ("Error while getting filename.");
Lay_ShowAlert (Lay_ERROR,"Fil_StartReceptionOfFile () - 2"); // !!!!!!!!!!!!!!
/***** Get MIME type *****/
/* Check if MIME type exists */
@ -264,7 +254,6 @@ struct Param *Fil_StartReceptionOfFile (const char *ParamFile,
Param->ContentType.Length == 0 ||
Param->ContentType.Length > Brw_MAX_BYTES_MIME_TYPE)
Lay_ShowErrorAndExit ("Error while getting content type.");
Lay_ShowAlert (Lay_ERROR,"Fil_StartReceptionOfFile () - 3"); // !!!!!!!!!!!!!!
/* Copy MIME type */
fseek (Gbl.F.Tmp,Param->ContentType.Start,SEEK_SET);
@ -272,7 +261,6 @@ struct Param *Fil_StartReceptionOfFile (const char *ParamFile,
Param->ContentType.Length)
Lay_ShowErrorAndExit ("Error while getting content type.");
MIMEType[Param->ContentType.Length] = '\0';
Lay_ShowAlert (Lay_ERROR,"Fil_StartReceptionOfFile () - 4"); // !!!!!!!!!!!!!!
return Param;
}

View File

@ -218,6 +218,7 @@ static long Soc_UnfavSocialComment (void);
static void Soc_RequestRemovalSocialNote (void);
static void Soc_RemoveSocialNote (void);
static void Soc_RemoveImgFileFromSocialPost (long PstCod);
static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot);
static long Soc_GetNotCodOfSocialPublishing (long PubCod);
@ -2012,12 +2013,13 @@ static void Soc_PutTextarea (const char *Placeholder,
fprintf (Gbl.F.Out,"<textarea name=\"Content\" rows=\"1\" maxlength=\"%u\""
" placeholder=\"%s&hellip;\""
" class=\"%s\""
" onfocus=\"expandTextarea(this,'%s','5');\""
" onblur=\"contractTextarea(this,'%s','1');\">"
" onfocus=\"expandTextarea(this,'%s','5');\">"
// " onblur=\"contractTextarea(this,'%s','1');\">"
"</textarea>",
Soc_MAX_CHARS_IN_POST,
Placeholder,ClassTextArea,
IdDivImgButton,IdDivImgButton);
// IdDivImgButton,
IdDivImgButton);
/***** Start concealable div *****/
fprintf (Gbl.F.Out,"<div id=\"%s\" style=\"display:none;\">",
@ -2053,8 +2055,7 @@ static void Soc_PutTextarea (const char *Placeholder,
fprintf (Gbl.F.Out,"<button type=\"submit\""
" class=\"BT_SUBMIT_INLINE BT_CREATE\">"
"%s"
"</button>"
"</div>",
"</button>",
Txt_Post);
/***** End hidden div *****/
@ -3553,7 +3554,11 @@ static void Soc_RemoveSocialNote (void)
if (Gbl.Usrs.Me.Logged &&
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author of this note
{
/***** Delete social publishing from database *****/
if (SocNot.NoteType == Soc_NOTE_SOCIAL_POST)
/***** Remove image file associated to social post *****/
Soc_RemoveImgFileFromSocialPost (SocNot.Cod);
/***** Delete social note from database *****/
Soc_RemoveASocialNoteFromDB (&SocNot);
/***** Message of success *****/
@ -3564,6 +3569,32 @@ static void Soc_RemoveSocialNote (void)
Lay_ShowAlert (Lay_WARNING,Txt_The_original_post_no_longer_exists);
}
/*****************************************************************************/
/************** Remove one file associated to a social post ******************/
/*****************************************************************************/
static void Soc_RemoveImgFileFromSocialPost (long PstCod)
{
char Query[128];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
/***** Get name of image associated to a social post from database *****/
sprintf (Query,"SELECT ImageName FROM social_posts WHERE PstCod='%ld'",
PstCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get image"))
{
/***** Get image name (row[0]) *****/
row = mysql_fetch_row (mysql_res);
/***** Remove image file *****/
Img_RemoveImageFile (row[0]);
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/
/******************* Remove a social note from database **********************/
/*****************************************************************************/

View File

@ -6122,7 +6122,7 @@ static void Tst_RemoveImgFileFromStemOfQst (long CrsCod,long QstCod)
sprintf (Query,"SELECT ImageName FROM tst_questions"
" WHERE QstCod='%ld' AND CrsCod='%ld'",
QstCod,CrsCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get test images"))
if (DB_QuerySELECT (Query,&mysql_res,"can not get image"))
{
/***** Get image name (row[0]) *****/
row = mysql_fetch_row (mysql_res);
@ -6152,7 +6152,7 @@ static void Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (long CrsCod)
sprintf (Query,"SELECT ImageName FROM tst_questions"
" WHERE CrsCod='%ld'",
CrsCod);
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get test images");
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
/***** Go over result removing image files *****/
for (NumImg = 0;
@ -6189,7 +6189,7 @@ static void Tst_RemoveImgFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsI
" AND tst_answers.QstCod='%ld'"
" AND tst_answers.AnsInd='%u'",
CrsCod,QstCod,QstCod,AnsInd);
if (DB_QuerySELECT (Query,&mysql_res,"can not get test images"))
if (DB_QuerySELECT (Query,&mysql_res,"can not get images"))
{
/***** Get image name (row[0]) *****/
row = mysql_fetch_row (mysql_res);
@ -6222,7 +6222,7 @@ static void Tst_RemoveAllImgFilesFromAnsOfQst (long CrsCod,long QstCod)
" AND tst_questions.QstCod=tst_answers.QstCod"
" AND tst_answers.QstCod='%ld'",
CrsCod,QstCod,QstCod);
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get test images");
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
/***** Go over result removing image files *****/
for (NumImg = 0;
@ -6259,7 +6259,7 @@ static void Tst_RemoveAllImgFilesFromAnsOfAllQstsInCrs (long CrsCod)
" WHERE tst_questions.CrsCod='%ld'"
" AND tst_questions.QstCod=tst_answers.QstCod",
CrsCod);
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get test images");
NumImages = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get images");
/***** Go over result removing image files *****/
for (NumImg = 0;