mirror of https://github.com/acanas/swad-core.git
Version 20.36.7: Feb 27, 2021 Query moved to module swad_timeline_database.
This commit is contained in:
parent
850fb99b00
commit
443ecfb4df
|
@ -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.7: Feb 27, 2021 Query moved to module swad_timeline_database. (? lines)
|
||||
Version 20.36.6: Feb 27, 2021 Queries moved to module swad_timeline_database. (305195 lines)
|
||||
Version 20.36.5: Feb 26, 2021 Queries moved to module swad_timeline_database. (305179 lines)
|
||||
Version 20.36.4: Feb 26, 2021 Query moved to module swad_timeline_database. (305156 lines)
|
||||
|
|
|
@ -50,6 +50,50 @@
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Create a new note *****************************/
|
||||
/*****************************************************************************/
|
||||
// Returns code of note just created
|
||||
|
||||
long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod,
|
||||
long PublisherCod,long HieCod)
|
||||
{
|
||||
return
|
||||
DB_QueryINSERTandReturnCode ("can not create new note",
|
||||
"INSERT INTO tl_notes"
|
||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||
" VALUES"
|
||||
" (%u,%ld,%ld,%ld,'N',NOW())",
|
||||
(unsigned) NoteType, // Post, file, exam, notice, forum
|
||||
Cod, // Post, file, exam, notice, forum code
|
||||
PublisherCod, // Publisher code
|
||||
HieCod); // Where in hierarchy
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Insert note in temporary tables used to not get notes already shown ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod)
|
||||
{
|
||||
/* Insert note in temporary table with just retrieved notes.
|
||||
This table will be used to not get notes already shown */
|
||||
DB_QueryINSERT ("can not store note code",
|
||||
"INSERT IGNORE INTO tl_tmp_just_retrieved_notes"
|
||||
" SET NotCod=%ld",
|
||||
NotCod);
|
||||
}
|
||||
|
||||
void TL_DB_InsertNoteInVisibleTimeline (long NotCod)
|
||||
{
|
||||
/* Insert note in temporary table with visible timeline.
|
||||
This table will be used to not get notes already shown */
|
||||
DB_QueryINSERT ("can not store note code",
|
||||
"INSERT IGNORE INTO tl_tmp_visible_timeline"
|
||||
" SET NotCod=%ld",
|
||||
NotCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of comments in a note **********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -134,7 +178,7 @@ unsigned TL_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res)
|
|||
|
||||
/***** Get data of comment from database *****/
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get data of comment",
|
||||
DB_QuerySELECT (mysql_res,"can not get data of comment",
|
||||
"SELECT tl_pubs.PubCod," // row[0]
|
||||
"tl_pubs.PublisherCod," // row[1]
|
||||
"tl_pubs.NotCod," // row[2]
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include "swad_database.h"
|
||||
#include "swad_timeline_note.h"
|
||||
#include "swad_timeline_post.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -42,6 +43,13 @@
|
|||
/****************************** Public prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Notes */
|
||||
long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod,
|
||||
long PublisherCod,long HieCod);
|
||||
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod);
|
||||
void TL_DB_InsertNoteInVisibleTimeline (long NotCod);
|
||||
|
||||
/* Comments */
|
||||
unsigned TL_DB_GetNumCommentsInNote (long NotCod);
|
||||
unsigned TL_DB_GetInitialComments (long NotCod,
|
||||
unsigned NumInitialCommentsToGet,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "swad_photo.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_timeline.h"
|
||||
#include "swad_timeline_database.h"
|
||||
#include "swad_timeline_favourite.h"
|
||||
#include "swad_timeline_form.h"
|
||||
#include "swad_timeline_publication.h"
|
||||
|
@ -184,30 +185,6 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
|
|||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Insert note in temporary tables used to not get notes already shown ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_Not_InsertNoteInJustRetrievedNotes (long NotCod)
|
||||
{
|
||||
/* Insert note in temporary table with just retrieved notes.
|
||||
This table will be used to not get notes already shown */
|
||||
DB_QueryINSERT ("can not store note code",
|
||||
"INSERT IGNORE INTO tl_tmp_just_retrieved_notes"
|
||||
" SET NotCod=%ld",
|
||||
NotCod);
|
||||
}
|
||||
|
||||
void TL_Not_InsertNoteInVisibleTimeline (long NotCod)
|
||||
{
|
||||
/* Insert note in temporary table with visible timeline.
|
||||
This table will be used to not get notes already shown */
|
||||
DB_QueryINSERT ("can not store note code",
|
||||
"INSERT IGNORE INTO tl_tmp_visible_timeline"
|
||||
" SET NotCod=%ld",
|
||||
NotCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Check and write note with top message ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -895,18 +872,9 @@ void TL_Not_StoreAndPublishNoteInternal (TL_Not_NoteType_t NoteType,long Cod,str
|
|||
break;
|
||||
}
|
||||
|
||||
/***** Store note *****/
|
||||
Pub->NotCod =
|
||||
DB_QueryINSERTandReturnCode ("can not create new note",
|
||||
"INSERT INTO tl_notes"
|
||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||
" VALUES"
|
||||
" (%u,%ld,%ld,%ld,'N',NOW())",
|
||||
(unsigned) NoteType,
|
||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod,HieCod);
|
||||
|
||||
/***** Publish note in timeline *****/
|
||||
Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
Pub->NotCod = TL_DB_CreateNewNote (NoteType,Cod,Pub->PublisherCod,HieCod);
|
||||
Pub->PubType = TL_Pub_ORIGINAL_NOTE;
|
||||
TL_Pub_PublishPubInTimeline (Pub);
|
||||
}
|
||||
|
|
|
@ -87,9 +87,6 @@ struct TL_Not_Note
|
|||
void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
|
||||
struct TL_Not_Note *Not);
|
||||
|
||||
void TL_Not_InsertNoteInJustRetrievedNotes (long NotCod);
|
||||
void TL_Not_InsertNoteInVisibleTimeline (long NotCod);
|
||||
|
||||
void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline,
|
||||
const struct TL_Not_Note *Not,
|
||||
TL_TopMessage_t TopMessage,
|
||||
|
|
|
@ -223,9 +223,9 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
|
|||
|
||||
/* Insert note in temporary tables with just retrieved notes.
|
||||
These tables will be used to not get notes already shown */
|
||||
TL_Not_InsertNoteInJustRetrievedNotes (Pub->NotCod);
|
||||
TL_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod);
|
||||
if (Timeline->WhatToGet == TL_GET_ONLY_OLD_PUBS) // Get only old publications
|
||||
TL_Not_InsertNoteInVisibleTimeline (Pub->NotCod);
|
||||
TL_DB_InsertNoteInVisibleTimeline (Pub->NotCod);
|
||||
|
||||
/* Narrow the range for the next iteration */
|
||||
RangePubsToGet.Top = Pub->PubCod;
|
||||
|
|
Loading…
Reference in New Issue