From 6b023eba5436872076faabdcd1f8aab3ffba53e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 2 May 2017 12:13:27 +0200 Subject: [PATCH] Version 16.201.2 --- css/swad16.201.css | 2 +- swad_changelog.h | 3 +- swad_global.h | 1 + swad_message.c | 82 ++++++++++++++++++++++------------------------ 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/css/swad16.201.css b/css/swad16.201.css index ea50f63ef..402325858 100644 --- a/css/swad16.201.css +++ b/css/swad16.201.css @@ -1546,7 +1546,7 @@ a:hover /* Default ==> underlined */ .CONTEXT_COL { width:36px; - text-align:left; + text-align:center; vertical-align:top; } diff --git a/swad_changelog.h b/swad_changelog.h index d2efea7f0..65ce8d45f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -222,13 +222,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.201.1 (2017-05-02)" +#define Log_PLATFORM_VERSION "SWAD 16.201.2 (2017-05-02)" #define CSS_FILE "swad16.201.css" #define JS_FILE "swad16.181.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 16.201.2: May 02, 2017 Code refactoring in messages. (218242 lines) Version 16.201.1: May 02, 2017 Code refactoring in messages. (218241 lines) Version 16.201: May 02, 2017 Change layout of contextual icons in assignments, surveys and attendance. (218344 lines) Version 16.200.1: May 02, 2017 Fixed problem printing view of students, teachers and guests. (218331 lines) diff --git a/swad_global.h b/swad_global.h index 980c99f84..83fc33725 100644 --- a/swad_global.h +++ b/swad_global.h @@ -621,6 +621,7 @@ struct Globals char FileNameMail[PATH_MAX + 1]; FILE *FileMail; unsigned CurrentPage; + long MsgCod; // Used as parameter with message to be removed } Msg; struct { diff --git a/swad_message.c b/swad_message.c index 2845fba0c..c1ba5b9da 100644 --- a/swad_message.c +++ b/swad_message.c @@ -93,6 +93,7 @@ static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char Query[Msg_MAX_BYT static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs); static void Msg_PutIconsListMsgs (void); +static void Msg_PutHiddenParamsOneMsg (void); static void Msg_ShowFormToShowOnlyUnreadMessages (void); static void Msg_GetParamOnlyUnreadMsgs (void); @@ -142,8 +143,6 @@ static void Msg_WriteFormToReply (long MsgCod,long CrsCod, static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted); static void Msg_WriteMsgTo (long MsgCod); -static void Msg_PutFormToDeleteMessage (long MsgCod); - static void Msg_PutFormToBanSender (struct UsrData *UsrDat); static void Msg_PutFormToUnbanSender (struct UsrData *UsrDat); static void Msg_UnbanSender (void); @@ -1697,22 +1696,22 @@ static void Msg_ShowSentOrReceivedMessages (void) static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] = { ActSeeRcvMsg, - ActSeeSntMsg + ActSeeSntMsg, }; static const Pag_WhatPaginate_t WhatPaginate[Msg_NUM_TYPES_OF_MSGS] = { Pag_MESSAGES_RECEIVED, - Pag_MESSAGES_SENT + Pag_MESSAGES_SENT, }; const char *Help[Msg_NUM_TYPES_OF_MSGS] = { Hlp_MESSAGES_Received, - Hlp_MESSAGES_Sent + Hlp_MESSAGES_Sent, }; const char *HelpFilter[Msg_NUM_TYPES_OF_MSGS] = { Hlp_MESSAGES_Received_filter, - Hlp_MESSAGES_Sent_filter + Hlp_MESSAGES_Sent_filter, }; /***** Get the page number *****/ @@ -2406,9 +2405,14 @@ static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs) static void Msg_PutIconsListMsgs (void) { - /***** Put icons to remove messages *****/ - Lay_PutContextualIconToRemove ((Gbl.Msg.TypeOfMessages == Msg_MESSAGES_RECEIVED) ? ActReqDelAllRcvMsg : - ActReqDelAllSntMsg, + static const Act_Action_t ActionReqDelAllMsg[Msg_NUM_TYPES_OF_MSGS] = + { + ActReqDelAllRcvMsg, + ActReqDelAllSntMsg, + }; + + /***** Put icon to remove messages *****/ + Lay_PutContextualIconToRemove (ActionReqDelAllMsg[Gbl.Msg.TypeOfMessages], Msg_PutHiddenParamsMsgsFilters); /***** Put icon to show a figure *****/ @@ -2417,7 +2421,19 @@ static void Msg_PutIconsListMsgs (void) } /*****************************************************************************/ -/***** Write a form parameter to specify filter "from"/"to" for messages *****/ +/******* Put hidden parameters to expand, contract or delete a message *******/ +/*****************************************************************************/ + +static void Msg_PutHiddenParamsOneMsg (void) + { + Pag_PutHiddenParamPagNum (Msg_WhatPaginate[Gbl.Msg.TypeOfMessages], + Gbl.Msg.CurrentPage); + Msg_PutHiddenParamMsgCod (Gbl.Msg.MsgCod); + Msg_PutHiddenParamsMsgsFilters (); + } + +/*****************************************************************************/ +/****************** Put hidden parameters with filters ***********************/ /*****************************************************************************/ void Msg_PutHiddenParamsMsgsFilters (void) @@ -2814,6 +2830,11 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod) extern const char *Txt_MSG_From; extern const char *Txt_MSG_To; extern const char *Txt_MSG_Content; + static const Act_Action_t ActionDelMsg[Msg_NUM_TYPES_OF_MSGS] = + { + ActDelRcvMsg, + ActDelSntMsg, + }; struct UsrData UsrDat; const char *Title = NULL; // Initialized to avoid warning bool FromThisCrs = false; // Initialized to avoid warning @@ -2856,7 +2877,7 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod) } fprintf (Gbl.F.Out,"" - "" + "" "\"%s\"", @@ -2873,7 +2894,9 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod) /***** Form to delete message *****/ fprintf (Gbl.F.Out,"
"); - Msg_PutFormToDeleteMessage (MsgCod); + Gbl.Msg.MsgCod = MsgCod; // Message to be deleted + Lay_PutContextualIconToRemove (ActionDelMsg[Gbl.Msg.TypeOfMessages], + Msg_PutHiddenParamsOneMsg); fprintf (Gbl.F.Out,""); /***** Write message number *****/ @@ -3061,10 +3084,8 @@ static void Msg_WriteSentOrReceivedMsgSubject (long MsgCod,const char *Subject,b ActExpRcvMsg) : (Expanded ? ActConSntMsg : ActExpSntMsg)); - Msg_PutHiddenParamsMsgsFilters (); - Pag_PutHiddenParamPagNum (Msg_WhatPaginate[Gbl.Msg.TypeOfMessages], - Gbl.Msg.CurrentPage); - Msg_PutHiddenParamMsgCod (MsgCod); + Gbl.Msg.MsgCod = MsgCod; // Message to be contracted/expanded + Msg_PutHiddenParamsOneMsg (); Act_LinkFormSubmit (Expanded ? Txt_Hide_message : Txt_See_message, Open ? "MSG_TIT" : @@ -3343,7 +3364,7 @@ static void Msg_WriteMsgTo (long MsgCod) static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] = { ActSeeRcvMsg, - ActSeeSntMsg + ActSeeSntMsg, }; /***** Get number of recipients of a message from database *****/ @@ -3462,10 +3483,8 @@ static void Msg_WriteMsgTo (long MsgCod) fprintf (Gbl.F.Out,"" ""); Act_FormStart (ActionSee[Gbl.Msg.TypeOfMessages]); - Msg_PutHiddenParamsMsgsFilters (); - Pag_PutHiddenParamPagNum (Msg_WhatPaginate[Gbl.Msg.TypeOfMessages], - Gbl.Msg.CurrentPage); - Msg_PutHiddenParamMsgCod (MsgCod); + Gbl.Msg.MsgCod = MsgCod; // Message to be expanded with all recipients visible + Msg_PutHiddenParamsOneMsg (); Par_PutHiddenParamChar ("SeeAllRcpts",'Y'); Act_LinkFormSubmit (Txt_View_all_recipients,"AUTHOR_TXT",NULL); fprintf (Gbl.F.Out,Txt_and_X_other_recipients, @@ -3515,27 +3534,6 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground) fprintf (Gbl.F.Out,""); } -/*****************************************************************************/ -/************* Put a form to delete a received or sent message ***************/ -/*****************************************************************************/ - -static void Msg_PutFormToDeleteMessage (long MsgCod) - { - static const Act_Action_t ActionDel[Msg_NUM_TYPES_OF_MSGS] = - { - ActDelRcvMsg, - ActDelSntMsg - }; - - Act_FormStart (ActionDel[Gbl.Msg.TypeOfMessages]); - Pag_PutHiddenParamPagNum (Msg_WhatPaginate[Gbl.Msg.TypeOfMessages], - Gbl.Msg.CurrentPage); - Msg_PutHiddenParamMsgCod (MsgCod); - Msg_PutHiddenParamsMsgsFilters (); - Lay_PutIconRemove (); - Act_FormEnd (); - } - /*****************************************************************************/ /********************* Write the text (content) of a message *****************/ /*****************************************************************************/