diff --git a/swad_changelog.h b/swad_changelog.h index ba17d149..b90379ee 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 20.29 (2021-02-11)" +#define Log_PLATFORM_VERSION "SWAD 20.29.1 (2021-02-11)" #define CSS_FILE "swad20.8.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,6 +601,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: Salvador Romero Cortés: @acanas opción para editar posts + Version 20.29.1: Feb 11, 2021 Code refactoring in timeline. (305780 lines) Version 20.29: Feb 11, 2021 New module swad_timeline_notification. (305767 lines) Version 20.28: Feb 11, 2021 New module swad_timeline_user. (305675 lines) Version 20.27: Feb 11, 2021 New module swad_timeline_post. (305593 lines) diff --git a/swad_timeline.c b/swad_timeline.c index 96729782..10c1984f 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -470,7 +470,7 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline, /* Write note */ TL_Not_WriteNote (Timeline,&Not, - Pub->TopMessage,Pub->PublisherCod, + TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, Not.NotCod == NotCodToHighlight ? TL_HIGHLIGHT : TL_DONT_HIGHLIGHT, TL_DONT_SHOW_ALONE); @@ -513,11 +513,13 @@ void TL_FormStart (const struct TL_Timeline *Timeline, { if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) { + /***** Start form in user timeline *****/ Frm_StartFormAnchor (ActionUsr,"timeline"); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); } else { + /***** Start form in global timeline *****/ Frm_StartForm (ActionGbl); Usr_PutHiddenParamWho (Timeline->Who); } diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 659894e9..7ae13734 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -49,7 +49,7 @@ /************************* Private constants and types ***********************/ /*****************************************************************************/ -#define TL_COM_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them +#define TL_Com_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -208,15 +208,15 @@ void TL_Com_WriteCommentsInNote (struct TL_Timeline *Timeline, and how many final comments will be visible *****/ // Never hide only one comment // So, the number of comments initially hidden must be 0 or >= 2 - if (NumComments <= TL_COM_NUM_VISIBLE_COMMENTS + 1) + if (NumComments <= TL_Com_NUM_VISIBLE_COMMENTS + 1) { NumInitialComments = 0; NumFinalCommentsToGet = NumComments; } else { - NumInitialComments = NumComments - TL_COM_NUM_VISIBLE_COMMENTS; - NumFinalCommentsToGet = TL_COM_NUM_VISIBLE_COMMENTS; + NumInitialComments = NumComments - TL_Com_NUM_VISIBLE_COMMENTS; + NumFinalCommentsToGet = TL_Com_NUM_VISIBLE_COMMENTS; } /***** Get last comments of this note from database *****/ @@ -419,7 +419,7 @@ void TL_Com_ShowHiddenCommentsGbl (void) /***** Write HTML inside DIV with hidden comments *****/ NumInitialCommentsGot = TL_Com_WriteHiddenComments (&Timeline, - NotCod,IdComments,NumInitialCommentsToGet); + NotCod,IdComments,NumInitialCommentsToGet); /***** Link to show the first comments *****/ TL_Com_LinkToShowPreviousComments (IdComments,NumInitialCommentsGot); @@ -812,7 +812,6 @@ static long TL_Com_ReceiveComment (void) return Not.NotCod; } - /*****************************************************************************/ /**************** Request the removal of a comment in a note *****************/ /*****************************************************************************/ diff --git a/swad_timeline_favourite.c b/swad_timeline_favourite.c index 987bc405..3ad5d741 100644 --- a/swad_timeline_favourite.c +++ b/swad_timeline_favourite.c @@ -40,8 +40,8 @@ /************************* Private constants and types ***********************/ /*****************************************************************************/ -#define TL_ICON_FAV "heart.svg" -#define TL_ICON_FAVED "heart-red.svg" +#define TL_Fav_ICON_FAV "heart.svg" +#define TL_Fav_ICON_FAVED "heart-red.svg" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -91,13 +91,13 @@ static void TL_Fav_PutDisabledIconFav (unsigned NumFavs) /***** Disabled icon to mark as favourite *****/ if (NumFavs) { - Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_FAV, + Ico_PutDivIcon ("TL_ICO_DISABLED",TL_Fav_ICON_FAV, Str_BuildStringLong (Txt_TIMELINE_NOTE_Favourited_by_X_USERS, (long) NumFavs)); Str_FreeString (); } else - Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_FAV, + Ico_PutDivIcon ("TL_ICO_DISABLED",TL_Fav_ICON_FAV, Txt_TIMELINE_NOTE_Not_favourited_by_anyone); } @@ -110,9 +110,10 @@ static void TL_Fav_PutFormToFavNote (long ParamCod) extern const char *Txt_Mark_as_favourite; /***** Form and icon to mark note as favourite *****/ - TL_Usr_FormFavSha (ActFavTL_NotGbl,ActFavTL_NotUsr, - "NotCod=%ld",ParamCod, - TL_ICON_FAV,Txt_Mark_as_favourite); + TL_Usr_FormFavSha (ActFavTL_NotGbl, + ActFavTL_NotUsr, + "NotCod=%ld",ParamCod, + TL_Fav_ICON_FAV,Txt_Mark_as_favourite); } static void TL_Fav_PutFormToUnfNote (long ParamCod) @@ -120,9 +121,10 @@ static void TL_Fav_PutFormToUnfNote (long ParamCod) extern const char *Txt_TIMELINE_NOTE_Favourite; /***** Form and icon to unfav (remove mark as favourite) note *****/ - TL_Usr_FormFavSha (ActUnfTL_NotGbl,ActUnfTL_NotUsr, - "NotCod=%ld",ParamCod, - TL_ICON_FAVED,Txt_TIMELINE_NOTE_Favourite); + TL_Usr_FormFavSha (ActUnfTL_NotGbl, + ActUnfTL_NotUsr, + "NotCod=%ld",ParamCod, + TL_Fav_ICON_FAVED,Txt_TIMELINE_NOTE_Favourite); } /*****************************************************************************/ @@ -134,9 +136,10 @@ static void TL_Fav_PutFormToFavComment (long ParamCod) extern const char *Txt_Mark_as_favourite; /***** Form and icon to mark comment as favourite *****/ - TL_Usr_FormFavSha (ActFavTL_ComGbl,ActFavTL_ComUsr, - "PubCod=%ld",ParamCod, - TL_ICON_FAV,Txt_Mark_as_favourite); + TL_Usr_FormFavSha (ActFavTL_ComGbl, + ActFavTL_ComUsr, + "PubCod=%ld",ParamCod, + TL_Fav_ICON_FAV,Txt_Mark_as_favourite); } static void TL_Fav_PutFormToUnfComment (long ParamCod) @@ -144,9 +147,10 @@ static void TL_Fav_PutFormToUnfComment (long ParamCod) extern const char *Txt_TIMELINE_NOTE_Favourite; /***** Form and icon to unfav (remove mark as favourite) comment *****/ - TL_Usr_FormFavSha (ActUnfTL_ComGbl,ActUnfTL_ComUsr, - "PubCod=%ld",ParamCod, - TL_ICON_FAVED,Txt_TIMELINE_NOTE_Favourite); + TL_Usr_FormFavSha (ActUnfTL_ComGbl, + ActUnfTL_ComUsr, + "PubCod=%ld",ParamCod, + TL_Fav_ICON_FAVED,Txt_TIMELINE_NOTE_Favourite); } /*****************************************************************************/ @@ -231,10 +235,10 @@ void TL_Fav_PutFormToFavUnfNote (const struct TL_Not_Note *Not, { /* Put icon to fav/unfav */ IAmAFaverOfThisNot = TL_Fav_CheckIfNoteIsFavedByUsr (Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Usrs.Me.UsrDat.UsrCod); if (IAmAFaverOfThisNot) // I have favourited this note TL_Fav_PutFormToUnfNote (Not->NotCod); - else // I am not a faver of this note + else // I am not a faver of this note TL_Fav_PutFormToFavNote (Not->NotCod); } HTM_DIV_End (); @@ -257,7 +261,7 @@ static void TL_Fav_FavNote (struct TL_Not_Note *Not) ItsMe = Usr_ItsMe (Not->UsrCod); if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author if (!TL_Fav_CheckIfNoteIsFavedByUsr (Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note + Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note { /***** Mark as favourite in database *****/ DB_QueryINSERT ("can not favourite note", @@ -275,7 +279,8 @@ static void TL_Fav_FavNote (struct TL_Not_Note *Not) for the author of the post *****/ OriginalPubCod = TL_Not_GetPubCodOfOriginalNote (Not->NotCod); if (OriginalPubCod > 0) - TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_FAV); + TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod, + Ntf_EVENT_TIMELINE_FAV); } } } @@ -295,7 +300,7 @@ static void TL_Fav_UnfNote (struct TL_Not_Note *Not) if (Not->NumFavs && Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author if (TL_Fav_CheckIfNoteIsFavedByUsr (Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note + Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note { /***** Delete the mark as favourite from database *****/ DB_QueryDELETE ("can not unfavourite note", @@ -398,7 +403,7 @@ void TL_Fav_PutFormToFavUnfComment (const struct TL_Com_Comment *Com, { /* Put icon to mark this comment as favourite */ IAmAFaverOfThisCom = TL_Fav_CheckIfCommIsFavedByUsr (Com->PubCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Usrs.Me.UsrDat.UsrCod); if (IAmAFaverOfThisCom) // I have favourited this comment /* Put icon to unfav this publication and list of users */ TL_Fav_PutFormToUnfComment (Com->PubCod); @@ -444,7 +449,8 @@ static void TL_Fav_FavComment (struct TL_Com_Comment *Com) /**** Create notification about favourite post for the author of the post ***/ - TL_Ntf_CreateNotifToAuthor (Com->UsrCod,Com->PubCod,Ntf_EVENT_TIMELINE_FAV); + TL_Ntf_CreateNotifToAuthor (Com->UsrCod,Com->PubCod, + Ntf_EVENT_TIMELINE_FAV); } } @@ -572,7 +578,7 @@ static void TL_Fav_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Not_Note *Not Not->NotCod, Not->UsrCod, HowManyUsrs == TL_Usr_SHOW_FEW_USRS ? TL_Usr_DEF_USRS_SHOWN : - TL_Usr_MAX_USRS_SHOWN); + TL_Usr_MAX_USRS_SHOWN); else NumFirstUsrs = 0; @@ -587,9 +593,10 @@ static void TL_Fav_ShowUsrsWhoHaveMarkedNoteAsFav (const struct TL_Not_Note *Not TL_Usr_ShowSharersOrFavers (&mysql_res,Not->NumFavs,NumFirstUsrs); if (NumFirstUsrs < Not->NumFavs) // Not all are shown /* Clickable ellipsis to show all users */ - TL_Usr_PutFormToSeeAllFaversSharers (ActAllFavTL_NotGbl,ActAllFavTL_NotUsr, - "NotCod=%ld",Not->NotCod, - HowManyUsrs); + TL_Usr_PutFormToSeeAllFaversSharers (ActAllFavTL_NotGbl, + ActAllFavTL_NotUsr, + "NotCod=%ld",Not->NotCod, + HowManyUsrs); HTM_DIV_End (); /***** Free structure that stores the query result *****/ @@ -619,7 +626,7 @@ static void TL_Fav_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Com_Comment * Com->PubCod, Com->UsrCod, HowManyUsrs == TL_Usr_SHOW_FEW_USRS ? TL_Usr_DEF_USRS_SHOWN : - TL_Usr_MAX_USRS_SHOWN); + TL_Usr_MAX_USRS_SHOWN); else NumFirstUsrs = 0; @@ -634,9 +641,10 @@ static void TL_Fav_ShowUsrsWhoHaveMarkedCommAsFav (const struct TL_Com_Comment * TL_Usr_ShowSharersOrFavers (&mysql_res,Com->NumFavs,NumFirstUsrs); if (NumFirstUsrs < Com->NumFavs) /* Clickable ellipsis to show all users */ - TL_Usr_PutFormToSeeAllFaversSharers (ActAllFavTL_ComGbl,ActAllFavTL_ComUsr, - "PubCod=%ld",Com->PubCod, - HowManyUsrs); + TL_Usr_PutFormToSeeAllFaversSharers (ActAllFavTL_ComGbl, + ActAllFavTL_ComUsr, + "PubCod=%ld",Com->PubCod, + HowManyUsrs); HTM_DIV_End (); /***** Free structure that stores the query result *****/ diff --git a/swad_timeline_note.c b/swad_timeline_note.c index 394c7805..58f67bc0 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -753,7 +753,7 @@ void TL_Not_StoreAndPublishNoteInternal (TL_Not_NoteType_t NoteType,long Cod,str /***** Publish note in timeline *****/ Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; - Pub->PubType = TL_PUB_ORIGINAL_NOTE; + Pub->PubType = TL_Pub_ORIGINAL_NOTE; TL_Pub_PublishPubInTimeline (Pub); } @@ -1156,10 +1156,10 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not) { /* Remove media associated to a post from database */ if (DB_QuerySELECT (&mysql_res,"can not get media", - "SELECT MedCod" // row[0] - " FROM tl_posts" - " WHERE PstCod=%ld", - Not->Cod) == 1) // Result should have a unique row + "SELECT MedCod" // row[0] + " FROM tl_posts" + " WHERE PstCod=%ld", + Not->Cod) == 1) // Result should have a unique row { /* Get media code */ row = mysql_fetch_row (mysql_res); @@ -1300,7 +1300,7 @@ long TL_Not_GetPubCodOfOriginalNote (long NotCod) if (DB_QuerySELECT (&mysql_res,"can not get code of publication", "SELECT PubCod FROM tl_pubs" " WHERE NotCod=%ld AND PubType=%u", - NotCod,(unsigned) TL_PUB_ORIGINAL_NOTE) == 1) // Result should have a unique row + NotCod,(unsigned) TL_Pub_ORIGINAL_NOTE) == 1) // Result should have a unique row { /* Get code of publication (row[0]) */ row = mysql_fetch_row (mysql_res); diff --git a/swad_timeline_notification.c b/swad_timeline_notification.c index 5440d6ea..79929908 100644 --- a/swad_timeline_notification.c +++ b/swad_timeline_notification.c @@ -26,19 +26,15 @@ /*****************************************************************************/ #include // For boolean type -// #include // For malloc and free #include // For string functions #include "swad_database.h" #include "swad_global.h" -// #include "swad_profile.h" #include "swad_timeline.h" -// #include "swad_timeline_favourite.h" #include "swad_timeline_note.h" #include "swad_timeline_notification.h" #include "swad_timeline_post.h" #include "swad_timeline_publication.h" -// #include "swad_timeline_share.h" /*****************************************************************************/ /****************************** Public constants *****************************/ @@ -118,7 +114,7 @@ void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], bool ContentCopied = false; /***** Return nothing on error *****/ - Pub.PubType = TL_PUB_UNKNOWN; + Pub.PubType = TL_Pub_UNKNOWN; SummaryStr[0] = '\0'; // Return nothing on error Content.Txt[0] = '\0'; @@ -139,10 +135,10 @@ void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], /***** Get summary and content *****/ switch (Pub.PubType) { - case TL_PUB_UNKNOWN: + case TL_Pub_UNKNOWN: break; - case TL_PUB_ORIGINAL_NOTE: - case TL_PUB_SHARED_NOTE: + case TL_Pub_ORIGINAL_NOTE: + case TL_Pub_SHARED_NOTE: /* Get data of note */ Not.NotCod = Pub.NotCod; TL_Not_GetDataOfNoteByCod (&Not); diff --git a/swad_timeline_notification.h b/swad_timeline_notification.h index a6741ecf..5a8407e5 100644 --- a/swad_timeline_notification.h +++ b/swad_timeline_notification.h @@ -27,10 +27,7 @@ /********************************** Headers **********************************/ /*****************************************************************************/ -// #include "swad_form.h" -// #include "swad_media.h" #include "swad_notification.h" -// #include "swad_user.h" /*****************************************************************************/ /****************************** Public constants *****************************/ diff --git a/swad_timeline_post.h b/swad_timeline_post.h index ddafe73a..024af4e4 100644 --- a/swad_timeline_post.h +++ b/swad_timeline_post.h @@ -26,12 +26,7 @@ /*****************************************************************************/ /********************************** Headers **********************************/ /*****************************************************************************/ -/* -#include "swad_form.h" -#include "swad_media.h" -#include "swad_notification.h" -#include "swad_user.h" -*/ + /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ diff --git a/swad_timeline_publication.c b/swad_timeline_publication.c index ed8b5bb8..f3810c3e 100644 --- a/swad_timeline_publication.c +++ b/swad_timeline_publication.c @@ -577,7 +577,7 @@ void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline) /* Write note */ TL_Not_WriteNote (Timeline,&Not, - Pub->TopMessage,Pub->PublisherCod, + TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, TL_DONT_HIGHLIGHT, TL_DONT_SHOW_ALONE); } @@ -604,12 +604,29 @@ void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline) /* Write note */ TL_Not_WriteNote (Timeline,&Not, - Pub->TopMessage,Pub->PublisherCod, + TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, TL_DONT_HIGHLIGHT, TL_DONT_SHOW_ALONE); } } +/*****************************************************************************/ +/************* Get a top message given the type of publication ***************/ +/*****************************************************************************/ + +TL_TopMessage_t TL_Pub_GetTopMessage (TL_Pub_PubType_t PubType) + { + static const TL_TopMessage_t TopMessages[TL_Pub_NUM_PUB_TYPES] = + { + [TL_Pub_UNKNOWN ] = TL_TOP_MESSAGE_NONE, + [TL_Pub_ORIGINAL_NOTE ] = TL_TOP_MESSAGE_NONE, + [TL_Pub_SHARED_NOTE ] = TL_TOP_MESSAGE_SHARED, + [TL_Pub_COMMENT_TO_NOTE] = TL_TOP_MESSAGE_COMMENTED, + }; + + return TopMessages[PubType]; + } + /*****************************************************************************/ /***************** Put link to view new publications in timeline *************/ /*****************************************************************************/ @@ -718,13 +735,6 @@ long TL_Pub_GetNotCodFromPubCod (long PubCod) void TL_Pub_GetDataOfPublicationFromNextRow (MYSQL_RES *mysql_res, struct TL_Pub_Publication *Pub) { - static const TL_TopMessage_t TopMessages[TL_NUM_PUB_TYPES] = - { - [TL_PUB_UNKNOWN ] = TL_TOP_MESSAGE_NONE, - [TL_PUB_ORIGINAL_NOTE ] = TL_TOP_MESSAGE_NONE, - [TL_PUB_SHARED_NOTE ] = TL_TOP_MESSAGE_SHARED, - [TL_Pub_COMMENT_TO_NOTE] = TL_TOP_MESSAGE_COMMENTED, - }; MYSQL_ROW row; /***** Get next row from result *****/ @@ -747,7 +757,6 @@ void TL_Pub_GetDataOfPublicationFromNextRow (MYSQL_RES *mysql_res, /***** Get type of publication (row[3]) *****/ Pub->PubType = TL_Pub_GetPubTypeFromStr ((const char *) row[3]); - Pub->TopMessage = TopMessages[Pub->PubType]; } /*****************************************************************************/ @@ -759,10 +768,10 @@ static TL_Pub_PubType_t TL_Pub_GetPubTypeFromStr (const char *Str) unsigned UnsignedNum; if (sscanf (Str,"%u",&UnsignedNum) == 1) - if (UnsignedNum < TL_NUM_PUB_TYPES) + if (UnsignedNum < TL_Pub_NUM_PUB_TYPES) return (TL_Pub_PubType_t) UnsignedNum; - return TL_PUB_UNKNOWN; + return TL_Pub_UNKNOWN; } /*****************************************************************************/ diff --git a/swad_timeline_publication.h b/swad_timeline_publication.h index 3551dcb4..7cf22f54 100644 --- a/swad_timeline_publication.h +++ b/swad_timeline_publication.h @@ -45,14 +45,14 @@ /******************************** Public types *******************************/ /*****************************************************************************/ -#define TL_NUM_PUB_TYPES 4 +#define TL_Pub_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_UNKNOWN = 0, + TL_Pub_ORIGINAL_NOTE = 1, + TL_Pub_SHARED_NOTE = 2, TL_Pub_COMMENT_TO_NOTE = 3, } TL_Pub_PubType_t; @@ -60,9 +60,8 @@ struct TL_Pub_Publication { long PubCod; long NotCod; - long PublisherCod; // Sharer or writer of the publication + long PublisherCod; // Sharer or writer of the publication TL_Pub_PubType_t PubType; - TL_TopMessage_t TopMessage; // Used to show feedback on the action made struct TL_Pub_Publication *Next; // Used for chained list }; @@ -76,6 +75,8 @@ void TL_Pub_FreeListPubs (struct TL_Timeline *Timeline); void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline); void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline); +TL_TopMessage_t TL_Pub_GetTopMessage (TL_Pub_PubType_t PubType); + void TL_Pub_PutLinkToViewNewPublications (void); void TL_Pub_PutLinkToViewOldPublications (void); diff --git a/swad_timeline_share.c b/swad_timeline_share.c index d2fc1908..4c18dc18 100644 --- a/swad_timeline_share.c +++ b/swad_timeline_share.c @@ -40,8 +40,8 @@ /************************* Private constants and types ***********************/ /*****************************************************************************/ -#define TL_ICON_SHARE "share-alt.svg" -#define TL_ICON_SHARED "share-alt-green.svg" +#define TL_Sha_ICON_SHARE "share-alt.svg" +#define TL_Sha_ICON_SHARED "share-alt-green.svg" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -82,13 +82,13 @@ static void TL_Sha_PutDisabledIconShare (unsigned NumShared) /***** Disabled icon to share *****/ if (NumShared) { - Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE, + Ico_PutDivIcon ("TL_ICO_DISABLED",TL_Sha_ICON_SHARE, Str_BuildStringLong (Txt_TIMELINE_NOTE_Shared_by_X_USERS, (long) NumShared)); Str_FreeString (); } else - Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE, + Ico_PutDivIcon ("TL_ICO_DISABLED",TL_Sha_ICON_SHARE, Txt_TIMELINE_NOTE_Not_shared_by_anyone); } @@ -101,9 +101,10 @@ static void TL_Sha_PutFormToShaNote (long ParamCod) extern const char *Txt_Share; /***** Form and icon to mark note as favourite *****/ - TL_Usr_FormFavSha (ActShaTL_NotGbl,ActShaTL_NotUsr, - "NotCod=%ld",ParamCod, - TL_ICON_SHARE,Txt_Share); + TL_Usr_FormFavSha (ActShaTL_NotGbl, + ActShaTL_NotUsr, + "NotCod=%ld",ParamCod, + TL_Sha_ICON_SHARE,Txt_Share); } static void TL_Sha_PutFormToUnsNote (long ParamCod) @@ -111,9 +112,10 @@ static void TL_Sha_PutFormToUnsNote (long ParamCod) extern const char *Txt_TIMELINE_NOTE_Shared; /***** Form and icon to mark note as favourite *****/ - TL_Usr_FormFavSha (ActUnsTL_NotGbl,ActUnsTL_NotUsr, - "NotCod=%ld",ParamCod, - TL_ICON_SHARED,Txt_TIMELINE_NOTE_Shared); + TL_Usr_FormFavSha (ActUnsTL_NotGbl, + ActUnsTL_NotUsr, + "NotCod=%ld",ParamCod, + TL_Sha_ICON_SHARED,Txt_TIMELINE_NOTE_Shared); } /*****************************************************************************/ @@ -181,7 +183,7 @@ static void TL_Sha_ShaNote (struct TL_Not_Note *Not) /***** Share (publish note in timeline) *****/ Pub.NotCod = Not->NotCod; Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; - Pub.PubType = TL_PUB_SHARED_NOTE; + Pub.PubType = TL_Pub_SHARED_NOTE; TL_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod /* Update number of times this note is shared */ @@ -191,7 +193,8 @@ static void TL_Sha_ShaNote (struct TL_Not_Note *Not) for the author of the post ***/ OriginalPubCod = TL_Not_GetPubCodOfOriginalNote (Not->NotCod); if (OriginalPubCod > 0) - TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_SHARE); + TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod, + Ntf_EVENT_TIMELINE_SHARE); } } } @@ -246,7 +249,7 @@ static void TL_Sha_UnsNote (struct TL_Not_Note *Not) " AND PubType=%u", Not->NotCod, Gbl.Usrs.Me.UsrDat.UsrCod, - (unsigned) TL_PUB_SHARED_NOTE); + (unsigned) TL_Pub_SHARED_NOTE); /***** Update number of times this note is shared *****/ TL_Sha_UpdateNumTimesANoteHasBeenShared (Not); @@ -301,7 +304,7 @@ static bool TL_Sha_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod) " AND PubType=%u", NotCod, UsrCod, - (unsigned) TL_PUB_SHARED_NOTE) != 0); + (unsigned) TL_Pub_SHARED_NOTE) != 0); } /*****************************************************************************/ @@ -320,7 +323,7 @@ void TL_Sha_UpdateNumTimesANoteHasBeenShared (struct TL_Not_Note *Not) " AND PubType=%u", Not->NotCod, Not->UsrCod, // The author - (unsigned) TL_PUB_SHARED_NOTE); + (unsigned) TL_Pub_SHARED_NOTE); } /*****************************************************************************/ @@ -344,7 +347,7 @@ static void TL_Sha_ShowUsrsWhoHaveSharedNote (const struct TL_Not_Note *Not, " ORDER BY PubCod LIMIT %u", Not->NotCod, Not->UsrCod, - (unsigned) TL_PUB_SHARED_NOTE, + (unsigned) TL_Pub_SHARED_NOTE, HowManyUsrs == TL_Usr_SHOW_FEW_USRS ? TL_Usr_DEF_USRS_SHOWN : TL_Usr_MAX_USRS_SHOWN); else @@ -361,9 +364,10 @@ static void TL_Sha_ShowUsrsWhoHaveSharedNote (const struct TL_Not_Note *Not, TL_Usr_ShowSharersOrFavers (&mysql_res,Not->NumShared,NumFirstUsrs); if (NumFirstUsrs < Not->NumShared) /* Clickable ellipsis to show all users */ - TL_Usr_PutFormToSeeAllFaversSharers (ActAllShaTL_NotGbl,ActAllShaTL_NotUsr, - "NotCod=%ld",Not->NotCod, - HowManyUsrs); + TL_Usr_PutFormToSeeAllFaversSharers (ActAllShaTL_NotGbl, + ActAllShaTL_NotUsr, + "NotCod=%ld",Not->NotCod, + HowManyUsrs); HTM_DIV_End (); /***** Free structure that stores the query result *****/ diff --git a/swad_timeline_user.c b/swad_timeline_user.c index d6f1996c..9e6abc23 100644 --- a/swad_timeline_user.c +++ b/swad_timeline_user.c @@ -229,7 +229,8 @@ void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res, /********************* Form to show all favers/sharers ***********************/ /*****************************************************************************/ -void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl,Act_Action_t ActionUsr, +void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl, + Act_Action_t ActionUsr, const char *ParamFormat,long ParamCod, TL_Usr_HowManyUsrs_t HowManyUsrs) { @@ -239,9 +240,10 @@ void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl,Act_Action_t Ac { case TL_Usr_SHOW_FEW_USRS: /***** Form and icon to mark note as favourite *****/ - TL_Usr_FormFavSha (ActionGbl,ActionUsr, - ParamFormat,ParamCod, - TL_Usr_ICON_ELLIPSIS,Txt_View_all_USERS); + TL_Usr_FormFavSha (ActionGbl, + ActionUsr, + ParamFormat,ParamCod, + TL_Usr_ICON_ELLIPSIS,Txt_View_all_USERS); break; case TL_Usr_SHOW_ALL_USRS: Ico_PutIconOff (TL_Usr_ICON_ELLIPSIS,Txt_View_all_USERS); @@ -253,7 +255,8 @@ void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl,Act_Action_t Ac /******* Form to fav/unfav or share/unshare in global or user timeline *******/ /*****************************************************************************/ -void TL_Usr_FormFavSha (Act_Action_t ActionGbl,Act_Action_t ActionUsr, +void TL_Usr_FormFavSha (Act_Action_t ActionGbl, + Act_Action_t ActionUsr, const char *ParamFormat,long ParamCod, const char *Icon,const char *Title) { diff --git a/swad_timeline_user.h b/swad_timeline_user.h index 2f165edb..3563f5ee 100644 --- a/swad_timeline_user.h +++ b/swad_timeline_user.h @@ -66,10 +66,12 @@ void TL_Usr_RemoveUsrContent (long UsrCod); void TL_Usr_ShowNumSharersOrFavers (unsigned NumUsrs); void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res, unsigned NumUsrs,unsigned NumFirstUsrs); -void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl,Act_Action_t ActionUsr, +void TL_Usr_PutFormToSeeAllFaversSharers (Act_Action_t ActionGbl, + Act_Action_t ActionUsr, const char *ParamFormat,long ParamCod, TL_Usr_HowManyUsrs_t HowManyUsrs); -void TL_Usr_FormFavSha (Act_Action_t ActionGbl,Act_Action_t ActionUsr, +void TL_Usr_FormFavSha (Act_Action_t ActionGbl, + Act_Action_t ActionUsr, const char *ParamFormat,long ParamCod, const char *Icon,const char *Title);