mirror of https://github.com/acanas/swad-core.git
Version 20.36.11: Feb 27, 2021 Query moved to module swad_timeline_database.
This commit is contained in:
parent
c2a05d146d
commit
70bd31cf91
|
@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.10 (2021-02-07)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.11 (2021-02-07)"
|
||||
#define CSS_FILE "swad20.33.9.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
|
@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err
|
|||
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
|
||||
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
||||
|
||||
Version 20.36.11: Feb 27, 2021 Query moved to module swad_timeline_database. (305246 lines)
|
||||
Version 20.36.10: Feb 27, 2021 Query moved to module swad_timeline_database. (305243 lines)
|
||||
Version 20.36.9: Feb 27, 2021 Query moved to module swad_timeline_database. (305233 lines)
|
||||
Version 20.36.8: Feb 27, 2021 Function moved to module swad_timeline_database. (305215 lines)
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long TL_DB_GetMedCodFromPub (long PubCod,const char *DBTable);
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Create a new note *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -128,6 +130,15 @@ void TL_DB_InsertNoteInVisibleTimeline (long NotCod)
|
|||
NotCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get code of media associated to post **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long TL_DB_GetMedCodFromPost (long PubCod)
|
||||
{
|
||||
return TL_DB_GetMedCodFromPub (PubCod,"tl_posts");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of comments in a note **********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -265,26 +276,7 @@ void TL_DB_InsertCommentContent (long PubCod,
|
|||
|
||||
long TL_DB_GetMedCodFromComment (long PubCod)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long MedCod = -1L; // Default value
|
||||
|
||||
/***** Get code of media associated to comment *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get media code",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM tl_comments"
|
||||
" WHERE PubCod=%ld",
|
||||
PubCod) == 1) // Result should have a unique row
|
||||
{
|
||||
/* Get media code */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
MedCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
}
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return MedCod;
|
||||
return TL_DB_GetMedCodFromPub (PubCod,"tl_comments");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -329,3 +321,31 @@ void TL_DB_RemoveCommentPub (long PubCod,long PublisherCod)
|
|||
PublisherCod,
|
||||
(unsigned) TL_Pub_COMMENT_TO_NOTE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get code of media associated to post/comment ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long TL_DB_GetMedCodFromPub (long PubCod,const char *DBTable)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long MedCod = -1L; // Default value
|
||||
|
||||
/***** Get code of media associated to comment *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get media code",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM %s"
|
||||
" WHERE PubCod=%ld",
|
||||
DBTable,PubCod) == 1) // Result should have a unique row
|
||||
{
|
||||
/* Get media code */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
MedCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
}
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return MedCod;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType,
|
|||
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod);
|
||||
void TL_DB_InsertNoteInVisibleTimeline (long NotCod);
|
||||
|
||||
/* Posts */
|
||||
long TL_DB_GetMedCodFromPost (long PubCod);
|
||||
|
||||
/* Comments */
|
||||
unsigned TL_DB_GetNumCommentsInNote (long NotCod);
|
||||
unsigned TL_DB_GetComments (long NotCod,MYSQL_RES **mysql_res);
|
||||
|
|
|
@ -1228,25 +1228,8 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
|
|||
|
||||
/***** Remove media associated to post *****/
|
||||
if (Not->NoteType == TL_NOTE_POST)
|
||||
{
|
||||
/* Remove media associated to a post from database */
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM tl_posts"
|
||||
" WHERE PstCod=%ld",
|
||||
Not->Cod) == 1) // Result should have a unique row
|
||||
{
|
||||
/* Get media code */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
MedCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Remove media */
|
||||
if ((MedCod = TL_DB_GetMedCodFromPost (Not->Cod)) > 0)
|
||||
Med_RemoveMedia (MedCod);
|
||||
}
|
||||
|
||||
/* Free structure that stores the query result */
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/***** Mark possible notifications on the publications
|
||||
of this note as removed *****/
|
||||
|
|
Loading…
Reference in New Issue