Version 20.33.9: Feb 22, 2021 Code refactoring related to writing a timeline comment.

This commit is contained in:
acanas 2021-02-22 19:16:28 +01:00
parent f6724c549d
commit 4362193730
8 changed files with 67 additions and 96 deletions

View File

@ -3655,6 +3655,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
} }
.TL_TXT .TL_TXT
{ {
text-align:left;
padding-top:5px; padding-top:5px;
color:#202020; color:#202020;
font-size:13pt; font-size:13pt;

View File

@ -553,8 +553,8 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.33.8 (2021-02-22)" #define Log_PLATFORM_VERSION "SWAD 20.33.9 (2021-02-22)"
#define CSS_FILE "swad20.8.css" #define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
TODO: Juan Miguel Boyero Corral: Este verano ha habido varias personas que han solicitado incluir la funcionalidad del apartado de Actividades en SWADroid. Si lo ves viable podríamos estudiarlo. TODO: Juan Miguel Boyero Corral: Este verano ha habido varias personas que han solicitado incluir la funcionalidad del apartado de Actividades en SWADroid. Si lo ves viable podríamos estudiarlo.
@ -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: 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 TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.33.9: Feb 22, 2021 Code refactoring related to writing a timeline comment. (304949 lines)
Version 20.33.8: Feb 22, 2021 Code refactoring related to writing a timeline note. (304971 lines) Version 20.33.8: Feb 22, 2021 Code refactoring related to writing a timeline note. (304971 lines)
Version 20.33.7: Feb 22, 2021 Code refactoring related to writing a timeline note. (304923 lines) Version 20.33.7: Feb 22, 2021 Code refactoring related to writing a timeline note. (304923 lines)
Version 20.33.6: Feb 22, 2021 Code refactoring related to writing a timeline note. (304898 lines) Version 20.33.6: Feb 22, 2021 Code refactoring related to writing a timeline note. (304898 lines)

View File

@ -469,11 +469,12 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline,
TL_Not_GetDataOfNoteByCod (&Not); TL_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
TL_Not_WriteNoteInList (Timeline,&Not, HTM_LI_Begin ("class=\"%s\"",Not.NotCod == NotCodToHighlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" :
TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, "TL_WIDTH TL_SEP");
Not.NotCod == NotCodToHighlight ? TL_HIGHLIGHT : TL_Not_WriteNoteWithTopMsg (Timeline,&Not,
TL_DONT_HIGHLIGHT, TL_Pub_GetTopMessage (Pub->PubType),
TL_DONT_SHOW_ALONE); Pub->PublisherCod);
HTM_LI_End ();
} }
HTM_UL_End (); HTM_UL_End ();

View File

@ -90,7 +90,7 @@ struct TL_Timeline
long NotCod; // Used as parameter about social note to be edited, removed... long NotCod; // Used as parameter about social note to be edited, removed...
long PubCod; // Used as parameter about social publishing to be edited, removed... long PubCod; // Used as parameter about social publishing to be edited, removed...
}; };
/*
typedef enum typedef enum
{ {
TL_DONT_HIGHLIGHT, TL_DONT_HIGHLIGHT,
@ -102,7 +102,7 @@ typedef enum
TL_DONT_SHOW_ALONE, TL_DONT_SHOW_ALONE,
TL_SHOW_ALONE, TL_SHOW_ALONE,
} TL_ShowAlone_t; } TL_ShowAlone_t;
*/
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -80,8 +80,7 @@ static void TL_Com_LinkToShowPreviousComments (const char IdComments[Frm_MAX_BYT
static void TL_Com_PutIconToToggleComments (const char *UniqueId, static void TL_Com_PutIconToToggleComments (const char *UniqueId,
const char *Icon,const char *Text); const char *Icon,const char *Text);
static void TL_Com_WriteComment (const struct TL_Timeline *Timeline, static void TL_Com_WriteComment (const struct TL_Timeline *Timeline,
struct TL_Com_Comment *Com, struct TL_Com_Comment *Com);
TL_ShowAlone_t ShowCommentAlone); // Comment is shown alone, not in a list
static void TL_Com_WriteAuthorComment (struct UsrData *UsrDat); static void TL_Com_WriteAuthorComment (struct UsrData *UsrDat);
static void TL_Com_PutFormToRemoveComment (const struct TL_Timeline *Timeline, static void TL_Com_PutFormToRemoveComment (const struct TL_Timeline *Timeline,
@ -427,8 +426,9 @@ static void TL_Com_WriteOneCommentInList (const struct TL_Timeline *Timeline,
TL_Com_GetDataOfCommentFromRow (row,&Com); TL_Com_GetDataOfCommentFromRow (row,&Com);
/***** Write comment *****/ /***** Write comment *****/
TL_Com_WriteComment (Timeline,&Com, HTM_LI_Begin ("class=\"TL_COM\"");
TL_DONT_SHOW_ALONE); TL_Com_WriteComment (Timeline,&Com);
HTM_LI_End ();
/***** Free image *****/ /***** Free image *****/
Med_MediaDestructor (&Com.Content.Media); Med_MediaDestructor (&Com.Content.Media);
@ -497,8 +497,7 @@ static void TL_Com_PutIconToToggleComments (const char *UniqueId,
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteComment (const struct TL_Timeline *Timeline, static void TL_Com_WriteComment (const struct TL_Timeline *Timeline,
struct TL_Com_Comment *Com, struct TL_Com_Comment *Com)
TL_ShowAlone_t ShowCommentAlone) // Comment is shown alone, not in a list
{ {
struct UsrData AuthorDat; struct UsrData AuthorDat;
bool IAmTheAuthor; bool IAmTheAuthor;
@ -508,29 +507,9 @@ static void TL_Com_WriteComment (const struct TL_Timeline *Timeline,
NumDiv++; NumDiv++;
if (ShowCommentAlone == TL_SHOW_ALONE) if (Com->PubCod > 0 &&
{ Com->NotCod > 0 &&
/***** Box begin *****/ Com->UsrCod > 0)
Box_BoxBegin (NULL,NULL,
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
HTM_DIV_End ();
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
HTM_UL_Begin ("class=\"LIST_LEFT\"");
}
/***** Start list item *****/
HTM_LI_Begin (ShowCommentAlone == TL_SHOW_ALONE ? NULL :
"class=\"TL_COM\"");
if (Com->PubCod <= 0 ||
Com->NotCod <= 0 ||
Com->UsrCod <= 0)
Ale_ShowAlert (Ale_ERROR,"Error in comment.");
else
{ {
/***** Get author's data *****/ /***** Get author's data *****/
Usr_UsrDataConstructor (&AuthorDat); Usr_UsrDataConstructor (&AuthorDat);
@ -578,8 +557,9 @@ static void TL_Com_WriteComment (const struct TL_Timeline *Timeline,
/* Put icon to remove this comment */ /* Put icon to remove this comment */
HTM_DIV_Begin ("class=\"TL_REM\""); HTM_DIV_Begin ("class=\"TL_REM\"");
if (IAmTheAuthor && // if (IAmTheAuthor &&
ShowCommentAlone == TL_DONT_SHOW_ALONE) // ShowCommentAlone == TL_DONT_SHOW_ALONE)
if (IAmTheAuthor)
TL_Com_PutFormToRemoveComment (Timeline,Com->PubCod); TL_Com_PutFormToRemoveComment (Timeline,Com->PubCod);
HTM_DIV_End (); HTM_DIV_End ();
@ -589,17 +569,8 @@ static void TL_Com_WriteComment (const struct TL_Timeline *Timeline,
/***** Free memory used for user's data *****/ /***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&AuthorDat); Usr_UsrDataDestructor (&AuthorDat);
} }
else
/***** End list item *****/ Ale_ShowAlert (Ale_ERROR,"Error in comment.");
HTM_LI_End ();
if (ShowCommentAlone == TL_SHOW_ALONE)
{
/***** Box end *****/
HTM_UL_End ();
HTM_DIV_End ();
Box_BoxEnd ();
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -816,8 +787,18 @@ static void TL_Com_RequestRemovalComment (struct TL_Timeline *Timeline)
TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment); TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment);
/* Show comment */ /* Show comment */
TL_Com_WriteComment (Timeline,&Com, Box_BoxBegin (NULL,NULL,
TL_SHOW_ALONE); NULL,NULL,
NULL,Box_NOT_CLOSABLE);
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
HTM_DIV_End ();
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
TL_Com_WriteComment (Timeline,&Com);
HTM_DIV_End ();
Box_BoxEnd ();
/* End alert */ /* End alert */
Timeline->PubCod = Com.PubCod; // Publication to be removed Timeline->PubCod = Com.PubCod; // Publication to be removed

View File

@ -69,6 +69,8 @@ extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod); static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod);
static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
const struct TL_Not_Note *Not);
static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat); static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat);
static void TL_Not_WriteTop (const struct TL_Not_Note *Not, static void TL_Not_WriteTop (const struct TL_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
@ -174,12 +176,11 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
NULL,NULL, NULL,NULL,
NULL,Box_CLOSABLE); NULL,Box_CLOSABLE);
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_DIV_Begin ("class=\"TL_WIDTH TL_NEW_PUB\"");
TL_Not_WriteNoteInList (Timeline,Not, TL_Not_WriteNoteWithTopMsg (Timeline,Not,
TopMessages[NotifyEvent],PublisherDat.UsrCod, TopMessages[NotifyEvent],
TL_HIGHLIGHT, PublisherDat.UsrCod);
TL_SHOW_ALONE); HTM_DIV_End ();
HTM_UL_End ();
Box_BoxEnd (); Box_BoxEnd ();
} }
@ -211,21 +212,11 @@ void TL_Not_InsertNoteInVisibleTimeline (long NotCod)
/******************************** Write note *********************************/ /******************************** Write note *********************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_WriteNoteInList (const struct TL_Timeline *Timeline, void TL_Not_WriteNoteWithTopMsg (const struct TL_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct TL_Not_Note *Not,
TL_TopMessage_t TopMessage, TL_TopMessage_t TopMessage,
long PublisherCod, // Who did the action (publication, commenting, faving, sharing, mentioning) 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
{ {
/***** Start list item *****/
HTM_LI_Begin ("class=\"%s\"",
ShowNoteAlone == TL_SHOW_ALONE ?
(Highlight == TL_HIGHLIGHT ? "TL_WIDTH TL_NEW_PUB" :
"TL_WIDTH") :
(Highlight == TL_HIGHLIGHT ? "TL_WIDTH TL_SEP TL_NEW_PUB" :
"TL_WIDTH TL_SEP"));
if (Not->NotCod > 0 && if (Not->NotCod > 0 &&
Not->UsrCod > 0 && Not->UsrCod > 0 &&
Not->NoteType != TL_NOTE_UNKNOWN) Not->NoteType != TL_NOTE_UNKNOWN)
@ -239,9 +230,6 @@ void TL_Not_WriteNoteInList (const struct TL_Timeline *Timeline,
} }
else else
Ale_ShowAlert (Ale_ERROR,"Error in note."); Ale_ShowAlert (Ale_ERROR,"Error in note.");
/***** End list item *****/
HTM_LI_End ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1129,12 +1117,11 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
NULL,NULL, NULL,NULL,
NULL,Box_CLOSABLE); NULL,Box_CLOSABLE);
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_DIV_Begin ("class=\"TL_WIDTH\"");
TL_Not_WriteNoteInList (Timeline,&Not, TL_Not_WriteNoteWithTopMsg (Timeline,&Not,
TL_TOP_MESSAGE_NONE,-1L, TL_TOP_MESSAGE_NONE,
TL_DONT_HIGHLIGHT, -1L);
TL_SHOW_ALONE); HTM_DIV_End ();
HTM_UL_End ();
Box_BoxEnd (); Box_BoxEnd ();
/* End alert */ /* End alert */

View File

@ -90,12 +90,10 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
void TL_Not_InsertNoteInJustRetrievedNotes (long NotCod); void TL_Not_InsertNoteInJustRetrievedNotes (long NotCod);
void TL_Not_InsertNoteInVisibleTimeline (long NotCod); void TL_Not_InsertNoteInVisibleTimeline (long NotCod);
void TL_Not_WriteNoteInList (const struct TL_Timeline *Timeline, void TL_Not_WriteNoteWithTopMsg (const struct TL_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct TL_Not_Note *Not,
TL_TopMessage_t TopMessage, TL_TopMessage_t TopMessage,
long PublisherCod, // Who did the action (publication, commenting, faving, sharing, mentioning) long PublisherCod);
TL_Highlight_t Highlight, // Highlight note
TL_ShowAlone_t ShowNoteAlone); // Note is shown alone, not in a list
void TL_Not_WriteAuthorName (const struct UsrData *UsrDat); void TL_Not_WriteAuthorName (const struct UsrData *UsrDat);
void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not,

View File

@ -539,10 +539,11 @@ void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline)
TL_Not_GetDataOfNoteByCod (&Not); TL_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
TL_Not_WriteNoteInList (Timeline,&Not, HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\"");
TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, TL_Not_WriteNoteWithTopMsg (Timeline,&Not,
TL_DONT_HIGHLIGHT, TL_Pub_GetTopMessage (Pub->PubType),
TL_DONT_SHOW_ALONE); Pub->PublisherCod);
HTM_LI_End ();
} }
} }
@ -566,10 +567,11 @@ void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline)
TL_Not_GetDataOfNoteByCod (&Not); TL_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
TL_Not_WriteNoteInList (Timeline,&Not, HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP\"");
TL_Pub_GetTopMessage (Pub->PubType),Pub->PublisherCod, TL_Not_WriteNoteWithTopMsg (Timeline,&Not,
TL_DONT_HIGHLIGHT, TL_Pub_GetTopMessage (Pub->PubType),
TL_DONT_SHOW_ALONE); Pub->PublisherCod);
HTM_LI_End ();
} }
} }