From 321faa348965d69dcd2eb4723904e5f2cf44c9cd Mon Sep 17 00:00:00 2001 From: acanas Date: Tue, 23 Feb 2021 00:07:52 +0100 Subject: [PATCH] Version 20.33.10: Feb 23, 2021 Code refactoring related to writing a timeline notes and comments. --- swad_changelog.h | 3 +- swad_timeline.c | 6 +- swad_timeline_comment.c | 219 ++++++++++++++++++++++++------------ swad_timeline_note.c | 121 ++++++++++++-------- swad_timeline_note.h | 8 +- swad_timeline_publication.c | 12 +- 6 files changed, 235 insertions(+), 134 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 6b68756e6..b95aef2b9 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.33.9 (2021-02-22)" +#define Log_PLATFORM_VERSION "SWAD 20.33.10 (2021-02-23)" #define CSS_FILE "swad20.33.9.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.33.10: Feb 23, 2021 Code refactoring related to writing a timeline notes and comments. (305038 lines) Version 20.33.9: Feb 22, 2021 Code refactoring related to writing a timeline comment. (304949 lines) Version 20.33.8: Feb 22, 2021 Code refactoring related to writing a timeline note. (304971 lines) Version 20.33.7: Feb 22, 2021 Code refactoring related to writing a timeline note. (304923 lines) diff --git a/swad_timeline.c b/swad_timeline.c index f1ceb86f4..eab7c9663 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -471,9 +471,9 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline, /* Write note */ HTM_LI_Begin ("class=\"%s\"",Not.NotCod == NotCodToHighlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" : "TL_WIDTH TL_SEP"); - TL_Not_WriteNoteWithTopMsg (Timeline,&Not, - TL_Pub_GetTopMessage (Pub->PubType), - Pub->PublisherCod); + TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, + TL_Pub_GetTopMessage (Pub->PubType), + Pub->PublisherCod); HTM_LI_End (); } HTM_UL_End (); diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 16b4c4386..6166839fc 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -79,9 +79,18 @@ static void TL_Com_LinkToShowPreviousComments (const char IdComments[Frm_MAX_BYT unsigned NumInitialComments); static void TL_Com_PutIconToToggleComments (const char *UniqueId, const char *Icon,const char *Text); +static void TL_Com_CheckAndWriteComment (const struct TL_Timeline *Timeline, + struct TL_Com_Comment *Com); static void TL_Com_WriteComment (const struct TL_Timeline *Timeline, struct TL_Com_Comment *Com); -static void TL_Com_WriteAuthorComment (struct UsrData *UsrDat); +static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat); +static void TL_Com_WriteAuthorTimeAndContent (struct TL_Com_Comment *Com, + const struct UsrData *UsrDat); +static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat); +static void TL_Com_WriteContent (struct TL_Com_Comment *Com); +static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline, + const struct TL_Com_Comment *Com, + const struct UsrData *UsrDat); static void TL_Com_PutFormToRemoveComment (const struct TL_Timeline *Timeline, long PubCod); @@ -162,7 +171,7 @@ void TL_Com_PutHiddenFormToWriteNewComment (const struct TL_Timeline *Timeline, /* Textarea and button */ TL_Pst_PutTextarea (Txt_New_TIMELINE_comment, - "TL_COM_TEXTAREA TL_COMM_WIDTH"); + "TL_COM_TEXTAREA TL_COMM_WIDTH"); /* End form */ Frm_EndForm (); @@ -427,7 +436,7 @@ static void TL_Com_WriteOneCommentInList (const struct TL_Timeline *Timeline, /***** Write comment *****/ HTM_LI_Begin ("class=\"TL_COM\""); - TL_Com_WriteComment (Timeline,&Com); + TL_Com_CheckAndWriteComment (Timeline,&Com); HTM_LI_End (); /***** Free image *****/ @@ -492,6 +501,36 @@ static void TL_Com_PutIconToToggleComments (const char *UniqueId, free (OnClick); } +/*****************************************************************************/ +/************************** Check and write comment **************************/ +/*****************************************************************************/ + +static void TL_Com_CheckAndWriteComment (const struct TL_Timeline *Timeline, + struct TL_Com_Comment *Com) + { + /*__________________________________________ + | _____ | | | \ \ + || | | Author's name | Date-time | | | + ||Auth.| |______________________|___________| | | + ||photo| | | | author's | + ||_____| | | > name, time | + | | Comment | | and content > comment + | | content | | | + | | | | | + | |__________________________________| / | + | | | | \ | + | | Favs |Remove| > buttons | + |________|___________________________|______| / / + */ + if (Com->PubCod > 0 && + Com->NotCod > 0 && + Com->UsrCod > 0) + /***** Write comment *****/ + TL_Com_WriteComment (Timeline,Com); + else + Ale_ShowAlert (Ale_ERROR,"Error in comment."); + } + /*****************************************************************************/ /******************************** Write comment ******************************/ /*****************************************************************************/ @@ -499,85 +538,73 @@ static void TL_Com_PutIconToToggleComments (const char *UniqueId, static void TL_Com_WriteComment (const struct TL_Timeline *Timeline, struct TL_Com_Comment *Com) { - struct UsrData AuthorDat; - bool IAmTheAuthor; - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - static unsigned NumDiv = 0; // Used to create unique div id for fav + struct UsrData UsrDat; // Author of the comment - NumDiv++; + /***** Get author's data *****/ + Usr_UsrDataConstructor (&UsrDat); + UsrDat.UsrCod = Com->UsrCod; + Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); - if (Com->PubCod > 0 && - Com->NotCod > 0 && - Com->UsrCod > 0) - { - /***** Get author's data *****/ - Usr_UsrDataConstructor (&AuthorDat); - AuthorDat.UsrCod = Com->UsrCod; - Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&AuthorDat,Usr_DONT_GET_PREFS); - IAmTheAuthor = Usr_ItsMe (AuthorDat.UsrCod); + /***** Left: author's photo *****/ + TL_Com_ShowAuthorPhoto (&UsrDat); - /***** Left: write author's photo *****/ - HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&AuthorDat,PhotoURL); - Pho_ShowUsrPhoto (&AuthorDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO30x40",Pho_ZOOM,true); // Use unique id - HTM_DIV_End (); + /***** Right: author's name, time, content, and buttons *****/ + /* Begin container */ + HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); - /***** Right: author's name, time, content, image and buttons *****/ - HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); + /* Right top: author's name, time, and content */ + TL_Com_WriteAuthorTimeAndContent (Com,&UsrDat); - /* Write author's full name and nickname */ - TL_Com_WriteAuthorComment (&AuthorDat); + /* Right bottom: buttons */ + TL_Com_WriteButtons (Timeline,Com,&UsrDat); - /* Write date and time */ - TL_WriteDateTime (Com->DateTimeUTC); + /* End container */ + HTM_DIV_End (); - /* Write content of the comment */ - if (Com->Content.Txt[0]) - { - HTM_DIV_Begin ("class=\"TL_TXT\""); - Msg_WriteMsgContent (Com->Content.Txt,Cns_MAX_BYTES_LONG_TEXT,true,false); - HTM_DIV_End (); - } - - /* Show image */ - Med_ShowMedia (&Com->Content.Media,"TL_COM_MED_CONT TL_COMM_WIDTH", - "TL_COM_MED TL_COMM_WIDTH"); - - /* Start foot container */ - HTM_DIV_Begin ("class=\"TL_FOOT TL_COMM_WIDTH\""); - - /* Fav zone */ - HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"", - Gbl.UniqueNameEncrypted,NumDiv); - TL_Fav_PutFormToFavUnfComment (Com,TL_Usr_SHOW_FEW_USRS); - HTM_DIV_End (); - - /* Put icon to remove this comment */ - HTM_DIV_Begin ("class=\"TL_REM\""); - // if (IAmTheAuthor && - // ShowCommentAlone == TL_DONT_SHOW_ALONE) - if (IAmTheAuthor) - TL_Com_PutFormToRemoveComment (Timeline,Com->PubCod); - HTM_DIV_End (); - - /* End foot container */ - HTM_DIV_End (); - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&AuthorDat); - } - else - Ale_ShowAlert (Ale_ERROR,"Error in comment."); + /***** Free memory used for user's data *****/ + Usr_UsrDataDestructor (&UsrDat); } /*****************************************************************************/ -/********* Write name and nickname of author of a comment to a note **********/ +/********************* Show photo of author of a comment *********************/ /*****************************************************************************/ -static void TL_Com_WriteAuthorComment (struct UsrData *UsrDat) +static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat) + { + bool ShowPhoto = false; + char PhotoURL[PATH_MAX + 1]; + + /***** Show author's photo *****/ + HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); + ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); + Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : + NULL, + "PHOTO30x40",Pho_ZOOM,true); // Use unique id + HTM_DIV_End (); + } + +/*****************************************************************************/ +/**** Write top right part of a note: author's name, time and note content ***/ +/*****************************************************************************/ + +static void TL_Com_WriteAuthorTimeAndContent (struct TL_Com_Comment *Com, + const struct UsrData *UsrDat) // Author + { + /***** Write author's full name and nickname *****/ + TL_Com_WriteAuthorName (UsrDat); + + /***** Write date and time *****/ + TL_WriteDateTime (Com->DateTimeUTC); + + /***** Write content of the comment *****/ + TL_Com_WriteContent (Com); + } + +/*****************************************************************************/ +/*************** Write name of author of a comment to a note *****************/ +/*****************************************************************************/ + +static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat) // Author { extern const char *Txt_My_public_profile; extern const char *Txt_Another_user_s_profile; @@ -594,6 +621,56 @@ static void TL_Com_WriteAuthorComment (struct UsrData *UsrDat) Frm_EndForm (); } +/*****************************************************************************/ +/************************* Write content of comment **************************/ +/*****************************************************************************/ + +static void TL_Com_WriteContent (struct TL_Com_Comment *Com) + { + /***** Write content of the comment *****/ + if (Com->Content.Txt[0]) + { + HTM_DIV_Begin ("class=\"TL_TXT\""); + Msg_WriteMsgContent (Com->Content.Txt,Cns_MAX_BYTES_LONG_TEXT,true,false); + HTM_DIV_End (); + } + + /***** Show image *****/ + Med_ShowMedia (&Com->Content.Media,"TL_COM_MED_CONT TL_COMM_WIDTH", + "TL_COM_MED TL_COMM_WIDTH"); + } + +/*****************************************************************************/ +/********************* Write bottom part of a comment ************************/ +/*****************************************************************************/ + +static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline, + const struct TL_Com_Comment *Com, + const struct UsrData *UsrDat) + { + static unsigned NumDiv = 0; // Used to create unique div id for fav + + NumDiv++; + + /***** Begin buttons container *****/ + HTM_DIV_Begin ("class=\"TL_FOOT TL_COMM_WIDTH\""); + + /***** Foot column 1: fav zone *****/ + HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"", + Gbl.UniqueNameEncrypted,NumDiv); + TL_Fav_PutFormToFavUnfComment (Com,TL_Usr_SHOW_FEW_USRS); + HTM_DIV_End (); + + /***** Foot column 2: icon to remove this comment *****/ + HTM_DIV_Begin ("class=\"TL_REM\""); + if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author + TL_Com_PutFormToRemoveComment (Timeline,Com->PubCod); + HTM_DIV_End (); + + /***** End buttons container *****/ + HTM_DIV_End (); + } + /*****************************************************************************/ /************************* Form to remove comment ****************************/ /*****************************************************************************/ @@ -795,7 +872,7 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline) HTM_DIV_End (); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); - TL_Com_WriteComment (Timeline,&Com); + TL_Com_CheckAndWriteComment (Timeline,&Com); HTM_DIV_End (); Box_BoxEnd (); diff --git a/swad_timeline_note.c b/swad_timeline_note.c index a96178ce5..1f3e2ff3d 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -72,8 +72,8 @@ static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod static void TL_Not_WriteNote (const struct TL_Timeline *Timeline, const struct TL_Not_Note *Not); static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat); -static void TL_Not_WriteTop (const struct TL_Not_Note *Not, - const struct UsrData *UsrDat); +static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not, + const struct UsrData *UsrDat); static void TL_Not_WriteContent (const struct TL_Not_Note *Not); static void TL_Not_GetAndWriteNoPost (const struct TL_Not_Note *Not); @@ -88,17 +88,17 @@ static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not, static void TL_Not_PutFormGoToAction (const struct TL_Not_Note *Not, const struct For_Forums *Forums); -static void TL_Not_WriteBottom (const struct TL_Timeline *Timeline, +static void TL_Not_WriteButtonsAndComments (const struct TL_Timeline *Timeline, const struct TL_Not_Note *Not, const struct UsrData *UsrDat); static void TL_Not_WriteButtonToAddAComment (const struct TL_Not_Note *Not, const char IdNewComment[Frm_MAX_BYTES_ID + 1]); -static void TL_Not_WriteFootAndComments (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - const struct UsrData *UsrDat); -static void TL_Not_WriteFoot (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - const struct UsrData *UsrDat); +static void TL_Not_WriteFavShaRemAndComments (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + const struct UsrData *UsrDat); +static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + const struct UsrData *UsrDat); static void TL_Not_PutFormToRemoveNote (const struct TL_Timeline *Timeline, long NotCod); @@ -177,9 +177,9 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline, NULL,NULL, NULL,Box_CLOSABLE); HTM_DIV_Begin ("class=\"TL_WIDTH TL_NEW_PUB\""); - TL_Not_WriteNoteWithTopMsg (Timeline,Not, - TopMessages[NotifyEvent], - PublisherDat.UsrCod); + TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,Not, + TopMessages[NotifyEvent], + PublisherDat.UsrCod); HTM_DIV_End (); Box_BoxEnd (); } @@ -209,14 +209,39 @@ void TL_Not_InsertNoteInVisibleTimeline (long NotCod) } /*****************************************************************************/ -/******************************** Write note *********************************/ +/****************** Check and write note with top message ********************/ /*****************************************************************************/ -void TL_Not_WriteNoteWithTopMsg (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - TL_TopMessage_t TopMessage, - long PublisherCod) // Who did the action (publication, commenting, faving, sharing, mentioning) +void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + TL_TopMessage_t TopMessage, + long PublisherCod) // Who did the action (publication, commenting, faving, sharing, mentioning) { + /*__________________________________________ + | | \ + | Top message: | > top message + |___________________________________________| / + | _____ | | | \ \ + || | | Author's name | Date-time | | | + ||Auth.| |______________________|___________| | | + ||photo| | | | author's | + ||_____| | | > name, time | + | | Note | | and content | + | | content | | | + | | | | | + | |__________________________________| / | + | | | | | \ | + | | Favs | Shared |Remove| | > note + | |_____________|_____________|______| | | + |________| | | | + | | List | | buttons | + | Comment| of | > and | + | icon | comments | | comments | + |________|__________________________________| | | + | | | | + | Form to write new comment | | | + |__________________________________| / / + */ if (Not->NotCod > 0 && Not->UsrCod > 0 && Not->NoteType != TL_NOTE_UNKNOWN) @@ -282,21 +307,19 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline, { struct UsrData UsrDat; // Author of the note - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - /***** Get author data *****/ + Usr_UsrDataConstructor (&UsrDat); UsrDat.UsrCod = Not->UsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); - /***** Left top: write author's photo *****/ + /***** Left top: author's photo *****/ TL_Not_ShowAuthorPhoto (&UsrDat); - /***** Right top: author's name, time, summary and buttons *****/ - TL_Not_WriteTop (Not,&UsrDat); + /***** Right top: author's name, time, and content *****/ + TL_Not_WriteAuthorTimeAndContent (Not,&UsrDat); /***** Bottom: buttons and comments *****/ - TL_Not_WriteBottom (Timeline,Not,&UsrDat); + TL_Not_WriteButtonsAndComments (Timeline,Not,&UsrDat); /***** Free memory used for author's data *****/ Usr_UsrDataDestructor (&UsrDat); @@ -324,10 +347,10 @@ static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat) /**** Write top right part of a note: author's name, time and note content ***/ /*****************************************************************************/ -static void TL_Not_WriteTop (const struct TL_Not_Note *Not, - const struct UsrData *UsrDat) +static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not, + const struct UsrData *UsrDat) { - /***** Begin right container *****/ + /***** Begin top container *****/ HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); /***** Write author's full name *****/ @@ -339,7 +362,7 @@ static void TL_Not_WriteTop (const struct TL_Not_Note *Not, /***** Write content of the note *****/ TL_Not_WriteContent (Not); - /***** End right container *****/ + /***** End top container *****/ HTM_DIV_End (); } @@ -726,7 +749,7 @@ void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, /************************ Write bottom part of a note ************************/ /*****************************************************************************/ -static void TL_Not_WriteBottom (const struct TL_Timeline *Timeline, +static void TL_Not_WriteButtonsAndComments (const struct TL_Timeline *Timeline, const struct TL_Not_Note *Not, const struct UsrData *UsrDat) // Author { @@ -738,8 +761,8 @@ static void TL_Not_WriteBottom (const struct TL_Timeline *Timeline, /***** Left: button to add a comment *****/ TL_Not_WriteButtonToAddAComment (Not,IdNewComment); - /***** Right: write foot and comments *****/ - TL_Not_WriteFootAndComments (Timeline,Not,UsrDat); + /***** Right: write favs, shared and remove buttons, and comments *****/ + TL_Not_WriteFavShaRemAndComments (Timeline,Not,UsrDat); /***** Put hidden form to write a new comment *****/ TL_Com_PutHiddenFormToWriteNewComment (Timeline,Not->NotCod,IdNewComment); @@ -761,33 +784,33 @@ static void TL_Not_WriteButtonToAddAComment (const struct TL_Not_Note *Not, } /*****************************************************************************/ -/******************** Write foot and comments of a note **********************/ +/******* Write favs, shared and remove buttons, and comments of a note *******/ /*****************************************************************************/ -static void TL_Not_WriteFootAndComments (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - const struct UsrData *UsrDat) // Author +static void TL_Not_WriteFavShaRemAndComments (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + const struct UsrData *UsrDat) // Author { - /***** Begin container for foot and comments *****/ + /***** Begin container *****/ HTM_DIV_Begin ("class=\"TL_BOTTOM_RIGHT TL_RIGHT_WIDTH\""); - /***** Write foot of a note *****/ - TL_Not_WriteFoot (Timeline,Not,UsrDat); + /***** Write favs, shared and remove buttons int the foot of a note *****/ + TL_Not_WriteFavShaRem (Timeline,Not,UsrDat); /***** Comments *****/ TL_Com_WriteCommentsInNote (Timeline,Not); - /***** End container for buttons and comments *****/ + /***** End container *****/ HTM_DIV_End (); } /*****************************************************************************/ -/*************************** Write foot of a note ****************************/ +/******* Write favs, shared and remove buttons in the foot of a note *********/ /*****************************************************************************/ -static void TL_Not_WriteFoot (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - const struct UsrData *UsrDat) // Author +static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + const struct UsrData *UsrDat) // Author { static unsigned NumDiv = 0; // Used to create unique div id for fav and shared @@ -796,19 +819,19 @@ static void TL_Not_WriteFoot (const struct TL_Timeline *Timeline, /***** Begin foot container *****/ HTM_DIV_Begin ("class=\"TL_FOOT TL_RIGHT_WIDTH\""); - /***** 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\"", Gbl.UniqueNameEncrypted,NumDiv); TL_Fav_PutFormToFavUnfNote (Not,TL_Usr_SHOW_FEW_USRS); 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\"", Gbl.UniqueNameEncrypted,NumDiv); TL_Sha_PutFormToShaUnsNote (Not,TL_Usr_SHOW_FEW_USRS); HTM_DIV_End (); - /***** Foot column 3: Icon to remove this note *****/ + /***** Foot column 3: icon to remove this note *****/ HTM_DIV_Begin ("class=\"TL_REM\""); if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author TL_Not_PutFormToRemoveNote (Timeline,Not->NotCod); @@ -1118,9 +1141,9 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline) NULL,NULL, NULL,Box_CLOSABLE); HTM_DIV_Begin ("class=\"TL_WIDTH\""); - TL_Not_WriteNoteWithTopMsg (Timeline,&Not, - TL_TOP_MESSAGE_NONE, - -1L); + TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, + TL_TOP_MESSAGE_NONE, + -1L); HTM_DIV_End (); Box_BoxEnd (); diff --git a/swad_timeline_note.h b/swad_timeline_note.h index 268dabb9a..d8cc34b09 100644 --- a/swad_timeline_note.h +++ b/swad_timeline_note.h @@ -90,10 +90,10 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline, void TL_Not_InsertNoteInJustRetrievedNotes (long NotCod); void TL_Not_InsertNoteInVisibleTimeline (long NotCod); -void TL_Not_WriteNoteWithTopMsg (const struct TL_Timeline *Timeline, - const struct TL_Not_Note *Not, - TL_TopMessage_t TopMessage, - long PublisherCod); +void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline, + const struct TL_Not_Note *Not, + TL_TopMessage_t TopMessage, + long PublisherCod); void TL_Not_WriteAuthorName (const struct UsrData *UsrDat); void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, diff --git a/swad_timeline_publication.c b/swad_timeline_publication.c index 04a560ee6..9d93dd8ad 100644 --- a/swad_timeline_publication.c +++ b/swad_timeline_publication.c @@ -540,9 +540,9 @@ void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline) /* Write note */ HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\""); - TL_Not_WriteNoteWithTopMsg (Timeline,&Not, - TL_Pub_GetTopMessage (Pub->PubType), - Pub->PublisherCod); + TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, + TL_Pub_GetTopMessage (Pub->PubType), + Pub->PublisherCod); HTM_LI_End (); } } @@ -568,9 +568,9 @@ void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline) /* Write note */ HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP\""); - TL_Not_WriteNoteWithTopMsg (Timeline,&Not, - TL_Pub_GetTopMessage (Pub->PubType), - Pub->PublisherCod); + TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, + TL_Pub_GetTopMessage (Pub->PubType), + Pub->PublisherCod); HTM_LI_End (); } }