From f53f29fac99d0c95aa4a81d343c128e07c2844e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 21 Feb 2019 20:04:05 +0100 Subject: [PATCH] Version 18.53 --- sql/swad.sql | 1 + swad_changelog.h | 8 +++- swad_database.c | 4 +- swad_search.c | 3 +- swad_social.c | 101 +++++++++++++++++++++++++++++++++++++++++------ swad_social.h | 9 +++-- swad_text.c | 7 +++- 7 files changed, 111 insertions(+), 22 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index e668c0a44..726c473a3 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1407,6 +1407,7 @@ CREATE TABLE IF NOT EXISTS usr_last ( LastTab TINYINT NOT NULL, LastTime DATETIME NOT NULL, LastAccNotif DATETIME NOT NULL, + TimelineUsrs TINYINT NOT NULL DEFAULT 0, UNIQUE INDEX(UsrCod), INDEX(LastTime)); -- diff --git a/swad_changelog.h b/swad_changelog.h index 3a5b81065..31a3edbcb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -429,11 +429,15 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.52.4 (2019-02-21)" +#define Log_PLATFORM_VERSION "SWAD 18.53 (2019-02-21)" #define CSS_FILE "swad18.52.4.css" #define JS_FILE "swad18.51.js" /* - Version 18.52.4: Feb 21, 2019 Changes in pink theme. (? lines) + Version 18.53: Feb 21, 2019 Last selection of users scope in timeline is saved in database. (237538 lines) + 1 change necessary in database: +ALTER TABLE usr_last ADD COLUMN TimelineUsrs TINYINT NOT NULL DEFAULT 0 AFTER LastAccNotif; + + Version 18.52.4: Feb 21, 2019 Changes in pink theme. (237459 lines) Version 18.52.3: Feb 21, 2019 Fixed bug in removing of old temporary files. (237458 lines) Version 18.52.2: Feb 20, 2019 Fixed bug in reception of images. (237458 lines) Version 18.52.1: Feb 20, 2019 Messages to debug problem with files. (237425 lines) diff --git a/swad_database.c b/swad_database.c index f678c082d..ef7155cf4 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2969,8 +2969,9 @@ mysql> DESCRIBE usr_last; | LastTab | tinyint(4) | NO | | NULL | | | LastTime | datetime | NO | MUL | NULL | | | LastAccNotif | datetime | NO | | NULL | | +| TimelineUsrs | tinyint(4) | NO | | 0 | | +--------------+------------+------+-----+---------+-------+ -6 rows in set (0.00 sec) +7 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_last (" "UsrCod INT NOT NULL," @@ -2979,6 +2980,7 @@ mysql> DESCRIBE usr_last; "LastTab TINYINT NOT NULL," "LastTime DATETIME NOT NULL," "LastAccNotif DATETIME NOT NULL," + "TimelineUsrs TINYINT NOT NULL DEFAULT 0," "UNIQUE INDEX(UsrCod)," "INDEX(LastTime))"); diff --git a/swad_search.c b/swad_search.c index 79272ed2e..30750a32a 100644 --- a/swad_search.c +++ b/swad_search.c @@ -287,7 +287,8 @@ void Sch_GetParamWhatToSearch (void) Sch_NUM_WHAT_TO_SEARCH - 1, (unsigned long) Sch_SEARCH_UNKNOWN); - // If parameter WhatToSearch is not present, use parameter from session + /***** If parameter WhatToSearch is not present, + use parameter from session *****/ if (WhatToSearch != Sch_SEARCH_UNKNOWN) Gbl.Search.WhatToSearch = WhatToSearch; } diff --git a/swad_social.c b/swad_social.c index 1ff9169c0..0cf151f11 100644 --- a/swad_social.c +++ b/swad_social.c @@ -148,6 +148,8 @@ static void Soc_FormStart (Act_Action_t ActionGbl,Act_Action_t ActionUsr); static void Soc_PutFormWhichUsrs (void); static void Soc_PutParamWhichUsrs (void); static void Soc_GetParamsWhichUsrs (void); +static Soc_WhichUsrs_t Soc_GetWhichUsrsFromDB (void); +static void Soc_SaveWhichUsersInDB (void); static void Soc_ShowWarningYouDontFollowAnyUser (void); @@ -277,6 +279,10 @@ void Soc_ShowTimelineGbl1 (void) /***** Get which users *****/ Soc_GetParamsWhichUsrs (); + + /***** Save which users in database *****/ + if (Gbl.Action.Act == ActSeeSocTmlGbl) // Only in action to see global timeline + Soc_SaveWhichUsersInDB (); } void Soc_ShowTimelineGbl2 (void) @@ -572,7 +578,7 @@ static void Soc_BuildQueryToGetTimeline (char **Query, case Soc_TIMELINE_GBL: // Show the global timeline switch (Gbl.Social.WhichUsrs) { - case Soc_FOLLOWED: // Show the timeline of the users I follow + case Soc_USRS_FOLLOWED: // Show the timeline of the users I follow DB_Query ("can not create temporary table", "CREATE TEMPORARY TABLE publishers " "(UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY" @@ -585,9 +591,12 @@ static void Soc_BuildQueryToGetTimeline (char **Query, sprintf (SubQueryPublishers,"social_pubs.PublisherCod=publishers.UsrCod AND "); break; - case Soc_ALL_USRS: // Show the timeline of all users + case Soc_USRS_ALL: // Show the timeline of all users SubQueryPublishers[0] = '\0'; break; + default: + Lay_ShowErrorAndExit ("Wrong parameter which users."); + break; } break; } @@ -700,12 +709,15 @@ static void Soc_BuildQueryToGetTimeline (char **Query, case Soc_TIMELINE_GBL: // Show the global timeline switch (Gbl.Social.WhichUsrs) { - case Soc_FOLLOWED: // Show the timeline of the users I follow + case Soc_USRS_FOLLOWED: // Show the timeline of the users I follow sprintf (SubQueryRangeBottom,"social_pubs.PubCod>%ld AND ",RangePubsToGet.Bottom); break; - case Soc_ALL_USRS: // Show the timeline of all users + case Soc_USRS_ALL: // Show the timeline of all users sprintf (SubQueryRangeBottom,"PubCod>%ld AND ",RangePubsToGet.Bottom); break; + default: + Lay_ShowErrorAndExit ("Wrong parameter which users."); + break; } break; } @@ -721,12 +733,15 @@ static void Soc_BuildQueryToGetTimeline (char **Query, case Soc_TIMELINE_GBL: // Show the global timeline switch (Gbl.Social.WhichUsrs) { - case Soc_FOLLOWED: // Show the timeline of the users I follow + case Soc_USRS_FOLLOWED: // Show the timeline of the users I follow sprintf (SubQueryRangeTop,"social_pubs.PubCod<%ld AND ",RangePubsToGet.Top); break; - case Soc_ALL_USRS: // Show the timeline of all users + case Soc_USRS_ALL: // Show the timeline of all users sprintf (SubQueryRangeTop,"PubCod<%ld AND ",RangePubsToGet.Top); break; + default: + Lay_ShowErrorAndExit ("Wrong parameter which users."); + break; } break; } @@ -750,7 +765,7 @@ static void Soc_BuildQueryToGetTimeline (char **Query, case Soc_TIMELINE_GBL: // Show the global timeline switch (Gbl.Social.WhichUsrs) { - case Soc_FOLLOWED: // Show the timeline of the users I follow + case Soc_USRS_FOLLOWED: // Show the timeline of the users I follow NumPubs = (unsigned) DB_QuerySELECT (&mysql_res,"can not get publishing", "SELECT PubCod,NotCod FROM social_pubs,publishers" @@ -760,7 +775,7 @@ static void Soc_BuildQueryToGetTimeline (char **Query, SubQueryPublishers, SubQueryAlreadyExists); break; - case Soc_ALL_USRS: // Show the timeline of all users + case Soc_USRS_ALL: // Show the timeline of all users NumPubs = (unsigned) DB_QuerySELECT (&mysql_res,"can not get publishing", "SELECT PubCod,NotCod FROM social_pubs" @@ -769,6 +784,9 @@ static void Soc_BuildQueryToGetTimeline (char **Query, SubQueryRangeBottom,SubQueryRangeTop, SubQueryAlreadyExists); break; + default: + Lay_ShowErrorAndExit ("Wrong parameter which users."); + break; } break; } @@ -1057,7 +1075,7 @@ static void Soc_PutFormWhichUsrs (void) fprintf (Gbl.F.Out,"
" "