diff --git a/swad_changelog.h b/swad_changelog.h index aeaf5f548..cc7daae7c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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.6 (2021-04-29)" +#define Log_PLATFORM_VERSION "SWAD 20.68.7 (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.7: Apr 29, 2021 Code refactoring in timeline. (309749 lines) 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) diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index b29b5eb48..edd4ba668 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -388,8 +388,8 @@ static unsigned Tml_Com_WriteHiddenComms (struct Tml_Timeline *Timeline, /***** Get comments of this note from database *****/ NumInitialCommsGot = Tml_DB_GetInitialComms (NotCod, - NumInitialCommsToGet, - &mysql_res); + NumInitialCommsToGet, + &mysql_res); /***** List comments *****/ HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComms); @@ -478,7 +478,7 @@ static void Tml_Com_LinkToShowComms (Tml_Com_ContractExpand_t ConExp, /* Icon and text */ Tml_Com_PutIconToToggleComms (IdComms,Icon[ConExp], - Str_BuildStringLong (Text[ConExp],(long) NumComms)); + Str_BuildStringLong (Text[ConExp],(long) NumComms)); Str_FreeString (); /* End container */ @@ -661,13 +661,12 @@ static void Tml_Com_WriteButtons (const struct Tml_Timeline *Timeline, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM, Com->PubCod,Com->UsrCod,Com->NumFavs, Tml_Usr_SHOW_FEW_USRS); - HTM_DIV_End (); /***** Foot column 2: icon to remove this comment *****/ HTM_DIV_Begin ("class=\"TL_REM\""); - if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author - Tml_Com_PutFormToRemoveComm (Timeline,Com->PubCod); + if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author + Tml_Com_PutFormToRemoveComm (Timeline,Com->PubCod); HTM_DIV_End (); /***** End buttons container *****/ @@ -957,6 +956,7 @@ void Tml_Com_RemoveComGbl (void) static void Tml_Com_RemoveComm (void) { extern const char *Txt_The_post_no_longer_exists; + extern const char *Txt_You_dont_have_permission_to_perform_this_action; extern const char *Txt_Comment_removed; struct Tml_Com_Comment Com; @@ -979,7 +979,7 @@ static void Tml_Com_RemoveComm (void) if (!Usr_ItsMe (Com.UsrCod)) { Med_MediaDestructor (&Com.Content.Media); - Ale_ShowAlert (Ale_ERROR,"You are not the author."); + Ale_ShowAlert (Ale_ERROR,Txt_You_dont_have_permission_to_perform_this_action); return; } diff --git a/swad_timeline_favourite.c b/swad_timeline_favourite.c index cbd827c99..aeed1293e 100644 --- a/swad_timeline_favourite.c +++ b/swad_timeline_favourite.c @@ -84,8 +84,8 @@ void Tml_Fav_ShowAllFaversNoteGbl (void) /***** Write HTML inside DIV with form to fav/unfav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE, - Not.NotCod,Not.UsrCod,Not.NumFavs, - Tml_Usr_SHOW_ALL_USRS); + Not.NotCod,Not.UsrCod,Not.NumFavs, + Tml_Usr_SHOW_ALL_USRS); } /*****************************************************************************/ @@ -110,8 +110,8 @@ void Tml_Fav_FavNoteGbl (void) /***** Write HTML inside DIV with form to unfav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE, - Not.NotCod,Not.UsrCod,Not.NumFavs, - Tml_Usr_SHOW_FEW_USRS); + Not.NotCod,Not.UsrCod,Not.NumFavs, + Tml_Usr_SHOW_FEW_USRS); } void Tml_Fav_UnfNoteUsr (void) @@ -132,8 +132,8 @@ void Tml_Fav_UnfNoteGbl (void) /***** Write HTML inside DIV with form to fav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE, - Not.NotCod,Not.UsrCod,Not.NumFavs, - Tml_Usr_SHOW_FEW_USRS); + Not.NotCod,Not.UsrCod,Not.NumFavs, + Tml_Usr_SHOW_FEW_USRS); } static void Tml_Fav_FavNote (struct Tml_Not_Note *Not) @@ -150,7 +150,7 @@ static void Tml_Fav_FavNote (struct Tml_Not_Note *Not) /***** Trivial check: Have I faved this note? *****/ if (Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_NOTE,Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) + Gbl.Usrs.Me.UsrDat.UsrCod)) return; /***** Mark note as favourite in database *****/ @@ -158,7 +158,7 @@ static void Tml_Fav_FavNote (struct Tml_Not_Note *Not) /***** Update number of times this note is favourited *****/ Not->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_NOTE, - Not->NotCod,Not->UsrCod); + Not->NotCod,Not->UsrCod); /***** Create notification about favourite post for the author of the post *****/ @@ -181,7 +181,7 @@ static void Tml_Fav_UnfNote (struct Tml_Not_Note *Not) /***** Trivial check: Have I faved this note? *****/ if (!Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_NOTE,Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) + Gbl.Usrs.Me.UsrDat.UsrCod)) return; /***** Delete the mark as favourite from database *****/ @@ -189,7 +189,7 @@ static void Tml_Fav_UnfNote (struct Tml_Not_Note *Not) /***** Update number of times this note is favourited *****/ Not->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_NOTE, - Not->NotCod,Not->UsrCod); + Not->NotCod,Not->UsrCod); /***** Mark possible notifications on this note as removed *****/ OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod); @@ -222,8 +222,8 @@ void Tml_Fav_ShowAllFaversComGbl (void) /***** Write HTML inside DIV with form to fav/unfav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM, - Com.PubCod,Com.UsrCod,Com.NumFavs, - Tml_Usr_SHOW_ALL_USRS); + Com.PubCod,Com.UsrCod,Com.NumFavs, + Tml_Usr_SHOW_ALL_USRS); } /*****************************************************************************/ @@ -248,8 +248,8 @@ void Tml_Fav_FavCommGbl (void) /***** Write HTML inside DIV with form to unfav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM, - Com.PubCod,Com.UsrCod,Com.NumFavs, - Tml_Usr_SHOW_FEW_USRS); + Com.PubCod,Com.UsrCod,Com.NumFavs, + Tml_Usr_SHOW_FEW_USRS); } void Tml_Fav_UnfCommUsr (void) @@ -270,8 +270,8 @@ void Tml_Fav_UnfCommGbl (void) /***** Write HTML inside DIV with form to fav *****/ Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM, - Com.PubCod,Com.UsrCod,Com.NumFavs, - Tml_Usr_SHOW_FEW_USRS); + Com.PubCod,Com.UsrCod,Com.NumFavs, + Tml_Usr_SHOW_FEW_USRS); } static void Tml_Fav_FavComm (struct Tml_Com_Comment *Com) @@ -292,7 +292,7 @@ static void Tml_Fav_FavComm (struct Tml_Com_Comment *Com) /***** Trivial check: Have I faved this comment? *****/ if (Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_COMM,Com->PubCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) + Gbl.Usrs.Me.UsrDat.UsrCod)) { Med_MediaDestructor (&Com->Content.Media); return; @@ -303,7 +303,7 @@ static void Tml_Fav_FavComm (struct Tml_Com_Comment *Com) /***** Update number of times this comment is favourited *****/ Com->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_COMM, - Com->PubCod,Com->UsrCod); + Com->PubCod,Com->UsrCod); /***** Create notification about favourite post for the author of the post *****/ @@ -331,7 +331,7 @@ static void Tml_Fav_UnfComm (struct Tml_Com_Comment *Com) /***** Trivial check: Have I faved this comment? *****/ if (!Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_COMM,Com->PubCod, - Gbl.Usrs.Me.UsrDat.UsrCod)) + Gbl.Usrs.Me.UsrDat.UsrCod)) { Med_MediaDestructor (&Com->Content.Media); return; @@ -342,7 +342,7 @@ static void Tml_Fav_UnfComm (struct Tml_Com_Comment *Com) /***** Update number of times this comment is favourited *****/ Com->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_COMM, - Com->PubCod,Com->UsrCod); + Com->PubCod,Com->UsrCod); /***** Mark possible notifications on this comment as removed *****/ Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_FAV,Com->PubCod); diff --git a/swad_timeline_form.c b/swad_timeline_form.c index a8928d7a0..c3b7b8501 100644 --- a/swad_timeline_form.c +++ b/swad_timeline_form.c @@ -182,7 +182,8 @@ void Tml_Frm_PutFormToFavUnfShaUns (Tml_Usr_FavSha_t FavSha,long Cod) /***************** Begin a form in global or user timeline *******************/ /*****************************************************************************/ -void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action) +void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline, + Tml_Frm_Action_t Action) { if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) { @@ -208,8 +209,8 @@ void Tml_Frm_EndForm (void) /*****************************************************************************/ void Tml_Frm_PutFormToSeeAllFaversSharers (Tml_Frm_Action_t Action, - const char *ParamFormat,long ParamCod, - Tml_Usr_HowManyUsrs_t HowManyUsrs) + const char *ParamFormat,long ParamCod, + Tml_Usr_HowManyUsrs_t HowManyUsrs) { extern const char *Txt_View_all_USERS; struct TL_Form Form = @@ -298,8 +299,8 @@ void Tml_Frm_FormFavSha (const struct TL_Form *Form) /*****************************************************************************/ void Tml_Frm_FormToShowHiddenComms (long NotCod, - char IdComms[Frm_MAX_BYTES_ID + 1], - unsigned NumInitialComms) + char IdComms[Frm_MAX_BYTES_ID + 1], + unsigned NumInitialComms) { extern const char *The_ClassFormLinkInBox[The_NUM_THEMES]; extern const char *Txt_See_the_previous_X_COMMENTS; @@ -376,8 +377,9 @@ void Tml_Frm_BeginAlertRemove (const char *QuestionTxt) Ale_ShowAlertAndButton1 (Ale_QUESTION,QuestionTxt); } -void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action, - void (*FuncParams) (void *Args)) +void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline, + Tml_Frm_Action_t Action, + void (*FuncParams) (void *Args)) { extern const char *Txt_Remove; diff --git a/swad_timeline_form.h b/swad_timeline_form.h index eb3690332..1496b7870 100644 --- a/swad_timeline_form.h +++ b/swad_timeline_form.h @@ -79,20 +79,22 @@ struct TL_Form void Tml_Frm_PutFormToFavUnfShaUns (Tml_Usr_FavSha_t FavSha,long Cod); -void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action); +void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline, + Tml_Frm_Action_t Action); void Tml_Frm_EndForm (void); void Tml_Frm_PutFormToSeeAllFaversSharers (Tml_Frm_Action_t Action, - const char *ParamFormat,long ParamCod, - Tml_Usr_HowManyUsrs_t HowManyUsrs); + const char *ParamFormat,long ParamCod, + Tml_Usr_HowManyUsrs_t HowManyUsrs); void Tml_Frm_FormFavSha (const struct TL_Form *Form); void Tml_Frm_FormToShowHiddenComms (long NotCod, - char IdComms[Frm_MAX_BYTES_ID + 1], - unsigned NumInitialComms); + char IdComms[Frm_MAX_BYTES_ID + 1], + unsigned NumInitialComms); void Tml_Frm_BeginAlertRemove (const char *QuestionTxt); -void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action, - void (*FuncParams) (void *Args)); +void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline, + Tml_Frm_Action_t Action, + void (*FuncParams) (void *Args)); #endif diff --git a/swad_timeline_note.c b/swad_timeline_note.c index b2b6d62bb..925712ced 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -180,8 +180,8 @@ void Tml_Not_ShowHighlightedNote (struct Tml_Timeline *Timeline, /* Check and write note with top message */ Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,Not, - TopMessages[NotifyEvent], - PublisherDat.UsrCod); + TopMessages[NotifyEvent], + PublisherDat.UsrCod); /* End container */ HTM_DIV_End (); @@ -485,53 +485,60 @@ static void Tml_Not_WriteLocationInHierarchy (const struct Tml_Not_Note *Not, const struct Hie_Hierarchy *Hie, const char ForumName[For_MAX_BYTES_FORUM_NAME + 1]) { - extern const char *Txt_Forum; - extern const char *Txt_Course; - extern const char *Txt_Degree; - extern const char *Txt_Center; extern const char *Txt_Institution; + extern const char *Txt_Center; + extern const char *Txt_Degree; + extern const char *Txt_Course; + extern const char *Txt_Forum; - switch (Not->NoteType) - { - case TL_NOTE_INS_DOC_PUB_FILE: - case TL_NOTE_INS_SHA_PUB_FILE: - /* Write location (institution) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Institution,Hie->Ins.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_CTR_DOC_PUB_FILE: - case TL_NOTE_CTR_SHA_PUB_FILE: - /* Write location (center) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Center,Hie->Ctr.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_DEG_DOC_PUB_FILE: - case TL_NOTE_DEG_SHA_PUB_FILE: - /* Write location (degree) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Degree,Hie->Deg.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_CRS_DOC_PUB_FILE: - case TL_NOTE_CRS_SHA_PUB_FILE: - case TL_NOTE_CALL_FOR_EXAM: - case TL_NOTE_NOTICE: - /* Write location (course) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Course,Hie->Crs.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_FORUM_POST: - /* Write forum name */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Forum,ForumName); - HTM_DIV_End (); - break; - default: - break; - } + /***** Begin container *****/ + HTM_DIV_Begin ("class=\"TL_LOC\""); + + /***** Write location *****/ + switch (Not->NoteType) + { + case TL_NOTE_INS_DOC_PUB_FILE: + case TL_NOTE_INS_SHA_PUB_FILE: + /* Write location (institution) in hierarchy */ + HTM_TxtF ("%s: %s", + Txt_Institution, + Hie->Ins.ShrtName); + break; + case TL_NOTE_CTR_DOC_PUB_FILE: + case TL_NOTE_CTR_SHA_PUB_FILE: + /* Write location (center) in hierarchy */ + HTM_TxtF ("%s: %s", + Txt_Center, + Hie->Ctr.ShrtName); + break; + case TL_NOTE_DEG_DOC_PUB_FILE: + case TL_NOTE_DEG_SHA_PUB_FILE: + /* Write location (degree) in hierarchy */ + HTM_TxtF ("%s: %s", + Txt_Degree, + Hie->Deg.ShrtName); + break; + case TL_NOTE_CRS_DOC_PUB_FILE: + case TL_NOTE_CRS_SHA_PUB_FILE: + case TL_NOTE_CALL_FOR_EXAM: + case TL_NOTE_NOTICE: + /* Write location (course) in hierarchy */ + HTM_TxtF ("%s: %s", + Txt_Course, + Hie->Crs.ShrtName); + break; + case TL_NOTE_FORUM_POST: + /* Write forum name */ + HTM_TxtF ("%s: %s", + Txt_Forum, + ForumName); + break; + default: + break; + } + + /***** End container *****/ + HTM_DIV_End (); } /*****************************************************************************/