Version19.168

This commit is contained in:
acanas 2020-04-07 03:01:41 +02:00
parent 7cb4c962fc
commit 19c764abf7
20 changed files with 633 additions and 522 deletions

View File

@ -3250,7 +3250,7 @@ int swad__getNotifications (struct soap *soap,
struct Degree Deg; struct Degree Deg;
struct Course Crs; struct Course Crs;
long Cod; long Cod;
struct Forum ForumSelected; struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]; char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
char *ContentStr; char *ContentStr;

View File

@ -473,7 +473,7 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType)
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],
&Pagination, &Pagination,
(unsigned) Gbl.Agenda.SelectedOrder, (unsigned) Gbl.Agenda.SelectedOrder,
0); NULL,0);
if (Gbl.Agenda.Num) if (Gbl.Agenda.Num)
{ {
@ -499,7 +499,7 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType)
Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType], Pag_WriteLinksToPagesCentered (WhatPaginate[AgendaType],
&Pagination, &Pagination,
(unsigned) Gbl.Agenda.SelectedOrder, (unsigned) Gbl.Agenda.SelectedOrder,
0); NULL,0);
/***** Button to create a new event *****/ /***** Button to create a new event *****/
if (AgendaType == Agd_MY_AGENDA) if (AgendaType == Agd_MY_AGENDA)

View File

@ -187,7 +187,7 @@ static void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
&Pagination, &Pagination,
(unsigned) Assignments->SelectedOrder, (unsigned) Assignments->SelectedOrder,
0); NULL,0);
if (Assignments->Num) if (Assignments->Num)
{ {
@ -212,7 +212,7 @@ static void Asg_ShowAllAssignments (struct Asg_Assignments *Assignments)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS, Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
&Pagination, &Pagination,
(unsigned) Assignments->SelectedOrder, (unsigned) Assignments->SelectedOrder,
0); NULL,0);
/***** Button to create a new assignment *****/ /***** Button to create a new assignment *****/
if (Asg_CheckIfICanCreateAssignments ()) if (Asg_CheckIfICanCreateAssignments ())

View File

