Version20.12

This commit is contained in:
acanas 2021-02-08 13:37:25 +01:00
parent 46d06747ee
commit ebcd508541
7 changed files with 115 additions and 110 deletions

View File

@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.11.1 (2021-02-07)" #define Log_PLATFORM_VERSION "SWAD 20.12 (2021-02-08)"
#define CSS_FILE "swad20.8.css" #define CSS_FILE "swad20.8.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
@ -600,6 +600,7 @@ TODO: DNI de un estudiante sale err
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
Version 20.12: Feb 08, 2021 Code refactoring in timeline. (304882 lines)
Version 20.11.1: Feb 07, 2021 Fixed bugs in assigments pagination. (304880 lines) Version 20.11.1: Feb 07, 2021 Fixed bugs in assigments pagination. (304880 lines)
Version 20.11: Feb 07, 2021 An editing teacher can access and modify all files in all projects in course. (304875 lines) Version 20.11: Feb 07, 2021 An editing teacher can access and modify all files in all projects in course. (304875 lines)
Version 20.10.3: Feb 07, 2021 Fixed bug when a teacher changes a student's photo. Reported by Javier Fernández Baldomero. (304871 lines) Version 20.10.3: Feb 07, 2021 Fixed bug when a teacher changes a student's photo. Reported by Javier Fernández Baldomero. (304871 lines)

View File

@ -372,14 +372,13 @@ void ExaAnn_ReceiveExamAnn2 (void)
{ {
struct ExaAnn_ExamAnnouncements *ExamAnns = ExaAnn_GetGlobalExamAnns (); struct ExaAnn_ExamAnnouncements *ExamAnns = ExaAnn_GetGlobalExamAnns ();
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
struct TL_Publication SocPub;
/***** Notify by email about the new exam announcement *****/ /***** Notify by email about the new exam announcement *****/
if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod))) if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod)))
ExaAnn_UpdateNumUsrsNotifiedByEMailAboutExamAnn (ExamAnns->HighlightExaCod,NumUsrsToBeNotifiedByEMail); ExaAnn_UpdateNumUsrsNotifiedByEMailAboutExamAnn (ExamAnns->HighlightExaCod,NumUsrsToBeNotifiedByEMail);
/***** Create a new social note about the new exam announcement *****/ /***** Create a new social note about the new exam announcement *****/
TL_StoreAndPublishNote (TL_NOTE_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);

View File

