Version 23.46: Nov 07, 2023 Code refactoring and layout changes in lists of my courses, forums and chat.

This commit is contained in:
acanas 2023-11-07 19:06:18 +01:00
parent 61d93d612f
commit ae614985de
10 changed files with 157 additions and 5228 deletions

File diff suppressed because it is too large Load Diff

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')
*/
#define Log_PLATFORM_VERSION "SWAD 23.45 (2023-11-07)"
#define CSS_FILE "swad23.45.css"
#define Log_PLATFORM_VERSION "SWAD 23.46 (2023-11-07)"
#define CSS_FILE "swad23.46.css"
#define JS_FILE "swad22.49.js"
/*
Version 23.46: Nov 07, 2023 Code refactoring and layout changes in lists of my courses, forums and chat. (335525 lines)
Version 23.45: Nov 07, 2023 Improvements in responsive design. (335468 lines)
Version 23.44.4: Nov 06, 2023 Code refactoring in hierarchy. (335412 lines)
Version 23.44.3: Nov 06, 2023 Code refactoring in hierarchy. (335391 lines)

View File

@ -73,7 +73,7 @@ extern struct Globals Gbl;
/*****************************************************************************/
static void Cht_WriteLinkToChat1 (const char *RoomCode,const char *RoomShrtName,const char *RoomFullName,
unsigned Level,bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS]);
unsigned Level,Lay_LastItem_t IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS]);
static void Cht_WriteLinkToChat2 (const char *RoomCode,const char *RoomFullName);
/*****************************************************************************/
@ -112,7 +112,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS];
Lay_LastItem_t IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS];
unsigned NumMyDeg;
struct Hie_Node Deg;
struct Hie_Node Crs;
@ -136,15 +136,18 @@ void Cht_ShowListOfAvailableChatRooms (void)
HTM_UL_Begin ("class=\"LIST_TREE\"");
/***** Link to chat available for all users *****/
IsLastItemInLevel[1] = (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] &&
!Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num);
IsLastItemInLevel[1] = (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] ||
Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num) ? Lay_NO_LAST_ITEM :
Lay_LAST_ITEM;
snprintf (ThisRoomFullName,sizeof (ThisRoomFullName),"%s (%s)",
Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel);
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],
ThisRoomFullName,1,IsLastItemInLevel);
Ico_PutIcon ("comments.svg",Ico_BLACK,ThisRoomFullName,"ICO16x16");
Cht_WriteLinkToChat2 ("GBL_USR",ThisRoomFullName);
IsLastItemInLevel[1] = !Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num;
IsLastItemInLevel[1] = Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num ? Lay_NO_LAST_ITEM :
Lay_LAST_ITEM;
switch (Gbl.Usrs.Me.Role.Logged)
{
case Rol_STD:
@ -179,13 +182,15 @@ void Cht_ShowListOfAvailableChatRooms (void)
Err_WrongDegreeExit ();
/* Link to the room of this degree */
IsLastItemInLevel[1] = (NumMyDeg == Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num - 1);
IsLastItemInLevel[1] = (NumMyDeg == Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
snprintf (ThisRoomCode,sizeof (ThisRoomCode),"DEG_%ld",Deg.HieCod);
snprintf (ThisRoomShrtName,sizeof (ThisRoomShrtName),"%s",
Deg.ShrtName);
snprintf (ThisRoomFullName,sizeof (ThisRoomFullName),"%s %s",
Txt_HIERARCHY_SINGUL_Abc[Hie_DEG],Deg.ShrtName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,ThisRoomFullName,1,IsLastItemInLevel);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,
ThisRoomFullName,1,IsLastItemInLevel);
Lgo_DrawLogo (Hie_DEG,
Deg.HieCod,
Deg.ShrtName,
@ -210,14 +215,16 @@ void Cht_ShowListOfAvailableChatRooms (void)
Crs_GetCourseDataByCod (&Crs);
/* Link to the room of this course */
IsLastItemInLevel[2] = (NumCrs == NumCrss - 1);
IsLastItemInLevel[2] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
snprintf (ThisRoomCode,sizeof (ThisRoomCode),"CRS_%ld",
Crs.HieCod);
snprintf (ThisRoomShrtName,sizeof (ThisRoomShrtName),"%s",
Crs.ShrtName);
snprintf (ThisRoomFullName,sizeof (ThisRoomFullName),"%s %s",
Txt_HIERARCHY_SINGUL_Abc[Hie_CRS],Crs.ShrtName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,ThisRoomFullName,2,IsLastItemInLevel);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,
ThisRoomFullName,2,IsLastItemInLevel);
Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,ThisRoomFullName,"ICO16x16");
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
}
@ -290,12 +297,12 @@ void Cht_ShowListOfChatRoomsWithUsrs (void)
/*****************************************************************************/
static void Cht_WriteLinkToChat1 (const char *RoomCode,const char *RoomShrtName,const char *RoomFullName,
unsigned Level,bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS])
unsigned Level,Lay_LastItem_t IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS])
{
/***** Begin list item *****/
HTM_LI_Begin (NULL);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,Lay_HORIZONTAL_LINE_AT_RIGHT);
/***** Begin form *****/
Frm_BeginForm (ActCht);

