Version 14.97

This commit is contained in:
Antonio Cañas Vargas 2015-03-19 00:28:37 +01:00
parent e9941c8c16
commit 04e21f0745
7 changed files with 136 additions and 8 deletions

View File

@ -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;} .CONV_IMPR {font-family:Garamond, "DejaVu LGC Serif", "Bitstream Vera Serif", serif; color:#202020; font-size:11pt;}
/***************************** Public user's profile *************************/ /***************************** Public user's profile *************************/
.RANK .FOLLOW
{ {
color:#808080; color:#808080;
font-size:11pt; font-size:24pt;
font-weight:bold; font-weight:bold;
} }

View File

@ -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;} .CONV_IMPR {font-Family:Garamond, "DejaVu LGC Serif", "Bitstream Vera Serif", serif; color:#202020; font-size:11pt;}
/***************************** Public user's profile *************************/ /***************************** Public user's profile *************************/
.RANK .FOLLOW
{ {
color:#808080; color:#808080;
font-size:16pt; font-size:28pt;
font-weight:bold; font-weight:bold;
} }

View File

@ -103,11 +103,12 @@
/****************************** Public constants *****************************/ /****************************** 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: // 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 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.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.2: Mar 18, 2015 Changes in record cards. (183011 lines)
Version 14.96.1: Mar 18, 2015 Changes in user's profile. (183015 lines) Version 14.96.1: Mar 18, 2015 Changes in user's profile. (183015 lines)

View File

@ -60,6 +60,9 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static unsigned Fol_GetNumFollowing (long UsrCod);
static unsigned Fol_GetNumFollowers (long UsrCod);
/*****************************************************************************/ /*****************************************************************************/
/*************** Check if a user is a follower of another user ***************/ /*************** 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); 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,"<table class=\"CELLS_PAD_4\" style=\"margin:0 auto;\">"
"<tr>");
/***** Following *****/
fprintf (Gbl.F.Out,"<td style=\"min-width:100px;"
" text-align:center; vertical-align:top;\">"
"<div class=\"FOLLOW\">"
"%u"
"</div>"
"<div class=\"%s\">"
"%s"
"</div>"
"</td>",
Following,
The_ClassFormul[Gbl.Prefs.Theme],
Txt_Following);
/***** Followers *****/
fprintf (Gbl.F.Out,"<td style=\"min-width:100px;"
" text-align:center; vertical-align:top;\">"
"<div class=\"FOLLOW\">"
"%u"
"</div>"
"<div class=\"%s\">"
"%s"
"</div>"
"</td>",
Followers,
The_ClassFormul[Gbl.Prefs.Theme],
Txt_Followers);
/***** End table *****/
fprintf (Gbl.F.Out,"</tr>"
"</table>");
}
/*****************************************************************************/
/*************************** 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 ***************************/ /***************************** Follow another user ***************************/

View File

@ -40,6 +40,7 @@
/*****************************************************************************/ /*****************************************************************************/
bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod); bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod);
void Fol_ShowFollowingAndFollowers (long UsrCod);
void Fol_FollowUsr (void); void Fol_FollowUsr (void);
void Fol_UnfollowUsr (void); void Fol_UnfollowUsr (void);

View File

@ -29,6 +29,7 @@
#include "swad_config.h" #include "swad_config.h"
#include "swad_database.h" #include "swad_database.h"
#include "swad_follow.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_nickname.h" #include "swad_nickname.h"
#include "swad_parameter.h" #include "swad_parameter.h"
@ -231,12 +232,16 @@ bool Prf_ShowUserProfile (void)
fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">" fprintf (Gbl.F.Out,"<div style=\"margin:0 auto;\">"
"<table style=\"margin:0 auto;\">" "<table style=\"margin:0 auto;\">"
"<tr>" "<tr>"
"<td style=\"text-align:right;" "<td style=\"text-align:center;"
" vertical-align:top;\">"); " vertical-align:top;\">");
/***** Common record *****/ /***** Common record *****/
Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); 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,"</td>" fprintf (Gbl.F.Out,"</td>"
"<td style=\"text-align:left;" "<td style=\"text-align:left;"
" vertical-align:top; padding-left:4px;\">"); " vertical-align:top; padding-left:4px;\">");
@ -739,7 +744,7 @@ static unsigned long Prf_GetNumUsrsWithNumClicksPerDay (void)
static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs) 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; extern const char *Txt_of_PART_OF_A_TOTAL;
/***** Part of a total and end container *****/ /***** Part of a total and end container *****/
@ -750,7 +755,7 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs)
Act_FormStart (ActSeeUseGbl); Act_FormStart (ActSeeUseGbl);
Sco_PutParamScope (Sco_SCOPE_SYS); Sco_PutParamScope (Sco_SCOPE_SYS);
Par_PutHiddenParamUnsigned ("UseStatType",(unsigned) Sta_USRS_RANKING); 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</a>",Rank); fprintf (Gbl.F.Out,"#%lu</a>",Rank);
Act_FormEnd (); Act_FormEnd ();
} }

View File

@ -11859,6 +11859,48 @@ const char *Txt_Follow =
"Seguir"; "Seguir";
#endif #endif
const char *Txt_Followers =
#if L==0
"Seguidors";
#elif L==1
"Anh&auml;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&aogon;";
#elif L==8
"Seguidores";
#endif
const char *Txt_Following =
#if L==0
"Seg&uuml;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&eogon;puj&aogon;cy";
#elif L==8
"Seguinte";
#endif
const char *Txt_For_security_enter_your_password = const char *Txt_For_security_enter_your_password =
#if L==0 #if L==0
"Per a m&eacute;s seguretat, introdueixi la seva contrasenya"; "Per a m&eacute;s seguretat, introdueixi la seva contrasenya";