Version 20.39.1: Mar 02, 2021 Code refactoring in timeline comments.

This commit is contained in:
acanas 2021-03-02 10:36:00 +01:00
parent d4c5288ec3
commit 781a1b3e84
2 changed files with 31 additions and 22 deletions

View File

@ -598,10 +598,11 @@ 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
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.39 (2021-03-02)" #define Log_PLATFORM_VERSION "SWAD 20.39.1 (2021-03-02)"
#define CSS_FILE "swad20.33.9.css" #define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
Version 20.39.1: Mar 02, 2021 Code refactoring in timeline comments. (305618 lines)
Version 20.39: Mar 02, 2021 Code refactoring in user's photo. (305610 lines) Version 20.39: Mar 02, 2021 Code refactoring in user's photo. (305610 lines)
Version 20.38.1: Mar 02, 2021 Code refactoring in timeline comments. (305768 lines) Version 20.38.1: Mar 02, 2021 Code refactoring in timeline comments. (305768 lines)
Version 20.38: Mar 02, 2021 Code refactoring in timeline. (305756 lines) Version 20.38: Mar 02, 2021 Code refactoring in timeline. (305756 lines)

View File

@ -73,6 +73,8 @@ static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline,
long NotCod, long NotCod,
char IdComms[Frm_MAX_BYTES_ID + 1], char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialCommsToGet); unsigned NumInitialCommsToGet);
static void TL_Com_ListComms (const struct TL_Timeline *Timeline,
MYSQL_RES *mysql_res,unsigned NumComms);
static void TL_Com_WriteOneCommInList (const struct TL_Timeline *Timeline, static void TL_Com_WriteOneCommInList (const struct TL_Timeline *Timeline,
MYSQL_RES *mysql_res); MYSQL_RES *mysql_res);
static void TL_Com_LinkToShowOnlyLatestComms (const char IdComms[Frm_MAX_BYTES_ID + 1]); static void TL_Com_LinkToShowOnlyLatestComms (const char IdComms[Frm_MAX_BYTES_ID + 1]);
@ -232,7 +234,6 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
unsigned NumInitialComms; unsigned NumInitialComms;
unsigned NumFinalCommsToGet; unsigned NumFinalCommsToGet;
unsigned NumFinalCommsGot; unsigned NumFinalCommsGot;
unsigned NumCom;
char IdComms[Frm_MAX_BYTES_ID + 1]; char IdComms[Frm_MAX_BYTES_ID + 1];
/***** Get number of comments in note *****/ /***** Get number of comments in note *****/
@ -258,9 +259,8 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
} }
/***** Get final comments of this note from database *****/ /***** Get final comments of this note from database *****/
NumFinalCommsGot = TL_DB_GetFinalComms (Not->NotCod, NumFinalCommsGot = TL_DB_GetFinalComms (Not->NotCod,NumFinalCommsToGet,
NumFinalCommsToGet, &mysql_res);
&mysql_res);
/* /*
Before clicking "See prev..." --> After clicking "See prev..." Before clicking "See prev..." --> After clicking "See prev..."
_________________________________ _________________________________ _________________________________ _________________________________
@ -322,10 +322,7 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
if (NumFinalCommsGot) if (NumFinalCommsGot)
{ {
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_UL_Begin ("class=\"TL_LIST\"");
for (NumCom = 0; TL_Com_ListComms (Timeline,mysql_res,NumFinalCommsGot);
NumCom < NumFinalCommsGot;
NumCom++)
TL_Com_WriteOneCommInList (Timeline,mysql_res);
HTM_UL_End (); HTM_UL_End ();
} }
@ -358,13 +355,9 @@ void TL_Com_ShowHiddenCommsGbl (void)
TL_ResetTimeline (&Timeline); TL_ResetTimeline (&Timeline);
/***** Get parameters *****/ /***** Get parameters *****/
/* Get note code */ /* Get note code, identifier and number of comments to get */
NotCod = TL_Not_GetParamNotCod (); NotCod = TL_Not_GetParamNotCod ();
/* Get identifier */
Par_GetParToText ("IdComments",IdComms,Frm_MAX_BYTES_ID); Par_GetParToText ("IdComments",IdComms,Frm_MAX_BYTES_ID);
/* Get number of comments to get */
NumInitialCommsToGet = (unsigned) Par_GetParToLong ("NumHidCom"); NumInitialCommsToGet = (unsigned) Par_GetParToLong ("NumHidCom");
/***** Write HTML inside DIV with hidden comments *****/ /***** Write HTML inside DIV with hidden comments *****/
@ -387,7 +380,6 @@ static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline,
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned long NumInitialCommsGot; unsigned long NumInitialCommsGot;
unsigned long NumCom;
/***** Get comments of this note from database *****/ /***** Get comments of this note from database *****/
NumInitialCommsGot = TL_DB_GetInitialComms (NotCod, NumInitialCommsGot = TL_DB_GetInitialComms (NotCod,
@ -396,10 +388,7 @@ static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline,
/***** List comments *****/ /***** List comments *****/
HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComms); HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComms);
for (NumCom = 0; TL_Com_ListComms (Timeline,mysql_res,NumInitialCommsGot);
NumCom < NumInitialCommsGot;
NumCom++)
TL_Com_WriteOneCommInList (Timeline,mysql_res);
HTM_UL_End (); HTM_UL_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -408,6 +397,22 @@ static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline,
return NumInitialCommsGot; return NumInitialCommsGot;
} }
/*****************************************************************************/
/*********************** Write comments in a note ****************************/
/*****************************************************************************/
static void TL_Com_ListComms (const struct TL_Timeline *Timeline,
MYSQL_RES *mysql_res,unsigned NumComms)
{
unsigned NumCom;
/***** List comments one by one *****/
for (NumCom = 0;
NumCom < NumComms;
NumCom++)
TL_Com_WriteOneCommInList (Timeline,mysql_res);
}
/*****************************************************************************/ /*****************************************************************************/
/************************* Write a comment in list ***************************/ /************************* Write a comment in list ***************************/
/*****************************************************************************/ /*****************************************************************************/
@ -465,8 +470,8 @@ static void TL_Com_LinkToShowPreviousComms (const char IdComms[Frm_MAX_BYTES_ID
" style=\"display:none;\"", // Hidden " style=\"display:none;\"", // Hidden
IdComms); IdComms);
TL_Com_PutIconToToggleComms (IdComms,"angle-up.svg", TL_Com_PutIconToToggleComms (IdComms,"angle-up.svg",
Str_BuildStringLong (Txt_See_the_previous_X_COMMENTS, Str_BuildStringLong (Txt_See_the_previous_X_COMMENTS,
(long) NumInitialComms)); (long) NumInitialComms));
Str_FreeString (); Str_FreeString ();
HTM_DIV_End (); HTM_DIV_End ();
} }
@ -857,18 +862,21 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
/* Begin alert */ /* Begin alert */
TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment); TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment);
/* Show comment */ /* Begin box for the comment */
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
NULL,NULL, NULL,NULL,
NULL,Box_NOT_CLOSABLE); NULL,Box_NOT_CLOSABLE);
/* Indent the comment */
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\""); HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
HTM_DIV_End (); HTM_DIV_End ();
/* Show the comment */
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
TL_Com_CheckAndWriteComm (Timeline,&Com); TL_Com_CheckAndWriteComm (Timeline,&Com);
HTM_DIV_End (); HTM_DIV_End ();
/* End box */
Box_BoxEnd (); Box_BoxEnd ();
/* End alert */ /* End alert */