From ba2ec0a62df9901022dc8c5edd9ff5cdc17e07c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 29 Dec 2014 20:22:46 +0100 Subject: [PATCH] Version 14.47.2 --- swad_changelog.h | 3 +- swad_chat.c | 57 ++++++++++---------- swad_chat.h | 1 - swad_course.c | 126 +++++++++++++++++++++++++------------------- swad_enrollment.c | 6 ++- swad_file_browser.c | 3 +- swad_forum.c | 95 +++++++++++++++++++++++---------- swad_forum.h | 2 - 8 files changed, 175 insertions(+), 118 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 128ec9b1..6ec417e8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -35,11 +35,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.47.1 (2014/12/29)" +#define Log_PLATFORM_VERSION "SWAD 14.47.2 (2014/12/29)" // 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 | tail -1 /* + Version 14.47.2 :Dic 29, 2014 Changes in listing of chat rooms, forums and user's courses. (174677 lines) Version 14.47.1 :Dic 29, 2014 Changes in listing of chat rooms, forums and user's courses. Fixed bugs in CSS. (174619 lines) Version 14.47 :Dic 29, 2014 Changes in listing of user's courses. (174659 lines) diff --git a/swad_chat.c b/swad_chat.c index 8253bbb8..55d427ce 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -60,6 +60,7 @@ extern struct Globals Gbl; static void Cht_WriteLinkToChat (const char *Icon,const char *RoomCode,const char *RoomShortName,const char *RoomFullName, unsigned Level,bool IsLastItemInLevel[1+Cht_CHAT_MAX_LEVELS]); +static unsigned Cht_GetNumUsrsInChatRoom (const char *RoomCode); /*****************************************************************************/ /****************** List available whiteboard/chat rooms *********************/ @@ -116,15 +117,19 @@ void Cht_ShowListOfAvailableChatRooms (void) /***** Table start *****/ Lay_StartRoundFrameTable10 (NULL,0,Txt_Chat_rooms); fprintf (Gbl.F.Out,"" - "" + "
" + "" + "
" + "" + ""); Lay_EndRoundFrameTable10 (); } @@ -279,24 +288,19 @@ static void Cht_WriteLinkToChat (const char *Icon,const char *RoomCode,const cha unsigned Level,bool IsLastItemInLevel[1+Cht_CHAT_MAX_LEVELS]) { extern const char *The_ClassFormul[The_NUM_THEMES]; - extern const char *The_ClassFormulB[The_NUM_THEMES]; extern const char *Txt_connected_PLURAL; extern const char *Txt_connected_SINGULAR; - const char *Style; - int NumUsrsInRoom = Cht_GetNumUsrsInChatRoom (RoomCode); + unsigned NumUsrsInRoom = Cht_GetNumUsrsInChatRoom (RoomCode); sprintf (Gbl.Chat.WindowName,"%s_%s",RoomCode,Gbl.UniqueNameEncrypted); - Style = (NumUsrsInRoom > 0 ? The_ClassFormulB[Gbl.Prefs.Theme] : - The_ClassFormul[Gbl.Prefs.Theme]); - fprintf (Gbl.F.Out,"" - "", - Style); + fprintf (Gbl.F.Out,"
  • "); Lay_IndentDependingOnLevel (Level,IsLastItemInLevel); Act_FormStart (ActCht); Cht_WriteParamsRoomCodeAndNames (RoomCode,RoomShortName,RoomFullName); - Act_LinkFormSubmit (RoomFullName,Style); + Act_LinkFormSubmit (RoomFullName,The_ClassFormul[Gbl.Prefs.Theme]); + if (NumUsrsInRoom) + fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,"%s %s",Icon,RoomFullName); if (NumUsrsInRoom > 1) fprintf (Gbl.F.Out," [%d %s]", @@ -304,10 +308,11 @@ static void Cht_WriteLinkToChat (const char *Icon,const char *RoomCode,const cha else if (NumUsrsInRoom == 1) fprintf (Gbl.F.Out," [1 %s]", Txt_connected_SINGULAR); + if (NumUsrsInRoom) + fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,"" "" - "" - ""); + "
  • "); } /*****************************************************************************/ @@ -325,27 +330,23 @@ void Cht_WriteParamsRoomCodeAndNames (const char *RoomCode,const char *RoomShort /*************** Get number of users connected to a chat room ****************/ /*****************************************************************************/ -int Cht_GetNumUsrsInChatRoom (const char *RoomCode) +static unsigned Cht_GetNumUsrsInChatRoom (const char *RoomCode) { char Query[512]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned long NumRows; - int NumUsrs = -1; // -1 ==> room is not in database. We can not know the number of usrs connected + unsigned NumUsrs = 0; /***** Get number of users connected to chat rooms from database *****/ - sprintf (Query,"SELECT NumUsrs FROM chat WHERE RoomCode='%s'",RoomCode); - NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get number of users connected to a chat room"); - - /***** Check number of rows of the result *****/ - if (NumRows == 1) + sprintf (Query,"SELECT NumUsrs FROM chat WHERE RoomCode='%s'", + RoomCode); + if (DB_QuerySELECT (Query,&mysql_res,"can not get number of users connected to a chat room")) { /* Get number of users connected to the chat room */ row = mysql_fetch_row (mysql_res); if (row[0]) - if (sscanf (row[0],"%d",&NumUsrs) == 1) - if (NumUsrs < 0) - NumUsrs = -1; + if (sscanf (row[0],"%u",&NumUsrs) != 1) + NumUsrs = 0; } /***** Free structure that stores the query result *****/ diff --git a/swad_chat.h b/swad_chat.h index 120d02b9..223fb219 100644 --- a/swad_chat.h +++ b/swad_chat.h @@ -43,7 +43,6 @@ void Cht_ShowChatRooms (void); void Cht_ShowListOfAvailableChatRooms (void); void Cht_ShowListOfChatRoomsWithUsrs (void); void Cht_WriteParamsRoomCodeAndNames (const char *RoomCode,const char *RoomShortName,const char *RoomFullName); -int Cht_GetNumUsrsInChatRoom (const char *RoomCode); void Cht_OpenChatWindow (void); #endif diff --git a/swad_course.c b/swad_course.c index 44f8224e..93919438 100644 --- a/swad_course.c +++ b/swad_course.c @@ -546,6 +546,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) struct Degree Deg; struct Course Crs; bool IsLastItemInLevel[1+5]; + bool Highlight; // Highlight because degree, course, etc. is selected MYSQL_RES *mysql_resCty; MYSQL_RES *mysql_resIns; MYSQL_RES *mysql_resCtr; @@ -562,29 +563,35 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Table start *****/ Lay_StartRoundFrameTable10 (NULL,0,Txt_My_courses); - - /***** Write link to country *****/ fprintf (Gbl.F.Out,"" - "", - The_ClassFormul[Gbl.Prefs.Theme]); + "" + "
    " + "" + "
    " + "" + ""); Lay_EndRoundFrameTable10 (); } diff --git a/swad_enrollment.c b/swad_enrollment.c index 4331500a..24a584ee 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -741,7 +741,8 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe) /***** Start list of options *****/ fprintf (Gbl.F.Out,"
    " - "