Version 23.50: Nov 28, 2023 Code refactoring in hierarchy.

This commit is contained in:
acanas 2023-11-28 01:44:05 +01:00
parent 3039405c8d
commit 33cd1e8bfe
28 changed files with 474 additions and 624 deletions

View File

@ -9258,16 +9258,21 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
extern const char *Txt_Folder; extern const char *Txt_Folder;
extern const char *Txt_Link; extern const char *Txt_Link;
struct Brw_FileMetadata FileMetadata; struct Brw_FileMetadata FileMetadata;
struct Hie_Node Hie[Hie_NUM_LEVELS];
/*
long InsCod; long InsCod;
long CtrCod; long CtrCod;
long DegCod; long DegCod;
long CrsCod; long CrsCod;
*/
long GrpCod; long GrpCod;
Act_Action_t Action; Act_Action_t Action;
/*
const char *InsShortName; const char *InsShortName;
const char *CtrShortName; const char *CtrShortName;
const char *DegShortName; const char *DegShortName;
const char *CrsShortName; const char *CrsShortName;
*/
const char *BgColor; const char *BgColor;
const char *Title; const char *Title;
char FileNameToShow[NAME_MAX + 1]; char FileNameToShow[NAME_MAX + 1];
@ -9291,28 +9296,28 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
if (!Brw_DB_CheckIfFileOrFolderIsSetAsHiddenUsingMetadata (&FileMetadata)) if (!Brw_DB_CheckIfFileOrFolderIsSetAsHiddenUsingMetadata (&FileMetadata))
{ {
/***** Get institution code (row[2]) *****/ /***** Get institution code (row[2]) *****/
InsCod = Str_ConvertStrCodToLongCod (row[2]); Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[2]);
InsShortName = row[3]; Str_Copy (Hie[Hie_INS].ShrtName,row[3],sizeof (Hie[Hie_INS].ShrtName) - 1);
/***** Get center code (row[4]) *****/ /***** Get center code (row[4]) *****/
CtrCod = Str_ConvertStrCodToLongCod (row[4]); Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[4]);
CtrShortName = row[5]; Str_Copy (Hie[Hie_CTR].ShrtName,row[5],sizeof (Hie[Hie_CTR].ShrtName) - 1);
/***** Get degree code (row[6]) *****/ /***** Get degree code (row[6]) *****/
DegCod = Str_ConvertStrCodToLongCod (row[6]); Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[6]);
DegShortName = row[7]; Str_Copy (Hie[Hie_DEG].ShrtName,row[7],sizeof (Hie[Hie_DEG].ShrtName) - 1);
/***** Get course code (row[8]) *****/ /***** Get course code (row[8]) *****/
CrsCod = Str_ConvertStrCodToLongCod (row[8]); Hie[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[8]);
CrsShortName = row[9]; Str_Copy (Hie[Hie_CRS].ShrtName,row[9],sizeof (Hie[Hie_CRS].ShrtName) - 1);
/***** Get group code (row[8]) *****/ /***** Get group code (row[8]) *****/
GrpCod = Str_ConvertStrCodToLongCod (row[10]); GrpCod = Str_ConvertStrCodToLongCod (row[10]);
/***** Set row color *****/ /***** Set row color *****/
BgColor = (CrsCod > 0 && BgColor = (Hie[Hie_CRS].HieCod > 0 &&
CrsCod == Gbl.Hierarchy.Node[Hie_CRS].HieCod) ? "BG_HIGHLIGHT" : Hie[Hie_CRS].HieCod == Gbl.Hierarchy.Node[Hie_CRS].HieCod) ? "BG_HIGHLIGHT" :
The_GetColorRows (); The_GetColorRows ();
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -9325,16 +9330,15 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
/***** Write institution logo, institution short name *****/ /***** Write institution logo, institution short name *****/
HTM_TD_Begin ("class=\"LT DAT_%s %s\"", HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
if (InsCod > 0) if (Hie[Hie_INS].HieCod > 0)
{ {
Frm_BeginFormGoTo (ActSeeInsInf); Frm_BeginFormGoTo (ActSeeInsInf);
ParCod_PutPar (ParCod_Ins,InsCod); ParCod_PutPar (ParCod_Ins,Hie[Hie_INS].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (InsShortName), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie[Hie_INS].ShrtName),
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
Lgo_DrawLogo (Hie_INS,InsCod,InsShortName, Lgo_DrawLogo (Hie_INS,&Hie[Hie_INS],"LT BT_LINK ICO20x20");
"ICO20x20","LT BT_LINK"); HTM_TxtF (" %s",Hie[Hie_INS].ShrtName);
HTM_TxtF (" %s",InsShortName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
} }
@ -9343,16 +9347,15 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
/***** Write center logo, center short name *****/ /***** Write center logo, center short name *****/
HTM_TD_Begin ("class=\"LT DAT_%s %s\"", HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
if (CtrCod > 0) if (Hie[Hie_CTR].HieCod > 0)
{ {
Frm_BeginFormGoTo (ActSeeCtrInf); Frm_BeginFormGoTo (ActSeeCtrInf);
ParCod_PutPar (ParCod_Ctr,CtrCod); ParCod_PutPar (ParCod_Ctr,Hie[Hie_CTR].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (CtrShortName), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie[Hie_CTR].ShrtName),
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
Lgo_DrawLogo (Hie_CTR,CtrCod,CtrShortName, Lgo_DrawLogo (Hie_CTR,&Hie[Hie_CTR],"LT ICO20x20");
"ICO20x20","LT"); HTM_TxtF (" %s",Hie[Hie_CTR].ShrtName);
HTM_TxtF (" %s",CtrShortName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
} }
@ -9361,16 +9364,15 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
/***** Write degree logo, degree short name *****/ /***** Write degree logo, degree short name *****/
HTM_TD_Begin ("class=\"LT DAT_%s %s\"", HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
if (DegCod > 0) if (Hie[Hie_DEG].HieCod > 0)
{ {
Frm_BeginFormGoTo (ActSeeDegInf); Frm_BeginFormGoTo (ActSeeDegInf);
ParCod_PutPar (ParCod_Deg,DegCod); ParCod_PutPar (ParCod_Deg,Hie[Hie_DEG].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (DegShortName), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie[Hie_DEG].ShrtName),
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
Lgo_DrawLogo (Hie_DEG,DegCod,DegShortName, Lgo_DrawLogo (Hie_DEG,&Hie[Hie_DEG],"LT ICO20x20");
"ICO20x20","LT"); HTM_TxtF (" %s",Hie[Hie_DEG].ShrtName);
HTM_TxtF (" %s",DegShortName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
} }
@ -9379,14 +9381,14 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
/***** Write course short name *****/ /***** Write course short name *****/
HTM_TD_Begin ("class=\"LT DAT_%s %s\"", HTM_TD_Begin ("class=\"LT DAT_%s %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
if (CrsCod > 0) if (Hie[Hie_CRS].HieCod > 0)
{ {
Frm_BeginFormGoTo (ActSeeCrsInf); Frm_BeginFormGoTo (ActSeeCrsInf);
ParCod_PutPar (ParCod_Crs,CrsCod); ParCod_PutPar (ParCod_Crs,Hie[Hie_CRS].HieCod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (CrsShortName), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Hie[Hie_CRS].ShrtName),
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
HTM_Txt (CrsShortName); HTM_Txt (Hie[Hie_CRS].ShrtName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
} }
@ -9454,27 +9456,27 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
/* Begin form */ /* Begin form */
Action = Brw_ActReqDatFile[Brw_FileBrowserForFoundDocs[FileMetadata.FileBrowser]]; Action = Brw_ActReqDatFile[Brw_FileBrowserForFoundDocs[FileMetadata.FileBrowser]];
if (CrsCod > 0) if (Hie[Hie_CRS].HieCod > 0)
{ {
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
ParCod_PutPar (ParCod_Crs,CrsCod); // Go to course ParCod_PutPar (ParCod_Crs,Hie[Hie_CRS].HieCod); // Go to course
if (GrpCod > 0) if (GrpCod > 0)
ParCod_PutPar (ParCod_Grp,GrpCod); ParCod_PutPar (ParCod_Grp,GrpCod);
} }
else if (DegCod > 0) else if (Hie[Hie_DEG].HieCod > 0)
{ {
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
ParCod_PutPar (ParCod_Deg,DegCod); // Go to degree ParCod_PutPar (ParCod_Deg,Hie[Hie_DEG].HieCod); // Go to degree
} }
else if (CtrCod > 0) else if (Hie[Hie_CTR].HieCod > 0)
{ {
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
ParCod_PutPar (ParCod_Ctr,CtrCod); // Go to center ParCod_PutPar (ParCod_Ctr,Hie[Hie_CTR].HieCod); // Go to center
} }
else if (InsCod > 0) else if (Hie[Hie_INS].HieCod > 0)
{ {
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
ParCod_PutPar (ParCod_Ins,InsCod); // Go to institution ParCod_PutPar (ParCod_Ins,Hie[Hie_INS].HieCod); // Go to institution
} }
else else
Frm_BeginForm (Action); Frm_BeginForm (Action);

View File

@ -952,10 +952,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
if (TypeViewCallForExam == Cfe_NORMAL_VIEW) if (TypeViewCallForExam == Cfe_NORMAL_VIEW)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"EXAM_TIT_%s\"", HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"EXAM_TIT_%s\"",
Gbl.Hierarchy.Node[Hie_INS].WWW,The_GetSuffix ()); Gbl.Hierarchy.Node[Hie_INS].WWW,The_GetSuffix ());
Lgo_DrawLogo (Hie_INS, Lgo_DrawLogo (Hie_INS,&Gbl.Hierarchy.Node[Hie_INS],"ICO64x64");
Gbl.Hierarchy.Node[Hie_INS].HieCod,
Gbl.Hierarchy.Node[Hie_INS].FullName,
"ICO64x64",NULL);
HTM_BR (); HTM_BR ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName); HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName);
if (TypeViewCallForExam == Cfe_NORMAL_VIEW) if (TypeViewCallForExam == Cfe_NORMAL_VIEW)

View File

@ -158,7 +158,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"", HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
Ctr_DrawCenterLogoAndNameWithLink (&Ctr,ActSeeDeg,"CM"); Ctr_DrawCenterLogoAndNameWithLink (&Ctr,ActSeeDeg,"CM ICO16x16");
HTM_TD_End (); HTM_TD_End ();
/* Number of pending degrees (row[1]) */ /* Number of pending degrees (row[1]) */
@ -185,7 +185,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
/*****************************************************************************/ /*****************************************************************************/
void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action, void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action,
const char *ClassLogo) const char *IconClass)
{ {
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
@ -197,7 +197,7 @@ void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
/***** Center logo and name *****/ /***** Center logo and name *****/
Lgo_DrawLogo (Hie_CTR,Ctr->HieCod,Ctr->ShrtName,"ICO16x16",ClassLogo); Lgo_DrawLogo (Hie_CTR,Ctr,IconClass);
HTM_TxtF (" %s",Ctr->FullName); HTM_TxtF (" %s",Ctr->FullName);
/***** End link *****/ /***** End link *****/
@ -342,7 +342,7 @@ static void Ctr_ListOneCenterForSeeing (struct Hie_Node *Ctr,unsigned NumCtr)
/***** Center logo and name *****/ /***** Center logo and name *****/
HTM_TD_Begin ("class=\"LM %s_%s %s\"", HTM_TD_Begin ("class=\"LM %s_%s %s\"",
TxtClassStrong,The_GetSuffix (),BgColor); TxtClassStrong,The_GetSuffix (),BgColor);
Ctr_DrawCenterLogoAndNameWithLink (Ctr,ActSeeDeg,"CM"); Ctr_DrawCenterLogoAndNameWithLink (Ctr,ActSeeDeg,"CM ICO16x16");
HTM_TD_End (); HTM_TD_End ();
/***** Number of users who claim to belong to this center *****/ /***** Number of users who claim to belong to this center *****/
@ -537,40 +537,40 @@ void Ctr_GetFullListOfCenters (long InsCod,Hie_Order_t SelectedOrder)
/************************ Get data of center by code *************************/ /************************ Get data of center by code *************************/
/*****************************************************************************/ /*****************************************************************************/
bool Ctr_GetCenterDataByCod (struct Hie_Node *Ctr) bool Ctr_GetCenterDataByCod (struct Hie_Node *Node)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool CtrFound = false; bool Found = false;
/***** Clear data *****/ /***** Clear data *****/
Ctr->PrtCod = -1L; Node->PrtCod = -1L;
Ctr->Specific.PlcCod = -1L; Node->Specific.PlcCod = -1L;
Ctr->Status = (Hie_Status_t) 0; Node->Status = (Hie_Status_t) 0;
Ctr->RequesterUsrCod = -1L; Node->RequesterUsrCod = -1L;
Ctr->ShrtName[0] = '\0'; Node->ShrtName[0] = '\0';
Ctr->FullName[0] = '\0'; Node->FullName[0] = '\0';
Ctr->WWW[0] = '\0'; Node->WWW[0] = '\0';
Ctr->NumUsrsWhoClaimToBelong.Valid = false; Node->NumUsrsWhoClaimToBelong.Valid = false;
/***** Check if center code is correct *****/ /***** Check if center code is correct *****/
if (Ctr->HieCod > 0) if (Node->HieCod > 0)
{ {
/***** Get data of a center from database *****/ /***** Get data of a center from database *****/
if (Ctr_DB_GetCenterDataByCod (&mysql_res,Ctr->HieCod)) // Center found... if (Ctr_DB_GetCenterDataByCod (&mysql_res,Node->HieCod)) // Center found...
{ {
/* Get center data */ /* Get center data */
Ctr_GetCenterDataFromRow (mysql_res,Ctr, Ctr_GetCenterDataFromRow (mysql_res,Node,
false); // Don't get number of users who claim to belong to this center false); // Don't get number of users who claim to belong to this center
/* Set return value */ /* Set return value */
CtrFound = true; Found = true;
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
return CtrFound; return Found;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -791,7 +791,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
/* Center logo */ /* Center logo */
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ctr->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ctr->FullName);
Lgo_DrawLogo (Hie_CTR,Ctr->HieCod,Ctr->ShrtName,"ICO20x20",NULL); Lgo_DrawLogo (Hie_CTR,Ctr,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/* Place */ /* Place */
@ -1220,6 +1220,7 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
{ {
extern const char *Txt_Another_place; extern const char *Txt_Another_place;
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
struct Hie_Node Ctr;
unsigned NumPlc; unsigned NumPlc;
const struct Plc_Place *Plc; const struct Plc_Place *Plc;
const char *Names[Nam_NUM_SHRT_FULL_NAMES]; const char *Names[Nam_NUM_SHRT_FULL_NAMES];
@ -1250,7 +1251,9 @@ static void Ctr_PutFormToCreateCenter (const struct Plc_Places *Places)
/***** Center logo *****/ /***** Center logo *****/
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ctr_EditingCtr->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ctr_EditingCtr->FullName);
Lgo_DrawLogo (Hie_CTR,-1L,"","ICO20x20",NULL); Ctr.HieCod = -1L;
Ctr.ShrtName[0] = '\0';
Lgo_DrawLogo (Hie_CTR,&Ctr,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/***** Place *****/ /***** Place *****/

View File

@ -44,14 +44,14 @@
void Ctr_SeeCtrWithPendingDegs (void); void Ctr_SeeCtrWithPendingDegs (void);
void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action, void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action,
const char *ClassLogo); const char *IconClass);
void Ctr_ShowCtrsOfCurrentIns (void); void Ctr_ShowCtrsOfCurrentIns (void);
void Ctr_EditCenters (void); void Ctr_EditCenters (void);
void Ctr_GetBasicListOfCenters (long InsCod); void Ctr_GetBasicListOfCenters (long InsCod);
void Ctr_GetFullListOfCenters (long InsCod,Hie_Order_t SelectedOrder); void Ctr_GetFullListOfCenters (long InsCod,Hie_Order_t SelectedOrder);
bool Ctr_GetCenterDataByCod (struct Hie_Node *Ctr); bool Ctr_GetCenterDataByCod (struct Hie_Node *Node);
void Ctr_GetCoordByCod (long CtrCod,struct Map_Coordinates *Coord); void Ctr_GetCoordByCod (long CtrCod,struct Map_Coordinates *Coord);
void Ctr_WriteSelectorOfCenter (void); void Ctr_WriteSelectorOfCenter (void);
void Ctr_RemoveCenter (void); void Ctr_RemoveCenter (void);

View File

@ -580,10 +580,7 @@ static void CtrCfg_Institution (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
} }
Lgo_DrawLogo (Hie_INS, Lgo_DrawLogo (Hie_INS,&Gbl.Hierarchy.Node[Hie_INS],"LM ICO20x20");
Gbl.Hierarchy.Node[Hie_INS].HieCod,
Gbl.Hierarchy.Node[Hie_INS].ShrtName,
"ICO20x20","LM");
HTM_NBSP (); HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName); HTM_Txt (Gbl.Hierarchy.Node[Hie_INS].FullName);

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.49 (2023-11-27)" #define Log_PLATFORM_VERSION "SWAD 23.50 (2023-11-28)"
#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.50: Nov 28, 2023 Code refactoring in hierarchy. (335634 lines)
Version 23.49: Nov 27, 2023 Code refactoring in highlighting. (335774 lines) 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)

View File

@ -191,7 +191,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
Txt_HIERARCHY_SINGUL_Abc[Hie_DEG],Deg.ShrtName); Txt_HIERARCHY_SINGUL_Abc[Hie_DEG],Deg.ShrtName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName, Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,
ThisRoomFullName,1,IsLastItemInLevel); ThisRoomFullName,1,IsLastItemInLevel);
Lgo_DrawLogo (Hie_DEG,Deg.HieCod,Deg.ShrtName,"ICO16x16",NULL); Lgo_DrawLogo (Hie_DEG,&Deg,"ICO16x16");
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName); Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
/* Get my courses in this degree from database */ /* Get my courses in this degree from database */
@ -222,7 +222,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
Txt_HIERARCHY_SINGUL_Abc[Hie_CRS],Crs.ShrtName); Txt_HIERARCHY_SINGUL_Abc[Hie_CRS],Crs.ShrtName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName, Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShrtName,
ThisRoomFullName,2,IsLastItemInLevel); ThisRoomFullName,2,IsLastItemInLevel);
Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,ThisRoomFullName,"ICO16x16"); Lgo_DrawLogo (Hie_CRS,&Crs,"ICO16x16");
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName); Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
} }
} }

