swad-core/swad_social.h

182 lines
5.7 KiB
C
Raw Normal View History

2015-12-31 14:25:28 +01:00
// swad_social.c: social networking (timeline)
2015-12-28 19:23:42 +01:00
#ifndef _SWAD_SOC
#define _SWAD_SOC
/*
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.
2017-01-13 01:51:23 +01:00
Copyright (C) 1999-2017 Antonio Ca<EFBFBD>as Vargas
2015-12-28 19:23:42 +01:00
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 **********************************/
/*****************************************************************************/
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************** Public types *******************************/
/*****************************************************************************/
2017-02-24 03:38:18 +01:00
#define Soc_NUM_WHICH_USRS 2
typedef enum
{
Soc_FOLLOWED = 0,
Soc_ALL_USRS = 1,
} Soc_WhichUsrs_t; // Which users I want to see: only users I follow or all users
#define Soc_DEFAULT_WHICH_USRS Soc_FOLLOWED
2016-01-11 20:54:14 +01:00
#define Soc_NUM_PUB_TYPES 4
// If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table social_notes
2016-01-11 14:42:54 +01:00
typedef enum
{
2016-01-11 20:54:14 +01:00
Soc_PUB_UNKNOWN = 0,
Soc_PUB_ORIGINAL_NOTE = 1,
Soc_PUB_SHARED_NOTE = 2,
Soc_PUB_COMMENT_TO_NOTE = 3,
2016-01-11 14:42:54 +01:00
} Soc_PubType_t;
2016-01-11 20:54:14 +01:00
#define Soc_NUM_NOTE_TYPES 13
2015-12-28 19:23:42 +01:00
// If the numbers assigned to each event type change,
2015-12-31 14:25:28 +01:00
// it is necessary to change old numbers to new ones in database table social_notes
2015-12-28 19:23:42 +01:00
typedef enum
{
2015-12-31 14:25:28 +01:00
Soc_NOTE_UNKNOWN = 0,
2015-12-28 19:23:42 +01:00
/* Institution tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_INS_DOC_PUB_FILE = 1,
Soc_NOTE_INS_SHA_PUB_FILE = 2,
2015-12-28 19:23:42 +01:00
/* Centre tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_CTR_DOC_PUB_FILE = 3,
Soc_NOTE_CTR_SHA_PUB_FILE = 4,
2015-12-28 19:23:42 +01:00
/* Degree tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_DEG_DOC_PUB_FILE = 5,
Soc_NOTE_DEG_SHA_PUB_FILE = 6,
2015-12-28 19:23:42 +01:00
/* Course tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_CRS_DOC_PUB_FILE = 7,
Soc_NOTE_CRS_SHA_PUB_FILE = 8,
2015-12-28 19:23:42 +01:00
/* Assessment tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_EXAM_ANNOUNCEMENT = 9,
2015-12-28 19:23:42 +01:00
2015-12-29 10:38:46 +01:00
/* Users tab */
2015-12-28 19:23:42 +01:00
/* Social tab */
2016-01-02 13:21:25 +01:00
Soc_NOTE_SOCIAL_POST = 10,
2015-12-31 14:25:28 +01:00
Soc_NOTE_FORUM_POST = 11,
2015-12-28 19:23:42 +01:00
/* Messages tab */
2015-12-31 14:25:28 +01:00
Soc_NOTE_NOTICE = 12,
2015-12-28 19:23:42 +01:00
/* Statistics tab */
/* Profile tab */
2015-12-31 18:40:45 +01:00
} Soc_NoteType_t;
2015-12-28 19:23:42 +01:00
2017-01-28 15:58:46 +01:00
#define Soc_NUM_TOP_MESSAGES (1 + 6)
2016-01-25 11:43:14 +01:00
typedef enum
{
2016-01-25 16:25:10 +01:00
Soc_TOP_MESSAGE_NONE = 0,
2016-01-25 21:48:08 +01:00
Soc_TOP_MESSAGE_COMMENTED = 1,
Soc_TOP_MESSAGE_FAVED = 2,
Soc_TOP_MESSAGE_UNFAVED = 3,
Soc_TOP_MESSAGE_SHARED = 4,
Soc_TOP_MESSAGE_UNSHARED = 5,
Soc_TOP_MESSAGE_MENTIONED = 6,
2016-01-25 11:43:14 +01:00
} Soc_TopMessage_t;
struct SocialPublishing
{
long PubCod;
long NotCod;
long PublisherCod; // Sharer or writer of a comment
Soc_PubType_t PubType;
time_t DateTimeUTC;
Soc_TopMessage_t TopMessage; // Used to show feedback on the action made
};
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
2017-02-24 03:38:18 +01:00
void Soc_ShowTimelineGbl1 (void);
void Soc_ShowTimelineGbl2 (void);
2016-01-15 14:46:44 +01:00
void Soc_ShowTimelineUsr (void);
2016-01-14 01:39:02 +01:00
void Soc_RefreshNewTimelineGbl (void);
void Soc_RefreshOldTimelineGbl (void);
2016-01-15 14:46:44 +01:00
void Soc_RefreshOldTimelineUsr (void);
2015-12-28 19:23:42 +01:00
2016-01-25 23:00:22 +01:00
void Soc_MarkMyNotifAsSeen (void);
2016-01-25 11:43:14 +01:00
void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod,struct SocialPublishing *SocPub);
2016-01-03 19:30:59 +01:00
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod);
void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType,long Cod);
2016-01-22 12:05:25 +01:00
void Soc_MarkSocialNoteOneFileAsUnavailable (const char *Path);
2016-01-04 01:56:28 +01:00
void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path);
2015-12-28 20:46:48 +01:00
2016-01-02 01:56:48 +01:00
void Soc_ReceiveSocialPostGbl (void);
void Soc_ReceiveSocialPostUsr (void);
2015-12-30 12:40:13 +01:00
2016-01-25 14:40:57 +01:00
void Soc_PutHiddenParamPubCod (long PubCod);
2016-01-22 12:42:43 +01:00
2016-01-07 14:21:21 +01:00
void Soc_ReceiveCommentGbl (void);
void Soc_ReceiveCommentUsr (void);
2016-01-07 00:42:35 +01:00
2016-01-04 02:54:04 +01:00
void Soc_ShareSocialNoteGbl (void);
void Soc_ShareSocialNoteUsr (void);
2016-01-19 00:50:35 +01:00
void Soc_FavSocialNoteGbl (void);
void Soc_FavSocialNoteUsr (void);
2016-01-19 12:54:27 +01:00
void Soc_FavSocialCommentGbl (void);
void Soc_FavSocialCommentUsr (void);
2016-01-19 00:50:35 +01:00
2016-01-16 01:37:37 +01:00
void Soc_UnshareSocialNoteGbl (void);
void Soc_UnshareSocialNoteUsr (void);
2016-01-19 00:50:35 +01:00
void Soc_UnfavSocialNoteGbl (void);
void Soc_UnfavSocialNoteUsr (void);
2016-01-19 12:54:27 +01:00
void Soc_UnfavSocialCommentGbl (void);
void Soc_UnfavSocialCommentUsr (void);
2016-01-01 20:19:43 +01:00
2016-01-08 01:53:37 +01:00
void Soc_RequestRemSocialNoteGbl (void);
void Soc_RequestRemSocialNoteUsr (void);
void Soc_RemoveSocialNoteGbl (void);
void Soc_RemoveSocialNoteUsr (void);
void Soc_RequestRemSocialComGbl (void);
void Soc_RequestRemSocialComUsr (void);
void Soc_RemoveSocialComGbl (void);
void Soc_RemoveSocialComUsr (void);
2015-12-30 02:08:08 +01:00
2016-01-08 10:13:28 +01:00
void Soc_RemoveUsrSocialContent (long UsrCod);
2016-01-12 20:58:19 +01:00
void Soc_ClearOldTimelinesDB (void);
2017-03-08 14:12:33 +01:00
void Soc_GetNotifSocialPublishing (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
2017-03-06 13:01:16 +01:00
char **ContentStr,
long PubCod,bool GetContent);
2016-01-22 12:05:25 +01:00
2015-12-28 19:23:42 +01:00
#endif