From 04e21f0745d096b87b5387afe638db571668d20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 19 Mar 2015 00:28:37 +0100 Subject: [PATCH] Version 14.97 --- css/swad_desktop.css | 4 +-- css/swad_mobile.css | 4 +-- swad_changelog.h | 3 +- swad_follow.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ swad_follow.h | 1 + swad_profile.c | 11 ++++-- swad_text.c | 42 +++++++++++++++++++++++ 7 files changed, 136 insertions(+), 8 deletions(-) diff --git a/css/swad_desktop.css b/css/swad_desktop.css index 7bc3aef5f..8b67fc200 100644 --- a/css/swad_desktop.css +++ b/css/swad_desktop.css @@ -820,10 +820,10 @@ a:hover img.CENTRE_PHOTO_SHOW .CONV_IMPR {font-family:Garamond, "DejaVu LGC Serif", "Bitstream Vera Serif", serif; color:#202020; font-size:11pt;} /***************************** Public user's profile *************************/ -.RANK +.FOLLOW { color:#808080; - font-size:11pt; + font-size:24pt; font-weight:bold; } diff --git a/css/swad_mobile.css b/css/swad_mobile.css index 1feaabe90..95f46c32a 100644 --- a/css/swad_mobile.css +++ b/css/swad_mobile.css @@ -633,10 +633,10 @@ a:hover img.CENTRE_PHOTO_SHOW .CONV_IMPR {font-Family:Garamond, "DejaVu LGC Serif", "Bitstream Vera Serif", serif; color:#202020; font-size:11pt;} /***************************** Public user's profile *************************/ -.RANK +.FOLLOW { color:#808080; - font-size:16pt; + font-size:28pt; font-weight:bold; } diff --git a/swad_changelog.h b/swad_changelog.h index 864f79c50..997657d54 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.96.3 (2015/03/18)" +#define Log_PLATFORM_VERSION "SWAD 14.97 (2015/03/18)" // 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 14.97: Mar 18, 2015 Show number of following and followers in user's profile. (183130 lines) Version 14.96.3: Mar 18, 2015 Changes in record cards. (183017 lines) Version 14.96.2: Mar 18, 2015 Changes in record cards. (183011 lines) Version 14.96.1: Mar 18, 2015 Changes in user's profile. (183015 lines) diff --git a/swad_follow.c b/swad_follow.c index ed650d2fc..47ac04ba7 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -60,6 +60,9 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static unsigned Fol_GetNumFollowing (long UsrCod); +static unsigned Fol_GetNumFollowers (long UsrCod); + /*****************************************************************************/ /*************** Check if a user is a follower of another user ***************/ /*****************************************************************************/ @@ -78,6 +81,82 @@ bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod) return (DB_QueryCOUNT (Query,"can not get if a user is a follower of another one") != 0); } +/*****************************************************************************/ +/**************** Show following and followers of a user *********************/ +/*****************************************************************************/ + +void Fol_ShowFollowingAndFollowers (long UsrCod) + { + extern const char *The_ClassFormul[The_NUM_THEMES]; + extern const char *Txt_Following; + extern const char *Txt_Followers; + unsigned Following = Fol_GetNumFollowing (UsrCod); + unsigned Followers = Fol_GetNumFollowers (UsrCod); + + /***** Start table *****/ + fprintf (Gbl.F.Out,"" + ""); + + /***** Following *****/ + fprintf (Gbl.F.Out,"", + Following, + The_ClassFormul[Gbl.Prefs.Theme], + Txt_Following); + + /***** Followers *****/ + fprintf (Gbl.F.Out,"", + Followers, + The_ClassFormul[Gbl.Prefs.Theme], + Txt_Followers); + + /***** End table *****/ + fprintf (Gbl.F.Out,"" + "
" + "
" + "%u" + "
" + "
" + "%s" + "
" + "
" + "
" + "%u" + "
" + "
" + "%s" + "
" + "
"); + } + +/*****************************************************************************/ +/*************************** Get number of followed **************************/ +/*****************************************************************************/ + +static unsigned Fol_GetNumFollowing (long UsrCod) + { + char Query[128]; + + /***** Check if a user is a follower of another user *****/ + sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowerCod='%ld'", + UsrCod); + return DB_QueryCOUNT (Query,"can not get number of followed"); + } + +/*****************************************************************************/ +/************************** Get number of followers **************************/ +/*****************************************************************************/ + +static unsigned Fol_GetNumFollowers (long UsrCod) + { + char Query[128]; + + /***** Check if a user is a follower of another user *****/ + sprintf (Query,"SELECT COUNT(*) FROM usr_follow WHERE FollowedCod='%ld'", + UsrCod); + return DB_QueryCOUNT (Query,"can not get number of followers"); + } /*****************************************************************************/ /***************************** Follow another user ***************************/ diff --git a/swad_follow.h b/swad_follow.h index d438d65a8..e1de6e7c5 100644 --- a/swad_follow.h +++ b/swad_follow.h @@ -40,6 +40,7 @@ /*****************************************************************************/ bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod); +void Fol_ShowFollowingAndFollowers (long UsrCod); void Fol_FollowUsr (void); void Fol_UnfollowUsr (void); diff --git a/swad_profile.c b/swad_profile.c index 11f34146d..6d3a75b2c 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -29,6 +29,7 @@ #include "swad_config.h" #include "swad_database.h" +#include "swad_follow.h" #include "swad_global.h" #include "swad_nickname.h" #include "swad_parameter.h" @@ -231,12 +232,16 @@ bool Prf_ShowUserProfile (void) fprintf (Gbl.F.Out,"
" "" "" - "" "
"); /***** Common record *****/ Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); + /***** Show following and followers *****/ + if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) + Fol_ShowFollowingAndFollowers (Gbl.Usrs.Other.UsrDat.UsrCod); + fprintf (Gbl.F.Out,""); @@ -739,7 +744,7 @@ static unsigned long Prf_GetNumUsrsWithNumClicksPerDay (void) static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs) { - // extern const char *Txt_Ranking; + extern const char *The_ClassFormul[The_NUM_THEMES]; extern const char *Txt_of_PART_OF_A_TOTAL; /***** Part of a total and end container *****/ @@ -750,7 +755,7 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs) Act_FormStart (ActSeeUseGbl); Sco_PutParamScope (Sco_SCOPE_SYS); Par_PutHiddenParamUnsigned ("UseStatType",(unsigned) Sta_USRS_RANKING); - Act_LinkFormSubmit (Gbl.Title,"RANK"); + Act_LinkFormSubmit (Gbl.Title,The_ClassFormul[Gbl.Prefs.Theme]); fprintf (Gbl.F.Out,"#%lu",Rank); Act_FormEnd (); } diff --git a/swad_text.c b/swad_text.c index ca3cb9412..1f93c9725 100644 --- a/swad_text.c +++ b/swad_text.c @@ -11859,6 +11859,48 @@ const char *Txt_Follow = "Seguir"; #endif +const char *Txt_Followers = +#if L==0 + "Seguidors"; +#elif L==1 + "Anhänger"; +#elif L==2 + "Followers"; +#elif L==3 + "Seguidores"; +#elif L==4 + "Suiveurs"; +#elif L==5 + "Seguidores"; // Okoteve traducción +#elif L==6 + "Followers"; +#elif L==7 + "Obserwują"; +#elif L==8 + "Seguidores"; +#endif + +const char *Txt_Following = +#if L==0 + "Següent"; +#elif L==1 + "Folgende"; +#elif L==2 + "Following"; +#elif L==3 + "Siguiendo"; +#elif L==4 + "Suivant"; +#elif L==5 + "Siguiendo"; // Okoteve traducción +#elif L==6 + "Following"; +#elif L==7 + "Następujący"; +#elif L==8 + "Seguinte"; +#endif + const char *Txt_For_security_enter_your_password = #if L==0 "Per a més seguretat, introdueixi la seva contrasenya";