From 1a010ce6f006279c86a94929c3724589f83ca244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 21 Mar 2016 14:50:23 +0100 Subject: [PATCH] Version 15.159 --- swad_changelog.h | 3 +- swad_forum.c | 23 ++++++++++++- swad_message.c | 78 +++++++++++++++++++++++++++----------------- swad_message.h | 2 +- swad_pagination.c | 13 ++------ swad_text.c | 82 +++++++++++++++++++++++++++++++++++------------ 6 files changed, 139 insertions(+), 62 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 3dbec016b..8c360375a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -134,13 +134,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.158.4 (2016-03-21)" +#define Log_PLATFORM_VERSION "SWAD 15.158.5 (2016-03-21)" #define CSS_FILE "swad15.157.css" #define JS_FILE "swad15.131.3.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.158.5: Mar 21, 2016 Number of sent/received messages integrated in frame title. (? lines) Version 15.158.4: Mar 21, 2016 Icon to remove sent/received messages integrated in frame. (196300 lines) Version 15.158.3: Mar 21, 2016 Change in layout of form to import test questions. (196277 lines) Version 15.158.2: Mar 21, 2016 Icon to add new test question integrated in frame. (196283 lines) diff --git a/swad_forum.c b/swad_forum.c index 3707e38a9..fd549bea6 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -277,6 +277,7 @@ static void For_WriteThrSubject (long ThrCod); static long For_GetParamThrCod (void); static void For_PutHiddenParamPstCod (long PstCod); static long For_GetParamPstCod (void); +static void For_WriteNumPsts (unsigned NumPsts); static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod, bool LastPst,char *LastSubject, bool NewPst,bool ICanModerateForum); @@ -952,7 +953,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject) /* Write number of posts and number of new posts */ fprintf (Gbl.F.Out," "); - Msg_WriteNumMsgs (NumPsts,0); + For_WriteNumPsts (NumPsts); fprintf (Gbl.F.Out,"" "" @@ -1053,6 +1054,26 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject) DB_FreeMySQLResult (&mysql_res); } +/*****************************************************************************/ +/*************************** Write number of posts ***************************/ +/*****************************************************************************/ + +static void For_WriteNumPsts (unsigned NumPsts) + { + extern const char *Txt_post; + extern const char *Txt_posts; + + fprintf (Gbl.F.Out,"["); + + /***** Write total number of posts *****/ + if (NumPsts == 1) + fprintf (Gbl.F.Out,"1 %s",Txt_post); + else + fprintf (Gbl.F.Out,"%u %s",NumPsts,Txt_posts); + + fprintf (Gbl.F.Out,"]"); + } + /*****************************************************************************/ /**************************** Show a post from forum *************************/ /*****************************************************************************/ diff --git a/swad_message.c b/swad_message.c index 7c6ba432c..f61e15680 100644 --- a/swad_message.c +++ b/swad_message.c @@ -76,6 +76,8 @@ static void Msg_PutLinkToViewBannedUsers(void); static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod, long FilterCrsCod,const char *FilterFromToSubquery); +static char *Msg_WriteNumMsgs (Msg_TypeOfMessages_t TypeOfMessages, + unsigned NumMsgs,unsigned NumUnreadMsgs); static void Msg_PutIconToRemoveOneRcvMsg (void); static void Msg_PutIconToRemoveSevRcvMsgs (void); static void Msg_PutIconToRemoveOneSntMsg (void); @@ -1665,16 +1667,15 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages) { extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *Txt_Update_messages; - extern const char *Txt_Messages_received; - extern const char *Txt_Messages_sent; char FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY+1]; char Query[Msg_MAX_LENGTH_MESSAGES_QUERY+1]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned long NumRow,NumRows; + unsigned long NumRow; + unsigned long NumRows; unsigned long NumMsg = 0; // Initialized to avoid warning unsigned NumMsgs; - unsigned NumUnreadMsgs = 0; + unsigned NumUnreadMsgs; struct Pagination Pagination; long MsgCod; @@ -1709,6 +1710,8 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages) if (TypeOfMessages == Msg_MESSAGES_RECEIVED) NumUnreadMsgs = Msg_GetNumUnreadMsgs (Gbl.Msg.FilterCrsCod,FilterFromToSubquery); + else + NumUnreadMsgs = 0; /***** Get messages from database *****/ Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,TypeOfMessages,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Msg.FilterCrsCod,FilterFromToSubquery); @@ -1718,8 +1721,7 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages) /***** Start frame with messages *****/ Lay_StartRoundFrame ("97%", - TypeOfMessages == Msg_MESSAGES_RECEIVED ? Txt_Messages_received : - Txt_Messages_sent, + Msg_WriteNumMsgs (TypeOfMessages,NumMsgs,NumUnreadMsgs), TypeOfMessages == Msg_MESSAGES_RECEIVED ? ((NumMsgs == 1) ? Msg_PutIconToRemoveOneRcvMsg : ((NumMsgs > 1) ? Msg_PutIconToRemoveSevRcvMsgs : NULL)) : @@ -1727,11 +1729,6 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages) ((NumMsgs > 1) ? Msg_PutIconToRemoveSevSntMsgs : NULL))); - /* Write number of messages and number of new messages */ - fprintf (Gbl.F.Out,"
"); - Msg_WriteNumMsgs (NumMsgs,NumUnreadMsgs); - fprintf (Gbl.F.Out,"
"); - if (NumMsgs) // If there are messages... { if (Gbl.Action.Act == ActExpRcvMsg) // Expanding a message, perhaps it is the result of following a link @@ -2274,34 +2271,57 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus) } /*****************************************************************************/ -/*********** Write number of messages and number of new messages *************/ +/********* Write number of messages and number of unread messages ************/ /*****************************************************************************/ +// Fill Gbl.Title -void Msg_WriteNumMsgs (unsigned NumMsgs,unsigned NumUnreadMsgs) +static char *Msg_WriteNumMsgs (Msg_TypeOfMessages_t TypeOfMessages, + unsigned NumMsgs,unsigned NumUnreadMsgs) { - extern const char *Txt_message; - extern const char *Txt_messages; + extern const char *Txt_message_received; + extern const char *Txt_message_sent; + extern const char *Txt_messages_received; + extern const char *Txt_messages_sent; extern const char *Txt_unread_MESSAGE; extern const char *Txt_unread_MESSAGES; - fprintf (Gbl.F.Out,"["); - - /***** Write total number of messages *****/ - if (NumMsgs == 1) - fprintf (Gbl.F.Out,"1 %s",Txt_message); - else - fprintf (Gbl.F.Out,"%u %s",NumMsgs,Txt_messages); - - /***** Write number of unread messages *****/ - if (NumUnreadMsgs) + if (TypeOfMessages == Msg_MESSAGES_RECEIVED) { - if (NumUnreadMsgs == 1) - fprintf (Gbl.F.Out,", 1 %s",Txt_unread_MESSAGE); + if (NumMsgs == 1) + { + if (NumUnreadMsgs) + sprintf (Gbl.Title,"1 %s, 1 %s", + Txt_message_received,Txt_unread_MESSAGE); + else + sprintf (Gbl.Title,"1 %s", + Txt_message_received); + } else - fprintf (Gbl.F.Out,", %u %s",NumUnreadMsgs,Txt_unread_MESSAGES); + { + if (NumUnreadMsgs == 0) + sprintf (Gbl.Title,"%u %s", + NumMsgs,Txt_messages_received); + else if (NumUnreadMsgs == 1) + sprintf (Gbl.Title,"%u %s, 1 %s", + NumMsgs,Txt_messages_received, + Txt_unread_MESSAGE); + else + sprintf (Gbl.Title,"%u %s, %u %s", + NumMsgs,Txt_messages_received, + NumUnreadMsgs,Txt_unread_MESSAGES); + } + } + else // TypeOfMessages == Msg_MESSAGES_SENT + { + if (NumMsgs == 1) + sprintf (Gbl.Title,"1 %s", + Txt_message_sent); + else + sprintf (Gbl.Title,"%u %s", + NumMsgs,Txt_messages_sent); } - fprintf (Gbl.F.Out,"]"); + return Gbl.Title; } /*****************************************************************************/ diff --git a/swad_message.h b/swad_message.h index ead7ba64d..5d3d7f5f5 100644 --- a/swad_message.h +++ b/swad_message.h @@ -88,7 +88,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod); unsigned long Msg_GetNumMsgsSentByUsr (long UsrCod); unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus); unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus); -void Msg_WriteNumMsgs (unsigned NumMsgs,unsigned NumUnreadMsgs); + void Msg_PutHiddenParamsMsgsFilters (void); void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages); void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages); diff --git a/swad_pagination.c b/swad_pagination.c index c9d0ae952..9e9a6ce6f 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -191,12 +191,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,long ThrCod,struct P fprintf (Gbl.F.Out,"" "" "" - "", - Font,Font,Txt_Page); + Font,Txt_Page); /***** Possible link to page 1 *****/ if (Pagination->StartPage > 1) @@ -502,12 +499,8 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,long ThrCod,struct P Act_FormEnd (); fprintf (Gbl.F.Out,""); } - fprintf (Gbl.F.Out,"" - "" - "
" - "[" - "" "%s" "" - "]" - "
", - Font); + fprintf (Gbl.F.Out,"" + ""); } } diff --git a/swad_text.c b/swad_text.c index 3da88f270..24d834951 100644 --- a/swad_text.c +++ b/swad_text.c @@ -20914,25 +20914,46 @@ const char *Txt_Messages_of_THE_USER_X_have_been_deleted = // Warning: it is ver "Messages of %s have been deleted."; // Necessita de tradução #endif -const char *Txt_Messages_received = +const char *Txt_message_received = #if L==1 - "Missatges rebuts"; + "missatge rebut"; #elif L==2 - "Empfangene Nachrichten"; + "Nachricht empfangen"; #elif L==3 - "Messages received"; + "message received"; #elif L==4 - "Mensajes recibidos"; + "mensaje recibido"; #elif L==5 - "Messages reçus"; + "message reçu"; #elif L==6 - "Mensajes recibidos"; // Okoteve traducción + "mensaje recibido"; // Okoteve traducción #elif L==7 - "Messaggi ricevuti"; + "messaggio ricevuto"; #elif L==8 - "Wiadomości odebrane"; + "odebranej wiadomości"; #elif L==9 - "Mensagens recebidas"; + "mensagem recebida"; +#endif + +const char *Txt_messages_received = +#if L==1 + "missatges rebuts"; +#elif L==2 + "empfangene Nachrichten"; +#elif L==3 + "messages received"; +#elif L==4 + "mensajes recibidos"; +#elif L==5 + "messages reçus"; +#elif L==6 + "mensajes recibidos"; // Okoteve traducción +#elif L==7 + "messaggi ricevuti"; +#elif L==8 + "wiadomości odebrane"; +#elif L==9 + "mensagens recebidas"; #endif const char *Txt_Messages_received_from_A_COURSE = @@ -20956,25 +20977,46 @@ const char *Txt_Messages_received_from_A_COURSE = "Mensagens recebidas de"; #endif -const char *Txt_Messages_sent = +const char *Txt_message_sent = #if L==1 - "Missatges enviats"; + "missatge enviat"; #elif L==2 - "Gesendete Nachrichten"; + "Nachricht gesendet"; #elif L==3 - "Messages sent"; + "message sent"; #elif L==4 - "Mensajes enviados"; + "mensaje enviado"; #elif L==5 - "Messages envoyés"; + "message envoyé"; #elif L==6 - "Mensajes enviados"; // Okoteve traducción + "mensaje enviado"; // Okoteve traducción #elif L==7 - "Messaggi inviati"; + "messaggio inviato"; #elif L==8 - "Wiadomości wysylane"; + "wiadomość wysłana"; #elif L==9 - "Mensagens enviadas"; + "mensagem enviada"; +#endif + +const char *Txt_messages_sent = +#if L==1 + "missatges enviats"; +#elif L==2 + "gesendete Nachrichten"; +#elif L==3 + "messages sent"; +#elif L==4 + "mensajes enviados"; +#elif L==5 + "messages envoyés"; +#elif L==6 + "mensajes enviados"; // Okoteve traducción +#elif L==7 + "messaggi inviati"; +#elif L==8 + "wiadomości wysylane"; +#elif L==9 + "mensagens enviadas"; #endif const char *Txt_Messages_sent_by_teachers =