View File

@ -534,7 +534,7 @@ void Cty_DrawCountryMapAndNameWithLink (struct Hie_Node *Cty,Act_Action_t Action
/***************************** Draw country map ******************************/ /***************************** Draw country map ******************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DrawCountryMap (struct Hie_Node *Cty,const char *Class) void Cty_DrawCountryMap (const struct Hie_Node *Cty,const char *Class)
{ {
char *URL; char *URL;
char *Icon; char *Icon;
@ -559,7 +559,7 @@ void Cty_DrawCountryMap (struct Hie_Node *Cty,const char *Class)
/*********************** Check if country map exists *************************/ /*********************** Check if country map exists *************************/
/*****************************************************************************/ /*****************************************************************************/
bool Cty_CheckIfCountryPhotoExists (struct Hie_Node *Cty) bool Cty_CheckIfCountryPhotoExists (const struct Hie_Node *Cty)
{ {
char PathMap[PATH_MAX + 1]; char PathMap[PATH_MAX + 1];
@ -897,51 +897,50 @@ void Cty_WriteCountryName (long CtyCod)
/***************** Get basic data of country given its code ******************/ /***************** Get basic data of country given its code ******************/
/*****************************************************************************/ /*****************************************************************************/
bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Cty) bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Node)
{ {
extern const char *Txt_Another_country; extern const char *Txt_Another_country;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
bool CtyFound; bool Found;
if (Cty->HieCod < 0) if (Node->HieCod < 0)
return false; return false;
/***** Clear data *****/ /***** Clear data *****/
Cty->ShrtName[0] = '\0'; Node->ShrtName[0] = '\0';
Cty->FullName[0] = '\0'; Node->FullName[0] = '\0';
Cty->WWW[0] = '\0'; Node->WWW[0] = '\0';
Cty->NumUsrsWhoClaimToBelong.Valid = false; Node->NumUsrsWhoClaimToBelong.Valid = false;
/***** If another country *****/ /***** If another country *****/
if (Cty->HieCod == 0) if (Node->HieCod == 0)
{ {
Str_Copy (Cty->FullName,Txt_Another_country, Str_Copy (Node->FullName,Txt_Another_country,sizeof (Node->FullName) - 1);
sizeof (Cty->FullName) - 1);
return false; return false;
} }
// Here Cty->CtyCod > 0 // Here Cty->CtyCod > 0
/***** Get data of a country from database *****/ /***** Get data of a country from database *****/
CtyFound = (Cty_DB_GetBasicCountryDataByCod (&mysql_res,Cty->HieCod) != 0); Found = (Cty_DB_GetBasicCountryDataByCod (&mysql_res,Node->HieCod) != 0);
if (CtyFound) // Country found... if (Found) // Country found...
{ {
/* Get row */ /* Get row */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
/* Get Alpha-2 country code (row[0]) */ /* Get Alpha-2 country code (row[0]) */
Str_Copy (Cty->ShrtName,row[0],sizeof (Cty->ShrtName) - 1); Str_Copy (Node->ShrtName,row[0],sizeof (Node->ShrtName) - 1);
/* Get name and WWW of the country in current language */ /* Get name and WWW of the country in current language */
Str_Copy (Cty->FullName,row[1],sizeof (Cty->FullName) - 1); Str_Copy (Node->FullName,row[1],sizeof (Node->FullName) - 1);
Str_Copy (Cty->WWW ,row[2],sizeof (Cty->WWW ) - 1); Str_Copy (Node->WWW ,row[2],sizeof (Node->WWW ) - 1);
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
return CtyFound; return Found;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -58,8 +58,8 @@ bool Cty_CheckIfICanEditCountries (void);
void Cty_DrawCountryMapAndNameWithLink (struct Hie_Node *Cty,Act_Action_t Action, void Cty_DrawCountryMapAndNameWithLink (struct Hie_Node *Cty,Act_Action_t Action,
const char *ClassContainer, const char *ClassContainer,
const char *ClassMap); const char *ClassMap);
void Cty_DrawCountryMap (struct Hie_Node *Cty,const char *Class); void Cty_DrawCountryMap (const struct Hie_Node *Cty,const char *Class);
bool Cty_CheckIfCountryPhotoExists (struct Hie_Node *Cty); bool Cty_CheckIfCountryPhotoExists (const struct Hie_Node *Cty);
void Cty_WriteScriptGoogleGeochart (void); void Cty_WriteScriptGoogleGeochart (void);
void Cty_PutParCtyOrder (void); void Cty_PutParCtyOrder (void);
@ -67,7 +67,7 @@ void Cty_EditCountries (void);
void Cty_GetBasicListOfCountries (void); void Cty_GetBasicListOfCountries (void);
void Cty_WriteSelectorOfCountry (void); void Cty_WriteSelectorOfCountry (void);
void Cty_WriteCountryName (long CtyCod); void Cty_WriteCountryName (long CtyCod);
bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Cty); bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Node);
void Cty_GetNamesAndWWWsByCod (struct Hie_Node *Cty, void Cty_GetNamesAndWWWsByCod (struct Hie_Node *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1], char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]); char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]);

View File

@ -91,6 +91,13 @@ static struct Hie_Node *Crs_EditingCrs = NULL; // Static variable to keep the co
/*****************************************************************************/ /*****************************************************************************/
static void Crs_WriteListMyCoursesToSelectOne (void); static void Crs_WriteListMyCoursesToSelectOne (void);
static void Crs_WriteNodes (struct Hie_Node Hie[Hie_NUM_LEVELS],
Lay_LastItem_t IsLastItemInLevel[1 + 6],
Hie_Level_t Level);
static void Crs_WriteRowMyCourses (Hie_Level_t Level,
const struct Hie_Node Hie[Hie_NUM_LEVELS],
Lay_Highlight_t Highlight,
Lay_LastItem_t IsLastItemInLevel[1 + 6]);
static void Crs_GetListCrssInCurrentDeg (void); static void Crs_GetListCrssInCurrentDeg (void);
static void Crs_ListCourses (void); static void Crs_ListCourses (void);
@ -151,30 +158,9 @@ 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 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];
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];
Lay_Highlight_t Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_resCty;
MYSQL_RES *mysql_resIns;
MYSQL_RES *mysql_resCtr;
MYSQL_RES *mysql_resDeg;
MYSQL_RES *mysql_resCrs;
MYSQL_ROW row;
unsigned NumCty;
unsigned NumCtys;
unsigned NumIns;
unsigned NumInss;
unsigned NumCtr;
unsigned NumCtrs;
unsigned NumDeg;
unsigned NumDegs;
unsigned NumCrs;
unsigned NumCrss;
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_My_courses, Box_BoxBegin (NULL,Txt_My_courses,
@ -184,237 +170,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("class=\"LIST_TREE\""); HTM_UL_Begin ("class=\"LIST_TREE\"");
/***** Write link to platform *****/ /***** Write nodes recursively *****/
Highlight = (Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0) ? Lay_HIGHLIGHT : Crs_WriteNodes (Hie,IsLastItemInLevel,Hie_SYS);
Lay_NO_HIGHLIGHT;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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],
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Ico_PutIcon ("sitemap.svg",Ico_BLACK,Txt_HIERARCHY_SINGUL_Abc[Hie_SYS],"ICO16x16");
HTM_TxtF ("&nbsp;%s",Txt_HIERARCHY_SINGUL_Abc[Hie_SYS]);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my countries *****/
NumCtys = Cty_DB_GetMyCtys (&mysql_resCty,-1L);
for (NumCty = 0;
NumCty < NumCtys;
NumCty++)
{
/***** Get next country *****/
row = mysql_fetch_row (mysql_resCty);
/***** Get data of this country *****/
Hie[Hie_CTY].HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Cty_GetBasicCountryDataByCod (&Hie[Hie_CTY]))
Err_WrongCountrExit ();
/***** Write link to country *****/
Highlight = (Gbl.Hierarchy.Node[Hie_INS].HieCod <= 0 &&
Gbl.Hierarchy.Node[Hie_CTY].HieCod == Hie[Hie_CTY].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Cty_DrawCountryMap (&Hie[Hie_CTY],"ICO16x16");
HTM_TxtF ("&nbsp;%s",Hie[Hie_CTY].FullName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my institutions in this country *****/
NumInss = Ins_DB_GetMyInss (&mysql_resIns,
Hie[Hie_CTY].HieCod);
for (NumIns = 0;
NumIns < NumInss;
NumIns++)
{
/***** Get next institution *****/
row = mysql_fetch_row (mysql_resIns);
/***** Get data of this institution *****/
Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ins_GetInstitDataByCod (&Hie[Hie_INS]))
Err_WrongInstitExit ();
/***** Write link to institution *****/
Highlight = (Gbl.Hierarchy.Node[Hie_CTR].HieCod <= 0 &&
Gbl.Hierarchy.Node[Hie_INS].HieCod == Hie[Hie_INS].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Lgo_DrawLogo (Hie_INS,
Hie[Hie_INS].HieCod,
Hie[Hie_INS].ShrtName,
"ICO16x16",NULL);
HTM_TxtF ("&nbsp;%s",Hie[Hie_INS].ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my centers in this institution *****/
NumCtrs = Ctr_DB_GetMyCtrs (&mysql_resCtr,Hie[Hie_INS].HieCod);
for (NumCtr = 0;
NumCtr < NumCtrs;
NumCtr++)
{
/***** Get next center *****/
row = mysql_fetch_row (mysql_resCtr);
/***** Get data of this center *****/
Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ctr_GetCenterDataByCod (&Hie[Hie_CTR]))
Err_WrongCenterExit ();
/***** Write link to center *****/
Highlight = (Gbl.Hierarchy.Level == Hie_CTR &&
Gbl.Hierarchy.Node[Hie_CTR].HieCod == Hie[Hie_CTR].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Lgo_DrawLogo (Hie_CTR,
Hie[Hie_CTR].HieCod,
Hie[Hie_CTR].ShrtName,
"ICO16x16",NULL);
HTM_TxtF ("&nbsp;%s",Hie[Hie_CTR].ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my degrees in this center *****/
NumDegs = Deg_DB_GetMyDegs (&mysql_resDeg,Hie[Hie_CTR].HieCod);
for (NumDeg = 0;
NumDeg < NumDegs;
NumDeg++)
{
/***** Get next degree *****/
row = mysql_fetch_row (mysql_resDeg);
/***** Get data of this degree *****/
Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Deg_GetDegreeDataByCod (&Hie[Hie_DEG]))
Err_WrongDegreeExit ();
/***** Write link to degree *****/
Highlight = (Gbl.Hierarchy.Level == Hie_DEG &&
Gbl.Hierarchy.Node[Hie_DEG].HieCod == Hie[Hie_DEG].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Lgo_DrawLogo (Hie_DEG,
Hie[Hie_DEG].HieCod,
Hie[Hie_DEG].ShrtName,
"ICO16x16",NULL);
HTM_TxtF ("&nbsp;%s",Hie[Hie_DEG].ShrtName);
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Get my courses in this degree *****/
NumCrss = Crs_DB_GetCrssFromUsr (&mysql_resCrs,
Gbl.Usrs.Me.UsrDat.UsrCod,
Hie[Hie_DEG].HieCod);
for (NumCrs = 0;
NumCrs < NumCrss;
NumCrs++)
{
/***** Get next course *****/
row = mysql_fetch_row (mysql_resCrs);
/***** Get data of this course *****/
Hie[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
Err_WrongCourseExit ();
/***** Write link to course *****/
Highlight = (Gbl.Hierarchy.Level == Hie_CRS &&
Gbl.Hierarchy.Node[Hie_CRS].HieCod == Hie[Hie_CRS].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[6] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
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),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Str_FreeGoToTitle ();
// Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,Hie[Hie_CRS].FullName,"ICO16x16");
Lgo_DrawLogo (Hie_CRS,
Hie[Hie_CRS].HieCod,
Hie[Hie_CRS].ShrtName,
"ICO16x16",NULL);
HTM_DIV_Begin ("class=\"MY_CRS_TXT\"");
HTM_TxtF ("&nbsp;%s",Hie[Hie_CRS].ShrtName);
HTM_DIV_End ();
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
/***** Put link to register students *****/
Enr_PutButtonInlineToRegisterStds (Hie[Hie_CRS].HieCod,
6,IsLastItemInLevel,
Highlight);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_resCrs);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_resDeg);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_resCtr);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_resIns);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_resCty);
/***** End list *****/ /***** End list *****/
HTM_UL_End (); HTM_UL_End ();
@ -423,6 +180,110 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Box_BoxEnd (); Box_BoxEnd ();
} }
static void Crs_WriteNodes (struct Hie_Node Hie[Hie_NUM_LEVELS],
Lay_LastItem_t IsLastItemInLevel[1 + 6],
Hie_Level_t Level)
{
extern unsigned (*Hie_GetMyNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
long PrtCod);
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
Lay_Highlight_t Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumNode;
unsigned NumNodes;
static bool (*GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node) =
{
[Hie_CTY] = Cty_GetBasicCountryDataByCod,
[Hie_INS] = Ins_GetInstitDataByCod,
[Hie_CTR] = Ctr_GetCenterDataByCod,
[Hie_DEG] = Deg_GetDegreeDataByCod,
[Hie_CRS] = Crs_GetCourseDataByCod,
};
if (Level > Hie_SYS)
NumNodes = Hie_GetMyNodesFromDB[Level] (&mysql_res,Hie[Level - 1].HieCod);
else
NumNodes = 1;
for (NumNode = 0;
NumNode < NumNodes;
NumNode++)
{
if (Level > Hie_SYS)
{
/***** Get next node *****/
row = mysql_fetch_row (mysql_res);
Hie[Level].HieCod = Str_ConvertStrCodToLongCod (row[0]);
/***** Get data of this node *****/
if (!GetDataByCod[Level] (&Hie[Level]))
Err_WrongCountrExit ();
}
else
{
Hie[Level].HieCod = -1L;
Str_Copy (Hie[Level].ShrtName,Txt_HIERARCHY_SINGUL_Abc[Level],
sizeof (Hie[Level].ShrtName) - 1);
}
/***** Write link to node *****/
if (Level < Hie_CRS)
Highlight = (Gbl.Hierarchy.Node[Level + 1].HieCod <= 0 &&
Gbl.Hierarchy.Node[Level].HieCod == Hie[Level].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
else
Highlight = (Gbl.Hierarchy.Node[Level].HieCod == Hie[Level].HieCod) ? Lay_HIGHLIGHT :
Lay_NO_HIGHLIGHT;
IsLastItemInLevel[Level] = (NumNode == NumNodes - 1) ? Lay_LAST_ITEM :
Lay_NO_LAST_ITEM;
Crs_WriteRowMyCourses (Level,Hie,Highlight,IsLastItemInLevel);
/***** Write subnodes recursively ******/
if (Level < Hie_CRS)
Crs_WriteNodes (Hie,IsLastItemInLevel,Level + 1);
}
if (Level > Hie_SYS)
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
}
static void Crs_WriteRowMyCourses (Hie_Level_t Level,
const struct Hie_Node Hie[Hie_NUM_LEVELS],
Lay_Highlight_t Highlight,
Lay_LastItem_t IsLastItemInLevel[1 + 6])
{
extern ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS];
extern const char *Lay_HighlightClass[Lay_NUM_HIGHLIGHT];
static Act_Action_t Actions[Hie_NUM_LEVELS] =
{
[Hie_SYS] = ActSeeSysInf,
[Hie_CTY] = ActSeeCtyInf,
[Hie_INS] = ActSeeInsInf,
[Hie_CTR] = ActSeeCtrInf,
[Hie_DEG] = ActSeeDegInf,
[Hie_CRS] = ActSeeCrsInf,
};
HTM_LI_Begin (Lay_HighlightClass[Highlight]);
Lay_IndentDependingOnLevel (Level,IsLastItemInLevel,
Lay_HORIZONTAL_LINE_AT_RIGHT);
Frm_BeginForm (ActMyCrs);
ParCod_PutPar (Hie_ParCod[Level],Hie[Level].HieCod);
HTM_BUTTON_Submit_Begin (Act_GetActionText (Actions[Level]),
"class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ());
Lgo_DrawLogo (Level,&Hie[Level],"ICO16x16");
HTM_DIV_Begin ("class=\"MY_CRS_TXT\"");
HTM_TxtF ("&nbsp;%s",Hie[Level].ShrtName);
HTM_DIV_End ();
HTM_BUTTON_End ();
Frm_EndForm ();
HTM_LI_End ();
}
/*****************************************************************************/ /*****************************************************************************/
/********************* Get number of courses with users **********************/ /********************* Get number of courses with users **********************/
/*****************************************************************************/ /*****************************************************************************/
@ -1363,37 +1224,37 @@ void Crs_RemoveCourse (void)
/********************* Get data of a course from its code ********************/ /********************* Get data of a course from its code ********************/
/*****************************************************************************/ /*****************************************************************************/
bool Crs_GetCourseDataByCod (struct Hie_Node *Crs) bool Crs_GetCourseDataByCod (struct Hie_Node *Node)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool CrsFound = false; bool Found = false;
/***** Clear data *****/ /***** Clear data *****/
Crs->PrtCod = -1L; Node->PrtCod = -1L;
Crs->Specific.Year = 0; Node->Specific.Year = 0;
Crs->Status = (Hie_Status_t) 0; Node->Status = (Hie_Status_t) 0;
Crs->RequesterUsrCod = -1L; Node->RequesterUsrCod = -1L;
Crs->ShrtName[0] = '\0'; Node->ShrtName[0] = '\0';
Crs->FullName[0] = '\0'; Node->FullName[0] = '\0';
/***** Check if course code is correct *****/ /***** Check if course code is correct *****/
if (Crs->HieCod > 0) if (Node->HieCod > 0)
{ {
/***** Get data of a course from database *****/ /***** Get data of a course from database *****/
if (Crs_DB_GetCourseDataByCod (&mysql_res,Crs->HieCod)) // Course found... if (Crs_DB_GetCourseDataByCod (&mysql_res,Node->HieCod)) // Course found...
{ {
/***** Get data of the course *****/ /***** Get data of the course *****/
Crs_GetCourseDataFromRow (mysql_res,Crs); Crs_GetCourseDataFromRow (mysql_res,Node);
/* Set return value */ /* Set return value */
CrsFound = true; Found = true;
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
return CrsFound; return Found;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1931,6 +1792,7 @@ static void Crs_PutIconToSearchCourses (__attribute__((unused)) void *Args)
void Crs_PutIconToSelectMyCoursesInBreadcrumb (void) void Crs_PutIconToSelectMyCoursesInBreadcrumb (void)
{ {
extern const char *Hie_Icons[Hie_NUM_LEVELS];
extern const char *Txt_My_courses; extern const char *Txt_My_courses;
if (Gbl.Usrs.Me.Logged) // I am logged if (Gbl.Usrs.Me.Logged) // I am logged
@ -1939,7 +1801,7 @@ void Crs_PutIconToSelectMyCoursesInBreadcrumb (void)
Frm_BeginForm (ActMyCrs); Frm_BeginForm (ActMyCrs);
/***** Put icon with link *****/ /***** Put icon with link *****/
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"sitemap.svg",Txt_My_courses, HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Hie_Icons[Hie_SYS],Txt_My_courses,
"class=\"BC_ICO BC_ICO_%s ICO_HIGHLIGHT\"", "class=\"BC_ICO BC_ICO_%s ICO_HIGHLIGHT\"",
The_GetSuffix ()); The_GetSuffix ());
@ -2176,8 +2038,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (row[2]), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (row[2]),
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
Lgo_DrawLogo (Hie_DEG,Deg.HieCod,Deg.ShrtName, Lgo_DrawLogo (Hie_DEG,&Deg,"CT ICO20x20");
"ICO20x20","CT");
HTM_TxtF ("&nbsp;%s&nbsp;(%s)",row[2],row[6]); HTM_TxtF ("&nbsp;%s&nbsp;(%s)",row[2],row[6]);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -235,10 +235,7 @@ static void CrsCfg_Degree (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
"class=\"LT BT_LINK\""); "class=\"LT BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
} }
Lgo_DrawLogo (Hie_DEG, Lgo_DrawLogo (Hie_DEG,&Gbl.Hierarchy.Node[Hie_DEG],"LM ICO20x20");
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
"ICO20x20","LM");
HTM_NBSP (); HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_DEG].FullName); HTM_Txt (Gbl.Hierarchy.Node[Hie_DEG].FullName);
if (ViewType == Vie_VIEW) if (ViewType == Vie_VIEW)

View File

@ -163,7 +163,7 @@ void Deg_SeeDegWithPendingCrss (void)
/* Degree logo and full name */ /* Degree logo and full name */
HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"", HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeCrs,"CM"); Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeCrs,"CM ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/* Number of pending courses (row[1]) */ /* Number of pending courses (row[1]) */
@ -191,7 +191,7 @@ void Deg_SeeDegWithPendingCrss (void)
/*****************************************************************************/ /*****************************************************************************/
void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action, void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action,
const char *ClassLogo) const char *IconClass)
{ {
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
@ -203,7 +203,7 @@ void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
/***** Degree logo and name *****/ /***** Degree logo and name *****/
Lgo_DrawLogo (Hie_DEG,Deg->HieCod,Deg->ShrtName,"ICO20x20",ClassLogo); Lgo_DrawLogo (Hie_DEG,Deg,IconClass);
HTM_TxtF ("&nbsp;%s",Deg->FullName); HTM_TxtF ("&nbsp;%s",Deg->FullName);
/***** End link *****/ /***** End link *****/
@ -375,7 +375,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
/* Degree logo */ /* Degree logo */
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg->FullName);
Lgo_DrawLogo (Hie_DEG,Deg->HieCod,Deg->ShrtName,"ICO20x20",NULL); Lgo_DrawLogo (Hie_DEG,Deg,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/* Degree short name and full name */ /* Degree short name and full name */
@ -499,6 +499,7 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
unsigned NumDegTyp; unsigned NumDegTyp;
struct DegTyp_DegreeType *DegTyp; struct DegTyp_DegreeType *DegTyp;
struct Hie_Node Deg;
const char *Names[Nam_NUM_SHRT_FULL_NAMES]; const char *Names[Nam_NUM_SHRT_FULL_NAMES];
/***** Set action depending on role *****/ /***** Set action depending on role *****/
@ -527,7 +528,9 @@ static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes)
/***** Degree logo *****/ /***** Degree logo *****/
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg_EditingDeg->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Deg_EditingDeg->FullName);
Lgo_DrawLogo (Hie_DEG,-1L,"","ICO20x20",NULL); Deg.HieCod = -1L;
Deg.ShrtName[0] = '\0';
Lgo_DrawLogo (Hie_DEG,&Deg,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/***** Degree short name and full name *****/ /***** Degree short name and full name *****/
@ -792,7 +795,7 @@ static void Deg_ListOneDegreeForSeeing (struct Hie_Node *Deg,unsigned NumDeg)
/***** Degree logo and name *****/ /***** Degree logo and name *****/
HTM_TD_Begin ("class=\"LM %s_%s %s\"", HTM_TD_Begin ("class=\"LM %s_%s %s\"",
TxtClassStrong,The_GetSuffix (),BgColor); TxtClassStrong,The_GetSuffix (),BgColor);
Deg_DrawDegreeLogoAndNameWithLink (Deg,ActSeeCrs,"CM"); Deg_DrawDegreeLogoAndNameWithLink (Deg,ActSeeCrs,"CM ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/***** Type of degree *****/ /***** Type of degree *****/
@ -1109,38 +1112,38 @@ void Deg_RemoveDegree (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns true if degree found // Returns true if degree found
bool Deg_GetDegreeDataByCod (struct Hie_Node *Deg) bool Deg_GetDegreeDataByCod (struct Hie_Node *Node)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool DegFound = false; bool Found = false;
/***** Clear data *****/ /***** Clear data *****/
Deg->PrtCod = -1L; Node->PrtCod = -1L;
Deg->Specific.TypCod = -1L; Node->Specific.TypCod = -1L;
Deg->Status = (Hie_Status_t) 0; Node->Status = (Hie_Status_t) 0;
Deg->RequesterUsrCod = -1L; Node->RequesterUsrCod = -1L;
Deg->ShrtName[0] = '\0'; Node->ShrtName[0] = '\0';
Deg->FullName[0] = '\0'; Node->FullName[0] = '\0';
Deg->WWW[0] = '\0'; Node->WWW[0] = '\0';
/***** Check if degree code is correct *****/ /***** Check if degree code is correct *****/
if (Deg->HieCod > 0) if (Node->HieCod > 0)
{ {
/***** Get data of a degree from database *****/ /***** Get data of a degree from database *****/
if (Deg_DB_GetDegreeDataByCod (&mysql_res,Deg->HieCod)) // Degree found... if (Deg_DB_GetDegreeDataByCod (&mysql_res,Node->HieCod)) // Degree found...
{ {
/***** Get data of degree *****/ /***** Get data of degree *****/
Deg_GetDegreeDataFromRow (mysql_res,Deg); Deg_GetDegreeDataFromRow (mysql_res,Node);
/* Set return value */ /* Set return value */
DegFound = true; Found = true;
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
return DegFound; return Found;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -50,7 +50,7 @@
void Deg_SeeDegWithPendingCrss (void); void Deg_SeeDegWithPendingCrss (void);
void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action, void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action,
const char *ClassLogo); const char *IconClass);
void Deg_WriteSelectorOfDegree (void); void Deg_WriteSelectorOfDegree (void);
@ -70,7 +70,7 @@ void Deg_ReceiveFormReqDeg (void);
void Deg_ReceiveFormNewDeg (void); void Deg_ReceiveFormNewDeg (void);
void Deg_RemoveDegree (void); void Deg_RemoveDegree (void);
bool Deg_GetDegreeDataByCod (struct Hie_Node *Deg); bool Deg_GetDegreeDataByCod (struct Hie_Node *Node);
void Deg_RemoveDegreeCompletely (long DegCod); void Deg_RemoveDegreeCompletely (long DegCod);
void Deg_RenameDegreeShort (void); void Deg_RenameDegreeShort (void);
void Deg_RenameDegreeFull (void); void Deg_RenameDegreeFull (void);

View File

@ -229,10 +229,7 @@ static void DegCfg_Center (Vie_ViewType_t ViewType,Frm_PutForm_t PutForm)
"class=\"LB BT_LINK\""); "class=\"LB BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
} }
Lgo_DrawLogo (Hie_CTR, Lgo_DrawLogo (Hie_CTR,&Gbl.Hierarchy.Node[Hie_CTR],"LM ICO20x20");
Gbl.Hierarchy.Node[Hie_CTR].HieCod,
Gbl.Hierarchy.Node[Hie_CTR].ShrtName,
"ICO20x20","LM");
HTM_NBSP (); HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].FullName); HTM_Txt (Gbl.Hierarchy.Node[Hie_CTR].FullName);
if (ViewType == Vie_VIEW) if (ViewType == Vie_VIEW)

View File

@ -79,10 +79,12 @@ void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod)
void Enr_DB_CreateTmpTableMyCourses (void) void Enr_DB_CreateTmpTableMyCourses (void)
{ {
DB_CreateTmpTable ("CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp" DB_CreateTmpTable ("CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp"
" (CrsCod INT NOT NULL," "(CrsInd INT NOT NULL AUTO_INCREMENT,"
"Role TINYINT NOT NULL," "CrsCod INT NOT NULL,"
"DegCod INT NOT NULL," "Role TINYINT NOT NULL,"
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY" "DegCod INT NOT NULL,"
"UNIQUE INDEX(CrsInd),"
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
" SELECT crs_users.CrsCod," " SELECT crs_users.CrsCod,"
"crs_users.Role," "crs_users.Role,"
"crs_courses.DegCod" "crs_courses.DegCod"
@ -101,15 +103,26 @@ void Enr_DB_CreateTmpTableMyCourses (void)
/************************* Get my courses from database **********************/ /************************* Get my courses from database **********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res, unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res,long PrtCod)
__attribute__((unused)) long PrtCod)
{ {
return (unsigned) if (PrtCod > 0)
DB_QuerySELECT (mysql_res,"can not get which courses you belong to", return (unsigned)
"SELECT CrsCod," // row[0] DB_QuerySELECT (mysql_res,"can not get which courses you belong to",
"Role," // row[1] "SELECT CrsCod," // row[0]
"DegCod" // row[2] "Role," // row[1]
" FROM my_courses_tmp"); "DegCod" // row[2]
" FROM my_courses_tmp"
" WHERE DegCod=%ld"
" ORDER BY CrsInd",
PrtCod);
else
return (unsigned)
DB_QuerySELECT (mysql_res,"can not get which courses you belong to",
"SELECT CrsCod," // row[0]
"Role," // row[1]
"DegCod" // row[2]
" FROM my_courses_tmp"
" ORDER BY CrsInd");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -40,8 +40,7 @@ void Enr_DB_InsertUsrInCurrentCrs (long UsrCod,long CrsCod,Rol_Role_t NewRole,
void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod); void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod);
void Enr_DB_CreateTmpTableMyCourses (void); void Enr_DB_CreateTmpTableMyCourses (void);
unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res, unsigned Enr_DB_GetMyCrss (MYSQL_RES **mysql_res,long PrtCod);
__attribute__((unused)) long PrtCod);
void Enr_DB_DropTmpTableMyCourses (void); void Enr_DB_DropTmpTableMyCourses (void);
unsigned Enr_DB_GetMyCoursesNames (MYSQL_RES **mysql_res); unsigned Enr_DB_GetMyCoursesNames (MYSQL_RES **mysql_res);

View File

@ -1730,6 +1730,22 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
unsigned NumThrs; unsigned NumThrs;
unsigned NumThrsWithNewPosts; unsigned NumThrsWithNewPosts;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]; char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
Hie_Level_t Levels[For_NUM_TYPES_FORUM] =
{
[For_FORUM_GLOBAL_USRS] = Hie_SYS,
[For_FORUM_GLOBAL_TCHS] = Hie_SYS,
[For_FORUM__SWAD__USRS] = Hie_SYS,
[For_FORUM__SWAD__TCHS] = Hie_SYS,
[For_FORUM_INSTIT_USRS] = Hie_INS,
[For_FORUM_INSTIT_TCHS] = Hie_INS,
[For_FORUM_CENTER_USRS] = Hie_CTR,
[For_FORUM_CENTER_TCHS] = Hie_CTR,
[For_FORUM_DEGREE_USRS] = Hie_DEG,
[For_FORUM_DEGREE_TCHS] = Hie_DEG,
[For_FORUM_COURSE_USRS] = Hie_CRS,
[For_FORUM_COURSE_TCHS] = Hie_CRS,
};
struct Hie_Node Node;
/***** Get number of threads and number of posts *****/ /***** Get number of threads and number of posts *****/
NumThrs = For_DB_GetNumThrsInForum (Forum); NumThrs = For_DB_GetNumThrsInForum (Forum);
@ -1786,27 +1802,25 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
{ {
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_USRS:
case For_FORUM_GLOBAL_TCHS: case For_FORUM_GLOBAL_TCHS:
Ico_PutIcon ("comments.svg",Ico_BLACK,ForumName,"ICO16x16"); Ico_PutIcon ("comments.svg",Ico_BLACK,ForumName,
"ICO16x16");
break; break;
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
case For_FORUM__SWAD__TCHS: case For_FORUM__SWAD__TCHS:
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,ForumName,"ICO16x16"); Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,ForumName,
"ICO16x16");
break; break;
case For_FORUM_INSTIT_USRS: case For_FORUM_INSTIT_USRS:
case For_FORUM_INSTIT_TCHS: case For_FORUM_INSTIT_TCHS:
Lgo_DrawLogo (Hie_INS,Forum->HieCod,ForumName,"ICO16x16",NULL);
break;
case For_FORUM_CENTER_USRS: case For_FORUM_CENTER_USRS:
case For_FORUM_CENTER_TCHS: case For_FORUM_CENTER_TCHS:
Lgo_DrawLogo (Hie_CTR,Forum->HieCod,ForumName,"ICO16x16",NULL);
break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS: case For_FORUM_DEGREE_TCHS:
Lgo_DrawLogo (Hie_DEG,Forum->HieCod,ForumName,"ICO16x16",NULL);
break;
case For_FORUM_COURSE_USRS: case For_FORUM_COURSE_USRS:
case For_FORUM_COURSE_TCHS: case For_FORUM_COURSE_TCHS:
Ico_PutIcon ("chalkboard-teacher.svg",Ico_BLACK,ForumName,"ICO16x16"); Node.HieCod = Forum->HieCod;
Str_Copy (Node.ShrtName,ForumName,sizeof (Node.ShrtName) - 1);
Lgo_DrawLogo (Levels[Forum->Type],&Node,"ICO16x16");
break; break;
default: default:
break; break;

View File

@ -58,7 +58,7 @@
extern struct Globals Gbl; extern struct Globals Gbl;
/*****************************************************************************/ /*****************************************************************************/
/**************************** Public constants ******************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS] = ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS] =
@ -70,6 +70,26 @@ ParCod_Param_t Hie_ParCod[Hie_NUM_LEVELS] =
[Hie_CRS] = ParCod_Crs, [Hie_CRS] = ParCod_Crs,
}; };
const char *Hie_Icons[Hie_NUM_LEVELS] =
{
[Hie_SYS] = "sitemap.svg",
[Hie_CTY] = "globe-americas.svg",
[Hie_INS] = "university.svg",
[Hie_CTR] = "building.svg",
[Hie_DEG] = "graduation-cap.svg",
[Hie_CRS] = "chalkboard-teacher.svg",
};
unsigned (*Hie_GetMyNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
long PrtCod) =
{
[Hie_CTY] = Cty_DB_GetMyCtys,
[Hie_INS] = Ins_DB_GetMyInss,
[Hie_CTR] = Ctr_DB_GetMyCtrs,
[Hie_DEG] = Deg_DB_GetMyDegs,
[Hie_CRS] = Enr_DB_GetMyCrss,
};
/*****************************************************************************/ /*****************************************************************************/
/**************************** Private constants ******************************/ /**************************** Private constants ******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -427,38 +447,9 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
static void Hie_DrawLogo (void) static void Hie_DrawLogo (void)
{ {
static Hie_Level_t LogoScope[Hie_NUM_LEVELS] =
{
[Hie_INS] = Hie_INS,
[Hie_CTR] = Hie_CTR,
[Hie_DEG] = Hie_DEG,
[Hie_CRS] = Hie_DEG, // Draw logo of degree
};
static const long *LogoCode[Hie_NUM_LEVELS] =
{
[Hie_INS] = &Gbl.Hierarchy.Node[Hie_INS].HieCod,
[Hie_CTR] = &Gbl.Hierarchy.Node[Hie_CTR].HieCod,
[Hie_DEG] = &Gbl.Hierarchy.Node[Hie_DEG].HieCod,
[Hie_CRS] = &Gbl.Hierarchy.Node[Hie_DEG].HieCod, // Degree code
};
/***** Logo *****/ /***** Logo *****/
switch (Gbl.Hierarchy.Level) Lgo_DrawLogo (Gbl.Hierarchy.Level,&Gbl.Hierarchy.Node[Gbl.Hierarchy.Level],
{ "TOP_LOGO ICO40x40");
case Hie_SYS: // System
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,"TOP_LOGO");
break;
case Hie_CTY: // Country
Cty_DrawCountryMap (&Gbl.Hierarchy.Node[Hie_CTY],"TOP_LOGO");
break;
default:
Lgo_DrawLogo (LogoScope[Gbl.Hierarchy.Level],
*LogoCode[Gbl.Hierarchy.Level],
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,
"ICO40x40","TOP_LOGO");
break;
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -650,7 +641,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
Ins_GetInstitDataByCod (&Hie[Hie_INS]); Ins_GetInstitDataByCod (&Hie[Hie_INS]);
/* Write institution logo and name */ /* Write institution logo and name */
Ins_DrawInstitLogoAndNameWithLink (&Hie[Hie_INS],ActSeeInsInf,"LT"); Ins_DrawInstitLogoAndNameWithLink (&Hie[Hie_INS],ActSeeInsInf,"LT ICO16x16");
} }
break; break;
case Hie_CTR: // Center case Hie_CTR: // Center
@ -660,7 +651,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]); Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
/* Write center logo and name */ /* Write center logo and name */
Ctr_DrawCenterLogoAndNameWithLink (&Hie[Hie_CTR],ActSeeCtrInf,"LT"); Ctr_DrawCenterLogoAndNameWithLink (&Hie[Hie_CTR],ActSeeCtrInf,"LT ICO16x16");
} }
break; break;
case Hie_DEG: // Degree case Hie_DEG: // Degree
@ -670,7 +661,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]); Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
/* Write degree logo and name */ /* Write degree logo and name */
Deg_DrawDegreeLogoAndNameWithLink (&Hie[Hie_DEG],ActSeeDegInf,"LT"); Deg_DrawDegreeLogoAndNameWithLink (&Hie[Hie_DEG],ActSeeDegInf,"LT ICO20x20");
} }
break; break;
default: // There are no administrators in other scopes default: // There are no administrators in other scopes
@ -930,15 +921,6 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
unsigned NumNode; unsigned NumNode;
unsigned NumNodes; unsigned NumNodes;
long HieCod; long HieCod;
static unsigned (*GetNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
long PrtCod) =
{
[Hie_CTY] = Cty_DB_GetMyCtys,
[Hie_INS] = Ins_DB_GetMyInss,
[Hie_CTR] = Ctr_DB_GetMyCtrs,
[Hie_DEG] = Deg_DB_GetMyDegs,
[Hie_CRS] = Enr_DB_GetMyCrss,
};
/***** Trivial check 1: if list of nodes is already filled, there's nothing to do *****/ /***** Trivial check 1: if list of nodes is already filled, there's nothing to do *****/
if (Gbl.Usrs.Me.Hierarchy[Level].Filled) if (Gbl.Usrs.Me.Hierarchy[Level].Filled)
@ -960,7 +942,7 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL; Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
/***** Get my courses/degrees/centers/institutions/countries from database *****/ /***** Get my courses/degrees/centers/institutions/countries from database *****/
if ((NumNodes = GetNodesFromDB[Level] (&mysql_res,-1L))) if ((NumNodes = Hie_GetMyNodesFromDB[Level] (&mysql_res,-1L)))
{ {
if ((Gbl.Usrs.Me.Hierarchy[Level].Nodes = malloc (NumNodes * if ((Gbl.Usrs.Me.Hierarchy[Level].Nodes = malloc (NumNodes *
sizeof (*Gbl.Usrs.Me.Hierarchy[Level].Nodes))) == NULL) sizeof (*Gbl.Usrs.Me.Hierarchy[Level].Nodes))) == NULL)
@ -982,7 +964,7 @@ void Hie_GetMyHierarchy (Hie_Level_t Level)
/* Get parent hierarchy code */ /* Get parent hierarchy code */
if (Level == Hie_CRS) if (Level == Hie_CRS)
Gbl.Usrs.Me.Hierarchy[Level].Nodes[Gbl.Usrs.Me.Hierarchy[Level].Num].PrtCod = Str_ConvertStrCodToLongCod (row[2]); Gbl.Usrs.Me.Hierarchy[Level].Nodes[Gbl.Usrs.Me.Hierarchy[Level].Num].PrtCod = Str_ConvertStrCodToLongCod (row[2]);
Gbl.Usrs.Me.Hierarchy[Level].Num++; Gbl.Usrs.Me.Hierarchy[Level].Num++;
} }
@ -1113,14 +1095,6 @@ void Hie_GetAndShowHierarchyStats (void)
static void Hie_WriteHeadHierarchy (void) static void Hie_WriteHeadHierarchy (void)
{ {
extern const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS]; extern const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS];
static const char *Icons[Hie_NUM_LEVELS] =
{
[Hie_CTY] = "globe-americas.svg",
[Hie_INS] = "university.svg",
[Hie_CTR] = "building.svg",
[Hie_DEG] = "graduation-cap.svg",
[Hie_CRS] = "chalkboard-teacher.svg",
};
Hie_Level_t Level; Hie_Level_t Level;
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -1132,7 +1106,8 @@ static void Hie_WriteHeadHierarchy (void)
Level++) Level++)
{ {
HTM_TH_Begin (HTM_HEAD_RIGHT); HTM_TH_Begin (HTM_HEAD_RIGHT);
Ico_PutIcon (Icons[Level],Ico_BLACK,Txt_HIERARCHY_PLURAL_Abc[Level],"ICOx16"); Ico_PutIcon (Hie_Icons[Level],Ico_BLACK,
Txt_HIERARCHY_PLURAL_Abc[Level],"ICOx16");
HTM_BR (); HTM_BR ();
HTM_Txt (Txt_HIERARCHY_PLURAL_Abc[Level]); HTM_Txt (Txt_HIERARCHY_PLURAL_Abc[Level]);
HTM_TH_End (); HTM_TH_End ();

View File

@ -67,10 +67,7 @@ void HieCfg_Title (Hie_PutLink_t PutLink,Hie_Level_t Level)
The_GetSuffix ()); The_GetSuffix ());
/* Logo and name */ /* Logo and name */
Lgo_DrawLogo (LevelLogo, Lgo_DrawLogo (LevelLogo,&Gbl.Hierarchy.Node[LevelLogo],"ICO64x64");
Gbl.Hierarchy.Node[LevelLogo].HieCod,
Gbl.Hierarchy.Node[LevelLogo].ShrtName,
"ICO64x64",NULL);
HTM_BR (); HTM_BR ();
HTM_Txt (Gbl.Hierarchy.Node[Level].FullName); HTM_Txt (Gbl.Hierarchy.Node[Level].FullName);

View File

@ -180,7 +180,7 @@ void Ins_SeeInsWithPendingCtrs (void)
HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"", HTM_TD_Begin ("class=\"LM DAT_%s NOWRAP %s\"",
The_GetSuffix (),BgColor); The_GetSuffix (),BgColor);
Ins_DrawInstitLogoAndNameWithLink (&Ins,ActSeeCtr,"CM"); Ins_DrawInstitLogoAndNameWithLink (&Ins,ActSeeCtr,"CM ICO16x16");
HTM_TD_End (); HTM_TD_End ();
/* Number of pending centers (row[1]) */ /* Number of pending centers (row[1]) */
@ -217,7 +217,7 @@ void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,const char *IconClass
ParCod_PutPar (ParCod_Ins,Ins->HieCod); ParCod_PutPar (ParCod_Ins,Ins->HieCod);
HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\""); HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\"");
} }
Lgo_DrawLogo (Hie_INS,Ins->HieCod,Ins->FullName,IconClass,NULL); Lgo_DrawLogo (Hie_INS,Ins,IconClass);
if (PutLink == Hie_PUT_LINK) if (PutLink == Hie_PUT_LINK)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -230,7 +230,7 @@ void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,const char *IconClass
/*****************************************************************************/ /*****************************************************************************/
void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action, void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action,
const char *ClassLogo) const char *IconClass)
{ {
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormGoTo (Action); Frm_BeginFormGoTo (Action);
@ -242,7 +242,7 @@ void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
/***** Institution logo and name *****/ /***** Institution logo and name *****/
Lgo_DrawLogo (Hie_INS,Ins->HieCod,Ins->ShrtName,"ICO16x16",ClassLogo); Lgo_DrawLogo (Hie_INS,Ins,IconClass);
HTM_TxtF ("&nbsp;%s",Ins->FullName); HTM_TxtF ("&nbsp;%s",Ins->FullName);
/***** End link *****/ /***** End link *****/
@ -381,7 +381,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Hie_Node *Ins,unsigned NumIn
/***** Institution logo and name *****/ /***** Institution logo and name *****/
HTM_TD_Begin ("class=\"LM %s_%s %s\"", HTM_TD_Begin ("class=\"LM %s_%s %s\"",
TxtClassStrong,The_GetSuffix (),BgColor); TxtClassStrong,The_GetSuffix (),BgColor);
Ins_DrawInstitLogoAndNameWithLink (Ins,ActSeeCtr,"CM"); Ins_DrawInstitLogoAndNameWithLink (Ins,ActSeeCtr,"CM ICO16x16");
HTM_TD_End (); HTM_TD_End ();
/***** Number of users who claim to belong to this institution *****/ /***** Number of users who claim to belong to this institution *****/
@ -648,39 +648,39 @@ void Ins_WriteInstitutionNameAndCty (long InsCod)
/************************* Get data of an institution ************************/ /************************* Get data of an institution ************************/
/*****************************************************************************/ /*****************************************************************************/
bool Ins_GetInstitDataByCod (struct Hie_Node *Ins) bool Ins_GetInstitDataByCod (struct Hie_Node *Node)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool InsFound = false; bool Found = false;
/***** Clear data *****/ /***** Clear data *****/
Ins->PrtCod = -1L; Node->PrtCod = -1L;
Ins->Status = (Hie_Status_t) 0; Node->Status = (Hie_Status_t) 0;
Ins->RequesterUsrCod = -1L; Node->RequesterUsrCod = -1L;
Ins->ShrtName[0] = Node->ShrtName[0] =
Ins->FullName[0] = Node->FullName[0] =
Ins->WWW[0] = '\0'; Node->WWW[0] = '\0';
Ins->NumUsrsWhoClaimToBelong.Valid = false; Node->NumUsrsWhoClaimToBelong.Valid = false;
/***** Check if institution code is correct *****/ /***** Check if institution code is correct *****/
if (Ins->HieCod > 0) if (Node->HieCod > 0)
{ {
/***** Get data of an institution from database *****/ /***** Get data of an institution from database *****/
if (Ins_DB_GetInsDataByCod (&mysql_res,Ins->HieCod)) // Institution found... if (Ins_DB_GetInsDataByCod (&mysql_res,Node->HieCod)) // Institution found...
{ {
/* Get institution data */ /* Get institution data */
Ins_GetInstitDataFromRow (mysql_res,Ins, Ins_GetInstitDataFromRow (mysql_res,Node,
false); // Don't get number of users who claim to belong to this institution false); // Don't get number of users who claim to belong to this institution
/* Set return value */ /* Set return value */
InsFound = true; Found = true;
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
return InsFound; return Found;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -936,7 +936,7 @@ static void Ins_ListInstitutionsForEdition (void)
/* Institution logo */ /* Institution logo */
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins->FullName);
Lgo_DrawLogo (Hie_INS,Ins->HieCod,Ins->ShrtName,"ICO20x20",NULL); Lgo_DrawLogo (Hie_INS,Ins,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/* Institution short name and full name */ /* Institution short name and full name */
@ -1317,6 +1317,7 @@ static void Ins_PutFormToCreateInstitution (void)
{ {
Act_Action_t NextAction = ActUnk; Act_Action_t NextAction = ActUnk;
const char *Names[Nam_NUM_SHRT_FULL_NAMES]; const char *Names[Nam_NUM_SHRT_FULL_NAMES];
struct Hie_Node Node;
/***** Set action depending on role *****/ /***** Set action depending on role *****/
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
@ -1344,7 +1345,9 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Institution logo *****/ /***** Institution logo *****/
HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins_EditingIns->FullName); HTM_TD_Begin ("title=\"%s\" class=\"HIE_LOGO\"",Ins_EditingIns->FullName);
Lgo_DrawLogo (Hie_INS,-1L,"","ICO20x20",NULL); Node.HieCod = -1L;
Node.ShrtName[0] = '\0';
Lgo_DrawLogo (Hie_INS,&Node,"ICO20x20");
HTM_TD_End (); HTM_TD_End ();
/***** Institution short name and full name *****/ /***** Institution short name and full name *****/
@ -1867,8 +1870,8 @@ static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
/***** Draw institutions as a list *****/ /***** Draw institutions as a list *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Empty (1); HTM_TH_Empty (1);
HTM_TH (Txt_HIERARCHY_SINGUL_Abc[Hie_INS],HTM_HEAD_LEFT); HTM_TH (Txt_HIERARCHY_SINGUL_Abc[Hie_INS],HTM_HEAD_LEFT );
HTM_TH (TxtFigure ,HTM_HEAD_RIGHT); HTM_TH (TxtFigure ,HTM_HEAD_RIGHT);
HTM_TR_End (); HTM_TR_End ();
for (NumIns = 1, NumOrder = 1, NumberLastRow = 0; for (NumIns = 1, NumOrder = 1, NumberLastRow = 0;
@ -1895,8 +1898,7 @@ static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
"class=\"LM BT_LINK\""); "class=\"LM BT_LINK\"");
if (Gbl.Usrs.Listing.WithPhotos) if (Gbl.Usrs.Listing.WithPhotos)
{ {
Lgo_DrawLogo (Hie_INS,Ins.HieCod,Ins.ShrtName, Lgo_DrawLogo (Hie_INS,&Ins,"ICO40x40");
"ICO40x40",NULL);
HTM_NBSP (); HTM_NBSP ();
} }
HTM_Txt (Ins.FullName); HTM_Txt (Ins.FullName);

View File

@ -41,7 +41,7 @@ void Ins_SeeInsWithPendingCtrs (void);
void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,const char *IconClass); void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,const char *IconClass);
void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action, void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action,
const char *ClassLogo); const char *IconClass);
void Ins_ShowInssOfCurrentCty (void); void Ins_ShowInssOfCurrentCty (void);
void Ins_EditInstitutions (void); void Ins_EditInstitutions (void);
@ -49,7 +49,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod);
void Ins_GetFullListOfInstitutions (long CtyCod); void Ins_GetFullListOfInstitutions (long CtyCod);
void Ins_WriteInstitutionNameAndCty (long InsCod); void Ins_WriteInstitutionNameAndCty (long InsCod);
bool Ins_GetInstitDataByCod (struct Hie_Node *Ins); bool Ins_GetInstitDataByCod (struct Hie_Node *Node);
void Ins_FlushCacheFullNameAndCtyOfInstitution (void); void Ins_FlushCacheFullNameAndCtyOfInstitution (void);
void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins, void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
char CtyName[Nam_MAX_BYTES_FULL_NAME + 1]); char CtyName[Nam_MAX_BYTES_FULL_NAME + 1]);

View File

@ -1518,8 +1518,7 @@ void Lay_WriteHeaderClassPhoto (Vie_ViewType_t ViewType)
{ {
if (ViewType == Vie_VIEW) if (ViewType == Vie_VIEW)
HTM_A_Begin ("href=\"%s\" target=\"_blank\"",Hie[Hie_INS].WWW); HTM_A_Begin ("href=\"%s\" target=\"_blank\"",Hie[Hie_INS].WWW);
Lgo_DrawLogo (Hie_INS,Hie[Hie_INS].HieCod,Hie[Hie_INS].ShrtName, Lgo_DrawLogo (Hie_INS,&Hie[Hie_INS],"ICO40x40");
"ICO40x40",NULL);
if (ViewType == Vie_VIEW) if (ViewType == Vie_VIEW)
HTM_A_End (); HTM_A_End ();
} }
@ -1570,8 +1569,7 @@ void Lay_WriteHeaderClassPhoto (Vie_ViewType_t ViewType)
HTM_A_Begin ("href=\"%s\" target=\"_blank\"" HTM_A_Begin ("href=\"%s\" target=\"_blank\""
" class=\"CLASSPHOTO_TITLE CLASSPHOTO_%s\"", " class=\"CLASSPHOTO_TITLE CLASSPHOTO_%s\"",
Hie[Hie_DEG].WWW,The_GetSuffix ()); Hie[Hie_DEG].WWW,The_GetSuffix ());
Lgo_DrawLogo (Hie_DEG,Hie[Hie_DEG].HieCod,Hie[Hie_DEG].ShrtName, Lgo_DrawLogo (Hie_DEG,&Hie[Hie_DEG],"ICO40x40");
"ICO40x40",NULL);
if (ViewType == Vie_VIEW) if (ViewType == Vie_VIEW)
HTM_A_End (); HTM_A_End ();
} }
@ -1644,7 +1642,7 @@ void Lay_IndentDependingOnLevel (unsigned Level,
if (Level <= 1) if (Level <= 1)
return; return;
/***** Indent (from 1 to Level-1) *****/ /***** Indent (from 2 to Level-1) *****/
for (L = 2; for (L = 2;
L < Level; L < Level;
L++) L++)

View File

@ -74,120 +74,118 @@ static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem);
/***************** Draw institution, center or degree logo *******************/ /***************** Draw institution, center or degree logo *******************/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_DrawLogo (Hie_Level_t Level,long HieCod,const char *AltText, void Lgo_DrawLogo (Hie_Level_t Level,const struct Hie_Node *Node,
const char *IconClass,const char *Class) const char *IconClass)
{ {
static const char *HieIcon[Hie_NUM_LEVELS] = extern const char *Hie_Icons[Hie_NUM_LEVELS];
{
[Hie_INS] = "university.svg",
[Hie_CTR] = "building.svg",
[Hie_DEG] = "graduation-cap.svg",
[Hie_CRS] = "chalkboard-teacher.svg",
};
const char *Folder = NULL; // To avoid warning const char *Folder = NULL; // To avoid warning
char PathLogo[PATH_MAX + 1]; char PathLogo[PATH_MAX + 1];
bool LogoFound = false; bool LogoFound = false;
long InsCod = HieCod; long HieCod;
long CtrCod = HieCod; long InsCod;
long DegCod = HieCod; long CtrCod;
long CrsCod = HieCod; long DegCod;
long CrsCod;
char *URL; char *URL;
char *Icon; char *Icon;
bool ClassNotEmpty;
/***** Path to logo *****/ switch (Level)
if (HieIcon[Level]) // Scope is correct
{ {
if (HieCod > 0) // Institution, center or degree exists case Hie_SYS:
{ Ico_PutIcon (Hie_Icons[Hie_SYS],Ico_BLACK,Node->ShrtName,IconClass);
/* Course */ break;
case Hie_CTY:
/* Degree */ Cty_DrawCountryMap (Node,IconClass);
if (!LogoFound && Level >= Hie_DEG) break;
case Hie_INS:
case Hie_CTR:
case Hie_DEG:
case Hie_CRS:
if (Node->HieCod > 0) // Institution, center, degree or course exists
{ {
Folder = Cfg_FOLDER_DEG; HieCod =
if (Level >= Hie_CRS) InsCod =
DegCod = Crs_DB_GetDegCodOfCourseByCod (CrsCod); CtrCod =
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png", DegCod =
Cfg_PATH_DEG_PUBLIC, CrsCod = Node->HieCod;
(unsigned) (DegCod % 100),
(unsigned) DegCod, /* Course */
(unsigned) DegCod);
LogoFound = Fil_CheckIfPathExists (PathLogo); /* Degree */
if (!LogoFound && Level >= Hie_DEG)
{
Folder = Cfg_FOLDER_DEG;
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),
(unsigned) DegCod,
(unsigned) DegCod);
LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound)
HieCod = DegCod;
}
/* Center */
if (!LogoFound && Level >= Hie_CTR)
{
Folder = Cfg_FOLDER_CTR;
if (Level >= Hie_DEG)
CtrCod = Deg_DB_GetCtrCodOfDegreeByCod (DegCod);
else
CtrCod = HieCod;
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_CTR_PUBLIC,
(unsigned) (CtrCod % 100),
(unsigned) CtrCod,
(unsigned) CtrCod);
LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound)
HieCod = CtrCod;
}
/* Institution */
if (!LogoFound)
{
Folder = Cfg_FOLDER_INS;
if (Level >= Hie_CTR)
InsCod = Ctr_DB_GetInsCodOfCenterByCod (CtrCod);
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_INS_PUBLIC,
(unsigned) (InsCod % 100),
(unsigned) InsCod,
(unsigned) InsCod);
LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound)
HieCod = InsCod;
}
/***** Draw logo *****/
if (LogoFound) if (LogoFound)
HieCod = DegCod; {
} if (asprintf (&URL,"%s/%s/%02u/%u/logo",
Cfg_URL_SWAD_PUBLIC,Folder,
(unsigned) (HieCod % 100),
(unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%u.png",(unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit ();
/* Center */ HTM_IMG (URL,Icon,Node->FullName,
if (!LogoFound && Level >= Hie_CTR) "class=\"%s\"",IconClass);
{ free (Icon);
Folder = Cfg_FOLDER_CTR; free (URL);
if (Level >= Hie_DEG) }
CtrCod = Deg_DB_GetCtrCodOfDegreeByCod (DegCod);
else else
CtrCod = HieCod; HTM_IMG (Cfg_URL_ICON_PUBLIC,Hie_Icons[Level],Node->ShrtName,
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png", "class=\"%s ICO_%s_%s\"",
Cfg_PATH_CTR_PUBLIC, IconClass,
(unsigned) (CtrCod % 100), Ico_GetPreffix (Ico_BLACK),The_GetSuffix ());
(unsigned) CtrCod,
(unsigned) CtrCod);
LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound)
HieCod = CtrCod;
} }
break;
/* Institution */ default:
if (!LogoFound) break;
{
Folder = Cfg_FOLDER_INS;
if (Level >= Hie_CTR)
InsCod = Ctr_DB_GetInsCodOfCenterByCod (CtrCod);
snprintf (PathLogo,sizeof (PathLogo),"%s/%02u/%u/logo/%u.png",
Cfg_PATH_INS_PUBLIC,
(unsigned) (InsCod % 100),
(unsigned) InsCod,
(unsigned) InsCod);
LogoFound = Fil_CheckIfPathExists (PathLogo);
if (LogoFound)
HieCod = InsCod;
}
/***** Draw logo *****/
ClassNotEmpty = false;
if (Class)
if (Class[0])
ClassNotEmpty = true;
if (LogoFound)
{
if (asprintf (&URL,"%s/%s/%02u/%u/logo",
Cfg_URL_SWAD_PUBLIC,Folder,
(unsigned) (HieCod % 100),
(unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%u.png",(unsigned) HieCod) < 0)
Err_NotEnoughMemoryExit ();
HTM_IMG (URL,Icon,AltText,
"class=\"%s%s%s\"",
IconClass,
ClassNotEmpty ? " " :
"",
ClassNotEmpty ? Class :
"");
free (Icon);
free (URL);
}
else
HTM_IMG (Cfg_URL_ICON_PUBLIC,HieIcon[Level],AltText,
"class=\"%s ICO_%s_%s%s%s\"",
IconClass,
Ico_GetPreffix (Ico_BLACK),The_GetSuffix (),
ClassNotEmpty ? " " :
"",
ClassNotEmpty ? Class :
"");
}
} }
} }

View File

@ -27,8 +27,8 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Lgo_DrawLogo (Hie_Level_t Level,long HieCod,const char *AltText, void Lgo_DrawLogo (Hie_Level_t Level,const struct Hie_Node *Node,
const char *IconClass,const char *Class); const char *IconClass);
void Lgo_PutIconToChangeLogo (Hie_Level_t Level); void Lgo_PutIconToChangeLogo (Hie_Level_t Level);
void Lgo_RequestLogo (Hie_Level_t Level); void Lgo_RequestLogo (Hie_Level_t Level);
void Lgo_ReceiveLogo (Hie_Level_t Level); void Lgo_ReceiveLogo (Hie_Level_t Level);

View File

@ -330,7 +330,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
{ {
case Not_LIST_BRIEF_NOTICES: case Not_LIST_BRIEF_NOTICES:
/***** Get notices from database *****/ /***** Get notices from database *****/
NumNotices = Not_DB_GetActiveNotices (&mysql_res,Gbl.Hierarchy.Node[Hie_CRS].HieCod); NumNotices = Not_DB_GetActiveNotices (&mysql_res,
Gbl.Hierarchy.Node[Hie_CRS].HieCod);
break; break;
case Not_LIST_FULL_NOTICES: case Not_LIST_FULL_NOTICES:
/***** Get notices from database *****/ /***** Get notices from database *****/

View File

@ -2259,11 +2259,10 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
if (SeeOrPrint == Pho_DEGREES_SEE) if (SeeOrPrint == Pho_DEGREES_SEE)
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,"CT"); Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,"CT ICO20x20");
else // Pho_DEGREES_PRINT else // Pho_DEGREES_PRINT
{ {
Lgo_DrawLogo (Hie_DEG,Deg.HieCod,Deg.ShrtName, Lgo_DrawLogo (Hie_DEG,&Deg,"CT ICO20x20");
"ICO20x20","CT");
HTM_TxtF ("&nbsp;%s",Deg.FullName); HTM_TxtF ("&nbsp;%s",Deg.FullName);
} }
HTM_TD_End (); HTM_TD_End ();

View File

@ -1654,10 +1654,8 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LM\" style=\"width:%upx;\"",Rec_DEGREE_LOGO_SIZE); HTM_TD_Begin ("class=\"LM\" style=\"width:%upx;\"",Rec_DEGREE_LOGO_SIZE);
Lgo_DrawLogo (Hie_DEG, Lgo_DrawLogo (Hie_DEG,&Gbl.Hierarchy.Node[Hie_DEG],
Gbl.Hierarchy.Node[Hie_DEG].HieCod, "ICO64x64");
Gbl.Hierarchy.Node[Hie_DEG].ShrtName,
"ICO64x64",NULL);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"REC_HEAD CM\""); HTM_TD_Begin ("class=\"REC_HEAD CM\"");
@ -2534,8 +2532,7 @@ static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,
ParCod_PutPar (ParCod_Ins,Ins->HieCod); ParCod_PutPar (ParCod_Ins,Ins->HieCod);
HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\""); HTM_BUTTON_Submit_Begin (Ins->FullName,"class=\"BT_LINK\"");
} }
Lgo_DrawLogo (Hie_INS,Ins->HieCod,Ins->ShrtName, Lgo_DrawLogo (Hie_INS,Ins,"ICO");
"ICO",NULL);
if (PutFormLinks == Frm_PUT_FORM) if (PutFormLinks == Frm_PUT_FORM)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();

View File

@ -3053,7 +3053,7 @@ static void Sta_WriteInstit (long InsCod)
The_GetSuffix (),Ins.FullName); The_GetSuffix (),Ins.FullName);
/***** Form to go to institution *****/ /***** Form to go to institution *****/
Ins_DrawInstitLogoAndNameWithLink (&Ins,ActSeeInsInf,"CT"); Ins_DrawInstitLogoAndNameWithLink (&Ins,ActSeeInsInf,"CT ICO16x16");
} }
else // Hit with no institution selected else // Hit with no institution selected
{ {
@ -3144,7 +3144,7 @@ static void Sta_WriteCenter (long CtrCod)
The_GetSuffix (),Ctr.FullName); The_GetSuffix (),Ctr.FullName);
/***** Form to go to center *****/ /***** Form to go to center *****/
Ctr_DrawCenterLogoAndNameWithLink (&Ctr,ActSeeCtrInf,"CT"); Ctr_DrawCenterLogoAndNameWithLink (&Ctr,ActSeeCtrInf,"CT ICO16x16");
} }
else // Hit with no center selected else // Hit with no center selected
{ {
@ -3235,7 +3235,7 @@ static void Sta_WriteDegree (long DegCod)
The_GetSuffix (),Deg.FullName); The_GetSuffix (),Deg.FullName);
/***** Form to go to degree *****/ /***** Form to go to degree *****/
Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,"CT"); Deg_DrawDegreeLogoAndNameWithLink (&Deg,ActSeeDegInf,"CT ICO20x20");
} }
else // Hit with no degree selected else // Hit with no degree selected
{ {