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.
*/
#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 JS_FILE "swad20.6.2.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
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.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)

View File

@ -310,25 +310,26 @@ void Tml_RefreshNewTimelineGbl (void)
{
struct Tml_Timeline Timeline;
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything
{
/***** Reset timeline context *****/
Tml_ResetTimeline (&Timeline);
/***** Trivial check: session should be open *****/
if (!Gbl.Session.IsOpen) // If session has been closed...
return; // ...do not write anything
/***** Get which users *****/
Timeline.Who = Tml_Who_GetGlobalWho ();
/***** Reset timeline context *****/
Tml_ResetTimeline (&Timeline);
/***** Get list of pubications to show in timeline *****/
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
/***** Get which users *****/
Timeline.Who = Tml_Who_GetGlobalWho ();
/***** Show new timeline *****/
Tml_Pub_InsertNewPubsInTimeline (&Timeline);
/***** Get list of pubications to show in timeline *****/
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
/***** Free chained list of publications *****/
Tml_Pub_FreeListPubs (&Timeline);
}
/***** Show new 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;
/***** Get user whom profile is displayed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // Existing user
{
/***** Reset timeline context *****/
Tml_ResetTimeline (&Timeline);
if (!Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // If user does not exist...
return; // ...do not write anything
/***** If user exists, show old publications *****/
Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR;
Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
Tml_GetAndShowOldTimeline (&Timeline);
}
/***** Reset timeline context *****/
Tml_ResetTimeline (&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)
{
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];
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\"");
/***** Show publisher's name inside form to go to user's public profile *****/
/* Begin form */
Frm_BeginFormUnique (ActSeeOthPubPrf);
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 ();
Tml_Not_WriteAuthorName (&PublisherDat,
"BT_LINK Tml_TOP_PUBLISHER");
/***** Show action made *****/
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\"");
/***** 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 *****/
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 *****************/
/*****************************************************************************/
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_Another_user_s_profile;
@ -376,8 +365,7 @@ void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat)
/* Author's name */
HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (UsrDat->UsrCod) ? Txt_My_public_profile :
Txt_Another_user_s_profile,
"BT_LINK TL_RIGHT_AUTHOR TL_RIGHT_AUTHOR_WIDTH DAT_N_BOLD",
NULL);
Class,NULL);
HTM_Txt (UsrDat->FullName);
HTM_BUTTON_End ();

View File

@ -92,7 +92,8 @@ void Tml_Not_CheckAndWriteNoteWithTopMsg (const struct Tml_Timeline *Timeline,
Tml_TopMessage_t TopMessage,
long PublisherCod);
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,
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\"");
/***** 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 *****/
/* Begin container */