@ -270,7 +270,7 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
&Pagination, &Pagination,
(unsigned) Events->SelectedOrder, (unsigned) Events->SelectedOrder,
0); NULL,0);
if (Events->Num) if (Events->Num)
{ {
@ -324,7 +324,7 @@ static void Att_ShowAllAttEvents (struct Att_Events *Events)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS, Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
&Pagination, &Pagination,
(unsigned) Events->SelectedOrder, (unsigned) Events->SelectedOrder,
0); NULL,0);
/***** Button to create a new attendance event *****/ /***** Button to create a new attendance event *****/
if (ICanEdit) if (ICanEdit)

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.167 (2020-04-06)" #define Log_PLATFORM_VERSION "SWAD 19.168 (2020-04-07)"
#define CSS_FILE "swad19.146.css" #define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.153.js" #define JS_FILE "swad19.153.js"
/* /*
@ -550,6 +550,7 @@ Funci
// TODO: Bug en SWADroid: loginByUserPasswordKey falla cuando se le pasa como parámetro un DNI // TODO: Bug en SWADroid: loginByUserPasswordKey falla cuando se le pasa como parámetro un DNI
Version 19.168: Apr 07, 2020 Code refactoring in forums. (284866 lines)
Version 19.167: Apr 06, 2020 Code refactoring in figures. (284772 lines) Version 19.167: Apr 06, 2020 Code refactoring in figures. (284772 lines)
Version 19.166.1: Apr 06, 2020 Fixed bug in API function loginByUserPasswordKey, reported by Javier Bueno López. (? lines) Version 19.166.1: Apr 06, 2020 Fixed bug in API function loginByUserPasswordKey, reported by Javier Bueno López. (? lines)
Version 19.166: Apr 06, 2020 Code refactoring in banners. (284805 lines) Version 19.166: Apr 06, 2020 Code refactoring in banners. (284805 lines)

View File

@ -363,7 +363,11 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole)
if (CreateNotif) if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L, Ntf_StoreNotifyEventToOneUser (NotifyEvent,UsrDat,-1L,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0),
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1332,7 +1332,11 @@ static void Fol_FollowUsr (struct UsrData *UsrDat)
if (CreateNotif) if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_FOLLOWER,UsrDat,Gbl.Usrs.Me.UsrDat.UsrCod, Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_FOLLOWER,UsrDat,Gbl.Usrs.Me.UsrDat.UsrCod,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0),
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
} }
/*****************************************************************************/ /*****************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
#include "swad_degree.h" #include "swad_degree.h"
#include "swad_institution.h" #include "swad_institution.h"
#include "swad_notification.h" #include "swad_notification.h"
#include "swad_pagination.h" // #include "swad_pagination.h"
#include "swad_scope.h" #include "swad_scope.h"
#include "swad_string.h" #include "swad_string.h"
@ -65,7 +65,7 @@ typedef enum
For_FORUM_UNKNOWN = 12, // TODO: Change to 0 (also in database) For_FORUM_UNKNOWN = 12, // TODO: Change to 0 (also in database)
} For_ForumType_t; // Don't change numbers (used in database) } For_ForumType_t; // Don't change numbers (used in database)
struct Forum struct For_Forum
{ {
For_ForumType_t Type; // Type of forum For_ForumType_t Type; // Type of forum
long Location; // Code of institution, centre, degree or course long Location; // Code of institution, centre, degree or course
@ -73,6 +73,16 @@ struct Forum
long PstCod; // Optional post code long PstCod; // Optional post code
}; };
struct For_Forums
{
For_ForumSet_t ForumSet;
Dat_StartEndTime_t ThreadsOrder;
unsigned CurrentPageThrs;
unsigned CurrentPagePsts;
struct For_Forum ForumSelected; // Forum type, location, thread and post
long ThreadToMove;
};
struct ForumThread struct ForumThread
{ {
long ThrCod; long ThrCod;
@ -96,10 +106,12 @@ struct ForumThread
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void For_ResetForums (struct For_Forums *Forums);
void For_EnablePost (void); void For_EnablePost (void);
void For_DisablePost (void); void For_DisablePost (void);
void For_GetForumTypeAndLocationOfAPost (long PstCod,struct Forum *Forum); void For_GetForumTypeAndLocationOfAPost (long PstCod,struct For_Forum *Forum);
unsigned long For_GetNumPostsUsr (long UsrCod); unsigned long For_GetNumPostsUsr (long UsrCod);
void For_RemoveUsrFromReadThrs (long UsrCod); void For_RemoveUsrFromReadThrs (long UsrCod);
@ -116,7 +128,7 @@ void For_PutAllHiddenParamsForum (unsigned NumPageThreads,
long ThrCod, long ThrCod,
long PstCod); long PstCod);
void For_SetForumName (struct Forum *Forum, void For_SetForumName (const struct For_Forum *Forum,
char ForumName[For_MAX_BYTES_FORUM_NAME + 1], char ForumName[For_MAX_BYTES_FORUM_NAME + 1],
Lan_Language_t Language,bool UseHTMLEntities); Lan_Language_t Language,bool UseHTMLEntities);

View File

@ -222,7 +222,7 @@ static void Gam_ListAllGames (void)
Pag_WriteLinksToPagesCentered (Pag_GAMES, Pag_WriteLinksToPagesCentered (Pag_GAMES,
&Pagination, &Pagination,
(unsigned) Gbl.Games.SelectedOrder, (unsigned) Gbl.Games.SelectedOrder,
0); NULL,0);
if (Gbl.Games.Num) if (Gbl.Games.Num)
{ {
@ -282,7 +282,7 @@ static void Gam_ListAllGames (void)
Pag_WriteLinksToPagesCentered (Pag_GAMES, Pag_WriteLinksToPagesCentered (Pag_GAMES,
&Pagination, &Pagination,
(unsigned) Gbl.Games.SelectedOrder, (unsigned) Gbl.Games.SelectedOrder,
0); NULL,0);
/***** Button to create a new game *****/ /***** Button to create a new game *****/
if (Gam_CheckIfICanEditGames ()) if (Gam_CheckIfICanEditGames ())

View File

