From 25dd8e6c92f4fc245f50838d58905c4f44f65e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 2 Jan 2020 14:12:22 +0100 Subject: [PATCH] Version19.109.5 --- swad_action.c | 4 +++- swad_action.h | 1 - swad_changelog.h | 3 ++- swad_log.c | 49 +++++++++++++++++++++------------------------- swad_text_action.c | 18 ++++++++--------- 5 files changed, 36 insertions(+), 39 deletions(-) diff --git a/swad_action.c b/swad_action.c index 289931658..52b37004b 100644 --- a/swad_action.c +++ b/swad_action.c @@ -4984,6 +4984,8 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un /**************************** Private prototypes *****************************/ /*****************************************************************************/ +static const char *Act_GetActionTextFromDB (long ActCod); // TODO: Remove when database table actions is removed + /*****************************************************************************/ /****************** Get action from permanent action code ********************/ /*****************************************************************************/ @@ -5189,7 +5191,7 @@ const char *Act_GetActionText (Act_Action_t Action) /********************* Get text for action from database *********************/ /*****************************************************************************/ -const char *Act_GetActionTextFromDB (long ActCod) // TODO: Remove when database table actions is removed +static const char *Act_GetActionTextFromDB (long ActCod) // TODO: Remove when database table actions is removed { extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; MYSQL_RES *mysql_res; diff --git a/swad_action.h b/swad_action.h index c2b937cc5..3c4a73333 100644 --- a/swad_action.h +++ b/swad_action.h @@ -1699,7 +1699,6 @@ const char *Act_GetIcon (Act_Action_t Action); const char *Act_GetTitleAction (Act_Action_t Action); const char *Act_GetSubtitleAction (Act_Action_t Action); const char *Act_GetActionText (Act_Action_t Action); -const char *Act_GetActionTextFromDB (long ActCod); void Act_AdjustActionWhenNoUsrLogged (void); void Act_AdjustCurrentAction (void); diff --git a/swad_changelog.h b/swad_changelog.h index 2cae9457a..c04c1e7ca 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.109.4 (2020-01-02)" +#define Log_PLATFORM_VERSION "SWAD 19.109.5 (2020-01-02)" #define CSS_FILE "swad19.101.5.css" #define JS_FILE "swad19.91.1.js" /* @@ -502,6 +502,7 @@ ps2pdf source.ps destination.pdf // TODO: Version 19.1xx: Jan xx, 2020 Map in country information. (? lines) // TODO: Version 19.1xx: Jan xx, 2020 Map in institution information. (? lines) + Version 19.109.5: Jan 02, 2020 Changed query in last clicks. (278708 lines) Version 19.109.4: Jan 02, 2020 Code refactoring in actions. (278712 lines) Version 19.109.3: Jan 02, 2020 Changing action descriptions from database to swad-core. Not finished. (278839 lines) Version 19.109.2: Jan 02, 2020 Changing action descriptions from database to swad-core. Not finished. (278623 lines) diff --git a/swad_log.c b/swad_log.c index 08c13d54a..33424781e 100644 --- a/swad_log.c +++ b/swad_log.c @@ -231,6 +231,7 @@ void Log_GetAndShowLastClicks (void) unsigned long NumRow; unsigned long NumRows; long ActCod; + Act_Action_t Action; const char *ClassRow; time_t TimeDiff; struct Country Cty; @@ -239,23 +240,18 @@ void Log_GetAndShowLastClicks (void) struct Degree Deg; /***** Get last clicks from database *****/ - /* Important for maximum performance: - do the LIMIT in the big log table before the JOIN */ NumRows = DB_QuerySELECT (&mysql_res,"can not get last clicks", - "SELECT last_logs.LogCod,last_logs.ActCod," - "last_logs.Dif,last_logs.Role," - "last_logs.CtyCod,last_logs.InsCod," - "last_logs.CtrCod,last_logs.DegCod," - "actions.Txt" - " FROM" - " (SELECT LogCod,ActCod," - "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ClickTime) AS Dif," - "Role,CtyCod,InsCod,CtrCod,DegCod" - " FROM log_recent ORDER BY LogCod DESC LIMIT 20)" - " AS last_logs LEFT JOIN actions" // LEFT JOIN because action may be not present in table of actions - " ON last_logs.ActCod=actions.ActCod" - " WHERE actions.Language='es'" // TODO: Change to user's language - " OR actions.Language IS NULL"); // When action is not present in table of actions + "SELECT LogCod," // row[0] + "ActCod," // row[1] + "UNIX_TIMESTAMP()-" + "UNIX_TIMESTAMP(ClickTime)," // row[2] + "Role," // row[3] + "CtyCod," // row[4] + "InsCod," // row[5] + "CtrCod," // row[6] + "DegCod" // row[7] + " FROM log_recent" + " ORDER BY LogCod DESC LIMIT 20"); /***** Write list of connected users *****/ HTM_TABLE_BeginCenterPadding (1); @@ -280,9 +276,10 @@ void Log_GetAndShowLastClicks (void) /* Get action code (row[1]) */ ActCod = Str_ConvertStrCodToLongCod (row[1]); + Action = Act_GetActionFromActCod (ActCod); /* Use a special color for this row depending on the action */ - ClassRow = (Act_GetBrowserTab (Act_GetActionFromActCod (ActCod)) == Act_DOWNLD_FILE) ? "DAT_SMALL_YELLOW" : + ClassRow = (Act_GetBrowserTab (Action) == Act_DOWNLD_FILE) ? "DAT_SMALL_YELLOW" : (ActCod == Act_GetActCod (ActLogIn ) || ActCod == Act_GetActCod (ActLogInNew)) ? "DAT_SMALL_GREEN" : (ActCod == Act_GetActCod (ActLogOut )) ? "DAT_SMALL_RED" : @@ -313,38 +310,36 @@ void Log_GetAndShowLastClicks (void) HTM_TR_Begin (NULL); HTM_TD_Begin ("class=\"LC_CLK %s\"",ClassRow); - HTM_Txt (row[0]); // Click + HTM_Txt (row[0]); // Click HTM_TD_End (); - HTM_TD_Begin ("class=\"LC_TIM %s\"",ClassRow); // Elapsed time + HTM_TD_Begin ("class=\"LC_TIM %s\"",ClassRow); // Elapsed time Dat_WriteHoursMinutesSecondsFromSeconds (TimeDiff); HTM_TD_End (); HTM_TD_Begin ("class=\"LC_ROL %s\"",ClassRow); - HTM_Txt ( // Role + HTM_Txt ( // Role Txt_ROLES_SINGUL_Abc[Rol_ConvertUnsignedStrToRole (row[3])][Usr_SEX_UNKNOWN]); HTM_TD_End (); HTM_TD_Begin ("class=\"LC_CTY %s\"",ClassRow); - HTM_Txt (Cty.Name[Gbl.Prefs.Language]); // Country + HTM_Txt (Cty.Name[Gbl.Prefs.Language]); // Country HTM_TD_End (); HTM_TD_Begin ("class=\"LC_INS %s\"",ClassRow); - HTM_Txt (Ins.ShrtName); // Institution + HTM_Txt (Ins.ShrtName); // Institution HTM_TD_End (); HTM_TD_Begin ("class=\"LC_CTR %s\"",ClassRow); - HTM_Txt (Ctr.ShrtName); // Centre + HTM_Txt (Ctr.ShrtName); // Centre HTM_TD_End (); HTM_TD_Begin ("class=\"LC_DEG %s\"",ClassRow); - HTM_Txt (Deg.ShrtName); // Degree + HTM_Txt (Deg.ShrtName); // Degree HTM_TD_End (); HTM_TD_Begin ("class=\"LC_ACT %s\"",ClassRow); - if (row[8]) - if (row[8][0]) - HTM_Txt (row[8]); // Action + HTM_Txt (Act_GetActionText (Action)); // Action HTM_TD_End (); HTM_TR_End (); diff --git a/swad_text_action.c b/swad_text_action.c index 32091fb45..d51318059 100644 --- a/swad_text_action.c +++ b/swad_text_action.c @@ -190,23 +190,23 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = , [ActSeeSocTmlGbl] = #if L==1 // ca - "Show timeline (global)" // Necessita traducció + "Show timeline global" // Necessita traducció #elif L==2 // de - "Show timeline (global)" // Need Übersetzung + "Show timeline global" // Need Übersetzung #elif L==3 // en - "Show timeline (global)" + "Show timeline global" #elif L==4 // es - "Mostrar timeline (global)" + "Mostrar timeline global" #elif L==5 // fr - "Show timeline (global)" // Besoin de traduction + "Show timeline global" // Besoin de traduction #elif L==6 // gn - "Mostrar timeline (global)" // Okoteve traducción + "Mostrar timeline global" // Okoteve traducción #elif L==7 // it - "Show timeline (global)" // Bisogno di traduzione + "Show timeline global" // Bisogno di traduzione #elif L==8 // pl - "Show timeline (global)" // Potrzebujesz tlumaczenie + "Show timeline global" // Potrzebujesz tlumaczenie #elif L==9 // pt - "Show timeline (global)" // Precisa de tradução + "Show timeline global" // Precisa de tradução #endif , [ActSeeSocPrf] =