From ac2a4b53398f912bc5c9c4bbd5eac02ed53077d7 Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 22 Feb 2021 10:03:36 +0100 Subject: [PATCH] Version 20.33.3: Feb 22, 2021 Code refactoring in timeline related to forms. --- swad_changelog.h | 3 ++- swad_timeline_comment.c | 8 +++----- swad_timeline_form.c | 7 ++++++- swad_timeline_form.h | 1 + swad_timeline_note.c | 8 +++----- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 10fd62315..dea5f27a3 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.2 (2021-02-22)" +#define Log_PLATFORM_VERSION "SWAD 20.33.3 (2021-02-22)" #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.33.3: Feb 22, 2021 Code refactoring in timeline related to forms. (304882 lines) Version 20.33.2: Feb 22, 2021 Code refactoring in timeline related to forms. (304880 lines) Version 20.33.1: Feb 22, 2021 Code refactoring in timeline related to forms. (304888 lines) Version 20.33: Feb 21, 2021 New module swad_timeline_form. (304866 lines) diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 964677323..d75402aa8 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -790,7 +790,6 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline) extern const char *Txt_The_comment_no_longer_exists; extern const char *Txt_Do_you_really_want_to_remove_the_following_comment; struct TL_Com_Comment Com; - bool ItsMe; /***** Initialize image *****/ Med_MediaConstructor (&Com.Content.Media); @@ -801,12 +800,11 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline) if (Com.PubCod > 0) { - ItsMe = Usr_ItsMe (Com.UsrCod); - if (ItsMe) // I am the author of this comment + if (Usr_ItsMe (Com.UsrCod)) // I am the author of this comment { /***** Show question and button to remove comment *****/ - /* Start alert */ - Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_following_comment); + /* Begin alert */ + TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment); /* Show comment */ TL_Com_WriteComment (Timeline,&Com, diff --git a/swad_timeline_form.c b/swad_timeline_form.c index e8bcd0d7d..c4a3bef03 100644 --- a/swad_timeline_form.c +++ b/swad_timeline_form.c @@ -270,9 +270,14 @@ void TL_Frm_FormToShowHiddenComments (long NotCod, } /*****************************************************************************/ -/******************* End form to remove note / comment ***********************/ +/********************** Form to remove note / comment ************************/ /*****************************************************************************/ +void TL_Frm_BeginAlertRemove (const char *QuestionTxt) + { + Ale_ShowAlertAndButton1 (Ale_QUESTION,QuestionTxt); + } + void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action, void (*FuncParams) (void *Args)) { diff --git a/swad_timeline_form.h b/swad_timeline_form.h index 71a15b61e..366e0f431 100644 --- a/swad_timeline_form.h +++ b/swad_timeline_form.h @@ -87,6 +87,7 @@ void TL_Frm_FormToShowHiddenComments (long NotCod, char IdComments[Frm_MAX_BYTES_ID + 1], unsigned NumInitialComments); +void TL_Frm_BeginAlertRemove (const char *QuestionTxt); void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action, void (*FuncParams) (void *Args)); diff --git a/swad_timeline_note.c b/swad_timeline_note.c index 056dc3ba8..d3c459d3a 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -1017,7 +1017,6 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline) extern const char *Txt_The_original_post_no_longer_exists; extern const char *Txt_Do_you_really_want_to_remove_the_following_post; struct TL_Not_Note Not; - bool ItsMe; /***** Get data of note *****/ Not.NotCod = TL_Not_GetParamNotCod (); @@ -1025,12 +1024,11 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline) if (Not.NotCod > 0) { - ItsMe = Usr_ItsMe (Not.UsrCod); - if (ItsMe) // I am the author of this note + if (Usr_ItsMe (Not.UsrCod)) // I am the author of this note { /***** Show question and button to remove note *****/ - /* Start alert */ - Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_following_post); + /* Begin alert */ + TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_post); /* Show note */ TL_Not_WriteNote (Timeline,&Not,