From c5dde0ef53d3dfb14b7c6cb4453df570754ea59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 17 Mar 2015 00:54:03 +0100 Subject: [PATCH] Version 14.93.4 --- swad_changelog.h | 3 ++- swad_profile.c | 55 ++++++++++++++++++++++++++++++------------------ swad_text.c | 21 ++++++++++++++++++ 3 files changed, 58 insertions(+), 21 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 8e5e7c3e..886c185e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.93.3 (2015/03/16)" +#define Log_PLATFORM_VERSION "SWAD 14.93.4 (2015/03/17)" // 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.93.4: Mar 17, 2015 Links in user's figures to ranking. (182661 lines) Version 14.93.3: Mar 16, 2015 Changes in rankings. (182630 lines) Version 14.93.2: Mar 16, 2015 New rankings for downloads, forum posts and messages sent. (182628 lines) Version 14.93.1: Mar 16, 2015 Photos and links to users' profiles in users' ranking. (182560 lines) diff --git a/swad_profile.c b/swad_profile.c index b2d45656..daf5f683 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -86,6 +86,7 @@ static unsigned long Prf_GetRankingNumClicks (long UsrCod); static unsigned long Prf_GetNumUsrsWithNumClicks (void); static unsigned long Prf_GetRankingNumClicksPerDay (long UsrCod); static unsigned long Prf_GetNumUsrsWithNumClicksPerDay (void); +static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs); static void Prf_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod); static void Prf_GetNumClicksAndStoreAsUsrFigure (long UsrCod); @@ -396,7 +397,6 @@ static void Prf_ShowHistoricUserProfile (const struct UsrData *UsrDat) extern const char *Txt_days; extern const char *Txt_Calculate; extern const char *Txt_Clicks; - extern const char *Txt_of_PART_OF_A_TOTAL; extern const char *Txt_clicks; extern const char *Txt_Downloads; extern const char *Txt_download; @@ -461,28 +461,17 @@ static void Prf_ShowHistoricUserProfile (const struct UsrData *UsrDat) Txt_Clicks); if (UsrFigures.NumClicks >= 0) { - fprintf (Gbl.F.Out,"%ld %s" - "
" - "#%ld" - " %s %ld" - "
", - UsrFigures.NumClicks,Txt_clicks, - Prf_GetRankingNumClicks (UsrDat->UsrCod), - Txt_of_PART_OF_A_TOTAL, - Prf_GetNumUsrsWithNumClicks ()); + fprintf (Gbl.F.Out,"%ld %s", + UsrFigures.NumClicks,Txt_clicks); + Prf_ShowRanking (Prf_GetRankingNumClicks (UsrDat->UsrCod), + Prf_GetNumUsrsWithNumClicks ()); if (UsrFigures.NumDays >= 0) { Str_WriteFloatNum ((float) UsrFigures.NumClicks / (float) (UsrFigures.NumDays + 1)); - fprintf (Gbl.F.Out," / %s" - "
" - "#%ld" - " %s %ld" - "
", - Txt_day, - Prf_GetRankingNumClicksPerDay (UsrDat->UsrCod), - Txt_of_PART_OF_A_TOTAL, - Prf_GetNumUsrsWithNumClicksPerDay ()); + fprintf (Gbl.F.Out," / %s",Txt_day); + Prf_ShowRanking (Prf_GetRankingNumClicksPerDay (UsrDat->UsrCod), + Prf_GetNumUsrsWithNumClicksPerDay ()); } } else // Number of clicks is unknown @@ -747,6 +736,32 @@ static unsigned long Prf_GetNumUsrsWithNumClicksPerDay (void) return DB_QueryCOUNT (Query,"can not get number of users with number of clicks per day"); } +/*****************************************************************************/ +/************************* Show position in ranking **************************/ +/*****************************************************************************/ + +static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs) + { + extern const char *Txt_Ranking; + extern const char *Txt_of_PART_OF_A_TOTAL; + + /***** Start container *****/ + fprintf (Gbl.F.Out,"
"); + + /***** Rank in form to go to ranking *****/ + Act_FormStart (ActSeeUseGbl); + Sco_PutParamScope (Sco_SCOPE_SYS); + Par_PutHiddenParamUnsigned ("UseStatType",(unsigned) Sta_USRS_RANKING); + Act_LinkFormSubmit (Txt_Ranking,"RANK"); + fprintf (Gbl.F.Out,"#%ld",Rank); + Act_FormEnd (); + + /***** Part of a total and end container *****/ + fprintf (Gbl.F.Out," %s %ld" + "
", + Txt_of_PART_OF_A_TOTAL,NumUsrs); + } + /*****************************************************************************/ /********* Calculate first click time and show user's profile again **********/ /*****************************************************************************/ @@ -1445,7 +1460,7 @@ static void Prf_ShowUsrInRanking (const struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO18x24",Pho_ZOOM); + "PHOTO15x20",Pho_ZOOM); /***** Put form to go to public profile *****/ if (UsrDat->Nickname[0]) diff --git a/swad_text.c b/swad_text.c index e7c427fe..c2e45e1a 100644 --- a/swad_text.c +++ b/swad_text.c @@ -27448,6 +27448,27 @@ const char *Txt_Quota_exceeded = "Quota excedida!"; #endif +const char *Txt_Ranking = +#if L==0 + "Rànquing"; +#elif L==1 + "Rang"; +#elif L==2 + "Ranking"; +#elif L==3 + "Ranking"; +#elif L==4 + "Classement"; +#elif L==5 + "Ranking"; // Okoteve traducción +#elif L==6 + "Posto"; +#elif L==7 + "Ranking"; +#elif L==8 + "Posição"; +#endif + const char *Txt_ReaBRders = #if L==0 "Lec-
tores"; // Necessita traduccio