mirror of https://github.com/acanas/swad-core.git
Version18.94.1
This commit is contained in:
parent
ebf15b3830
commit
4b2c5f68eb
|
@ -1575,6 +1575,8 @@ Profile:
|
|||
1332. ActChgMyTT1stDay Change first day of week and show timetable of the course
|
||||
*/
|
||||
|
||||
#define Act_DEFAULT_ACTION_AFTER_LOGIN ActSeeSocTmlGbl
|
||||
|
||||
/*
|
||||
struct Act_Actions
|
||||
{
|
||||
|
@ -5385,10 +5387,10 @@ void Act_AdjustCurrentAction (void)
|
|||
|
||||
/***** Adjustment 10:
|
||||
--------------
|
||||
Just after login with all checks OK ==> go to timeline *****/
|
||||
Just after login with all checks OK ==> go to default action *****/
|
||||
if (JustAfterLogin)
|
||||
{
|
||||
Gbl.Action.Act = ActSeeSocTmlGbl;
|
||||
Gbl.Action.Act = Act_DEFAULT_ACTION_AFTER_LOGIN;
|
||||
Tab_SetCurrentTab ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -464,10 +464,11 @@ En OpenSWAD:
|
|||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.94 (2019-04-03)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 18.94.1 (2019-04-03)"
|
||||
#define CSS_FILE "swad18.92.css"
|
||||
#define JS_FILE "swad18.92.js"
|
||||
/*
|
||||
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.93: Apr 01, 2019 When a user logs in, hierarchy, action and role are got from database. (241533 lines)
|
||||
5 changes necessary in database:
|
||||
|
|
|
@ -533,6 +533,8 @@
|
|||
|
||||
#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
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
|
18
swad_user.c
18
swad_user.c
|
@ -369,6 +369,7 @@ void Usr_ResetMyLastData (void)
|
|||
Gbl.Usrs.Me.UsrLast.LastHie.Cod = -1L;
|
||||
Gbl.Usrs.Me.UsrLast.LastAct = ActUnk;
|
||||
Gbl.Usrs.Me.UsrLast.LastRole = Rol_UNK;
|
||||
Gbl.Usrs.Me.UsrLast.LastTime = 0;
|
||||
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0;
|
||||
}
|
||||
|
||||
|
@ -766,7 +767,8 @@ static void Usr_GetMyLastData (void)
|
|||
"LastCod," // row[2]
|
||||
"LastAct," // row[3]
|
||||
"LastRole," // row[4]
|
||||
"UNIX_TIMESTAMP(LastAccNotif)" // row[5]
|
||||
"UNIX_TIMESTAMP(LastTime)," // row[5]
|
||||
"UNIX_TIMESTAMP(LastAccNotif)" // row[6]
|
||||
" FROM usr_last WHERE UsrCod=%ld",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if (NumRows == 0)
|
||||
|
@ -822,10 +824,15 @@ static void Usr_GetMyLastData (void)
|
|||
/* Get last role (row[4]) */
|
||||
Gbl.Usrs.Me.UsrLast.LastRole = Rol_ConvertUnsignedStrToRole (row[4]);
|
||||
|
||||
/* Get last access to notifications (row[5]) */
|
||||
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0L;
|
||||
/* Get last access to platform (row[5]) */
|
||||
Gbl.Usrs.Me.UsrLast.LastTime = 0L;
|
||||
if (row[5])
|
||||
sscanf (row[5],"%ld",&(Gbl.Usrs.Me.UsrLast.LastAccNotif));
|
||||
sscanf (row[5],"%ld",&(Gbl.Usrs.Me.UsrLast.LastTime));
|
||||
|
||||
/* Get last access to notifications (row[6]) */
|
||||
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0L;
|
||||
if (row[6])
|
||||
sscanf (row[6],"%ld",&(Gbl.Usrs.Me.UsrLast.LastAccNotif));
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
@ -3404,6 +3411,9 @@ static void Usr_SetMyPrefsAndRoles (void)
|
|||
|
||||
/***** Get action and role from last data *****/
|
||||
if (GetActionAndRoleFromLastData)
|
||||
// Remember last action and role only if last access is recent
|
||||
if (Gbl.Usrs.Me.UsrLast.LastTime >= Gbl.StartExecutionTimeUTC -
|
||||
Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN)
|
||||
{
|
||||
/* Get action from last data */
|
||||
LastSuperAction = Act_GetSuperAction (Gbl.Usrs.Me.UsrLast.LastAct);
|
||||
|
|
|
@ -220,6 +220,7 @@ struct UsrLast
|
|||
} LastHie;
|
||||
Act_Action_t LastAct;
|
||||
Rol_Role_t LastRole;
|
||||
long LastTime;
|
||||
long LastAccNotif;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue