Version 15.159

This commit is contained in:
Antonio Cañas Vargas 2016-03-21 14:50:23 +01:00
parent cc3bf588e0
commit 1a010ce6f0
6 changed files with 139 additions and 62 deletions

View File

@ -134,13 +134,14 @@
/****************************** Public constants *****************************/ /****************************** 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 CSS_FILE "swad15.157.css"
#define JS_FILE "swad15.131.3.js" #define JS_FILE "swad15.131.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // 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.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.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) Version 15.158.2: Mar 21, 2016 Icon to add new test question integrated in frame. (196283 lines)

View File

@ -277,6 +277,7 @@ static void For_WriteThrSubject (long ThrCod);
static long For_GetParamThrCod (void); static long For_GetParamThrCod (void);
static void For_PutHiddenParamPstCod (long PstCod); static void For_PutHiddenParamPstCod (long PstCod);
static long For_GetParamPstCod (void); static long For_GetParamPstCod (void);
static void For_WriteNumPsts (unsigned NumPsts);
static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod, static void For_ShowAForumPost (struct ForumThread *Thr,unsigned PstNum,long PstCod,
bool LastPst,char *LastSubject, bool LastPst,char *LastSubject,
bool NewPst,bool ICanModerateForum); 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 */ /* Write number of posts and number of new posts */
fprintf (Gbl.F.Out," "); fprintf (Gbl.F.Out," ");
Msg_WriteNumMsgs (NumPsts,0); For_WriteNumPsts (NumPsts);
fprintf (Gbl.F.Out,"</li>" fprintf (Gbl.F.Out,"</li>"
"</ul>" "</ul>"
@ -1053,6 +1054,26 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
DB_FreeMySQLResult (&mysql_res); 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 *************************/ /**************************** Show a post from forum *************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -76,6 +76,8 @@ static void Msg_PutLinkToViewBannedUsers(void);
static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod, static void Msg_ConstructQueryToSelectSentOrReceivedMsgs (char *Query,Msg_TypeOfMessages_t TypeOfMessages,long UsrCod,
long FilterCrsCod,const char *FilterFromToSubquery); 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_PutIconToRemoveOneRcvMsg (void);
static void Msg_PutIconToRemoveSevRcvMsgs (void); static void Msg_PutIconToRemoveSevRcvMsgs (void);
static void Msg_PutIconToRemoveOneSntMsg (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 *The_ClassFormBold[The_NUM_THEMES];
extern const char *Txt_Update_messages; 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 FilterFromToSubquery[Msg_MAX_LENGTH_MESSAGES_QUERY+1];
char Query[Msg_MAX_LENGTH_MESSAGES_QUERY+1]; char Query[Msg_MAX_LENGTH_MESSAGES_QUERY+1];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumRow,NumRows; unsigned long NumRow;
unsigned long NumRows;
unsigned long NumMsg = 0; // Initialized to avoid warning unsigned long NumMsg = 0; // Initialized to avoid warning
unsigned NumMsgs; unsigned NumMsgs;
unsigned NumUnreadMsgs = 0; unsigned NumUnreadMsgs;
struct Pagination Pagination; struct Pagination Pagination;
long MsgCod; long MsgCod;
@ -1709,6 +1710,8 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
if (TypeOfMessages == Msg_MESSAGES_RECEIVED) if (TypeOfMessages == Msg_MESSAGES_RECEIVED)
NumUnreadMsgs = Msg_GetNumUnreadMsgs (Gbl.Msg.FilterCrsCod,FilterFromToSubquery); NumUnreadMsgs = Msg_GetNumUnreadMsgs (Gbl.Msg.FilterCrsCod,FilterFromToSubquery);
else
NumUnreadMsgs = 0;
/***** Get messages from database *****/ /***** Get messages from database *****/
Msg_ConstructQueryToSelectSentOrReceivedMsgs (Query,TypeOfMessages,Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Msg.FilterCrsCod,FilterFromToSubquery); 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 *****/ /***** Start frame with messages *****/
Lay_StartRoundFrame ("97%", Lay_StartRoundFrame ("97%",
TypeOfMessages == Msg_MESSAGES_RECEIVED ? Txt_Messages_received : Msg_WriteNumMsgs (TypeOfMessages,NumMsgs,NumUnreadMsgs),
Txt_Messages_sent,
TypeOfMessages == Msg_MESSAGES_RECEIVED ? ((NumMsgs == 1) ? Msg_PutIconToRemoveOneRcvMsg : TypeOfMessages == Msg_MESSAGES_RECEIVED ? ((NumMsgs == 1) ? Msg_PutIconToRemoveOneRcvMsg :
((NumMsgs > 1) ? Msg_PutIconToRemoveSevRcvMsgs : ((NumMsgs > 1) ? Msg_PutIconToRemoveSevRcvMsgs :
NULL)) : NULL)) :
@ -1727,11 +1729,6 @@ static void Msg_ShowSentOrReceivedMessages (Msg_TypeOfMessages_t TypeOfMessages)
((NumMsgs > 1) ? Msg_PutIconToRemoveSevSntMsgs : ((NumMsgs > 1) ? Msg_PutIconToRemoveSevSntMsgs :
NULL))); NULL)));
/* Write number of messages and number of new messages */
fprintf (Gbl.F.Out,"<div class=\"TIT CENTER_MIDDLE\">");
Msg_WriteNumMsgs (NumMsgs,NumUnreadMsgs);
fprintf (Gbl.F.Out,"</div>");
if (NumMsgs) // If there are messages... if (NumMsgs) // If there are messages...
{ {
if (Gbl.Action.Act == ActExpRcvMsg) // Expanding a message, perhaps it is the result of following a link 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_message_received;
extern const char *Txt_messages; 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_MESSAGE;
extern const char *Txt_unread_MESSAGES; extern const char *Txt_unread_MESSAGES;
fprintf (Gbl.F.Out,"["); if (TypeOfMessages == Msg_MESSAGES_RECEIVED)
/***** 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 (NumUnreadMsgs == 1) if (NumMsgs == 1)
fprintf (Gbl.F.Out,", 1 %s",Txt_unread_MESSAGE); {
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 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;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -88,7 +88,7 @@ unsigned Msg_GetNumMsgsSentByTchsCrs (long CrsCod);
unsigned long Msg_GetNumMsgsSentByUsr (long UsrCod); unsigned long Msg_GetNumMsgsSentByUsr (long UsrCod);
unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus); unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus);
unsigned Msg_GetNumMsgsReceived (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_PutHiddenParamsMsgsFilters (void);
void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages); void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages);
void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages); void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages);

View File

@ -191,12 +191,9 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,long ThrCod,struct P
fprintf (Gbl.F.Out,"<table style=\"margin:0 auto; border-spacing:6px;\">" fprintf (Gbl.F.Out,"<table style=\"margin:0 auto; border-spacing:6px;\">"
"<tr>" "<tr>"
"<td class=\"%s LEFT_MIDDLE\">" "<td class=\"%s LEFT_MIDDLE\">"
"["
"</td>"
"<td class=\"%s LEFT_MIDDLE\">"
"%s" "%s"
"</td>", "</td>",
Font,Font,Txt_Page); Font,Txt_Page);
/***** Possible link to page 1 *****/ /***** Possible link to page 1 *****/
if (Pagination->StartPage > 1) if (Pagination->StartPage > 1)
@ -502,12 +499,8 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,long ThrCod,struct P
Act_FormEnd (); Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"); fprintf (Gbl.F.Out,"</td>");
} }
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"</tr>"
"]" "</table>");
"</td>"
"</tr>"
"</table>",
Font);
} }
} }

