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

This commit is contained in:
acanas 2021-02-22 09:25:29 +01:00
parent da4297f113
commit 9db2439bae
7 changed files with 23 additions and 33 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.1 (2021-02-22)"
#define Log_PLATFORM_VERSION "SWAD 20.33.2 (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.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)
Version 20.32.2: Feb 21, 2021 Code refactoring in timeline related to forms. (304771 lines)

View File

@ -88,6 +88,7 @@ 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);
@ -813,7 +814,8 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline)
/* End alert */
Timeline->PubCod = Com.PubCod; // Publication to be removed
TL_Frm_EndAlertRemComm (Timeline);
TL_Frm_EndAlertRemove (Timeline,TL_Frm_REM_COMM,
TL_Com_PutParamsRemoveComment);
}
}
else
@ -827,13 +829,13 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline)
/******************** Put parameters to remove a comment *********************/
/*****************************************************************************/
void TL_Com_PutParamsRemoveComment (void *Timeline)
static void TL_Com_PutParamsRemoveComment (void *Timeline)
{
if (Timeline)
{
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
else
else // Global timeline
Usr_PutHiddenParamWho (((struct TL_Timeline *) Timeline)->Who);
TL_Pub_PutHiddenParamPubCod (((struct TL_Timeline *) Timeline)->PubCod);
}

View File

@ -72,7 +72,6 @@ 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

@ -270,33 +270,20 @@ void TL_Frm_FormToShowHiddenComments (long NotCod,
}
/*****************************************************************************/
/*********************** End form to remove a note ***************************/
/******************* End form to remove note / comment ***********************/
/*****************************************************************************/
void TL_Frm_EndAlertRemNote (struct TL_Timeline *Timeline)
void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action,
void (*FuncParams) (void *Args))
{
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,
Ale_ShowAlertAndButton2 (TL_Frm_ActionUsr[Action],"timeline",NULL,
FuncParams,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,
Ale_ShowAlertAndButton2 (TL_Frm_ActionGbl[Action],NULL,NULL,
FuncParams,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove);
}

View File

@ -87,7 +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);
void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action,
void (*FuncParams) (void *Args));
#endif

View File

@ -85,6 +85,7 @@ 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);
@ -1039,7 +1040,8 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
/* End alert */
Timeline->NotCod = Not.NotCod; // Note to be removed
TL_Frm_EndAlertRemNote (Timeline);
TL_Frm_EndAlertRemove (Timeline,TL_Frm_REM_NOTE,
TL_Not_PutParamsRemoveNote);
}
}
else
@ -1050,13 +1052,13 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
/********************* Put parameters to remove a note ***********************/
/*****************************************************************************/
void TL_Not_PutParamsRemoveNote (void *Timeline)
static void TL_Not_PutParamsRemoveNote (void *Timeline)
{
if (Timeline)
{
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
else
else // Global timeline
Usr_PutHiddenParamWho (((struct TL_Timeline *) Timeline)->Who);
TL_Not_PutHiddenParamNotCod (((struct TL_Timeline *) Timeline)->NotCod);
}

View File

@ -112,7 +112,6 @@ 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);