swad-core/swad_forum.h

142 lines
4.9 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_forum.h: forums
#ifndef _SWAD_FOR
#define _SWAD_FOR
/*
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
2014-12-01 23:55:08 +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 ***********************************/
/*****************************************************************************/
#include "swad_centre.h"
#include "swad_degree.h"
#include "swad_institution.h"
2017-03-08 14:12:33 +01:00
#include "swad_notification.h"
2014-12-01 23:55:08 +01:00
#include "swad_pagination.h"
2016-10-28 00:23:02 +02:00
#include "swad_scope.h"
2014-12-01 23:55:08 +01:00
#include "swad_string.h"
/*****************************************************************************/
/************************ Public constants and types *************************/
/*****************************************************************************/
#define For_NUM_WHICH_FORUMS 2
typedef enum
{
For_ONLY_CURRENT_FORUMS = 0,
For_ALL_MY_FORUMS = 1,
2017-04-17 11:57:55 +02:00
} For_ForumSet_t; // Which set of forums I want to see: all my forums or only the forums of current institution/degree/course.
2014-12-01 23:55:08 +01:00
#define For_DEFAULT_WHICH_FORUMS For_ONLY_CURRENT_FORUMS
#define For_NUM_TYPES_FORUM 12
typedef enum
{
For_FORUM_COURSE_USRS = 0,
For_FORUM_COURSE_TCHS = 1,
For_FORUM_DEGREE_USRS = 2,
For_FORUM_DEGREE_TCHS = 3,
For_FORUM_CENTRE_USRS = 4,
For_FORUM_CENTRE_TCHS = 5,
2016-10-28 00:23:02 +02:00
For_FORUM_INSTIT_USRS = 6,
For_FORUM_INSTIT_TCHS = 7,
2014-12-01 23:55:08 +01:00
For_FORUM_GLOBAL_USRS = 8,
For_FORUM_GLOBAL_TCHS = 9,
For_FORUM_SWAD_USRS = 10,
For_FORUM_SWAD_TCHS = 11,
} For_ForumType_t; // Don't change numbers (used in database)
2017-04-17 11:57:55 +02:00
struct Forum
{
For_ForumType_t Type;
long Location; // Code of institution, centre, degree or course
};
2014-12-01 23:55:08 +01:00
struct ForumThread
{
long ThrCod;
long PstCod[2];
long UsrCod[2];
2015-10-24 20:12:03 +02:00
time_t WriteTime[2];
2014-12-01 23:55:08 +01:00
bool Enabled[2];
2017-01-17 03:10:43 +01:00
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
2014-12-01 23:55:08 +01:00
unsigned NumPosts;
unsigned NumUnreadPosts; // Number of my unread posts in thread
unsigned NumMyPosts; // Number of posts written by me in thread
unsigned NumWriters;
unsigned NumReaders;
};
2017-01-29 21:41:08 +01:00
#define For_NUM_ORDERS 2
2014-12-01 23:55:08 +01:00
typedef enum
{
For_FIRST_MSG = 0,
For_LAST_MSG = 1,
2017-01-29 12:42:19 +01:00
} For_Order_t;
2014-12-01 23:55:08 +01:00
#define For_DEFAULT_ORDER For_LAST_MSG
2017-01-13 10:49:56 +01:00
#define For_MAX_BYTES_FORUM_NAME (512 - 1)
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void For_EnbPst (void);
void For_DisPst (void);
2016-04-10 19:19:20 +02:00
2017-04-17 11:57:55 +02:00
void For_GetForumTypeAndLocationOfAPost (long PstCod,struct Forum *WhichForum);
2016-04-10 19:19:20 +02:00
2015-03-14 02:26:59 +01:00
unsigned long For_GetNumPostsUsr (long UsrCod);
2014-12-01 23:55:08 +01:00
void For_RemoveUsrFromReadThrs (long UsrCod);
2017-03-08 14:12:33 +01:00
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
2017-01-13 10:49:56 +01:00
char **ContentStr,
2017-03-06 13:01:16 +01:00
long PstCod,bool GetContent);
2014-12-01 23:55:08 +01:00
void For_PutAllHiddenParamsForum (void);
2017-04-16 13:45:11 +02:00
2017-04-17 11:57:55 +02:00
void For_SetForumName (struct Forum *WhichForum,
2017-01-13 10:49:56 +01:00
char ForumName[For_MAX_BYTES_FORUM_NAME + 1],
Txt_Language_t Language,bool UseHTMLEntities);
2017-04-16 23:48:05 +02:00
2014-12-01 23:55:08 +01:00
void For_ShowForumThrs (void);
unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
2015-03-09 01:25:59 +01:00
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
2014-12-01 23:55:08 +01:00
unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
2015-03-09 01:25:59 +01:00
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
2014-12-01 23:55:08 +01:00
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
2015-03-09 01:25:59 +01:00
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
2014-12-01 23:55:08 +01:00
unsigned *NumUsrsToBeNotifiedByEMail);
2017-04-13 23:53:57 +02:00
2014-12-01 23:55:08 +01:00
void For_ShowThrPsts (void);
void For_PutHiddenParamThrCod (long ThrCod);
void For_RecForumPst (void);
void For_DelPst (void);
void For_ReqDelThr (void);
void For_DelThr (void);
void For_CutThr (void);
void For_PasteThr (void);
void For_RemoveUsrFromThrClipboard (long UsrCod);
2017-04-16 23:48:05 +02:00
void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation);
2016-10-27 22:26:52 +02:00
2014-12-01 23:55:08 +01:00
#endif