Version 20.68.6: Apr 29, 2021 Code refactoring in timeline.

This commit is contained in:
acanas 2021-04-29 22:08:33 +02:00
parent 4c2f1f3142
commit 7dfcd428eb
5 changed files with 38 additions and 46 deletions

View File

@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.68.5 (2021-04-29)" #define Log_PLATFORM_VERSION "SWAD 20.68.6 (2021-04-29)"
#define CSS_FILE "swad20.45.css" #define CSS_FILE "swad20.45.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.68.6: Apr 29, 2021 Code refactoring in timeline. (309738 lines)
Version 20.68.5: Apr 29, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (309746 lines) Version 20.68.5: Apr 29, 2021 Fixed bug in matches. Reported by Jesús Garrido Alcázar. (309746 lines)
Version 20.68.4: Apr 27, 2021 Fixed bug in question tags. Reported by Julio Ortega Lopera. (309802 lines) Version 20.68.4: Apr 27, 2021 Fixed bug in question tags. Reported by Julio Ortega Lopera. (309802 lines)
Version 20.68.3: Apr 27, 2021 Maximum file size increased from 1.5 GiB to 2000 MiB. (309809 lines) Version 20.68.3: Apr 27, 2021 Maximum file size increased from 1.5 GiB to 2000 MiB. (309809 lines)

View File

@ -310,25 +310,26 @@ void Tml_RefreshNewTimelineGbl (void)
{ {
struct Tml_Timeline Timeline; struct Tml_Timeline Timeline;
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything /***** Trivial check: session should be open *****/
{ if (!Gbl.Session.IsOpen) // If session has been closed...
/***** Reset timeline context *****/ return; // ...do not write anything
Tml_ResetTimeline (&Timeline);
/***** Get which users *****/ /***** Reset timeline context *****/
Timeline.Who = Tml_Who_GetGlobalWho (); Tml_ResetTimeline (&Timeline);
/***** Get list of pubications to show in timeline *****/ /***** Get which users *****/
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL; Timeline.Who = Tml_Who_GetGlobalWho ();
Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
/***** Show new timeline *****/ /***** Get list of pubications to show in timeline *****/
Tml_Pub_InsertNewPubsInTimeline (&Timeline); Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
/***** Free chained list of publications *****/ /***** Show new timeline *****/
Tml_Pub_FreeListPubs (&Timeline); Tml_Pub_InsertNewPubsInTimeline (&Timeline);
}
/***** Free chained list of publications *****/
Tml_Pub_FreeListPubs (&Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -356,16 +357,16 @@ void Tml_RefreshOldTimelineUsr (void)
struct Tml_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // Existing user if (!Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // If user does not exist...
{ return; // ...do not write anything
/***** Reset timeline context *****/
Tml_ResetTimeline (&Timeline);
/***** If user exists, show old publications *****/ /***** Reset timeline context *****/
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR; Tml_ResetTimeline (&Timeline);
Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
Tml_GetAndShowOldTimeline (&Timeline); /***** If user exists, show old publications *****/
} Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR;
Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
Tml_GetAndShowOldTimeline (&Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -247,8 +247,6 @@ void Tml_Not_CheckAndWriteNoteWithTopMsg (const struct Tml_Timeline *Timeline,
static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherCod) static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherCod)
{ {
extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile;
extern const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[Tml_NUM_TOP_MESSAGES]; extern const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[Tml_NUM_TOP_MESSAGES];
struct UsrData PublisherDat; struct UsrData PublisherDat;
@ -265,19 +263,8 @@ static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherC
HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER TL_WIDTH\""); HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER TL_WIDTH\"");
/***** Show publisher's name inside form to go to user's public profile *****/ /***** Show publisher's name inside form to go to user's public profile *****/
/* Begin form */ Tml_Not_WriteAuthorName (&PublisherDat,
Frm_BeginFormUnique (ActSeeOthPubPrf); "BT_LINK Tml_TOP_PUBLISHER");
Usr_PutParamUsrCodEncrypted (PublisherDat.EnUsrCod);
/* Publisher's name */
HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (PublisherCod) ? Txt_My_public_profile :
Txt_Another_user_s_profile,
"BT_LINK Tml_TOP_PUBLISHER",NULL);
HTM_Txt (PublisherDat.FullName);
HTM_BUTTON_End ();
/* End form */
Frm_EndForm ();
/***** Show action made *****/ /***** Show action made *****/
HTM_TxtF (" %s:",Txt_TIMELINE_NOTE_TOP_MESSAGES[TopMessage]); HTM_TxtF (" %s:",Txt_TIMELINE_NOTE_TOP_MESSAGES[TopMessage]);
@ -347,7 +334,8 @@ static void Tml_Not_WriteAuthorTimeAndContent (const struct Tml_Not_Note *Not,
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/***** Write author's full name *****/ /***** Write author's full name *****/
Tml_Not_WriteAuthorName (UsrDat); Tml_Not_WriteAuthorName (UsrDat,
"BT_LINK TL_RIGHT_AUTHOR TL_RIGHT_AUTHOR_WIDTH DAT_N_BOLD");
/***** Write date and time *****/ /***** Write date and time *****/
Tml_WriteDateTime (Not->DateTimeUTC); Tml_WriteDateTime (Not->DateTimeUTC);
@ -363,7 +351,8 @@ static void Tml_Not_WriteAuthorTimeAndContent (const struct Tml_Not_Note *Not,
/*************** Write name and nickname of author of a note *****************/ /*************** Write name and nickname of author of a note *****************/
/*****************************************************************************/ /*****************************************************************************/
void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat) void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat,
const char *Class)
{ {
extern const char *Txt_My_public_profile; extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
@ -376,8 +365,7 @@ void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat)
/* Author's name */ /* Author's name */
HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (UsrDat->UsrCod) ? Txt_My_public_profile : HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (UsrDat->UsrCod) ? Txt_My_public_profile :
Txt_Another_user_s_profile, Txt_Another_user_s_profile,
"BT_LINK TL_RIGHT_AUTHOR TL_RIGHT_AUTHOR_WIDTH DAT_N_BOLD", Class,NULL);
NULL);
HTM_Txt (UsrDat->FullName); HTM_Txt (UsrDat->FullName);
HTM_BUTTON_End (); HTM_BUTTON_End ();

View File

@ -92,7 +92,8 @@ void Tml_Not_CheckAndWriteNoteWithTopMsg (const struct Tml_Timeline *Timeline,
Tml_TopMessage_t TopMessage, Tml_TopMessage_t TopMessage,
long PublisherCod); long PublisherCod);
void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique); void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique);
void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat); void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat,
const char *Class);
void Tml_Not_GetNoteSummary (const struct Tml_Not_Note *Not, void Tml_Not_GetNoteSummary (const struct Tml_Not_Note *Not,
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]); char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]);

View File

@ -179,7 +179,8 @@ static void Tml_Pst_PutFormToWriteNewPost (struct Tml_Timeline *Timeline)
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/***** Author name *****/ /***** Author name *****/
Tml_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat); Tml_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat,
"BT_LINK TL_RIGHT_AUTHOR TL_RIGHT_AUTHOR_WIDTH DAT_N_BOLD");
/***** Form to write the post *****/ /***** Form to write the post *****/
/* Begin container */ /* Begin container */