Version 20.34.1: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (305009 lines)

This commit is contained in:
acanas 2021-02-23 09:36:45 +01:00
parent 8b27481510
commit 86775586fe
4 changed files with 59 additions and 61 deletions

View File

@ -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.34 (2021-02-23)"
#define Log_PLATFORM_VERSION "SWAD 20.34.1 (2021-02-23)"
#define CSS_FILE "swad20.33.9.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.34.1: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (305009 lines)
Version 20.34: Feb 23, 2021 Code refactoring in timeline related to sharing and faving. (305011 lines)
Version 20.33.11: Feb 23, 2021 Code refactoring in timeline. (305001 lines)
Version 20.33.10: Feb 23, 2021 Code refactoring related to writing a timeline notes and comments. (305038 lines)

View File

@ -19077,7 +19077,7 @@ const char *Txt_Mark_all_NOTIFICATIONS_as_read =
"Marcar todas como lidas";
#endif
const char *Txt_Mark_as_favourite =
const char *Txt_TIMELINE_Mark_as_favourite =
#if L==1 // ca
"Marca com favorit";
#elif L==2 // de

View File

@ -409,30 +409,29 @@ static void TL_Fav_PutDisabledIconFav (unsigned NumFavs)
static void TL_Fav_PutFormToFavUnfNote (long NotCod)
{
extern const char *Txt_TIMELINE_Favourite;
extern const char *Txt_Mark_as_favourite;
TL_Frm_Action_t Action;
const char *Icon;
const char *Title;
extern const char *Txt_TIMELINE_Mark_as_favourite;
bool FavUnf;
static TL_Frm_Action_t Action[2] =
{
TL_Frm_FAV_NOTE, // Not faved ==> fav
TL_Frm_UNF_NOTE, // Faved ==> unfav
};
static const char *Icon[2] =
{
TL_Fav_ICON_FAV, // Not faved ==> put icon to fav
TL_Fav_ICON_FAVED, // Faved ==> put icon to unfav
};
const char *Title[2] =
{
Txt_TIMELINE_Mark_as_favourite, // Not faved ==> put text to fav
Txt_TIMELINE_Favourite, // Faved ==> put text to unfav
};
/***** Select whether fav/unfav *****/
if (TL_Fav_CheckIfNoteIsFavedByUsr (NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited this note
{
/* Faved ==> put form and icon to unfav */
Action = TL_Frm_UNF_NOTE;
Icon = TL_Fav_ICON_FAVED;
Title = Txt_TIMELINE_Favourite;
}
else
{
/* Not faved ==> put form and icon to fav */
Action = TL_Frm_FAV_NOTE;
Icon = TL_Fav_ICON_FAV;
Title = Txt_Mark_as_favourite;
}
FavUnf = TL_Fav_CheckIfNoteIsFavedByUsr (NotCod,Gbl.Usrs.Me.UsrDat.UsrCod); // I have favourited this note
/***** Form and icon to fav/unfav note *****/
TL_Frm_FormFavSha (Action,"NotCod=%ld",NotCod,Icon,Title);
TL_Frm_FormFavSha (Action[FavUnf],"NotCod=%ld",NotCod,Icon[FavUnf],Title[FavUnf]);
}
/*****************************************************************************/
@ -442,30 +441,29 @@ static void TL_Fav_PutFormToFavUnfNote (long NotCod)
static void TL_Fav_PutFormToFavUnfComm (long PubCod)
{
extern const char *Txt_TIMELINE_Favourite;
extern const char *Txt_Mark_as_favourite;
TL_Frm_Action_t Action;
const char *Icon;
const char *Title;
extern const char *Txt_TIMELINE_Mark_as_favourite;
bool FavUnf;
static TL_Frm_Action_t Action[2] =
{
TL_Frm_FAV_COMM, // Not faved ==> fav
TL_Frm_UNF_COMM, // Faved ==> unfav
};
static const char *Icon[2] =
{
TL_Fav_ICON_FAV, // Not faved ==> put icon to fav
TL_Fav_ICON_FAVED, // Faved ==> put icon to unfav
};
const char *Title[2] =
{
Txt_TIMELINE_Mark_as_favourite, // Not faved ==> put text to fav
Txt_TIMELINE_Favourite, // Faved ==> put text to unfav
};
/***** Select whether fav/unfav *****/
if (TL_Fav_CheckIfCommIsFavedByUsr (PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited this comment
{
/* Faved ==> put form and icon to unfav */
Action = TL_Frm_UNF_COMM;
Icon = TL_Fav_ICON_FAVED;
Title = Txt_TIMELINE_Favourite;
}
else
{
/* Not faved ==> put form and icon to fav */
Action = TL_Frm_FAV_COMM;
Icon = TL_Fav_ICON_FAV;
Title = Txt_Mark_as_favourite;
}
FavUnf = TL_Fav_CheckIfNoteIsFavedByUsr (PubCod,Gbl.Usrs.Me.UsrDat.UsrCod); // I have favourited this comment
/***** Form and icon to fav/unfav *****/
TL_Frm_FormFavSha (Action,"PubCod=%ld",PubCod,Icon,Title);
TL_Frm_FormFavSha (Action[FavUnf],"PubCod=%ld",PubCod,Icon[FavUnf],Title[FavUnf]);
}
/*****************************************************************************/

View File

@ -254,29 +254,28 @@ static void TL_Sha_PutFormToShaUnsNote (long NotCod)
{
extern const char *Txt_TIMELINE_Shared;
extern const char *Txt_TIMELINE_Share;
TL_Frm_Action_t Action;
const char *Icon;
const char *Title;
bool ShaUns;
static TL_Frm_Action_t Action[2] =
{
TL_Frm_SHA_NOTE, // Not shared ==> share
TL_Frm_UNS_NOTE, // Shared ==> unshare
};
static const char *Icon[2] =
{
TL_Sha_ICON_SHARE, // Not shared ==> put icon to share
TL_Sha_ICON_SHARED, // Shared ==> put icon to unshare
};
const char *Title[2] =
{
Txt_TIMELINE_Share, // Not shared ==> put text to share
Txt_TIMELINE_Shared, // Shared ==> put text to unshare
};
/***** Select whether share/unshare *****/
if (TL_Sha_CheckIfNoteIsSharedByUsr (NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have shared this note
{
/* Shared ==> put form and icon to unshare */
Action = TL_Frm_UNS_NOTE;
Icon = TL_Sha_ICON_SHARED;
Title = Txt_TIMELINE_Shared;
}
else
{
/* Not shared ==> put form and icon to share */
Action = TL_Frm_SHA_NOTE;
Icon = TL_Sha_ICON_SHARE;
Title = Txt_TIMELINE_Share;
}
ShaUns = TL_Sha_CheckIfNoteIsSharedByUsr (NotCod,Gbl.Usrs.Me.UsrDat.UsrCod); // I have shared this note
/***** Form and icon to share/unshare note *****/
TL_Frm_FormFavSha (Action,"NotCod=%ld",NotCod,Icon,Title);
TL_Frm_FormFavSha (Action[ShaUns],"NotCod=%ld",NotCod,Icon[ShaUns],Title[ShaUns]);
}
/*****************************************************************************/