From 05e90007791c1d94de7f3063f25f76cff49ff082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 30 Jun 2016 21:05:06 +0200 Subject: [PATCH] Version 15.236 --- swad_changelog.h | 5 ++-- swad_message.c | 70 +++++++++++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a882c2d85..219736736 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -133,13 +133,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.235.1 (2016-06-30)" +#define Log_PLATFORM_VERSION "SWAD 15.236 (2016-06-30)" #define CSS_FILE "swad15.229.css" -#define JS_FILE "swad15.226.js" +#define JS_FILE "swad15.236.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.236: Jun 30, 2015 The form "Show more recipients" now have a hidden field with the subject. (204343 lines) Version 15.235.1: Jun 30, 2015 Minor change in icon to download files. (203206 lines) Copy icons icon/download64x64.png diff --git a/swad_message.c b/swad_message.c index 8c006d199..2b29903a6 100644 --- a/swad_message.c +++ b/swad_message.c @@ -297,7 +297,8 @@ static void Msg_PutFormMsgUsrs (const char *Content) Par_GetParToText ("IsReply",YN,1); if ((Gbl.Msg.Reply.IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y'))) /* Get original message code */ - Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod (); + if ((Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Get user's code of possible preselected recipient *****/ if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // There is a preselected recipient @@ -474,6 +475,9 @@ static void Msg_PutParamsShowMorePotentialRecipients (void) } if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) Usr_PutParamOtherUsrCodEncrypted (); + + fprintf (Gbl.F.Out,""); } /*****************************************************************************/ @@ -573,24 +577,29 @@ static void Msg_WriteFormSubjectAndContentMsgToUsrs (const char *Content) MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRows; - char LongStr[1+10+1]; - long MsgCod = -1; + long MsgCod; char OriginalTxt[Cns_MAX_BYTES_LONG_TEXT+1]; + /***** Get possible code (of original message if it's a reply) *****/ + MsgCod = Msg_GetParamMsgCod (); + + /***** Get possible subject *****/ + Par_GetParToHTML ("Subject",Gbl.Msg.Subject,Cns_MAX_BYTES_SUBJECT); + /***** Subject of new message *****/ fprintf (Gbl.F.Out,"" "" "%s: " "" "" - "" + + /***** Subject of new message *****/ + if (Gbl.Msg.Subject[0]) // Subject comes from form + fprintf (Gbl.F.Out,"%s",Gbl.Msg.Subject); + else // Subject comes from database + fprintf (Gbl.F.Out,"Re: %s",row[0]); + fprintf (Gbl.F.Out,"" "" - "", - row[0]); + ""); /***** Content of new message *****/ fprintf (Gbl.F.Out,"" @@ -710,10 +723,10 @@ void Msg_RecMsgFromUsr (void) bool Error = false; /***** Get data from form *****/ - /* Get the subject of the message */ + /* Get subject */ Par_GetParToHTML ("Subject",Gbl.Msg.Subject,Cns_MAX_BYTES_SUBJECT); - /* Get the body of the message */ + /* Get body */ Par_GetParAndChangeFormat ("Content",Content,Cns_MAX_BYTES_LONG_TEXT, Str_DONT_CHANGE,false); @@ -721,7 +734,8 @@ void Msg_RecMsgFromUsr (void) Par_GetParToText ("IsReply",YN,1); if ((IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y'))) /* Get original message code */ - OriginalMsgCod = Msg_GetParamMsgCod (); + if ((OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /* Get user's code of possible preselected recipient */ Usr_GetParamOtherUsrCodEncryptedAndGetListIDs (); @@ -1137,7 +1151,8 @@ void Msg_DelSntMsg (void) long MsgCod; /***** Get the code of the message to delete *****/ - MsgCod = Msg_GetParamMsgCod (); + if ((MsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Delete the message *****/ /* Delete the sent message */ @@ -1158,7 +1173,8 @@ void Msg_DelRecMsg (void) long MsgCod; /***** Get the code of the message to delete *****/ - MsgCod = Msg_GetParamMsgCod (); + if ((MsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Delete the message *****/ /* Delete the received message */ @@ -1176,7 +1192,8 @@ void Msg_DelRecMsg (void) void Msg_ExpSntMsg (void) { /***** Get the code of the message to expand *****/ - Gbl.Msg.ExpandedMsgCod = Msg_GetParamMsgCod (); + if ((Gbl.Msg.ExpandedMsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Expand the message *****/ Msg_ExpandSentMsg (Gbl.Msg.ExpandedMsgCod); @@ -1192,7 +1209,8 @@ void Msg_ExpSntMsg (void) void Msg_ExpRecMsg (void) { /***** Get the code of the message to expand *****/ - Gbl.Msg.ExpandedMsgCod = Msg_GetParamMsgCod (); + if ((Gbl.Msg.ExpandedMsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Expand the message *****/ Msg_ExpandReceivedMsg (Gbl.Msg.ExpandedMsgCod); @@ -1215,7 +1233,8 @@ void Msg_ConSntMsg (void) long MsgCod; /***** Get the code of the message to contract *****/ - MsgCod = Msg_GetParamMsgCod (); + if ((MsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Contract the message *****/ Msg_ContractSentMsg (MsgCod); @@ -1233,7 +1252,8 @@ void Msg_ConRecMsg (void) long MsgCod; /***** Get the code of the message to contract *****/ - MsgCod = Msg_GetParamMsgCod (); + if ((MsgCod = Msg_GetParamMsgCod ()) <= 0) + Lay_ShowErrorAndExit ("Wrong code of message."); /***** Contract the message *****/ Msg_ContractReceivedMsg (MsgCod); @@ -3548,15 +3568,11 @@ void Msg_PutHiddenParamMsgCod (long MsgCod) static long Msg_GetParamMsgCod (void) { - char LongStr[1+10+1]; // String that holds the message code - long MsgCod; + char LongStr[1+10+1]; - /* Get message code */ + /***** Get parameter with code of message *****/ Par_GetParToText ("MsgCod",LongStr,1+10); - if (sscanf (LongStr,"%ld",&MsgCod) != 1) - Lay_ShowErrorAndExit ("Wrong code of message."); - - return MsgCod; + return Str_ConvertStrCodToLongCod (LongStr); } /*****************************************************************************/