diff --git a/swad_changelog.h b/swad_changelog.h index f4db7cd45..d37605096 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 20.29.2 (2021-02-11)" +#define Log_PLATFORM_VERSION "SWAD 20.29.3 (2021-02-11)" #define CSS_FILE "swad20.8.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,6 +601,7 @@ 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: Salvador Romero Cortés: @acanas opción para editar posts + Version 20.29.3: Feb 11, 2021 Code refactoring in timeline. (305826 lines) Version 20.29.2: Feb 11, 2021 Code refactoring in timeline. (305806 lines) Version 20.29.1: Feb 11, 2021 Code refactoring in timeline. (305780 lines) Version 20.29: Feb 11, 2021 New module swad_timeline_notification. (305767 lines) diff --git a/swad_timeline_note.c b/swad_timeline_note.c index 7cfa589aa..489e10112 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -75,6 +75,12 @@ static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not, struct Crs_Course *Crs, struct For_Forum *Forum, char ForumName[For_MAX_BYTES_FORUM_NAME + 1]); +static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not, + const struct Ins_Instit *Ins, + const struct Ctr_Centre *Ctr, + const struct Deg_Degree *Deg, + const struct Crs_Course *Crs, + const char ForumName[For_MAX_BYTES_FORUM_NAME + 1]); static void TL_Not_PutFormGoToAction (const struct TL_Not_Note *Not, const struct For_Forums *Forums); @@ -191,11 +197,6 @@ void TL_Not_WriteNote (struct TL_Timeline *Timeline, TL_Highlight_t Highlight, // Highlight note TL_ShowAlone_t ShowNoteAlone) // Note is shown alone, not in a list { - extern const char *Txt_Forum; - extern const char *Txt_Course; - extern const char *Txt_Degree; - extern const char *Txt_Centre; - extern const char *Txt_Institution; struct UsrData AuthorDat; bool IAmTheAuthor; struct Ins_Instit Ins; @@ -292,47 +293,8 @@ void TL_Not_WriteNote (struct TL_Timeline *Timeline, /* Write location in hierarchy */ if (!Not->Unavailable) - 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,Ins.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_CTR_DOC_PUB_FILE: - case TL_NOTE_CTR_SHA_PUB_FILE: - /* Write location (centre) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Centre,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,Deg.ShrtName); - HTM_DIV_End (); - break; - case TL_NOTE_CRS_DOC_PUB_FILE: - case TL_NOTE_CRS_SHA_PUB_FILE: - case TL_NOTE_EXAM_ANNOUNCEMENT: - case TL_NOTE_NOTICE: - /* Write location (course) in hierarchy */ - HTM_DIV_Begin ("class=\"TL_LOC\""); - HTM_TxtF ("%s: %s",Txt_Course,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; - } + TL_Not_WriteLocationInHierarchy (Not,&Ins,&Ctr,&Deg,&Crs, + ForumName); /* Write note summary */ TL_Not_GetNoteSummary (Not,SummaryStr); @@ -477,7 +439,7 @@ void TL_Not_WriteAuthorNote (const struct UsrData *UsrDat) } /*****************************************************************************/ -/*************** Write name and nickname of author of a note *****************/ +/************************ Get location in hierarchy **************************/ /*****************************************************************************/ static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not, @@ -526,6 +488,66 @@ static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not, } } +/*****************************************************************************/ +/*********************** Write location in hierarchy *************************/ +/*****************************************************************************/ + +static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not, + const struct Ins_Instit *Ins, + const struct Ctr_Centre *Ctr, + const struct Deg_Degree *Deg, + const struct Crs_Course *Crs, + 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_Centre; + extern const char *Txt_Institution; + + 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,Ins->ShrtName); + HTM_DIV_End (); + break; + case TL_NOTE_CTR_DOC_PUB_FILE: + case TL_NOTE_CTR_SHA_PUB_FILE: + /* Write location (centre) in hierarchy */ + HTM_DIV_Begin ("class=\"TL_LOC\""); + HTM_TxtF ("%s: %s",Txt_Centre,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,Deg->ShrtName); + HTM_DIV_End (); + break; + case TL_NOTE_CRS_DOC_PUB_FILE: + case TL_NOTE_CRS_SHA_PUB_FILE: + case TL_NOTE_EXAM_ANNOUNCEMENT: + case TL_NOTE_NOTICE: + /* Write location (course) in hierarchy */ + HTM_DIV_Begin ("class=\"TL_LOC\""); + HTM_TxtF ("%s: %s",Txt_Course,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; + } + } + /*****************************************************************************/ /************* Put form to go to an action depending on the note *************/ /*****************************************************************************/