@ -343,15 +343,6 @@ void Gbl_InitializeGlobals (void)
/* Public activity */ /* Public activity */
Gbl.Timeline.Who = TL_DEFAULT_WHO; Gbl.Timeline.Who = TL_DEFAULT_WHO;
/* Forums */
Gbl.Forum.ForumSet = For_DEFAULT_FORUM_SET;
Gbl.Forum.ForumSelected.Type = For_FORUM_UNKNOWN;
Gbl.Forum.ForumSelected.Location = -1L;
Gbl.Forum.ForumSelected.ThrCod = -1L;
Gbl.Forum.ForumSelected.PstCod = -1L;
Gbl.Forum.ThreadsOrder = For_DEFAULT_ORDER;
Gbl.Forum.ThreadToMove = -1L;
/* User nickname */ /* User nickname */
Gbl.Usrs.Me.UsrDat.Nickname[0] = '\0'; Gbl.Usrs.Me.UsrDat.Nickname[0] = '\0';

View File

@ -540,15 +540,6 @@ struct Globals
long NotCod; // Used as parameter about social note to be edited, removed... long NotCod; // Used as parameter about social note to be edited, removed...
long PubCod; // Used as parameter about social publishing to be edited, removed... long PubCod; // Used as parameter about social publishing to be edited, removed...
} Timeline; } Timeline;
struct
{
For_ForumSet_t ForumSet;
Dat_StartEndTime_t ThreadsOrder;
unsigned CurrentPageThrs;
unsigned CurrentPagePsts;
struct Forum ForumSelected; // Forum type, location, thread and post
long ThreadToMove;
} Forum;
struct struct
{ {
Msg_TypeOfMessages_t TypeOfMessages; Msg_TypeOfMessages_t TypeOfMessages;

View File

@ -46,6 +46,7 @@
#include "swad_ID.h" #include "swad_ID.h"
#include "swad_message.h" #include "swad_message.h"
#include "swad_notification.h" #include "swad_notification.h"
#include "swad_pagination.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_photo.h" #include "swad_photo.h"
#include "swad_profile.h" #include "swad_profile.h"
@ -814,7 +815,11 @@ void Msg_RecMsgFromUsr (void)
if (CreateNotif) if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_MESSAGE,&UsrDstData,NewMsgCod, Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_MESSAGE,&UsrDstData,NewMsgCod,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0),
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
/***** Show an alert indicating that the message has been sent successfully *****/ /***** Show an alert indicating that the message has been sent successfully *****/
Ale_ShowAlert (Ale_SUCCESS,NotifyByEmail ? Txt_message_sent_to_X_notified_by_email : Ale_ShowAlert (Ale_SUCCESS,NotifyByEmail ? Txt_message_sent_to_X_notified_by_email :
@ -1835,7 +1840,7 @@ static void Msg_ShowSentOrReceivedMessages (void)
Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages],
&Pagination, &Pagination,
(unsigned) Dat_START_TIME, // Not used (unsigned) Dat_START_TIME, // Not used
0); NULL,0);
/***** Show received / sent messages in this page *****/ /***** Show received / sent messages in this page *****/
HTM_TABLE_BeginWidePadding (2); HTM_TABLE_BeginWidePadding (2);
@ -1859,7 +1864,7 @@ static void Msg_ShowSentOrReceivedMessages (void)
Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages], Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages],
&Pagination, &Pagination,
(unsigned) Dat_START_TIME, // Not used (unsigned) Dat_START_TIME, // Not used
0); NULL,0);
} }
/***** End box *****/ /***** End box *****/

View File

@ -40,6 +40,7 @@
#include "swad_exam.h" #include "swad_exam.h"
#include "swad_follow.h" #include "swad_follow.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_HTML.h" #include "swad_HTML.h"
#include "swad_mark.h" #include "swad_mark.h"
@ -267,7 +268,8 @@ static void Ntf_WriteFormAllNotifications (bool AllNotifications);
static bool Ntf_GetAllNotificationsFromForm (void); static bool Ntf_GetAllNotificationsFromForm (void);
static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent, static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
long CrsCod,struct UsrData *UsrDat,long Cod); long CrsCod,struct UsrData *UsrDat,long Cod,
const struct For_Forums *Forums);
static void Ntf_PutHiddenParamNotifyEvent (Ntf_NotifyEvent_t NotifyEvent); static void Ntf_PutHiddenParamNotifyEvent (Ntf_NotifyEvent_t NotifyEvent);
static void Ntf_UpdateMyLastAccessToNotifications (void); static void Ntf_UpdateMyLastAccessToNotifications (void);
@ -321,6 +323,7 @@ void Ntf_ShowMyNotifications (void)
struct Degree Deg; struct Degree Deg;
struct Course Crs; struct Course Crs;
long Cod; long Cod;
struct For_Forums Forums;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
time_t DateTimeUTC; // Date-time of the event time_t DateTimeUTC; // Date-time of the event
Ntf_Status_t Status; Ntf_Status_t Status;
@ -428,8 +431,9 @@ void Ntf_ShowMyNotifications (void)
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE || if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY) NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{ {
For_GetForumTypeAndLocationOfAPost (Cod,&Gbl.Forum.ForumSelected); For_ResetForums (&Forums);
For_SetForumName (&Gbl.Forum.ForumSelected, For_GetForumTypeAndLocationOfAPost (Cod,&Forums.ForumSelected);
For_SetForumName (&Forums.ForumSelected,
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
} }
@ -472,7 +476,7 @@ void Ntf_ShowMyNotifications (void)
HTM_TD_Begin ("class=\"%s LT\" style=\"width:25px;\"",ClassBackground); HTM_TD_Begin ("class=\"%s LT\" style=\"width:25px;\"",ClassBackground);
if (PutLink) if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod); PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink) if (PutLink)
{ {
@ -489,7 +493,7 @@ void Ntf_ShowMyNotifications (void)
HTM_TD_Begin ("class=\"%s LT\"",ClassBackground); HTM_TD_Begin ("class=\"%s LT\"",ClassBackground);
if (PutLink) if (PutLink)
{ {
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod); PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL); HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]); HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -514,7 +518,7 @@ void Ntf_ShowMyNotifications (void)
NotifyEvent == Ntf_EVENT_FORUM_REPLY) NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{ {
if (PutLink) if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod); PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink) if (PutLink)
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL); HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
@ -532,7 +536,7 @@ void Ntf_ShowMyNotifications (void)
else else
{ {
if (PutLink) if (PutLink)
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod); PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,&UsrDat,Cod,&Forums);
if (PutLink) if (PutLink)
HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL); HTM_BUTTON_SUBMIT_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassLink,NULL);
@ -653,7 +657,8 @@ static bool Ntf_GetAllNotificationsFromForm (void)
// Return the value of Gbl.Form.Inside (true if form is started) // Return the value of Gbl.Form.Inside (true if form is started)
static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent, static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
long CrsCod,struct UsrData *UsrDat,long Cod) long CrsCod,struct UsrData *UsrDat,long Cod,
const struct For_Forums *Forums)
{ {
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM]; extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
struct FileMetadata FileMetadata; struct FileMetadata FileMetadata;
@ -734,13 +739,13 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
break; break;
case Ntf_EVENT_FORUM_POST_COURSE: case Ntf_EVENT_FORUM_POST_COURSE:
case Ntf_EVENT_FORUM_REPLY: case Ntf_EVENT_FORUM_REPLY:
Frm_StartForm (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type]); Frm_StartForm (For_ActionsSeeFor[Forums->ForumSelected.Type]);
For_PutAllHiddenParamsForum (1, // Page of threads = first For_PutAllHiddenParamsForum (1, // Page of threads = first
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
Gbl.Forum.ThreadsOrder, Forums->ThreadsOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
Gbl.Forum.ForumSelected.ThrCod, Forums->ForumSelected.ThrCod,
-1L); -1L);
break; break;
case Ntf_EVENT_NOTICE: case Ntf_EVENT_NOTICE:
@ -1145,7 +1150,11 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
unsigned long NumRow; unsigned long NumRow;
unsigned long NumRows = 0; // Initialized to avoid warning unsigned long NumRows = 0; // Initialized to avoid warning
struct UsrData UsrDat; struct UsrData UsrDat;
struct Forum ForumSelected; struct For_Forum ForumSelected;
long InsCod;
long CtrCod;
long DegCod;
long CrsCod;
unsigned NumUsrsToBeNotifiedByEMail = 0; unsigned NumUsrsToBeNotifiedByEMail = 0;
unsigned NotifyEventMask = (1 << NotifyEvent); unsigned NotifyEventMask = (1 << NotifyEvent);
@ -1299,6 +1308,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
case Ntf_EVENT_FORUM_POST_COURSE: case Ntf_EVENT_FORUM_POST_COURSE:
// Check if forum is for users or for all users in the course // Check if forum is for users or for all users in the course
For_GetForumTypeAndLocationOfAPost (Cod,&ForumSelected); For_GetForumTypeAndLocationOfAPost (Cod,&ForumSelected);
switch (ForumSelected.Type) switch (ForumSelected.Type)
{ {
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
@ -1367,6 +1377,40 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
break; break;
} }
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
InsCod = CtrCod = DegCod = CrsCod = -1L;
switch (ForumSelected.Type)
{
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
InsCod = ForumSelected.Location;
break;
case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS:
CtrCod = ForumSelected.Location;
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
DegCod = ForumSelected.Location;
break;
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
CrsCod = ForumSelected.Location;
break;
default:
break;
}
}
else
{
InsCod = Gbl.Hierarchy.Ins.InsCod;
CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
DegCod = Gbl.Hierarchy.Deg.DegCod;
CrsCod = Gbl.Hierarchy.Crs.CrsCod;
}
if (NumRows) // Users found if (NumRows) // Users found
{ {
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
@ -1389,11 +1433,13 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
if ((UsrDat.NtfEvents.SendEmail & NotifyEventMask)) // Send notification by email if ((UsrDat.NtfEvents.SendEmail & NotifyEventMask)) // Send notification by email
{ {
Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,Cod, Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,Cod,
(Ntf_Status_t) Ntf_STATUS_BIT_EMAIL); (Ntf_Status_t) Ntf_STATUS_BIT_EMAIL,
InsCod,CtrCod,DegCod,CrsCod);
NumUsrsToBeNotifiedByEMail++; NumUsrsToBeNotifiedByEMail++;
} }
else // Don't send notification by email else // Don't send notification by email
Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,Cod,(Ntf_Status_t) 0); Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,Cod,(Ntf_Status_t) 0,
InsCod,CtrCod,DegCod,CrsCod);
} }
} }
@ -1413,47 +1459,9 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent, void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
struct UsrData *UsrDat, struct UsrData *UsrDat,
long Cod,Ntf_Status_t Status) long Cod,Ntf_Status_t Status,
long InsCod,long CtrCod,long DegCod,long CrsCod)
{ {
long InsCod;
long CtrCod;
long DegCod;
long CrsCod;
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
InsCod = CtrCod = DegCod = CrsCod = -1L;
switch (Gbl.Forum.ForumSelected.Type)
{
case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS:
InsCod = Gbl.Forum.ForumSelected.Location;
break;
case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS:
CtrCod = Gbl.Forum.ForumSelected.Location;
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
DegCod = Gbl.Forum.ForumSelected.Location;
break;
case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS:
CrsCod = Gbl.Forum.ForumSelected.Location;
break;
default:
break;
}
}
else
{
InsCod = Gbl.Hierarchy.Ins.InsCod;
CtrCod = Gbl.Hierarchy.Ctr.CtrCod;
DegCod = Gbl.Hierarchy.Deg.DegCod;
CrsCod = Gbl.Hierarchy.Crs.CrsCod;
}
/***** Store notify event *****/ /***** Store notify event *****/
DB_QueryINSERT ("can not create new notification event", DB_QueryINSERT ("can not create new notification event",
"INSERT INTO notif" "INSERT INTO notif"
@ -1578,7 +1586,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
struct Degree Deg; struct Degree Deg;
struct Course Crs; struct Course Crs;
long Cod; long Cod;
struct Forum ForumSelected; struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char Command[2048 + char Command[2048 +
Cfg_MAX_BYTES_SMTP_PASSWORD + Cfg_MAX_BYTES_SMTP_PASSWORD +

View File

@ -131,7 +131,8 @@ void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod);
unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod); unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod);
void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent, void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
struct UsrData *UsrDat, struct UsrData *UsrDat,
long Cod,Ntf_Status_t Status); long Cod,Ntf_Status_t Status,
long InsCod,long CtrCod,long DegCod,long CrsCod);
void Ntf_SendPendingNotifByEMailToAllUsrs (void); void Ntf_SendPendingNotifByEMailToAllUsrs (void);
Ntf_NotifyEvent_t Ntf_GetNotifyEventFromStr (const char *Str); Ntf_NotifyEvent_t Ntf_GetNotifyEventFromStr (const char *Str);
void Ntf_MarkAllNotifAsSeen (void); void Ntf_MarkAllNotifAsSeen (void);

