mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-02 14:55:23 +02:00
Version18.81.4
This commit is contained in:
parent
b850096759
commit
033766858f
|
@ -459,10 +459,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.81.3 (2019-03-19)"
|
#define Log_PLATFORM_VERSION "SWAD 18.81.4 (2019-03-19)"
|
||||||
#define CSS_FILE "swad18.80.css"
|
#define CSS_FILE "swad18.80.css"
|
||||||
#define JS_FILE "swad18.80.js"
|
#define JS_FILE "swad18.80.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.81.4: Mar 19, 2019 Code refactoring related to media. (240586 lines)
|
||||||
Version 18.81.3: Mar 19, 2019 Remove unused fields MediaName,MediaType,MediaTitle,MediaURL,Media from tables. (240657 lines)
|
Version 18.81.3: Mar 19, 2019 Remove unused fields MediaName,MediaType,MediaTitle,MediaURL,Media from tables. (240657 lines)
|
||||||
8 changes necessary in database:
|
8 changes necessary in database:
|
||||||
ALTER TABLE forum_post DROP COLUMN MediaName,DROP COLUMN MediaType,DROP COLUMN MediaTitle,DROP COLUMN MediaURL;
|
ALTER TABLE forum_post DROP COLUMN MediaName,DROP COLUMN MediaType,DROP COLUMN MediaTitle,DROP COLUMN MediaURL;
|
||||||
|
|
14
swad_forum.c
14
swad_forum.c
|
@ -500,18 +500,8 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
||||||
{
|
{
|
||||||
long PstCod;
|
long PstCod;
|
||||||
|
|
||||||
/***** Check if image is received and processed *****/
|
/***** Store media in filesystem and database *****/
|
||||||
Media->MedCod = -1L;
|
Med_RemoveKeepOrStoreMedia (-1L,Media);
|
||||||
if (Media->Action == Med_ACTION_NEW_MEDIA && // New media
|
|
||||||
Media->Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed media to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Media->Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (Media); // Set Media->MedCod
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Insert forum post in the database *****/
|
/***** Insert forum post in the database *****/
|
||||||
PstCod =
|
PstCod =
|
||||||
|
|
44
swad_media.c
44
swad_media.c
|
@ -1137,6 +1137,50 @@ static void Med_GetAndProcessEmbedFromForm (const char *ParamURL,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**** Remove media, keep media or store media, depending on media action *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Med_RemoveKeepOrStoreMedia (long CurrentMedCodInDB,struct Media *Media)
|
||||||
|
{
|
||||||
|
switch (Media->Action)
|
||||||
|
{
|
||||||
|
case Med_ACTION_NO_MEDIA:
|
||||||
|
/* Remove possible current media */
|
||||||
|
Med_RemoveMedia (Media->MedCod);
|
||||||
|
|
||||||
|
/* Reset media data */
|
||||||
|
Med_ResetMedia (Media);
|
||||||
|
break;
|
||||||
|
case Med_ACTION_KEEP_MEDIA:
|
||||||
|
/* Keep current media */
|
||||||
|
Media->MedCod = CurrentMedCodInDB;
|
||||||
|
Med_GetMediaDataByCod (Media);
|
||||||
|
break;
|
||||||
|
case Med_ACTION_NEW_MEDIA:
|
||||||
|
/* Remove possible current media */
|
||||||
|
Med_RemoveMedia (Media->MedCod);
|
||||||
|
|
||||||
|
/* New media received and processed sucessfully? */
|
||||||
|
if (Media->Status == Med_PROCESSED) // The new media received has been processed
|
||||||
|
{
|
||||||
|
/* Move processed media to definitive directory */
|
||||||
|
Med_MoveMediaToDefinitiveDir (Media);
|
||||||
|
|
||||||
|
if (Media->Status == Med_MOVED)
|
||||||
|
/* Store media in database */
|
||||||
|
Med_StoreMediaInDB (Media); // Set Media->MedCod
|
||||||
|
else
|
||||||
|
/* Reset media data */
|
||||||
|
Med_ResetMedia (Media);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Reset media data */
|
||||||
|
Med_ResetMedia (Media);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Move temporary processed media file to definitive private directory ****/
|
/**** Move temporary processed media file to definitive private directory ****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -145,6 +145,7 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
|
||||||
const char *SectionForAlerts);
|
const char *SectionForAlerts);
|
||||||
void Med_SetParamNames (struct ParamUploadMedia *ParamUploadMedia,int NumMediaInForm);
|
void Med_SetParamNames (struct ParamUploadMedia *ParamUploadMedia,int NumMediaInForm);
|
||||||
|
|
||||||
|
void Med_RemoveKeepOrStoreMedia (long CurrentMedCodInDB,struct Media *Media);
|
||||||
void Med_MoveMediaToDefinitiveDir (struct Media *Media);
|
void Med_MoveMediaToDefinitiveDir (struct Media *Media);
|
||||||
void Med_StoreMediaInDB (struct Media *Media);
|
void Med_StoreMediaInDB (struct Media *Media);
|
||||||
|
|
||||||
|
|
|
@ -1281,18 +1281,8 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
|
||||||
{
|
{
|
||||||
long MsgCod;
|
long MsgCod;
|
||||||
|
|
||||||
/***** Check if image is received and processed *****/
|
/***** Store media in filesystem and database *****/
|
||||||
Media->MedCod = -1L;
|
Med_RemoveKeepOrStoreMedia (-1L,Media);
|
||||||
if (Media->Action == Med_ACTION_NEW_MEDIA && // New media
|
|
||||||
Media->Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed image to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Media->Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (Media); // Set Media->MedCod
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Insert message subject and content in the database *****/
|
/***** Insert message subject and content in the database *****/
|
||||||
MsgCod =
|
MsgCod =
|
||||||
|
|
158
swad_test.c
158
swad_test.c
|
@ -257,6 +257,7 @@ static void Tst_FreeMediaOfQuestion (void);
|
||||||
|
|
||||||
static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||||
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
char Feedback[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
|
static long Tst_GetMedCodFromDB (int NumOpt);
|
||||||
static void Tst_GetMediaFromDB (int NumOpt,struct Media *Media);
|
static void Tst_GetMediaFromDB (int NumOpt,struct Media *Media);
|
||||||
|
|
||||||
static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *UnsignedStr);
|
static Tst_AnswerType_t Tst_ConvertFromUnsignedStrToAnsTyp (const char *UnsignedStr);
|
||||||
|
@ -281,10 +282,8 @@ static void Tst_RemAnsFromQst (void);
|
||||||
static void Tst_RemTagsFromQst (void);
|
static void Tst_RemTagsFromQst (void);
|
||||||
static void Tst_RemoveUnusedTagsFromCurrentCrs (void);
|
static void Tst_RemoveUnusedTagsFromCurrentCrs (void);
|
||||||
|
|
||||||
static void Tst_RemoveMediaFromStemOfQst (long CrsCod,long QstCod);
|
|
||||||
static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
|
static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
|
||||||
static void Tst_RemoveMediaFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd);
|
static void Tst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod);
|
||||||
static void Tst_RemoveAllMedFilesFromAnsOfQst (long CrsCod,long QstCod);
|
|
||||||
static void Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
|
static void Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
|
||||||
|
|
||||||
static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsType,struct Tst_Stats *Stats);
|
static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsType,struct Tst_Stats *Stats);
|
||||||
|
@ -5635,15 +5634,16 @@ static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Get possible media associated with a test question from database ******/
|
/******* Get media code associated with a test question from database ********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// NumOpt < 0 ==> media associated to stem
|
// NumOpt < 0 ==> media associated to stem
|
||||||
// NumOpt >= 0 ==> media associated to answer
|
// NumOpt >= 0 ==> media associated to answer
|
||||||
|
|
||||||
static void Tst_GetMediaFromDB (int NumOpt,struct Media *Media)
|
static long Tst_GetMedCodFromDB (int NumOpt)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
long MedCod;
|
||||||
|
|
||||||
/***** Query depending on NumOpt *****/
|
/***** Query depending on NumOpt *****/
|
||||||
if (NumOpt < 0)
|
if (NumOpt < 0)
|
||||||
|
@ -5663,12 +5663,26 @@ static void Tst_GetMediaFromDB (int NumOpt,struct Media *Media)
|
||||||
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get media (row[0]) *****/
|
/***** Get media code (row[0]) *****/
|
||||||
Media->MedCod = Str_ConvertStrCodToLongCod (row[0]);
|
MedCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
Med_GetMediaDataByCod (Media);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
|
return MedCod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***** Get possible media associated with a test question from database ******/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// NumOpt < 0 ==> media associated to stem
|
||||||
|
// NumOpt >= 0 ==> media associated to an answer option
|
||||||
|
|
||||||
|
static void Tst_GetMediaFromDB (int NumOpt,struct Media *Media)
|
||||||
|
{
|
||||||
|
/***** Get media *****/
|
||||||
|
Media->MedCod = Tst_GetMedCodFromDB (NumOpt);
|
||||||
|
Med_GetMediaDataByCod (Media);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6134,37 +6148,11 @@ bool Tst_CheckIfQstFormatIsCorrectAndCountNumOptions (void)
|
||||||
static void Tst_MoveMediaToDefinitiveDirectories (void)
|
static void Tst_MoveMediaToDefinitiveDirectories (void)
|
||||||
{
|
{
|
||||||
unsigned NumOpt;
|
unsigned NumOpt;
|
||||||
|
long CurrentMedCodInDB;
|
||||||
|
|
||||||
/***** Media associated to question stem *****/
|
/***** Media associated to question stem *****/
|
||||||
Gbl.Test.Media.MedCod = -1L; // By default, no media is associated to question stem
|
CurrentMedCodInDB = Tst_GetMedCodFromDB (-1L); // Get current media code associated to stem
|
||||||
switch (Gbl.Test.Media.Action)
|
Med_RemoveKeepOrStoreMedia (CurrentMedCodInDB,&Gbl.Test.Media);
|
||||||
{
|
|
||||||
case Med_ACTION_NO_MEDIA:
|
|
||||||
/* Remove possible files with the old media */
|
|
||||||
if (Gbl.Test.QstCod > 0) // Question already exists
|
|
||||||
Tst_RemoveMediaFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
|
|
||||||
break;
|
|
||||||
case Med_ACTION_KEEP_MEDIA:
|
|
||||||
/* Get current media associated to question */
|
|
||||||
Tst_GetMediaFromDB (-1,&Gbl.Test.Media);
|
|
||||||
break;
|
|
||||||
case Med_ACTION_NEW_MEDIA:
|
|
||||||
/* Remove possible files with the old media */
|
|
||||||
if (Gbl.Test.QstCod > 0) // Question already exists
|
|
||||||
Tst_RemoveMediaFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
|
|
||||||
|
|
||||||
/* New media received and processed sucessfully? */
|
|
||||||
if (Gbl.Test.Media.Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed media to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (&Gbl.Test.Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Gbl.Test.Media.Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (&Gbl.Test.Media); // Set Gbl.Test.Media.MedCod
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****** Move media associated to answers *****/
|
/****** Move media associated to answers *****/
|
||||||
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
|
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
|
||||||
|
@ -6173,35 +6161,8 @@ static void Tst_MoveMediaToDefinitiveDirectories (void)
|
||||||
NumOpt < Gbl.Test.Answer.NumOptions;
|
NumOpt < Gbl.Test.Answer.NumOptions;
|
||||||
NumOpt++)
|
NumOpt++)
|
||||||
{
|
{
|
||||||
Gbl.Test.Answer.Options[NumOpt].Media.MedCod = -1L; // By default, no media is associated to answer stem
|
CurrentMedCodInDB = Tst_GetMedCodFromDB (NumOpt); // Get current media code associated to this option
|
||||||
switch (Gbl.Test.Answer.Options[NumOpt].Media.Action)
|
Med_RemoveKeepOrStoreMedia (CurrentMedCodInDB,&Gbl.Test.Answer.Options[NumOpt].Media);
|
||||||
{
|
|
||||||
case Med_ACTION_NO_MEDIA:
|
|
||||||
/* Remove possible files with the old media */
|
|
||||||
if (Gbl.Test.QstCod > 0) // Question already exists
|
|
||||||
Tst_RemoveMediaFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod,NumOpt);
|
|
||||||
break;
|
|
||||||
case Med_ACTION_KEEP_MEDIA:
|
|
||||||
/* Get current media associated to question */
|
|
||||||
Tst_GetMediaFromDB (NumOpt,&Gbl.Test.Answer.Options[NumOpt].Media);
|
|
||||||
break;
|
|
||||||
case Med_ACTION_NEW_MEDIA:
|
|
||||||
/* Remove possible files with the old media */
|
|
||||||
if (Gbl.Test.QstCod > 0) // Question already exists
|
|
||||||
Tst_RemoveMediaFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod,NumOpt);
|
|
||||||
|
|
||||||
/* New media received and processed sucessfully? */
|
|
||||||
if (Gbl.Test.Answer.Options[NumOpt].Media.Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed media to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (&Gbl.Test.Answer.Options[NumOpt].Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Gbl.Test.Answer.Options[NumOpt].Media.Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (&Gbl.Test.Answer.Options[NumOpt].Media); // Set Gbl.Test.Answer.Options[NumOpt].Media.MedCod
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6402,6 +6363,7 @@ void Tst_RemoveQst (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Question_removed;
|
extern const char *Txt_Question_removed;
|
||||||
bool EditingOnlyThisQst;
|
bool EditingOnlyThisQst;
|
||||||
|
long MedCod;
|
||||||
|
|
||||||
/***** Get the question code *****/
|
/***** Get the question code *****/
|
||||||
Gbl.Test.QstCod = Tst_GetQstCod ();
|
Gbl.Test.QstCod = Tst_GetQstCod ();
|
||||||
|
@ -6412,9 +6374,13 @@ void Tst_RemoveQst (void)
|
||||||
to continue listing the rest of questions ******/
|
to continue listing the rest of questions ******/
|
||||||
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
|
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
|
||||||
|
|
||||||
/***** Remove images associated to question *****/
|
/***** Remove media associated to question *****/
|
||||||
Tst_RemoveAllMedFilesFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
|
/* Remove media associated to answers */
|
||||||
Tst_RemoveMediaFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
|
Tst_RemoveMediaFromAllAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
|
||||||
|
|
||||||
|
/* Remove media associated to stem */
|
||||||
|
MedCod = Tst_GetMedCodFromDB (-1L);
|
||||||
|
Med_RemoveMedia (MedCod);
|
||||||
|
|
||||||
/***** Remove the question from all the tables *****/
|
/***** Remove the question from all the tables *****/
|
||||||
/* Remove answers and tags from this test question */
|
/* Remove answers and tags from this test question */
|
||||||
|
@ -6720,30 +6686,6 @@ static void Tst_RemoveUnusedTagsFromCurrentCrs (void)
|
||||||
Gbl.CurrentCrs.Crs.CrsCod);
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********** Remove media associated to one stem of one test question *********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Tst_RemoveMediaFromStemOfQst (long CrsCod,long QstCod)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumMedia;
|
|
||||||
|
|
||||||
/***** Get media codes associated to stem of a test question from database *****/
|
|
||||||
NumMedia =
|
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
|
||||||
"SELECT MedCod" // row[0]
|
|
||||||
" FROM tst_questions"
|
|
||||||
" WHERE QstCod=%ld AND CrsCod=%ld",
|
|
||||||
QstCod,CrsCod);
|
|
||||||
|
|
||||||
/***** Remove media *****/
|
|
||||||
Med_RemoveMediaFromAllRows (NumMedia,mysql_res);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/** Remove all media associated to stems of all test questions in a course ***/
|
/** Remove all media associated to stems of all test questions in a course ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -6768,39 +6710,11 @@ static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********* Remove media associated to one answer of a test question **********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Tst_RemoveMediaFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
unsigned NumMedia;
|
|
||||||
|
|
||||||
/***** Get media codes associated to an answer of a test question from database *****/
|
|
||||||
NumMedia =
|
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
|
||||||
"SELECT tst_answers.MedCod" // row[0]
|
|
||||||
" FROM tst_questions,tst_answers"
|
|
||||||
" WHERE tst_questions.CrsCod=%ld"// Extra check
|
|
||||||
" AND tst_questions.QstCod=%ld" // Extra check
|
|
||||||
" AND tst_questions.QstCod=tst_answers.QstCod"
|
|
||||||
" AND tst_answers.QstCod=%ld"
|
|
||||||
" AND tst_answers.AnsInd=%u",
|
|
||||||
CrsCod,QstCod,QstCod,AnsInd);
|
|
||||||
|
|
||||||
/***** Go over result removing media files *****/
|
|
||||||
Med_RemoveMediaFromAllRows (NumMedia,mysql_res);
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******* Remove all media associated to all answers of a test question *******/
|
/******* Remove all media associated to all answers of a test question *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Tst_RemoveAllMedFilesFromAnsOfQst (long CrsCod,long QstCod)
|
static void Tst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
unsigned NumMedia;
|
unsigned NumMedia;
|
||||||
|
|
|
@ -2472,18 +2472,8 @@ static long TL_ReceivePost (void)
|
||||||
if (Content[0] || // Text not empty
|
if (Content[0] || // Text not empty
|
||||||
Media.Status == Med_PROCESSED) // A media is attached
|
Media.Status == Med_PROCESSED) // A media is attached
|
||||||
{
|
{
|
||||||
/***** Check if media is received and processed *****/
|
/***** Store media in filesystem and database *****/
|
||||||
Media.MedCod = -1L;
|
Med_RemoveKeepOrStoreMedia (-1L,&Media);
|
||||||
if (Media.Action == Med_ACTION_NEW_MEDIA && // New media
|
|
||||||
Media.Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed image to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (&Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Media.Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (&Media); // Set Media.MedCod
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Publish *****/
|
/***** Publish *****/
|
||||||
/* Insert post content in the database */
|
/* Insert post content in the database */
|
||||||
|
@ -3198,18 +3188,8 @@ static long TL_ReceiveComment (void)
|
||||||
if (Content[0] || // Text not empty
|
if (Content[0] || // Text not empty
|
||||||
Media.Status == Med_PROCESSED) // A media is attached
|
Media.Status == Med_PROCESSED) // A media is attached
|
||||||
{
|
{
|
||||||
/***** Check if media is received and processed *****/
|
/***** Store media in filesystem and database *****/
|
||||||
Media.MedCod = -1L;
|
Med_RemoveKeepOrStoreMedia (-1L,&Media);
|
||||||
if (Media.Action == Med_ACTION_NEW_MEDIA && // New media
|
|
||||||
Media.Status == Med_PROCESSED) // The new media received has been processed
|
|
||||||
{
|
|
||||||
/* Move processed image to definitive directory */
|
|
||||||
Med_MoveMediaToDefinitiveDir (&Media);
|
|
||||||
|
|
||||||
/* Store media in database */
|
|
||||||
if (Media.Status == Med_MOVED)
|
|
||||||
Med_StoreMediaInDB (&Media); // Set Media.MedCod
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Publish *****/
|
/***** Publish *****/
|
||||||
/* Insert into publications */
|
/* Insert into publications */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user