Version19.109.5

This commit is contained in:
Antonio Cañas Vargas 2020-01-02 14:12:22 +01:00
parent c9c91afb45
commit 25dd8e6c92
5 changed files with 36 additions and 39 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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 ();

View File

@ -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] =