From 07d206430d729f66a89153f4900f058518650ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 5 Feb 2017 22:23:41 +0100 Subject: [PATCH] Version 16.132.14 --- swad_changelog.h | 6 +++++- swad_config.h | 4 ++-- swad_database.c | 2 +- swad_global.c | 4 ++-- swad_global.h | 3 ++- swad_layout.c | 4 ++-- swad_parameter.c | 8 ++++++++ swad_session.c | 8 ++++---- swad_user.c | 6 +++--- 9 files changed, 29 insertions(+), 16 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 26a7ac1b..18450713 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -188,18 +188,22 @@ // TODO: Fix bug: When registering an administrator, the user's name changes are ignored // TODO: In list of indicators, alternate background colors also when not all the number of indicators are selected +// TODO: In "Antes de crear una nueva cuenta, compruebe si ya le han inscrito con su ID", force filling of ID + +// TODO: Ver solución de Guillermo Gómez Trenado cuando se pulsa con el botón derecho para abrir una descarga en otra ventana /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.132.13 (2017-02-01)" +#define Log_PLATFORM_VERSION "SWAD 16.132.14 (2017-02-05)" #define CSS_FILE "swad16.132.4.css" #define JS_FILE "swad16.123.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.132.14:Feb 05, 2017 Bug fixing related to AJAX and automatic refresh. (211916 lines) Version 16.132.13:Feb 01, 2017 Global connected in right column is shown only for system admins. (211904 lines) Version 16.132.12:Feb 01, 2017 Code refactoring and bug fixing in parameters related to users list type. (211900 lines) Version 16.132.11:Feb 01, 2017 Help on indicators of courses. (211900 lines) diff --git a/swad_config.h b/swad_config.h index 9d2af38c..f1abf220 100644 --- a/swad_config.h +++ b/swad_config.h @@ -456,11 +456,11 @@ #define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_REFRESH ((time_t)(Cfg_MAX_TIME_TO_REFRESH_CONNECTED * 2)) // After these seconds without refresh of connected users, session is closed #define Cfg_TIME_TO_CLOSE_SESSION_FROM_LAST_CLICK ((time_t)( 2 * 60UL * 60UL)) // After these seconds without user's clicks, session is closed -#define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 500UL)) // Refresh period of last clicks in miliseconds +#define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 1UL * 1000UL)) // Refresh period of last clicks in miliseconds #define Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE ((time_t)( 30UL * 1000UL)) // Refresh period of social timeline in miliseconds -#define Cfg_TIME_TO_CHANGE_BANNER ((time_t)( 5UL * 60UL)) // After these seconds, change banner +#define Cfg_TIME_TO_CHANGE_BANNER ((time_t)( 2UL * 60UL)) // After these seconds, change banner #define Cfg_NUMBER_OF_BANNERS 1 // Number of banners to show simultaneously #define Cfg_TIME_TO_DELETE_WEB_SERVICE_KEY ((time_t)( 7UL * 24UL * 60UL * 60UL)) // After these seconds, a web service key is removed diff --git a/swad_database.c b/swad_database.c index ee560917..0e4dca02 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1294,7 +1294,7 @@ mysql> DESCRIBE institutions; | FullName | text | NO | | NULL | | | WWW | varchar(255) | NO | | NULL | | +-----------------+--------------+------+-----+---------+----------------+ -7 rows in set (0.01 sec) +7 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS institutions (" "InsCod INT NOT NULL AUTO_INCREMENT," diff --git a/swad_global.c b/swad_global.c index 810fa3d8..7ea37e0c 100644 --- a/swad_global.c +++ b/swad_global.c @@ -180,6 +180,7 @@ void Gbl_InitializeGlobals (void) Gbl.Action.Act = ActUnk; Gbl.Action.UsesAJAX = false; + Gbl.Action.IsAJAXAutoRefresh = false; Gbl.Action.Tab = TabUnk; for (Role = (Rol_Role_t) 0; @@ -437,8 +438,7 @@ void Gbl_Cleanup (void) if (!Gbl.Action.UsesAJAX && !Gbl.WebService.IsWebService && - Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW && - !Gbl.HiddenParamsInsertedIntoDB) + Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW) Ses_RemoveHiddenParFromThisSession (); Usr_FreeMyCourses (); Usr_FreeMyDegrees (); diff --git a/swad_global.h b/swad_global.h index 69dd9552..4587b802 100644 --- a/swad_global.h +++ b/swad_global.h @@ -173,7 +173,8 @@ struct Globals { Tab_Tab_t Tab; Act_Action_t Act; - bool UsesAJAX; + bool UsesAJAX; // Do not generate full HTML page, only the content of a div + bool IsAJAXAutoRefresh; // It's an automatic refresh drom time to time } Action; time_t StartExecutionTimeUTC; struct DateTime Now; diff --git a/swad_layout.c b/swad_layout.c index 5603ade6..3b493516 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1473,7 +1473,7 @@ void Lay_ShowErrorAndExit (const char *Message) /***** Page is generated (except and ). Compute time to generate page *****/ - if (!Gbl.Action.UsesAJAX) + if (!Gbl.Action.IsAJAXAutoRefresh) Sta_ComputeTimeToGeneratePage (); if (Gbl.WebService.IsWebService) // Serving a plugin request @@ -1491,7 +1491,7 @@ void Lay_ShowErrorAndExit (const char *Message) Fil_FastCopyOfOpenFiles (Gbl.F.Out,stdout); Fil_CloseAndRemoveFileForHTMLOutput (); - if (!Gbl.Action.UsesAJAX) + if (!Gbl.Action.IsAJAXAutoRefresh) { /***** Compute time to send page *****/ Sta_ComputeTimeToSendPage (); diff --git a/swad_parameter.c b/swad_parameter.c index 5a19e9c7..587fc4f2 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -719,12 +719,20 @@ void Par_GetMainParameters (void) Gbl.Action.Act = Act_FromActCodToAction[ActCod]; /***** Some preliminary adjusts depending on action *****/ + Gbl.Action.UsesAJAX = false; + Gbl.Action.IsAJAXAutoRefresh = false; if (Gbl.Action.Act == ActRefCon || Gbl.Action.Act == ActRefLstClk || Gbl.Action.Act == ActRefNewSocPubGbl || Gbl.Action.Act == ActRefOldSocPubGbl || Gbl.Action.Act == ActRefOldSocPubUsr) + { Gbl.Action.UsesAJAX = true; + if (Gbl.Action.Act == ActRefCon || + Gbl.Action.Act == ActRefLstClk || + Gbl.Action.Act == ActRefNewSocPubGbl) + Gbl.Action.IsAJAXAutoRefresh = true; + } /***** Get session identifier, if exists *****/ Par_GetParToText ("ses",Gbl.Session.Id,Ses_LENGTH_SESSION_ID); diff --git a/swad_session.c b/swad_session.c index 91344bc8..d304a4c2 100644 --- a/swad_session.c +++ b/swad_session.c @@ -344,8 +344,7 @@ void Ses_InsertHiddenParInDB (Act_Action_t Action,const char *ParamName,const ch /***** Before of inserting the first hidden parameter passed to the next action, delete all the parameters coming from the previous action *****/ - if (!Gbl.HiddenParamsInsertedIntoDB) - Ses_RemoveHiddenParFromThisSession (); + Ses_RemoveHiddenParFromThisSession (); /***** For a unique session-action-parameter, don't insert a parameter more than one time *****/ if (!Ses_CheckIfHiddenParIsAlreadyInDB (Action,ParamName)) @@ -365,9 +364,10 @@ void Ses_InsertHiddenParInDB (Act_Action_t Action,const char *ParamName,const ch void Ses_RemoveHiddenParFromThisSession (void) { - char Query[512]; + char Query[128 + Ses_LENGTH_SESSION_ID]; - if (Gbl.Session.IsOpen) + if (Gbl.Session.IsOpen && // There is an open session + !Gbl.HiddenParamsInsertedIntoDB) // No params just inserted { /***** Remove hidden parameters of this session *****/ sprintf (Query,"DELETE FROM hidden_params WHERE SessionId='%s'", diff --git a/swad_user.c b/swad_user.c index ea4e70d0..63a77621 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2510,7 +2510,7 @@ void Usr_ChkUsrAndGetUsrData (void) if (Gbl.Session.HasBeenDisconnected) { - if (Gbl.Action.Act != ActRefCon) + if (!Gbl.Action.UsesAJAX) { Gbl.Action.Act = ActLogOut; Tab_SetCurrentTab (); @@ -2549,7 +2549,7 @@ void Usr_ChkUsrAndGetUsrData (void) Gbl.Usrs.Me.Logged = true; Usr_SetUsrRoleAndPrefs (); - if (Gbl.Action.Act == ActRefCon) // If refreshing connected users ==> don't refresh session + if (Gbl.Action.IsAJAXAutoRefresh) // If refreshing ==> don't refresh LastTime in session Ses_UpdateSessionLastRefreshInDB (); else { @@ -2613,7 +2613,7 @@ void Usr_ChkUsrAndGetUsrData (void) } /***** Adjust tab and action *****/ - if (Gbl.Action.Act != ActRefCon) + if (!Gbl.Action.UsesAJAX) { if (Gbl.Usrs.Me.Logged) {