From c45a9847b448ba50fd15338f546833293caaa57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 24 Dec 2015 00:31:45 +0100 Subject: [PATCH] Version 15.72.5 --- css/swad15.72.4.css | 2 +- swad_changelog.h | 3 ++- swad_message.c | 65 ++++++++++++++++++++++++++++++--------------- swad_record.c | 5 +--- swad_user.c | 6 +++-- 5 files changed, 52 insertions(+), 29 deletions(-) diff --git a/css/swad15.72.4.css b/css/swad15.72.4.css index 2a00ab75a..18e7ad5c5 100644 --- a/css/swad15.72.4.css +++ b/css/swad15.72.4.css @@ -1651,7 +1651,7 @@ a:hover img.CENTRE_PHOTO_SHOW .LOG_R {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:red; font-size:11pt;} /*********************************** Messages ********************************/ -.MSG_TO_ONE_RCP // ID and name of only one selected recipient +.MSG_TO_ONE_RCP { display:inline-block; padding-left:4px; diff --git a/swad_changelog.h b/swad_changelog.h index 7058e4575..fc70e0eba 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -118,12 +118,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.72.4 (2015-12-23)" +#define Log_PLATFORM_VERSION "SWAD 15.72.5 (2015-12-24)" #define CSS_FILE "swad15.72.4.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.5: Dec 24, 2015 Fixed bugs while sending a message to a unique recipient. (187794 lines) Version 15.72.4: Dec 23, 2015 Show recipient when writing message to only one recipient. (187775 lines) Version 15.72.3: Dec 23, 2015 Message translated. (187733 lines) Version 15.72.2: Dec 23, 2015 Write message only to one recipient. Not finished. diff --git a/swad_message.c b/swad_message.c index e94e8fbb3..5952c0653 100644 --- a/swad_message.c +++ b/swad_message.c @@ -115,7 +115,7 @@ static void Msg_GetMsgContent (long MsgCod,char *Content); static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod,const char *Subject,bool Open,bool Expanded); static void Msg_WriteFormToReply (long MsgCod,long CrsCod,const char *Subject, bool ThisCrs,bool Replied, - const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]); + const struct UsrData *UsrDat); static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted); static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod); @@ -292,6 +292,16 @@ static void Msg_PutFormMsgUsrs (const char *Content) /***** Get list of users' IDs or nicknames written explicitely *****/ Usr_GetListMsgRecipientsWrittenExplicitelyBySender (false); + sprintf (Gbl.Message,"Gbl.Usrs.ListOtherRecipients = '%s'", + Gbl.Usrs.ListOtherRecipients); + Lay_ShowAlert (Lay_INFO,Gbl.Message); + + /***** 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 belonging to the current course *****/ if (!Gbl.Msg.ShowOnlyOneRecipient && // Show list of potential recipients (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it @@ -334,12 +344,14 @@ static void Msg_PutFormMsgUsrs (const char *Content) /***** Start form to select recipients and write the message *****/ Act_FormStart (ActRcvMsgUsr); if (Gbl.Msg.Reply.IsReply) - { - Par_PutHiddenParamChar ("IsReply",'Y'); - Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod); - Usr_PutParamOtherUsrCodEncrypted (); - Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); - } + { + Par_PutHiddenParamChar ("IsReply",'Y'); + Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod); + } + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + Usr_PutParamOtherUsrCodEncrypted (); + if (Gbl.Msg.ShowOnlyOneRecipient) + Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); /***** Start table *****/ fprintf (Gbl.F.Out,""); @@ -441,8 +453,9 @@ static void Msg_PutParamsShowMorePotentialRecipients (void) { Par_PutHiddenParamChar ("IsReply",'Y'); Msg_PutHiddenParamMsgCod (Gbl.Msg.Reply.OriginalMsgCod); - Usr_PutParamOtherUsrCodEncrypted (); } + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + Usr_PutParamOtherUsrCodEncrypted (); } /*****************************************************************************/ @@ -473,6 +486,9 @@ static void Msg_ShowOneUniqueRecipient (void) Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" : "DAT_SMALL_NOBR", Gbl.Usrs.Other.UsrDat.FullName); + + /***** Hidden parameter with user's nickname *****/ + Msg_PutHiddenParamAnotherRecipient (&Gbl.Usrs.Other.UsrDat); } /*****************************************************************************/ @@ -485,13 +501,19 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void) extern const char *Txt_Recipients; extern const char *Txt_nicks_emails_or_IDs_separated_by_commas; char Nickname[Nck_MAX_LENGTH_NICKNAME_WITHOUT_ARROBA+1]; // old version because is a nickname retrieved from database. TODO: change in 2013 - unsigned Colspan = Usr_GetColumnsForSelectUsrs (); + bool PutColspan; + unsigned Colspan; + + PutColspan = Gbl.CurrentCrs.Crs.CrsCod > 0 && // If there is a course selected + (Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it + Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); + if (PutColspan) + Colspan = Usr_GetColumnsForSelectUsrs (); /***** Textarea with users' @nicknames, e-mails or IDs *****/ fprintf (Gbl.F.Out,"" "" "" "" @@ -692,7 +714,7 @@ void Msg_RecMsgFromUsr (void) /* Get list of users' IDs or nicknames written explicitely */ Error = Usr_GetListMsgRecipientsWrittenExplicitelyBySender (true); - /***** If there are no recipients... *****/ + /***** Check number of recipients *****/ if ((NumRecipients = Usr_CountNumUsrsInListOfSelectedUsrs ())) { if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && @@ -2801,8 +2823,9 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages, if (TypeOfMessages == Msg_MESSAGES_RECEIVED && Gbl.Usrs.Me.LoggedRole >= Rol_VISITOR) // Guests (users without courses) can read messages but not reply them - Msg_WriteFormToReply (MsgCod,CrsCod,Subject,FromThisCrs,Replied, - UsrDat.EncryptedUsrCod); + Msg_WriteFormToReply (MsgCod,CrsCod,Subject, + FromThisCrs,Replied, + &UsrDat); fprintf (Gbl.F.Out,"" "" "
%s:", Colspan,Txt_Other_recipients); else @@ -503,16 +525,16 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void) "
" @@ -3072,7 +3095,7 @@ bool Msg_WriteCrsOrgMsg (long CrsCod) static void Msg_WriteFormToReply (long MsgCod,long CrsCod,const char *Subject, bool FromThisCrs,bool Replied, - const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]) + const struct UsrData *UsrDat) { extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *Txt_Reply; @@ -3091,7 +3114,7 @@ static void Msg_WriteFormToReply (long MsgCod,long CrsCod,const char *Subject, Grp_PutParamAllGroups (); Par_PutHiddenParamChar ("IsReply",'Y'); Msg_PutHiddenParamMsgCod (MsgCod); - Usr_PutParamUsrCodEncrypted (EncryptedUsrCod); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); fprintf (Gbl.F.Out,"", diff --git a/swad_record.c b/swad_record.c index cef83a8a1..501d9bd74 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2302,10 +2302,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, /***** Button to send a message *****/ Act_FormStart (ActReqMsgUsr); Grp_PutParamAllGroups (); - if (HeBelongsToCurrentCrs) - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - else - Msg_PutHiddenParamAnotherRecipient (UsrDat); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); Act_LinkFormSubmit (Txt_Write_a_message,"REC_DAT_BOLD"); fprintf (Gbl.F.Out,"
0) + Usr_PutParamOtherUsrCodEncrypted (); + if (Gbl.Msg.ShowOnlyOneRecipient) + Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y'); break; case ActSeeUseGbl: Pho_PutHiddenParamFigureType ();