Version18.94.2

This commit is contained in:
Antonio Cañas Vargas 2019-04-03 22:08:44 +02:00
parent 4b2c5f68eb
commit a6d52e1050
3 changed files with 18 additions and 13 deletions

View File

@ -464,10 +464,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.94.1 (2019-04-03)" #define Log_PLATFORM_VERSION "SWAD 18.94.2 (2019-04-03)"
#define CSS_FILE "swad18.92.css" #define CSS_FILE "swad18.92.css"
#define JS_FILE "swad18.92.js" #define JS_FILE "swad18.92.js"
/* /*
Version 18.94.2: Apr 03, 2019 Remember last role even if last access is old. (241531 lines)
Version 18.94.1: Apr 03, 2019 Remember last action and role after login only if last access is recent. (241526 lines) Version 18.94.1: Apr 03, 2019 Remember last action and role after login only if last access is recent. (241526 lines)
Version 18.94: Apr 03, 2019 Code refactoring related to hierarchy. (241513 lines) Version 18.94: Apr 03, 2019 Code refactoring related to hierarchy. (241513 lines)
Version 18.93: Apr 01, 2019 When a user logs in, hierarchy, action and role are got from database. (241533 lines) Version 18.93: Apr 01, 2019 When a user logs in, hierarchy, action and role are got from database. (241533 lines)

View File

@ -533,7 +533,7 @@
#define Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO ((time_t)( 12UL * 60UL * 60UL)) // After these seconds, users can recompute the average photos of a degree #define Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO ((time_t)( 12UL * 60UL * 60UL)) // After these seconds, users can recompute the average photos of a degree
#define Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN ((time_t)( 2UL * 60UL * 60UL)) // On login, if interval since last action is less than this time, remember last action and role #define Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN ((time_t)( 2UL * 60UL * 60UL)) // On login, if interval since last action is less than this time, remember last action
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/

View File

@ -3337,7 +3337,7 @@ static void Usr_SetMyPrefsAndRoles (void)
extern const char *The_ThemeId[The_NUM_THEMES]; extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS]; extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
char URL[PATH_MAX + 1]; char URL[PATH_MAX + 1];
bool GetActionAndRoleFromLastData; bool GetRoleAndActionFromLastData;
Act_Action_t LastSuperAction; Act_Action_t LastSuperAction;
bool JustAfterLogin = Gbl.Action.Act == ActLogIn || bool JustAfterLogin = Gbl.Action.Act == ActLogIn ||
Gbl.Action.Act == ActLogInLan || Gbl.Action.Act == ActLogInLan ||
@ -3399,19 +3399,23 @@ static void Usr_SetMyPrefsAndRoles (void)
Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Valid = true; Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Valid = true;
} }
// Action and role will be got from last data // role and action will be got from last data
GetActionAndRoleFromLastData = true; GetRoleAndActionFromLastData = true;
} }
else // Country (and may be institution, centre, degree or course) selected else // Country (and may be institution, centre, degree or course) selected
// Action and role will be got from last data // Role and action will be got from last data
// only if I am in the same hierarchy location that the stored one // only if I am in the same hierarchy location that the stored one
GetActionAndRoleFromLastData = GetRoleAndActionFromLastData =
(Gbl.Hierarchy.Level == Gbl.Usrs.Me.UsrLast.LastHie.Scope && // The same scope... (Gbl.Hierarchy.Level == Gbl.Usrs.Me.UsrLast.LastHie.Scope && // The same scope...
Gbl.Hierarchy.Cod == Gbl.Usrs.Me.UsrLast.LastHie.Cod); // ...and code in hierarchy Gbl.Hierarchy.Cod == Gbl.Usrs.Me.UsrLast.LastHie.Cod); // ...and code in hierarchy
/***** Get action and role from last data *****/ /***** Get role and action from last data *****/
if (GetActionAndRoleFromLastData) if (GetRoleAndActionFromLastData)
// Remember last action and role only if last access is recent {
/* Get role from last data */
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrLast.LastRole;
/* Last action is really got only if last access is recent */
if (Gbl.Usrs.Me.UsrLast.LastTime >= Gbl.StartExecutionTimeUTC - if (Gbl.Usrs.Me.UsrLast.LastTime >= Gbl.StartExecutionTimeUTC -
Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN) Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN)
{ {
@ -3422,10 +3426,10 @@ static void Usr_SetMyPrefsAndRoles (void)
Gbl.Action.Act = LastSuperAction; Gbl.Action.Act = LastSuperAction;
Tab_SetCurrentTab (); Tab_SetCurrentTab ();
} }
/* Get role from last data */
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrLast.LastRole;
} }
/* If action is not set to last action,
it will be set later to a default action */
}
} }
/***** Set my roles *****/ /***** Set my roles *****/