mirror of https://github.com/acanas/swad-core.git
Version 16.179
This commit is contained in:
parent
fdd3c04038
commit
0ccd7b37ad
|
@ -214,13 +214,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.178.1 (2017-04-16)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.179 (2017-04-16)"
|
||||
#define CSS_FILE "swad16.177.css"
|
||||
#define JS_FILE "swad16.144.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 16.179: Apr 16, 2017 Code refactoring in forums (217444 lines)
|
||||
Version 16.178.1: Apr 16, 2017 Code refactoring in forums (217601 lines)
|
||||
Version 16.178: Apr 16, 2017 Code refactoring in forums (217595 lines)
|
||||
Version 16.177.4: Apr 14, 2017 Changes in layout of forums. (217611 lines)
|
||||
|
|
605
swad_forum.c
605
swad_forum.c
File diff suppressed because it is too large
Load Diff
21
swad_forum.h
21
swad_forum.h
|
@ -96,10 +96,10 @@ typedef enum
|
|||
void For_EnbPst (void);
|
||||
void For_DisPst (void);
|
||||
|
||||
For_ForumType_t For_GetForumTypeOfAPost (long PstCod);
|
||||
void For_GetForumTypeAndLocationOfAPost (long PstCod,
|
||||
For_ForumType_t *ForumType,long *ForumLocation);
|
||||
|
||||
unsigned long For_GetNumPostsUsr (long UsrCod);
|
||||
void For_DeleteThrFromReadThrs (long ThrCod);
|
||||
void For_RemoveUsrFromReadThrs (long UsrCod);
|
||||
|
||||
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||
|
@ -108,20 +108,15 @@ void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1
|
|||
|
||||
void For_PutAllHiddenParamsForum (void);
|
||||
|
||||
void For_SetForumName (For_ForumType_t ForumType,
|
||||
struct Instit *Ins,
|
||||
struct Centre *Ctr,
|
||||
struct Degree *Deg,
|
||||
struct Course *Crs,
|
||||
void For_SetForumName (For_ForumType_t ForumType,long ForumLocation,
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1],
|
||||
Txt_Language_t Language,bool UseHTMLEntities);
|
||||
unsigned For_GetNumThrsWithNewPstsInForum (For_ForumType_t ForumType,unsigned NumThreads);
|
||||
|
||||
void For_ShowForumThrs (void);
|
||||
unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
||||
unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
||||
unsigned For_GetNumThrsInForum (For_ForumType_t ForumType);
|
||||
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
|
||||
unsigned *NumUsrsToBeNotifiedByEMail);
|
||||
|
@ -134,14 +129,8 @@ void For_ReqDelThr (void);
|
|||
void For_DelThr (void);
|
||||
void For_CutThr (void);
|
||||
void For_PasteThr (void);
|
||||
long For_GetThrInMyClipboard (void);
|
||||
bool For_CheckIfThrBelongsToForum (long ThrCod,For_ForumType_t ForumType);
|
||||
void For_MoveThrToCurrentForum (long ThrCod);
|
||||
void For_InsertThrInClipboard (long ThrCod);
|
||||
void For_RemoveExpiredThrsClipboards (void);
|
||||
void For_RemoveThrCodFromThrClipboard (long ThrCod);
|
||||
void For_RemoveUsrFromThrClipboard (long UsrCod);
|
||||
|
||||
void For_RemoveForums (Sco_Scope_t Scope,long DegCod);
|
||||
void For_RemoveForums (Sco_Scope_t Scope,long ForumLocation);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -408,7 +408,7 @@ void Gbl_InitializeGlobals (void)
|
|||
/* Forums */
|
||||
Gbl.Forum.WhichForums = For_DEFAULT_WHICH_FORUMS;
|
||||
Gbl.Forum.Type = (For_ForumType_t) 0;
|
||||
Gbl.Forum.Cod = -1L;
|
||||
Gbl.Forum.Location = -1L;
|
||||
Gbl.Forum.SelectedOrder = For_DEFAULT_ORDER;
|
||||
Gbl.Forum.ThreadToMove = -1L;
|
||||
// Gbl.Forum.CurrentPageThrs = 1; // TODO: Remove this line
|
||||
|
|
|
@ -583,11 +583,7 @@ struct Globals
|
|||
{
|
||||
For_WhichForums_t WhichForums;
|
||||
For_ForumType_t Type;
|
||||
long Cod; // Institution, centre, degree or course code of the selected forum
|
||||
struct Instit Ins;
|
||||
struct Centre Ctr;
|
||||
struct Degree Deg;
|
||||
struct Course Crs;
|
||||
long Location; // Institution, centre, degree or course code of the selected forum
|
||||
int Level;
|
||||
For_Order_t SelectedOrder;
|
||||
char PathRelOld[PATH_MAX + 1];
|
||||
|
|
|
@ -450,17 +450,9 @@ void Ntf_ShowMyNotifications (void)
|
|||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||
{
|
||||
Gbl.Forum.Type = For_GetForumTypeOfAPost (Cod);
|
||||
For_SetForumName (Gbl.Forum.Type,
|
||||
&Ins,
|
||||
&Ctr,
|
||||
&Deg,
|
||||
&Crs,
|
||||
For_GetForumTypeAndLocationOfAPost (Cod,&Gbl.Forum.Type,&Gbl.Forum.Location);
|
||||
For_SetForumName (Gbl.Forum.Type,Gbl.Forum.Location,
|
||||
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
|
||||
Gbl.Forum.Ins.InsCod = Ins.InsCod;
|
||||
Gbl.Forum.Ctr.CtrCod = Ctr.CtrCod;
|
||||
Gbl.Forum.Deg.DegCod = Deg.DegCod;
|
||||
Gbl.Forum.Crs.CrsCod = Crs.CrsCod;
|
||||
}
|
||||
|
||||
/* Get time of the event (row[7]) */
|
||||
|
@ -1178,6 +1170,8 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
unsigned long NumRow;
|
||||
unsigned long NumRows;
|
||||
struct UsrData UsrDat;
|
||||
For_ForumType_t ForumType;
|
||||
long ForumLocation;
|
||||
unsigned NumUsrsToBeNotifiedByEMail = 0;
|
||||
unsigned NotifyEventMask = (1 << NotifyEvent);
|
||||
|
||||
|
@ -1308,7 +1302,8 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
|||
return 0;
|
||||
case Ntf_EVENT_FORUM_POST_COURSE:
|
||||
// Check if forum is for users or for all users in the course
|
||||
switch (For_GetForumTypeOfAPost (Cod))
|
||||
For_GetForumTypeAndLocationOfAPost (Cod,&ForumType,&ForumLocation);
|
||||
switch (ForumType)
|
||||
{
|
||||
case For_FORUM_COURSE_USRS:
|
||||
sprintf (Query,"SELECT UsrCod FROM crs_usr"
|
||||
|
@ -1421,16 +1416,32 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
|||
long CtrCod;
|
||||
long DegCod;
|
||||
long CrsCod;
|
||||
// long GrpCod;
|
||||
|
||||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||
{
|
||||
InsCod = Gbl.Forum.Ins.InsCod;
|
||||
CtrCod = Gbl.Forum.Ctr.CtrCod;
|
||||
DegCod = Gbl.Forum.Deg.DegCod;
|
||||
CrsCod = Gbl.Forum.Crs.CrsCod;
|
||||
// GrpCod = -1L; // There are no forums for a group
|
||||
InsCod = CtrCod = DegCod = CrsCod = -1L;
|
||||
switch (Gbl.Forum.Type)
|
||||
{
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
case For_FORUM_INSTIT_TCHS:
|
||||
InsCod = Gbl.Forum.Location;
|
||||
break;
|
||||
case For_FORUM_CENTRE_USRS:
|
||||
case For_FORUM_CENTRE_TCHS:
|
||||
CtrCod = Gbl.Forum.Location;
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
case For_FORUM_DEGREE_TCHS:
|
||||
DegCod = Gbl.Forum.Location;
|
||||
break;
|
||||
case For_FORUM_COURSE_USRS:
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
CrsCod = Gbl.Forum.Location;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1438,7 +1449,6 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
|
|||
CtrCod = Gbl.CurrentCtr.Ctr.CtrCod;
|
||||
DegCod = Gbl.CurrentDeg.Deg.DegCod;
|
||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||
// GrpCod = Gbl.CurrentCrs.Grps.GrpCod;
|
||||
}
|
||||
|
||||
/***** Store notify event *****/
|
||||
|
@ -1563,6 +1573,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
struct Course Crs;
|
||||
long Cod;
|
||||
For_ForumType_t ForumType = (For_ForumType_t) 0; // Initialized to avoid warning
|
||||
long ForumLocation = -1L; // Initialized to avoid warning
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char Command[2048]; // Command to execute for sending an email
|
||||
int ReturnCode;
|
||||
|
@ -1641,7 +1652,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
/* Get forum type */
|
||||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||
ForumType = For_GetForumTypeOfAPost (Cod);
|
||||
For_GetForumTypeAndLocationOfAPost (Cod,&ForumType,&ForumLocation);
|
||||
|
||||
/* Information about the type of this event */
|
||||
fprintf (Gbl.Msg.FileMail,Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[NotifyEvent][ToUsrLanguage],
|
||||
|
@ -1677,11 +1688,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
|
|||
break;
|
||||
case Ntf_EVENT_FORUM_POST_COURSE:
|
||||
case Ntf_EVENT_FORUM_REPLY:
|
||||
For_SetForumName (ForumType,
|
||||
&Ins,
|
||||
&Ctr,
|
||||
&Deg,
|
||||
&Crs,
|
||||
For_SetForumName (ForumType,ForumLocation,
|
||||
ForumName,ToUsrLanguage,false); // Set forum name in recipient's language
|
||||
fprintf (Gbl.Msg.FileMail,"%s: %s\n",
|
||||
Txt_Forum_NO_HTML[ToUsrLanguage],
|
||||
|
|
|
@ -1375,17 +1375,10 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
|||
break;
|
||||
case Soc_NOTE_FORUM_POST:
|
||||
/* Get forum type of the post */
|
||||
Gbl.Forum.Type = For_GetForumTypeOfAPost (SocNot->Cod);
|
||||
For_SetForumName (Gbl.Forum.Type,
|
||||
&Ins,
|
||||
&Ctr,
|
||||
&Deg,
|
||||
&Crs,
|
||||
For_GetForumTypeAndLocationOfAPost (SocNot->Cod,
|
||||
&Gbl.Forum.Type,&Gbl.Forum.Location);
|
||||
For_SetForumName (Gbl.Forum.Type,Gbl.Forum.Location,
|
||||
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
|
||||
Gbl.Forum.Ins.InsCod = Ins.InsCod;
|
||||
Gbl.Forum.Ctr.CtrCod = Ctr.CtrCod;
|
||||
Gbl.Forum.Deg.DegCod = Deg.DegCod;
|
||||
Gbl.Forum.Crs.CrsCod = Crs.CrsCod;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -2813,6 +2813,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
struct Degree Deg;
|
||||
struct Course Crs;
|
||||
long Cod;
|
||||
For_ForumType_t ForumType;
|
||||
long ForumLocation;
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
|
||||
char *ContentStr;
|
||||
|
@ -2947,11 +2949,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
|
||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||
{
|
||||
For_SetForumName (For_GetForumTypeOfAPost (Cod),
|
||||
&Ins,
|
||||
&Ctr,
|
||||
&Deg,
|
||||
&Crs,
|
||||
For_GetForumTypeAndLocationOfAPost (Cod,&ForumType,&ForumLocation);
|
||||
For_SetForumName (ForumType,ForumLocation,
|
||||
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
|
||||
sprintf (getNotificationsOut->notificationsArray.__ptr[NumNotif].location,"%s: %s",
|
||||
Txt_Forum,ForumName);
|
||||
|
|
Loading…
Reference in New Issue