Version 23.49: Nov 27, 2023 Code refactoring in highlighting.

This commit is contained in:
acanas 2023-11-27 14:41:02 +01:00
parent 831fdf5d1f
commit 3039405c8d
9 changed files with 105 additions and 75 deletions

View File

@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.48.3 (2023-11-27)" #define Log_PLATFORM_VERSION "SWAD 23.49 (2023-11-27)"
#define CSS_FILE "swad23.48.2.css" #define CSS_FILE "swad23.48.2.css"
#define JS_FILE "swad23.47.3.js" #define JS_FILE "swad23.47.3.js"
/* /*
Version 23.49: Nov 27, 2023 Code refactoring in highlighting. (335774 lines)
Version 23.48.3: Nov 27, 2023 Code refactoring in notices. (335746 lines) Version 23.48.3: Nov 27, 2023 Code refactoring in notices. (335746 lines)
Version 23.48.2: Nov 26, 2023 Responsive design in program. (335738 lines) Version 23.48.2: Nov 26, 2023 Responsive design in program. (335738 lines)
Version 23.48.1: Nov 26, 2023 Responsive design in record cards. (335693 lines) Version 23.48.1: Nov 26, 2023 Responsive design in record cards. (335693 lines)

View File

@ -151,13 +151,14 @@ void Crs_ShowIntroduction (void)
static void Crs_WriteListMyCoursesToSelectOne (void) static void Crs_WriteListMyCoursesToSelectOne (void)
{ {
extern const char *Hlp_PROFILE_Courses; extern const char *Hlp_PROFILE_Courses;
extern const char *Lay_HighlightClass[Lay_NUM_HIGHLIGHT];
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS]; extern ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS];
extern const char *Txt_My_courses; extern const char *Txt_My_courses;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS]; extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
struct Hie_Node Hie[Hie_NUM_LEVELS]; struct Hie_Node Hie[Hie_NUM_LEVELS];
Lay_LastItem_t IsLastItemInLevel[1 + 6]; Lay_LastItem_t IsLastItemInLevel[1 + 6];
bool Highlight; // Highlight because degree, course, etc. is selected Lay_Highlight_t Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_resCty; MYSQL_RES *mysql_resCty;
MYSQL_RES *mysql_resIns; MYSQL_RES *mysql_resIns;
MYSQL_RES *mysql_resCtr; MYSQL_RES *mysql_resCtr;
@ -184,9 +185,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
HTM_UL_Begin ("class=\"LIST_TREE\""); HTM_UL_Begin ("class=\"LIST_TREE\"");
/***** Write link to platform *****/ /***** Write link to platform *****/
Highlight = (Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0); Highlight = (Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0) ? Lay_HIGHLIGHT :
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : Lay_NO_HIGHLIGHT;
NULL); HTM_LI_Begin (Lay_HighlightClass[Highlight]);
IsLastItemInLevel[1] = Lay_LAST_ITEM; IsLastItemInLevel[1] = Lay_LAST_ITEM;
Lay_IndentDependingOnLevel (1,IsLastItemInLevel, Lay_IndentDependingOnLevel (1,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT); Lay_HORIZONTAL_LINE_AT_RIGHT);
@ -217,9 +218,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to country *****/ /***** Write link to country *****/
Highlight = (Gbl.Hierarchy.Node[Hie_INS].HieCod <= 0 && Highlight = (Gbl.Hierarchy.Node[Hie_INS].HieCod <= 0 &&
Gbl.Hierarchy.Node[Hie_CTY].HieCod == Hie[Hie_CTY].HieCod); Gbl.Hierarchy.Node[Hie_CTY].HieCod == Hie[Hie_CTY].HieCod) ? Lay_HIGHLIGHT :
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : Lay_NO_HIGHLIGHT;
NULL); HTM_LI_Begin (Lay_HighlightClass[Highlight]);
IsLastItemInLevel[2] = (NumCty == NumCtys - 1) ? Lay_LAST_ITEM : IsLastItemInLevel[2] = (NumCty == NumCtys - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (2,IsLastItemInLevel, Lay_IndentDependingOnLevel (2,IsLastItemInLevel,
@ -252,9 +253,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to institution *****/ /***** Write link to institution *****/
Highlight = (Gbl.Hierarchy.Node[Hie_CTR].HieCod <= 0 && Highlight = (Gbl.Hierarchy.Node[Hie_CTR].HieCod <= 0 &&
Gbl.Hierarchy.Node[Hie_INS].HieCod == Hie[Hie_INS].HieCod); Gbl.Hierarchy.Node[Hie_INS].HieCod == Hie[Hie_INS].HieCod) ? Lay_HIGHLIGHT :
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : Lay_NO_HIGHLIGHT;
NULL); HTM_LI_Begin (Lay_HighlightClass[Highlight]);
IsLastItemInLevel[3] = (NumIns == NumInss - 1) ? Lay_LAST_ITEM : IsLastItemInLevel[3] = (NumIns == NumInss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (3,IsLastItemInLevel, Lay_IndentDependingOnLevel (3,IsLastItemInLevel,
@ -289,9 +290,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to center *****/ /***** Write link to center *****/
Highlight = (Gbl.Hierarchy.Level == Hie_CTR && Highlight = (Gbl.Hierarchy.Level == Hie_CTR &&
Gbl.Hierarchy.Node[Hie_CTR].HieCod == Hie[Hie_CTR].HieCod); Gbl.Hierarchy.Node[Hie_CTR].HieCod == Hie[Hie_CTR].HieCod) ? Lay_HIGHLIGHT :
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : Lay_NO_HIGHLIGHT;
NULL); HTM_LI_Begin (Lay_HighlightClass[Highlight]);
IsLastItemInLevel[4] = (NumCtr == NumCtrs - 1) ? Lay_LAST_ITEM : IsLastItemInLevel[4] = (NumCtr == NumCtrs - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (4,IsLastItemInLevel, Lay_IndentDependingOnLevel (4,IsLastItemInLevel,
@ -326,9 +327,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to degree *****/ /***** Write link to degree *****/
Highlight = (Gbl.Hierarchy.Level == Hie_DEG && Highlight = (Gbl.Hierarchy.Level == Hie_DEG &&
Gbl.Hierarchy.Node[Hie_DEG].HieCod == Hie[Hie_DEG].HieCod); Gbl.Hierarchy.Node[Hie_DEG].HieCod == Hie[Hie_DEG].HieCod) ? Lay_HIGHLIGHT :
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : Lay_NO_HIGHLIGHT;
NULL); HTM_LI_Begin (Lay_HighlightClass[Highlight]);
IsLastItemInLevel[5] = (NumDeg == NumDegs - 1) ? Lay_LAST_ITEM : IsLastItemInLevel[5] = (NumDeg == NumDegs - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (5,IsLastItemInLevel, Lay_IndentDependingOnLevel (5,IsLastItemInLevel,
@ -365,11 +366,11 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to course *****/ /***** Write link to course *****/
Highlight = (Gbl.Hierarchy.Level == Hie_CRS && Highlight = (Gbl.Hierarchy.Level == Hie_CRS &&
Gbl.Hierarchy.Node[Hie_CRS].HieCod == Hie[Hie_CRS].HieCod); Gbl.Hierarchy.Node[Hie_CRS].HieCod == Hie[Hie_CRS].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[6] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM : IsLastItemInLevel[6] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : HTM_LI_Begin (Lay_HighlightClass[Highlight]);
NULL);
Lay_IndentDependingOnLevel (6,IsLastItemInLevel, Lay_IndentDependingOnLevel (6,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT); Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs); Frm_BeginForm (ActMyCrs);

View File

@ -174,16 +174,16 @@ void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void)
void Enr_PutButtonInlineToRegisterStds (long CrsCod, void Enr_PutButtonInlineToRegisterStds (long CrsCod,
unsigned Level,Lay_LastItem_t IsLastItemInLevel[], unsigned Level,Lay_LastItem_t IsLastItemInLevel[],
bool Highlight) Lay_Highlight_t Highlight)
{ {
extern const char *Lay_HighlightClass[Lay_NUM_HIGHLIGHT];
extern const char *Txt_Register_students; extern const char *Txt_Register_students;
if (Rol_GetMyRoleInCrs (CrsCod) == Rol_TCH) // I am a teacher in the given course if (Rol_GetMyRoleInCrs (CrsCod) == Rol_TCH) // I am a teacher in the given course
if (!Enr_GetNumUsrsInCrss (Hie_CRS,CrsCod, if (!Enr_GetNumUsrsInCrss (Hie_CRS,CrsCod,
1 << Rol_STD)) // No students in course 1 << Rol_STD)) // No students in course
{ {
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : HTM_LI_Begin (Lay_HighlightClass[Highlight]);
NULL);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel, Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,
Lay_NO_HORIZONTAL_LINE_AT_RIGHT); Lay_NO_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActReqEnrSevStd); Frm_BeginForm (ActReqEnrSevStd);

View File

@ -76,7 +76,7 @@ typedef enum
void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void); void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void);
void Enr_PutButtonInlineToRegisterStds (long CrsCod, void Enr_PutButtonInlineToRegisterStds (long CrsCod,
unsigned Level,Lay_LastItem_t IsLastItemInLevel[], unsigned Level,Lay_LastItem_t IsLastItemInLevel[],
bool Highlight); Lay_Highlight_t Highlight);
void Enr_PutLinkToRequestSignUp (void); void Enr_PutLinkToRequestSignUp (void);

View File

@ -355,7 +355,7 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]); Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinkToForum (const struct For_Forums *Forums, static void For_WriteLinkToForum (const struct For_Forums *Forums,
const struct For_Forum *Forum, const struct For_Forum *Forum,
bool Highlight, Lay_Highlight_t Highlight,
unsigned Level, unsigned Level,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]); Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum, static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum,
@ -1456,7 +1456,7 @@ static void For_PutFormWhichForums (const struct For_Forums *Forums)
static void For_WriteLinksToGblForums (const struct For_Forums *Forums, static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1469,7 +1469,8 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
/***** Link to forum global *****/ /***** Link to forum global *****/
Forum.Type = For_FORUM_GLOBAL_USRS; Forum.Type = For_FORUM_GLOBAL_USRS;
Forum.HieCod = -1L; Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_USRS); Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_USRS) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[1] = Lay_NO_LAST_ITEM; IsLastItemInLevel[1] = Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
@ -1479,7 +1480,8 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
{ {
Forum.Type = For_FORUM_GLOBAL_TCHS; Forum.Type = For_FORUM_GLOBAL_TCHS;
Forum.HieCod = -1L; Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_TCHS); Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_TCHS) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[1] = Lay_NO_LAST_ITEM; IsLastItemInLevel[1] = Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
} }
@ -1493,7 +1495,7 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
bool IsLastForum, bool IsLastForum,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1506,7 +1508,8 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
/***** Link to forum of users about the platform *****/ /***** Link to forum of users about the platform *****/
Forum.Type = For_FORUM__SWAD__USRS; Forum.Type = For_FORUM__SWAD__USRS;
Forum.HieCod = -1L; Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM__SWAD__USRS); Highlight = (Forums->Forum.Type == For_FORUM__SWAD__USRS) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum) ? Lay_LAST_ITEM : IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
@ -1516,7 +1519,8 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
{ {
Forum.Type = For_FORUM__SWAD__TCHS; Forum.Type = For_FORUM__SWAD__TCHS;
Forum.HieCod = -1L; Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM__SWAD__TCHS); Highlight = (Forums->Forum.Type == For_FORUM__SWAD__TCHS) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[1] = IsLastForum ? Lay_LAST_ITEM : IsLastItemInLevel[1] = IsLastForum ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
@ -1532,7 +1536,7 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
long InsCod,bool IsLastIns, long InsCod,bool IsLastIns,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
Rol_Role_t MaxRoleInIns; Rol_Role_t MaxRoleInIns;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1548,7 +1552,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_INSTIT_USRS; Forum.Type = For_FORUM_INSTIT_USRS;
Forum.HieCod = InsCod; Forum.HieCod = InsCod;
Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_USRS && Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_USRS &&
Forums->Forum.HieCod == InsCod); Forums->Forum.HieCod == InsCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[2] = (IsLastIns && !ICanSeeTeacherForum) ? Lay_LAST_ITEM : IsLastItemInLevel[2] = (IsLastIns && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel);
@ -1559,7 +1564,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_INSTIT_TCHS; Forum.Type = For_FORUM_INSTIT_TCHS;
Forum.HieCod = InsCod; Forum.HieCod = InsCod;
Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_TCHS && Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_TCHS &&
Forums->Forum.HieCod == InsCod); Forums->Forum.HieCod == InsCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[2] = IsLastIns ? Lay_LAST_ITEM : IsLastItemInLevel[2] = IsLastIns ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel);
@ -1577,7 +1583,7 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
long CtrCod,bool IsLastCtr, long CtrCod,bool IsLastCtr,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
Rol_Role_t MaxRoleInCtr; Rol_Role_t MaxRoleInCtr;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1593,7 +1599,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_CENTER_USRS; Forum.Type = For_FORUM_CENTER_USRS;
Forum.HieCod = CtrCod; Forum.HieCod = CtrCod;
Highlight = (Forums->Forum.Type == For_FORUM_CENTER_USRS && Highlight = (Forums->Forum.Type == For_FORUM_CENTER_USRS &&
Forums->Forum.HieCod == CtrCod); Forums->Forum.HieCod == CtrCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[3] = (IsLastCtr && !ICanSeeTeacherForum) ? Lay_LAST_ITEM : IsLastItemInLevel[3] = (IsLastCtr && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel);
@ -1604,7 +1611,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_CENTER_TCHS; Forum.Type = For_FORUM_CENTER_TCHS;
Forum.HieCod = CtrCod; Forum.HieCod = CtrCod;
Highlight = (Forums->Forum.Type == For_FORUM_CENTER_TCHS && Highlight = (Forums->Forum.Type == For_FORUM_CENTER_TCHS &&
Forums->Forum.HieCod == CtrCod); Forums->Forum.HieCod == CtrCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[3] = IsLastCtr ? Lay_LAST_ITEM : IsLastItemInLevel[3] = IsLastCtr ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel);
@ -1622,7 +1630,7 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
long DegCod,bool IsLastDeg, long DegCod,bool IsLastDeg,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
Rol_Role_t MaxRoleInDeg; Rol_Role_t MaxRoleInDeg;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1638,7 +1646,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_DEGREE_USRS; Forum.Type = For_FORUM_DEGREE_USRS;
Forum.HieCod = DegCod; Forum.HieCod = DegCod;
Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_USRS && Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_USRS &&
Forums->Forum.HieCod == DegCod); Forums->Forum.HieCod == DegCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[4] = (IsLastDeg && !ICanSeeTeacherForum) ? Lay_LAST_ITEM : IsLastItemInLevel[4] = (IsLastDeg && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel);
@ -1649,7 +1658,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_DEGREE_TCHS; Forum.Type = For_FORUM_DEGREE_TCHS;
Forum.HieCod = DegCod; Forum.HieCod = DegCod;
Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_TCHS && Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_TCHS &&
Forums->Forum.HieCod == DegCod); Forums->Forum.HieCod == DegCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[4] = IsLastDeg ? Lay_LAST_ITEM : IsLastItemInLevel[4] = IsLastDeg ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel);
@ -1667,7 +1677,7 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
long CrsCod,bool IsLastCrs, long CrsCod,bool IsLastCrs,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
bool Highlight; Lay_Highlight_t Highlight;
Rol_Role_t MyRoleInCrs; Rol_Role_t MyRoleInCrs;
bool ICanSeeTeacherForum; bool ICanSeeTeacherForum;
struct For_Forum Forum; struct For_Forum Forum;
@ -1683,7 +1693,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_COURSE_USRS; Forum.Type = For_FORUM_COURSE_USRS;
Forum.HieCod = CrsCod; Forum.HieCod = CrsCod;
Highlight = (Forums->Forum.Type == For_FORUM_COURSE_USRS && Highlight = (Forums->Forum.Type == For_FORUM_COURSE_USRS &&
Forums->Forum.HieCod == CrsCod); Forums->Forum.HieCod == CrsCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[5] = (IsLastCrs && !ICanSeeTeacherForum) ? Lay_LAST_ITEM : IsLastItemInLevel[5] = (IsLastCrs && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel);
@ -1694,7 +1705,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_COURSE_TCHS; Forum.Type = For_FORUM_COURSE_TCHS;
Forum.HieCod = CrsCod; Forum.HieCod = CrsCod;
Highlight = (Forums->Forum.Type == For_FORUM_COURSE_TCHS && Highlight = (Forums->Forum.Type == For_FORUM_COURSE_TCHS &&
Forums->Forum.HieCod == CrsCod); Forums->Forum.HieCod == CrsCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[5] = IsLastCrs ? Lay_LAST_ITEM : IsLastItemInLevel[5] = IsLastCrs ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM; Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel); For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel);
@ -1709,10 +1721,11 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
static void For_WriteLinkToForum (const struct For_Forums *Forums, static void For_WriteLinkToForum (const struct For_Forums *Forums,
const struct For_Forum *Forum, const struct For_Forum *Forum,
bool Highlight, Lay_Highlight_t Highlight,
unsigned Level, unsigned Level,
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{ {
extern const char *Lay_HighlightClass[Lay_NUM_HIGHLIGHT];
extern const char *Txt_Copy_not_allowed; extern const char *Txt_Copy_not_allowed;
unsigned NumThrs; unsigned NumThrs;
unsigned NumThrsWithNewPosts; unsigned NumThrsWithNewPosts;
@ -1723,8 +1736,7 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
NumThrsWithNewPosts = For_GetNumThrsWithNewPstsInForum (Forum,NumThrs); NumThrsWithNewPosts = For_GetNumThrsWithNewPstsInForum (Forum,NumThrs);
/***** Begin row *****/ /***** Begin row *****/
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : HTM_LI_Begin (Lay_HighlightClass[Highlight]);
NULL);
/***** Indent forum title *****/ /***** Indent forum title *****/
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel, Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,

View File

@ -125,7 +125,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod);
static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp, static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
Grp_WhichGroups_t GroupsSelectableByStdsOrNETs); Grp_WhichGroups_t GroupsSelectableByStdsOrNETs);
static void Grp_WriteGrpHead (struct GroupType *GrpTyp); static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight); static void Grp_WriteRowGrp (struct Group *Grp,Lay_Highlight_t Highlight);
static void Grp_PutFormToCreateGroupType (void); static void Grp_PutFormToCreateGroupType (void);
static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms); static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms);
static void Grp_GetGroupTypeDataByCod (struct GroupType *GrpTyp); static void Grp_GetGroupTypeDataByCod (struct GroupType *GrpTyp);
@ -1671,7 +1671,8 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
" disabled=\"disabled\""); " disabled=\"disabled\"");
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT);
HTM_TR_End (); HTM_TR_End ();
} }
@ -1980,7 +1981,8 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT);
HTM_TR_End (); HTM_TR_End ();
} }
@ -2077,7 +2079,8 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
HTM_TD_End (); HTM_TD_End ();
/* Write cell for group */ /* Write cell for group */
Grp_WriteRowGrp (Grp,UsrBelongsToThisGroup); Grp_WriteRowGrp (Grp,UsrBelongsToThisGroup ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT);
/* End row */ /* End row */
HTM_TR_End (); HTM_TR_End ();
@ -2173,7 +2176,8 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
" disabled=\"disabled\""); " disabled=\"disabled\"");
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT);
HTM_TR_End (); HTM_TR_End ();
} }
@ -2302,7 +2306,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp)
/****************** Write a row with the data of a group *********************/ /****************** Write a row with the data of a group *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) static void Grp_WriteRowGrp (struct Group *Grp,Lay_Highlight_t Highlight)
{ {
extern const char *Txt_Group_X_open; extern const char *Txt_Group_X_open;
extern const char *Txt_Group_X_closed; extern const char *Txt_Group_X_closed;
@ -2310,10 +2314,14 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
int Vacant; int Vacant;
Rol_Role_t Role; Rol_Role_t Role;
char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
static const char *HighlightClass[Lay_NUM_HIGHLIGHT] =
{
[Lay_NO_HIGHLIGHT] = "",
[Lay_HIGHLIGHT ] = " BG_HIGHLIGHT",
};
/***** Write icon to show if group is open or closed *****/ /***** Write icon to show if group is open or closed *****/
HTM_TD_Begin (Highlight ? "class=\"BM BG_HIGHLIGHT\"" : HTM_TD_Begin ("class=\"BM%s\"",HighlightClass[Highlight]);
"class=\"BM\"");
if (asprintf (&Title,Grp->Open ? Txt_Group_X_open : if (asprintf (&Title,Grp->Open ? Txt_Group_X_open :
Txt_Group_X_closed, Txt_Group_X_closed,
Grp->GrpName) < 0) Grp->GrpName) < 0)
@ -2327,8 +2335,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
HTM_TD_End (); HTM_TD_End ();
/***** Group name *****/ /***** Group name *****/
HTM_TD_Begin (Highlight ? "class=\"LM BG_HIGHLIGHT\"" : HTM_TD_Begin ("class=\"LM%s\"",HighlightClass[Highlight]);
"class=\"LM\"");
HTM_LABEL_Begin ("for=\"Grp%ld\" class=\"DAT_%s\"", HTM_LABEL_Begin ("for=\"Grp%ld\" class=\"DAT_%s\"",
Grp->GrpCod,The_GetSuffix ()); Grp->GrpCod,The_GetSuffix ());
HTM_Txt (Grp->GrpName); HTM_Txt (Grp->GrpName);
@ -2337,9 +2344,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
/***** Room *****/ /***** Room *****/
HTM_TD_Begin ("class=\"LM DAT_%s%s\"", HTM_TD_Begin ("class=\"LM DAT_%s%s\"",
The_GetSuffix (), The_GetSuffix (),HighlightClass[Highlight]);
Highlight ? " BG_HIGHLIGHT" :
"");
HTM_Txt (Grp->Room.ShrtName); HTM_Txt (Grp->Room.ShrtName);
HTM_TD_End (); HTM_TD_End ();
@ -2349,27 +2354,21 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
Role--) Role--)
{ {
HTM_TD_Begin ("class=\"CM DAT_%s%s\"", HTM_TD_Begin ("class=\"CM DAT_%s%s\"",
The_GetSuffix (), The_GetSuffix (),HighlightClass[Highlight]);
Highlight ? " BG_HIGHLIGHT" :
"");
HTM_Int (Grp->NumUsrs[Role]); HTM_Int (Grp->NumUsrs[Role]);
HTM_TD_End (); HTM_TD_End ();
} }
/***** Max. number of students in this group *****/ /***** Max. number of students in this group *****/
HTM_TD_Begin ("class=\"CM DAT_%s%s\"", HTM_TD_Begin ("class=\"CM DAT_%s%s\"",
The_GetSuffix (), The_GetSuffix (),HighlightClass[Highlight]);
Highlight ? " BG_HIGHLIGHT" :
"");
Grp_WriteMaxStds (StrMaxStudents,Grp->MaxStudents); Grp_WriteMaxStds (StrMaxStudents,Grp->MaxStudents);
HTM_TxtF ("%s&nbsp;",StrMaxStudents); HTM_TxtF ("%s&nbsp;",StrMaxStudents);
HTM_TD_End (); HTM_TD_End ();
/***** Vacants in this group *****/ /***** Vacants in this group *****/
HTM_TD_Begin ("class=\"CM DAT_%s%s\"", HTM_TD_Begin ("class=\"CM DAT_%s%s\"",
The_GetSuffix (), The_GetSuffix (),HighlightClass[Highlight]);
Highlight ? " BG_HIGHLIGHT" :
"");
if (Grp->MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP) if (Grp->MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP)
{ {
Vacant = (int) Grp->MaxStudents - (int) Grp->NumUsrs[Rol_STD]; Vacant = (int) Grp->MaxStudents - (int) Grp->NumUsrs[Rol_STD];

View File

@ -79,6 +79,12 @@
extern struct Globals Gbl; extern struct Globals Gbl;
const char *Lay_HighlightClass[Lay_NUM_HIGHLIGHT] =
{
[Lay_NO_HIGHLIGHT] = NULL,
[Lay_HIGHLIGHT ] = "class=\"BG_HIGHLIGHT\"",
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -54,6 +54,13 @@ typedef enum
Lay_HORIZONTAL_LINE_AT_RIGHT, Lay_HORIZONTAL_LINE_AT_RIGHT,
} Lay_HorizontalLineAtRight_t; } Lay_HorizontalLineAtRight_t;
#define Lay_NUM_HIGHLIGHT 2
typedef enum
{
Lay_NO_HIGHLIGHT,
Lay_HIGHLIGHT,
} Lay_Highlight_t;
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -93,7 +93,7 @@ static void Not_GetNoticeDataFromRow (MYSQL_RES *mysql_res,
Not_Listing_t TypeNoticesListing); Not_Listing_t TypeNoticesListing);
static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
struct Not_Notice *Notice, struct Not_Notice *Notice,
bool Highlight); Lay_Highlight_t Highlight);
static void Not_PutParNotCod (void *NotCod); static void Not_PutParNotCod (void *NotCod);
@ -357,7 +357,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
/* Draw notice */ /* Draw notice */
Not_DrawANotice (TypeNoticesListing,&Notice, Not_DrawANotice (TypeNoticesListing,&Notice,
(Notice.NotCod == HighlightNotCod)); // Highlighted? (Notice.NotCod == HighlightNotCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT);
} }
switch (TypeNoticesListing) switch (TypeNoticesListing)
@ -452,8 +453,7 @@ static void Not_GetDataAndShowNotice (long NotCod)
Not_GetNoticeDataFromRow (mysql_res,&Notice,Not_LIST_FULL_NOTICES); Not_GetNoticeDataFromRow (mysql_res,&Notice,Not_LIST_FULL_NOTICES);
/***** Draw the notice *****/ /***** Draw the notice *****/
Not_DrawANotice (Not_LIST_FULL_NOTICES,&Notice, Not_DrawANotice (Not_LIST_FULL_NOTICES,&Notice,Lay_NO_HIGHLIGHT);
false); // Not highlighted
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -513,7 +513,7 @@ static void Not_GetNoticeDataFromRow (MYSQL_RES *mysql_res,
static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
struct Not_Notice *Notice, struct Not_Notice *Notice,
bool Highlight) Lay_Highlight_t Highlight)
{ {
extern const char *Txt_See_full_notice; extern const char *Txt_See_full_notice;
static const Act_Action_t ActionHideUnhide[HidVis_NUM_HIDDEN_VISIBLE] = static const Act_Action_t ActionHideUnhide[HidVis_NUM_HIDDEN_VISIBLE] =
@ -531,6 +531,11 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
[Not_LIST_BRIEF_NOTICES] = "NOTICE_BOX_NARROW", [Not_LIST_BRIEF_NOTICES] = "NOTICE_BOX_NARROW",
[Not_LIST_FULL_NOTICES ] = "NOTICE_BOX_WIDE", [Not_LIST_FULL_NOTICES ] = "NOTICE_BOX_WIDE",
}; };
static const char *ContainerHighLightClass[Lay_NUM_HIGHLIGHT] =
{
[Lay_NO_HIGHLIGHT] = "",
[Lay_HIGHLIGHT ] = " NOTICE_HIGHLIGHT",
};
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
char *Id; char *Id;
struct Usr_Data UsrDat; struct Usr_Data UsrDat;
@ -544,8 +549,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
{ {
HTM_ARTICLE_Begin (Anchor); HTM_ARTICLE_Begin (Anchor);
HTM_DIV_Begin ("class=\"NOTICE_CONT%s\"", HTM_DIV_Begin ("class=\"NOTICE_CONT%s\"",
Highlight ? " NOTICE_HIGHLIGHT" : ContainerHighLightClass[Highlight]);
"");
} }
/***** Begin yellow note *****/ /***** Begin yellow note *****/