Version 20.33.1: Feb 22, 2021 Code refactoring in timeline related to forms.

This commit is contained in:
acanas 2021-02-22 09:16:57 +01:00
parent a34501e324
commit da4297f113
7 changed files with 62 additions and 26 deletions

View File

@ -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 (2021-02-21)"
#define Log_PLATFORM_VERSION "SWAD 20.33.1 (2021-02-22)"
#define CSS_FILE "swad20.8.css"
#define JS_FILE "swad20.6.2.js"
/*
@ -601,8 +601,9 @@ 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.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)
Version 20.32.2: Feb 21, 2021 Code refactoring in timeline related to actions. (304771 lines)
Version 20.32.2: Feb 21, 2021 Code refactoring in timeline related to forms. (304771 lines)
Version 20.32.1: Feb 15, 2021 Fixed bug in forums. (304756 lines)
Version 20.32: Feb 15, 2021 Fixed bugs in copy of strings.
Code refactoring in copy of strings. (304755 lines)

View File

@ -88,7 +88,6 @@ static void TL_Com_PutFormToRemoveComment (const struct TL_Timeline *Timeline,
static long TL_Com_ReceiveComment (void);
static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline);
static void TL_Com_PutParamsRemoveComment (void *Timeline);
static void TL_Com_RemoveComment (void);
static void TL_Com_GetDataOfCommentFromRow (MYSQL_ROW row,struct TL_Com_Comment *Com);
@ -789,7 +788,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;
extern const char *Txt_Remove;
struct TL_Com_Comment Com;
bool ItsMe;
@ -815,14 +813,7 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline)
/* End alert */
Timeline->PubCod = Com.PubCod; // Publication to be removed
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
Ale_ShowAlertAndButton2 (ActRemTL_ComUsr,"timeline",NULL,
TL_Com_PutParamsRemoveComment,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
else
Ale_ShowAlertAndButton2 (ActRemTL_ComGbl,NULL,NULL,
TL_Com_PutParamsRemoveComment,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
TL_Frm_EndAlertRemComm (Timeline);
}
}
else
@ -836,7 +827,7 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline)
/******************** Put parameters to remove a comment *********************/
/*****************************************************************************/
static void TL_Com_PutParamsRemoveComment (void *Timeline)
void TL_Com_PutParamsRemoveComment (void *Timeline)
{
if (Timeline)
{

View File

@ -72,6 +72,7 @@ void TL_Com_ReceiveCommentGbl (void);
void TL_Com_RequestRemComUsr (void);
void TL_Com_RequestRemComGbl (void);
void TL_Com_PutParamsRemoveComment (void *Timeline);
void TL_Com_RemoveComUsr (void);
void TL_Com_RemoveComGbl (void);

View File

@ -32,7 +32,9 @@
#include "swad_action.h"
#include "swad_global.h"
#include "swad_timeline.h"
#include "swad_timeline_comment.h"
#include "swad_timeline_form.h"
#include "swad_timeline_note.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
@ -50,6 +52,8 @@ const Act_Action_t TL_Frm_ActionGbl[TL_Frm_NUM_ACTIONS] =
[TL_Frm_RECEIVE_COMM] = ActRcvTL_ComGbl,
[TL_Frm_REQ_REM_NOTE] = ActReqRemTL_PubGbl,
[TL_Frm_REQ_REM_COMM] = ActReqRemTL_ComGbl,
[TL_Frm_REM_NOTE ] = ActRemTL_PubGbl,
[TL_Frm_REM_COMM ] = ActRemTL_ComGbl,
[TL_Frm_SHA_NOTE ] = ActShaTL_NotGbl,
[TL_Frm_UNS_NOTE ] = ActUnsTL_NotGbl,
[TL_Frm_FAV_NOTE ] = ActFavTL_NotGbl,
@ -67,6 +71,8 @@ const Act_Action_t TL_Frm_ActionUsr[TL_Frm_NUM_ACTIONS] =
[TL_Frm_RECEIVE_COMM] = ActRcvTL_ComUsr,
[TL_Frm_REQ_REM_NOTE] = ActReqRemTL_PubUsr,
[TL_Frm_REQ_REM_COMM] = ActReqRemTL_ComUsr,
[TL_Frm_REM_NOTE ] = ActRemTL_PubUsr,
[TL_Frm_REM_COMM ] = ActRemTL_ComUsr,
[TL_Frm_SHA_NOTE ] = ActShaTL_NotUsr,
[TL_Frm_UNS_NOTE ] = ActUnsTL_NotUsr,
[TL_Frm_FAV_NOTE ] = ActFavTL_NotUsr,
@ -262,3 +268,35 @@ void TL_Frm_FormToShowHiddenComments (long NotCod,
HTM_DIV_End ();
}
/*****************************************************************************/
/*********************** End form to remove a note ***************************/
/*****************************************************************************/
void TL_Frm_EndAlertRemNote (struct TL_Timeline *Timeline)
{
extern const char *Txt_Remove;
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
Ale_ShowAlertAndButton2 (TL_Frm_ActionUsr[TL_Frm_REM_NOTE],"timeline",NULL,
TL_Not_PutParamsRemoveNote,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
else
Ale_ShowAlertAndButton2 (TL_Frm_ActionGbl[TL_Frm_REM_NOTE],NULL,NULL,
TL_Not_PutParamsRemoveNote,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
}
void TL_Frm_EndAlertRemComm (struct TL_Timeline *Timeline)
{
extern const char *Txt_Remove;
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
Ale_ShowAlertAndButton2 (TL_Frm_ActionUsr[TL_Frm_REM_COMM],"timeline",NULL,
TL_Com_PutParamsRemoveComment,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
else
Ale_ShowAlertAndButton2 (TL_Frm_ActionUsr[TL_Frm_REM_COMM],NULL,NULL,
TL_Com_PutParamsRemoveComment,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
}

View File

@ -41,22 +41,32 @@
/******************************** Public types *******************************/
/*****************************************************************************/
#define TL_Frm_NUM_ACTIONS 14
#define TL_Frm_NUM_ACTIONS 16
typedef enum
{
TL_Frm_RECEIVE_POST, // Receive post
TL_Frm_RECEIVE_COMM, // Receive comment
TL_Frm_REQ_REM_NOTE, // Request removal note
TL_Frm_REQ_REM_COMM, // Request removal comment
TL_Frm_REM_NOTE, // Remove note
TL_Frm_REM_COMM, // Remove comment
TL_Frm_SHA_NOTE, // Share a note
TL_Frm_UNS_NOTE, // Unshare a note
TL_Frm_FAV_NOTE, // Favourite a note
TL_Frm_FAV_COMM, // Favourite a comment
TL_Frm_UNF_NOTE, // Unfavourite a note
TL_Frm_UNF_COMM, // Unfavourite a comment
TL_Frm_ALL_SHA_NOTE, // Show all sharers of note
TL_Frm_ALL_FAV_NOTE, // Show all favouriters of note
TL_Frm_ALL_FAV_COMM, // Show all favouriters of comment
TL_Frm_SHO_HID_COMM, // Show / hide comments
} TL_Frm_Action_t;
@ -77,4 +87,7 @@ void TL_Frm_FormToShowHiddenComments (long NotCod,
char IdComments[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialComments);
void TL_Frm_EndAlertRemNote (struct TL_Timeline *Timeline);
void TL_Frm_EndAlertRemComm (struct TL_Timeline *Timeline);
#endif

View File

@ -85,7 +85,6 @@ static void TL_Not_PutFormToRemoveNote (const struct TL_Timeline *Timeline,
long NotCod);
static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline);
static void TL_Not_PutParamsRemoveNote (void *Timeline);
static void TL_Not_RemoveNote (void);
static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not);
@ -1016,7 +1015,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;
extern const char *Txt_Remove;
struct TL_Not_Note Not;
bool ItsMe;
@ -1040,15 +1038,8 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
TL_SHOW_ALONE);
/* End alert */
Timeline->NotCod = Not.NotCod; // Note to be removed
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
Ale_ShowAlertAndButton2 (ActRemTL_PubUsr,"timeline",NULL,
TL_Not_PutParamsRemoveNote,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
else
Ale_ShowAlertAndButton2 (ActRemTL_PubGbl,NULL,NULL,
TL_Not_PutParamsRemoveNote,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
Timeline->NotCod = Not.NotCod; // Note to be removed
TL_Frm_EndAlertRemNote (Timeline);
}
}
else
@ -1059,7 +1050,7 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
/********************* Put parameters to remove a note ***********************/
/*****************************************************************************/
static void TL_Not_PutParamsRemoveNote (void *Timeline)
void TL_Not_PutParamsRemoveNote (void *Timeline)
{
if (Timeline)
{

View File

@ -112,6 +112,7 @@ long TL_Not_GetParamNotCod (void);
void TL_Not_RequestRemNoteUsr (void);
void TL_Not_RequestRemNoteGbl (void);
void TL_Not_PutParamsRemoveNote (void *Timeline);
void TL_Not_RemoveNoteUsr (void);
void TL_Not_RemoveNoteGbl (void);