View File

@ -36,6 +36,7 @@
#include "swad_forum.h" #include "swad_forum.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_HTML.h" #include "swad_HTML.h"
#include "swad_pagination.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_program.h" #include "swad_program.h"
#include "swad_project.h" #include "swad_project.h"
@ -131,12 +132,12 @@ void Pag_CalculatePagination (struct Pagination *Pagination)
void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
struct Pagination *Pagination, struct Pagination *Pagination,
unsigned SelectedOrder, unsigned SelectedOrder,
long ThrCod) const struct For_Forums *Forums,long ThrCod)
{ {
if (Pagination->MoreThanOnePage) if (Pagination->MoreThanOnePage)
{ {
HTM_DIV_Begin ("class=\"CM\""); HTM_DIV_Begin ("class=\"CM\"");
Pag_WriteLinksToPages (WhatPaginate,Pagination,SelectedOrder,ThrCod, Pag_WriteLinksToPages (WhatPaginate,Pagination,SelectedOrder,Forums,ThrCod,
true,NULL,"PAG_TXT",false); true,NULL,"PAG_TXT",false);
HTM_DIV_End (); HTM_DIV_End ();
} }
@ -149,7 +150,7 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
struct Pagination *Pagination, struct Pagination *Pagination,
unsigned SelectedOrder, unsigned SelectedOrder,
long ThrCod, const struct For_Forums *Forums,long ThrCod,
bool FirstMsgEnabled, bool FirstMsgEnabled,
const char *Subject,const char *ClassTxt, const char *Subject,const char *ClassTxt,
bool LinkToPagCurrent) bool LinkToPagCurrent)
@ -205,24 +206,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (1, // Page of threads = first For_PutAllHiddenParamsForum (1, // Page of threads = first
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;
@ -323,24 +324,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (1, // Page of threads = first For_PutAllHiddenParamsForum (1, // Page of threads = first
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;
@ -427,24 +428,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Pagination->LeftPage, // Page of threads = left For_PutAllHiddenParamsForum (Pagination->LeftPage, // Page of threads = left
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
Pagination->LeftPage, // Page of posts = left Pagination->LeftPage, // Page of posts = left
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;
@ -543,24 +544,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (NumPage, // Page of threads = number of page For_PutAllHiddenParamsForum (NumPage, // Page of threads = number of page
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
NumPage, // Page of posts = number of page NumPage, // Page of posts = number of page
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;
@ -646,24 +647,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Pagination->RightPage, // Page of threads = right For_PutAllHiddenParamsForum (Pagination->RightPage, // Page of threads = right
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
Pagination->RightPage, // Page of posts = right Pagination->RightPage, // Page of posts = right
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;
@ -750,24 +751,24 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
Grp_PutParamWhichGroups (&WhichGroups); Grp_PutParamWhichGroups (&WhichGroups);
break; break;
case Pag_THREADS_FORUM: case Pag_THREADS_FORUM:
Frm_StartFormAnchor (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeeFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Pagination->NumPags, // Page of threads = last For_PutAllHiddenParamsForum (Pagination->NumPags, // Page of threads = last
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
-1L, -1L,
-1L); -1L);
break; break;
case Pag_POSTS_FORUM: case Pag_POSTS_FORUM:
Frm_StartFormAnchor (For_ActionsSeePstFor[Gbl.Forum.ForumSelected.Type], Frm_StartFormAnchor (For_ActionsSeePstFor[Forums->ForumSelected.Type],
Pagination->Anchor); Pagination->Anchor);
For_PutAllHiddenParamsForum (Gbl.Forum.CurrentPageThrs, // Page of threads = current For_PutAllHiddenParamsForum (Forums->CurrentPageThrs, // Page of threads = current
Pagination->NumPags, // Page of posts = last Pagination->NumPags, // Page of posts = last
Gbl.Forum.ForumSet, Forums->ForumSet,
(Dat_StartEndTime_t) SelectedOrder, (Dat_StartEndTime_t) SelectedOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
ThrCod, ThrCod,
-1L); -1L);
break; break;

View File

@ -27,6 +27,8 @@
/********************************** Headers **********************************/ /********************************** Headers **********************************/
/*****************************************************************************/ /*****************************************************************************/
#include "swad_forum.h"
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -76,11 +78,11 @@ void Pag_CalculatePagination (struct Pagination *Pagination);
void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate, void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
struct Pagination *Pagination, struct Pagination *Pagination,
unsigned SelectedOrder, unsigned SelectedOrder,
long ThrCod); const struct For_Forums *Forums,long ThrCod);
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate, void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
struct Pagination *Pagination, struct Pagination *Pagination,
unsigned SelectedOrder, unsigned SelectedOrder,
long ThrCod, const struct For_Forums *Forums,long ThrCod,
bool FirstMsgEnabled, bool FirstMsgEnabled,
const char *Subject,const char *ClassTxt, const char *Subject,const char *ClassTxt,
bool LinkToPagCurrent); bool LinkToPagCurrent);