@ -10211,7 +10211,6 @@ void Brw_ChgFileMetadata (void)
bool PublicFileBeforeEdition; bool PublicFileBeforeEdition;
bool PublicFileAfterEdition; bool PublicFileAfterEdition;
Brw_License_t License; Brw_License_t License;
struct TL_Publication SocPub;
/***** Get parameters related to file browser *****/ /***** Get parameters related to file browser *****/
Brw_GetParAndInitFileBrowser (); Brw_GetParAndInitFileBrowser ();
@ -10278,28 +10277,28 @@ void Brw_ChgFileMetadata (void)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_ADMI_DOC_INS: case Brw_ADMI_DOC_INS:
TL_StoreAndPublishNote (TL_NOTE_INS_DOC_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_INS_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_INS: case Brw_ADMI_SHR_INS:
TL_StoreAndPublishNote (TL_NOTE_INS_SHA_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_INS_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_CTR: case Brw_ADMI_DOC_CTR:
TL_StoreAndPublishNote (TL_NOTE_CTR_DOC_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_CTR_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_CTR: case Brw_ADMI_SHR_CTR:
TL_StoreAndPublishNote (TL_NOTE_CTR_SHA_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_CTR_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_DEG: case Brw_ADMI_DOC_DEG:
TL_StoreAndPublishNote (TL_NOTE_DEG_DOC_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_DEG_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_DEG: case Brw_ADMI_SHR_DEG:
TL_StoreAndPublishNote (TL_NOTE_DEG_SHA_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_DEG_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_CRS: case Brw_ADMI_DOC_CRS:
TL_StoreAndPublishNote (TL_NOTE_CRS_DOC_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_CRS_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_CRS: case Brw_ADMI_SHR_CRS:
TL_StoreAndPublishNote (TL_NOTE_CRS_SHA_PUB_FILE,FileMetadata.FilCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_CRS_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
default: default:
break; break;

View File

@ -3931,7 +3931,6 @@ void For_ReceiveForumPost (void)
bool IsReply = false; bool IsReply = false;
long PstCod = 0; long PstCod = 0;
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
struct TL_Publication SocPub;
char Subject[Cns_MAX_BYTES_SUBJECT + 1]; char Subject[Cns_MAX_BYTES_SUBJECT + 1];
char Content[Cns_MAX_BYTES_LONG_TEXT + 1]; char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
struct Media Media; struct Media Media;
@ -4022,7 +4021,7 @@ void For_ReceiveForumPost (void)
{ {
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_USRS:
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
TL_StoreAndPublishNote (TL_NOTE_FORUM_POST,PstCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_FORUM_POST,PstCod);
break; break;
default: default:
break; break;

View File

@ -136,7 +136,6 @@ void Not_ReceiveNotice (void)
extern const char *Txt_Notice_created; extern const char *Txt_Notice_created;
long NotCod; long NotCod;
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
struct TL_Publication SocPub;
char Content[Cns_MAX_BYTES_TEXT + 1]; char Content[Cns_MAX_BYTES_TEXT + 1];
/***** Get the text of the notice *****/ /***** Get the text of the notice *****/
@ -157,7 +156,7 @@ void Not_ReceiveNotice (void)
Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail); Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail);
/***** Create a new social note about the new notice *****/ /***** Create a new social note about the new notice *****/
TL_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod,&SocPub); TL_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod);
/***** Set notice to be highlighted *****/ /***** Set notice to be highlighted *****/
Gbl.Crs.Notices.HighlightNotCod = NotCod; Gbl.Crs.Notices.HighlightNotCod = NotCod;

View File

@ -61,12 +61,17 @@
/************************* Private constants and types ***********************/ /************************* Private constants and types ***********************/
/*****************************************************************************/ /*****************************************************************************/
// Number of recent publishings got and shown the first time, before refreshing
#define TL_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // Unlimited
#define TL_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
#define TL_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
#define TL_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them #define TL_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them
#define TL_DEF_USRS_SHOWN 5 // Default maximum number of users shown who have share/fav a note #define TL_DEF_USRS_SHOWN 5 // Default maximum number of users shown who have share/fav a note
#define TL_MAX_USRS_SHOWN 1000 // Top maximum number of users shown who have share/fav a note #define TL_MAX_USRS_SHOWN 1000 // Top maximum number of users shown who have share/fav a note
#define TL_MAX_CHARS_IN_POST 1000 #define TL_MAX_CHARS_IN_POST 1000 // Maximum number of characters in a post
#define TL_ICON_ELLIPSIS "ellipsis-h.svg" #define TL_ICON_ELLIPSIS "ellipsis-h.svg"
#define TL_ICON_FAV "heart.svg" #define TL_ICON_FAV "heart.svg"
@ -85,10 +90,10 @@ typedef enum
{ {
TL_GET_ONLY_NEW_PUBS, // New publications are retrieved via AJAX TL_GET_ONLY_NEW_PUBS, // New publications are retrieved via AJAX
// automatically from time to time // automatically from time to time
TL_GET_RECENT_TIMELINE, // Recent timeline is shown when user clicks on action menu,... TL_GET_RECENT_TIMELINE, // Recent timeline is shown when the user clicks on action menu,...
// or after editing timeline // or after editing timeline
TL_GET_ONLY_OLD_PUBS, // Old publications are retrieved via AJAX TL_GET_ONLY_OLD_PUBS, // Old publications are retrieved via AJAX
// when user clicks on link at bottom of timeline // when the user clicks on link at bottom of timeline
} TL_WhatToGetFromTimeline_t; } TL_WhatToGetFromTimeline_t;
struct PostContent struct PostContent
@ -99,7 +104,7 @@ struct PostContent
/* /*
Timeline images will be saved with: Timeline images will be saved with:
· maximum width of TL_IMAGE_SAVED_MAX_HEIGHT · maximum width of TL_IMAGE_SAVED_MAX_HEIGHT
· maximum height of TL_IMAGE_SAVED_MAX_HEIGHT · maximum height of TL_IMAGE_SAVED_MAX_HEIGHT
· maintaining the original aspect ratio (aspect ratio recommended: 3:2) · maintaining the original aspect ratio (aspect ratio recommended: 3:2)
*/ */
@ -146,19 +151,6 @@ struct PostContent
written by an author in a date-time. written by an author in a date-time.
*/ */
struct TL_Note
{
long NotCod;
TL_NoteType_t NoteType; // Timeline post, public file, exam announcement, notice, forum post...
long UsrCod; // Publisher
long HieCod; // Hierarchy code (institution/centre/degree/course)
long Cod; // Code of file, forum post, notice, timeline post...
bool Unavailable; // File, forum post, notice,... unavailable (removed)
time_t DateTimeUTC; // Date-time of publication in UTC time
unsigned NumShared; // Number of times (users) this note has been shared
unsigned NumFavs; // Number of times (users) this note has been favourited
};
/* A note can have comments attached to it. /* A note can have comments attached to it.
__________________ __________________
|@author | |@author |
@ -178,9 +170,44 @@ struct TL_Note
|______________| |______________|
*/ */
struct TL_Comment
#define TL_NUM_PUB_TYPES 4
// If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table tl_notes
typedef enum
{
TL_PUB_UNKNOWN = 0,
TL_PUB_ORIGINAL_NOTE = 1,
TL_PUB_SHARED_NOTE = 2,
TL_PUB_COMMENT_TO_NOTE = 3,
} TL_PubType_t;
struct TL_Publication
{ {
long PubCod; long PubCod;
long NotCod;
long PublisherCod; // Sharer or writer of the publication
TL_PubType_t PubType;
time_t DateTimeUTC;
TL_TopMessage_t TopMessage; // Used to show feedback on the action made
};
struct TL_Note
{
long NotCod; // Unique code/identifier for each note
TL_NoteType_t NoteType; // Timeline post, public file, exam announcement, notice, forum post...
long UsrCod; // Publisher
long HieCod; // Hierarchy code (institution/centre/degree/course)
long Cod; // Code of file, forum post, notice, timeline post...
bool Unavailable; // File, forum post, notice,... unavailable (removed)
time_t DateTimeUTC; // Date-time of publication in UTC time
unsigned NumShared; // Number of times (users) this note has been shared
unsigned NumFavs; // Number of times (users) this note has been favourited
};
struct TL_Comment
{
long PubCod; // Unique code/identifier for each publication
long UsrCod; // Publisher long UsrCod; // Publisher
long NotCod; // Note code to which this comment belongs long NotCod; // Note code to which this comment belongs
time_t DateTimeUTC; // Date-time of publication in UTC time time_t DateTimeUTC; // Date-time of publication in UTC time
@ -190,9 +217,9 @@ struct TL_Comment
typedef enum typedef enum
{ {
TL_SHOW_A_FEW_USRS, // Show a few first favers/sharers TL_SHOW_FEW_USRS, // Show a few first favers/sharers
TL_SHOW_ALL_USRS, // Show all favers/sharers TL_SHOW_ALL_USRS, // Show all favers/sharers
} TL_HowMany_t; } TL_HowManyUsrs_t;
/*****************************************************************************/ /*****************************************************************************/
/************** External global variables from others modules ****************/ /************** External global variables from others modules ****************/
@ -206,6 +233,8 @@ extern struct Globals Gbl;
Usr_Who_t TL_GlobalWho; Usr_Who_t TL_GlobalWho;
#define TL_DEFAULT_WHO Usr_WHO_FOLLOWED
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -273,6 +302,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot,
const struct For_Forums *Forums); const struct For_Forums *Forums);
static void TL_GetNoteSummary (const struct TL_Note *SocNot, static void TL_GetNoteSummary (const struct TL_Note *SocNot,
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]); char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]);
static void TL_StoreAndPublishNoteInternal (TL_NoteType_t NoteType,long Cod,struct TL_Publication *SocPub);
static void TL_PublishNoteInTimeline (struct TL_Publication *SocPub); static void TL_PublishNoteInTimeline (struct TL_Publication *SocPub);
static void TL_PutFormToWriteNewPost (struct TL_Timeline *Timeline); static void TL_PutFormToWriteNewPost (struct TL_Timeline *Timeline);
@ -317,17 +347,17 @@ static void TL_PutDisabledIconShare (unsigned NumShared);
static void TL_PutDisabledIconFav (unsigned NumFavs); static void TL_PutDisabledIconFav (unsigned NumFavs);
static void TL_PutFormToSeeAllSharersNote (const struct TL_Note *SocNot, static void TL_PutFormToSeeAllSharersNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_PutFormToShaNote (const struct TL_Note *SocNot); static void TL_PutFormToShaNote (const struct TL_Note *SocNot);
static void TL_PutFormToUnsNote (const struct TL_Note *SocNot); static void TL_PutFormToUnsNote (const struct TL_Note *SocNot);
static void TL_PutFormToSeeAllFaversNote (const struct TL_Note *SocNot, static void TL_PutFormToSeeAllFaversNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_PutFormToFavNote (const struct TL_Note *SocNot); static void TL_PutFormToFavNote (const struct TL_Note *SocNot);
static void TL_PutFormToUnfNote (const struct TL_Note *SocNot); static void TL_PutFormToUnfNote (const struct TL_Note *SocNot);
static void TL_PutFormToSeeAllFaversComment (const struct TL_Comment *SocCom, static void TL_PutFormToSeeAllFaversComment (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_PutFormToFavComment (const struct TL_Comment *SocCom); static void TL_PutFormToFavComment (const struct TL_Comment *SocCom);
static void TL_PutFormToUnfComment (const struct TL_Comment *SocCom); static void TL_PutFormToUnfComment (const struct TL_Comment *SocCom);
@ -341,17 +371,17 @@ static long TL_GetParamPubCod (void);
static long TL_ReceiveComment (void); static long TL_ReceiveComment (void);
static void TL_PutFormToShaUnsNote (const struct TL_Note *SocNot, static void TL_PutFormToShaUnsNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_ShaNote (struct TL_Note *SocNot); static void TL_ShaNote (struct TL_Note *SocNot);
static void TL_UnsNote (struct TL_Note *SocNot); static void TL_UnsNote (struct TL_Note *SocNot);
static void TL_PutFormToFavUnfNote (const struct TL_Note *SocNot, static void TL_PutFormToFavUnfNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_FavNote (struct TL_Note *SocNot); static void TL_FavNote (struct TL_Note *SocNot);
static void TL_UnfNote (struct TL_Note *SocNot); static void TL_UnfNote (struct TL_Note *SocNot);
static void TL_PutFormToFavUnfComment (const struct TL_Comment *SocCom, static void TL_PutFormToFavUnfComment (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_FavComment (struct TL_Comment *SocCom); static void TL_FavComment (struct TL_Comment *SocCom);
static void TL_UnfComment (struct TL_Comment *SocCom); static void TL_UnfComment (struct TL_Comment *SocCom);
@ -380,11 +410,11 @@ static void TL_GetNumTimesANoteHasBeenFav (struct TL_Note *SocNot);
static void TL_GetNumTimesACommHasBeenFav (struct TL_Comment *SocCom); static void TL_GetNumTimesACommHasBeenFav (struct TL_Comment *SocCom);
static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot, static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot, static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom, static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany); TL_HowManyUsrs_t HowManyUsrs);
static void TL_ShowNumSharersOrFavers (unsigned NumUsrs); static void TL_ShowNumSharersOrFavers (unsigned NumUsrs);
static void TL_ShowSharersOrFavers (MYSQL_RES **mysql_res, static void TL_ShowSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsrs,unsigned NumFirstUsrs); unsigned NumUsrs,unsigned NumFirstUsrs);
@ -1829,13 +1859,13 @@ static void TL_WriteNote (struct TL_Timeline *Timeline,
/* Foot column 1: Fav zone */ /* Foot column 1: Fav zone */
HTM_DIV_Begin ("id=\"fav_not_%s_%u\" class=\"TL_FAV_NOT TL_FAV_NOT_WIDTH\"", HTM_DIV_Begin ("id=\"fav_not_%s_%u\" class=\"TL_FAV_NOT TL_FAV_NOT_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_PutFormToFavUnfNote (SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfNote (SocNot,TL_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/* Foot column 2: Share zone */ /* Foot column 2: Share zone */
HTM_DIV_Begin ("id=\"sha_not_%s_%u\" class=\"TL_SHA_NOT TL_SHA_NOT_WIDTH\"", HTM_DIV_Begin ("id=\"sha_not_%s_%u\" class=\"TL_SHA_NOT TL_SHA_NOT_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_PutFormToShaUnsNote (SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToShaUnsNote (SocNot,TL_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/* Foot column 3: Icon to remove this note */ /* Foot column 3: Icon to remove this note */
@ -2226,9 +2256,15 @@ static void TL_GetNoteSummary (const struct TL_Note *SocNot,
/*****************************************************************************/ /*****************************************************************************/
/***************** Store and publish a note into database ********************/ /***************** Store and publish a note into database ********************/
/*****************************************************************************/ /*****************************************************************************/
// Return the code of the new note just created
void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod,struct TL_Publication *SocPub) void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod)
{
struct TL_Publication SocPub;
TL_StoreAndPublishNoteInternal (NoteType,Cod,&SocPub);
}
static void TL_StoreAndPublishNoteInternal (TL_NoteType_t NoteType,long Cod,struct TL_Publication *SocPub)
{ {
long HieCod; // Hierarchy code (institution/centre/degree/course) long HieCod; // Hierarchy code (institution/centre/degree/course)
@ -2611,7 +2647,7 @@ static long TL_ReceivePost (void)
Content.Media.MedCod); Content.Media.MedCod);
/* Insert post in notes */ /* Insert post in notes */
TL_StoreAndPublishNote (TL_NOTE_POST,PstCod,&SocPub); TL_StoreAndPublishNoteInternal (TL_NOTE_POST,PstCod,&SocPub);
/***** Analyze content and store notifications about mentions *****/ /***** Analyze content and store notifications about mentions *****/
Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (SocPub.PubCod,Content.Txt); Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (SocPub.PubCod,Content.Txt);
@ -3173,7 +3209,7 @@ static void TL_WriteComment (struct TL_Timeline *Timeline,
/* Fav zone */ /* Fav zone */
HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"", HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_PutFormToFavUnfComment (SocCom,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfComment (SocCom,TL_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/* Put icon to remove this comment */ /* Put icon to remove this comment */
@ -3286,14 +3322,14 @@ static void TL_PutDisabledIconFav (unsigned NumFavs)
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutFormToSeeAllSharersNote (const struct TL_Note *SocNot, static void TL_PutFormToSeeAllSharersNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
extern const char *Txt_View_all_USERS; extern const char *Txt_View_all_USERS;
char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]; char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
switch (HowMany) switch (HowManyUsrs)
{ {
case TL_SHOW_A_FEW_USRS: case TL_SHOW_FEW_USRS:
/***** Form and icon to mark note as favourite *****/ /***** Form and icon to mark note as favourite *****/
sprintf (ParamCod,"NotCod=%ld",SocNot->NotCod); sprintf (ParamCod,"NotCod=%ld",SocNot->NotCod);
TL_FormFavSha (ActAllShaSocNotGbl,ActAllShaSocNotUsr,ParamCod, TL_FormFavSha (ActAllShaSocNotGbl,ActAllShaSocNotUsr,ParamCod,
@ -3332,14 +3368,14 @@ static void TL_PutFormToUnsNote (const struct TL_Note *SocNot)
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutFormToSeeAllFaversNote (const struct TL_Note *SocNot, static void TL_PutFormToSeeAllFaversNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
extern const char *Txt_View_all_USERS; extern const char *Txt_View_all_USERS;
char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]; char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
switch (HowMany) switch (HowManyUsrs)
{ {
case TL_SHOW_A_FEW_USRS: case TL_SHOW_FEW_USRS:
/***** Form and icon to mark note as favourite *****/ /***** Form and icon to mark note as favourite *****/
sprintf (ParamCod,"NotCod=%ld",SocNot->NotCod); sprintf (ParamCod,"NotCod=%ld",SocNot->NotCod);
TL_FormFavSha (ActAllFavSocNotGbl,ActAllFavSocNotUsr,ParamCod, TL_FormFavSha (ActAllFavSocNotGbl,ActAllFavSocNotUsr,ParamCod,
@ -3378,14 +3414,14 @@ static void TL_PutFormToUnfNote (const struct TL_Note *SocNot)
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutFormToSeeAllFaversComment (const struct TL_Comment *SocCom, static void TL_PutFormToSeeAllFaversComment (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
extern const char *Txt_View_all_USERS; extern const char *Txt_View_all_USERS;
char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]; char ParamCod[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
switch (HowMany) switch (HowManyUsrs)
{ {
case TL_SHOW_A_FEW_USRS: case TL_SHOW_FEW_USRS:
/***** Form and icon to mark comment as favourite *****/ /***** Form and icon to mark comment as favourite *****/
sprintf (ParamCod,"PubCod=%ld",SocCom->PubCod); sprintf (ParamCod,"PubCod=%ld",SocCom->PubCod);
TL_FormFavSha (ActAllFavSocComGbl,ActAllFavSocComUsr,ParamCod, TL_FormFavSha (ActAllFavSocComGbl,ActAllFavSocComUsr,ParamCod,
@ -3626,11 +3662,11 @@ void TL_ShaNoteGbl (void)
TL_ShaNote (&SocNot); TL_ShaNote (&SocNot);
/***** Write HTML inside DIV with form to unshare *****/ /***** Write HTML inside DIV with form to unshare *****/
TL_PutFormToShaUnsNote (&SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToShaUnsNote (&SocNot,TL_SHOW_FEW_USRS);
} }
static void TL_PutFormToShaUnsNote (const struct TL_Note *SocNot, static void TL_PutFormToShaUnsNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
bool IAmTheAuthor; bool IAmTheAuthor;
bool IAmASharerOfThisSocNot; bool IAmASharerOfThisSocNot;
@ -3655,7 +3691,7 @@ static void TL_PutFormToShaUnsNote (const struct TL_Note *SocNot,
HTM_DIV_End (); HTM_DIV_End ();
/***** Show who have shared this note *****/ /***** Show who have shared this note *****/
TL_ShowUsrsWhoHaveSharedNote (SocNot,HowMany); TL_ShowUsrsWhoHaveSharedNote (SocNot,HowManyUsrs);
} }
static void TL_ShaNote (struct TL_Note *SocNot) static void TL_ShaNote (struct TL_Note *SocNot)
@ -3736,7 +3772,7 @@ void TL_FavNoteGbl (void)
TL_FavNote (&SocNot); TL_FavNote (&SocNot);
/***** Write HTML inside DIV with form to unfav *****/ /***** Write HTML inside DIV with form to unfav *****/
TL_PutFormToFavUnfNote (&SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfNote (&SocNot,TL_SHOW_FEW_USRS);
} }
void TL_UnfNoteUsr (void) void TL_UnfNoteUsr (void)
@ -3756,11 +3792,11 @@ void TL_UnfNoteGbl (void)
TL_UnfNote (&SocNot); TL_UnfNote (&SocNot);
/***** Write HTML inside DIV with form to fav *****/ /***** Write HTML inside DIV with form to fav *****/
TL_PutFormToFavUnfNote (&SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfNote (&SocNot,TL_SHOW_FEW_USRS);
} }
static void TL_PutFormToFavUnfNote (const struct TL_Note *SocNot, static void TL_PutFormToFavUnfNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
bool IAmTheAuthor; bool IAmTheAuthor;
bool IAmAFaverOfThisSocNot; bool IAmAFaverOfThisSocNot;
@ -3785,7 +3821,7 @@ static void TL_PutFormToFavUnfNote (const struct TL_Note *SocNot,
HTM_DIV_End (); HTM_DIV_End ();
/***** Show who have marked this note as favourite *****/ /***** Show who have marked this note as favourite *****/
TL_ShowUsrsWhoHaveMarkedNoteAsFav (SocNot,HowMany); TL_ShowUsrsWhoHaveMarkedNoteAsFav (SocNot,HowManyUsrs);
} }
static void TL_FavNote (struct TL_Note *SocNot) static void TL_FavNote (struct TL_Note *SocNot)
@ -3904,7 +3940,7 @@ void TL_FavCommentGbl (void)
TL_FavComment (&SocCom); TL_FavComment (&SocCom);
/***** Write HTML inside DIV with form to unfav *****/ /***** Write HTML inside DIV with form to unfav *****/
TL_PutFormToFavUnfComment (&SocCom,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfComment (&SocCom,TL_SHOW_FEW_USRS);
} }
void TL_UnfCommentUsr (void) void TL_UnfCommentUsr (void)
@ -3924,11 +3960,11 @@ void TL_UnfCommentGbl (void)
TL_UnfComment (&SocCom); TL_UnfComment (&SocCom);
/***** Write HTML inside DIV with form to fav *****/ /***** Write HTML inside DIV with form to fav *****/
TL_PutFormToFavUnfComment (&SocCom,TL_SHOW_A_FEW_USRS); TL_PutFormToFavUnfComment (&SocCom,TL_SHOW_FEW_USRS);
} }
static void TL_PutFormToFavUnfComment (const struct TL_Comment *SocCom, static void TL_PutFormToFavUnfComment (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
bool IAmTheAuthor; bool IAmTheAuthor;
bool IAmAFaverOfThisSocCom; bool IAmAFaverOfThisSocCom;
@ -3954,7 +3990,7 @@ static void TL_PutFormToFavUnfComment (const struct TL_Comment *SocCom,
HTM_DIV_End (); HTM_DIV_End ();
/***** Show who have marked this comment as favourite *****/ /***** Show who have marked this comment as favourite *****/
TL_ShowUsrsWhoHaveMarkedCommAsFav (SocCom,HowMany); TL_ShowUsrsWhoHaveMarkedCommAsFav (SocCom,HowManyUsrs);
} }
static void TL_FavComment (struct TL_Comment *SocCom) static void TL_FavComment (struct TL_Comment *SocCom)
@ -4095,7 +4131,7 @@ void TL_UnsNoteGbl (void)
TL_UnsNote (&SocNot); TL_UnsNote (&SocNot);
/***** Write HTML inside DIV with form to share *****/ /***** Write HTML inside DIV with form to share *****/
TL_PutFormToShaUnsNote (&SocNot,TL_SHOW_A_FEW_USRS); TL_PutFormToShaUnsNote (&SocNot,TL_SHOW_FEW_USRS);
} }
static void TL_UnsNote (struct TL_Note *SocNot) static void TL_UnsNote (struct TL_Note *SocNot)
@ -4917,7 +4953,7 @@ static void TL_GetNumTimesACommHasBeenFav (struct TL_Comment *SocCom)
/*****************************************************************************/ /*****************************************************************************/
static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot, static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumFirstUsrs = 0; unsigned NumFirstUsrs = 0;
@ -4934,7 +4970,7 @@ static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
SocNot->NotCod, SocNot->NotCod,
SocNot->UsrCod, SocNot->UsrCod,
(unsigned) TL_PUB_SHARED_NOTE, (unsigned) TL_PUB_SHARED_NOTE,
HowMany == TL_SHOW_A_FEW_USRS ? TL_DEF_USRS_SHOWN : HowManyUsrs == TL_SHOW_FEW_USRS ? TL_DEF_USRS_SHOWN :
TL_MAX_USRS_SHOWN); TL_MAX_USRS_SHOWN);
/***** Show users *****/ /***** Show users *****/
@ -4945,7 +4981,7 @@ static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
HTM_DIV_Begin ("class=\"TL_USRS\""); HTM_DIV_Begin ("class=\"TL_USRS\"");
TL_ShowSharersOrFavers (&mysql_res,SocNot->NumShared,NumFirstUsrs); TL_ShowSharersOrFavers (&mysql_res,SocNot->NumShared,NumFirstUsrs);
if (NumFirstUsrs < SocNot->NumShared) if (NumFirstUsrs < SocNot->NumShared)
TL_PutFormToSeeAllSharersNote (SocNot,HowMany); TL_PutFormToSeeAllSharersNote (SocNot,HowManyUsrs);
HTM_DIV_End (); HTM_DIV_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -4958,7 +4994,7 @@ static void TL_ShowUsrsWhoHaveSharedNote (const struct TL_Note *SocNot,
/*****************************************************************************/ /*****************************************************************************/
static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot, static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumFirstUsrs = 0; unsigned NumFirstUsrs = 0;
@ -4975,7 +5011,7 @@ static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
" ORDER BY FavCod LIMIT %u", " ORDER BY FavCod LIMIT %u",
SocNot->NotCod, SocNot->NotCod,
SocNot->UsrCod, SocNot->UsrCod,
HowMany == TL_SHOW_A_FEW_USRS ? TL_DEF_USRS_SHOWN : HowManyUsrs == TL_SHOW_FEW_USRS ? TL_DEF_USRS_SHOWN :
TL_MAX_USRS_SHOWN); TL_MAX_USRS_SHOWN);
} }
@ -4987,7 +5023,7 @@ static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
HTM_DIV_Begin ("class=\"TL_USRS\""); HTM_DIV_Begin ("class=\"TL_USRS\"");
TL_ShowSharersOrFavers (&mysql_res,SocNot->NumFavs,NumFirstUsrs); TL_ShowSharersOrFavers (&mysql_res,SocNot->NumFavs,NumFirstUsrs);
if (NumFirstUsrs < SocNot->NumFavs) // Not all are shown if (NumFirstUsrs < SocNot->NumFavs) // Not all are shown
TL_PutFormToSeeAllFaversNote (SocNot,HowMany); TL_PutFormToSeeAllFaversNote (SocNot,HowManyUsrs);
HTM_DIV_End (); HTM_DIV_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -5000,7 +5036,7 @@ static void TL_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Note *SocNot,
/*****************************************************************************/ /*****************************************************************************/
static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom, static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom,
TL_HowMany_t HowMany) TL_HowManyUsrs_t HowManyUsrs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumFirstUsrs = 0; unsigned NumFirstUsrs = 0;
@ -5016,7 +5052,7 @@ static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom,
" ORDER BY FavCod LIMIT %u", " ORDER BY FavCod LIMIT %u",
SocCom->PubCod, SocCom->PubCod,
SocCom->UsrCod, SocCom->UsrCod,
HowMany == TL_SHOW_A_FEW_USRS ? TL_DEF_USRS_SHOWN : HowManyUsrs == TL_SHOW_FEW_USRS ? TL_DEF_USRS_SHOWN :
TL_MAX_USRS_SHOWN); TL_MAX_USRS_SHOWN);
/***** Show users *****/ /***** Show users *****/
@ -5027,7 +5063,7 @@ static void TL_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Comment *SocCom,
HTM_DIV_Begin ("class=\"TL_USRS\""); HTM_DIV_Begin ("class=\"TL_USRS\"");
TL_ShowSharersOrFavers (&mysql_res,SocCom->NumFavs,NumFirstUsrs); TL_ShowSharersOrFavers (&mysql_res,SocCom->NumFavs,NumFirstUsrs);
if (NumFirstUsrs < SocCom->NumFavs) if (NumFirstUsrs < SocCom->NumFavs)
TL_PutFormToSeeAllFaversComment (SocCom,HowMany); TL_PutFormToSeeAllFaversComment (SocCom,HowManyUsrs);
HTM_DIV_End (); HTM_DIV_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/

View File

@ -33,17 +33,10 @@
#define TL_TIMELINE_SECTION_ID "timeline" #define TL_TIMELINE_SECTION_ID "timeline"
// Number of recent publishings got and shown the first time, before refreshing
#define TL_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // Unlimited
#define TL_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
#define TL_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_DEFAULT_WHO Usr_WHO_FOLLOWED
#define TL_NUM_NOTE_TYPES 13 #define TL_NUM_NOTE_TYPES 13
// If the numbers assigned to each event type change, // If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table tl_notes // it is necessary to change old numbers to new ones in database table tl_notes
@ -74,17 +67,6 @@ typedef enum
/* Profile tab */ /* Profile tab */
} TL_NoteType_t; } TL_NoteType_t;
#define TL_NUM_PUB_TYPES 4
// If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table tl_notes
typedef enum
{
TL_PUB_UNKNOWN = 0,
TL_PUB_ORIGINAL_NOTE = 1,
TL_PUB_SHARED_NOTE = 2,
TL_PUB_COMMENT_TO_NOTE = 3,
} TL_PubType_t;
#define TL_NUM_TOP_MESSAGES (1 + 6) #define TL_NUM_TOP_MESSAGES (1 + 6)
typedef enum typedef enum
{ {
@ -97,16 +79,6 @@ typedef enum
TL_TOP_MESSAGE_MENTIONED = 6, TL_TOP_MESSAGE_MENTIONED = 6,
} TL_TopMessage_t; } TL_TopMessage_t;
struct TL_Publication
{
long PubCod;
long NotCod;
long PublisherCod; // Sharer or writer of the publication
TL_PubType_t PubType;
time_t DateTimeUTC;
TL_TopMessage_t TopMessage; // Used to show feedback on the action made
};
struct TL_Timeline struct TL_Timeline
{ {
Usr_Who_t Who; Usr_Who_t Who;
@ -133,7 +105,7 @@ void TL_MarkMyNotifAsSeen (void);
void TL_GetParamWho (void); void TL_GetParamWho (void);
Usr_Who_t TL_GetGlobalWho (void); Usr_Who_t TL_GetGlobalWho (void);
void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod,struct TL_Publication *SocPub); void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod);
void TL_MarkNoteAsUnavailableUsingNotCod (long NotCod); void TL_MarkNoteAsUnavailableUsingNotCod (long NotCod);
void TL_MarkNoteAsUnavailableUsingNoteTypeAndCod (TL_NoteType_t NoteType,long Cod); void TL_MarkNoteAsUnavailableUsingNoteTypeAndCod (TL_NoteType_t NoteType,long Cod);
void TL_MarkNoteOneFileAsUnavailable (const char *Path); void TL_MarkNoteOneFileAsUnavailable (const char *Path);