View File

@ -20914,25 +20914,46 @@ const char *Txt_Messages_of_THE_USER_X_have_been_deleted = // Warning: it is ver
"Messages of <strong>%s</strong> have been deleted."; // Necessita de tradução "Messages of <strong>%s</strong> have been deleted."; // Necessita de tradução
#endif #endif
const char *Txt_Messages_received = const char *Txt_message_received =
#if L==1 #if L==1
"Missatges rebuts"; "missatge rebut";
#elif L==2 #elif L==2
"Empfangene Nachrichten"; "Nachricht empfangen";
#elif L==3 #elif L==3
"Messages received"; "message received";
#elif L==4 #elif L==4
"Mensajes recibidos"; "mensaje recibido";
#elif L==5 #elif L==5
"Messages re&ccedil;us"; "message re&ccedil;u";
#elif L==6 #elif L==6
"Mensajes recibidos"; // Okoteve traducción "mensaje recibido"; // Okoteve traducción
#elif L==7 #elif L==7
"Messaggi ricevuti"; "messaggio ricevuto";
#elif L==8 #elif L==8
"Wiadomo&sacute;ci odebrane"; "odebranej wiadomo&sacute;ci";
#elif L==9 #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&ccedil;us";
#elif L==6
"mensajes recibidos"; // Okoteve traducción
#elif L==7
"messaggi ricevuti";
#elif L==8
"wiadomo&sacute;ci odebrane";
#elif L==9
"mensagens recebidas";
#endif #endif
const char *Txt_Messages_received_from_A_COURSE = const char *Txt_Messages_received_from_A_COURSE =
@ -20956,25 +20977,46 @@ const char *Txt_Messages_received_from_A_COURSE =
"Mensagens recebidas de"; "Mensagens recebidas de";
#endif #endif
const char *Txt_Messages_sent = const char *Txt_message_sent =
#if L==1 #if L==1
"Missatges enviats"; "missatge enviat";
#elif L==2 #elif L==2
"Gesendete Nachrichten"; "Nachricht gesendet";
#elif L==3 #elif L==3
"Messages sent"; "message sent";
#elif L==4 #elif L==4
"Mensajes enviados"; "mensaje enviado";
#elif L==5 #elif L==5
"Messages envoy&eacute;s"; "message envoy&eacute;";
#elif L==6 #elif L==6
"Mensajes enviados"; // Okoteve traducción "mensaje enviado"; // Okoteve traducción
#elif L==7 #elif L==7
"Messaggi inviati"; "messaggio inviato";
#elif L==8 #elif L==8
"Wiadomo&sacute;ci wysylane"; "wiadomo&sacute;&cacute; wys&lstrok;ana";
#elif L==9 #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&eacute;s";
#elif L==6
"mensajes enviados"; // Okoteve traducción
#elif L==7
"messaggi inviati";
#elif L==8
"wiadomo&sacute;ci wysylane";
#elif L==9
"mensagens enviadas";
#endif #endif
const char *Txt_Messages_sent_by_teachers = const char *Txt_Messages_sent_by_teachers =