View File

@ -434,7 +434,7 @@ static void Prj_ShowPrjsInCurrentPage (void *Args)
Pag_WriteLinksToPagesCentered (Pag_PROJECTS, Pag_WriteLinksToPagesCentered (Pag_PROJECTS,
&Pagination, &Pagination,
(unsigned) Gbl.Prjs.SelectedOrder, (unsigned) Gbl.Prjs.SelectedOrder,
0); NULL,0);
/***** Allocate memory for the project *****/ /***** Allocate memory for the project *****/
Prj_AllocMemProject (&Prj); Prj_AllocMemProject (&Prj);
@ -480,7 +480,7 @@ static void Prj_ShowPrjsInCurrentPage (void *Args)
Pag_WriteLinksToPagesCentered (Pag_PROJECTS, Pag_WriteLinksToPagesCentered (Pag_PROJECTS,
&Pagination, &Pagination,
(unsigned) Gbl.Prjs.SelectedOrder, (unsigned) Gbl.Prjs.SelectedOrder,
0); NULL,0);
} }
else // No projects created else // No projects created
Ale_ShowAlert (Ale_INFO,Txt_No_projects); Ale_ShowAlert (Ale_INFO,Txt_No_projects);

View File

@ -235,7 +235,7 @@ static void Svy_ListAllSurveys (void)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS, Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
&Pagination, &Pagination,
(unsigned) Gbl.Svys.SelectedOrder, (unsigned) Gbl.Svys.SelectedOrder,
0); NULL,0);
if (Gbl.Svys.Num) if (Gbl.Svys.Num)
{ {
@ -291,7 +291,7 @@ static void Svy_ListAllSurveys (void)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS, Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
&Pagination, &Pagination,
(unsigned) Gbl.Svys.SelectedOrder, (unsigned) Gbl.Svys.SelectedOrder,
0); NULL,0);
/***** Button to create a new survey *****/ /***** Button to create a new survey *****/
if (Svy_CheckIfICanCreateSvy ()) if (Svy_CheckIfICanCreateSvy ())

