From 8873e4d2eba41a818c5649896d4e9897cdb00509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 1 Apr 2019 11:15:38 +0200 Subject: [PATCH] Version18.92.2 --- swad_action.c | 14 +++++++------- swad_changelog.h | 3 ++- swad_menu.c | 2 +- swad_notification.c | 4 ++-- swad_search.c | 3 ++- swad_tab.c | 2 +- swad_tab.h | 2 +- swad_text.c | 6 +++--- swad_timeline.c | 3 ++- swad_user.c | 37 ++++++++++++++++++++++--------------- 10 files changed, 43 insertions(+), 33 deletions(-) diff --git a/swad_action.c b/swad_action.c index bea7731d..0e16d7fd 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1610,13 +1610,13 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRefOldSocPubUsr*/{1511,-1,TabUnk,ActRefOldSocPubUsr ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TL_RefreshOldTimelineUsr ,NULL}, /* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Plg_WebService ,NULL}, - // TabSta ****************************************************************** - /* ActFrmLogIn */{1521, 0,TabSta,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WriteLandingPage ,"power-off" }, - /* ActReqSch */{ 627, 1,TabSta,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sch_ReqSysSearch ,"search" }, - /* ActSeeSocTmlGbl */{1490, 2,TabSta,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ShowTimelineGbl2 ,"comment-dots" }, - /* ActSeeSocPrf */{1520, 3,TabSta,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_SeeSocialProfiles ,"user-check" }, - /* ActSeeCal */{1622, 4,TabSta,ActSeeCal ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cal_ShowCalendar ,"calendar" }, - /* ActSeeNtf */{ 990, 5,TabSta,ActSeeNtf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ntf_ShowMyNotifications ,"bell" }, + // TabStr ****************************************************************** + /* ActFrmLogIn */{1521, 0,TabStr,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WriteLandingPage ,"power-off" }, + /* ActReqSch */{ 627, 1,TabStr,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sch_ReqSysSearch ,"search" }, + /* ActSeeSocTmlGbl */{1490, 2,TabStr,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_ShowTimelineGbl1 ,TL_ShowTimelineGbl2 ,"comment-dots" }, + /* ActSeeSocPrf */{1520, 3,TabStr,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_SeeSocialProfiles ,"user-check" }, + /* ActSeeCal */{1622, 4,TabStr,ActSeeCal ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cal_ShowCalendar ,"calendar" }, + /* ActSeeNtf */{ 990, 5,TabStr,ActSeeNtf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ntf_ShowMyNotifications ,"bell" }, /* ActLogIn */{ 6,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, /* ActLogInNew */{1585,-1,TabUnk,ActFrmLogIn ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WelcomeUsr ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 306e0912..e328244e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -464,10 +464,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.92.1 (2019-04-01)" +#define Log_PLATFORM_VERSION "SWAD 18.92.2 (2019-04-01)" #define CSS_FILE "swad18.92.css" #define JS_FILE "swad18.92.js" /* + Version 18.92.2: Apr 01, 2019 Code refactoring related to user login and actions. (241379 lines) Version 18.92.1: Apr 01, 2019 Fixed bug in tests, reported by Javier Fernández Baldomero. (241371 lines) Version 18.92: Mar 29, 2019 Changes in timeline layout. (241367 lines) Version 18.91.1: Mar 29, 2019 Changes in timeline layout. (241345 lines) diff --git a/swad_menu.c b/swad_menu.c index d42b9ead..2e86652a 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -86,7 +86,7 @@ const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB 0, // 11 0, // 12 }, - // TabSta ******************* + // TabStr ******************* { ActFrmLogIn, // 0 ActReqSch, // 1 diff --git a/swad_notification.c b/swad_notification.c index 13fa38ed..6eefa2de 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -1499,12 +1499,12 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent, } /*****************************************************************************/ -/********* Reset my number of new received notifications to 0 ****************/ +/*************** Reset my number of new notifications to 0 *******************/ /*****************************************************************************/ static void Ntf_UpdateMyLastAccessToNotifications (void) { - /***** Reset to 0 my number of new received messages *****/ + /***** Reset to 0 my number of new notifications *****/ DB_QueryUPDATE ("can not update last access to notifications", "UPDATE usr_last SET LastAccNotif=NOW()" " WHERE UsrCod=%ld", diff --git a/swad_search.c b/swad_search.c index 4c97e386..5f96889d 100644 --- a/swad_search.c +++ b/swad_search.c @@ -1168,7 +1168,8 @@ static void Sch_SaveLastSearchIntoSession (void) // WhatToSearch is stored in usr_last for next time I log in // In other existing sessions distinct to this, WhatToSearch will remain unchanged DB_QueryUPDATE ("can not update type of search in user's last data", - "UPDATE usr_last SET WhatToSearch=%u WHERE UsrCod=%ld", + "UPDATE usr_last SET WhatToSearch=%u" + " WHERE UsrCod=%ld", (unsigned) Gbl.Search.WhatToSearch, Gbl.Usrs.Me.UsrDat.UsrCod); } diff --git a/swad_tab.c b/swad_tab.c index 4b1280e0..edb72723 100644 --- a/swad_tab.c +++ b/swad_tab.c @@ -43,7 +43,7 @@ extern struct Globals Gbl; const char *Tab_TabIcons[Tab_NUM_TABS] = { /* TabUnk */ NULL, - /* TabSta */ "home", + /* TabStr */ "home", /* TabSys */ "sitemap", /* TabCty */ "globe", /* TabIns */ "university", diff --git a/swad_tab.h b/swad_tab.h index d512264c..10145ac7 100644 --- a/swad_tab.h +++ b/swad_tab.h @@ -40,7 +40,7 @@ typedef enum { TabUnk = 0, - TabSta = 1, + TabStr = 1, TabSys = 2, TabCty = 3, TabIns = 4, diff --git a/swad_text.c b/swad_text.c index 1e263e3c..72ed8c3e 100644 --- a/swad_text.c +++ b/swad_text.c @@ -18020,7 +18020,7 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = NULL, // 12 }, { - // TabSta ***************************************************** + // TabStr ***************************************************** // 0: ActFrmLogIn #if L==1 // ca "Entrar" @@ -19827,7 +19827,7 @@ const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = NULL, // 12 }, { - // TabSta ***************************************************** + // TabStr ***************************************************** // 0: ActFrmLogIn #if L==1 // ca "Rol en aquesta sessió" @@ -41686,7 +41686,7 @@ const char *Txt_TABS_TXT[Tab_NUM_TABS] = // TabUnk NULL , - // TabSta + // TabStr #if L==1 // ca "Inici" #elif L==2 // de diff --git a/swad_timeline.c b/swad_timeline.c index 97aa844d..3a159ad1 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1282,7 +1282,8 @@ static void TL_SaveWhichUsersInDB (void) /***** Update which users in database *****/ // WhichUsrs is stored in usr_last for next time I log in DB_QueryUPDATE ("can not update timeline users in user's last data", - "UPDATE usr_last SET TimelineUsrs=%u WHERE UsrCod=%ld", + "UPDATE usr_last SET TimelineUsrs=%u" + " WHERE UsrCod=%ld", (unsigned) Gbl.Timeline.WhichUsrs, Gbl.Usrs.Me.UsrDat.UsrCod); } diff --git a/swad_user.c b/swad_user.c index 39b90d99..87b3b083 100644 --- a/swad_user.c +++ b/swad_user.c @@ -789,7 +789,7 @@ static void Usr_GetMyLastData (void) Gbl.Usrs.Me.UsrLast.LastCrs = Str_ConvertStrCodToLongCod (row[1]); /* Get last tab */ - Gbl.Usrs.Me.UsrLast.LastTab = TabPrf; // By default, set last tab to the profile tab + Gbl.Usrs.Me.UsrLast.LastTab = TabStr; // By default, set last tab to the start tab if (sscanf (row[2],"%u",&UnsignedNum) == 1) if (UnsignedNum >= 1 || UnsignedNum <= Tab_NUM_TABS) @@ -3090,28 +3090,37 @@ void Usr_ChkUsrAndGetUsrData (void) { // Don't adjust Gbl.Action.Act here Gbl.Action.Tab = ((Gbl.Usrs.Me.UsrLast.LastTab == TabCrs) && - (Gbl.CurrentCrs.Crs.CrsCod <= 0)) ? TabSys : + (Gbl.CurrentCrs.Crs.CrsCod <= 0)) ? TabStr : Gbl.Usrs.Me.UsrLast.LastTab; Tab_DisableIncompatibleTabs (); } - Usr_UpdateMyLastData (); - Crs_UpdateCrsLast (); } else if (Gbl.Action.Act == ActUnk) // No user logged and unknown action Act_AdjustActionWhenNoUsrLogged (); - /***** When I change to another tab, go to the first option allowed *****/ + /***** When I change to another tab, go to: + - my last action in that tab if it is known, or + - the first option allowed *****/ if (Gbl.Action.Act == ActMnu) { - if (Gbl.Usrs.Me.Logged) - { - if ((Action = MFU_GetMyLastActionInCurrentTab ()) == ActUnk) - Action = Mnu_GetFirstActionAvailableInCurrentTab (); - } - else + /* Get my last action in current tab */ + Action = (Gbl.Usrs.Me.Logged) ? MFU_GetMyLastActionInCurrentTab () : + ActUnk; + if (Action == ActUnk) + /* Get the first option allowed */ Action = Mnu_GetFirstActionAvailableInCurrentTab (); - if (Action != ActUnk) - Gbl.Action.Act = Action; + + Gbl.Action.Act = (Action == ActUnk) ? ((Gbl.Usrs.Me.Logged) ? ActSeeSocTmlGbl : // Default action if logged + ActFrmLogIn) : // Default action if not logged + Action; + Tab_SetCurrentTab (); + } + + /***** Update last data for next time *****/ + if (Gbl.Usrs.Me.Logged) + { + Usr_UpdateMyLastData (); + Crs_UpdateCrsLast (); } } } @@ -3294,8 +3303,6 @@ static void Usr_ShowAlertUsrDoesNotExistsOrWrongPassword (void) { extern const char *Txt_The_user_does_not_exist_or_password_is_incorrect; - // Gbl.Action.Act = ActFrmLogIn; - // Tab_SetCurrentTab (); Ale_ShowAlert (Ale_WARNING,Txt_The_user_does_not_exist_or_password_is_incorrect); }