Version 15.110.18

This commit is contained in:
Antonio Cañas Vargas 2016-01-13 18:49:46 +01:00
parent eee8051f7c
commit 7859e172e3
2 changed files with 20 additions and 24 deletions

View File

@ -121,19 +121,20 @@
// TODO: Limit text of post/comment in social timeline to 1000 characters? Limit textarea to 20 lines not resizeable. // TODO: Limit text of post/comment in social timeline to 1000 characters? Limit textarea to 20 lines not resizeable.
// TODO: Sinchronize timeline in other actions // TODO: Sinchronize timeline in other actions
// TODO: Optimize Javascript not concatenating big strings in new timeline // TODO: Optimize Javascript not concatenating big strings in new timeline
// TODO: FIX BUG: Timeline is not shown on user's profile
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.110.17 (2016-01-13)" #define Log_PLATFORM_VERSION "SWAD 15.110.18 (2016-01-13)"
#define CSS_FILE "swad15.110.13.css" #define CSS_FILE "swad15.110.13.css"
#define JS_FILE "swad15.110.13.js" #define JS_FILE "swad15.110.13.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.110.19:Jan 13, 2016 Fixed bug in user's timeline. (? lines)
Version 15.110.18:Jan 13, 2016 Optimization in query to get initial recent timeline. (192564 lines)
Version 15.110.17:Jan 13, 2016 Reviewed code related to Soc_MAX_RECENT_PUBS_TO_GET. (192568 lines) Version 15.110.17:Jan 13, 2016 Reviewed code related to Soc_MAX_RECENT_PUBS_TO_GET. (192568 lines)
Version 15.110.16:Jan 13, 2016 Form to go to public profile of author of comment in timeline. (192563 lines) Version 15.110.16:Jan 13, 2016 Form to go to public profile of author of comment in timeline. (192563 lines)
Version 15.110.15:Jan 13, 2016 Form to go to public profile of author of note in timeline. Version 15.110.15:Jan 13, 2016 Form to go to public profile of author of note in timeline.

View File

@ -297,7 +297,7 @@ void Soc_ShowTimelineUsr (void)
extern const char *Txt_Public_activity_OF_A_USER; extern const char *Txt_Public_activity_OF_A_USER;
char Query[512]; char Query[512];
/***** Build query to show timeline with publishing of a unique user *****/ /***** Build query to show timeline with publishings of a unique user *****/
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)" sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,PubType,UNIX_TIMESTAMP(TimePublish)"
" FROM social_pubs" " FROM social_pubs"
" WHERE PublisherCod='%ld'" " WHERE PublisherCod='%ld'"
@ -403,21 +403,15 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
DB_ExitOnMySQLError ("can not create temporary table"); DB_ExitOnMySQLError ("can not create temporary table");
/***** Create temporary table with notes already present in current timeline *****/ /***** Create temporary table with notes already present in current timeline *****/
switch (WhatToGetFromTimeline) if (WhatToGetFromTimeline == Soc_GET_ONLY_OLD_PUBS)
{ {
case Soc_GET_ONLY_OLD_PUBS: sprintf (Query,"CREATE TEMPORARY TABLE current_timeline "
case Soc_GET_RECENT_TIMELINE: "(NotCod BIGINT NOT NULL,"
sprintf (Query,"CREATE TEMPORARY TABLE current_timeline " "UNIQUE INDEX(NotCod)) ENGINE=MEMORY"
"(NotCod BIGINT NOT NULL," " SELECT NotCod FROM social_timelines WHERE SessionId='%s'",
"UNIQUE INDEX(NotCod)) ENGINE=MEMORY" Gbl.Session.Id);
" SELECT NotCod FROM social_timelines WHERE SessionId='%s'", if (mysql_query (&Gbl.mysql,Query))
Gbl.Session.Id); DB_ExitOnMySQLError ("can not create temporary table");
if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table");
break;
case Soc_GET_ONLY_NEW_PUBS:
// Get publishings even if they are already present in current timeline
break;
} }
/***** Create temporary table with publishing codes *****/ /***** Create temporary table with publishing codes *****/
@ -425,21 +419,21 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
// of every set of publishings corresponding to the same note // of every set of publishings corresponding to the same note
switch (WhatToGetFromTimeline) switch (WhatToGetFromTimeline)
{ {
case Soc_GET_RECENT_TIMELINE: case Soc_GET_RECENT_TIMELINE: // Get some limited recent publishings
// Get some limited recent publishings /* This is the first query to get initial timeline shown
==> no notes yet in current timeline table */
sprintf (Query,"CREATE TEMPORARY TABLE pub_cods " sprintf (Query,"CREATE TEMPORARY TABLE pub_cods "
"(NewestPubForNote BIGINT NOT NULL," "(NewestPubForNote BIGINT NOT NULL,"
"UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY" "UNIQUE INDEX(NewestPubForNote)) ENGINE=MEMORY"
" SELECT MAX(PubCod) AS NewestPubForNote" " SELECT MAX(PubCod) AS NewestPubForNote"
" FROM social_pubs" " FROM social_pubs"
" WHERE PublisherCod IN (SELECT UsrCod FROM publishers)" " WHERE PublisherCod IN (SELECT UsrCod FROM publishers)"
" AND NotCod NOT IN (SELECT NotCod FROM current_timeline)"
" GROUP BY NotCod" " GROUP BY NotCod"
" ORDER BY NewestPubForNote DESC LIMIT %u", " ORDER BY NewestPubForNote DESC LIMIT %u",
Soc_MAX_RECENT_PUBS_TO_GET); Soc_MAX_RECENT_PUBS_TO_GET);
break; break;
case Soc_GET_ONLY_NEW_PUBS: case Soc_GET_ONLY_NEW_PUBS: // Get the publishings (without limit) newer than LastPubCod
// Get the publishings (without limit) newer than LastPubCod /* This query is made via AJAX automatically from time to time */
LastPubCod = Soc_GetPubCodFromSession ("LastPubCod"); LastPubCod = Soc_GetPubCodFromSession ("LastPubCod");
if (LastPubCod > 0) if (LastPubCod > 0)
sprintf (SubQueryRangePubs,"PubCod>'%ld' AND ",LastPubCod); sprintf (SubQueryRangePubs,"PubCod>'%ld' AND ",LastPubCod);
@ -455,8 +449,9 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
" ORDER BY NewestPubForNote DESC", " ORDER BY NewestPubForNote DESC",
SubQueryRangePubs); SubQueryRangePubs);
break; break;
case Soc_GET_ONLY_OLD_PUBS: case Soc_GET_ONLY_OLD_PUBS: // Get some limited publishings older than FirstPubCod
// Get some limited publishings older than FirstPubCod /* This query is made via AJAX
when I click in link to get old publishings */
FirstPubCod = Soc_GetPubCodFromSession ("FirstPubCod"); FirstPubCod = Soc_GetPubCodFromSession ("FirstPubCod");
if (FirstPubCod > 0) if (FirstPubCod > 0)
sprintf (SubQueryRangePubs,"PubCod<'%ld' AND ",FirstPubCod); sprintf (SubQueryRangePubs,"PubCod<'%ld' AND ",FirstPubCod);