View File

@ -156,7 +156,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
extern const char *Txt_My_courses;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
struct Hie_Node Hie[Hie_NUM_LEVELS];
bool IsLastItemInLevel[1 + 6];
Lay_LastItem_t IsLastItemInLevel[1 + 6];
bool Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_resCty;
MYSQL_RES *mysql_resIns;
@ -187,8 +187,9 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Highlight = (Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0);
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[1] = true;
Lay_IndentDependingOnLevel (1,IsLastItemInLevel);
IsLastItemInLevel[1] = Lay_LAST_ITEM;
Lay_IndentDependingOnLevel (1,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
Par_PutParLong (NULL,Par_CodeStr[Hie_ParCod[Hie_CTY]],-1L);
HTM_BUTTON_Submit_Begin (Txt_HIERARCHY_SINGUL_Abc[Hie_SYS],
@ -219,8 +220,10 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Gbl.Hierarchy.Node[Hie_CTY].HieCod == Hie[Hie_CTY].HieCod);
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[2] = (NumCty == NumCtys - 1);
Lay_IndentDependingOnLevel (2,IsLastItemInLevel);
IsLastItemInLevel[2] = (NumCty == NumCtys - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (2,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Hie_CTY],Hie[Hie_CTY].HieCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtyInf),
@ -252,8 +255,10 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Gbl.Hierarchy.Node[Hie_INS].HieCod == Hie[Hie_INS].HieCod);
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[3] = (NumIns == NumInss - 1);
Lay_IndentDependingOnLevel (3,IsLastItemInLevel);
IsLastItemInLevel[3] = (NumIns == NumInss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (3,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Hie_INS],Hie[Hie_INS].HieCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeInsInf),
@ -287,8 +292,10 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Gbl.Hierarchy.Node[Hie_CTR].HieCod == Hie[Hie_CTR].HieCod);
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[4] = (NumCtr == NumCtrs - 1);
Lay_IndentDependingOnLevel (4,IsLastItemInLevel);
IsLastItemInLevel[4] = (NumCtr == NumCtrs - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (4,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Hie_CTR],Hie[Hie_CTR].HieCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeCtrInf),
@ -322,8 +329,10 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Gbl.Hierarchy.Node[Hie_DEG].HieCod == Hie[Hie_DEG].HieCod);
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[5] = (NumDeg == NumDegs - 1);
Lay_IndentDependingOnLevel (5,IsLastItemInLevel);
IsLastItemInLevel[5] = (NumDeg == NumDegs - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
Lay_IndentDependingOnLevel (5,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Hie_DEG],Hie[Hie_DEG].HieCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (ActSeeDegInf),
@ -357,10 +366,12 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Write link to course *****/
Highlight = (Gbl.Hierarchy.Level == Hie_CRS &&
Gbl.Hierarchy.Node[Hie_CRS].HieCod == Hie[Hie_CRS].HieCod);
IsLastItemInLevel[6] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
IsLastItemInLevel[6] = (NumCrs == NumCrss - 1);
Lay_IndentDependingOnLevel (6,IsLastItemInLevel);
Lay_IndentDependingOnLevel (6,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Hie_CRS],Hie[Hie_CRS].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie[Hie_CRS].ShrtName),
@ -377,11 +388,12 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
HTM_DIV_End ();
HTM_BUTTON_End ();
Frm_EndForm ();
/***** Put link to register students *****/
Enr_PutButtonInlineToRegisterStds (Hie[Hie_CRS].HieCod);
HTM_LI_End ();
/***** Put link to register students *****/
Enr_PutButtonInlineToRegisterStds (Hie[Hie_CRS].HieCod,
6,IsLastItemInLevel,
Highlight);
}
/* Free structure that stores the query result */

View File

@ -172,19 +172,25 @@ void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void)
/****************** Put inline button to register students *******************/
/*****************************************************************************/
void Enr_PutButtonInlineToRegisterStds (long CrsCod)
void Enr_PutButtonInlineToRegisterStds (long CrsCod,
unsigned Level,Lay_LastItem_t IsLastItemInLevel[],
bool Highlight)
{
extern const char *Txt_Register_students;
// if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
if (Rol_GetMyRoleInCrs (CrsCod) == Rol_TCH) // I am a teacher in the given course
if (!Enr_GetNumUsrsInCrss (Hie_CRS,CrsCod,
1 << Rol_STD)) // No students in course
{
Frm_BeginForm (ActReqEnrSevStd);
ParCod_PutPar (ParCod_Crs,CrsCod);
Btn_PutCreateButtonInline (Txt_Register_students);
Frm_EndForm ();
HTM_LI_Begin (Highlight ? "class=\"BG_HIGHLIGHT\"" :
NULL);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,
Lay_NO_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActReqEnrSevStd);
ParCod_PutPar (ParCod_Crs,CrsCod);
Btn_PutCreateButtonInline (Txt_Register_students);
Frm_EndForm ();
HTM_LI_End ();
}
}

View File

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

View File

@ -337,27 +337,27 @@ static void For_PutIconsForums (__attribute__((unused)) void *Args);
static void For_PutFormWhichForums (const struct For_Forums *Forums);
static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
bool IsLastForum,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
long InsCod,bool IsLastIns,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
long CtrCod,bool IsLastCtr,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
long DegCod,bool IsLastDeg,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
long CrsCod,bool IsLastCrs,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static void For_WriteLinkToForum (const struct For_Forums *Forums,
const struct For_Forum *Forum,
bool Highlight,
unsigned Level,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]);
static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum,
unsigned NumThreads);
static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr);
@ -1213,7 +1213,7 @@ void For_ShowForumList (struct For_Forums *Forums)
{
extern const char *Hlp_COMMUNICATION_Forums;
extern const char *Txt_Forums;
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS];
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS];
MYSQL_RES *mysql_resCtr;
MYSQL_RES *mysql_resDeg;
MYSQL_RES *mysql_resCrs;
@ -1454,7 +1454,7 @@ static void For_PutFormWhichForums (const struct For_Forums *Forums)
/*****************************************************************************/
static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
bool ICanSeeTeacherForum;
@ -1470,7 +1470,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_GLOBAL_USRS;
Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_USRS);
IsLastItemInLevel[1] = false;
IsLastItemInLevel[1] = Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
/***** Link to forum of teachers global *****/
@ -1480,7 +1480,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM_GLOBAL_TCHS;
Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM_GLOBAL_TCHS);
IsLastItemInLevel[1] = false;
IsLastItemInLevel[1] = Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
}
}
@ -1491,7 +1491,7 @@ static void For_WriteLinksToGblForums (const struct For_Forums *Forums,
static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
bool IsLastForum,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
bool ICanSeeTeacherForum;
@ -1507,7 +1507,8 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM__SWAD__USRS;
Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM__SWAD__USRS);
IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum);
IsLastItemInLevel[1] = (IsLastForum && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
/***** Link to forum of teachers about the platform *****/
@ -1516,7 +1517,8 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
Forum.Type = For_FORUM__SWAD__TCHS;
Forum.HieCod = -1L;
Highlight = (Forums->Forum.Type == For_FORUM__SWAD__TCHS);
IsLastItemInLevel[1] = IsLastForum;
IsLastItemInLevel[1] = IsLastForum ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,1,IsLastItemInLevel);
}
}
@ -1528,7 +1530,7 @@ static void For_WriteLinksToPlatformForums (const struct For_Forums *Forums,
static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
long InsCod,bool IsLastIns,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
Rol_Role_t MaxRoleInIns;
@ -1547,7 +1549,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
Forum.HieCod = InsCod;
Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_USRS &&
Forums->Forum.HieCod == InsCod);
IsLastItemInLevel[2] = (IsLastIns && !ICanSeeTeacherForum);
IsLastItemInLevel[2] = (IsLastIns && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel);
/***** Link to forum of teachers from this institution *****/
@ -1557,7 +1560,8 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
Forum.HieCod = InsCod;
Highlight = (Forums->Forum.Type == For_FORUM_INSTIT_TCHS &&
Forums->Forum.HieCod == InsCod);
IsLastItemInLevel[2] = IsLastIns;
IsLastItemInLevel[2] = IsLastIns ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,2,IsLastItemInLevel);
}
}
@ -1571,7 +1575,7 @@ static long For_WriteLinksToInsForums (const struct For_Forums *Forums,
static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
long CtrCod,bool IsLastCtr,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
Rol_Role_t MaxRoleInCtr;
@ -1590,7 +1594,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
Forum.HieCod = CtrCod;
Highlight = (Forums->Forum.Type == For_FORUM_CENTER_USRS &&
Forums->Forum.HieCod == CtrCod);
IsLastItemInLevel[3] = (IsLastCtr && !ICanSeeTeacherForum);
IsLastItemInLevel[3] = (IsLastCtr && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel);
/***** Link to forum of teachers from this center *****/
@ -1600,7 +1605,8 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
Forum.HieCod = CtrCod;
Highlight = (Forums->Forum.Type == For_FORUM_CENTER_TCHS &&
Forums->Forum.HieCod == CtrCod);
IsLastItemInLevel[3] = IsLastCtr;
IsLastItemInLevel[3] = IsLastCtr ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,3,IsLastItemInLevel);
}
}
@ -1614,7 +1620,7 @@ static long For_WriteLinksToCtrForums (const struct For_Forums *Forums,
static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
long DegCod,bool IsLastDeg,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
Rol_Role_t MaxRoleInDeg;
@ -1633,7 +1639,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
Forum.HieCod = DegCod;
Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_USRS &&
Forums->Forum.HieCod == DegCod);
IsLastItemInLevel[4] = (IsLastDeg && !ICanSeeTeacherForum);
IsLastItemInLevel[4] = (IsLastDeg && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel);
/***** Link to forum of teachers from this degree *****/
@ -1643,7 +1650,8 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
Forum.HieCod = DegCod;
Highlight = (Forums->Forum.Type == For_FORUM_DEGREE_TCHS &&
Forums->Forum.HieCod == DegCod);
IsLastItemInLevel[4] = IsLastDeg;
IsLastItemInLevel[4] = IsLastDeg ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,4,IsLastItemInLevel);
}
}
@ -1657,7 +1665,7 @@ static long For_WriteLinksToDegForums (const struct For_Forums *Forums,
static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
long CrsCod,bool IsLastCrs,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
bool Highlight;
Rol_Role_t MyRoleInCrs;
@ -1676,7 +1684,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
Forum.HieCod = CrsCod;
Highlight = (Forums->Forum.Type == For_FORUM_COURSE_USRS &&
Forums->Forum.HieCod == CrsCod);
IsLastItemInLevel[5] = (IsLastCrs && !ICanSeeTeacherForum);
IsLastItemInLevel[5] = (IsLastCrs && !ICanSeeTeacherForum) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel);
/***** Link to forum of teachers from this course *****/
@ -1686,7 +1695,8 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums,
Forum.HieCod = CrsCod;
Highlight = (Forums->Forum.Type == For_FORUM_COURSE_TCHS &&
Forums->Forum.HieCod == CrsCod);
IsLastItemInLevel[5] = IsLastCrs;
IsLastItemInLevel[5] = IsLastCrs ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
For_WriteLinkToForum (Forums,&Forum,Highlight,5,IsLastItemInLevel);
}
}
@ -1701,7 +1711,7 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
const struct For_Forum *Forum,
bool Highlight,
unsigned Level,
bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
Lay_LastItem_t IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS])
{
extern const char *Txt_Copy_not_allowed;
unsigned NumThrs;
@ -1717,7 +1727,8 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
NULL);
/***** Indent forum title *****/
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
/***** Write paste button used to move a thread in clipboard to this forum *****/
if (Forums->Thread.ToMove >= 0) // If I have permission to paste threads and there is a thread ready to be pasted...
@ -1808,11 +1819,13 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
Frm_EndForm ();
/***** Put link to register students *****/
if (Forum->Type == For_FORUM_COURSE_USRS)
Enr_PutButtonInlineToRegisterStds (Forum->HieCod);
HTM_LI_End ();
/***** Put link to register students *****/
if (Forum->Type == For_FORUM_COURSE_USRS)
Enr_PutButtonInlineToRegisterStds (Forum->HieCod,
5,IsLastItemInLevel,
Highlight);
}
/*****************************************************************************/

View File

@ -1604,31 +1604,36 @@ void Lay_AdvertisementMobile (void)
}
/*****************************************************************************/
/*********************** Indent forum or chat title **************************/
/****************** Indent forum, chat or course tree title ******************/
/*****************************************************************************/
// IsLastItemInLevel[] is a vector with at least 1 + Level booleans
// IsLastItemInLevel[] is a vector with at least 1 + Level elements
void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[])
void Lay_IndentDependingOnLevel (unsigned Level,
Lay_LastItem_t IsLastItemInLevel[],
Lay_HorizontalLineAtRight_t HorizontalLineAtRight)
{
unsigned i;
static const char *Icons[Lay_NUM_HORIZONTAL_LINE_AT_RIGHT][Lay_NUM_LAST_ITEM] =
{
[Lay_NO_HORIZONTAL_LINE_AT_RIGHT][Lay_NO_LAST_ITEM] = "subleft20x20.gif",
[Lay_NO_HORIZONTAL_LINE_AT_RIGHT][Lay_LAST_ITEM ] = "tr20x20.gif",
[Lay_HORIZONTAL_LINE_AT_RIGHT ][Lay_NO_LAST_ITEM] = "submid20x20.gif",
[Lay_HORIZONTAL_LINE_AT_RIGHT ][Lay_LAST_ITEM ] = "subend20x20.gif",
};
unsigned L;
if (Level <= 1)
return;
/***** Indent (from 1 to Level-1) *****/
for (i = 2;
i < Level;
i++)
Ico_PutIcon (IsLastItemInLevel[i] ? "tr20x20.gif" :
"subleft20x20.gif",
Ico_BLACK,
"","ICO25x25");
for (L = 2;
L < Level;
L++)
Ico_PutIcon (Icons[Lay_NO_HORIZONTAL_LINE_AT_RIGHT][IsLastItemInLevel[L]],
Ico_BLACK,"","ICO25x25");
/***** Level *****/
Ico_PutIcon (IsLastItemInLevel[Level] ? "subend20x20.gif" :
"submid20x20.gif",
Ico_BLACK,
"","ICO25x25");
Ico_PutIcon (Icons[HorizontalLineAtRight][IsLastItemInLevel[Level]],
Ico_BLACK,"","ICO25x25");
}
/*****************************************************************************/

View File

@ -40,6 +40,20 @@
#define Lay_SHOW_LEFT_COLUMN 2 // 10
#define Lay_SHOW_BOTH_COLUMNS (Lay_SHOW_LEFT_COLUMN | Lay_SHOW_RIGHT_COLUMN) // 11
#define Lay_NUM_LAST_ITEM 2
typedef enum
{
Lay_NO_LAST_ITEM,
Lay_LAST_ITEM,
} Lay_LastItem_t;
#define Lay_NUM_HORIZONTAL_LINE_AT_RIGHT 2
typedef enum
{
Lay_NO_HORIZONTAL_LINE_AT_RIGHT,
Lay_HORIZONTAL_LINE_AT_RIGHT,
} Lay_HorizontalLineAtRight_t;
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
@ -72,7 +86,9 @@ void Lay_WriteHeaderClassPhoto (Vie_ViewType_t ViewType);
void Lay_AdvertisementMobile (void);
void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[]);
void Lay_IndentDependingOnLevel (unsigned Level,
Lay_LastItem_t IsLastItemInLevel[],
Lay_HorizontalLineAtRight_t HorizontalLineAtRight);
void Lay_HelpPlainEditor (void);
void Lay_HelpRichEditor (void);

View File

@ -88,10 +88,11 @@ void Lgo_DrawLogo (Hie_Level_t Level,
};
const char *Folder = NULL; // To avoid warning
char PathLogo[PATH_MAX + 1];
bool LogoFound;
long InsCod;
long CtrCod;
long DegCod;
bool LogoFound = false;
long InsCod = HieCod;
long CtrCod = HieCod;
long DegCod = HieCod;
long CrsCod = HieCod;
char *URL;
char *Icon;
bool ClassNotEmpty;
@ -102,16 +103,13 @@ void Lgo_DrawLogo (Hie_Level_t Level,
if (HieCod > 0) // Institution, center or degree exists
{
/* Course */
LogoFound = false;
/* Degree */
if (!LogoFound && Level >= Hie_DEG)
{
Folder = Cfg_FOLDER_DEG;
if (Level >= Hie_CRS) // && !LogoFound
DegCod = Crs_DB_GetDegCodOfCourseByCod (HieCod);
else
DegCod = HieCod;
if (Level >= Hie_CRS)
DegCod = Crs_DB_GetDegCodOfCourseByCod (CrsCod);
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_DEG_PUBLIC,
(unsigned) (DegCod % 100),
@ -126,7 +124,7 @@ void Lgo_DrawLogo (Hie_Level_t Level,
if (!LogoFound && Level >= Hie_CTR)
{
Folder = Cfg_FOLDER_CTR;
if (Level >= Hie_DEG) // && !LogoFound
if (Level >= Hie_DEG)
CtrCod = Deg_DB_GetCtrCodOfDegreeByCod (DegCod);
else
CtrCod = HieCod;
@ -144,10 +142,8 @@ void Lgo_DrawLogo (Hie_Level_t Level,
if (!LogoFound)
{
Folder = Cfg_FOLDER_INS;
if (Level >= Hie_CTR) // && !LogoFound
if (Level >= Hie_CTR)
InsCod = Ctr_DB_GetInsCodOfCenterByCod (CtrCod);
else
InsCod = HieCod;
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_INS_PUBLIC,
(unsigned) (InsCod % 100),