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
|
1332. ActChgMyTT1stDay Change first day of week and show timetable of the course
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define Act_DEFAULT_ACTION_AFTER_LOGIN ActSeeSocTmlGbl
|
||||||
|
|
||||||
/*
|
/*
|
||||||
struct Act_Actions
|
struct Act_Actions
|
||||||
{
|
{
|
||||||
|
@ -5385,10 +5387,10 @@ void Act_AdjustCurrentAction (void)
|
||||||
|
|
||||||
/***** Adjustment 10:
|
/***** 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)
|
if (JustAfterLogin)
|
||||||
{
|
{
|
||||||
Gbl.Action.Act = ActSeeSocTmlGbl;
|
Gbl.Action.Act = Act_DEFAULT_ACTION_AFTER_LOGIN;
|
||||||
Tab_SetCurrentTab ();
|
Tab_SetCurrentTab ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,10 +464,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
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 CSS_FILE "swad18.92.css"
|
||||||
#define JS_FILE "swad18.92.js"
|
#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.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)
|
||||||
5 changes necessary in database:
|
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_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 *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
38
swad_user.c
38
swad_user.c
|
@ -369,6 +369,7 @@ void Usr_ResetMyLastData (void)
|
||||||
Gbl.Usrs.Me.UsrLast.LastHie.Cod = -1L;
|
Gbl.Usrs.Me.UsrLast.LastHie.Cod = -1L;
|
||||||
Gbl.Usrs.Me.UsrLast.LastAct = ActUnk;
|
Gbl.Usrs.Me.UsrLast.LastAct = ActUnk;
|
||||||
Gbl.Usrs.Me.UsrLast.LastRole = Rol_UNK;
|
Gbl.Usrs.Me.UsrLast.LastRole = Rol_UNK;
|
||||||
|
Gbl.Usrs.Me.UsrLast.LastTime = 0;
|
||||||
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0;
|
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,7 +767,8 @@ static void Usr_GetMyLastData (void)
|
||||||
"LastCod," // row[2]
|
"LastCod," // row[2]
|
||||||
"LastAct," // row[3]
|
"LastAct," // row[3]
|
||||||
"LastRole," // row[4]
|
"LastRole," // row[4]
|
||||||
"UNIX_TIMESTAMP(LastAccNotif)" // row[5]
|
"UNIX_TIMESTAMP(LastTime)," // row[5]
|
||||||
|
"UNIX_TIMESTAMP(LastAccNotif)" // row[6]
|
||||||
" FROM usr_last WHERE UsrCod=%ld",
|
" FROM usr_last WHERE UsrCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
if (NumRows == 0)
|
if (NumRows == 0)
|
||||||
|
@ -822,10 +824,15 @@ static void Usr_GetMyLastData (void)
|
||||||
/* Get last role (row[4]) */
|
/* Get last role (row[4]) */
|
||||||
Gbl.Usrs.Me.UsrLast.LastRole = Rol_ConvertUnsignedStrToRole (row[4]);
|
Gbl.Usrs.Me.UsrLast.LastRole = Rol_ConvertUnsignedStrToRole (row[4]);
|
||||||
|
|
||||||
/* Get last access to notifications (row[5]) */
|
/* Get last access to platform (row[5]) */
|
||||||
Gbl.Usrs.Me.UsrLast.LastAccNotif = 0L;
|
Gbl.Usrs.Me.UsrLast.LastTime = 0L;
|
||||||
if (row[5])
|
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 *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
@ -3404,18 +3411,21 @@ static void Usr_SetMyPrefsAndRoles (void)
|
||||||
|
|
||||||
/***** Get action and role from last data *****/
|
/***** Get action and role from last data *****/
|
||||||
if (GetActionAndRoleFromLastData)
|
if (GetActionAndRoleFromLastData)
|
||||||
{
|
// Remember last action and role only if last access is recent
|
||||||
/* Get action from last data */
|
if (Gbl.Usrs.Me.UsrLast.LastTime >= Gbl.StartExecutionTimeUTC -
|
||||||
LastSuperAction = Act_GetSuperAction (Gbl.Usrs.Me.UsrLast.LastAct);
|
Cfg_MAX_TIME_TO_REMEMBER_LAST_ACTION_ON_LOGIN)
|
||||||
if (LastSuperAction != ActUnk)
|
|
||||||
{
|
{
|
||||||
Gbl.Action.Act = LastSuperAction;
|
/* Get action from last data */
|
||||||
Tab_SetCurrentTab ();
|
LastSuperAction = Act_GetSuperAction (Gbl.Usrs.Me.UsrLast.LastAct);
|
||||||
}
|
if (LastSuperAction != ActUnk)
|
||||||
|
{
|
||||||
|
Gbl.Action.Act = LastSuperAction;
|
||||||
|
Tab_SetCurrentTab ();
|
||||||
|
}
|
||||||
|
|
||||||
/* Get role from last data */
|
/* Get role from last data */
|
||||||
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrLast.LastRole;
|
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrLast.LastRole;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Set my roles *****/
|
/***** Set my roles *****/
|
||||||
|
|
|
@ -220,6 +220,7 @@ struct UsrLast
|
||||||
} LastHie;
|
} LastHie;
|
||||||
Act_Action_t LastAct;
|
Act_Action_t LastAct;
|
||||||
Rol_Role_t LastRole;
|
Rol_Role_t LastRole;
|
||||||
|
long LastTime;
|
||||||
long LastAccNotif;
|
long LastAccNotif;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue