From 3814579155727cba06abc5e78cbcf852098d5f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 22 Dec 2015 14:00:36 +0100 Subject: [PATCH] Version 15.72.1 --- swad_changelog.h | 3 ++- swad_global.h | 2 +- swad_message.c | 63 +++++++++++++++++++++++++++++++----------------- swad_record.c | 1 + swad_user.c | 2 +- 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a53ba6fe1..7bd748c1f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -117,12 +117,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.72 (2015-12-22)" +#define Log_PLATFORM_VERSION "SWAD 15.72.1 (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.1: Dec 22, 2015 Write message only to one recipient. Not finished. (187724 lines) 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) diff --git a/swad_global.h b/swad_global.h index 76dd13556..c68808cc2 100644 --- a/swad_global.h +++ b/swad_global.h @@ -584,9 +584,9 @@ struct Globals 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; + bool ShowOnlyOneRecipient; // Shown only a selected recipient or also other potential recipients? char FileNameMail[PATH_MAX+1]; FILE *FileMail; } Msg; diff --git a/swad_message.c b/swad_message.c index 953b4ccc3..7e29c2b7d 100644 --- a/swad_message.c +++ b/swad_message.c @@ -272,19 +272,19 @@ 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.Reply.IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y'))) - { /* Get original message code */ 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 (); + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // There is a preselected recipient + { + /* Get who to show as potential recipients: + - only the selected recipient + - any user (default) */ + Par_GetParToText ("ShowOnlyOneRecipient",YN,1); + Gbl.Msg.ShowOnlyOneRecipient = (Str_ConvertToUpperLetter (YN[0]) == 'Y'); + } /***** Get list of users' IDs or nicknames written explicitely *****/ Usr_GetListMsgRecipientsWrittenExplicitelyBySender (false); @@ -328,29 +328,46 @@ static void Msg_PutFormMsgUsrs (const char *Content) if (Gbl.Msg.Reply.IsReply) { Par_PutHiddenParamChar ("IsReply",'Y'); - // Par_PutHiddenParamChar ("ShowOtherRecipients",'N'); Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod); Usr_PutParamOtherUsrCodEncrypted (); + Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); } - /***** Draw lists of users with the recipients *****/ - fprintf (Gbl.F.Out,"" - "" + /***** Start table *****/ + fprintf (Gbl.F.Out,"
"); + + /***** To (recipients) *****/ + fprintf (Gbl.F.Out,"" "" "" - "" - "
" "%s:" "" - "", + "
", The_ClassForm[Gbl.Prefs.Theme],Txt_MSG_To); + if (Gbl.Msg.ShowOnlyOneRecipient) + { + fprintf (Gbl.F.Out,"" + "" + ""); + } + else + { + /***** Show potential recipients *****/ + /* Teachers */ + Usr_ListUsersToSelect (Rol_TEACHER); - /* Other users (nicknames) */ - Msg_WriteFormUsrsIDsOrNicksOtherRecipients (); + /* Students */ + Usr_ListUsersToSelect (Rol_STUDENT); + + /* Other users (nicknames) */ + Msg_WriteFormUsrsIDsOrNicksOtherRecipients (); + } /* End of table */ fprintf (Gbl.F.Out,"
"); - /* Teachers */ - Usr_ListUsersToSelect (Rol_TEACHER); + /***** Show only one user as recipient *****/ + sprintf (Gbl.Message,"Gbl.Usrs.Other.UsrDat.UsrCod = %ld",Gbl.Usrs.Other.UsrDat.UsrCod); + Lay_ShowAlert (Lay_INFO,Gbl.Message); - /* Students */ - Usr_ListUsersToSelect (Rol_STUDENT); + fprintf (Gbl.F.Out,"
" @@ -365,8 +382,10 @@ static void Msg_PutFormMsgUsrs (const char *Content) "
"); Lay_HelpPlainEditor (); fprintf (Gbl.F.Out,"
"); + ""); + + /***** End table *****/ + fprintf (Gbl.F.Out,""); /***** Send button *****/ Lay_PutCreateButton (Txt_Send_message); @@ -3007,9 +3026,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_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); fprintf (Gbl.F.Out,"", Subject); diff --git a/swad_record.c b/swad_record.c index 3364c9ba7..cef83a8a1 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2306,6 +2306,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); else Msg_PutHiddenParamAnotherRecipient (UsrDat); + Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); Act_LinkFormSubmit (Txt_Write_a_message,"REC_DAT_BOLD"); fprintf (Gbl.F.Out,"
" diff --git a/swad_user.c b/swad_user.c index 7c774c9c1..d14ce3f4e 100644 --- a/swad_user.c +++ b/swad_user.c @@ -5025,9 +5025,9 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction) if (Gbl.Msg.Reply.IsReply) { Par_PutHiddenParamChar ("IsReply",'Y'); - // Par_PutHiddenParamChar ("ShowOtherRecipients",'N'); Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod); Usr_PutParamOtherUsrCodEncrypted (); + Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); } break; case ActSeeUseGbl: