mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-10 10:45:23 +02:00
Version 16.48
This commit is contained in:
parent
2c44f74713
commit
8124fa835c
|
@ -156,13 +156,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.47.19 (2016-11-07)"
|
#define Log_PLATFORM_VERSION "SWAD 16.48 (2016-11-07)"
|
||||||
#define CSS_FILE "swad16.32.1.css"
|
#define CSS_FILE "swad16.32.1.css"
|
||||||
#define JS_FILE "swad16.46.1.js"
|
#define JS_FILE "swad16.46.1.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.48: Nov 07, 2016 Icon in messages to show figure (statistics).
|
||||||
|
Code refactoring in messages. (206418 lines)
|
||||||
Version 16.47.19: Nov 07, 2016 Icon in forums to show figure (statistics). (206361 lines)
|
Version 16.47.19: Nov 07, 2016 Icon in forums to show figure (statistics). (206361 lines)
|
||||||
Version 16.47.18: Nov 07, 2016 Icon in "who to follow" to show figure (statistics). (206350 lines)
|
Version 16.47.18: Nov 07, 2016 Icon in "who to follow" to show figure (statistics). (206350 lines)
|
||||||
Version 16.47.17: Nov 07, 2016 Icon in public activity to show figure (statistics). (206337 lines)
|
Version 16.47.17: Nov 07, 2016 Icon in public activity to show figure (statistics). (206337 lines)
|
||||||
|
|
|
@ -585,6 +585,8 @@ struct Globals
|
||||||
} Forum;
|
} Forum;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
Msg_TypeOfMessages_t TypeOfMessages;
|
||||||
|
unsigned NumMsgs;
|
||||||
int MsgId;
|
int MsgId;
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
char Subject[Cns_MAX_BYTES_SUBJECT+1];
|
||||||
unsigned NumCourses;
|
unsigned NumCourses;
|
||||||
|
|
290
swad_message.c
290
swad_message.c
|
@ -76,14 +76,15 @@ extern struct Globals Gbl;
|
||||||
|
|
||||||
static void Msg_PutFormMsgUsrs (char *Content);
|
static void Msg_PutFormMsgUsrs (char *Content);
|
||||||
|
|
||||||
static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages);
|
static void Msg_ShowSentOrReceivedMessages (void);
|
||||||
static unsigned long Msg_GetNumUsrsBannedByMe (void);
|
static unsigned long Msg_GetNumUsrsBannedByMe (void);
|
||||||
static void Msg_PutLinkToViewBannedUsers(void);
|
static void Msg_PutLinkToViewBannedUsers(void);
|
||||||
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
|
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCod,
|
||||||
long FilterCrsCod,const char *FilterFromToSubquery);
|
long FilterCrsCod,const char *FilterFromToSubquery);
|
||||||
|
|
||||||
static char *Msg_WriteNumMsgs (Msg_TypeOfMessages_t TypeOfMessages,
|
static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs);
|
||||||
unsigned NumMsgs,unsigned NumUnreadMsgs);
|
|
||||||
|
static void Msg_PutIconsListMsgs (void);
|
||||||
static void Msg_PutIconToRemoveOneRcvMsg (void);
|
static void Msg_PutIconToRemoveOneRcvMsg (void);
|
||||||
static void Msg_PutIconToRemoveSevRcvMsgs (void);
|
static void Msg_PutIconToRemoveSevRcvMsgs (void);
|
||||||
static void Msg_PutIconToRemoveOneSntMsg (void);
|
static void Msg_PutIconToRemoveOneSntMsg (void);
|
||||||
|
@ -91,7 +92,7 @@ static void Msg_PutIconToRemoveSevSntMsgs (void);
|
||||||
|
|
||||||
static void Msg_ShowFormToShowOnlyUnreadMessages (void);
|
static void Msg_ShowFormToShowOnlyUnreadMessages (void);
|
||||||
static void Msg_GetParamOnlyUnreadMsgs (void);
|
static void Msg_GetParamOnlyUnreadMsgs (void);
|
||||||
static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,long MsgNum,long MsgCod);
|
static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod);
|
||||||
static void Msg_GetStatusOfSentMsg (long MsgCod,bool *Expanded);
|
static void Msg_GetStatusOfSentMsg (long MsgCod,bool *Expanded);
|
||||||
static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,bool *Expanded);
|
static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,bool *Expanded);
|
||||||
static long Msg_GetParamMsgCod (void);
|
static long Msg_GetParamMsgCod (void);
|
||||||
|
@ -127,14 +128,14 @@ static void Msg_GetMsgSntData (long MsgCod,long *CrsCod,long *UsrCod,
|
||||||
time_t *CreatTimeUTC,char *Subject,bool *Deleted);
|
time_t *CreatTimeUTC,char *Subject,bool *Deleted);
|
||||||
static void Msg_GetMsgContent (long MsgCod,char *Content,struct Image *Image);
|
static void Msg_GetMsgContent (long MsgCod,char *Content,struct Image *Image);
|
||||||
|
|
||||||
static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod,const char *Subject,bool Open,bool Expanded);
|
static void Msg_WriteSentOrReceivedMsgSubject (long MsgCod,const char *Subject,bool Open,bool Expanded);
|
||||||
static void Msg_WriteFormToReply (long MsgCod,long CrsCod,
|
static void Msg_WriteFormToReply (long MsgCod,long CrsCod,
|
||||||
bool ThisCrs,bool Replied,
|
bool ThisCrs,bool Replied,
|
||||||
const struct UsrData *UsrDat);
|
const struct UsrData *UsrDat);
|
||||||
static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted);
|
static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted);
|
||||||
static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod);
|
static void Msg_WriteMsgTo (long MsgCod);
|
||||||
|
|
||||||
static void Msg_PutFormToDeleteMessage (long MsgCod,Msg_TypeOfMessages_t TypeOfMessages);
|
static void Msg_PutFormToDeleteMessage (long MsgCod);
|
||||||
|
|
||||||
static void Msg_PutFormToBanSender (struct UsrData *UsrDat);
|
static void Msg_PutFormToBanSender (struct UsrData *UsrDat);
|
||||||
static void Msg_PutFormToUnbanSender (struct UsrData *UsrDat);
|
static void Msg_PutFormToUnbanSender (struct UsrData *UsrDat);
|
||||||
|
@ -1325,7 +1326,7 @@ static unsigned long Msg_DelSomeRecOrSntMsgsUsr (Msg_TypeOfMessages_t TypeOfMess
|
||||||
long MsgCod;
|
long MsgCod;
|
||||||
|
|
||||||
/***** Get some of the messages received or sent by this user from database *****/
|
/***** Get some of the messages received or sent by this user from database *****/
|
||||||
Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,TypeOfMessages,UsrCod,FilterCrsCod,FilterFromToSubquery);
|
Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,UsrCod,FilterCrsCod,FilterFromToSubquery);
|
||||||
NumMsgs = DB_QuerySELECT (Query,&mysql_res,"can not get list of messages");
|
NumMsgs = DB_QuerySELECT (Query,&mysql_res,"can not get list of messages");
|
||||||
|
|
||||||
/***** Delete each message *****/
|
/***** Delete each message *****/
|
||||||
|
@ -1615,7 +1616,8 @@ static unsigned Msg_GetNumUnreadMsgs (long FilterCrsCod,const char *FilterFromTo
|
||||||
void Msg_ShowSntMsgs (void)
|
void Msg_ShowSntMsgs (void)
|
||||||
{
|
{
|
||||||
/***** Show the sent messages *****/
|
/***** Show the sent messages *****/
|
||||||
Msg_ShowSentOrReceivedMessages (Msg_MESSAGES_SENT);
|
Gbl.Msg.TypeOfMessages = Msg_MESSAGES_SENT;
|
||||||
|
Msg_ShowSentOrReceivedMessages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1633,14 +1635,15 @@ void Msg_ShowRecMsgs (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Show the received messages *****/
|
/***** Show the received messages *****/
|
||||||
Msg_ShowSentOrReceivedMessages (Msg_MESSAGES_RECEIVED);
|
Gbl.Msg.TypeOfMessages = Msg_MESSAGES_RECEIVED;
|
||||||
|
Msg_ShowSentOrReceivedMessages ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************ Show sent or received messages *********************/
|
/************************ Show sent or received messages *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
static void Msg_ShowSentOrReceivedMessages (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
extern const char *The_ClassFormBold[The_NUM_THEMES];
|
||||||
extern const char *Txt_Update_messages;
|
extern const char *Txt_Update_messages;
|
||||||
|
@ -1651,28 +1654,35 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
unsigned long NumRow;
|
unsigned long NumRow;
|
||||||
unsigned long NumRows;
|
unsigned long NumRows;
|
||||||
unsigned long NumMsg = 0; // Initialized to avoid warning
|
unsigned long NumMsg = 0; // Initialized to avoid warning
|
||||||
unsigned NumMsgs;
|
|
||||||
unsigned NumUnreadMsgs;
|
unsigned NumUnreadMsgs;
|
||||||
struct Pagination Pagination;
|
struct Pagination Pagination;
|
||||||
long MsgCod;
|
long MsgCod;
|
||||||
|
static const Pag_WhatPaginate_t WhatPaginate[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
|
{
|
||||||
|
Pag_MESSAGES_RECEIVED,
|
||||||
|
Pag_MESSAGES_SENT
|
||||||
|
};
|
||||||
|
static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
|
{
|
||||||
|
ActSeeRcvMsg,
|
||||||
|
ActSeeSntMsg
|
||||||
|
};
|
||||||
|
|
||||||
/***** Get the page number *****/
|
/***** Get the page number *****/
|
||||||
Pag_GetParamPagNum (TypeOfMessages == Msg_MESSAGES_RECEIVED ? Pag_MESSAGES_RECEIVED :
|
Pag_GetParamPagNum (WhatPaginate[Gbl.Msg.TypeOfMessages]);
|
||||||
Pag_MESSAGES_SENT);
|
|
||||||
|
|
||||||
/***** Get other parameters *****/
|
/***** Get other parameters *****/
|
||||||
Msg_GetParamMsgsCrsCod ();
|
Msg_GetParamMsgsCrsCod ();
|
||||||
Msg_GetParamFilterFromTo ();
|
Msg_GetParamFilterFromTo ();
|
||||||
Msg_GetParamFilterContent ();
|
Msg_GetParamFilterContent ();
|
||||||
Msg_MakeFilterFromToSubquery (FilterFromToSubquery);
|
Msg_MakeFilterFromToSubquery (FilterFromToSubquery);
|
||||||
Msg_GetDistinctCoursesInMyMessages (TypeOfMessages);
|
Msg_GetDistinctCoursesInMyMessages ();
|
||||||
|
|
||||||
/***** Form to see messages again *****/
|
/***** Form to see messages again *****/
|
||||||
Act_FormStart (TypeOfMessages == Msg_MESSAGES_RECEIVED ? ActSeeRcvMsg :
|
Act_FormStart (ActionSee[Gbl.Msg.TypeOfMessages]);
|
||||||
ActSeeSntMsg);
|
Msg_ShowFormSelectCourseSentOrRecMsgs ();
|
||||||
Msg_ShowFormSelectCourseSentOrRecMsgs (TypeOfMessages);
|
Msg_ShowFormToFilterMsgs ();
|
||||||
Msg_ShowFormToFilterMsgs (TypeOfMessages);
|
if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED)
|
||||||
if (TypeOfMessages == Msg_MESSAGES_RECEIVED)
|
|
||||||
{
|
{
|
||||||
Msg_GetParamOnlyUnreadMsgs ();
|
Msg_GetParamOnlyUnreadMsgs ();
|
||||||
Msg_ShowFormToShowOnlyUnreadMessages ();
|
Msg_ShowFormToShowOnlyUnreadMessages ();
|
||||||
|
@ -1687,28 +1697,28 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
|
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
|
|
||||||
if (TypeOfMessages == Msg_MESSAGES_RECEIVED)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
NumUnreadMsgs = Msg_GetNumUnreadMsgs (Gbl.Msg.FilterCrsCod,FilterFromToSubquery);
|
{
|
||||||
else
|
case Msg_MESSAGES_RECEIVED:
|
||||||
NumUnreadMsgs = 0;
|
NumUnreadMsgs = Msg_GetNumUnreadMsgs (Gbl.Msg.FilterCrsCod,FilterFromToSubquery);
|
||||||
|
break;
|
||||||
|
case Msg_MESSAGES_SENT:
|
||||||
|
NumUnreadMsgs = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/***** Get messages from database *****/
|
/***** Get messages from database *****/
|
||||||
Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,TypeOfMessages,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Msg.FilterCrsCod,FilterFromToSubquery);
|
Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Msg.FilterCrsCod,FilterFromToSubquery);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get messages");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get messages");
|
||||||
|
|
||||||
NumMsgs = (unsigned) NumRows;
|
Gbl.Msg.NumMsgs = (unsigned) NumRows;
|
||||||
|
|
||||||
/***** Start frame with messages *****/
|
/***** Start frame with messages *****/
|
||||||
Lay_StartRoundFrame ("97%",
|
Lay_StartRoundFrame ("97%",
|
||||||
Msg_WriteNumMsgs (TypeOfMessages,NumMsgs,NumUnreadMsgs),
|
Msg_WriteNumMsgs (NumUnreadMsgs),
|
||||||
TypeOfMessages == Msg_MESSAGES_RECEIVED ? ((NumMsgs == 1) ? Msg_PutIconToRemoveOneRcvMsg :
|
Msg_PutIconsListMsgs);
|
||||||
((NumMsgs > 1) ? Msg_PutIconToRemoveSevRcvMsgs :
|
|
||||||
NULL)) :
|
|
||||||
((NumMsgs == 1) ? Msg_PutIconToRemoveOneSntMsg :
|
|
||||||
((NumMsgs > 1) ? Msg_PutIconToRemoveSevSntMsgs :
|
|
||||||
NULL)));
|
|
||||||
|
|
||||||
if (NumMsgs) // If there are messages...
|
if (Gbl.Msg.NumMsgs) // If there are messages...
|
||||||
{
|
{
|
||||||
if (Gbl.Action.Act == ActExpRcvMsg) // Expanding a message, perhaps it is the result of following a link
|
if (Gbl.Action.Act == ActExpRcvMsg) // Expanding a message, perhaps it is the result of following a link
|
||||||
// from a notification of received message, so show the page where the message is inside
|
// from a notification of received message, so show the page where the message is inside
|
||||||
|
@ -1731,20 +1741,18 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Compute variables related to pagination *****/
|
/***** Compute variables related to pagination *****/
|
||||||
Pagination.NumItems = NumMsgs;
|
Pagination.NumItems = Gbl.Msg.NumMsgs;
|
||||||
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
|
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
|
||||||
Pag_CalculatePagination (&Pagination);
|
Pag_CalculatePagination (&Pagination);
|
||||||
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
|
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
|
||||||
|
|
||||||
/***** Save my current page in order to show it next time I'll view my received/sent messages *****/
|
/***** Save my current page in order to show it next time I'll view my received/sent messages *****/
|
||||||
Pag_SaveLastPageMsgIntoSession (TypeOfMessages == Msg_MESSAGES_RECEIVED ? Pag_MESSAGES_RECEIVED :
|
Pag_SaveLastPageMsgIntoSession (WhatPaginate[Gbl.Msg.TypeOfMessages],
|
||||||
Pag_MESSAGES_SENT,
|
|
||||||
Gbl.Pag.CurrentPage);
|
Gbl.Pag.CurrentPage);
|
||||||
|
|
||||||
/***** Write links to pages *****/
|
/***** Write links to pages *****/
|
||||||
if (Pagination.MoreThanOnePage)
|
if (Pagination.MoreThanOnePage)
|
||||||
Pag_WriteLinksToPagesCentered (TypeOfMessages == Msg_MESSAGES_RECEIVED ? Pag_MESSAGES_RECEIVED :
|
Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages],
|
||||||
Pag_MESSAGES_SENT,
|
|
||||||
0,&Pagination);
|
0,&Pagination);
|
||||||
|
|
||||||
/***** Show received / sent messages in this page *****/
|
/***** Show received / sent messages in this page *****/
|
||||||
|
@ -1761,15 +1769,14 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
if (sscanf (row[0],"%ld",&MsgCod) != 1)
|
if (sscanf (row[0],"%ld",&MsgCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of message when listing the messages in a page.");
|
Lay_ShowErrorAndExit ("Wrong code of message when listing the messages in a page.");
|
||||||
NumMsg = NumRows - NumRow + 1;
|
NumMsg = NumRows - NumRow + 1;
|
||||||
Msg_ShowASentOrReceivedMessage (TypeOfMessages,NumMsg,MsgCod);
|
Msg_ShowASentOrReceivedMessage (NumMsg,MsgCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</table>");
|
fprintf (Gbl.F.Out,"</table>");
|
||||||
|
|
||||||
/***** Write again links to pages *****/
|
/***** Write again links to pages *****/
|
||||||
if (Pagination.MoreThanOnePage)
|
if (Pagination.MoreThanOnePage)
|
||||||
Pag_WriteLinksToPagesCentered (TypeOfMessages == Msg_MESSAGES_RECEIVED ? Pag_MESSAGES_RECEIVED :
|
Pag_WriteLinksToPagesCentered (WhatPaginate[Gbl.Msg.TypeOfMessages],
|
||||||
Pag_MESSAGES_SENT,
|
|
||||||
0,&Pagination);
|
0,&Pagination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1812,7 +1819,7 @@ static void Msg_PutLinkToViewBannedUsers(void)
|
||||||
/********* Generate a query to select messages received or sent **************/
|
/********* Generate a query to select messages received or sent **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
|
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,long UsrCod,
|
||||||
long FilterCrsCod,const char *FilterFromToSubquery)
|
long FilterCrsCod,const char *FilterFromToSubquery)
|
||||||
{
|
{
|
||||||
char SubQuery[Msg_MAX_LENGTH_MESSAGES_QUERY+1];
|
char SubQuery[Msg_MAX_LENGTH_MESSAGES_QUERY+1];
|
||||||
|
@ -1823,7 +1830,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOf
|
||||||
Query;
|
Query;
|
||||||
|
|
||||||
if (FilterCrsCod > 0) // If origin course selected
|
if (FilterCrsCod > 0) // If origin course selected
|
||||||
switch (TypeOfMessages)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
{
|
{
|
||||||
case Msg_MESSAGES_RECEIVED:
|
case Msg_MESSAGES_RECEIVED:
|
||||||
StrUnreadMsg = (Gbl.Msg.ShowOnlyUnreadMsgs ? " AND msg_rcv.Open='N'" :
|
StrUnreadMsg = (Gbl.Msg.ShowOnlyUnreadMsgs ? " AND msg_rcv.Open='N'" :
|
||||||
|
@ -1870,7 +1877,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOf
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else // If no origin course selected
|
else // If no origin course selected
|
||||||
switch (TypeOfMessages)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
{
|
{
|
||||||
case Msg_MESSAGES_RECEIVED:
|
case Msg_MESSAGES_RECEIVED:
|
||||||
if (FilterFromToSubquery[0])
|
if (FilterFromToSubquery[0])
|
||||||
|
@ -2256,8 +2263,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// Fill Gbl.Title
|
// Fill Gbl.Title
|
||||||
|
|
||||||
static char *Msg_WriteNumMsgs (Msg_TypeOfMessages_t TypeOfMessages,
|
static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs)
|
||||||
unsigned NumMsgs,unsigned NumUnreadMsgs)
|
|
||||||
{
|
{
|
||||||
extern const char *Txt_message_received;
|
extern const char *Txt_message_received;
|
||||||
extern const char *Txt_message_sent;
|
extern const char *Txt_message_sent;
|
||||||
|
@ -2266,45 +2272,74 @@ static char *Msg_WriteNumMsgs (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
extern const char *Txt_unread_MESSAGE;
|
extern const char *Txt_unread_MESSAGE;
|
||||||
extern const char *Txt_unread_MESSAGES;
|
extern const char *Txt_unread_MESSAGES;
|
||||||
|
|
||||||
if (TypeOfMessages == Msg_MESSAGES_RECEIVED)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
{
|
{
|
||||||
if (NumMsgs == 1)
|
case Msg_MESSAGES_RECEIVED:
|
||||||
{
|
if (Gbl.Msg.NumMsgs == 1)
|
||||||
if (NumUnreadMsgs)
|
{
|
||||||
sprintf (Gbl.Title,"1 %s, 1 %s",
|
if (NumUnreadMsgs)
|
||||||
Txt_message_received,Txt_unread_MESSAGE);
|
sprintf (Gbl.Title,"1 %s, 1 %s",
|
||||||
|
Txt_message_received,Txt_unread_MESSAGE);
|
||||||
|
else
|
||||||
|
sprintf (Gbl.Title,"1 %s",
|
||||||
|
Txt_message_received);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (NumUnreadMsgs == 0)
|
||||||
|
sprintf (Gbl.Title,"%u %s",
|
||||||
|
Gbl.Msg.NumMsgs,Txt_messages_received);
|
||||||
|
else if (NumUnreadMsgs == 1)
|
||||||
|
sprintf (Gbl.Title,"%u %s, 1 %s",
|
||||||
|
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||||
|
Txt_unread_MESSAGE);
|
||||||
|
else
|
||||||
|
sprintf (Gbl.Title,"%u %s, %u %s",
|
||||||
|
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||||
|
NumUnreadMsgs,Txt_unread_MESSAGES);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Msg_MESSAGES_SENT:
|
||||||
|
if (Gbl.Msg.NumMsgs == 1)
|
||||||
sprintf (Gbl.Title,"1 %s",
|
sprintf (Gbl.Title,"1 %s",
|
||||||
Txt_message_received);
|
Txt_message_sent);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (NumUnreadMsgs == 0)
|
|
||||||
sprintf (Gbl.Title,"%u %s",
|
|
||||||
NumMsgs,Txt_messages_received);
|
|
||||||
else if (NumUnreadMsgs == 1)
|
|
||||||
sprintf (Gbl.Title,"%u %s, 1 %s",
|
|
||||||
NumMsgs,Txt_messages_received,
|
|
||||||
Txt_unread_MESSAGE);
|
|
||||||
else
|
else
|
||||||
sprintf (Gbl.Title,"%u %s, %u %s",
|
sprintf (Gbl.Title,"%u %s",
|
||||||
NumMsgs,Txt_messages_received,
|
Gbl.Msg.NumMsgs,Txt_messages_sent);
|
||||||
NumUnreadMsgs,Txt_unread_MESSAGES);
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
else // TypeOfMessages == Msg_MESSAGES_SENT
|
|
||||||
{
|
|
||||||
if (NumMsgs == 1)
|
|
||||||
sprintf (Gbl.Title,"1 %s",
|
|
||||||
Txt_message_sent);
|
|
||||||
else
|
|
||||||
sprintf (Gbl.Title,"%u %s",
|
|
||||||
NumMsgs,Txt_messages_sent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Gbl.Title;
|
return Gbl.Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************** Put contextual icons in list of messages ******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Msg_PutIconsListMsgs (void)
|
||||||
|
{
|
||||||
|
/***** Put icons to remove messages *****/
|
||||||
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
|
{
|
||||||
|
case Msg_MESSAGES_RECEIVED:
|
||||||
|
if (Gbl.Msg.NumMsgs == 1)
|
||||||
|
Msg_PutIconToRemoveOneRcvMsg ();
|
||||||
|
else if (Gbl.Msg.NumMsgs > 1)
|
||||||
|
Msg_PutIconToRemoveSevRcvMsgs ();
|
||||||
|
break;
|
||||||
|
case Msg_MESSAGES_SENT:
|
||||||
|
if (Gbl.Msg.NumMsgs == 1)
|
||||||
|
Msg_PutIconToRemoveOneSntMsg ();
|
||||||
|
else if (Gbl.Msg.NumMsgs > 1)
|
||||||
|
Msg_PutIconToRemoveSevSntMsgs ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Put icon to show a figure *****/
|
||||||
|
Gbl.Stat.FigureType = Sta_MESSAGES;
|
||||||
|
Sta_PutIconToShowFigure ();
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************** Put icon to remove one received message *******************/
|
/***************** Put icon to remove one received message *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2381,7 +2416,7 @@ void Msg_PutHiddenParamsMsgsFilters (void)
|
||||||
/********************* Get dictinct courses in my messages *******************/
|
/********************* Get dictinct courses in my messages *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
void Msg_GetDistinctCoursesInMyMessages (void)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
|
@ -2390,7 +2425,7 @@ void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
struct Course Crs;
|
struct Course Crs;
|
||||||
|
|
||||||
/***** Get distinct courses in my messages from database *****/
|
/***** Get distinct courses in my messages from database *****/
|
||||||
switch (TypeOfMessages)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
{
|
{
|
||||||
case Msg_MESSAGES_RECEIVED:
|
case Msg_MESSAGES_RECEIVED:
|
||||||
sprintf (Query,"SELECT DISTINCT courses.CrsCod,courses.ShortName"
|
sprintf (Query,"SELECT DISTINCT courses.CrsCod,courses.ShortName"
|
||||||
|
@ -2440,13 +2475,18 @@ void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
/********* Show form to select course for sent or received messages **********/
|
/********* Show form to select course for sent or received messages **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages)
|
void Msg_ShowFormSelectCourseSentOrRecMsgs (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Messages_received_from_A_COURSE;
|
extern const char *Txt_Messages_received_from_A_COURSE;
|
||||||
extern const char *Txt_Messages_sent_from_A_COURSE;
|
extern const char *Txt_Messages_sent_from_A_COURSE;
|
||||||
extern const char *Txt_any_course;
|
extern const char *Txt_any_course;
|
||||||
unsigned NumOriginCrs;
|
unsigned NumOriginCrs;
|
||||||
|
const char *TxtSelector[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
|
{
|
||||||
|
Txt_Messages_received_from_A_COURSE,
|
||||||
|
Txt_Messages_sent_from_A_COURSE
|
||||||
|
};
|
||||||
|
|
||||||
/***** Course selection *****/
|
/***** Course selection *****/
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
|
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
|
||||||
|
@ -2454,8 +2494,7 @@ void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
"<select name=\"FilterCrsCod\">"
|
"<select name=\"FilterCrsCod\">"
|
||||||
"<option value=\"\"",
|
"<option value=\"\"",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
TypeOfMessages == Msg_MESSAGES_RECEIVED ? Txt_Messages_received_from_A_COURSE :
|
TxtSelector[Gbl.Msg.TypeOfMessages]);
|
||||||
Txt_Messages_sent_from_A_COURSE);
|
|
||||||
if (Gbl.Msg.FilterCrsCod < 0)
|
if (Gbl.Msg.FilterCrsCod < 0)
|
||||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||||
fprintf (Gbl.F.Out,">%s</option>",Txt_any_course);
|
fprintf (Gbl.F.Out,">%s</option>",Txt_any_course);
|
||||||
|
@ -2478,12 +2517,17 @@ void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
/***** Show form to filter "from" and "to" for received or sent messages *****/
|
/***** Show form to filter "from" and "to" for received or sent messages *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Msg_ShowFormToFilterMsgs (Msg_TypeOfMessages_t TypeOfMessages)
|
void Msg_ShowFormToFilterMsgs (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_MSG_From;
|
extern const char *Txt_MSG_From;
|
||||||
extern const char *Txt_MSG_To;
|
extern const char *Txt_MSG_To;
|
||||||
extern const char *Txt_MSG_Message;
|
extern const char *Txt_MSG_Message;
|
||||||
|
const char *TxtFromTo[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
|
{
|
||||||
|
Txt_MSG_From,
|
||||||
|
Txt_MSG_To
|
||||||
|
};
|
||||||
|
|
||||||
/***** Table start *****/
|
/***** Table start *****/
|
||||||
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto;\">");
|
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto;\">");
|
||||||
|
@ -2501,8 +2545,7 @@ void Msg_ShowFormToFilterMsgs (Msg_TypeOfMessages_t TypeOfMessages)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
TypeOfMessages == Msg_MESSAGES_RECEIVED ? Txt_MSG_From :
|
TxtFromTo[Gbl.Msg.TypeOfMessages],
|
||||||
Txt_MSG_To,
|
|
||||||
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME*3,Gbl.Msg.FilterFromTo);
|
Usr_MAX_LENGTH_USR_NAME_OR_SURNAME*3,Gbl.Msg.FilterFromTo);
|
||||||
|
|
||||||
/***** Authors/recipients of the message *****/
|
/***** Authors/recipients of the message *****/
|
||||||
|
@ -2745,7 +2788,7 @@ static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,boo
|
||||||
/******** Show a sent or a received message (from a user to another) *********/
|
/******** Show a sent or a received message (from a user to another) *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,long MsgNum,long MsgCod)
|
static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
|
||||||
{
|
{
|
||||||
extern const char *Txt_MSG_Replied;
|
extern const char *Txt_MSG_Replied;
|
||||||
extern const char *Txt_MSG_Not_replied;
|
extern const char *Txt_MSG_Not_replied;
|
||||||
|
@ -2772,7 +2815,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
|
|
||||||
/***** Get data of message *****/
|
/***** Get data of message *****/
|
||||||
Msg_GetMsgSntData (MsgCod,&CrsCod,&UsrDat.UsrCod,&CreatTimeUTC,Subject,&Deleted);
|
Msg_GetMsgSntData (MsgCod,&CrsCod,&UsrDat.UsrCod,&CreatTimeUTC,Subject,&Deleted);
|
||||||
switch (TypeOfMessages)
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
{
|
{
|
||||||
case Msg_MESSAGES_RECEIVED:
|
case Msg_MESSAGES_RECEIVED:
|
||||||
Msg_GetStatusOfReceivedMsg (MsgCod,&Open,&Replied,&Expanded);
|
Msg_GetStatusOfReceivedMsg (MsgCod,&Open,&Replied,&Expanded);
|
||||||
|
@ -2780,34 +2823,40 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
case Msg_MESSAGES_SENT:
|
case Msg_MESSAGES_SENT:
|
||||||
Msg_GetStatusOfSentMsg (MsgCod,&Expanded);
|
Msg_GetStatusOfSentMsg (MsgCod,&Expanded);
|
||||||
break;
|
break;
|
||||||
default: // Not aplicable here
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Put an icon with message status *****/
|
/***** Put an icon with message status *****/
|
||||||
Title = TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Open ? (Replied ? Txt_MSG_Replied :
|
switch (Gbl.Msg.TypeOfMessages)
|
||||||
Txt_MSG_Not_replied) :
|
{
|
||||||
Txt_MSG_Unopened) :
|
case Msg_MESSAGES_RECEIVED:
|
||||||
Txt_MSG_Sent;
|
Title = (Open ? (Replied ? Txt_MSG_Replied :
|
||||||
|
Txt_MSG_Not_replied) :
|
||||||
|
Txt_MSG_Unopened);
|
||||||
|
break;
|
||||||
|
case Msg_MESSAGES_SENT:
|
||||||
|
Title = Txt_MSG_Sent;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"%s CENTER_TOP\" style=\"width:20px;\">"
|
"<td class=\"%s CENTER_TOP\" style=\"width:20px;\">"
|
||||||
"<img src=\"%s/msg-%s16x16.gif\""
|
"<img src=\"%s/msg-%s16x16.gif\""
|
||||||
" alt=\"%s\" title=\"%s\""
|
" alt=\"%s\" title=\"%s\""
|
||||||
" class=\"ICON20x20\" />",
|
" class=\"ICON20x20\" />",
|
||||||
TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Open ? "BG_MSG_BLUE" :
|
Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Open ? "BG_MSG_BLUE" :
|
||||||
"BG_MSG_GREEN") :
|
"BG_MSG_GREEN") :
|
||||||
"BG_MSG_BLUE",
|
"BG_MSG_BLUE",
|
||||||
|
|
||||||
Gbl.Prefs.IconsURL,
|
Gbl.Prefs.IconsURL,
|
||||||
TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Open ? (Replied ? "replied" :
|
Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Open ? (Replied ? "replied" :
|
||||||
"open") :
|
"open") :
|
||||||
"unread") :
|
"unread") :
|
||||||
"fwd",
|
"fwd",
|
||||||
Title,Title);
|
Title,Title);
|
||||||
|
|
||||||
/***** Form to delete message *****/
|
/***** Form to delete message *****/
|
||||||
fprintf (Gbl.F.Out,"<br />");
|
fprintf (Gbl.F.Out,"<br />");
|
||||||
Msg_PutFormToDeleteMessage (MsgCod,TypeOfMessages);
|
Msg_PutFormToDeleteMessage (MsgCod);
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/***** Write message number *****/
|
/***** Write message number *****/
|
||||||
|
@ -2821,7 +2870,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
true,NULL);
|
true,NULL);
|
||||||
|
|
||||||
/***** Write subject *****/
|
/***** Write subject *****/
|
||||||
Msg_WriteSentOrReceivedMsgSubject (TypeOfMessages,MsgCod,Subject,Open,Expanded);
|
Msg_WriteSentOrReceivedMsgSubject (MsgCod,Subject,Open,Expanded);
|
||||||
|
|
||||||
/***** Write date-time *****/
|
/***** Write date-time *****/
|
||||||
Msg_WriteMsgDate (CreatTimeUTC,Open ? "MSG_TIT_BG" :
|
Msg_WriteMsgDate (CreatTimeUTC,Open ? "MSG_TIT_BG" :
|
||||||
|
@ -2845,7 +2894,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
/***** Form to reply message *****/
|
/***** Form to reply message *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"LEFT_MIDDLE\">");
|
"<td class=\"LEFT_MIDDLE\">");
|
||||||
if (TypeOfMessages == Msg_MESSAGES_RECEIVED &&
|
if (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED &&
|
||||||
Gbl.Usrs.Me.LoggedRole >= Rol_VISITOR)
|
Gbl.Usrs.Me.LoggedRole >= Rol_VISITOR)
|
||||||
// Guests (users without courses) can read messages but not reply them
|
// Guests (users without courses) can read messages but not reply them
|
||||||
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
|
Msg_WriteFormToReply (MsgCod,CrsCod,FromThisCrs,Replied,&UsrDat);
|
||||||
|
@ -2875,7 +2924,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td colspan=\"2\" class=\"LEFT_TOP\">",
|
"<td colspan=\"2\" class=\"LEFT_TOP\">",
|
||||||
Txt_MSG_To);
|
Txt_MSG_To);
|
||||||
Msg_WriteMsgTo (TypeOfMessages,MsgCod);
|
Msg_WriteMsgTo (MsgCod);
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
fprintf (Gbl.F.Out,"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
|
@ -2972,7 +3021,7 @@ void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg)
|
||||||
/******************** Write subject of a received message ********************/
|
/******************** Write subject of a received message ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod,const char *Subject,bool Open,bool Expanded)
|
static void Msg_WriteSentOrReceivedMsgSubject (long MsgCod,const char *Subject,bool Open,bool Expanded)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Hide_message;
|
extern const char *Txt_Hide_message;
|
||||||
extern const char *Txt_See_message;
|
extern const char *Txt_See_message;
|
||||||
|
@ -2984,10 +3033,10 @@ static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessag
|
||||||
"MSG_TIT_BG_NEW");
|
"MSG_TIT_BG_NEW");
|
||||||
|
|
||||||
/***** Start form to expand/contract the message *****/
|
/***** Start form to expand/contract the message *****/
|
||||||
Act_FormStart (TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Expanded ? ActConRcvMsg :
|
Act_FormStart (Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED ? (Expanded ? ActConRcvMsg :
|
||||||
ActExpRcvMsg) :
|
ActExpRcvMsg) :
|
||||||
(Expanded ? ActConSntMsg :
|
(Expanded ? ActConSntMsg :
|
||||||
ActExpSntMsg));
|
ActExpSntMsg));
|
||||||
Msg_PutHiddenParamsMsgsFilters ();
|
Msg_PutHiddenParamsMsgsFilters ();
|
||||||
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
||||||
Msg_PutHiddenParamMsgCod (MsgCod);
|
Msg_PutHiddenParamMsgCod (MsgCod);
|
||||||
|
@ -3235,7 +3284,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted)
|
||||||
#define Msg_MAX_RECIPIENTS_TO_SHOW 10 // If number of recipients <= Msg_MAX_RECIPIENTS_TO_SHOW, show all recipients
|
#define Msg_MAX_RECIPIENTS_TO_SHOW 10 // If number of recipients <= Msg_MAX_RECIPIENTS_TO_SHOW, show all recipients
|
||||||
#define Msg_DEF_RECIPIENTS_TO_SHOW 5 // If number of recipients > Msg_MAX_RECIPIENTS_TO_SHOW, show only Msg_DEF_RECIPIENTS_TO_SHOW
|
#define Msg_DEF_RECIPIENTS_TO_SHOW 5 // If number of recipients > Msg_MAX_RECIPIENTS_TO_SHOW, show only Msg_DEF_RECIPIENTS_TO_SHOW
|
||||||
|
|
||||||
static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod)
|
static void Msg_WriteMsgTo (long MsgCod)
|
||||||
{
|
{
|
||||||
extern const char *Txt_MSG_Open_and_deleted;
|
extern const char *Txt_MSG_Open_and_deleted;
|
||||||
extern const char *Txt_MSG_Open;
|
extern const char *Txt_MSG_Open;
|
||||||
|
@ -3263,6 +3312,11 @@ static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod)
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
const char *Title;
|
const char *Title;
|
||||||
char PhotoURL[PATH_MAX+1];
|
char PhotoURL[PATH_MAX+1];
|
||||||
|
static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
|
{
|
||||||
|
ActSeeRcvMsg,
|
||||||
|
ActSeeSntMsg
|
||||||
|
};
|
||||||
|
|
||||||
/***** Get number of recipients of a message from database *****/
|
/***** Get number of recipients of a message from database *****/
|
||||||
sprintf (Query,"SELECT "
|
sprintf (Query,"SELECT "
|
||||||
|
@ -3382,8 +3436,7 @@ static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod)
|
||||||
/***** Start form to show all the users *****/
|
/***** Start form to show all the users *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td colspan=\"3\" class=\"MSG_AUT LEFT_MIDDLE\">");
|
"<td colspan=\"3\" class=\"MSG_AUT LEFT_MIDDLE\">");
|
||||||
Act_FormStart (TypeOfMessages == Msg_MESSAGES_RECEIVED ? ActSeeRcvMsg :
|
Act_FormStart (ActionSee[Gbl.Msg.TypeOfMessages]);
|
||||||
ActSeeSntMsg);
|
|
||||||
Msg_PutHiddenParamsMsgsFilters ();
|
Msg_PutHiddenParamsMsgsFilters ();
|
||||||
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
||||||
Msg_PutHiddenParamMsgCod (MsgCod);
|
Msg_PutHiddenParamMsgCod (MsgCod);
|
||||||
|
@ -3439,10 +3492,15 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground)
|
||||||
/************* Put a form to delete a received or sent message ***************/
|
/************* Put a form to delete a received or sent message ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Msg_PutFormToDeleteMessage (long MsgCod,Msg_TypeOfMessages_t TypeOfMessages)
|
static void Msg_PutFormToDeleteMessage (long MsgCod)
|
||||||
{
|
{
|
||||||
Act_FormStart (TypeOfMessages == Msg_MESSAGES_RECEIVED ? ActDelRcvMsg :
|
static const Act_Action_t ActionDel[Msg_NUM_TYPES_OF_MSGS] =
|
||||||
ActDelSntMsg);
|
{
|
||||||
|
ActDelRcvMsg,
|
||||||
|
ActDelSntMsg
|
||||||
|
};
|
||||||
|
|
||||||
|
Act_FormStart (ActionDel[Gbl.Msg.TypeOfMessages]);
|
||||||
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
|
||||||
Msg_PutHiddenParamMsgCod (MsgCod);
|
Msg_PutHiddenParamMsgCod (MsgCod);
|
||||||
Msg_PutHiddenParamsMsgsFilters ();
|
Msg_PutHiddenParamsMsgsFilters ();
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define Msg_NUM_TYPES_OF_MSGS 2
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Msg_MESSAGES_RECEIVED,
|
Msg_MESSAGES_RECEIVED,
|
||||||
|
@ -89,9 +90,9 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus);
|
||||||
unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus);
|
unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus);
|
||||||
|
|
||||||
void Msg_PutHiddenParamsMsgsFilters (void);
|
void Msg_PutHiddenParamsMsgsFilters (void);
|
||||||
void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages);
|
void Msg_GetDistinctCoursesInMyMessages (void);
|
||||||
void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages);
|
void Msg_ShowFormSelectCourseSentOrRecMsgs (void);
|
||||||
void Msg_ShowFormToFilterMsgs (Msg_TypeOfMessages_t TypeOfMessages);
|
void Msg_ShowFormToFilterMsgs (void);
|
||||||
void Msg_GetMsgSubject (long MsgCod,char *Subject);
|
void Msg_GetMsgSubject (long MsgCod,char *Subject);
|
||||||
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,
|
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,
|
||||||
unsigned MaxChars,bool GetContent);
|
unsigned MaxChars,bool GetContent);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user