Version 15.72

This commit is contained in:
Antonio Cañas Vargas 2015-12-22 13:22:35 +01:00
parent a207626ade
commit 025de82e83
7 changed files with 73 additions and 35 deletions

View File

@ -109,7 +109,6 @@
// TODO: By default, profile and photo should be visible by users who share course
// TODO: When page is refreshed in course works, prevent users to be duplicated
// TODO: Fix bug at the end of ranking (number too low) when a course is selected
// TODO: Reply to one user, suggested by Francisco Ocaña Lara
// TODO: Reply to all
// TODO: Reply icons should appear without text
// TODO: Link to remove messages is too wide. For example: "Remove these X messages".
@ -118,12 +117,13 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.71.3 (2015-12-22)"
#define Log_PLATFORM_VERSION "SWAD 15.72 (2015-12-22)"
#define CSS_FILE "swad15.65.1.css"
// 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 15.72: Dec 22, 2015 Reply message only to sender, suggested by Francisco Ocaña Lara. Not finished. (187705 lines)
Version 15.71.3: Dec 22, 2015 Changes in birthday range of years. (187669 lines)
Version 15.71.2: Dec 21, 2015 Fixed bugs in removing old files in briefcase. (187666 lines)
Version 15.71.1: Dec 21, 2015 Fixed bugs in removing old files in briefcase. (187665 lines)

View File

@ -580,9 +580,13 @@ struct Globals
char FilterFromTo[Usr_MAX_LENGTH_USR_NAME_OR_SURNAME*3+1]; // Show only messages from/to these users
char FilterContent[Msg_MAX_LENGTH_FILTER_CONTENT+1]; // Show only messages that match this content
bool ShowOnlyUnreadMsgs; // Show only unread messages (this option is applicable only for received messages)
bool IsReply; // Is the message I am editing a reply to a received message?
long RepliedMsgCod; // Original message code when I am editing a reply to a received message
long ExpandedMsgCod; // The current expanded message code
struct
{
bool IsReply; // Is the message I am editing a reply?
bool ShowOtherRecipients; // Shown other recipients or only the sender of the original message?
long OriginalMsgCod; // Original message code when I am editing a reply
} Reply;
char FileNameMail[PATH_MAX+1];
FILE *FileMail;
} Msg;

View File

