mirror of https://github.com/acanas/swad-core.git
Version 20.36.28: Feb 28, 2021 Functions moved to module swad_timeline_database.
This commit is contained in:
parent
d388d5552e
commit
a38ab09b97
|
@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.36.27 (2021-02-28)"
|
#define Log_PLATFORM_VERSION "SWAD 20.36.28 (2021-02-28)"
|
||||||
#define CSS_FILE "swad20.33.9.css"
|
#define CSS_FILE "swad20.33.9.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#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: 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
|
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
||||||
|
|
||||||
|
Version 20.36.28: Feb 28, 2021 Functions moved to module swad_timeline_database. (305426 lines)
|
||||||
Version 20.36.27: Feb 28, 2021 Functions moved to module swad_timeline_database. (305424 lines)
|
Version 20.36.27: Feb 28, 2021 Functions moved to module swad_timeline_database. (305424 lines)
|
||||||
Version 20.36.26: Feb 28, 2021 Queries moved to module swad_timeline_database. (305423 lines)
|
Version 20.36.26: Feb 28, 2021 Queries moved to module swad_timeline_database. (305423 lines)
|
||||||
Version 20.36.25: Feb 28, 2021 Queries moved to module swad_timeline_database. (305405 lines)
|
Version 20.36.25: Feb 28, 2021 Queries moved to module swad_timeline_database. (305405 lines)
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ static void TL_Com_GetDataOfCommentFromRow (MYSQL_ROW row,
|
||||||
Med_GetMediaDataByCod (&Com->Content.Media);
|
Med_GetMediaDataByCod (&Com->Content.Media);
|
||||||
|
|
||||||
/***** Get number of times this comment has been favourited *****/
|
/***** Get number of times this comment has been favourited *****/
|
||||||
TL_Fav_GetNumTimesACommHasBeenFav (Com);
|
Com->NumFavs = TL_DB_GetNumTimesACommHasBeenFav (Com);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -875,6 +875,40 @@ bool TL_DB_CheckIfCommIsFavedByUsr (long PubCod,long UsrCod)
|
||||||
PubCod,UsrCod) != 0);
|
PubCod,UsrCod) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*************** Get number of times a note has been favourited **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned TL_DB_GetNumTimesANoteHasBeenFav (const struct TL_Not_Note *Not)
|
||||||
|
{
|
||||||
|
/***** Get number of times (users) this note has been favourited *****/
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get number of times"
|
||||||
|
" a note has been favourited",
|
||||||
|
"SELECT COUNT(*) FROM tl_notes_fav"
|
||||||
|
" WHERE NotCod=%ld"
|
||||||
|
" AND UsrCod<>%ld", // Extra check
|
||||||
|
Not->NotCod,
|
||||||
|
Not->UsrCod); // The author
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get number of times a comment has been favourited **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
unsigned TL_DB_GetNumTimesACommHasBeenFav (const struct TL_Com_Comment *Com)
|
||||||
|
{
|
||||||
|
/***** Get number of times (users) this comment has been favourited *****/
|
||||||
|
return (unsigned)
|
||||||
|
DB_QueryCOUNT ("can not get number of times"
|
||||||
|
" a comment has been favourited",
|
||||||
|
"SELECT COUNT(*) FROM tl_comments_fav"
|
||||||
|
" WHERE PubCod=%ld"
|
||||||
|
" AND UsrCod<>%ld", // Extra check
|
||||||
|
Com->PubCod,
|
||||||
|
Com->UsrCod); // The author
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Mark note as favourite in database *******************/
|
/********************** Mark note as favourite in database *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_file_browser.h"
|
#include "swad_file_browser.h"
|
||||||
|
#include "swad_timeline_comment.h"
|
||||||
#include "swad_timeline_note.h"
|
#include "swad_timeline_note.h"
|
||||||
#include "swad_timeline_post.h"
|
#include "swad_timeline_post.h"
|
||||||
#include "swad_timeline_publication.h"
|
#include "swad_timeline_publication.h"
|
||||||
|
@ -113,6 +114,8 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod);
|
||||||
/****************************** Favourites ***********************************/
|
/****************************** Favourites ***********************************/
|
||||||
bool TL_DB_CheckIfNoteIsFavedByUsr (long NotCod,long UsrCod);
|
bool TL_DB_CheckIfNoteIsFavedByUsr (long NotCod,long UsrCod);
|
||||||
bool TL_DB_CheckIfCommIsFavedByUsr (long PubCod,long UsrCod);
|
bool TL_DB_CheckIfCommIsFavedByUsr (long PubCod,long UsrCod);
|
||||||
|
unsigned TL_DB_GetNumTimesANoteHasBeenFav (const struct TL_Not_Note *Not);
|
||||||
|
unsigned TL_DB_GetNumTimesACommHasBeenFav (const struct TL_Com_Comment *Com);
|
||||||
void TL_DB_MarkNoteAsFav (long NotCod);
|
void TL_DB_MarkNoteAsFav (long NotCod);
|
||||||
void TL_DB_MarkCommAsFav (long PubCod);
|
void TL_DB_MarkCommAsFav (long PubCod);
|
||||||
void TL_DB_UnmarkNoteAsFav (long NotCod);
|
void TL_DB_UnmarkNoteAsFav (long NotCod);
|
||||||
|
|
|
@ -175,7 +175,7 @@ static void TL_Fav_FavNote (struct TL_Not_Note *Not)
|
||||||
TL_DB_MarkNoteAsFav (Not->NotCod);
|
TL_DB_MarkNoteAsFav (Not->NotCod);
|
||||||
|
|
||||||
/***** Update number of times this note is favourited *****/
|
/***** Update number of times this note is favourited *****/
|
||||||
TL_Fav_GetNumTimesANoteHasBeenFav (Not);
|
TL_DB_GetNumTimesANoteHasBeenFav (Not);
|
||||||
|
|
||||||
/***** Create notification about favourite post
|
/***** Create notification about favourite post
|
||||||
for the author of the post *****/
|
for the author of the post *****/
|
||||||
|
@ -206,7 +206,7 @@ static void TL_Fav_UnfNote (struct TL_Not_Note *Not)
|
||||||
TL_DB_UnmarkNoteAsFav (Not->NotCod);
|
TL_DB_UnmarkNoteAsFav (Not->NotCod);
|
||||||
|
|
||||||
/***** Update number of times this note is favourited *****/
|
/***** Update number of times this note is favourited *****/
|
||||||
TL_Fav_GetNumTimesANoteHasBeenFav (Not);
|
TL_DB_GetNumTimesANoteHasBeenFav (Not);
|
||||||
|
|
||||||
/***** Mark possible notifications on this note as removed *****/
|
/***** Mark possible notifications on this note as removed *****/
|
||||||
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod);
|
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod);
|
||||||
|
@ -316,7 +316,7 @@ static void TL_Fav_FavComment (struct TL_Com_Comment *Com)
|
||||||
TL_DB_MarkCommAsFav (Com->PubCod);
|
TL_DB_MarkCommAsFav (Com->PubCod);
|
||||||
|
|
||||||
/* Update number of times this comment is favourited */
|
/* Update number of times this comment is favourited */
|
||||||
TL_Fav_GetNumTimesACommHasBeenFav (Com);
|
TL_DB_GetNumTimesACommHasBeenFav (Com);
|
||||||
|
|
||||||
/**** Create notification about favourite post
|
/**** Create notification about favourite post
|
||||||
for the author of the post ***/
|
for the author of the post ***/
|
||||||
|
@ -347,7 +347,7 @@ static void TL_Fav_UnfComment (struct TL_Com_Comment *Com)
|
||||||
TL_DB_UnmarkCommAsFav (Com->PubCod);
|
TL_DB_UnmarkCommAsFav (Com->PubCod);
|
||||||
|
|
||||||
/***** Update number of times this comment is favourited *****/
|
/***** Update number of times this comment is favourited *****/
|
||||||
TL_Fav_GetNumTimesACommHasBeenFav (Com);
|
TL_DB_GetNumTimesACommHasBeenFav (Com);
|
||||||
|
|
||||||
/***** Mark possible notifications on this comment as removed *****/
|
/***** Mark possible notifications on this comment as removed *****/
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV,Com->PubCod);
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV,Com->PubCod);
|
||||||
|
@ -444,40 +444,6 @@ static void TL_Fav_PutFormToFavUnfComm (long PubCod)
|
||||||
TL_Frm_FormFavSha (&Form[TL_DB_CheckIfNoteIsFavedByUsr (PubCod,Gbl.Usrs.Me.UsrDat.UsrCod)]);
|
TL_Frm_FormFavSha (&Form[TL_DB_CheckIfNoteIsFavedByUsr (PubCod,Gbl.Usrs.Me.UsrDat.UsrCod)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Get number of times a note has been favourited **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void TL_Fav_GetNumTimesANoteHasBeenFav (struct TL_Not_Note *Not)
|
|
||||||
{
|
|
||||||
/***** Get number of times (users) this note has been favourited *****/
|
|
||||||
Not->NumFavs =
|
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
|
||||||
" a note has been favourited",
|
|
||||||
"SELECT COUNT(*) FROM tl_notes_fav"
|
|
||||||
" WHERE NotCod=%ld"
|
|
||||||
" AND UsrCod<>%ld", // Extra check
|
|
||||||
Not->NotCod,
|
|
||||||
Not->UsrCod); // The author
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get number of times a comment has been favourited **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void TL_Fav_GetNumTimesACommHasBeenFav (struct TL_Com_Comment *Com)
|
|
||||||
{
|
|
||||||
/***** Get number of times (users) this comment has been favourited *****/
|
|
||||||
Com->NumFavs =
|
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
|
||||||
" a comment has been favourited",
|
|
||||||
"SELECT COUNT(*) FROM tl_comments_fav"
|
|
||||||
" WHERE PubCod=%ld"
|
|
||||||
" AND UsrCod<>%ld", // Extra check
|
|
||||||
Com->PubCod,
|
|
||||||
Com->UsrCod); // The author
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Show users who have marked this note as favourite **************/
|
/************ Show users who have marked this note as favourite **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -65,7 +65,4 @@ void TL_Fav_UnfCommentGbl (void);
|
||||||
void TL_Fav_PutIconToFavUnfComment (const struct TL_Com_Comment *Com,
|
void TL_Fav_PutIconToFavUnfComment (const struct TL_Com_Comment *Com,
|
||||||
TL_Usr_HowManyUsrs_t HowManyUsrs);
|
TL_Usr_HowManyUsrs_t HowManyUsrs);
|
||||||
|
|
||||||
void TL_Fav_GetNumTimesANoteHasBeenFav (struct TL_Not_Note *Not);
|
|
||||||
void TL_Fav_GetNumTimesACommHasBeenFav (struct TL_Com_Comment *Com);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1294,7 +1294,7 @@ static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not)
|
||||||
TL_Sha_UpdateNumTimesANoteHasBeenShared (Not);
|
TL_Sha_UpdateNumTimesANoteHasBeenShared (Not);
|
||||||
|
|
||||||
/***** Get number of times this note has been favourited *****/
|
/***** Get number of times this note has been favourited *****/
|
||||||
TL_Fav_GetNumTimesANoteHasBeenFav (Not);
|
Not->NumFavs = TL_DB_GetNumTimesANoteHasBeenFav (Not);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue