swad-core/swad_timeline.c

528 lines
20 KiB
C
Raw Normal View History

2019-03-12 21:25:55 +01:00
// swad_timeline.c: social timeline
2015-12-28 19:23:42 +01:00
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
2021-02-09 12:43:45 +01:00
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
2015-12-28 19:23:42 +01:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General 3 License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2019-03-29 00:57:51 +01:00
2019-11-24 23:51:03 +01:00
/*
2021-02-09 12:43:45 +01:00
mysql> SHOW TABLES LIKE 'tl_%';
+-----------------------+
| Tables_in_swad (tl_%) |
+-----------------------+
| tl_comments |
| tl_comments_fav |
| tl_notes |
| tl_notes_fav |
| tl_posts |
| tl_pubs |
| tl_timelines |
+-----------------------+
7 rows in set (0.00 sec)
2019-11-24 23:51:03 +01:00
The timeline is a set of publications.
A publication can be:
2021-02-09 12:43:45 +01:00
<EFBFBD> an original note (22783, 83% of 27396)
<EFBFBD> a shared note ( 750, 3% of 27396)
<EFBFBD> a comment to a note ( 3863, 14% of 27396)
2021-02-10 14:51:05 +01:00
*Numbers are got from swad.ugr.es on february 2020
2021-02-09 12:43:45 +01:00
____tl_pubs____ _tl_comments_
| | | |
| Publication p |---------->| Comment c |-----+
| (comment) | | (to note 2) | |
|_______________| |_____________| |
| | | | |
<EFBFBD> ... <EFBFBD> <EFBFBD> ... <EFBFBD> |
<EFBFBD> ... <EFBFBD> <EFBFBD> ... <EFBFBD> |
|_______________| |_____________| |
| | | | |
|Publication i+4|---------->| Comment 1 |---+ |
| (comment) | | (to note n) | | |
|_______________| |_____________| | |
| | (3863) | |
|Publication i+3|-- | |
|(original note)| \ | |
|_______________| \ ___tl_notes____ | | exam_announcements
| | \ | | | | | |
|Publication i+2|-- ---->| Note n |<-+ | | Exam announc. | (5571)
|(original note)| \ |(exam announc.)|-(2639)->|_______________|
2021-02-09 12:43:45 +01:00
|_______________| \ |_______________| 12% ____files____
| | \ | | | | |
|Publication i+1|-- ---->| Note n-1 |-(64)--->| Public file | (1473406)
|(original note)| \ | (public file) | <1% |_____________|
|_______________| \ |_______________| | _notices_
| | \ | | | | |
| Publication i |-- ---->| Note n-2 |-(16693)>| Notice | (14793)
|(original note)| \ | (notice) | 73% |_________|
|_______________| \ |_______________| | __tl_posts___
| | \ | | | | |
<EFBFBD> ... <EFBFBD> ---->| Note n-3 |-(3119)->| Post s |
<EFBFBD> ... <EFBFBD> | (tl. post) | 14% | |
|_______________| |_______________| | |_____________|
| | | | | | |
| Publication 3 | <EFBFBD> ... <EFBFBD> | <EFBFBD> ... <EFBFBD> (3119)
| (shared note) |--- <EFBFBD> ... <EFBFBD> | <EFBFBD> ... <EFBFBD>
|_______________| \ |_______________| | |_____________|
| | \ | | | | |
| Publication 2 | ---->| Note 2 |<---+ | Post 1 |
|(original note)|--------->| (tl. post) |-------->| |
|_______________| |_______________| |_____________|
| | | | _forum_post_
| Publication 1 |--------->| Note 1 | | |
|(original note)| | (forum post) |-(268)-->| Forum post | (66226)
|_______________| |_______________| 1% |____________|
(27396) (22783)
2019-11-25 23:18:08 +01:00
2019-11-24 23:51:03 +01:00
A note can be:
2021-02-09 12:43:45 +01:00
<EFBFBD> a timeline post ( 3119, 14% of 22783)
<EFBFBD> a public file ( 64, <1% of 22783)
<EFBFBD> an exam announcement ( 2639, 12% of 22783)
<EFBFBD> a notice (16693, 73% of 22783)
<EFBFBD> a forum post ( 268, 1% of 22783)
2019-11-24 23:51:03 +01:00
written by an author in a date-time.
2015-12-28 19:23:42 +01:00
2021-02-09 12:43:45 +01:00
A note can have comments attached to it.
2019-11-24 23:51:03 +01:00
__________________
|@author |
| Note |
|__________________|
|@author |
| Comment 1 |
|______________|
|@author |
| Comment 2 |
|______________|
| |
| ... |
|______________|
|@author |
| Comment n |
|______________|
*/
2021-02-11 14:39:46 +01:00
/*****************************************************************************/
/*********************************** Headers *********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <linux/limits.h> // For PATH_MAX
#include <stdio.h> // For asprintf
#include "swad_figure.h"
#include "swad_global.h"
#include "swad_message.h"
#include "swad_notification.h"
#include "swad_photo.h"
#include "swad_profile.h"
#include "swad_timeline.h"
#include "swad_timeline_database.h"
2021-02-11 14:39:46 +01:00
#include "swad_timeline_note.h"
2021-02-11 17:45:16 +01:00
#include "swad_timeline_notification.h"
2021-02-11 14:39:46 +01:00
#include "swad_timeline_publication.h"
#include "swad_timeline_who.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/************************* Private constants and types ***********************/
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
2019-11-21 16:47:07 +01:00
/************************* Private global variables **************************/
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
2021-02-08 22:33:41 +01:00
static void TL_GetAndShowOldTimeline (struct TL_Timeline *Timeline);
2016-01-14 01:39:02 +01:00
2020-04-11 00:57:25 +02:00
static void TL_ShowTimeline (struct TL_Timeline *Timeline,
2019-03-13 10:23:41 +01:00
const char *Title,long NotCodToHighlight);
2020-04-08 03:41:05 +02:00
static void TL_PutIconsTimeline (__attribute__((unused)) void *Args);
2017-02-24 03:38:18 +01:00
2015-12-29 14:24:37 +01:00
/*****************************************************************************/
2020-04-11 00:57:25 +02:00
/************************ Initialize global timeline *************************/
2015-12-29 14:24:37 +01:00
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
void TL_InitTimelineGbl (struct TL_Timeline *Timeline)
2017-02-24 03:38:18 +01:00
{
2020-04-11 00:57:25 +02:00
/***** Reset timeline context *****/
TL_ResetTimeline (Timeline);
2017-02-24 03:38:18 +01:00
/***** Mark all my notifications about timeline as seen *****/
2021-02-11 17:20:38 +01:00
TL_Ntf_MarkMyNotifAsSeen ();
2017-02-24 03:38:18 +01:00
/***** Get which users *****/
2021-02-11 13:27:44 +01:00
Timeline->Who = TL_Who_GetGlobalWho ();
2020-04-11 00:57:25 +02:00
}
/*****************************************************************************/
/*************************** Reset timeline context **************************/
/*****************************************************************************/
void TL_ResetTimeline (struct TL_Timeline *Timeline)
{
2021-02-11 17:20:38 +01:00
Timeline->UsrOrGbl = TL_Usr_TIMELINE_GBL;
2021-02-11 14:39:46 +01:00
Timeline->Who = TL_Who_DEFAULT_WHO;
2021-02-11 12:00:06 +01:00
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE;
Timeline->Pubs.Top =
Timeline->Pubs.Bottom = NULL,
Timeline->NotCod = -1L;
Timeline->PubCod = -1L;
2020-04-11 00:57:25 +02:00
}
/*****************************************************************************/
2021-02-08 13:53:19 +01:00
/**************** Show highlighted note and global timeline ******************/
2020-04-11 00:57:25 +02:00
/*****************************************************************************/
void TL_ShowTimelineGbl (void)
{
struct TL_Timeline Timeline;
/***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline);
2019-02-21 20:04:05 +01:00
/***** Save which users in database *****/
2021-02-11 13:27:44 +01:00
TL_Who_SaveWhoInDB (&Timeline);
2020-04-11 00:57:25 +02:00
2021-02-08 13:53:19 +01:00
/***** Show highlighted note and global timeline *****/
2020-04-11 00:57:25 +02:00
TL_ShowNoteAndTimelineGbl (&Timeline);
2017-02-24 03:38:18 +01:00
}
2021-02-08 13:53:19 +01:00
/*****************************************************************************/
/**************** Show highlighted note and global timeline ******************/
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
void TL_ShowNoteAndTimelineGbl (struct TL_Timeline *Timeline)
2015-12-29 14:24:37 +01:00
{
2016-01-25 14:40:57 +01:00
long PubCod;
2021-02-11 00:58:53 +01:00
struct TL_Not_Note Not;
2021-02-08 13:53:19 +01:00
/***** Initialize note code to -1 ==> no highlighted note *****/
2021-02-10 19:53:57 +01:00
Not.NotCod = -1L;
2021-02-08 13:53:19 +01:00
/***** Get parameter with the code of a publication *****/
// This parameter is optional. It can be provided by a notification.
// If > 0 ==> the note is shown highlighted above the timeline
2021-02-11 13:10:08 +01:00
PubCod = TL_Pub_GetParamPubCod ();
2021-02-08 13:53:19 +01:00
/***** If a note should be highlighted ==> get code of note from database *****/
if (PubCod > 0)
Not.NotCod = TL_DB_GetNotCodFromPubCod (PubCod);
2021-02-08 13:53:19 +01:00
/***** If a note should be highlighted ==> show it above the timeline *****/
2021-02-10 19:53:57 +01:00
if (Not.NotCod > 0)
2021-02-08 13:53:19 +01:00
/***** Show the note highlighted above the timeline *****/
2021-02-11 00:58:53 +01:00
TL_Not_ShowHighlightedNote (Timeline,&Not);
2021-02-08 13:53:19 +01:00
/***** Show timeline with possible highlighted note *****/
2021-02-10 19:53:57 +01:00
TL_ShowTimelineGblHighlightingNot (Timeline,Not.NotCod);
2021-02-08 13:53:19 +01:00
}
/*****************************************************************************/
2021-02-08 16:24:29 +01:00
/******************* Show global timeline highlighting a note ****************/
2021-02-08 13:53:19 +01:00
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
void TL_ShowTimelineGblHighlightingNot (struct TL_Timeline *Timeline,
long NotCod)
2016-01-15 14:46:44 +01:00
{
2017-02-27 19:52:04 +01:00
extern const char *Txt_Timeline;
2015-12-29 14:24:37 +01:00
2021-02-11 12:00:06 +01:00
/***** Get list of pubications to show in timeline *****/
2021-02-11 17:20:38 +01:00
Timeline->UsrOrGbl = TL_Usr_TIMELINE_GBL;
2021-02-08 22:33:41 +01:00
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE;
2021-02-11 13:10:08 +01:00
TL_Pub_GetListPubsToShowInTimeline (Timeline);
2015-12-29 14:24:37 +01:00
/***** Show timeline *****/
2021-02-10 00:52:33 +01:00
TL_ShowTimeline (Timeline,Txt_Timeline,NotCod);
2021-02-11 12:00:06 +01:00
/***** Free chained list of publications *****/
2021-02-11 13:10:08 +01:00
TL_Pub_FreeListPubs (Timeline);
2015-12-29 14:24:37 +01:00
}
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
/********************* Show timeline of a selected user **********************/
2015-12-29 14:24:37 +01:00
/*****************************************************************************/
2020-04-11 00:57:25 +02:00
void TL_ShowTimelineUsr (struct TL_Timeline *Timeline)
2015-12-29 14:24:37 +01:00
{
2020-04-11 00:57:25 +02:00
TL_ShowTimelineUsrHighlightingNot (Timeline,-1L);
2016-01-15 14:46:44 +01:00
}
2015-12-29 14:24:37 +01:00
2021-02-08 16:24:29 +01:00
/*****************************************************************************/
/************ Show timeline of a selected user highlighting a note ***********/
/*****************************************************************************/
2021-02-11 00:58:53 +01:00
void TL_ShowTimelineUsrHighlightingNot (struct TL_Timeline *Timeline,
long NotCod)
2016-01-15 14:46:44 +01:00
{
2017-02-27 19:52:04 +01:00
extern const char *Txt_Timeline_OF_A_USER;
2016-01-08 10:27:58 +01:00
2021-02-11 12:00:06 +01:00
/***** Get list of pubications to show in timeline *****/
2021-02-11 17:20:38 +01:00
Timeline->UsrOrGbl = TL_Usr_TIMELINE_USR;
2021-02-08 22:33:41 +01:00
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE;
2021-02-11 13:10:08 +01:00
TL_Pub_GetListPubsToShowInTimeline (Timeline);
2016-01-10 03:10:40 +01:00
/***** Show timeline *****/
2020-04-11 00:57:25 +02:00
TL_ShowTimeline (Timeline,
2021-02-10 00:52:33 +01:00
Str_BuildStringStr (Txt_Timeline_OF_A_USER,
Gbl.Usrs.Other.UsrDat.FrstName),
2019-12-30 18:08:31 +01:00
NotCod);
2019-12-30 21:47:07 +01:00
Str_FreeString ();
2016-01-10 03:10:40 +01:00
2021-02-11 12:00:06 +01:00
/***** Free chained list of publications *****/
2021-02-11 13:10:08 +01:00
TL_Pub_FreeListPubs (Timeline);
2016-01-10 03:10:40 +01:00
}
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
/************** Refresh new publications in timeline via AJAX ****************/
2016-01-14 01:39:02 +01:00
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
void TL_RefreshNewTimelineGbl (void)
2016-01-10 03:10:40 +01:00
{
2020-04-11 00:57:25 +02:00
struct TL_Timeline Timeline;
2018-10-30 03:29:40 +01:00
2017-02-06 01:23:33 +01:00
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything
{
2020-04-11 00:57:25 +02:00
/***** Reset timeline context *****/
TL_ResetTimeline (&Timeline);
2017-02-24 03:38:18 +01:00
/***** Get which users *****/
2021-02-11 13:27:44 +01:00
Timeline.Who = TL_Who_GetGlobalWho ();
2017-02-24 03:38:18 +01:00
2021-02-11 12:00:06 +01:00
/***** Get list of pubications to show in timeline *****/
2021-02-11 17:20:38 +01:00
Timeline.UsrOrGbl = TL_Usr_TIMELINE_GBL;
2021-02-08 22:33:41 +01:00
Timeline.WhatToGet = TL_GET_ONLY_NEW_PUBS;
2021-02-11 13:10:08 +01:00
TL_Pub_GetListPubsToShowInTimeline (&Timeline);
2016-01-10 03:10:40 +01:00
2017-02-06 01:23:33 +01:00
/***** Show new timeline *****/
2021-02-11 13:10:08 +01:00
TL_Pub_InsertNewPubsInTimeline (&Timeline);
2021-02-10 00:52:33 +01:00
2021-02-11 12:00:06 +01:00
/***** Free chained list of publications *****/
2021-02-11 13:10:08 +01:00
TL_Pub_FreeListPubs (&Timeline);
2017-02-06 01:23:33 +01:00
}
2016-01-14 01:39:02 +01:00
}
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
/**************** View old publications in timeline via AJAX *****************/
2016-01-14 01:39:02 +01:00
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
void TL_RefreshOldTimelineGbl (void)
2016-01-14 01:39:02 +01:00
{
2020-04-11 00:57:25 +02:00
struct TL_Timeline Timeline;
/***** Reset timeline context *****/
TL_ResetTimeline (&Timeline);
2017-02-24 03:38:18 +01:00
/***** Get which users *****/
2021-02-11 13:27:44 +01:00
Timeline.Who = TL_Who_GetGlobalWho ();
2017-02-24 03:38:18 +01:00
2019-03-06 10:13:39 +01:00
/***** Show old publications *****/
2021-02-11 17:20:38 +01:00
Timeline.UsrOrGbl = TL_Usr_TIMELINE_GBL;
2021-02-08 22:33:41 +01:00
Timeline.WhatToGet = TL_GET_ONLY_OLD_PUBS;
TL_GetAndShowOldTimeline (&Timeline);
2016-01-14 01:39:02 +01:00
}
2019-03-12 21:25:55 +01:00
void TL_RefreshOldTimelineUsr (void)
2016-01-14 01:39:02 +01:00
{
2020-04-11 00:57:25 +02:00
struct TL_Timeline Timeline;
2017-02-17 10:17:39 +01:00
/***** Get user whom profile is displayed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // Existing user
2020-04-11 00:57:25 +02:00
{
/***** Reset timeline context *****/
TL_ResetTimeline (&Timeline);
2019-03-06 10:13:39 +01:00
/***** If user exists, show old publications *****/
2021-02-11 17:20:38 +01:00
Timeline.UsrOrGbl = TL_Usr_TIMELINE_USR;
2021-02-08 22:33:41 +01:00
Timeline.WhatToGet = TL_GET_ONLY_OLD_PUBS;
TL_GetAndShowOldTimeline (&Timeline);
2020-04-11 00:57:25 +02:00
}
2016-01-14 01:39:02 +01:00
}
2016-01-10 14:27:35 +01:00
/*****************************************************************************/
2019-03-06 10:13:39 +01:00
/**************** Get and show old publications in timeline ******************/
2016-01-10 14:27:35 +01:00
/*****************************************************************************/
2021-02-08 22:33:41 +01:00
static void TL_GetAndShowOldTimeline (struct TL_Timeline *Timeline)
2016-01-10 14:27:35 +01:00
{
2021-02-11 12:00:06 +01:00
/***** Get list of pubications to show in timeline *****/
2021-02-11 13:10:08 +01:00
TL_Pub_GetListPubsToShowInTimeline (Timeline);
2016-01-10 14:27:35 +01:00
2016-01-10 16:57:02 +01:00
/***** Show old timeline *****/
2021-02-11 13:10:08 +01:00
TL_Pub_ShowOldPubsInTimeline (Timeline);
2021-02-10 00:52:33 +01:00
2021-02-11 12:00:06 +01:00
/***** Free chained list of publications *****/
2021-02-11 13:10:08 +01:00
TL_Pub_FreeListPubs (Timeline);
2016-01-10 14:27:35 +01:00
}
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
/******************************* Show timeline *******************************/
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
2016-01-17 21:22:01 +01:00
/* _____
/ |_____| just_now_timeline_list (Posts retrieved automatically
| |_____| via AJAX from time to time.
| |_____| They are transferred inmediately
2016-01-17 19:56:56 +01:00
| | to new_timeline_list.)
2016-01-17 21:22:01 +01:00
Hidden < __v__
| |_____| new_timeline_list (Posts retrieved but hidden.
| |_____| When user clicks to view them,
| |_____| they are transferred
\ |_____| to visible timeline_list.)
2016-01-17 19:56:56 +01:00
|
2016-01-17 21:22:01 +01:00
__v__
/ |_____| timeline_list (Posts visible on page)
| |_____|
Visible | |_____|
on < |_____|
page | |_____|
| |_____|
\ |_____|
2016-01-17 19:56:56 +01:00
^
2016-01-17 21:22:01 +01:00
__|__
/ |_____| old_timeline_list (Posts just retrieved via AJAX
| |_____| when user clicks "see more".
| |_____| They are transferred inmediately
Hidden < |_____| to timeline_list.)
| |_____|
| |_____|
\ |_____|
2016-01-17 19:56:56 +01:00
*/
2020-04-11 00:57:25 +02:00
static void TL_ShowTimeline (struct TL_Timeline *Timeline,
2019-03-13 10:23:41 +01:00
const char *Title,long NotCodToHighlight)
2015-12-28 19:23:42 +01:00
{
2019-03-12 21:25:55 +01:00
extern const char *Hlp_START_Timeline;
2021-02-11 13:10:08 +01:00
struct TL_Pub_Publication *Pub;
2021-02-11 00:58:53 +01:00
struct TL_Not_Note Not;
2021-02-11 12:00:06 +01:00
unsigned NumPubs;
2017-02-24 03:38:18 +01:00
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
2015-12-28 19:23:42 +01:00
2019-10-26 02:19:42 +02:00
/***** Begin box *****/
2020-03-26 02:54:30 +01:00
Box_BoxBegin (NULL,Title,
2020-04-08 03:41:05 +02:00
TL_PutIconsTimeline,NULL,
2019-03-12 21:25:55 +01:00
Hlp_START_Timeline,Box_NOT_CLOSABLE);
2015-12-30 18:36:10 +01:00
2017-02-24 03:38:18 +01:00
/***** Put form to select users whom public activity is displayed *****/
if (GlobalTimeline)
2021-02-11 13:27:44 +01:00
TL_Who_PutFormWho (Timeline);
2017-02-24 03:38:18 +01:00
2016-01-12 14:17:47 +01:00
/***** Form to write a new post *****/
if (GlobalTimeline ||
Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod))
2021-02-11 14:39:46 +01:00
TL_Pst_PutFormToWriteNewPost (Timeline);
2016-01-08 15:08:30 +01:00
2019-03-06 10:13:39 +01:00
/***** New publications refreshed dynamically via AJAX *****/
2017-02-24 03:38:18 +01:00
if (GlobalTimeline)
2016-01-14 14:24:20 +01:00
{
2019-03-06 10:13:39 +01:00
/* Link to view new publications via AJAX */
2021-02-11 13:10:08 +01:00
TL_Pub_PutLinkToViewNewPublications ();
2016-01-09 15:00:14 +01:00
2021-02-11 17:20:38 +01:00
/* Hidden list where insert
just received (not visible) publications via AJAX */
2019-10-26 12:25:27 +02:00
HTM_UL_Begin ("id=\"just_now_timeline_list\" class=\"TL_LIST\"");
2019-10-26 02:19:42 +02:00
HTM_UL_End ();
2016-01-14 15:12:42 +01:00
2021-02-11 17:20:38 +01:00
/* Hidden list where insert
new (not visible) publications via AJAX */
2019-10-26 12:25:27 +02:00
HTM_UL_Begin ("id=\"new_timeline_list\" class=\"TL_LIST\"");
2019-10-26 02:19:42 +02:00
HTM_UL_End ();
2016-01-14 14:24:20 +01:00
}
2016-01-10 14:27:35 +01:00
2019-03-06 10:13:39 +01:00
/***** List recent publications in timeline *****/
2019-10-26 12:25:27 +02:00
HTM_UL_Begin ("id=\"timeline_list\" class=\"TL_LIST\"");
2021-02-11 12:00:06 +01:00
for (Pub = Timeline->Pubs.Top, NumPubs = 0;
Pub;
Pub = Pub->Next, NumPubs++)
2016-01-12 14:17:47 +01:00
{
2019-03-12 21:25:55 +01:00
/* Get data of note */
2021-02-11 12:00:06 +01:00
Not.NotCod = Pub->NotCod;
2021-02-11 00:58:53 +01:00
TL_Not_GetDataOfNoteByCod (&Not);
2016-01-05 04:54:00 +01:00
2019-03-12 21:25:55 +01:00
/* Write note */
HTM_LI_Begin ("class=\"%s\"",Not.NotCod == NotCodToHighlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" :
"TL_WIDTH TL_SEP");
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
TL_Pub_GetTopMessage (Pub->PubType),
Pub->PublisherCod);
HTM_LI_End ();
2016-01-12 14:17:47 +01:00
}
2019-10-26 02:19:42 +02:00
HTM_UL_End ();
2015-12-30 18:36:10 +01:00
2021-02-11 12:00:06 +01:00
/***** If the number of publications shown is the maximum,
probably there will be more, so show link to get more *****/
2021-02-11 13:10:08 +01:00
if (NumPubs == TL_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW)
2016-01-12 14:17:47 +01:00
{
2021-02-11 12:00:06 +01:00
/* Link to view old publications via AJAX */
2021-02-11 13:10:08 +01:00
TL_Pub_PutLinkToViewOldPublications ();
2016-01-10 14:27:35 +01:00
2021-02-11 12:00:06 +01:00
/* Hidden list where insert old publications via AJAX */
2019-10-26 12:25:27 +02:00
HTM_UL_Begin ("id=\"old_timeline_list\" class=\"TL_LIST\"");
2019-10-26 02:19:42 +02:00
HTM_UL_End ();
2016-01-12 14:17:47 +01:00
}
2016-01-10 14:27:35 +01:00
2017-06-12 14:16:33 +02:00
/***** End box *****/
2019-10-25 22:48:34 +02:00
Box_BoxEnd ();
2016-01-10 03:10:40 +01:00
}
2016-11-07 10:40:27 +01:00
/*****************************************************************************/
/********************* Put contextual icons in timeline **********************/
/*****************************************************************************/
2020-04-08 03:41:05 +02:00
static void TL_PutIconsTimeline (__attribute__((unused)) void *Args)
2016-11-07 10:40:27 +01:00
{
2020-04-08 03:41:05 +02:00
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_TIMELINE);
2016-11-07 10:40:27 +01:00
}
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
2019-03-12 21:25:55 +01:00
/******************* Write the date of creation of a note ********************/
2015-12-28 19:23:42 +01:00
/*****************************************************************************/
// TimeUTC holds UTC date and time in UNIX format (seconds since 1970)
2021-02-11 00:58:53 +01:00
void TL_WriteDateTime (time_t TimeUTC)
2015-12-28 19:23:42 +01:00
{
2018-11-09 20:47:39 +01:00
char IdDateTime[Frm_MAX_BYTES_ID + 1];
2015-12-28 19:23:42 +01:00
2016-01-11 19:28:43 +01:00
/***** Create unique Id *****/
2018-11-09 20:47:39 +01:00
Frm_SetUniqueId (IdDateTime);
2016-01-10 23:00:15 +01:00
/***** Container where the date-time is written *****/
2019-10-24 00:04:40 +02:00
HTM_DIV_Begin ("id=\"%s\" class=\"TL_RIGHT_TIME DAT_LIGHT\"",IdDateTime);
2019-10-23 20:07:56 +02:00
HTM_DIV_End ();
2016-01-10 23:00:15 +01:00
/***** Script to write date and time in browser local time *****/
// This must be out of the div where the output is written
// because it will be evaluated in a loop in JavaScript
2019-11-01 23:35:55 +01:00
Dat_WriteLocalDateHMSFromUTC (IdDateTime,TimeUTC,
2019-11-02 12:10:58 +01:00
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
2019-11-02 11:45:41 +01:00
true,true,false,0x6);
2015-12-28 19:23:42 +01:00
}