mirror of https://github.com/acanas/swad-core.git
Version 20.36.16: Feb 27, 2021 Query moved to module swad_timeline_database.
This commit is contained in:
parent
fd99ef1116
commit
bf6f4616b4
|
@ -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.15 (2021-02-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.16 (2021-02-27)"
|
||||
#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.16: Feb 27, 2021 Query moved to module swad_timeline_database. (305317 lines)
|
||||
Version 20.36.15: Feb 27, 2021 Functions moved to module swad_timeline_database. (305305 lines)
|
||||
Version 20.36.14: Feb 27, 2021 Query moved to module swad_timeline_database. (305300 lines)
|
||||
Version 20.36.13: Feb 27, 2021 Functions moved to module swad_timeline_database. (305285 lines)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <linux/limits.h> // For PATH_MAX
|
||||
#include <stdio.h> // For asprintf
|
||||
|
||||
#include "swad_database.h"
|
||||
#include "swad_forum.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_message.h"
|
||||
|
|
|
@ -322,6 +322,23 @@ void TL_DB_RemoveNote (long NotCod,long PublisherCod)
|
|||
PublisherCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Get publication codes of comments of a note from database *****************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of rows got
|
||||
|
||||
unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get the content"
|
||||
" of a post",
|
||||
"SELECT Txt," // row[0]
|
||||
"MedCod" // row[1]
|
||||
" FROM tl_posts"
|
||||
" WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get code of media associated to post **********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -68,6 +68,7 @@ void TL_DB_RemoveNotePubs (long NotCod);
|
|||
void TL_DB_RemoveNote (long NotCod,long PublisherCod);
|
||||
|
||||
/* Posts */
|
||||
unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res);
|
||||
long TL_DB_GetMedCodFromPost (long PubCod);
|
||||
void TL_DB_RemovePost (long PstCod);
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "swad_alert.h"
|
||||
#include "swad_box.h"
|
||||
#include "swad_course.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_exam_announcement.h"
|
||||
#include "swad_forum.h"
|
||||
#include "swad_global.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "swad_message.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_timeline.h"
|
||||
#include "swad_timeline_database.h"
|
||||
#include "swad_timeline_form.h"
|
||||
#include "swad_timeline_note.h"
|
||||
#include "swad_timeline_post.h"
|
||||
|
@ -71,30 +72,24 @@ void TL_Pst_GetAndWritePost (long PstCod)
|
|||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned long NumRows;
|
||||
struct TL_Pst_PostContent Content;
|
||||
|
||||
/***** Initialize image *****/
|
||||
Med_MediaConstructor (&Content.Media);
|
||||
|
||||
/***** Get post from database *****/
|
||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get the content"
|
||||
" of a post",
|
||||
"SELECT Txt," // row[0]
|
||||
"MedCod" // row[1]
|
||||
" FROM tl_posts"
|
||||
" WHERE PstCod=%ld",
|
||||
PstCod);
|
||||
|
||||
/***** Result should have a unique row *****/
|
||||
if (NumRows == 1)
|
||||
if (TL_DB_GetPostByCod (PstCod,&mysql_res) == 1)
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
/*
|
||||
row[0] Txt
|
||||
row[1] MedCod
|
||||
*/
|
||||
/* Get content (row[0]) */
|
||||
Str_Copy (Content.Txt,row[0],sizeof (Content.Txt) - 1);
|
||||
|
||||
/***** Get media (row[1]) *****/
|
||||
/* Get media (row[1]) */
|
||||
Content.Media.MedCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
Med_GetMediaDataByCod (&Content.Media);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue