mirror of https://github.com/acanas/swad-core.git
Version 22.118.12:May 30, 2023 Code refactoring in forums and messages.
This commit is contained in:
parent
2279d5cbd8
commit
bf031de6db
|
@ -896,7 +896,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"",
|
HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Center status */
|
/* Center status */
|
||||||
|
@ -1343,7 +1343,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
|
||||||
/***** Center requester *****/
|
/***** Center requester *****/
|
||||||
HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"",
|
HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&Gbl.Usrs.Me.UsrDat,true);
|
Usr_WriteAuthor (&Gbl.Usrs.Me.UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Center status *****/
|
/***** Center status *****/
|
||||||
|
|
|
@ -633,6 +633,7 @@ TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la ho
|
||||||
#define CSS_FILE "swad22.118.5.css"
|
#define CSS_FILE "swad22.118.5.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 22.118.12:May 30, 2023 Code refactoring in forums and messages. (337408 lines)
|
||||||
Version 22.118.11:May 30, 2023 Code refactoring in strings. (337391 lines)
|
Version 22.118.11:May 30, 2023 Code refactoring in strings. (337391 lines)
|
||||||
Version 22.118.10:May 30, 2023 Draw logo in head even if it does not exist. (337359 lines)
|
Version 22.118.10:May 30, 2023 Draw logo in head even if it does not exist. (337359 lines)
|
||||||
Version 22.118.9: May 30, 2023 Code refactoring in user account. (337363 lines)
|
Version 22.118.9: May 30, 2023 Code refactoring in user account. (337363 lines)
|
||||||
|
|
|
@ -119,4 +119,10 @@ typedef enum
|
||||||
Cns_FULL_NAME,
|
Cns_FULL_NAME,
|
||||||
} Cns_ShrtOrFullName_t;
|
} Cns_ShrtOrFullName_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
Cns_DISABLED,
|
||||||
|
Cns_ENABLED,
|
||||||
|
} Cns_Enabled_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Course status */
|
/* Course status */
|
||||||
|
@ -1371,7 +1371,7 @@ static void Crs_PutFormToCreateCourse (void)
|
||||||
/***** Course requester *****/
|
/***** Course requester *****/
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&Gbl.Usrs.Me.UsrDat,true);
|
Usr_WriteAuthor (&Gbl.Usrs.Me.UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Course status *****/
|
/***** Course status *****/
|
||||||
|
|
|
@ -481,7 +481,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Degree status */
|
/* Degree status */
|
||||||
|
@ -608,7 +608,7 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
|
||||||
/***** Degree requester *****/
|
/***** Degree requester *****/
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&Gbl.Usrs.Me.UsrDat,true);
|
Usr_WriteAuthor (&Gbl.Usrs.Me.UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Degree status *****/
|
/***** Degree status *****/
|
||||||
|
|
84
swad_forum.c
84
swad_forum.c
|
@ -912,7 +912,7 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||||
char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
|
char Content[Cns_MAX_BYTES_LONG_TEXT + 1];
|
||||||
struct Med_Media Media;
|
struct Med_Media Media;
|
||||||
bool Enabled;
|
Cns_Enabled_t Enabled;
|
||||||
char *Title;
|
char *Title;
|
||||||
|
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
|
@ -922,13 +922,13 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
Med_MediaConstructor (&Media);
|
Med_MediaConstructor (&Media);
|
||||||
|
|
||||||
/***** Check if post is enabled *****/
|
/***** Check if post is enabled *****/
|
||||||
Enabled = !For_DB_GetIfPstIsDisabled (Forums->PstCod);
|
Enabled = For_DB_GetIfPstIsEnabled (Forums->PstCod);
|
||||||
|
|
||||||
/***** Get data of post *****/
|
/***** Get data of post *****/
|
||||||
For_GetPstData (Forums->PstCod,&UsrDat.UsrCod,&CreatTimeUTC,
|
For_GetPstData (Forums->PstCod,&UsrDat.UsrCod,&CreatTimeUTC,
|
||||||
Subject,OriginalContent,&Media);
|
Subject,OriginalContent,&Media);
|
||||||
|
|
||||||
if (Enabled)
|
if (Enabled == Cns_ENABLED)
|
||||||
/* Return this subject as last subject */
|
/* Return this subject as last subject */
|
||||||
Str_Copy (LastSubject,Subject,Cns_MAX_BYTES_SUBJECT);
|
Str_Copy (LastSubject,Subject,Cns_MAX_BYTES_SUBJECT);
|
||||||
|
|
||||||
|
@ -964,15 +964,18 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
NewPst ? "MSG_BG_NEW" :
|
NewPst ? "MSG_BG_NEW" :
|
||||||
"MSG_BG",
|
"MSG_BG",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
if (Enabled)
|
switch (Enabled)
|
||||||
{
|
{
|
||||||
if (Subject[0])
|
case Cns_DISABLED:
|
||||||
HTM_Txt (Subject);
|
HTM_TxtF ("[%s]",Txt_FORUM_Post_banned);
|
||||||
else
|
break;
|
||||||
HTM_TxtF ("[%s]",Txt_no_subject);
|
case Cns_ENABLED:
|
||||||
}
|
if (Subject[0])
|
||||||
else
|
HTM_Txt (Subject);
|
||||||
HTM_TxtF ("[%s]",Txt_FORUM_Post_banned);
|
else
|
||||||
|
HTM_TxtF ("[%s]",Txt_no_subject);
|
||||||
|
break;
|
||||||
|
}
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
@ -983,28 +986,28 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
|
|
||||||
if (ICanModerateForum)
|
if (ICanModerateForum)
|
||||||
{
|
{
|
||||||
Frm_BeginFormAnchor (Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
Frm_BeginFormAnchor (Enabled == Cns_ENABLED ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
||||||
For_ActionsEnbPstFor[Forums->Forum.Type],
|
For_ActionsEnbPstFor[Forums->Forum.Type],
|
||||||
For_FORUM_POSTS_SECTION_ID);
|
For_FORUM_POSTS_SECTION_ID);
|
||||||
For_PutParsForum (Forums);
|
For_PutParsForum (Forums);
|
||||||
Ico_PutIconLink (Enabled ? "eye.svg" :
|
Ico_PutIconLink (Enabled == Cns_ENABLED ? "eye.svg" :
|
||||||
"eye-slash.svg",
|
"eye-slash.svg",
|
||||||
Enabled ? Ico_GREEN :
|
Enabled == Cns_ENABLED ? Ico_GREEN :
|
||||||
Ico_RED,
|
Ico_RED,
|
||||||
Enabled ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
Enabled == Cns_ENABLED ? For_ActionsDisPstFor[Forums->Forum.Type] :
|
||||||
For_ActionsEnbPstFor[Forums->Forum.Type]);
|
For_ActionsEnbPstFor[Forums->Forum.Type]);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (asprintf (&Title,Enabled ? Txt_FORUM_Post_X_allowed :
|
if (asprintf (&Title,Enabled == Cns_ENABLED ? Txt_FORUM_Post_X_allowed :
|
||||||
Txt_FORUM_Post_X_banned,
|
Txt_FORUM_Post_X_banned,
|
||||||
PstNum) < 0)
|
PstNum) < 0)
|
||||||
Err_NotEnoughMemoryExit ();
|
Err_NotEnoughMemoryExit ();
|
||||||
Ico_PutIcon (Enabled ? "eye.svg" :
|
Ico_PutIcon (Enabled == Cns_ENABLED ? "eye.svg" :
|
||||||
"eye-slash.svg",
|
"eye-slash.svg",
|
||||||
Enabled ? Ico_GREEN :
|
Enabled == Cns_ENABLED ? Ico_GREEN :
|
||||||
Ico_RED,
|
Ico_RED,
|
||||||
Title,
|
Title,
|
||||||
"ICO_HIDDEN ICO16x16");
|
"ICO_HIDDEN ICO16x16");
|
||||||
free (Title);
|
free (Title);
|
||||||
|
@ -1027,24 +1030,25 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
||||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||||
Usr_DONT_GET_PREFS,
|
Usr_DONT_GET_PREFS,
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
Msg_WriteMsgAuthor (&UsrDat,Enabled);
|
Usr_WriteAuthor (&UsrDat,Enabled);
|
||||||
if (Enabled)
|
if (Enabled == Cns_ENABLED)
|
||||||
/* Write number of posts from this user */
|
/* Write number of posts from this user */
|
||||||
For_WriteNumberOfPosts (Forums,UsrDat.UsrCod);
|
For_WriteNumberOfPosts (Forums,UsrDat.UsrCod);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Write post content *****/
|
/***** Write post content *****/
|
||||||
HTM_TD_Begin ("class=\"LT MSG_TXT_%s\"",The_GetSuffix ());
|
HTM_TD_Begin ("class=\"LT MSG_TXT_%s\"",The_GetSuffix ());
|
||||||
if (Enabled)
|
switch (Enabled)
|
||||||
{
|
{
|
||||||
Str_Copy (Content,OriginalContent,sizeof (Content) - 1);
|
case Cns_DISABLED:
|
||||||
Msg_WriteMsgContent (Content,true,false);
|
HTM_Txt (Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_the_forums);
|
||||||
|
break;
|
||||||
/***** Show image *****/
|
case Cns_ENABLED:
|
||||||
Med_ShowMedia (&Media,"FOR_IMG_CONT","FOR_IMG");
|
Str_Copy (Content,OriginalContent,sizeof (Content) - 1);
|
||||||
}
|
Msg_WriteMsgContent (Content,true,false);
|
||||||
else
|
Med_ShowMedia (&Media,"FOR_IMG_CONT","FOR_IMG");
|
||||||
HTM_Txt (Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_the_forums);
|
break;
|
||||||
|
}
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
|
@ -2294,7 +2298,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
HTM_TD_Begin ("class=\"LT %s_%s %s\"",
|
HTM_TD_Begin ("class=\"LT %s_%s %s\"",
|
||||||
Class,The_GetSuffix (),BgColor);
|
Class,The_GetSuffix (),BgColor);
|
||||||
Msg_WriteMsgAuthor (&UsrDat,Thr.Enabled[Order]);
|
Usr_WriteAuthor (&UsrDat,Thr.Enabled[Order]);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Write the date of first or last message (it's in YYYYMMDDHHMMSS format) */
|
/* Write the date of first or last message (it's in YYYYMMDDHHMMSS format) */
|
||||||
|
@ -2398,7 +2402,7 @@ void For_GetThreadData (struct For_Thread *Thr)
|
||||||
for (Order = (Dat_StartEndTime_t) 0;
|
for (Order = (Dat_StartEndTime_t) 0;
|
||||||
Order <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
Order <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
|
||||||
Order++)
|
Order++)
|
||||||
Thr->Enabled[Order] = !For_DB_GetIfPstIsDisabled (Thr->PstCod[Order]);
|
Thr->Enabled[Order] = For_DB_GetIfPstIsEnabled (Thr->PstCod[Order]);
|
||||||
|
|
||||||
/***** Get number of posts in this thread *****/
|
/***** Get number of posts in this thread *****/
|
||||||
Thr->NumPosts = For_DB_GetNumPstsInThr (Thr->ThrCod);
|
Thr->NumPosts = For_DB_GetNumPstsInThr (Thr->ThrCod);
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct For_Thread
|
||||||
long PstCod[Dat_NUM_START_END_TIME];
|
long PstCod[Dat_NUM_START_END_TIME];
|
||||||
long UsrCod[Dat_NUM_START_END_TIME];
|
long UsrCod[Dat_NUM_START_END_TIME];
|
||||||
time_t WriteTime[Dat_NUM_START_END_TIME];
|
time_t WriteTime[Dat_NUM_START_END_TIME];
|
||||||
bool Enabled[Dat_NUM_START_END_TIME];
|
Cns_Enabled_t Enabled[Dat_NUM_START_END_TIME];
|
||||||
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
|
||||||
unsigned NumPosts;
|
unsigned NumPosts;
|
||||||
unsigned NumUnreadPosts; // Number of my unread posts in thread
|
unsigned NumUnreadPosts; // Number of my unread posts in thread
|
||||||
|
|
|
@ -969,11 +969,11 @@ void For_DB_InsertPstIntoDisabled (long PstCod)
|
||||||
/*********************** Get if a forum post is disabled *********************/
|
/*********************** Get if a forum post is disabled *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
bool For_DB_GetIfPstIsDisabled (long PstCod)
|
Cns_Enabled_t For_DB_GetIfPstIsEnabled (long PstCod)
|
||||||
{
|
{
|
||||||
/***** Trivial check: post code should be > 0 *****/
|
/***** Trivial check: post code should be > 0 *****/
|
||||||
if (PstCod <= 0)
|
if (PstCod <= 0)
|
||||||
return true;
|
return Cns_DISABLED;
|
||||||
|
|
||||||
/***** Get if post is disabled from database *****/
|
/***** Get if post is disabled from database *****/
|
||||||
return
|
return
|
||||||
|
@ -982,7 +982,8 @@ bool For_DB_GetIfPstIsDisabled (long PstCod)
|
||||||
"(SELECT *"
|
"(SELECT *"
|
||||||
" FROM for_disabled"
|
" FROM for_disabled"
|
||||||
" WHERE PstCod=%ld)",
|
" WHERE PstCod=%ld)",
|
||||||
PstCod); // Post is enabled if it does not appear in table of disabled posts
|
PstCod) ? Cns_DISABLED :
|
||||||
|
Cns_ENABLED; // Post is enabled if it does not appear in table of disabled posts
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -98,7 +98,7 @@ void For_DB_RemoveExpiredClipboards (void);
|
||||||
|
|
||||||
//--------------------------- Disabled posts ----------------------------------
|
//--------------------------- Disabled posts ----------------------------------
|
||||||
void For_DB_InsertPstIntoDisabled (long PstCod);
|
void For_DB_InsertPstIntoDisabled (long PstCod);
|
||||||
bool For_DB_GetIfPstIsDisabled (long PstCod);
|
Cns_Enabled_t For_DB_GetIfPstIsEnabled (long PstCod);
|
||||||
void For_DB_RemovePstFromDisabled (long PstCod);
|
void For_DB_RemovePstFromDisabled (long PstCod);
|
||||||
void For_DB_RemoveDisabledPstsInThread (long ThrCod);
|
void For_DB_RemoveDisabledPstsInThread (long ThrCod);
|
||||||
|
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ static void Ins_ListInstitutionsForEdition (void)
|
||||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||||
Usr_DONT_GET_PREFS,
|
Usr_DONT_GET_PREFS,
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Institution status */
|
/* Institution status */
|
||||||
|
@ -1441,7 +1441,7 @@ static void Ins_PutFormToCreateInstitution (void)
|
||||||
/***** Institution requester *****/
|
/***** Institution requester *****/
|
||||||
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&Gbl.Usrs.Me.UsrDat,true);
|
Usr_WriteAuthor (&Gbl.Usrs.Me.UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Institution status *****/
|
/***** Institution status *****/
|
||||||
|
|
|
@ -2091,7 +2091,7 @@ static void Msg_ShowASentOrReceivedMessage (struct Msg_Messages *Messages,
|
||||||
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,
|
||||||
Usr_DONT_GET_PREFS,
|
Usr_DONT_GET_PREFS,
|
||||||
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
Usr_DONT_GET_ROLE_IN_CURRENT_CRS);
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/***** Subject *****/
|
/***** Subject *****/
|
||||||
|
@ -2293,63 +2293,6 @@ static void Msg_WriteSentOrReceivedMsgSubject (struct Msg_Messages *Messages,
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************ Write the author of a message **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// Input: UsrDat must hold user's data
|
|
||||||
|
|
||||||
void Msg_WriteMsgAuthor (struct Usr_Data *UsrDat,bool Enabled)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Unknown_or_without_photo;
|
|
||||||
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
|
||||||
{
|
|
||||||
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC30x40",
|
|
||||||
[PhoSha_SHAPE_ELLIPSE ] = "PHOTOE30x40",
|
|
||||||
[PhoSha_SHAPE_OVAL ] = "PHOTOO30x40",
|
|
||||||
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR30x40",
|
|
||||||
};
|
|
||||||
bool WriteAuthor;
|
|
||||||
|
|
||||||
/***** Write author name or don't write it? *****/
|
|
||||||
WriteAuthor = false;
|
|
||||||
if (Enabled)
|
|
||||||
if (UsrDat->UsrCod > 0)
|
|
||||||
WriteAuthor = true;
|
|
||||||
|
|
||||||
/***** Begin table and row *****/
|
|
||||||
HTM_TABLE_BeginPadding (2);
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/***** Begin first column with author's photo
|
|
||||||
(if author has a web page, put a link to it) *****/
|
|
||||||
HTM_TD_Begin ("class=\"CT\" style=\"width:30px;\"");
|
|
||||||
if (WriteAuthor)
|
|
||||||
Pho_ShowUsrPhotoIfAllowed (UsrDat,
|
|
||||||
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM);
|
|
||||||
else
|
|
||||||
Ico_PutIcon ("usr_bl.jpg",Ico_UNCHANGED,Txt_Unknown_or_without_photo,
|
|
||||||
ClassPhoto[Gbl.Prefs.PhotoShape]);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** Second column with user name (if author has a web page, put a link to it) *****/
|
|
||||||
if (WriteAuthor)
|
|
||||||
{
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
HTM_DIV_Begin ("class=\"AUTHOR_2_LINES\""); // Limited width
|
|
||||||
Usr_WriteFirstNameBRSurnames (UsrDat);
|
|
||||||
HTM_DIV_End ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HTM_TD_Begin ("class=\"LM\"");
|
|
||||||
|
|
||||||
/***** End second column *****/
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
/***** End row and table *****/
|
|
||||||
HTM_TR_End ();
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Write course origin of a message **********************/
|
/********************* Write course origin of a message **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -113,7 +113,6 @@ void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||||
char **ContentStr,long MsgCod,bool GetContent);
|
char **ContentStr,long MsgCod,bool GetContent);
|
||||||
|
|
||||||
void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg);
|
void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg);
|
||||||
void Msg_WriteMsgAuthor (struct Usr_Data *UsrDat,bool Enabled);
|
|
||||||
void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassTxt,const char *ClassBg);
|
void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassTxt,const char *ClassBg);
|
||||||
void Msg_WriteMsgContent (char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
void Msg_WriteMsgContent (char Content[Cns_MAX_BYTES_LONG_TEXT + 1],
|
||||||
bool InsertLinks,bool ChangeBRToRet);
|
bool InsertLinks,bool ChangeBRToRet);
|
||||||
|
|
|
@ -528,7 +528,7 @@ void Ntf_ShowMyNotifications (void)
|
||||||
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
|
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
|
||||||
ClassAuthor,The_GetSuffix (),
|
ClassAuthor,The_GetSuffix (),
|
||||||
ClassBg,The_GetSuffix ());
|
ClassBg,The_GetSuffix ());
|
||||||
Msg_WriteMsgAuthor (&UsrDat,true);
|
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
||||||
/* Write location */
|
/* Write location */
|
||||||
|
|
|
@ -146,7 +146,7 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
|
||||||
{
|
{
|
||||||
HTM_DIV_Begin ("class=\"CM\"");
|
HTM_DIV_Begin ("class=\"CM\"");
|
||||||
Pag_WriteLinksToPages (WhatPaginate,Pagination,Context,Cod,
|
Pag_WriteLinksToPages (WhatPaginate,Pagination,Context,Cod,
|
||||||
true,NULL,"PAG_TXT",false); // !!!!!!!!!!!!!!!!!!!!!!!!!!
|
Cns_ENABLED,NULL,"PAG_TXT",false); // !!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
|
||||||
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
struct Pag_Pagination *Pagination,
|
struct Pag_Pagination *Pagination,
|
||||||
const void *Context,long Cod,
|
const void *Context,long Cod,
|
||||||
bool FirstMsgEnabled,
|
Cns_Enabled_t FirstMsgEnabled,
|
||||||
const char *Subject,const char *ClassTxt,
|
const char *Subject,const char *ClassTxt,
|
||||||
bool LinkToPagCurrent)
|
bool LinkToPagCurrent)
|
||||||
{
|
{
|
||||||
|
@ -281,10 +281,15 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
HTM_SPAN_Begin ("class=\"%s_%s\"",ClassTxt,The_GetSuffix ());
|
HTM_SPAN_Begin ("class=\"%s_%s\"",ClassTxt,The_GetSuffix ());
|
||||||
if (FirstMsgEnabled)
|
switch (FirstMsgEnabled)
|
||||||
HTM_Txt (Subject);
|
{
|
||||||
else
|
case Cns_DISABLED:
|
||||||
HTM_TxtF ("[%s]",Txt_FORUM_Post_banned);
|
HTM_TxtF ("[%s]",Txt_FORUM_Post_banned);
|
||||||
|
break;
|
||||||
|
case Cns_ENABLED:
|
||||||
|
HTM_Txt (Subject);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (LinkToPagCurrent)
|
if (LinkToPagCurrent)
|
||||||
{
|
{
|
||||||
HTM_BUTTON_End ();
|
HTM_BUTTON_End ();
|
||||||
|
|
|
@ -84,7 +84,7 @@ void Pag_WriteLinksToPagesCentered (Pag_WhatPaginate_t WhatPaginate,
|
||||||
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
||||||
struct Pag_Pagination *Pagination,
|
struct Pag_Pagination *Pagination,
|
||||||
const void *Context,long Cod,
|
const void *Context,long Cod,
|
||||||
bool FirstMsgEnabled,
|
Cns_Enabled_t FirstMsgEnabled,
|
||||||
const char *Subject,const char *ClassTxt,
|
const char *Subject,const char *ClassTxt,
|
||||||
bool LinkToPagCurrent);
|
bool LinkToPagCurrent);
|
||||||
void Pag_PutParPagNum (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage);
|
void Pag_PutParPagNum (Pag_WhatPaginate_t WhatPaginate,unsigned NumPage);
|
||||||
|
|
57
swad_user.c
57
swad_user.c
|
@ -6335,6 +6335,63 @@ unsigned Usr_GetTotalNumberOfUsers (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******************** Write the author of a message/post/ ********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// Input: UsrDat must hold user's data
|
||||||
|
|
||||||
|
void Usr_WriteAuthor (struct Usr_Data *UsrDat,Cns_Enabled_t Enabled)
|
||||||
|
{
|
||||||
|
extern const char *Txt_Unknown_or_without_photo;
|
||||||
|
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
|
||||||
|
{
|
||||||
|
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC30x40",
|
||||||
|
[PhoSha_SHAPE_ELLIPSE ] = "PHOTOE30x40",
|
||||||
|
[PhoSha_SHAPE_OVAL ] = "PHOTOO30x40",
|
||||||
|
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR30x40",
|
||||||
|
};
|
||||||
|
bool WriteAuthor;
|
||||||
|
|
||||||
|
/***** Write author name or don't write it? *****/
|
||||||
|
WriteAuthor = false;
|
||||||
|
if (Enabled == Cns_ENABLED)
|
||||||
|
if (UsrDat->UsrCod > 0)
|
||||||
|
WriteAuthor = true;
|
||||||
|
|
||||||
|
/***** Begin table and row *****/
|
||||||
|
HTM_TABLE_BeginPadding (2);
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/***** Begin first column with author's photo
|
||||||
|
(if author has a web page, put a link to it) *****/
|
||||||
|
HTM_TD_Begin ("class=\"CT\" style=\"width:30px;\"");
|
||||||
|
if (WriteAuthor)
|
||||||
|
Pho_ShowUsrPhotoIfAllowed (UsrDat,
|
||||||
|
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM);
|
||||||
|
else
|
||||||
|
Ico_PutIcon ("usr_bl.jpg",Ico_UNCHANGED,Txt_Unknown_or_without_photo,
|
||||||
|
ClassPhoto[Gbl.Prefs.PhotoShape]);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** Second column with user name (if author has a web page, put a link to it) *****/
|
||||||
|
if (WriteAuthor)
|
||||||
|
{
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_DIV_Begin ("class=\"AUTHOR_2_LINES\""); // Limited width
|
||||||
|
Usr_WriteFirstNameBRSurnames (UsrDat);
|
||||||
|
HTM_DIV_End ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HTM_TD_Begin ("class=\"LM\"");
|
||||||
|
|
||||||
|
/***** End second column *****/
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
/***** End row and table *****/
|
||||||
|
HTM_TR_End ();
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Write the author of an assignment *********************/
|
/********************* Write the author of an assignment *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -433,6 +433,7 @@ void Usr_ShowWarningNoUsersFound (Rol_Role_t Role);
|
||||||
|
|
||||||
unsigned Usr_GetTotalNumberOfUsers (void);
|
unsigned Usr_GetTotalNumberOfUsers (void);
|
||||||
|
|
||||||
|
void Usr_WriteAuthor (struct Usr_Data *UsrDat,Cns_Enabled_t Enabled);
|
||||||
void Usr_WriteAuthor1Line (long UsrCod,bool Hidden);
|
void Usr_WriteAuthor1Line (long UsrCod,bool Hidden);
|
||||||
|
|
||||||
void Usr_ShowTableCellWithUsrData (struct Usr_Data *UsrDat,unsigned NumRows);
|
void Usr_ShowTableCellWithUsrData (struct Usr_Data *UsrDat,unsigned NumRows);
|
||||||
|
|
Loading…
Reference in New Issue