mirror of https://github.com/acanas/swad-core.git
Version 15.133
This commit is contained in:
parent
fd2be41b04
commit
5106642ec1
|
@ -123,13 +123,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.132.1 (2016-01-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.133 (2016-01-27)"
|
||||
#define CSS_FILE "swad15.131.2.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.133: Jan 27, 2016 List users to follow. (195236 lines)
|
||||
Version 15.132.1: Jan 27, 2016 Build query to get users to follow. (195158 lines)
|
||||
Version 15.132: Jan 27, 2016 Put link to suggest users to follow. (195116 lines)
|
||||
2 changes necessary in database:
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
#define Fol_NUM_COLUMNS_FOLLOW 3
|
||||
|
||||
#define Fol_MAX_USRS_TO_FOLLOW_SUGGESTED (Fol_NUM_COLUMNS_FOLLOW * 3)
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Internal types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -89,12 +91,16 @@ void Fol_PutLinkWhoToFollow (void)
|
|||
/******************** Put link to suggest users to follow ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Fol_MAX_USRS_SUGGESTED 1000
|
||||
|
||||
void Fol_SuggestWhoToFollow (void)
|
||||
{
|
||||
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
|
||||
extern const char *Txt_No_user_to_whom_you_can_follow_Try_again_later;
|
||||
char Query[2048];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumUsrs;
|
||||
unsigned NumUsr;
|
||||
struct UsrData UsrDat;
|
||||
|
||||
/***** First try: build query to get users to follow *****/
|
||||
sprintf (Query,"SELECT UsrCod FROM"
|
||||
|
@ -147,7 +153,7 @@ void Fol_SuggestWhoToFollow (void)
|
|||
" (SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld')"
|
||||
|
||||
// Get only Fol_MAX_USRS_SUGGESTED users
|
||||
// Get only Fol_MAX_USRS_TO_FOLLOW_SUGGESTED users
|
||||
" ORDER BY RAND() LIMIT %u",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
|
@ -159,9 +165,17 @@ void Fol_SuggestWhoToFollow (void)
|
|||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Pri_VisibilityDB[Pri_VISIBILITY_USER],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Fol_MAX_USRS_SUGGESTED);
|
||||
Fol_MAX_USRS_TO_FOLLOW_SUGGESTED);
|
||||
|
||||
Lay_ShowAlert (Lay_INFO,Query);
|
||||
// Lay_ShowAlert (Lay_INFO,Query);
|
||||
|
||||
/***** Try to get users *****/
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get followed users");
|
||||
|
||||
if (!NumUsrs)
|
||||
{
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Second try: build query to get users to follow *****/
|
||||
sprintf (Query,// Users with privacy
|
||||
|
@ -175,15 +189,60 @@ void Fol_SuggestWhoToFollow (void)
|
|||
" (SELECT FollowedCod FROM usr_follow"
|
||||
" WHERE FollowerCod='%ld')"
|
||||
|
||||
// Get only Fol_MAX_USRS_SUGGESTED users
|
||||
// Get only Fol_MAX_USRS_TO_FOLLOW_SUGGESTED users
|
||||
" ORDER BY RAND() LIMIT %u",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Pri_VisibilityDB[Pri_VISIBILITY_SYSTEM],
|
||||
Pri_VisibilityDB[Pri_VISIBILITY_WORLD],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Fol_MAX_USRS_SUGGESTED);
|
||||
Fol_MAX_USRS_TO_FOLLOW_SUGGESTED);
|
||||
|
||||
Lay_ShowAlert (Lay_INFO,Query);
|
||||
// Lay_ShowAlert (Lay_INFO,Query);
|
||||
|
||||
/***** Get users *****/
|
||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get followed users");
|
||||
}
|
||||
|
||||
if (NumUsrs)
|
||||
{
|
||||
/***** Initialize structure with user's data *****/
|
||||
Usr_UsrDataConstructor (&UsrDat);
|
||||
|
||||
/***** Start listing *****/
|
||||
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\""
|
||||
" style=\"margin:12px auto;\">");
|
||||
|
||||
for (NumUsr = 0;
|
||||
NumUsr < NumUsrs;
|
||||
NumUsr++)
|
||||
{
|
||||
/***** Get user *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* Get user's code (row[0]) */
|
||||
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/***** Show user *****/
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == 0)
|
||||
fprintf (Gbl.F.Out,"<tr>");
|
||||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||
Fol_ShowFollowedOrFollower (&UsrDat);
|
||||
if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) ||
|
||||
NumUsr == NumUsrs - 1)
|
||||
fprintf (Gbl.F.Out,"</tr>");
|
||||
}
|
||||
|
||||
/***** End listing *****/
|
||||
fprintf (Gbl.F.Out,"</table>");
|
||||
|
||||
/***** Free memory used for user's data *****/
|
||||
Usr_UsrDataDestructor (&UsrDat);
|
||||
}
|
||||
else
|
||||
Lay_ShowAlert (Lay_INFO,Txt_No_user_to_whom_you_can_follow_Try_again_later);
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
30
swad_text.c
30
swad_text.c
|
@ -24223,6 +24223,36 @@ const char *Txt_No_user_has_been_removed =
|
|||
"No user has been removed."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_No_user_to_whom_you_can_follow_Try_again_later =
|
||||
#if L==1
|
||||
"No hi ha cap usuari a qui vostè pugui seguir."
|
||||
" Intenteu-ho més endavant.";
|
||||
#elif L==2
|
||||
"Kein Benutzer dem Sie folgen können."
|
||||
" Versuchen Sie es später noch einmal.";
|
||||
#elif L==3
|
||||
"No user to whom you can follow."
|
||||
" Try again later.";
|
||||
#elif L==4
|
||||
"No hay ningún usuario a quien usted pueda seguir."
|
||||
" Inténtelo más adelante.";
|
||||
#elif L==5
|
||||
"Aucun utilisateur auquel vous pouvez suivre."
|
||||
" Réessayez plus tard.";
|
||||
#elif L==6
|
||||
"No hay ningún usuario a quien usted pueda seguir."
|
||||
" Inténtelo más adelante."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Nessun utente a cui è possibile seguire."
|
||||
" Riprovare più tardi.";
|
||||
#elif L==8
|
||||
"No użytkownika, do którego można śledzić."
|
||||
" Spróbuj ponownie później.";
|
||||
#elif L==9
|
||||
"Nenhum usuário a quem você pode seguir."
|
||||
" Tente novamente mais tarde.";
|
||||
#endif
|
||||
|
||||
const char *Txt_No_users_found[Rol_NUM_ROLES] =
|
||||
{
|
||||
#if L==1 // Rol_ROLE_UNKNOWN
|
||||
|
|
Loading…
Reference in New Issue