@ -80,6 +80,7 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
static void Msg_GetStatusOfSentMsg (long MsgCod,bool *Expanded);
static void Msg_GetStatusOfReceivedMsg (long MsgCod,bool *Open,bool *Replied,bool *Expanded);
static long Msg_GetParamMsgCod (void);
static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void);
static void Msg_WriteFormSubjectAndContentMsgToUsrs (const char *Content);
static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs);
@ -259,6 +260,7 @@ void Msg_FormMsgUsrs (void)
static void Msg_PutFormMsgUsrs (const char *Content)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Reply_message;
extern const char *Txt_New_message;
extern const char *Txt_MSG_To;
extern const char *Txt_Send_message;
@ -269,9 +271,17 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/***** Get parameter that indicates if the message is a reply to another message *****/
Par_GetParToText ("IsReply",YN,1);
if ((Gbl.Msg.IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
if ((Gbl.Msg.Reply.IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
{
/* Get original message code */
Gbl.Msg.RepliedMsgCod = Msg_GetParamMsgCod ();
Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod ();
/* Get who to show as potential recipients:
- the sender of the original message and other users
- only the sender of the original message (default) */
Par_GetParToText ("ShowOtherRecipients",YN,1);
Gbl.Msg.Reply.ShowOtherRecipients = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
}
/***** Get user's code of possible preselected recipient *****/
Usr_GetParamOtherUsrCodEncrypted ();
@ -305,7 +315,8 @@ static void Msg_PutFormMsgUsrs (const char *Content)
Gbl.Usrs.LstStds.NumUsrs))
{
/***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_New_message);
Lay_StartRoundFrame (NULL,Gbl.Msg.Reply.IsReply ? Txt_Reply_message :
Txt_New_message);
/***** Form to select type of list used for select several users *****/
if (Gbl.Usrs.LstTchs.NumUsrs ||
@ -314,10 +325,11 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/***** Start form to select recipients and write the message *****/
Act_FormStart (ActRcvMsgUsr);
if (Gbl.Msg.IsReply)
if (Gbl.Msg.Reply.IsReply)
{
Par_PutHiddenParamChar ("IsReply",'Y');
Msg_PutHiddenParamMsgCod (Gbl.Msg.RepliedMsgCod);
// Par_PutHiddenParamChar ("ShowOtherRecipients",'N');
Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod);
Usr_PutParamOtherUsrCodEncrypted ();
}
@ -338,7 +350,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
Usr_ListUsersToSelect (Rol_STUDENT);
/* Other users (nicknames) */
Msg_WriteFormUsrsIDsOrNicksOtherRecipients (Gbl.Msg.IsReply);
Msg_WriteFormUsrsIDsOrNicksOtherRecipients ();
/* End of table */
fprintf (Gbl.F.Out,"</table>"
@ -384,7 +396,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/************** Nicknames of recipients of a message to users ****************/
/*****************************************************************************/
void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
{
extern const char *Txt_Other_recipients;
extern const char *Txt_Recipients;
@ -415,9 +427,9 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
"<textarea name=\"OtherRecipients\" cols=\"72\" rows=\"2\">");
if (Gbl.Usrs.ListOtherRecipients[0])
fprintf (Gbl.F.Out,"%s",Gbl.Usrs.ListOtherRecipients);
else if (IsReply) // If this is a reply message
// and there's no list of explicit recipients,
// write @nickname of original sender
else if (Gbl.Msg.Reply.IsReply) // If this is a reply message
// and there's no list of explicit recipients,
// write @nickname of original sender
if (Nck_GetNicknameFromUsrCod (Gbl.Usrs.Other.UsrDat.UsrCod,Nickname))
fprintf (Gbl.F.Out,"@%s",Nickname);
fprintf (Gbl.F.Out,"</textarea>"
@ -560,14 +572,14 @@ void Msg_RecMsgFromUsr (void)
bool IsReply;
bool RecipientHasBannedMe;
bool Replied = false;
long RepliedMsgCod = -1; // Initialized to avoid warning
long OriginalMsgCod = -1L; // Initialized to avoid warning
const char *Ptr;
unsigned NumRecipients;
unsigned NumRecipientsToBeNotifiedByEMail = 0;
struct UsrData UsrDstData;
int NumErrors = 0;
char *ListUsrsDst;
long NewMsgCod = -1; // Initiliazed to avoid warning
long NewMsgCod = -1L; // Initiliazed to avoid warning
bool MsgAlreadyInserted = false;
bool CreateNotif;
bool NotifyByEmail;
@ -586,7 +598,7 @@ void Msg_RecMsgFromUsr (void)
Par_GetParToText ("IsReply",YN,1);
if ((IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
/* Get original message code */
RepliedMsgCod = Msg_GetParamMsgCod ();
OriginalMsgCod = Msg_GetParamMsgCod ();
/* Get user's code of possible preselected recipient */
Usr_GetParamOtherUsrCodEncrypted ();
@ -667,7 +679,8 @@ void Msg_RecMsgFromUsr (void)
}
/***** If this recipient is the original sender of a message been replied, set Replied to true *****/
Replied = (IsReply && UsrDstData.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
Replied = (IsReply &&
UsrDstData.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
/***** This received message must be notified by e-mail? *****/
CreateNotif = (UsrDstData.Prefs.NotifNtfEvents & (1 << Ntf_EVENT_MESSAGE));
@ -718,7 +731,7 @@ void Msg_RecMsgFromUsr (void)
/***** Update received message setting Replied field to true *****/
if (Replied)
Msg_SetReceivedMsgAsReplied (RepliedMsgCod);
Msg_SetReceivedMsgAsReplied (OriginalMsgCod);
/***** Write final message *****/
if (NumRecipients)
@ -2994,9 +3007,9 @@ static void Msg_WriteFormToReply (long MsgCod,long CrsCod,const char *Subject,
}
Grp_PutParamAllGroups ();
Par_PutHiddenParamChar ("IsReply",'Y');
// Par_PutHiddenParamChar ("ShowOtherRecipients",'N');
Msg_PutHiddenParamMsgCod (MsgCod);
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
// Par_PutHiddenParamString ("UsrCodAll",EncryptedUsrCod);
fprintf (Gbl.F.Out,"<input type=\"hidden\" name=\"Subject\""
" value=\"Re: %s\" />",
Subject);

View File

@ -59,7 +59,6 @@ typedef enum
void Msg_ListEMails (void); // Creates an e-mail message to students
void Msg_FormMsgUsrs (void);
void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply);
void Msg_PutHiddenParamAnotherRecipient (const struct UsrData *UsrDat);
void Msg_PutHiddenParamOtherRecipients (void);
void Msg_RecMsgFromUsr (void);

View File

@ -22598,7 +22598,7 @@ const char *Txt_New_mail_domain =
const char *Txt_New_message =
#if L==1
"Nuevo mensaje"; // Necessita traduccio
"Nou missatge";
#elif L==2
"Neue Nachricht";
#elif L==3
@ -29497,7 +29497,7 @@ const char *Txt_Remove_USER_from_the_course_X = // Warning: it is very important
const char *Txt_Reply =
#if L==1
"Responder"; // Necessita traduccio
"Respondre";
#elif L==2
"Antworten";
#elif L==3
@ -29518,7 +29518,7 @@ const char *Txt_Reply =
const char *Txt_Reply_again =
#if L==1
"Responder otra vez"; // Necessita traduccio
"Respondre de nou";
#elif L==2
"Antworten wieder";
#elif L==3
@ -29537,6 +29537,27 @@ const char *Txt_Reply_again =
"Responder novamente";
#endif
const char *Txt_Reply_message = // "Reply" as a noun, not as a verb
#if L==1
"Missatge de resposta";
#elif L==2
"Antwortnachricht";
#elif L==3
"Reply message";
#elif L==4
"Mensaje de respuesta";
#elif L==5
"Message de r&eacute;ponse";
#elif L==6
"Mensaje de respuesta"; // Okoteve traducción
#elif L==7
"Messaggio di risposta";
#elif L==8
"Wiadomo&sacute;&cacute; odpowiedz";
#elif L==9
"Mensagem de resposta";
#endif
const char *Txt_Requester =
#if L==1
"Sol&middot;licitant";
@ -29560,7 +29581,7 @@ const char *Txt_Requester =
const char *Txt_Reset =
#if L==1
"Poner a cero"; // Necessita traduccio
"Posar a zero";
#elif L==2
"Reset";
#elif L==3
@ -29581,7 +29602,7 @@ const char *Txt_Reset =
const char *Txt_Reset_survey =
#if L==1
"Poner encuesta a cero"; // Necessita traduccio
"Posar enquesta a zero";
#elif L==2
"Reset Umfrage";
#elif L==3
@ -29602,15 +29623,15 @@ const char *Txt_Reset_survey =
const char *Txt_results_per_page =
#if L==1
"resultados por p&aacute;gina"; // Necessita traduccio
"resultats per p&agrave;gina";
#elif L==2
"results per page"; // Need Übersetzung
"Ergebnisse pro Seite";
#elif L==3
"results per page";
#elif L==4
"resultados por p&aacute;gina";
#elif L==5
"results per page"; // Besoin de traduction
"r&eacute;sultats par page";
#elif L==6
"resultados por p&aacute;gina"; // Okoteve traducción
#elif L==7
@ -29618,7 +29639,7 @@ const char *Txt_results_per_page =
#elif L==8
"wynik&oacute;w na stronie";
#elif L==9
"results per page"; // Necessita de tradução
"resultados por p&aacute;gina";
#endif
const char *Txt_Results_tests =

View File

@ -5022,10 +5022,11 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction)
case ActReqMsgUsr:
Usr_PutHiddenParUsrCodAll (NextAction,Gbl.Usrs.Select.All);
Msg_PutHiddenParamOtherRecipients ();
if (Gbl.Msg.IsReply)
if (Gbl.Msg.Reply.IsReply)
{
Par_PutHiddenParamChar ("IsReply",'Y');
Msg_PutHiddenParamMsgCod (Gbl.Msg.RepliedMsgCod);
// Par_PutHiddenParamChar ("ShowOtherRecipients",'N');
Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod);
Usr_PutParamOtherUsrCodEncrypted ();
}
break;

View File

@ -186,7 +186,7 @@ static void Svc_GetListGrpsInAttendanceEvent (long AttCod,char **ListGroups);
static int Svc_GetMyLanguage (void);
static int Svc_sendMessageToUsr (long RepliedMsgCod,long SenderUsrCod,long ReplyUsrCod,long RecipientUsrCod,bool NotifyByEmail,const char *Subject,const char *Content);
static int Svc_sendMessageToUsr (long OriginalMsgCod,long SenderUsrCod,long ReplyUsrCod,long RecipientUsrCod,bool NotifyByEmail,const char *Subject,const char *Content);
static int Svc_GetTstConfig (long CrsCod);
static int Svc_GetNumTestQuestionsInCrs (long CrsCod);
@ -3007,7 +3007,7 @@ int swad__sendMessage (struct soap *soap,
/************************* Send a message to one user ************************/
/*****************************************************************************/
static int Svc_sendMessageToUsr (long RepliedMsgCod,long SenderUsrCod,long ReplyUsrCod,long RecipientUsrCod,bool NotifyByEmail,const char *Subject,const char *Content)
static int Svc_sendMessageToUsr (long OriginalMsgCod,long SenderUsrCod,long ReplyUsrCod,long RecipientUsrCod,bool NotifyByEmail,const char *Subject,const char *Content)
{
static bool MsgAlreadyInserted = false;
static long NewMsgCod;
@ -3058,7 +3058,7 @@ static int Svc_sendMessageToUsr (long RepliedMsgCod,long SenderUsrCod,long Reply
{
/***** ...then update received message setting Replied field to true *****/
sprintf (Query,"UPDATE msg_rcv SET Replied='Y' WHERE MsgCod='%ld' AND UsrCod='%ld'",
RepliedMsgCod,SenderUsrCod);
OriginalMsgCod,SenderUsrCod);
DB_QueryUPDATE (Query,"can not update a received message");
}