2021-02-11 13:10:08 +01:00
|
|
|
|
// swad_timeline_publication.h: social timeline publications
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
#ifndef _SWAD_TML_PUB
|
|
|
|
|
#define _SWAD_TML_PUB
|
2021-02-11 13:10:08 +01:00
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance in Spanish),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
|
|
|
|
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************** Headers **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_media.h"
|
|
|
|
|
#include "swad_notification.h"
|
|
|
|
|
#include "swad_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
// Number of recent publishings got and shown the first time, before refreshing
|
2021-03-04 17:47:08 +01:00
|
|
|
|
#define Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
|
|
|
|
|
#define Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // New publishings retrieved (big number)
|
|
|
|
|
#define Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************** Public types *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
#define Tml_Pub_NUM_PUB_TYPES 4
|
2021-02-11 13:10:08 +01:00
|
|
|
|
// If the numbers assigned to each event type change,
|
2021-03-04 18:37:16 +01:00
|
|
|
|
// it is necessary to change old numbers to new ones in database table tml_notes
|
2021-02-11 13:10:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Tml_Pub_UNKNOWN = 0,
|
|
|
|
|
Tml_Pub_ORIGINAL_NOTE = 1,
|
|
|
|
|
Tml_Pub_SHARED_NOTE = 2,
|
|
|
|
|
Tml_Pub_COMMENT_TO_NOTE = 3,
|
|
|
|
|
} Tml_Pub_PubType_t;
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
struct Tml_Pub_Publication
|
2021-02-11 13:10:08 +01:00
|
|
|
|
{
|
|
|
|
|
long PubCod;
|
|
|
|
|
long NotCod;
|
2021-02-11 20:19:14 +01:00
|
|
|
|
long PublisherCod; // Sharer or writer of the publication
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Tml_Pub_PubType_t PubType;
|
|
|
|
|
struct Tml_Pub_Publication *Next; // Used for chained list
|
2021-02-11 13:10:08 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
struct Tml_Pub_RangePubsToGet
|
2021-02-28 21:12:44 +01:00
|
|
|
|
{
|
|
|
|
|
long Top;
|
|
|
|
|
long Bottom;
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
#define Tml_Pub_MAX_BYTES_SUBQUERY (128 - 1)
|
|
|
|
|
struct Tml_Pub_SubQueries
|
2021-02-27 22:13:05 +01:00
|
|
|
|
{
|
|
|
|
|
char *TablePublishers;
|
2021-03-04 17:47:08 +01:00
|
|
|
|
char Publishers [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
|
|
|
|
|
char RangeBottom [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
|
|
|
|
|
char RangeTop [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
|
|
|
|
|
char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1];
|
2021-02-27 22:13:05 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-02-11 13:10:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline);
|
|
|
|
|
void Tml_Pub_FreeListPubs (struct Tml_Timeline *Timeline);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_InsertNewPubsInTimeline (struct Tml_Timeline *Timeline);
|
|
|
|
|
void Tml_Pub_ShowOldPubsInTimeline (struct Tml_Timeline *Timeline);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Tml_TopMessage_t Tml_Pub_GetTopMessage (Tml_Pub_PubType_t PubType);
|
2021-02-11 20:19:14 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_PutLinkToViewNewPubs (void);
|
|
|
|
|
void Tml_Pub_PutLinkToViewOldPubs (void);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_PutHiddenParamPubCod (long PubCod);
|
|
|
|
|
long Tml_Pub_GetParamPubCod (void);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res,
|
|
|
|
|
struct Tml_Pub_Publication *Pub);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Pub_PublishPubInTimeline (struct Tml_Pub_Publication *Pub);
|
2021-02-11 13:10:08 +01:00
|
|
|
|
|
|
|
|
|
#endif
|