Version 20.32.2: Feb 21, 2021 Code refactoring in timeline related to actions.

This commit is contained in:
acanas 2021-02-21 18:01:21 +01:00
parent da0ad80653
commit 76ca73926c
6 changed files with 34 additions and 17 deletions

View File

@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.32.1 (2021-02-15)" #define Log_PLATFORM_VERSION "SWAD 20.32.2 (2021-02-21)"
#define CSS_FILE "swad20.8.css" #define CSS_FILE "swad20.8.css"
#define JS_FILE "swad20.6.2.js" #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: 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 TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.32.2: Feb 21, 2021 Code refactoring in timeline related to actions. (304771 lines)
Version 20.32.1: Feb 15, 2021 Fixed bug in forums. (304756 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. Version 20.32: Feb 15, 2021 Fixed bugs in copy of strings.
Code refactoring in copy of strings. (304755 lines) Code refactoring in copy of strings. (304755 lines)

View File

@ -507,20 +507,33 @@ static void TL_PutIconsTimeline (__attribute__((unused)) void *Args)
/***************** Start a form in global or user timeline *******************/ /***************** Start a form in global or user timeline *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_FormStart (const struct TL_Timeline *Timeline, void TL_FormStart (const struct TL_Timeline *Timeline,TL_FormAction_t Action)
Act_Action_t ActionGbl,
Act_Action_t ActionUsr)
{ {
static const Act_Action_t ActionGbl[TL_NUM_ACTIONS] =
{
[TL_RECEIVE_POST] = ActRcvTL_PstGbl,
[TL_RECEIVE_COMM] = ActRcvTL_ComGbl,
[TL_REQ_REM_NOTE] = ActReqRemTL_PubGbl,
[TL_REQ_REM_COMM] = ActReqRemTL_ComGbl,
};
static const Act_Action_t ActionUsr[TL_NUM_ACTIONS] =
{
[TL_RECEIVE_POST] = ActRcvTL_PstUsr,
[TL_RECEIVE_COMM] = ActRcvTL_ComUsr,
[TL_REQ_REM_NOTE] = ActReqRemTL_PubUsr,
[TL_REQ_REM_COMM] = ActReqRemTL_ComUsr,
};
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{ {
/***** Start form in user timeline *****/ /***** Start form in user timeline *****/
Frm_StartFormAnchor (ActionUsr,"timeline"); Frm_StartFormAnchor (ActionUsr[Action],"timeline");
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
} }
else else
{ {
/***** Start form in global timeline *****/ /***** Start form in global timeline *****/
Frm_StartForm (ActionGbl); Frm_StartForm (ActionGbl[Action]);
Usr_PutHiddenParamWho (Timeline->Who); Usr_PutHiddenParamWho (Timeline->Who);
} }
} }

View File

@ -103,6 +103,15 @@ typedef enum
TL_SHOW_ALONE, TL_SHOW_ALONE,
} TL_ShowAlone_t; } TL_ShowAlone_t;
#define TL_NUM_ACTIONS 4
typedef enum
{
TL_RECEIVE_POST, // Receive post
TL_RECEIVE_COMM, // Receive comment
TL_REQ_REM_NOTE, // Request removal note
TL_REQ_REM_COMM, // Request removal comment
} TL_FormAction_t;
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -125,9 +134,7 @@ void TL_RefreshNewTimelineGbl (void);
void TL_RefreshOldTimelineGbl (void); void TL_RefreshOldTimelineGbl (void);
void TL_RefreshOldTimelineUsr (void); void TL_RefreshOldTimelineUsr (void);
void TL_FormStart (const struct TL_Timeline *Timeline, void TL_FormStart (const struct TL_Timeline *Timeline,TL_FormAction_t Action);
Act_Action_t ActionGbl,
Act_Action_t ActionUsr);
void TL_WriteDateTime (time_t TimeUTC); void TL_WriteDateTime (time_t TimeUTC);

View File

@ -159,8 +159,7 @@ void TL_Com_PutHiddenFormToWriteNewComment (const struct TL_Timeline *Timeline,
HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\"");
/* Begin form to write the post */ /* Begin form to write the post */
TL_FormStart (Timeline,ActRcvTL_ComGbl, TL_FormStart (Timeline,TL_RECEIVE_COMM);
ActRcvTL_ComUsr);
TL_Not_PutHiddenParamNotCod (NotCod); TL_Not_PutHiddenParamNotCod (NotCod);
/* Textarea and button */ /* Textarea and button */
@ -696,8 +695,7 @@ static void TL_Com_PutFormToRemoveComment (const struct TL_Timeline *Timeline,
extern const char *Txt_Remove; extern const char *Txt_Remove;
/***** Form to remove publication *****/ /***** Form to remove publication *****/
TL_FormStart (Timeline,ActReqRemTL_ComGbl, TL_FormStart (Timeline,TL_REQ_REM_COMM);
ActReqRemTL_ComUsr);
TL_Pub_PutHiddenParamPubCod (PubCod); TL_Pub_PutHiddenParamPubCod (PubCod);
Ico_PutIconLink ("trash.svg",Txt_Remove); Ico_PutIconLink ("trash.svg",Txt_Remove);
Frm_EndForm (); Frm_EndForm ();

View File

@ -942,8 +942,7 @@ static void TL_Not_PutFormToRemoveNote (const struct TL_Timeline *Timeline,
extern const char *Txt_Remove; extern const char *Txt_Remove;
/***** Form to remove publication *****/ /***** Form to remove publication *****/
TL_FormStart (Timeline,ActReqRemTL_PubGbl, TL_FormStart (Timeline,TL_REQ_REM_NOTE);
ActReqRemTL_PubUsr);
TL_Not_PutHiddenParamNotCod (NotCod); TL_Not_PutHiddenParamNotCod (NotCod);
Ico_PutIconLink ("trash.svg",Txt_Remove); Ico_PutIconLink ("trash.svg",Txt_Remove);
Frm_EndForm (); Frm_EndForm ();

View File

@ -149,8 +149,7 @@ void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
/* Form to write the post */ /* Form to write the post */
HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\"");
TL_FormStart (Timeline,ActRcvTL_PstGbl, TL_FormStart (Timeline,TL_RECEIVE_POST);
ActRcvTL_PstUsr);
TL_Pst_PutTextarea (Txt_New_TIMELINE_post,"TL_PST_TEXTAREA TL_RIGHT_WIDTH"); TL_Pst_PutTextarea (Txt_New_TIMELINE_post,"TL_PST_TEXTAREA TL_RIGHT_WIDTH");
Frm_EndForm (); Frm_EndForm ();
HTM_DIV_End (); HTM_DIV_End ();