From af48305df4cc3df411b0921e2f255186716a1c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 6 Mar 2015 23:36:36 +0100 Subject: [PATCH] Version 14.79.2 --- swad_changelog.h | 4 ++-- swad_text.c | 21 --------------------- swad_user.c | 38 ++++++++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 48321ae6b..5c91a8d91 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,12 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.79.1 (2015/03/06)" +#define Log_PLATFORM_VERSION "SWAD 14.79.2 (2015/03/06)" // 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.79.2: Mar 06, 2015 Public profile is shown depending on visibility. (178759 lines) Version 14.79.1: Mar 06, 2015 Add options to change visibility of public profile. (178769 lines) 3 changes necessary in database: ALTER TABLE usr_data ADD COLUMN ProfileVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user' AFTER PhotoVisibility; diff --git a/swad_text.c b/swad_text.c index 5e426b746..9884e025e 100644 --- a/swad_text.c +++ b/swad_text.c @@ -46509,27 +46509,6 @@ const char *Txt_User_ID = "Nº de identif. do utilizador"; #endif -const char *Txt_User_not_found = -#if L==0 - "Usuari no trobat"; -#elif L==1 - "Benutzer nicht gefunden."; -#elif L==2 - "User not found."; -#elif L==3 - "Usuario/a no encontrado/a."; -#elif L==4 - "Utilisateur introuvable."; -#elif L==5 - "Usuario/a no encontrado/a."; // Okoteve traducción -#elif L==6 - "IUtente non trovato."; -#elif L==7 - "Nie znaleziono użytkownika."; -#elif L==8 - "Utilizador não encontrado."; -#endif - const char *Txt_User_not_found_or_you_do_not_have_permission_ = #if L==0 "Usuari no trobat" diff --git a/swad_user.c b/swad_user.c index 65097fa0e..9a7a3172f 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7385,9 +7385,10 @@ void Usr_RequestUserProfile (void) void Usr_ShowUserProfile (void) { - extern const char *Txt_User_not_found; + extern const char *Txt_User_not_found_or_you_do_not_have_permission_; char Nickname[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA + 1]; long OtherUsrCod; + bool Error = false; /***** Get user *****/ if (Gbl.Usrs.Other.UsrDat.UsrCod < 0) @@ -7405,26 +7406,35 @@ void Usr_ShowUserProfile (void) /***** Check if user exists and get his data *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) // Existing user { - if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected + /***** Check if I can see the public profile *****/ + if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility,Gbl.Usrs.Other.UsrDat.UsrCod)) { - /* Get user's role in current course */ - Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); + if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected + { + /* Get user's role in current course */ + Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB = Rol_GetRoleInCrs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); - /* Get if user has accepted enrollment in current course */ - Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + /* Get if user has accepted enrollment in current course */ + Gbl.Usrs.Other.UsrDat.Accepted = Usr_GetIfUserHasAcceptedEnrollmentInCurrentCrs (Gbl.Usrs.Other.UsrDat.UsrCod); + } + + fprintf (Gbl.F.Out,"
"); + + /***** Common record *****/ + Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); + + fprintf (Gbl.F.Out,"
"); } - - fprintf (Gbl.F.Out,"
"); - - /***** Common record *****/ - Rec_ShowSharedUsrRecord (Rec_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat); - - fprintf (Gbl.F.Out,"
"); + else + Error = true; } else + Error = true; + + if (Error) { /***** Show error message *****/ - Lay_ShowAlert (Lay_WARNING,Txt_User_not_found); + Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); /***** Request nickname again *****/ Usr_RequestUserProfile ();