mirror of https://github.com/acanas/swad-core.git
Version 20.33.5: Feb 22, 2021 Code refactoring related to writing a timeline note.
This commit is contained in:
parent
4e2c41035a
commit
05e8fd6276
|
@ -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.33.4 (2021-02-22)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.33.5 (2021-02-22)"
|
||||
#define CSS_FILE "swad20.8.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
|
@ -601,7 +601,8 @@ 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.33.4: Feb 22, 2021 Some actions renamed. (? lines)
|
||||
Version 20.33.5: Feb 22, 2021 Code refactoring related to writing a timeline note. (304889 lines)
|
||||
Version 20.33.4: Feb 22, 2021 Some actions renamed. (304883 lines)
|
||||
Version 20.33.3: Feb 22, 2021 Code refactoring in timeline related to forms. (304882 lines)
|
||||
Version 20.33.2: Feb 22, 2021 Code refactoring in timeline related to forms. (304880 lines)
|
||||
Version 20.33.1: Feb 22, 2021 Code refactoring in timeline related to forms. (304888 lines)
|
||||
|
|
|
@ -70,6 +70,7 @@ extern struct Globals Gbl;
|
|||
|
||||
static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod);
|
||||
|
||||
static void TL_Not_GetAndWriteNoteNotPost (const struct TL_Not_Note *Not);
|
||||
static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not,
|
||||
struct Hie_Hierarchy *Hie,
|
||||
struct For_Forum *Forum,
|
||||
|
@ -189,18 +190,14 @@ void TL_Not_InsertNoteInVisibleTimeline (long NotCod)
|
|||
void TL_Not_WriteNote (struct TL_Timeline *Timeline,
|
||||
const struct TL_Not_Note *Not,
|
||||
TL_TopMessage_t TopMessage,
|
||||
long PublisherCod, // Who did the action (publication, commenting, faving, sharing, mentioning)
|
||||
TL_Highlight_t Highlight, // Highlight note
|
||||
long PublisherCod, // Who did the action (publication, commenting, faving, sharing, mentioning)
|
||||
TL_Highlight_t Highlight, // Highlight note
|
||||
TL_ShowAlone_t ShowNoteAlone) // Note is shown alone, not in a list
|
||||
{
|
||||
struct UsrData AuthorDat;
|
||||
bool IAmTheAuthor;
|
||||
struct Hie_Hierarchy Hie;
|
||||
bool ShowPhoto = false;
|
||||
char PhotoURL[PATH_MAX + 1];
|
||||
struct For_Forums Forums;
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
|
||||
unsigned NumComments;
|
||||
char IdNewComment[Frm_MAX_BYTES_ID + 1];
|
||||
static unsigned NumDiv = 0; // Used to create unique div id for fav and shared
|
||||
|
@ -231,13 +228,6 @@ void TL_Not_WriteNote (struct TL_Timeline *Timeline,
|
|||
Ale_ShowAlert (Ale_ERROR,"Error in note.");
|
||||
else
|
||||
{
|
||||
/***** Initialize location in hierarchy *****/
|
||||
Hie.Cty.CtyCod = -1L;
|
||||
Hie.Ins.InsCod = -1L;
|
||||
Hie.Ctr.CtrCod = -1L;
|
||||
Hie.Deg.DegCod = -1L;
|
||||
Hie.Crs.CrsCod = -1L;
|
||||
|
||||
/***** Write sharer/commenter if distinct to author *****/
|
||||
if (TopMessage != TL_TOP_MESSAGE_NONE)
|
||||
TL_Not_WriteTopMessage (TopMessage,PublisherCod);
|
||||
|
@ -269,31 +259,10 @@ void TL_Not_WriteNote (struct TL_Timeline *Timeline,
|
|||
TL_WriteDateTime (Not->DateTimeUTC);
|
||||
|
||||
/* Write content of the note */
|
||||
if (Not->NoteType == TL_NOTE_POST)
|
||||
/* Write post content */
|
||||
if (Not->NoteType == TL_NOTE_POST) // It's a post
|
||||
TL_Pst_GetAndWritePost (Not->Cod);
|
||||
else
|
||||
{
|
||||
/* Reset forums */
|
||||
For_ResetForums (&Forums);
|
||||
|
||||
/* Get location in hierarchy */
|
||||
if (!Not->Unavailable)
|
||||
TL_Not_GetLocationInHierarchy (Not,&Hie,&Forums.Forum,ForumName);
|
||||
|
||||
/* Write note type */
|
||||
TL_Not_PutFormGoToAction (Not,&Forums);
|
||||
|
||||
/* Write location in hierarchy */
|
||||
if (!Not->Unavailable)
|
||||
TL_Not_WriteLocationInHierarchy (Not,&Hie,ForumName);
|
||||
|
||||
/* Write note summary */
|
||||
TL_Not_GetNoteSummary (Not,SummaryStr);
|
||||
HTM_DIV_Begin ("class=\"TL_TXT\"");
|
||||
HTM_Txt (SummaryStr);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
else // Not a post
|
||||
TL_Not_GetAndWriteNoteNotPost (Not);
|
||||
|
||||
/* End right container */
|
||||
HTM_DIV_End ();
|
||||
|
@ -348,8 +317,7 @@ void TL_Not_WriteNote (struct TL_Timeline *Timeline,
|
|||
HTM_DIV_End ();
|
||||
|
||||
/* Put hidden form to write a new comment */
|
||||
TL_Com_PutHiddenFormToWriteNewComment (Timeline,
|
||||
Not->NotCod,IdNewComment);
|
||||
TL_Com_PutHiddenFormToWriteNewComment (Timeline,Not->NotCod,IdNewComment);
|
||||
|
||||
/***** Free memory used for author's data *****/
|
||||
Usr_UsrDataDestructor (&AuthorDat);
|
||||
|
@ -430,6 +398,38 @@ void TL_Not_WriteAuthorNote (const struct UsrData *UsrDat)
|
|||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Get and write a note which is not a post ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_Not_GetAndWriteNoteNotPost (const struct TL_Not_Note *Not)
|
||||
{
|
||||
struct Hie_Hierarchy Hie;
|
||||
struct For_Forums Forums;
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
|
||||
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
|
||||
|
||||
/* Reset forums */
|
||||
For_ResetForums (&Forums);
|
||||
|
||||
/* Get location in hierarchy */
|
||||
if (!Not->Unavailable)
|
||||
TL_Not_GetLocationInHierarchy (Not,&Hie,&Forums.Forum,ForumName);
|
||||
|
||||
/* Write note type */
|
||||
TL_Not_PutFormGoToAction (Not,&Forums);
|
||||
|
||||
/* Write location in hierarchy */
|
||||
if (!Not->Unavailable)
|
||||
TL_Not_WriteLocationInHierarchy (Not,&Hie,ForumName);
|
||||
|
||||
/* Write note summary */
|
||||
TL_Not_GetNoteSummary (Not,SummaryStr);
|
||||
HTM_DIV_Begin ("class=\"TL_TXT\"");
|
||||
HTM_Txt (SummaryStr);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Get location in hierarchy **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -439,6 +439,14 @@ static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not,
|
|||
struct For_Forum *Forum,
|
||||
char ForumName[For_MAX_BYTES_FORUM_NAME + 1])
|
||||
{
|
||||
/***** Initialize location in hierarchy *****/
|
||||
Hie->Cty.CtyCod =
|
||||
Hie->Ins.InsCod =
|
||||
Hie->Ctr.CtrCod =
|
||||
Hie->Deg.DegCod =
|
||||
Hie->Crs.CrsCod = -1L;
|
||||
|
||||
/***** Get location in hierarchy *****/
|
||||
switch (Not->NoteType)
|
||||
{
|
||||
case TL_NOTE_INS_DOC_PUB_FILE:
|
||||
|
|
Loading…
Reference in New Issue