From c61bef9a97e9714ec3a51d09ee013d583c83aaa4 Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 21 Apr 2022 09:11:27 +0200 Subject: [PATCH] Version 21.93: Apr 21, 2022 Homogenization of lists in forums, chat and my courses. --- swad_changelog.h | 3 +- swad_chat.c | 6 ---- swad_course.c | 74 +++++++++++++++++++++++++----------------------- swad_forum.c | 46 +++++++++++++++--------------- 4 files changed, 63 insertions(+), 66 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index dc53ca4ec..85a5d7f6b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate TODO: Attach pdf files in multimedia. */ -#define Log_PLATFORM_VERSION "SWAD 21.92 (2022-04-20)" +#define Log_PLATFORM_VERSION "SWAD 21.93 (2022-04-21)" #define CSS_FILE "swad21.92.css" #define JS_FILE "swad21.92.js" /* + Version 21.93: Apr 21, 2022 Homogenization of lists in forums, chat and my courses. (323245 lines) Version 21.92: Apr 20, 2022 Default theme is white when printing. (323246 lines) Version 21.91.6: Apr 07, 2022 Working on design of dark theme. (323347 lines) Version 21.91.5: Apr 07, 2022 Working on design of dark theme. (323314 lines) diff --git a/swad_chat.c b/swad_chat.c index 8d09099e5..c85f26b69 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -134,12 +134,6 @@ void Cht_ShowListOfAvailableChatRooms (void) /***** Begin list *****/ HTM_UL_Begin ("class=\"LIST_TREE\""); - /***** Title of top level *****/ - HTM_LI_Begin ("class=\"DAT_%s\"",The_GetSuffix ()); - Ico_PutIcon ("comments.svg",Ico_BLACK,Txt_Chat_rooms,"ICO16x16"); - HTM_TxtF (" %s",Txt_Chat_rooms); - HTM_LI_End (); - /***** Link to chat available for all users *****/ IsLastItemInLevel[1] = (!Gbl.Usrs.Me.IBelongToCurrentCrs && !Gbl.Usrs.Me.MyDegs.Num); diff --git a/swad_course.c b/swad_course.c index 3a257fea0..795ca4783 100644 --- a/swad_course.c +++ b/swad_course.c @@ -150,7 +150,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) extern const char *Txt_My_courses; extern const char *Txt_System; struct Hie_Hierarchy Hie; - bool IsLastItemInLevel[1 + 5]; + bool IsLastItemInLevel[1 + 6]; bool Highlight; // Highlight because degree, course, etc. is selected MYSQL_RES *mysql_resCty; MYSQL_RES *mysql_resIns; @@ -168,13 +168,6 @@ static void Crs_WriteListMyCoursesToSelectOne (void) unsigned NumDegs; unsigned NumCrs; unsigned NumCrss; - char ClassNormal[64]; - char ClassHighlight[64]; - - snprintf (ClassNormal,sizeof (ClassNormal),"BT_LINK FORM_IN_%s", - The_GetSuffix ()); - snprintf (ClassHighlight,sizeof (ClassHighlight),"BT_LINK FORM_IN_%s BOLD BG_HIGHLIGHT", - The_GetSuffix ()); /***** Begin box *****/ Box_BoxBegin (NULL,Txt_My_courses, @@ -186,11 +179,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to platform *****/ Highlight = (Gbl.Hierarchy.Cty.CtyCod <= 0); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[1] = true; + Lay_IndentDependingOnLevel (1,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Cty_PutParamCtyCod (-1L); - HTM_BUTTON_Submit_Begin (Txt_System,"class=\"BT_LINK\""); + HTM_BUTTON_Submit_Begin (Txt_System, + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Ico_PutIcon ("sitemap.svg",Ico_BLACK,Txt_System,"ICO16x16"); HTM_TxtF (" %s",Txt_System); HTM_BUTTON_End (); @@ -214,14 +211,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to country *****/ Highlight = (Gbl.Hierarchy.Ins.InsCod <= 0 && Gbl.Hierarchy.Cty.CtyCod == Hie.Cty.CtyCod); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); - IsLastItemInLevel[1] = (NumCty == NumCtys - 1); - Lay_IndentDependingOnLevel (1,IsLastItemInLevel); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[2] = (NumCty == NumCtys - 1); + Lay_IndentDependingOnLevel (2,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Cty_PutParamCtyCod (Hie.Cty.CtyCod); HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtyInf), - "class=\"BT_LINK\""); + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Cty_DrawCountryMap (&Hie.Cty,"ICO16x16"); HTM_TxtF (" %s",Hie.Cty.Name[Gbl.Prefs.Language]); HTM_BUTTON_End (); @@ -247,14 +245,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to institution *****/ Highlight = (Gbl.Hierarchy.Ctr.CtrCod <= 0 && Gbl.Hierarchy.Ins.InsCod == Hie.Ins.InsCod); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); - IsLastItemInLevel[2] = (NumIns == NumInss - 1); - Lay_IndentDependingOnLevel (2,IsLastItemInLevel); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[3] = (NumIns == NumInss - 1); + Lay_IndentDependingOnLevel (3,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Ins_PutParamInsCod (Hie.Ins.InsCod); HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeInsInf), - "class=\"BT_LINK\""); + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Lgo_DrawLogo (HieLvl_INS,Hie.Ins.InsCod,Hie.Ins.ShrtName,16,NULL,true); HTM_TxtF (" %s",Hie.Ins.ShrtName); HTM_BUTTON_End (); @@ -280,14 +279,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to center *****/ Highlight = (Gbl.Hierarchy.Level == HieLvl_CTR && Gbl.Hierarchy.Ctr.CtrCod == Hie.Ctr.CtrCod); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); - IsLastItemInLevel[3] = (NumCtr == NumCtrs - 1); - Lay_IndentDependingOnLevel (3,IsLastItemInLevel); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[4] = (NumCtr == NumCtrs - 1); + Lay_IndentDependingOnLevel (4,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Ctr_PutParamCtrCod (Hie.Ctr.CtrCod); HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtrInf), - "class=\"BT_LINK\""); + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Lgo_DrawLogo (HieLvl_CTR,Hie.Ctr.CtrCod,Hie.Ctr.ShrtName,16,NULL,true); HTM_TxtF (" %s",Hie.Ctr.ShrtName); HTM_BUTTON_End (); @@ -313,14 +313,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to degree *****/ Highlight = (Gbl.Hierarchy.Level == HieLvl_DEG && Gbl.Hierarchy.Deg.DegCod == Hie.Deg.DegCod); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); - IsLastItemInLevel[4] = (NumDeg == NumDegs - 1); - Lay_IndentDependingOnLevel (4,IsLastItemInLevel); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[5] = (NumDeg == NumDegs - 1); + Lay_IndentDependingOnLevel (5,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Deg_PutParamDegCod (Hie.Deg.DegCod); HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeDegInf), - "class=\"BT_LINK\""); + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Lgo_DrawLogo (HieLvl_DEG,Hie.Deg.DegCod,Hie.Deg.ShrtName,16,NULL,true); HTM_TxtF (" %s",Hie.Deg.ShrtName); HTM_BUTTON_End (); @@ -346,14 +347,15 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to course *****/ Highlight = (Gbl.Hierarchy.Level == HieLvl_CRS && Gbl.Hierarchy.Crs.CrsCod == Hie.Crs.CrsCod); - HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : - ClassNormal); - IsLastItemInLevel[5] = (NumCrs == NumCrss - 1); - Lay_IndentDependingOnLevel (5,IsLastItemInLevel); + HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" : + NULL); + IsLastItemInLevel[6] = (NumCrs == NumCrss - 1); + Lay_IndentDependingOnLevel (6,IsLastItemInLevel); Frm_BeginForm (ActMyCrs); Crs_PutParamCrsCod (Hie.Crs.CrsCod); HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie.Crs.ShrtName), - "class=\"BT_LINK\""); + "class=\"BT_LINK FORM_IN_%s\"", + The_GetSuffix ()); Str_FreeGoToTitle (); Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,Hie.Crs.FullName,"ICO16x16"); HTM_TxtF (" %s",Hie.Crs.ShrtName); diff --git a/swad_forum.c b/swad_forum.c index 3bee2463b..2820f1fa1 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -262,7 +262,7 @@ const Act_Action_t For_ActionsDisPstFor[For_NUM_TYPES_FORUM] = /*********************** Private constants and types *************************/ /*****************************************************************************/ -#define For_FORUM_MAX_LEVELS 4 +#define For_FORUM_MAX_LEVELS 5 static const unsigned PermissionThreadDeletion[For_NUM_TYPES_FORUM] = { @@ -1258,7 +1258,7 @@ static void For_ShowForumList (struct For_Forums *Forums) ICanSeeInsForum = false; /***** Links to forums about the platform *****/ - For_WriteLinksToPlatformForums (Forums,!ICanSeeInsForum,IsLastItemInLevel); + For_WriteLinksToPlatformForums (Forums,true,IsLastItemInLevel); if (ICanSeeInsForum) { @@ -1301,7 +1301,7 @@ static void For_ShowForumList (struct For_Forums *Forums) break; case For_ALL_MY_FORUMS: /***** Links to forums about the platform *****/ - For_WriteLinksToPlatformForums (Forums,(Gbl.Usrs.Me.MyInss.Num == 0),IsLastItemInLevel); + For_WriteLinksToPlatformForums (Forums,true,IsLastItemInLevel); /***** Links to forums of users from my institutions, the degrees in each institution and the courses in each degree *****/ for (NumMyIns = 0; @@ -1466,7 +1466,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums, Forum.Location = -1L; Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_USRS); IsLastItemInLevel[1] = false; - For_WriteLinkToForum (Forums,&Forum,Highlight,0,IsLastItemInLevel); + For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); /***** Link to forum of teachers global *****/ Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat); @@ -1476,7 +1476,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums, Forum.Location = -1L; Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_TCHS); IsLastItemInLevel[1] = false; - For_WriteLinkToForum (Forums,&Forum,Highlight,0,IsLastItemInLevel); + For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); } } @@ -1503,7 +1503,7 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums, Forum.Location = -1L; Highlight = (Forums->Forum.Type == For_FORUM__SWAD__USRS); IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum); - For_WriteLinkToForum (Forums,&Forum,Highlight,0,IsLastItemInLevel); + For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); /***** Link to forum of teachers about the platform *****/ if (ICanSeeTeacherForum) @@ -1512,7 +1512,7 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums, Forum.Location = -1L; Highlight = (Forums->Forum.Type == For_FORUM__SWAD__TCHS); IsLastItemInLevel[1] = IsLastForum; - For_WriteLinkToForum (Forums,&Forum,Highlight,0,IsLastItemInLevel); + For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); } } @@ -1542,8 +1542,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums, Forum.Location = InsCod; Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_USRS && Forums->Forum.Location == InsCod); - IsLastItemInLevel[1] = (IsLastIns && !ICanSeeTeacherForum); - For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); + IsLastItemInLevel[2] = (IsLastIns && !ICanSeeTeacherForum); + For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); /***** Link to forum of teachers from this institution *****/ if (ICanSeeTeacherForum) @@ -1552,8 +1552,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums, Forum.Location = InsCod; Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_TCHS && Forums->Forum.Location == InsCod); - IsLastItemInLevel[1] = IsLastIns; - For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel); + IsLastItemInLevel[2] = IsLastIns; + For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); } } return InsCod; @@ -1585,8 +1585,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums, Forum.Location = CtrCod; Highlight = (Forums->Forum.Type == For_FORUM_CENTER_USRS && Forums->Forum.Location == CtrCod); - IsLastItemInLevel[2] = (IsLastCtr && !ICanSeeTeacherForum); - For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); + IsLastItemInLevel[3] = (IsLastCtr && !ICanSeeTeacherForum); + For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); /***** Link to forum of teachers from this center *****/ if (ICanSeeTeacherForum) @@ -1595,8 +1595,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums, Forum.Location = CtrCod; Highlight = (Forums->Forum.Type == For_FORUM_CENTER_TCHS && Forums->Forum.Location == CtrCod); - IsLastItemInLevel[2] = IsLastCtr; - For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel); + IsLastItemInLevel[3] = IsLastCtr; + For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); } } return CtrCod; @@ -1628,8 +1628,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums, Forum.Location = DegCod; Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_USRS && Forums->Forum.Location == DegCod); - IsLastItemInLevel[3] = (IsLastDeg && !ICanSeeTeacherForum); - For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); + IsLastItemInLevel[4] = (IsLastDeg && !ICanSeeTeacherForum); + For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); /***** Link to forum of teachers from this degree *****/ if (ICanSeeTeacherForum) @@ -1638,8 +1638,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums, Forum.Location = DegCod; Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_TCHS && Forums->Forum.Location == DegCod); - IsLastItemInLevel[3] = IsLastDeg; - For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel); + IsLastItemInLevel[4] = IsLastDeg; + For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); } } return DegCod; @@ -1671,8 +1671,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums, Forum.Location = CrsCod; Highlight = (Forums->Forum.Type == For_FORUM_COURSE_USRS && Forums->Forum.Location == CrsCod); - IsLastItemInLevel[4] = (IsLastCrs && !ICanSeeTeacherForum); - For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); + IsLastItemInLevel[5] = (IsLastCrs && !ICanSeeTeacherForum); + For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel); /***** Link to forum of teachers from this course *****/ if (ICanSeeTeacherForum) @@ -1681,8 +1681,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums, Forum.Location = CrsCod; Highlight = (Forums->Forum.Type == For_FORUM_COURSE_TCHS && Forums->Forum.Location == CrsCod); - IsLastItemInLevel[4] = IsLastCrs; - For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel); + IsLastItemInLevel[5] = IsLastCrs; + For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel); } } return CrsCod;