View File

@ -250,7 +250,8 @@ static void TL_WriteTopMessage (TL_TopMessage_t TopMessage,long UsrCod);
static void TL_WriteAuthorNote (const struct UsrData *UsrDat); static void TL_WriteAuthorNote (const struct UsrData *UsrDat);
static void TL_WriteDateTime (time_t TimeUTC); static void TL_WriteDateTime (time_t TimeUTC);
static void TL_GetAndWritePost (long PstCod); static void TL_GetAndWritePost (long PstCod);
static void TL_PutFormGoToAction (const struct TL_Note *SocNot); static void TL_PutFormGoToAction (const struct TL_Note *SocNot,
const struct For_Forums *Forums);
static void TL_GetNoteSummary (const struct TL_Note *SocNot, static void TL_GetNoteSummary (const struct TL_Note *SocNot,
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]); char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]);
static void TL_PublishNoteInTimeline (struct TL_Publication *SocPub); static void TL_PublishNoteInTimeline (struct TL_Publication *SocPub);
@ -1536,6 +1537,7 @@ static void TL_WriteNote (const struct TL_Note *SocNot,
struct Course Crs; struct Course Crs;
bool ShowPhoto = false; bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
struct For_Forums Forums;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]; char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
unsigned NumComments; unsigned NumComments;
@ -1605,6 +1607,9 @@ static void TL_WriteNote (const struct TL_Note *SocNot,
TL_GetAndWritePost (SocNot->Cod); TL_GetAndWritePost (SocNot->Cod);
else else
{ {
/* Reset forums */
For_ResetForums (&Forums);
/* Get location in hierarchy */ /* Get location in hierarchy */
if (!SocNot->Unavailable) if (!SocNot->Unavailable)
switch (SocNot->NoteType) switch (SocNot->NoteType)
@ -1637,16 +1642,15 @@ static void TL_WriteNote (const struct TL_Note *SocNot,
break; break;
case TL_NOTE_FORUM_POST: case TL_NOTE_FORUM_POST:
/* Get forum type of the post */ /* Get forum type of the post */
For_GetForumTypeAndLocationOfAPost (SocNot->Cod,&Gbl.Forum.ForumSelected); For_GetForumTypeAndLocationOfAPost (SocNot->Cod,&Forums.ForumSelected);
For_SetForumName (&Gbl.Forum.ForumSelected, For_SetForumName (&Forums.ForumSelected,ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
break; break;
default: default:
break; break;
} }
/* Write note type */ /* Write note type */
TL_PutFormGoToAction (SocNot); TL_PutFormGoToAction (SocNot,&Forums);
/* Write location in hierarchy */ /* Write location in hierarchy */
if (!SocNot->Unavailable) if (!SocNot->Unavailable)
@ -1921,7 +1925,8 @@ static void TL_GetAndWritePost (long PstCod)
/************* Put form to go to an action depending on the note *************/ /************* Put form to go to an action depending on the note *************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutFormGoToAction (const struct TL_Note *SocNot) static void TL_PutFormGoToAction (const struct TL_Note *SocNot,
const struct For_Forums *Forums)
{ {
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM]; extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES]; extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
@ -2038,13 +2043,13 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot)
case TL_NOTE_POST: // Not applicable case TL_NOTE_POST: // Not applicable
return; return;
case TL_NOTE_FORUM_POST: case TL_NOTE_FORUM_POST:
Frm_StartFormUnique (For_ActionsSeeFor[Gbl.Forum.ForumSelected.Type]); Frm_StartFormUnique (For_ActionsSeeFor[Forums->ForumSelected.Type]);
For_PutAllHiddenParamsForum (1, // Page of threads = first For_PutAllHiddenParamsForum (1, // Page of threads = first
1, // Page of posts = first 1, // Page of posts = first
Gbl.Forum.ForumSet, Forums->ForumSet,
Gbl.Forum.ThreadsOrder, Forums->ThreadsOrder,
Gbl.Forum.ForumSelected.Location, Forums->ForumSelected.Location,
Gbl.Forum.ForumSelected.ThrCod, Forums->ForumSelected.ThrCod,
-1L); -1L);
if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course
Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course
@ -3929,7 +3934,11 @@ static void TL_CreateNotifToAuthor (long AuthorCod,long PubCod,
if (CreateNotif) if (CreateNotif)
Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,PubCod, Ntf_StoreNotifyEventToOneUser (NotifyEvent,&UsrDat,PubCod,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0),
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
} }
/***** Free memory used for user's data *****/ /***** Free memory used for user's data *****/
@ -5409,7 +5418,11 @@ static void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const
NotifyByEmail = (UsrDat.NtfEvents.SendEmail & (1 << Ntf_EVENT_TIMELINE_MENTION)); NotifyByEmail = (UsrDat.NtfEvents.SendEmail & (1 << Ntf_EVENT_TIMELINE_MENTION));
Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_TIMELINE_MENTION,&UsrDat,PubCod, Ntf_StoreNotifyEventToOneUser (Ntf_EVENT_TIMELINE_MENTION,&UsrDat,PubCod,
(Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : (Ntf_Status_t) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
0)); 0),
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod);
} }
} }
} }