From a2df48e6bdb95d36f583284bc6c99d5a84b729bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 13 Nov 2016 12:35:01 +0100 Subject: [PATCH] Version 16.54.5 --- swad_changelog.h | 3 ++- swad_global.c | 1 + swad_global.h | 1 + swad_help.c | 2 ++ swad_password.c | 2 +- swad_role.c | 4 +++- swad_user.c | 31 +++++++++++++++++++++++++------ 7 files changed, 35 insertions(+), 9 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 28c11b085..c17b4b30a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -156,13 +156,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.54.4 (2016-11-13)" +#define Log_PLATFORM_VERSION "SWAD 16.54.5 (2016-11-13)" #define CSS_FILE "swad16.51.css" #define JS_FILE "swad16.46.1.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 16.54.5: Nov 13, 2016 Frame and contextual help on role. (206771 lines) Version 16.54.4: Nov 13, 2016 Contextual help on creating a new account (sign up). (206747 lines) Version 16.54.3: Nov 13, 2016 Contextual help on log in. (206740 lines) Version 16.54.2: Nov 13, 2016 Contextual help on user's password. (206735 lines) diff --git a/swad_global.c b/swad_global.c index 1c0c064ec..cd4ba497b 100644 --- a/swad_global.c +++ b/swad_global.c @@ -160,6 +160,7 @@ void Gbl_InitializeGlobals (void) Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.LoggedRoleBeforeCloseSession = Gbl.Usrs.Me.MaxRole = Rol_UNKNOWN; + Gbl.Usrs.Me.RoleHasChanged = false; Gbl.Usrs.Me.IBelongToCurrentIns = false; Gbl.Usrs.Me.IBelongToCurrentCtr = false; Gbl.Usrs.Me.IBelongToCurrentDeg = false; diff --git a/swad_global.h b/swad_global.h index 55fd8c877..f59f83f9c 100644 --- a/swad_global.h +++ b/swad_global.h @@ -286,6 +286,7 @@ struct Globals Rol_Role_t LoggedRole; Rol_Role_t LoggedRoleBeforeCloseSession; Rol_Role_t MaxRole; + bool RoleHasChanged; // Set when I have changed my role char UsrIdLogin[Usr_MAX_BYTES_USR_LOGIN+1]; // String to store the ID, nickname or e-mail entered in the user's login char LoginPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD+1]; char LoginEncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64+1]; diff --git a/swad_help.c b/swad_help.c index 2934abd83..7c57244b3 100644 --- a/swad_help.c +++ b/swad_help.c @@ -56,6 +56,8 @@ const char *Hlp_PROFILE_Sign_up = "https://github.com/acanas/swad-core/wiki/PROFILE.Sign%20up"; const char *Hlp_PROFILE_Account = "https://github.com/acanas/swad-core/wiki/PROFILE.Account"; +const char *Hlp_PROFILE_Session_role = + "https://github.com/acanas/swad-core/wiki/PROFILE.Session#role"; const char *Hlp_PROFILE_Password = "https://github.com/acanas/swad-core/wiki/PROFILE.Password"; diff --git a/swad_password.c b/swad_password.c index 8e849e086..dfe1f2e39 100644 --- a/swad_password.c +++ b/swad_password.c @@ -259,7 +259,7 @@ void Pwd_ShowFormSendNewPwd (void) The_ClassForm[Gbl.Prefs.Theme],Txt_nick_email_or_ID, Usr_MAX_LENGTH_USR_LOGIN,Gbl.Usrs.Me.UsrIdLogin); - /***** Send button and end table *****/ + /***** Send button and end frame *****/ Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Get_a_new_password); /***** End form *****/ diff --git a/swad_role.c b/swad_role.c index 3f96ffa3b..088381469 100644 --- a/swad_role.c +++ b/swad_role.c @@ -330,8 +330,10 @@ void Rol_ChangeMyRole (void) if (!(Gbl.Usrs.Me.AvailableRoles & (1 << UnsignedNum))) return; - /* New role is correct and is allowed for me, so change my logged user type */ + /* New role is correct and is allowed for me, + so change my logged user type */ Gbl.Usrs.Me.LoggedRole = (Rol_Role_t) UnsignedNum; + Gbl.Usrs.Me.RoleHasChanged = true; /* Update logged role in session */ Ses_UpdateSessionDataInDB (); diff --git a/swad_user.c b/swad_user.c index c9621acf4..16ecdbe6a 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2696,12 +2696,15 @@ static void Usr_SetUsrRoleAndPrefs (void) void Usr_ShowFormsLogoutAndRole (void) { + extern const char *Hlp_PROFILE_Session_role; extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_Log_out; + extern const char *Txt_Role; extern const char *Txt_You_are_LOGGED_as_X; extern const char *Txt_logged[Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; - extern const char *Txt_Role; + extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + unsigned NumAvailableRoles; /***** Link to log out *****/ fprintf (Gbl.F.Out,"
"); @@ -2712,13 +2715,20 @@ void Usr_ShowFormsLogoutAndRole (void) fprintf (Gbl.F.Out,"
"); /***** Write message with my new logged role *****/ - sprintf (Gbl.Message,Txt_You_are_LOGGED_as_X, - Txt_logged[Gbl.Usrs.Me.UsrDat.Sex], - Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); - Lay_ShowAlert (Lay_INFO,Gbl.Message); + if (Gbl.Usrs.Me.RoleHasChanged) + { + sprintf (Gbl.Message,Txt_You_are_LOGGED_as_X, + Txt_logged[Gbl.Usrs.Me.UsrDat.Sex], + Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); + Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); + } + + /***** Start frame *****/ + Lay_StartRoundFrame (NULL,Txt_Role,NULL,Hlp_PROFILE_Session_role); /***** Put a form to change my role *****/ - if (Rol_GetNumAvailableRoles () > 1) + NumAvailableRoles = Rol_GetNumAvailableRoles (); + if (NumAvailableRoles > 1) { fprintf (Gbl.F.Out,"
" "%s: ", @@ -2726,6 +2736,15 @@ void Usr_ShowFormsLogoutAndRole (void) Rol_PutFormToChangeMyRole (false); fprintf (Gbl.F.Out,"
"); } + else + fprintf (Gbl.F.Out,"
" + "%s: %s" + "
", + Txt_Role, + Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.LoggedRole][Gbl.Usrs.Me.UsrDat.Sex]); + + /***** End frame *****/ + Lay_EndRoundFrame (); } /*****************************************************************************/