Version 20.39.5: Mar 02, 2021 Code refactoring in timeline notes and posts.

This commit is contained in:
acanas 2021-03-02 13:10:09 +01:00
parent 68b98f420a
commit 7557901463
7 changed files with 52 additions and 43 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.4 (2021-03-02)" #define Log_PLATFORM_VERSION "SWAD 20.39.5 (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.5: Mar 02, 2021 Code refactoring in timeline notes and posts. (305620 lines)
Version 20.39.4: Mar 02, 2021 Code refactoring in timeline notes. (305614 lines) Version 20.39.4: Mar 02, 2021 Code refactoring in timeline notes. (305614 lines)
Version 20.39.3: Mar 02, 2021 Code refactoring in timeline favourites. (305601 lines) Version 20.39.3: Mar 02, 2021 Code refactoring in timeline favourites. (305601 lines)
Version 20.39.2: Mar 02, 2021 Code refactoring in timeline database. (305612 lines) Version 20.39.2: Mar 02, 2021 Code refactoring in timeline database. (305612 lines)

View File

@ -437,7 +437,7 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline,
/***** Form to write a new post *****/ /***** Form to write a new post *****/
if (GlobalTimeline || if (GlobalTimeline ||
Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod)) Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod))
TL_Pst_PutFormToWriteNewPost (Timeline); TL_Pst_PutPhotoAndFormToWriteNewPost (Timeline);
/***** New publications refreshed dynamically via AJAX *****/ /***** New publications refreshed dynamically via AJAX *****/
if (GlobalTimeline) if (GlobalTimeline)

View File

@ -195,7 +195,7 @@ static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
} }
/*****************************************************************************/ /*****************************************************************************/
/************************* Form to comment a note ****************************/ /**************************** Form with textarea *****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline, static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline,
@ -203,22 +203,21 @@ static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline,
{ {
extern const char *Txt_New_TIMELINE_comment; extern const char *Txt_New_TIMELINE_comment;
/***** Form to write the comment *****/ /***** Begin container *****/
/* Begin container */
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_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_COMM); TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_COMM);
TL_Not_PutHiddenParamNotCod (NotCod); TL_Not_PutHiddenParamNotCod (NotCod);
/* Textarea and button */ /***** Textarea and button *****/
TL_Pst_PutTextarea (Txt_New_TIMELINE_comment, TL_Pst_PutTextarea (Txt_New_TIMELINE_comment,
"TL_COM_TEXTAREA TL_COMM_WIDTH"); "TL_COM_TEXTAREA TL_COMM_WIDTH");
/* End form */ /***** End form *****/
TL_Frm_EndForm (); TL_Frm_EndForm ();
/* End container */ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
} }

View File

@ -71,7 +71,6 @@ extern struct Globals Gbl;
static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod); static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod);
static void TL_Not_WriteNote (const struct TL_Timeline *Timeline, static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
const struct TL_Not_Note *Not); const struct TL_Not_Note *Not);
static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat);
static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not, static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
@ -306,7 +305,7 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
/***** Left top: author's photo *****/ /***** Left top: author's photo *****/
TL_Not_ShowAuthorPhoto (&UsrDat); TL_Not_ShowAuthorPhoto (&UsrDat,true); // Use unique id
/***** Right top: author's name, time, and content *****/ /***** Right top: author's name, time, and content *****/
TL_Not_WriteAuthorTimeAndContent (Not,&UsrDat); TL_Not_WriteAuthorTimeAndContent (Not,&UsrDat);
@ -322,14 +321,14 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
/*********************** Show photo of author of a note **********************/ /*********************** Show photo of author of a note **********************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat) void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
{ {
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\""); HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
/* Photo */ /* Photo */
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,true); // Use unique id Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,FormUnique);
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -91,6 +91,7 @@ void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct TL_Not_Note *Not,
TL_TopMessage_t TopMessage, TL_TopMessage_t TopMessage,
long PublisherCod); long PublisherCod);
void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique);
void TL_Not_WriteAuthorName (const struct UsrData *UsrDat); void TL_Not_WriteAuthorName (const struct UsrData *UsrDat);
void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not,

View File

@ -62,6 +62,8 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline);
static long TL_Pst_ReceivePost (void); static long TL_Pst_ReceivePost (void);
/*****************************************************************************/ /*****************************************************************************/
@ -99,7 +101,7 @@ void TL_Pst_GetAndWritePost (long PstCod)
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
/***** Write content *****/ /***** Write content text *****/
if (Content.Txt[0]) if (Content.Txt[0])
{ {
HTM_DIV_Begin ("class=\"TL_TXT\""); HTM_DIV_Begin ("class=\"TL_TXT\"");
@ -107,7 +109,7 @@ void TL_Pst_GetAndWritePost (long PstCod)
HTM_DIV_End (); HTM_DIV_End ();
} }
/***** Show image *****/ /***** Show media *****/
Med_ShowMedia (&Content.Media,"TL_PST_MED_CONT TL_RIGHT_WIDTH", Med_ShowMedia (&Content.Media,"TL_PST_MED_CONT TL_RIGHT_WIDTH",
"TL_PST_MED TL_RIGHT_WIDTH"); "TL_PST_MED TL_RIGHT_WIDTH");
@ -119,10 +121,8 @@ void TL_Pst_GetAndWritePost (long PstCod)
/********************** Form to write a new publication **********************/ /********************** Form to write a new publication **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline) void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline)
{ {
extern const char *Txt_New_TIMELINE_post;
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_UL_Begin ("class=\"TL_LIST\"");
@ -130,32 +130,10 @@ void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
HTM_LI_Begin ("class=\"TL_WIDTH\""); HTM_LI_Begin ("class=\"TL_WIDTH\"");
/***** Left: write author's photo (my photo) *****/ /***** Left: write author's photo (my photo) *****/
/* Begin container */ TL_Not_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat,false); // Don't use unique id
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
/* Author's photo */
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO45x60",Pho_ZOOM,false);
/* End container */
HTM_DIV_End ();
/***** Right: author's name, time, textarea *****/ /***** Right: author's name, time, textarea *****/
/* Begin container */ TL_Pst_PutFormToWriteNewPost (Timeline);
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/* Author name */
TL_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat);
/* Form to write the post */
HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\"");
TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_POST);
TL_Pst_PutTextarea (Txt_New_TIMELINE_post,
"TL_PST_TEXTAREA TL_RIGHT_WIDTH");
TL_Frm_EndForm ();
HTM_DIV_End ();
/* End container */
HTM_DIV_End ();
/***** End list item *****/ /***** End list item *****/
HTM_LI_End (); HTM_LI_End ();
@ -164,6 +142,37 @@ void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
HTM_UL_End (); HTM_UL_End ();
} }
/*****************************************************************************/
/**************** Author's name, time, and form with textarea ****************/
/*****************************************************************************/
static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
{
extern const char *Txt_New_TIMELINE_post;
/***** Begin container *****/
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/***** Author name *****/
TL_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat);
/***** Form to write the post *****/
/* Begin container */
HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\"");
/* Form with textarea */
TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_POST);
TL_Pst_PutTextarea (Txt_New_TIMELINE_post,
"TL_PST_TEXTAREA TL_RIGHT_WIDTH");
TL_Frm_EndForm ();
/* End container */
HTM_DIV_End ();
/***** End container *****/
HTM_DIV_End ();
}
/*****************************************************************************/ /*****************************************************************************/
/*** Put textarea and button inside a form to submit a new post or comment ***/ /*** Put textarea and button inside a form to submit a new post or comment ***/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -46,7 +46,7 @@ struct TL_Pst_PostContent
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_GetAndWritePost (long PstCod); void TL_Pst_GetAndWritePost (long PstCod);
void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline); void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline);
void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea); void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea);