Version 23.7: Sep 18, 2023 Code refactoring in hierarchy.

This commit is contained in:
acanas 2023-09-18 15:15:29 +02:00
parent 9f5d3e4688
commit ce0f3986c1
49 changed files with 354 additions and 483 deletions

View File

@ -43,14 +43,14 @@
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void RSS_WriteNotices (FILE *FileRSS,struct Crs_Course *Crs); static void RSS_WriteNotices (FILE *FileRSS,struct Hie_Node *Crs);
static void RSS_WriteCallsForExams (FILE *FileRSS,struct Crs_Course *Crs); static void RSS_WriteCallsForExams (FILE *FileRSS,struct Hie_Node *Crs);
/*****************************************************************************/ /*****************************************************************************/
/******* Update RSS archive with active notices in the current course ********/ /******* Update RSS archive with active notices in the current course ********/
/*****************************************************************************/ /*****************************************************************************/
void RSS_UpdateRSSFileForACrs (struct Crs_Course *Crs) void RSS_UpdateRSSFileForACrs (struct Hie_Node *Crs)
{ {
char PathRelPublRSSDir[PATH_MAX + 1]; char PathRelPublRSSDir[PATH_MAX + 1];
char PathRelPublRSSFile[PATH_MAX + 1 + NAME_MAX + 1]; char PathRelPublRSSFile[PATH_MAX + 1 + NAME_MAX + 1];
@ -139,7 +139,7 @@ void RSS_UpdateRSSFileForACrs (struct Crs_Course *Crs)
/************* Write notices of a course as items of RSS file ****************/ /************* Write notices of a course as items of RSS file ****************/
/*****************************************************************************/ /*****************************************************************************/
static void RSS_WriteNotices (FILE *FileRSS,struct Crs_Course *Crs) static void RSS_WriteNotices (FILE *FileRSS,struct Hie_Node *Crs)
{ {
extern const char *Txt_Notice; extern const char *Txt_Notice;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -228,7 +228,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Crs_Course *Crs)
/********** Write calls for exams of a course as items of RSS file ***********/ /********** Write calls for exams of a course as items of RSS file ***********/
/*****************************************************************************/ /*****************************************************************************/
static void RSS_WriteCallsForExams (FILE *FileRSS,struct Crs_Course *Crs) static void RSS_WriteCallsForExams (FILE *FileRSS,struct Hie_Node *Crs)
{ {
extern const char *Txt_Exam; extern const char *Txt_Exam;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;

View File

@ -27,7 +27,7 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void RSS_UpdateRSSFileForACrs (struct Crs_Course *Crs); void RSS_UpdateRSSFileForACrs (struct Hie_Node *Crs);
void RSS_BuildRSSLink (char RSSLink[Cns_MAX_BYTES_WWW + 1],long CrsCod); void RSS_BuildRSSLink (char RSSLink[Cns_MAX_BYTES_WWW + 1],long CrsCod);
#endif #endif

View File

@ -8786,9 +8786,9 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
long *CrsCod, long *CrsCod,
long *GrpCod) long *GrpCod)
{ {
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Deg_Degree Deg; struct Hie_Node Deg;
struct Crs_Course Crs; struct Hie_Node Crs;
struct GroupData GrpDat; struct GroupData GrpDat;
switch (FileBrowser) switch (FileBrowser)
@ -9261,7 +9261,7 @@ void Brw_RemoveGrpZones (long CrsCod,long GrpCod)
/***************** Remove the works of a user in a course ********************/ /***************** Remove the works of a user in a course ********************/
/*****************************************************************************/ /*****************************************************************************/
void Brw_RemoveUsrWorksInCrs (struct Usr_Data *UsrDat,struct Crs_Course *Crs) void Brw_RemoveUsrWorksInCrs (struct Usr_Data *UsrDat,struct Hie_Node *Crs)
{ {
char PathUsrInCrs[PATH_MAX + 1]; char PathUsrInCrs[PATH_MAX + 1];
@ -9287,7 +9287,7 @@ void Brw_RemoveUsrWorksInAllCrss (struct Usr_Data *UsrDat)
unsigned NumCrss; unsigned NumCrss;
unsigned NumCrs; unsigned NumCrs;
unsigned NumCrssWorksRemoved = 0; unsigned NumCrssWorksRemoved = 0;
struct Crs_Course Crs; struct Hie_Node Crs;
/***** Query database *****/ /***** Query database *****/
NumCrss = Crs_DB_GetCrssFromUsr (&mysql_res,UsrDat->UsrCod,-1L); NumCrss = Crs_DB_GetCrssFromUsr (&mysql_res,UsrDat->UsrCod,-1L);

View File

@ -264,7 +264,7 @@ void Brw_PutParsFileBrowser (const char *PathInTree,const char *FilFolLnkName,
void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod); void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod);
void Brw_RemoveGrpZones (long CrsCod,long GrpCod); void Brw_RemoveGrpZones (long CrsCod,long GrpCod);
void Brw_RemoveUsrWorksInCrs (struct Usr_Data *UsrDat,struct Crs_Course *Crs); void Brw_RemoveUsrWorksInCrs (struct Usr_Data *UsrDat,struct Hie_Node *Crs);
void Brw_RemoveUsrWorksInAllCrss (struct Usr_Data *UsrDat); void Brw_RemoveUsrWorksInAllCrss (struct Usr_Data *UsrDat);
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],

View File

@ -876,7 +876,7 @@ static void Cfe_ShowCallForExam (struct Cfe_CallsForExams *CallsForExams,
extern const char *Txt_minute; extern const char *Txt_minute;
extern const char *Txt_minutes; extern const char *Txt_minutes;
extern const char *Txt_Publish_call_FOR_EXAM; extern const char *Txt_Publish_call_FOR_EXAM;
struct Ins_Instit Ins; struct Hie_Node Ins;
char StrExamDate[Cns_MAX_BYTES_DATE + 1]; char StrExamDate[Cns_MAX_BYTES_DATE + 1];
unsigned CurrentYear = Dat_GetCurrentYear (); unsigned CurrentYear = Dat_GetCurrentYear ();
unsigned Year; unsigned Year;

View File

@ -68,7 +68,7 @@ extern struct Globals Gbl;
/***************************** Private variables *****************************/ /***************************** Private variables *****************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Ctr_Center *Ctr_EditingCtr = NULL; // Static variable to keep the center being edited static struct Hie_Node *Ctr_EditingCtr = NULL; // Static variable to keep the center being edited
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
@ -77,20 +77,20 @@ static struct Ctr_Center *Ctr_EditingCtr = NULL; // Static variable to keep the
static void Ctr_ListCenters (void); static void Ctr_ListCenters (void);
static void Ctr_PutIconsListingCenters (__attribute__((unused)) void *Args); static void Ctr_PutIconsListingCenters (__attribute__((unused)) void *Args);
static void Ctr_PutIconToEditCenters (void); static void Ctr_PutIconToEditCenters (void);
static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr); static void Ctr_ListOneCenterForSeeing (struct Hie_Node *Ctr,unsigned NumCtr);
static void Ctr_GetParCtrOrder (void); static void Ctr_GetParCtrOrder (void);
static void Ctr_EditCentersInternal (void); static void Ctr_EditCentersInternal (void);
static void Ctr_PutIconsEditingCenters (__attribute__((unused)) void *Args); static void Ctr_PutIconsEditingCenters (__attribute__((unused)) void *Args);
static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res, static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res,
struct Ctr_Center *Ctr, struct Hie_Node *Ctr,
bool GetNumUsrsWhoClaimToBelongToCtr); bool GetNumUsrsWhoClaimToBelongToCtr);
static void Ctr_GetCoordFromRow (MYSQL_RES *mysql_res, static void Ctr_GetCoordFromRow (MYSQL_RES *mysql_res,
struct Map_Coordinates *Coord); struct Map_Coordinates *Coord);
static void Ctr_ListCentersForEdition (const struct Plc_Places *Places); static void Ctr_ListCentersForEdition (const struct Plc_Places *Places);
static bool Ctr_CheckIfICanEditACenter (struct Ctr_Center *Ctr); static bool Ctr_CheckIfICanEditACenter (struct Hie_Node *Ctr);
static void Ctr_ShowAlertAndButtonToGoToCtr (void); static void Ctr_ShowAlertAndButtonToGoToCtr (void);
@ -104,7 +104,7 @@ static unsigned Ctr_GetNumCtrsInCty (long CtyCod);
static void Ctr_EditingCenterConstructor (void); static void Ctr_EditingCenterConstructor (void);
static void Ctr_EditingCenterDestructor (void); static void Ctr_EditingCenterDestructor (void);
static void Ctr_FormToGoToMap (struct Ctr_Center *Ctr); static void Ctr_FormToGoToMap (struct Hie_Node *Ctr);
static void Ctr_PutParCtrCod (void *CtrCod); static void Ctr_PutParCtrCod (void *CtrCod);
@ -123,7 +123,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumCtr; unsigned NumCtr;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
const char *BgColor; const char *BgColor;
/***** Get centers with pending degrees *****/ /***** Get centers with pending degrees *****/
@ -189,7 +189,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
/******************** Draw center logo and name with link ********************/ /******************** Draw center logo and name with link ********************/
/*****************************************************************************/ /*****************************************************************************/
void Ctr_DrawCenterLogoAndNameWithLink (struct Ctr_Center *Ctr,Act_Action_t Action, void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action,
const char *ClassLogo) const char *ClassLogo)
{ {
/***** Begin form *****/ /***** Begin form *****/
@ -313,7 +313,7 @@ static void Ctr_PutIconToEditCenters (void)
/************************* List one center for seeing ************************/ /************************* List one center for seeing ************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr) static void Ctr_ListOneCenterForSeeing (struct Hie_Node *Ctr,unsigned NumCtr)
{ {
extern const char *Txt_CENTER_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_CENTER_STATUS[Hie_NUM_STATUS_TXT];
struct Plc_Place Plc; struct Plc_Place Plc;
@ -395,11 +395,11 @@ static void Ctr_ListOneCenterForSeeing (struct Ctr_Center *Ctr,unsigned NumCtr)
static void Ctr_GetParCtrOrder (void) static void Ctr_GetParCtrOrder (void)
{ {
Gbl.Hierarchy.Ctrs.SelectedOrder = (Ctr_Order_t) Gbl.Hierarchy.Ctrs.SelectedOrder = (Hie_Order_t)
Par_GetParUnsignedLong ("Order", Par_GetParUnsignedLong ("Order",
0, 0,
Ctr_NUM_ORDERS - 1, Hie_NUM_ORDERS - 1,
(unsigned long) Ctr_ORDER_DEFAULT); (unsigned long) Hie_ORDER_DEFAULT);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -433,7 +433,7 @@ static void Ctr_EditCentersInternal (void)
Plc_GetListPlaces (&Places); Plc_GetListPlaces (&Places);
/***** Get list of centers *****/ /***** Get list of centers *****/
Gbl.Hierarchy.Ctrs.SelectedOrder = Ctr_ORDER_BY_CENTER; Gbl.Hierarchy.Ctrs.SelectedOrder = Hie_ORDER_BY_NAME;
Ctr_GetFullListOfCenters (Gbl.Hierarchy.Ins.Cod, Ctr_GetFullListOfCenters (Gbl.Hierarchy.Ins.Cod,
Gbl.Hierarchy.Ctrs.SelectedOrder); Gbl.Hierarchy.Ctrs.SelectedOrder);
@ -515,7 +515,7 @@ void Ctr_GetBasicListOfCenters (long InsCod)
/************* with number of users who claim to belong to them **************/ /************* with number of users who claim to belong to them **************/
/*****************************************************************************/ /*****************************************************************************/
void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder) void Ctr_GetFullListOfCenters (long InsCod,Hie_Order_t SelectedOrder)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumCtr; unsigned NumCtr;
@ -547,7 +547,7 @@ void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder)
/************************ Get data of center by code *************************/ /************************ Get data of center by code *************************/
/*****************************************************************************/ /*****************************************************************************/
bool Ctr_GetCenterDataByCod (struct Ctr_Center *Ctr) bool Ctr_GetCenterDataByCod (struct Hie_Node *Ctr)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool CtrFound = false; bool CtrFound = false;
@ -606,7 +606,7 @@ void Ctr_GetCoordByCod (long CtrCod,struct Map_Coordinates *Coord)
/*****************************************************************************/ /*****************************************************************************/
static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res, static void Ctr_GetCenterDataFromRow (MYSQL_RES *mysql_res,
struct Ctr_Center *Ctr, struct Hie_Node *Ctr,
bool GetNumUsrsWhoClaimToBelongToCtr) bool GetNumUsrsWhoClaimToBelongToCtr)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -753,7 +753,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
extern const char *Txt_Another_place; extern const char *Txt_Another_place;
extern const char *Txt_CENTER_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_CENTER_STATUS[Hie_NUM_STATUS_TXT];
unsigned NumCtr; unsigned NumCtr;
struct Ctr_Center *Ctr; struct Hie_Node *Ctr;
unsigned NumPlc; unsigned NumPlc;
const struct Plc_Place *PlcInLst; const struct Plc_Place *PlcInLst;
char WWW[Cns_MAX_BYTES_WWW + 1]; char WWW[Cns_MAX_BYTES_WWW + 1];
@ -951,7 +951,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places)
/************** Check if I can edit, remove, etc. a center *******************/ /************** Check if I can edit, remove, etc. a center *******************/
/*****************************************************************************/ /*****************************************************************************/
static bool Ctr_CheckIfICanEditACenter (struct Ctr_Center *Ctr) static bool Ctr_CheckIfICanEditACenter (struct Hie_Node *Ctr)
{ {
return Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM || // I am an institution administrator or higher return Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM || // I am an institution administrator or higher
((Ctr->Status & Hie_STATUS_BIT_PENDING) != 0 && // Center is not yet activated ((Ctr->Status & Hie_STATUS_BIT_PENDING) != 0 && // Center is not yet activated
@ -1090,7 +1090,7 @@ void Ctr_RenameCenterFull (void)
/************************ Change the name of a center ************************/ /************************ Change the name of a center ************************/
/*****************************************************************************/ /*****************************************************************************/
void Ctr_RenameCenter (struct Ctr_Center *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName) void Ctr_RenameCenter (struct Hie_Node *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
extern const char *Txt_The_center_X_already_exists; extern const char *Txt_The_center_X_already_exists;
extern const char *Txt_The_center_X_has_been_renamed_as_Y; extern const char *Txt_The_center_X_has_been_renamed_as_Y;
@ -1401,19 +1401,19 @@ static void Ctr_PutHeadCentersForSeeing (bool OrderSelectable)
extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Degrees_ABBREVIATION;
extern const char *Txt_Courses_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION;
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
Ctr_Order_t Order; Hie_Order_t Order;
static HTM_HeadAlign Align[Ctr_NUM_ORDERS] = static HTM_HeadAlign Align[Hie_NUM_ORDERS] =
{ {
[Ctr_ORDER_BY_CENTER ] = HTM_HEAD_LEFT, [Hie_ORDER_BY_NAME ] = HTM_HEAD_LEFT,
[Ctr_ORDER_BY_NUM_USRS] = HTM_HEAD_RIGHT [Hie_ORDER_BY_NUM_USRS] = HTM_HEAD_RIGHT
}; };
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Empty (1); HTM_TH_Empty (1);
for (Order = (Ctr_Order_t) 0; for (Order = (Hie_Order_t) 0;
Order <= (Ctr_Order_t) (Ctr_NUM_ORDERS - 1); Order <= (Hie_Order_t) (Hie_NUM_ORDERS - 1);
Order++) Order++)
{ {
HTM_TH_Begin (Align[Order]); HTM_TH_Begin (Align[Order]);
@ -1817,7 +1817,7 @@ void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs)
extern const char *Txt_centers; extern const char *Txt_centers;
unsigned NumCtr; unsigned NumCtr;
char *Title; char *Title;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
/***** Query database *****/ /***** Query database *****/
if (NumCtrs) if (NumCtrs)
@ -1896,7 +1896,7 @@ static void Ctr_EditingCenterDestructor (void)
/************************ Form to go to center map ***************************/ /************************ Form to go to center map ***************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ctr_FormToGoToMap (struct Ctr_Center *Ctr) static void Ctr_FormToGoToMap (struct Hie_Node *Ctr)
{ {
struct Map_Coordinates Coord; struct Map_Coordinates Coord;
@ -2034,7 +2034,7 @@ void Ctr_FlushCacheNumUsrsWhoClaimToBelongToCtr (void)
Gbl.Cache.NumUsrsWhoClaimToBelongToCtr.NumUsrs = 0; Gbl.Cache.NumUsrsWhoClaimToBelongToCtr.NumUsrs = 0;
} }
unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr) unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Hie_Node *Ctr)
{ {
/***** 1. Fast check: Trivial case *****/ /***** 1. Fast check: Trivial case *****/
if (Ctr->Cod <= 0) if (Ctr->Cod <= 0)
@ -2062,7 +2062,7 @@ unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr)
return Ctr->NumUsrsWhoClaimToBelong.NumUsrs; return Ctr->NumUsrsWhoClaimToBelong.NumUsrs;
} }
unsigned Ctr_GetCachedNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr) unsigned Ctr_GetCachedNumUsrsWhoClaimToBelongToCtr (struct Hie_Node *Ctr)
{ {
unsigned NumUsrsCtr; unsigned NumUsrsCtr;

View File

@ -41,58 +41,21 @@
#define Ctr_MAX_CENTERS_PER_USR 10 // Used in list of my centers #define Ctr_MAX_CENTERS_PER_USR 10 // Used in list of my centers
struct Ctr_Center
{
long Cod; // Center code
long PrtCod; // Parent (institution) code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Center status
long RequesterUsrCod; // User code of the person who requested the creation of this center
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
char WWW[Cns_MAX_BYTES_WWW + 1];
struct
{
bool Valid;
unsigned NumUsrs;
} NumUsrsWhoClaimToBelong;
};
#define Ctr_NUM_ORDERS 2
typedef enum
{
Ctr_ORDER_BY_CENTER = 0,
Ctr_ORDER_BY_NUM_USRS = 1,
} Ctr_Order_t;
#define Ctr_ORDER_DEFAULT Ctr_ORDER_BY_CENTER
struct Ctr_ListCtrs
{
unsigned Num; // Number of centers
struct Ctr_Center *Lst; // List of centers
Ctr_Order_t SelectedOrder; // Order of centers
};
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Ctr_SeeCtrWithPendingDegs (void); void Ctr_SeeCtrWithPendingDegs (void);
void Ctr_DrawCenterLogoAndNameWithLink (struct Ctr_Center *Ctr,Act_Action_t Action, void Ctr_DrawCenterLogoAndNameWithLink (struct Hie_Node *Ctr,Act_Action_t Action,
const char *ClassLogo); const char *ClassLogo);
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,Ctr_Order_t SelectedOrder); void Ctr_GetFullListOfCenters (long InsCod,Hie_Order_t SelectedOrder);
bool Ctr_GetCenterDataByCod (struct Ctr_Center *Ctr); bool Ctr_GetCenterDataByCod (struct Hie_Node *Ctr);
void Ctr_GetCoordByCod (long CtrCod,struct Map_Coordinates *Coord); void Ctr_GetCoordByCod (long CtrCod,struct Map_Coordinates *Coord);
void Ctr_FreeListCenters (void); void Ctr_FreeListCenters (void);
void Ctr_WriteSelectorOfCenter (void); void Ctr_WriteSelectorOfCenter (void);
@ -100,7 +63,7 @@ void Ctr_RemoveCenter (void);
void Ctr_ChangeCtrPlc (void); void Ctr_ChangeCtrPlc (void);
void Ctr_RenameCenterShort (void); void Ctr_RenameCenterShort (void);
void Ctr_RenameCenterFull (void); void Ctr_RenameCenterFull (void);
void Ctr_RenameCenter (struct Ctr_Center *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName); void Ctr_RenameCenter (struct Hie_Node *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
void Ctr_ChangeCtrWWW (void); void Ctr_ChangeCtrWWW (void);
void Ctr_ChangeCtrStatus (void); void Ctr_ChangeCtrStatus (void);
void Ctr_ContEditAfterChgCtr (void); void Ctr_ContEditAfterChgCtr (void);
@ -134,7 +97,7 @@ void Ctr_FlushCacheUsrBelongsToCtr (void);
bool Ctr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod); bool Ctr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod);
void Ctr_FlushCacheNumUsrsWhoClaimToBelongToCtr (void); void Ctr_FlushCacheNumUsrsWhoClaimToBelongToCtr (void);
unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr); unsigned Ctr_GetNumUsrsWhoClaimToBelongToCtr (struct Hie_Node *Ctr);
unsigned Ctr_GetCachedNumUsrsWhoClaimToBelongToCtr (struct Ctr_Center *Ctr); unsigned Ctr_GetCachedNumUsrsWhoClaimToBelongToCtr (struct Hie_Node *Ctr);
#endif #endif

View File

@ -550,7 +550,7 @@ static void CtrCfg_Institution (bool PrintView,bool PutForm)
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Institution; extern const char *Txt_Institution;
unsigned NumIns; unsigned NumIns;
const struct Ins_Instit *InsInLst; const struct Hie_Node *InsInLst;
/***** Institution *****/ /***** Institution *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -1029,7 +1029,7 @@ void CtrCfg_ChangeCtrIns (void)
{ {
extern const char *Txt_The_center_X_already_exists; extern const char *Txt_The_center_X_already_exists;
extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y; extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y;
struct Ins_Instit NewIns; struct Hie_Node NewIns;
/***** Get parameter with institution code *****/ /***** Get parameter with institution code *****/
NewIns.Cod = ParCod_GetAndCheckPar (ParCod_OthIns); NewIns.Cod = ParCod_GetAndCheckPar (ParCod_OthIns);

View File

@ -49,7 +49,7 @@ extern struct Globals Gbl;
/***************************** Create a new center ***************************/ /***************************** Create a new center ***************************/
/*****************************************************************************/ /*****************************************************************************/
long Ctr_DB_CreateCenter (const struct Ctr_Center *Ctr,Hie_Status_t Status) long Ctr_DB_CreateCenter (const struct Hie_Node *Ctr,Hie_Status_t Status)
{ {
return return
DB_QueryINSERTandReturnCode ("can not create a new center", DB_QueryINSERTandReturnCode ("can not create a new center",
@ -113,12 +113,12 @@ unsigned Ctr_DB_GetListOfCtrsFull (MYSQL_RES **mysql_res,long InsCod)
/*****************************************************************************/ /*****************************************************************************/
unsigned Ctr_DB_GetListOfCtrsFullWithNumUsrs (MYSQL_RES **mysql_res, unsigned Ctr_DB_GetListOfCtrsFullWithNumUsrs (MYSQL_RES **mysql_res,
long InsCod,Ctr_Order_t SelectedOrder) long InsCod,Hie_Order_t SelectedOrder)
{ {
static const char *OrderBySubQuery[Ctr_NUM_ORDERS] = static const char *OrderBySubQuery[Hie_NUM_ORDERS] =
{ {
[Ctr_ORDER_BY_CENTER ] = "FullName", [Hie_ORDER_BY_NAME ] = "FullName",
[Ctr_ORDER_BY_NUM_USRS] = "NumUsrs DESC," [Hie_ORDER_BY_NUM_USRS] = "NumUsrs DESC,"
"FullName", "FullName",
}; };

View File

@ -38,12 +38,12 @@
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
long Ctr_DB_CreateCenter (const struct Ctr_Center *Ctr,Hie_Status_t Status); long Ctr_DB_CreateCenter (const struct Hie_Node *Ctr,Hie_Status_t Status);
unsigned Ctr_DB_GetListOfCtrsInCurrentIns (MYSQL_RES **mysql_res); unsigned Ctr_DB_GetListOfCtrsInCurrentIns (MYSQL_RES **mysql_res);
unsigned Ctr_DB_GetListOfCtrsFull (MYSQL_RES **mysql_res,long InsCod); unsigned Ctr_DB_GetListOfCtrsFull (MYSQL_RES **mysql_res,long InsCod);
unsigned Ctr_DB_GetListOfCtrsFullWithNumUsrs (MYSQL_RES **mysql_res, unsigned Ctr_DB_GetListOfCtrsFullWithNumUsrs (MYSQL_RES **mysql_res,
long InsCod,Ctr_Order_t SelectedOrder); long InsCod,Hie_Order_t SelectedOrder);
unsigned Ctr_DB_GetCtrsWithPendingDegs (MYSQL_RES **mysql_res); unsigned Ctr_DB_GetCtrsWithPendingDegs (MYSQL_RES **mysql_res);
unsigned Ctr_DB_GetCenterDataByCod (MYSQL_RES **mysql_res,long CtrCod); unsigned Ctr_DB_GetCenterDataByCod (MYSQL_RES **mysql_res,long CtrCod);
unsigned Ctr_DB_GetCoordByCod (MYSQL_RES **mysql_res,long CtrCod); unsigned Ctr_DB_GetCoordByCod (MYSQL_RES **mysql_res,long CtrCod);

View File

@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así? Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"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.6.1 (2023-09-18)" #define Log_PLATFORM_VERSION "SWAD 23.7 (2023-09-18)"
#define CSS_FILE "swad22.120.4.css" #define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 23.7: Sep 18, 2023 Code refactoring in hierarchy. (337610 lines)
Version 23.6.1: Sep 18, 2023 Code refactoring in hierarchy. (337727 lines) Version 23.6.1: Sep 18, 2023 Code refactoring in hierarchy. (337727 lines)
Version 23.6: Sep 18, 2023 Code refactoring in centers and coordinates. (337699 lines) Version 23.6: Sep 18, 2023 Code refactoring in centers and coordinates. (337699 lines)
Version 23.5.1: Sep 18, 2023 Code refactoring in edition of countries. (337657 lines) Version 23.5.1: Sep 18, 2023 Code refactoring in edition of countries. (337657 lines)

View File

@ -115,8 +115,8 @@ void Cht_ShowListOfAvailableChatRooms (void)
extern const char *Txt_Course; extern const char *Txt_Course;
bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS]; bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS];
unsigned NumMyDeg; unsigned NumMyDeg;
struct Deg_Degree Deg; struct Hie_Node Deg;
struct Crs_Course Crs; struct Hie_Node Crs;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCrss; unsigned NumCrss;
@ -378,8 +378,8 @@ void Cht_OpenChatWindow (void)
char UsrName[Usr_MAX_BYTES_FULL_NAME + 1]; char UsrName[Usr_MAX_BYTES_FULL_NAME + 1];
unsigned NumMyDeg; unsigned NumMyDeg;
unsigned NumMyCrs; unsigned NumMyCrs;
struct Deg_Degree Deg; struct Hie_Node Deg;
struct Crs_Course Crs; struct Hie_Node Crs;
char ThisRoomCode[Cht_MAX_BYTES_ROOM_CODE + 1]; char ThisRoomCode[Cht_MAX_BYTES_ROOM_CODE + 1];
char ThisRoomShortName[Cht_MAX_BYTES_ROOM_SHRT_NAME + 1]; char ThisRoomShortName[Cht_MAX_BYTES_ROOM_SHRT_NAME + 1];
char ThisRoomFullName [Cht_MAX_BYTES_ROOM_FULL_NAME + 1]; char ThisRoomFullName [Cht_MAX_BYTES_ROOM_FULL_NAME + 1];

View File

@ -60,7 +60,7 @@ extern struct Globals Gbl;
/***************************** Private variables *****************************/ /***************************** Private variables *****************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Cty_Countr *Cty_EditingCty = NULL; // Static variable to keep the country being edited static struct Hie_Node *Cty_EditingCty = NULL; // Static variable to keep the country being edited
long Cty_CurrentCtyCod = -1L; // Used as parameter in contextual links long Cty_CurrentCtyCod = -1L; // Used as parameter in contextual links
/*****************************************************************************/ /*****************************************************************************/
@ -68,13 +68,11 @@ long Cty_CurrentCtyCod = -1L; // Used as parameter in contextual links
/*****************************************************************************/ /*****************************************************************************/
static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable); static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable);
static void Cty_ListOneCountryForSeeing (struct Cty_Countr *Cty,unsigned NumCty); static void Cty_ListOneCountryForSeeing (struct Hie_Node *Cty,unsigned NumCty);
static void Cty_PutIconsListingCountries (__attribute__((unused)) void *Args); static void Cty_PutIconsListingCountries (__attribute__((unused)) void *Args);
static void Cty_PutIconToEditCountries (void); static void Cty_PutIconToEditCountries (void);
static void Cty_GetParCtyOrder (void);
static void Cty_EditCountriesInternal (void); static void Cty_EditCountriesInternal (void);
static void Cty_PutIconsEditingCountries (__attribute__((unused)) void *Args); static void Cty_PutIconsEditingCountries (__attribute__((unused)) void *Args);
@ -94,7 +92,7 @@ static void Cty_PutHeadCountriesForEdition (void);
static void Cty_EditingCountryConstructor (void); static void Cty_EditingCountryConstructor (void);
static void Cty_EditingCountryDestructor (void); static void Cty_EditingCountryDestructor (void);
static void Cty_FormToGoToMap (struct Cty_Countr *Cty); static void Cty_FormToGoToMap (struct Hie_Node *Cty);
/*****************************************************************************/ /*****************************************************************************/
/***************** List countries with pending institutions ******************/ /***************** List countries with pending institutions ******************/
@ -111,7 +109,7 @@ void Cty_SeeCtyWithPendingInss (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCtys; unsigned NumCtys;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr Cty; struct Hie_Node Cty;
const char *BgColor; const char *BgColor;
/***** Trivial check: only system admins can see countries with pending institutions *****/ /***** Trivial check: only system admins can see countries with pending institutions *****/
@ -201,7 +199,7 @@ void Cty_ListCountries (void)
void Cty_ListCountries1 (void) void Cty_ListCountries1 (void)
{ {
/***** Get parameter with the type of order in the list of countries *****/ /***** Get parameter with the type of order in the list of countries *****/
Cty_GetParCtyOrder (); Hie_GetParHieOrder ();
/***** Get list of countries *****/ /***** Get list of countries *****/
Cty_GetFullListOfCountries (); Cty_GetFullListOfCountries ();
@ -353,18 +351,18 @@ static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable)
extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Degrees_ABBREVIATION;
extern const char *Txt_Courses_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION;
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
Cty_Order_t Order; Hie_Order_t Order;
static HTM_HeadAlign Align[Cty_NUM_ORDERS] = static HTM_HeadAlign Align[Hie_NUM_ORDERS] =
{ {
[Cty_ORDER_BY_COUNTRY ] = HTM_HEAD_LEFT, [Hie_ORDER_BY_NAME ] = HTM_HEAD_LEFT,
[Cty_ORDER_BY_NUM_USRS] = HTM_HEAD_RIGHT [Hie_ORDER_BY_NUM_USRS] = HTM_HEAD_RIGHT
}; };
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Empty (1); HTM_TH_Empty (1);
for (Order = (Cty_Order_t) 0; for (Order = (Hie_Order_t) 0;
Order <= (Cty_Order_t) (Cty_NUM_ORDERS - 1); Order <= (Hie_Order_t) (Hie_NUM_ORDERS - 1);
Order++) Order++)
{ {
HTM_TH_Begin (Align[Order]); HTM_TH_Begin (Align[Order]);
@ -404,7 +402,7 @@ static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable)
/************************ List one country for seeing ************************/ /************************ List one country for seeing ************************/
/*****************************************************************************/ /*****************************************************************************/
static void Cty_ListOneCountryForSeeing (struct Cty_Countr *Cty,unsigned NumCty) static void Cty_ListOneCountryForSeeing (struct Hie_Node *Cty,unsigned NumCty)
{ {
const char *BgColor; const char *BgColor;
@ -506,7 +504,7 @@ static void Cty_PutIconToEditCountries (void)
/********************* Draw country map and name with link *******************/ /********************* Draw country map and name with link *******************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *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)
{ {
@ -549,7 +547,7 @@ void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *Cty,Act_Action_t Acti
/***************************** Draw country map ******************************/ /***************************** Draw country map ******************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DrawCountryMap (struct Cty_Countr *Cty,const char *Class) void Cty_DrawCountryMap (struct Hie_Node *Cty,const char *Class)
{ {
char *URL; char *URL;
char *Icon; char *Icon;
@ -574,7 +572,7 @@ void Cty_DrawCountryMap (struct Cty_Countr *Cty,const char *Class)
/*********************** Check if country map exists *************************/ /*********************** Check if country map exists *************************/
/*****************************************************************************/ /*****************************************************************************/
bool Cty_CheckIfCountryPhotoExists (struct Cty_Countr *Cty) bool Cty_CheckIfCountryPhotoExists (struct Hie_Node *Cty)
{ {
char PathMap[PATH_MAX + 1]; char PathMap[PATH_MAX + 1];
@ -652,19 +650,6 @@ void Cty_WriteScriptGoogleGeochart (void)
HTM_SCRIPT_End (); HTM_SCRIPT_End ();
} }
/*****************************************************************************/
/******** Get parameter with the type or order in list of countries **********/
/*****************************************************************************/
static void Cty_GetParCtyOrder (void)
{
Gbl.Hierarchy.Ctys.SelectedOrder = (Cty_Order_t)
Par_GetParUnsignedLong ("Order",
0,
Cty_NUM_ORDERS - 1,
(unsigned long) Cty_ORDER_DEFAULT);
}
/*****************************************************************************/ /*****************************************************************************/
/******************** Put forms to edit institution types ********************/ /******************** Put forms to edit institution types ********************/
/*****************************************************************************/ /*****************************************************************************/
@ -687,7 +672,7 @@ static void Cty_EditCountriesInternal (void)
extern const char *Txt_Countries; extern const char *Txt_Countries;
/***** Get list of countries *****/ /***** Get list of countries *****/
Gbl.Hierarchy.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; Gbl.Hierarchy.Ctys.SelectedOrder = Hie_ORDER_BY_NAME;
Cty_GetFullListOfCountries (); Cty_GetFullListOfCountries ();
/***** Write menu to select country *****/ /***** Write menu to select country *****/
@ -735,7 +720,7 @@ void Cty_GetBasicListOfCountries (void)
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr *Cty; struct Hie_Node *Cty;
// Lan_Language_t Lan; // Lan_Language_t Lan;
/***** Trivial check: if list is already got, nothing to do *****/ /***** Trivial check: if list is already got, nothing to do *****/
@ -786,7 +771,7 @@ static void Cty_GetFullListOfCountries (void)
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr *Cty; struct Hie_Node *Cty;
/***** Trivial check: if list is already got, nothing to do *****/ /***** Trivial check: if list is already got, nothing to do *****/
if (Gbl.Hierarchy.Ctys.Num) if (Gbl.Hierarchy.Ctys.Num)
@ -841,7 +826,7 @@ void Cty_WriteSelectorOfCountry (void)
{ {
extern const char *Txt_Country; extern const char *Txt_Country;
unsigned NumCty; unsigned NumCty;
const struct Cty_Countr *CtyInLst; const struct Hie_Node *CtyInLst;
/***** Get list of countries *****/ /***** Get list of countries *****/
Cty_GetBasicListOfCountries (); Cty_GetBasicListOfCountries ();
@ -917,7 +902,7 @@ 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 Cty_Countr *Cty) bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Cty)
{ {
extern const char *Txt_Another_country; extern const char *Txt_Another_country;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -968,7 +953,7 @@ bool Cty_GetBasicCountryDataByCod (struct Cty_Countr *Cty)
/*********** Get all names and WWWs of a country given its code **************/ /*********** Get all names and WWWs of a country given its code **************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_GetNamesAndWWWsByCod (struct Cty_Countr *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])
{ {
@ -1065,7 +1050,7 @@ static void Cty_ListCountriesForEdition (void)
{ {
extern const char *Txt_STR_LANG_NAME[1 + Lan_NUM_LANGUAGES]; extern const char *Txt_STR_LANG_NAME[1 + Lan_NUM_LANGUAGES];
unsigned NumCty; unsigned NumCty;
struct Cty_Countr *Cty; struct Hie_Node *Cty;
unsigned NumInss; unsigned NumInss;
unsigned NumUsrsCty; unsigned NumUsrsCty;
Lan_Language_t Lan; Lan_Language_t Lan;
@ -1796,7 +1781,7 @@ void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
extern const char *Txt_countries; extern const char *Txt_countries;
char *Title; char *Title;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr Cty; struct Hie_Node Cty;
/***** Query database *****/ /***** Query database *****/
if (NumCtys) if (NumCtys)
@ -1874,7 +1859,7 @@ static void Cty_EditingCountryDestructor (void)
/************************ Form to go to country map **************************/ /************************ Form to go to country map **************************/
/*****************************************************************************/ /*****************************************************************************/
static void Cty_FormToGoToMap (struct Cty_Countr *Cty) static void Cty_FormToGoToMap (struct Hie_Node *Cty)
{ {
if (Cty_DB_CheckIfMapIsAvailable (Cty->Cod)) if (Cty_DB_CheckIfMapIsAvailable (Cty->Cod))
{ {
@ -2050,7 +2035,7 @@ void Cty_FlushCacheNumUsrsWhoClaimToBelongToCty (void)
Gbl.Cache.NumUsrsWhoClaimToBelongToCty.NumUsrs = 0; Gbl.Cache.NumUsrsWhoClaimToBelongToCty.NumUsrs = 0;
} }
unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (struct Cty_Countr *Cty) unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (struct Hie_Node *Cty)
{ {
/***** 1. Fast check: Trivial case *****/ /***** 1. Fast check: Trivial case *****/
if (Cty->Cod <= 0) if (Cty->Cod <= 0)
@ -2079,7 +2064,7 @@ unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (struct Cty_Countr *Cty)
return Cty->NumUsrsWhoClaimToBelong.NumUsrs; return Cty->NumUsrsWhoClaimToBelong.NumUsrs;
} }
unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToCty (struct Cty_Countr *Cty) unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToCty (struct Hie_Node *Cty)
{ {
unsigned NumUsrsCty; unsigned NumUsrsCty;

View File

@ -45,40 +45,6 @@
#define Cty_MAX_CHARS_NAME (48 - 1) // 47 #define Cty_MAX_CHARS_NAME (48 - 1) // 47
#define Cty_MAX_BYTES_NAME ((Cty_MAX_CHARS_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 767 #define Cty_MAX_BYTES_NAME ((Cty_MAX_CHARS_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 767
struct Cty_Countr
{
long Cod; // Country code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Alpha2
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
char WWW[Cns_MAX_BYTES_WWW + 1];
struct
{
bool Valid;
unsigned NumUsrs;
} NumUsrsWhoClaimToBelong;
};
#define Cty_NUM_ORDERS 2
typedef enum
{
Cty_ORDER_BY_COUNTRY = 0,
Cty_ORDER_BY_NUM_USRS = 1,
} Cty_Order_t;
#define Cty_ORDER_DEFAULT Cty_ORDER_BY_NUM_USRS
struct Cty_ListCtys
{
unsigned Num; // Number of countries
struct Cty_Countr *Lst; // List of countries
Cty_Order_t SelectedOrder; // Order of countries
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -91,11 +57,11 @@ void Cty_ListCountries2 (void);
bool Cty_CheckIfICanEditCountries (void); bool Cty_CheckIfICanEditCountries (void);
void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *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 Cty_Countr *Cty,const char *Class); void Cty_DrawCountryMap (struct Hie_Node *Cty,const char *Class);
bool Cty_CheckIfCountryPhotoExists (struct Cty_Countr *Cty); bool Cty_CheckIfCountryPhotoExists (struct Hie_Node *Cty);
void Cty_WriteScriptGoogleGeochart (void); void Cty_WriteScriptGoogleGeochart (void);
void Cty_PutParCtyOrder (void); void Cty_PutParCtyOrder (void);
@ -104,8 +70,8 @@ void Cty_GetBasicListOfCountries (void);
void Cty_FreeListCountries (void); void Cty_FreeListCountries (void);
void Cty_WriteSelectorOfCountry (void); void Cty_WriteSelectorOfCountry (void);
void Cty_WriteCountryName (long CtyCod); void Cty_WriteCountryName (long CtyCod);
bool Cty_GetBasicCountryDataByCod (struct Cty_Countr *Cty); bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Cty);
void Cty_GetNamesAndWWWsByCod (struct Cty_Countr *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]);
void Cty_FlushCacheCountryName (void); void Cty_FlushCacheCountryName (void);
@ -141,7 +107,7 @@ unsigned Cty_GetNumUsrsWhoClaimToBelongToAnotherCty (void);
unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToAnotherCty (void); unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToAnotherCty (void);
void Cty_FlushCacheNumUsrsWhoClaimToBelongToCty (void); void Cty_FlushCacheNumUsrsWhoClaimToBelongToCty (void);
unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (struct Cty_Countr *Cty); unsigned Cty_GetNumUsrsWhoClaimToBelongToCty (struct Hie_Node *Cty);
unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToCty (struct Cty_Countr *Cty); unsigned Cty_GetCachedNumUsrsWhoClaimToBelongToCty (struct Hie_Node *Cty);
#endif #endif

View File

@ -254,8 +254,8 @@ static void CtyCfg_Map (void)
unsigned Zoom; unsigned Zoom;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumCtr; unsigned NumCtr;
struct Ins_Instit Ins; struct Hie_Node Ins;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Map_Coordinates Coord; struct Map_Coordinates Coord;
/***** Leaflet CSS *****/ /***** Leaflet CSS *****/

View File

@ -55,7 +55,7 @@ extern struct Globals Gbl;
/**************************** Create a new country ***************************/ /**************************** Create a new country ***************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DB_CreateCountry (const struct Cty_Countr *Cty, void Cty_DB_CreateCountry (const 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])
{ {
@ -153,10 +153,10 @@ unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
char *OrderBySubQuery = NULL; char *OrderBySubQuery = NULL;
static const char *OrderBySubQueryFmt[Cty_NUM_ORDERS] = static const char *OrderBySubQueryFmt[Hie_NUM_ORDERS] =
{ {
[Cty_ORDER_BY_COUNTRY ] = "Name_%s", [Hie_ORDER_BY_NAME ] = "Name_%s",
[Cty_ORDER_BY_NUM_USRS] = "NumUsrs DESC," [Hie_ORDER_BY_NUM_USRS] = "NumUsrs DESC,"
"Name_%s", "Name_%s",
}; };
unsigned NumCtys; unsigned NumCtys;

View File

@ -38,7 +38,7 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DB_CreateCountry (const struct Cty_Countr *Cty, void Cty_DB_CreateCountry (const 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

@ -84,7 +84,7 @@ extern struct Globals Gbl;
/**************************** Private variables ******************************/ /**************************** Private variables ******************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Crs_Course *Crs_EditingCrs = NULL; // Static variable to keep the course being edited static struct Hie_Node *Crs_EditingCrs = NULL; // Static variable to keep the course being edited
/*****************************************************************************/ /*****************************************************************************/
/**************************** Private prototypes *****************************/ /**************************** Private prototypes *****************************/
@ -102,15 +102,15 @@ static void Crs_EditCoursesInternal (void);
static void Crs_PutIconsEditingCourses (__attribute__((unused)) void *Args); static void Crs_PutIconsEditingCourses (__attribute__((unused)) void *Args);
static void Crs_ListCoursesForEdition (void); static void Crs_ListCoursesForEdition (void);
static void Crs_ListCoursesOfAYearForEdition (unsigned Year); static void Crs_ListCoursesOfAYearForEdition (unsigned Year);
static bool Crs_CheckIfICanEdit (struct Crs_Course *Crs); static bool Crs_CheckIfICanEdit (struct Hie_Node *Crs);
static void Crs_PutFormToCreateCourse (void); static void Crs_PutFormToCreateCourse (void);
static void Crs_PutHeadCoursesForSeeing (void); static void Crs_PutHeadCoursesForSeeing (void);
static void Crs_PutHeadCoursesForEdition (void); static void Crs_PutHeadCoursesForEdition (void);
static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status); static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status);
static void Crs_GetParsNewCourse (struct Crs_Course *Crs); static void Crs_GetParsNewCourse (struct Hie_Node *Crs);
static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res, static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res,
struct Crs_Course *Crs); struct Hie_Node *Crs);
static void Crs_EmptyCourseCompletely (long CrsCod); static void Crs_EmptyCourseCompletely (long CrsCod);
@ -913,7 +913,7 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT];
unsigned NumCrs; unsigned NumCrs;
struct Crs_Course *Crs; struct Hie_Node *Crs;
const char *TxtClassNormal; const char *TxtClassNormal;
const char *TxtClassStrong; const char *TxtClassStrong;
const char *BgColor; const char *BgColor;
@ -1113,7 +1113,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
{ {
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_COURSE_STATUS[Hie_NUM_STATUS_TXT];
struct Crs_Course *Crs; struct Hie_Node *Crs;
unsigned YearAux; unsigned YearAux;
unsigned NumCrs; unsigned NumCrs;
struct Usr_Data UsrDat; struct Usr_Data UsrDat;
@ -1191,7 +1191,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
{ {
Frm_BeginForm (ActChgInsCrsCod); Frm_BeginForm (ActChgInsCrsCod);
ParCod_PutPar (ParCod_OthHie,Crs->Cod); ParCod_PutPar (ParCod_OthHie,Crs->Cod);
HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_COD, HTM_INPUT_TEXT ("InsCrsCod",Hie_MAX_CHARS_INSTITUTIONAL_COD,
Crs->InstitutionalCod,HTM_SUBMIT_ON_CHANGE, Crs->InstitutionalCod,HTM_SUBMIT_ON_CHANGE,
"class=\"INPUT_INS_CODE INPUT_%s\"", "class=\"INPUT_INS_CODE INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
@ -1271,7 +1271,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
/************** Check if I can edit, remove, etc. a course *******************/ /************** Check if I can edit, remove, etc. a course *******************/
/*****************************************************************************/ /*****************************************************************************/
static bool Crs_CheckIfICanEdit (struct Crs_Course *Crs) static bool Crs_CheckIfICanEdit (struct Hie_Node *Crs)
{ {
return Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM || // I am a degree administrator or higher return Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM || // I am a degree administrator or higher
((Crs->Status & Hie_STATUS_BIT_PENDING) != 0 && // Course is not yet activated ((Crs->Status & Hie_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
@ -1333,7 +1333,7 @@ static void Crs_PutFormToCreateCourse (void)
/***** Institutional code of the course *****/ /***** Institutional code of the course *****/
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_COD, HTM_INPUT_TEXT ("InsCrsCod",Hie_MAX_CHARS_INSTITUTIONAL_COD,
Crs_EditingCrs->InstitutionalCod, Crs_EditingCrs->InstitutionalCod,
HTM_DONT_SUBMIT_ON_CHANGE, HTM_DONT_SUBMIT_ON_CHANGE,
"class=\"INPUT_INS_CODE INPUT_%s\"", "class=\"INPUT_INS_CODE INPUT_%s\"",
@ -1523,7 +1523,7 @@ static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status)
/************** Get the parameters of a new course from form *****************/ /************** Get the parameters of a new course from form *****************/
/*****************************************************************************/ /*****************************************************************************/
static void Crs_GetParsNewCourse (struct Crs_Course *Crs) static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
{ {
char YearStr[2 + 1]; char YearStr[2 + 1];
@ -1533,7 +1533,7 @@ static void Crs_GetParsNewCourse (struct Crs_Course *Crs)
Crs->Specific.Year = Deg_ConvStrToYear (YearStr); Crs->Specific.Year = Deg_ConvStrToYear (YearStr);
/* Get institutional code */ /* Get institutional code */
Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Crs_MAX_BYTES_INSTITUTIONAL_COD); Par_GetParText ("InsCrsCod",Crs->InstitutionalCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
/* Get course short name */ /* Get course short name */
Par_GetParText ("ShortName",Crs->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME); Par_GetParText ("ShortName",Crs->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
@ -1586,7 +1586,7 @@ void Crs_RemoveCourse (void)
/********************* Get data of a course from its code ********************/ /********************* Get data of a course from its code ********************/
/*****************************************************************************/ /*****************************************************************************/
bool Crs_GetCourseDataByCod (struct Crs_Course *Crs) bool Crs_GetCourseDataByCod (struct Hie_Node *Crs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool CrsFound = false; bool CrsFound = false;
@ -1624,7 +1624,7 @@ bool Crs_GetCourseDataByCod (struct Crs_Course *Crs)
/*****************************************************************************/ /*****************************************************************************/
static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res, static void Crs_GetCourseDataFromRow (MYSQL_RES *mysql_res,
struct Crs_Course *Crs) struct Hie_Node *Crs)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -1683,7 +1683,7 @@ void Crs_RemoveCourseCompletely (long CrsCod)
static void Crs_EmptyCourseCompletely (long CrsCod) static void Crs_EmptyCourseCompletely (long CrsCod)
{ {
struct Crs_Course Crs; struct Hie_Node Crs;
char PathRelCrs[PATH_MAX + 1]; char PathRelCrs[PATH_MAX + 1];
if (CrsCod > 0) if (CrsCod > 0)
@ -1786,7 +1786,7 @@ void Crs_ChangeInsCrsCod (void)
{ {
extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y; extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y;
extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed; extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed;
char NewInstitutionalCrsCod[Crs_MAX_BYTES_INSTITUTIONAL_COD + 1]; char NewInstitutionalCrsCod[Hie_MAX_BYTES_INSTITUTIONAL_COD + 1];
/***** Course constructor *****/ /***** Course constructor *****/
Crs_EditingCourseConstructor (); Crs_EditingCourseConstructor ();
@ -1796,7 +1796,7 @@ void Crs_ChangeInsCrsCod (void)
Crs_EditingCrs->Cod = ParCod_GetAndCheckPar (ParCod_OthHie); Crs_EditingCrs->Cod = ParCod_GetAndCheckPar (ParCod_OthHie);
/* Get institutional code */ /* Get institutional code */
Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_COD); Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
/* Get data of the course */ /* Get data of the course */
Crs_GetCourseDataByCod (Crs_EditingCrs); Crs_GetCourseDataByCod (Crs_EditingCrs);
@ -1883,7 +1883,7 @@ void Crs_ChangeCrsYear (void)
/************* Change the institutional course code of a course **************/ /************* Change the institutional course code of a course **************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_UpdateInstitutionalCrsCod (struct Crs_Course *Crs, void Crs_UpdateInstitutionalCrsCod (struct Hie_Node *Crs,
const char *NewInstitutionalCrsCod) const char *NewInstitutionalCrsCod)
{ {
/***** Update institutional course code in table of courses *****/ /***** Update institutional course code in table of courses *****/
@ -1898,7 +1898,7 @@ void Crs_UpdateInstitutionalCrsCod (struct Crs_Course *Crs,
/****************** Change the year/semester of a course *********************/ /****************** Change the year/semester of a course *********************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_UpdateCrsYear (struct Crs_Course *Crs,unsigned NewYear) void Crs_UpdateCrsYear (struct Hie_Node *Crs,unsigned NewYear)
{ {
/***** Update year/semester in table of courses *****/ /***** Update year/semester in table of courses *****/
Crs_DB_UpdateCrsYear (Crs->Cod,NewYear); Crs_DB_UpdateCrsYear (Crs->Cod,NewYear);
@ -1935,7 +1935,7 @@ void Crs_RenameCourseFull (void)
/************************ Change the name of a course ************************/ /************************ Change the name of a course ************************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_RenameCourse (struct Crs_Course *Crs,Cns_ShrtOrFullName_t ShrtOrFullName) void Crs_RenameCourse (struct Hie_Node *Crs,Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
extern const char *Txt_The_course_X_already_exists; extern const char *Txt_The_course_X_already_exists;
extern const char *Txt_The_course_X_has_been_renamed_as_Y; extern const char *Txt_The_course_X_has_been_renamed_as_Y;
@ -2347,7 +2347,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
extern const char *Txt_Enrolment_confirmed; extern const char *Txt_Enrolment_confirmed;
extern const char *Txt_Enrolment_not_confirmed; extern const char *Txt_Enrolment_not_confirmed;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
struct Deg_Degree Deg; struct Hie_Node Deg;
long CrsCod; long CrsCod;
unsigned NumStds; unsigned NumStds;
unsigned NumNETs; unsigned NumNETs;

View File

@ -41,40 +41,10 @@
#define Crs_MAX_COURSES_PER_USR 100 // Used in list of my courses and list of distinct courses in sent or received messages #define Crs_MAX_COURSES_PER_USR 100 // Used in list of my courses and list of distinct courses in sent or received messages
#define Crs_MAX_CHARS_INSTITUTIONAL_COD (16 - 1) // 15
#define Crs_MAX_BYTES_INSTITUTIONAL_COD ((Crs_MAX_CHARS_INSTITUTIONAL_COD + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 255
#define Crs_MIN_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 6 #define Crs_MIN_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 6
#define Crs_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 12 #define Crs_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 12
#define Crs_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 60 #define Crs_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS 60
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
struct Crs_Course
{
long Cod; // Course code
long PrtCod; // Parent (degree) code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Course status
long RequesterUsrCod; // User code of the person who requested the creation of this course
char InstitutionalCod[Crs_MAX_BYTES_INSTITUTIONAL_COD + 1]; // Institutional code of the course
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Short name of course
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; // Full name of course
};
struct Crs_ListCrss
{
unsigned Num; // Number of courses
struct Crs_Course *Lst; // List of courses
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -112,18 +82,18 @@ void Crs_ReceiveFormReqCrs (void);
void Crs_ReceiveFormNewCrs (void); void Crs_ReceiveFormNewCrs (void);
void Crs_RemoveCourse (void); void Crs_RemoveCourse (void);
bool Crs_GetCourseDataByCod (struct Crs_Course *Crs); bool Crs_GetCourseDataByCod (struct Hie_Node *Crs);
void Crs_RemoveCourseCompletely (long CrsCod); void Crs_RemoveCourseCompletely (long CrsCod);
void Crs_ChangeInsCrsCod (void); void Crs_ChangeInsCrsCod (void);
void Crs_ChangeCrsYear (void); void Crs_ChangeCrsYear (void);
void Crs_UpdateInstitutionalCrsCod (struct Crs_Course *Crs, void Crs_UpdateInstitutionalCrsCod (struct Hie_Node *Crs,
const char *NewInstitutionalCrsCod); const char *NewInstitutionalCrsCod);
void Crs_UpdateCrsYear (struct Crs_Course *Crs,unsigned NewYear); void Crs_UpdateCrsYear (struct Hie_Node *Crs,unsigned NewYear);
void Crs_RenameCourseShort (void); void Crs_RenameCourseShort (void);
void Crs_RenameCourseFull (void); void Crs_RenameCourseFull (void);
void Crs_RenameCourse (struct Crs_Course *Crs,Cns_ShrtOrFullName_t ShrtOrFullName); void Crs_RenameCourse (struct Hie_Node *Crs,Cns_ShrtOrFullName_t ShrtOrFullName);
void Crs_ChangeCrsStatus (void); void Crs_ChangeCrsStatus (void);
void Crs_ContEditAfterChgCrs (void); void Crs_ContEditAfterChgCrs (void);

View File

@ -214,7 +214,7 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm)
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Degree; extern const char *Txt_Degree;
unsigned NumDeg; unsigned NumDeg;
const struct Deg_Degree *DegInLst; const struct Hie_Node *DegInLst;
/***** Degree *****/ /***** Degree *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -368,12 +368,12 @@ static void CrsCfg_InstitutionalCode (bool PutForm)
if (PutForm) if (PutForm)
{ {
Frm_BeginForm (ActChgInsCrsCodCfg); Frm_BeginForm (ActChgInsCrsCodCfg);
HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_COD, HTM_INPUT_TEXT ("InsCrsCod",Hie_MAX_CHARS_INSTITUTIONAL_COD,
Gbl.Hierarchy.Crs.InstitutionalCod, Gbl.Hierarchy.Crs.InstitutionalCod,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"id=\"InsCrsCod\" size=\"%u\"" "id=\"InsCrsCod\" size=\"%u\""
" class=\"INPUT_INS_CODE INPUT_%s\"", " class=\"INPUT_INS_CODE INPUT_%s\"",
Crs_MAX_CHARS_INSTITUTIONAL_COD, Hie_MAX_CHARS_INSTITUTIONAL_COD,
The_GetSuffix ()); The_GetSuffix ());
Frm_EndForm (); Frm_EndForm ();
} }
@ -478,7 +478,7 @@ void CrsCfg_ChangeCrsDeg (void)
extern const char *Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z; extern const char *Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE]; extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y; extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y;
struct Deg_Degree NewDeg; struct Hie_Node NewDeg;
/***** Get parameter with degree code *****/ /***** Get parameter with degree code *****/
NewDeg.Cod = ParCod_GetAndCheckPar (ParCod_OthDeg); NewDeg.Cod = ParCod_GetAndCheckPar (ParCod_OthDeg);
@ -594,10 +594,10 @@ void CrsCfg_ChangeInsCrsCod (void)
{ {
extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y; extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y;
extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed; extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed;
char NewInstitutionalCrsCod[Crs_MAX_BYTES_INSTITUTIONAL_COD + 1]; char NewInstitutionalCrsCod[Hie_MAX_BYTES_INSTITUTIONAL_COD + 1];
/***** Get institutional code from form *****/ /***** Get institutional code from form *****/
Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_COD); Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
/***** Change the institutional course code *****/ /***** Change the institutional course code *****/
if (strcmp (NewInstitutionalCrsCod,Gbl.Hierarchy.Crs.InstitutionalCod)) if (strcmp (NewInstitutionalCrsCod,Gbl.Hierarchy.Crs.InstitutionalCod))

View File

@ -47,7 +47,7 @@ extern struct Globals Gbl;
/************* Add a new requested course to pending requests ****************/ /************* Add a new requested course to pending requests ****************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_DB_CreateCourse (struct Crs_Course *Crs,Hie_Status_t Status) void Crs_DB_CreateCourse (struct Hie_Node *Crs,Hie_Status_t Status)
{ {
/***** Insert new course into pending requests *****/ /***** Insert new course into pending requests *****/
Crs->Cod = Crs->Cod =

View File

@ -35,7 +35,7 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Crs_DB_CreateCourse (struct Crs_Course *Crs,Hie_Status_t Status); void Crs_DB_CreateCourse (struct Hie_Node *Crs,Hie_Status_t Status);
unsigned Crs_DB_GetCrssInDeg (MYSQL_RES **mysql_res,long DegCod); unsigned Crs_DB_GetCrssInDeg (MYSQL_RES **mysql_res,long DegCod);
unsigned Crs_DB_GetCrssInCurrentDegBasic (MYSQL_RES **mysql_res); unsigned Crs_DB_GetCrssInCurrentDegBasic (MYSQL_RES **mysql_res);

View File

@ -77,14 +77,14 @@ typedef enum
/**************************** Private variables ******************************/ /**************************** Private variables ******************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Deg_Degree *Deg_EditingDeg = NULL; // Static variable to keep the degree being edited static struct Hie_Node *Deg_EditingDeg = NULL; // Static variable to keep the degree being edited
/*****************************************************************************/ /*****************************************************************************/
/**************************** Private prototypes *****************************/ /**************************** Private prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes); static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes);
static bool Deg_CheckIfICanEditADegree (struct Deg_Degree *Deg); static bool Deg_CheckIfICanEditADegree (struct Hie_Node *Deg);
static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes); static void Deg_PutFormToCreateDegree (const struct DegTyp_DegTypes *DegTypes);
static void Deg_PutHeadDegreesForSeeing (void); static void Deg_PutHeadDegreesForSeeing (void);
static void Deg_PutHeadDegreesForEdition (void); static void Deg_PutHeadDegreesForEdition (void);
@ -92,7 +92,7 @@ static void Deg_PutHeadDegreesForEdition (void);
static void Deg_ListDegrees (void); static void Deg_ListDegrees (void);
static void Deg_PutIconsListingDegrees (__attribute__((unused)) void *Args); static void Deg_PutIconsListingDegrees (__attribute__((unused)) void *Args);
static void Deg_PutIconToEditDegrees (void); static void Deg_PutIconToEditDegrees (void);
static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg); static void Deg_ListOneDegreeForSeeing (struct Hie_Node *Deg,unsigned NumDeg);
static void Deg_EditDegreesInternal (void); static void Deg_EditDegreesInternal (void);
static void Deg_PutIconsEditingDegrees (__attribute__((unused)) void *Args); static void Deg_PutIconsEditingDegrees (__attribute__((unused)) void *Args);
@ -100,7 +100,7 @@ static void Deg_PutIconsEditingDegrees (__attribute__((unused)) void *Args);
static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status); static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status);
static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res, static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res,
struct Deg_Degree *Deg); struct Hie_Node *Deg);
static void Deg_ShowAlertAndButtonToGoToDeg (void); static void Deg_ShowAlertAndButtonToGoToDeg (void);
@ -124,7 +124,7 @@ void Deg_SeeDegWithPendingCrss (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumDegs; unsigned NumDegs;
unsigned NumDeg; unsigned NumDeg;
struct Deg_Degree Deg; struct Hie_Node Deg;
const char *BgColor; const char *BgColor;
/***** Get degrees with pending courses *****/ /***** Get degrees with pending courses *****/
@ -190,7 +190,7 @@ void Deg_SeeDegWithPendingCrss (void)
/******************** Draw degree logo and name with link ********************/ /******************** Draw degree logo and name with link ********************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_DrawDegreeLogoAndNameWithLink (struct Deg_Degree *Deg,Act_Action_t Action, void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action,
const char *ClassLogo) const char *ClassLogo)
{ {
/***** Begin form *****/ /***** Begin form *****/
@ -315,7 +315,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
{ {
extern const char *Txt_DEGREE_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_DEGREE_STATUS[Hie_NUM_STATUS_TXT];
unsigned NumDeg; unsigned NumDeg;
struct Deg_Degree *DegInLst; struct Hie_Node *DegInLst;
unsigned NumDegTyp; unsigned NumDegTyp;
struct DegTyp_DegreeType *DegTypInLst; struct DegTyp_DegreeType *DegTypInLst;
char WWW[Cns_MAX_BYTES_WWW + 1]; char WWW[Cns_MAX_BYTES_WWW + 1];
@ -503,7 +503,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes)
/************** Check if I can edit, remove, etc. a degree *******************/ /************** Check if I can edit, remove, etc. a degree *******************/
/*****************************************************************************/ /*****************************************************************************/
static bool Deg_CheckIfICanEditADegree (struct Deg_Degree *Deg) static bool Deg_CheckIfICanEditADegree (struct Hie_Node *Deg)
{ {
return Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM || // I am a center administrator or higher return Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM || // I am a center administrator or higher
((Deg->Status & Hie_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated ((Deg->Status & Hie_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
@ -776,7 +776,7 @@ static void Deg_PutIconToEditDegrees (void)
/************************ List one degree for seeing *************************/ /************************ List one degree for seeing *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Deg_ListOneDegreeForSeeing (struct Deg_Degree *Deg,unsigned NumDeg) static void Deg_ListOneDegreeForSeeing (struct Hie_Node *Deg,unsigned NumDeg)
{ {
extern const char *Txt_DEGREE_With_courses; extern const char *Txt_DEGREE_With_courses;
extern const char *Txt_DEGREE_Without_courses; extern const char *Txt_DEGREE_Without_courses;
@ -955,7 +955,7 @@ void Deg_PutIconToViewDegrees (void)
/************ Create a list with all degrees that have students **************/ /************ Create a list with all degrees that have students **************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_GetListAllDegsWithStds (struct Deg_ListDegs *Degs) void Deg_GetListAllDegsWithStds (struct Hie_List *Degs)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumDeg; unsigned NumDeg;
@ -1015,7 +1015,7 @@ void Deg_GetListDegsInCurrentCtr (void)
/*************************** Free list of degrees ****************************/ /*************************** Free list of degrees ****************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_FreeListDegs (struct Deg_ListDegs *Degs) void Deg_FreeListDegs (struct Hie_List *Degs)
{ {
if (Degs->Lst) if (Degs->Lst)
{ {
@ -1146,7 +1146,7 @@ void Deg_RemoveDegree (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns true if degree found // Returns true if degree found
bool Deg_GetDegreeDataByCod (struct Deg_Degree *Deg) bool Deg_GetDegreeDataByCod (struct Hie_Node *Deg)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool DegFound = false; bool DegFound = false;
@ -1185,7 +1185,7 @@ bool Deg_GetDegreeDataByCod (struct Deg_Degree *Deg)
/*****************************************************************************/ /*****************************************************************************/
static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res, static void Deg_GetDegreeDataFromRow (MYSQL_RES *mysql_res,
struct Deg_Degree *Deg) struct Hie_Node *Deg)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -1299,7 +1299,7 @@ void Deg_RenameDegreeFull (void)
/************************ Change the name of a degree ************************/ /************************ Change the name of a degree ************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_RenameDegree (struct Deg_Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName) void Deg_RenameDegree (struct Hie_Node *Deg,Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
extern const char *Txt_The_degree_X_already_exists; extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_renamed_as_Y; extern const char *Txt_The_degree_X_has_been_renamed_as_Y;
@ -1715,7 +1715,7 @@ void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
extern const char *Txt_degrees; extern const char *Txt_degrees;
char *Title; char *Title;
unsigned NumDeg; unsigned NumDeg;
struct Deg_Degree Deg; struct Hie_Node Deg;
/***** Query database *****/ /***** Query database *****/
if (NumDegs) if (NumDegs)

View File

@ -43,40 +43,13 @@
#define Deg_MAX_DEGREES_PER_USR 20 // Used in list of my degrees #define Deg_MAX_DEGREES_PER_USR 20 // Used in list of my degrees
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
struct Deg_Degree
{
long Cod; // Degree code
long PrtCod; // Parent (center) code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Degree status
long RequesterUsrCod; // User code of the person who requested the creation of this degree
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Short name of degree
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; // Full name of degree
char WWW[Cns_MAX_BYTES_WWW + 1];
};
struct Deg_ListDegs
{
unsigned Num; // Number of degrees
struct Deg_Degree *Lst; // List of degrees
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_SeeDegWithPendingCrss (void); void Deg_SeeDegWithPendingCrss (void);
void Deg_DrawDegreeLogoAndNameWithLink (struct Deg_Degree *Deg,Act_Action_t Action, void Deg_DrawDegreeLogoAndNameWithLink (struct Hie_Node *Deg,Act_Action_t Action,
const char *ClassLogo); const char *ClassLogo);
void Deg_WriteSelectorOfDegree (void); void Deg_WriteSelectorOfDegree (void);
@ -89,19 +62,19 @@ void Deg_EditDegrees (void);
void Deg_PutIconToViewDegrees (void); void Deg_PutIconToViewDegrees (void);
void Deg_GetListAllDegsWithStds (struct Deg_ListDegs *Degs); void Deg_GetListAllDegsWithStds (struct Hie_List *Degs);
void Deg_GetListDegsInCurrentCtr (void); void Deg_GetListDegsInCurrentCtr (void);
void Deg_FreeListDegs (struct Deg_ListDegs *Degs); void Deg_FreeListDegs (struct Hie_List *Degs);
void Deg_ReceiveFormReqDeg (void); void Deg_ReceiveFormReqDeg (void);
void Deg_ReceiveFormNewDeg (void); void Deg_ReceiveFormNewDeg (void);
void Deg_RemoveDegree (void); void Deg_RemoveDegree (void);
bool Deg_GetDegreeDataByCod (struct Deg_Degree *Deg); bool Deg_GetDegreeDataByCod (struct Hie_Node *Deg);
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);
void Deg_RenameDegree (struct Deg_Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName); void Deg_RenameDegree (struct Hie_Node *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
void Deg_ChangeDegreeType (void); void Deg_ChangeDegreeType (void);
void Deg_ChangeDegWWW (void); void Deg_ChangeDegWWW (void);
void Deg_ChangeDegStatus (void); void Deg_ChangeDegStatus (void);

View File

@ -209,7 +209,7 @@ static void DegCfg_Center (bool PrintView,bool PutForm)
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Center; extern const char *Txt_Center;
unsigned NumCtr; unsigned NumCtr;
const struct Ctr_Center *CtrInLst; const struct Hie_Node *CtrInLst;
/***** Center *****/ /***** Center *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -364,7 +364,7 @@ void DegCfg_ChangeDegCtr (void)
{ {
extern const char *Txt_The_degree_X_already_exists; extern const char *Txt_The_degree_X_already_exists;
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y; extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
struct Ctr_Center NewCtr; struct Hie_Node NewCtr;
/***** Get parameter with center code *****/ /***** Get parameter with center code *****/
NewCtr.Cod = ParCod_GetAndCheckPar (ParCod_OthCtr); NewCtr.Cod = ParCod_GetAndCheckPar (ParCod_OthCtr);

View File

@ -54,7 +54,7 @@ void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE
/***************************** Create a new degree ***************************/ /***************************** Create a new degree ***************************/
/*****************************************************************************/ /*****************************************************************************/
void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status) void Deg_DB_CreateDegree (struct Hie_Node *Deg,Hie_Status_t Status)
{ {
Deg->Cod = Deg->Cod =
DB_QueryINSERTandReturnCode ("can not create a new degree", DB_QueryINSERTandReturnCode ("can not create a new degree",

View File

@ -38,7 +38,7 @@
/*****************************************************************************/ /*****************************************************************************/
void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]); void Deg_DB_CreateDegreeType (const char DegTypName[DegTyp_MAX_BYTES_DEGREE_TYPE_NAME + 1]);
void Deg_DB_CreateDegree (struct Deg_Degree *Deg,Hie_Status_t Status); void Deg_DB_CreateDegree (struct Hie_Node *Deg,Hie_Status_t Status);
unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Level); unsigned Deg_DB_GetNumDegreeTypes (HieLvl_Level_t Level);
unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res, unsigned Deg_DB_GetDegreeTypes (MYSQL_RES **mysql_res,

View File

@ -465,9 +465,9 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
extern const char *Txt_Another_institution; extern const char *Txt_Another_institution;
unsigned NumDpt; unsigned NumDpt;
struct Dpt_Department *DptInLst; struct Dpt_Department *DptInLst;
struct Ins_Instit Ins; struct Hie_Node Ins;
unsigned NumIns; unsigned NumIns;
struct Ins_Instit *InsInLst; struct Hie_Node *InsInLst;
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_BeginPadding (2); HTM_TABLE_BeginPadding (2);
@ -814,7 +814,7 @@ static void Dpt_PutFormToCreateDepartment (void)
{ {
extern const char *Txt_Another_institution; extern const char *Txt_Another_institution;
unsigned NumIns; unsigned NumIns;
const struct Ins_Instit *InsInLst; const struct Hie_Node *InsInLst;
/***** Begin form to create *****/ /***** Begin form to create *****/
Frm_BeginFormTable (ActNewDpt,NULL,NULL,NULL); Frm_BeginFormTable (ActNewDpt,NULL,NULL,NULL);

View File

@ -149,7 +149,7 @@ static bool Enr_CheckIfICanRemUsrFromCrs (void);
static void Enr_AskIfRemoveUsrFromCrs (struct Usr_Data *UsrDat); static void Enr_AskIfRemoveUsrFromCrs (struct Usr_Data *UsrDat);
static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat, static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
struct Crs_Course *Crs, struct Hie_Node *Crs,
Enr_RemoveUsrProduction_t RemoveUsrWorks, Enr_RemoveUsrProduction_t RemoveUsrWorks,
Cns_QuietOrVerbose_t QuietOrVerbose); Cns_QuietOrVerbose_t QuietOrVerbose);
@ -1773,7 +1773,7 @@ void Enr_RemAllStdsThisCrs (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns the numbers of students in list // Returns the numbers of students in list
unsigned Enr_RemAllStdsInCrs (struct Crs_Course *Crs) unsigned Enr_RemAllStdsInCrs (struct Hie_Node *Crs)
{ {
unsigned NumStdsInCrs; unsigned NumStdsInCrs;
unsigned NumUsr; unsigned NumUsr;
@ -2111,8 +2111,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
unsigned NumReqs; unsigned NumReqs;
unsigned NumReq; unsigned NumReq;
long ReqCod; long ReqCod;
struct Deg_Degree Deg; struct Hie_Node Deg;
struct Crs_Course Crs; struct Hie_Node Crs;
struct Usr_Data UsrDat; struct Usr_Data UsrDat;
bool UsrExists; bool UsrExists;
bool UsrBelongsToCrs; bool UsrBelongsToCrs;
@ -3128,7 +3128,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct Usr_Data *UsrDat)
/*****************************************************************************/ /*****************************************************************************/
static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat, static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
struct Crs_Course *Crs, struct Hie_Node *Crs,
Enr_RemoveUsrProduction_t RemoveUsrWorks, Enr_RemoveUsrProduction_t RemoveUsrWorks,
Cns_QuietOrVerbose_t QuietOrVerbose) Cns_QuietOrVerbose_t QuietOrVerbose)
{ {

View File

@ -106,7 +106,7 @@ bool Enr_PutActionsRegRemOneUsr (Usr_MeOrOther_t MeOrOther);
void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role); void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role);
void Enr_AskRemAllStdsThisCrs (void); void Enr_AskRemAllStdsThisCrs (void);
void Enr_RemAllStdsThisCrs (void); void Enr_RemAllStdsThisCrs (void);
unsigned Enr_RemAllStdsInCrs (struct Crs_Course *Crs); unsigned Enr_RemAllStdsInCrs (struct Hie_Node *Crs);
void Enr_ReqSignUpInCrs (void); void Enr_ReqSignUpInCrs (void);
void Enr_SignUpInCrs (void); void Enr_SignUpInCrs (void);
void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],

View File

@ -166,11 +166,11 @@ void Gbl_InitializeGlobals (void)
Gbl.Hierarchy.Ctys.Num = 0; Gbl.Hierarchy.Ctys.Num = 0;
Gbl.Hierarchy.Ctys.Lst = NULL; Gbl.Hierarchy.Ctys.Lst = NULL;
Gbl.Hierarchy.Ctys.SelectedOrder = Cty_ORDER_DEFAULT; Gbl.Hierarchy.Ctys.SelectedOrder = Hie_ORDER_DEFAULT;
Gbl.Hierarchy.Inss.Num = 0; Gbl.Hierarchy.Inss.Num = 0;
Gbl.Hierarchy.Inss.Lst = NULL; Gbl.Hierarchy.Inss.Lst = NULL;
Gbl.Hierarchy.Inss.SelectedOrder = Ins_ORDER_DEFAULT; Gbl.Hierarchy.Inss.SelectedOrder = Hie_ORDER_DEFAULT;
Gbl.Hierarchy.Ins.ShrtName[0] = '\0'; Gbl.Hierarchy.Ins.ShrtName[0] = '\0';
Gbl.Hierarchy.Ins.FullName[0] = '\0'; Gbl.Hierarchy.Ins.FullName[0] = '\0';
@ -178,7 +178,7 @@ void Gbl_InitializeGlobals (void)
Gbl.Hierarchy.Ctrs.Num = 0; Gbl.Hierarchy.Ctrs.Num = 0;
Gbl.Hierarchy.Ctrs.Lst = NULL; Gbl.Hierarchy.Ctrs.Lst = NULL;
Gbl.Hierarchy.Ctrs.SelectedOrder = Ctr_ORDER_DEFAULT; Gbl.Hierarchy.Ctrs.SelectedOrder = Hie_ORDER_DEFAULT;
Gbl.Hierarchy.Ctr.ShrtName[0] = '\0'; Gbl.Hierarchy.Ctr.ShrtName[0] = '\0';
Gbl.Hierarchy.Ctr.FullName[0] = '\0'; Gbl.Hierarchy.Ctr.FullName[0] = '\0';

View File

@ -41,6 +41,7 @@
#include "swad_enrolment.h" #include "swad_enrolment.h"
#include "swad_file.h" #include "swad_file.h"
#include "swad_group.h" #include "swad_group.h"
#include "swad_hierarchy.h"
#include "swad_mail.h" #include "swad_mail.h"
#include "swad_record.h" #include "swad_record.h"
@ -89,16 +90,16 @@ struct Globals
{ {
HieLvl_Level_t Level; // Current level in the hierarchy: system, country, institution, center, degree or course HieLvl_Level_t Level; // Current level in the hierarchy: system, country, institution, center, degree or course
long Cod; // Code of the current country, institution, center, degree or course long Cod; // Code of the current country, institution, center, degree or course
struct Cty_ListCtys Ctys; // List of countries struct Hie_List Ctys; // List of countries
struct Cty_Countr Cty; // Current country struct Hie_List Inss; // List of institutions in current country
struct Ins_ListInss Inss; // List of institutions in current country struct Hie_List Ctrs; // List of centers in current institution
struct Ins_Instit Ins; // Current institution struct Hie_List Degs; // List of degrees in current center
struct Ctr_ListCtrs Ctrs; // List of centers in current institution struct Hie_List Crss; // List of courses in current degree
struct Ctr_Center Ctr; // Current center struct Hie_Node Cty; // Current country
struct Deg_ListDegs Degs; // List of degrees in current center struct Hie_Node Ins; // Current institution
struct Deg_Degree Deg; // Current degree struct Hie_Node Ctr; // Current center
struct Crs_ListCrss Crss; // List of courses in current degree struct Hie_Node Deg; // Current degree
struct Crs_Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs. struct Hie_Node Crs; // Current course. Aditional info about course is stored in Gbl.Crs.
} Hierarchy; } Hierarchy;
struct struct
{ {

View File

@ -933,6 +933,19 @@ void Hie_PutParOtherHieCod (void *HieCod)
ParCod_PutPar (ParCod_OthHie,*((long *) HieCod)); ParCod_PutPar (ParCod_OthHie,*((long *) HieCod));
} }
/*****************************************************************************/
/****** Get parameter with the type or order in list of hierarchy nodes ******/
/*****************************************************************************/
void Hie_GetParHieOrder (void)
{
Gbl.Hierarchy.Inss.SelectedOrder = (Hie_Order_t)
Par_GetParUnsignedLong ("Order",
0,
Hie_NUM_ORDERS - 1,
(unsigned long) Hie_ORDER_DEFAULT);
}
/*****************************************************************************/ /*****************************************************************************/
/********* Get and show stats about hierarchy ***********/ /********* Get and show stats about hierarchy ***********/
/********* (countries, institutions, centers, degrees and courses) ***********/ /********* (countries, institutions, centers, degrees and courses) ***********/

View File

@ -39,11 +39,11 @@
struct Hie_Hierarchy struct Hie_Hierarchy
{ {
struct Cty_Countr Cty; struct Hie_Node Cty;
struct Ins_Instit Ins; struct Hie_Node Ins;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Deg_Degree Deg; struct Hie_Node Deg;
struct Crs_Course Crs; struct Hie_Node Crs;
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -73,6 +73,8 @@ void Hie_WriteStatusCellEditable (bool ICanEdit,Hie_Status_t Status,
Hie_Status_t Hie_GetParStatus (void); Hie_Status_t Hie_GetParStatus (void);
void Hie_PutParOtherHieCod (void *HieCod); void Hie_PutParOtherHieCod (void *HieCod);
void Hie_GetParHieOrder (void);
//-------------------------------- Figures ------------------------------------ //-------------------------------- Figures ------------------------------------
void Hie_GetAndShowHierarchyStats (void); void Hie_GetAndShowHierarchyStats (void);

View File

@ -23,6 +23,13 @@
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_constant.h"
#include "swad_string.h"
/*****************************************************************************/ /*****************************************************************************/
/******************************* Public types ********************************/ /******************************* Public types ********************************/
/*****************************************************************************/ /*****************************************************************************/
@ -59,4 +66,45 @@ typedef enum
Hie_STATUS_REMOVED = 3, // 1- (Status & Hie_STATUS_BIT_REMOVED) Hie_STATUS_REMOVED = 3, // 1- (Status & Hie_STATUS_BIT_REMOVED)
} Hie_StatusTxt_t; } Hie_StatusTxt_t;
#define Hie_MAX_CHARS_INSTITUTIONAL_COD (16 - 1) // 15
#define Hie_MAX_BYTES_INSTITUTIONAL_COD ((Hie_MAX_CHARS_INSTITUTIONAL_COD + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 255
struct Hie_Node
{
long Cod; // Course/degree/center/institution/country code
long PrtCod; // Parent code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Node status
long RequesterUsrCod; // User code of the person who requested the creation of this node
char InstitutionalCod[Hie_MAX_BYTES_INSTITUTIONAL_COD + 1]; // Institutional code of the node
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; // Short name of the node
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; // Full name of the node
char WWW[Cns_MAX_BYTES_WWW + 1];
struct
{
bool Valid;
unsigned NumUsrs;
} NumUsrsWhoClaimToBelong;
};
#define Hie_NUM_ORDERS 2
typedef enum
{
Hie_ORDER_BY_NAME = 0,
Hie_ORDER_BY_NUM_USRS = 1,
} Hie_Order_t;
#define Hie_ORDER_DEFAULT Hie_ORDER_BY_NUM_USRS
struct Hie_List
{
unsigned Num; // Number of courses
struct Hie_Node *Lst; // List of courses
Hie_Order_t SelectedOrder; // Order of centers
};
#endif #endif

View File

@ -68,7 +68,7 @@ extern struct Globals Gbl;
/***************************** Private variables *****************************/ /***************************** Private variables *****************************/
/*****************************************************************************/ /*****************************************************************************/
static struct Ins_Instit *Ins_EditingIns = NULL; // Static variable to keep the institution being edited static struct Hie_Node *Ins_EditingIns = NULL; // Static variable to keep the institution being edited
/*****************************************************************************/ /*****************************************************************************/
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
@ -77,19 +77,18 @@ static struct Ins_Instit *Ins_EditingIns = NULL; // Static variable to keep the
static void Ins_ListInstitutions (void); static void Ins_ListInstitutions (void);
static void Ins_PutIconsListingInstitutions (__attribute__((unused)) void *Args); static void Ins_PutIconsListingInstitutions (__attribute__((unused)) void *Args);
static void Ins_PutIconToEditInstitutions (void); static void Ins_PutIconToEditInstitutions (void);
static void Ins_ListOneInstitutionForSeeing (struct Ins_Instit *Ins,unsigned NumIns); static void Ins_ListOneInstitutionForSeeing (struct Hie_Node *Ins,unsigned NumIns);
static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable); static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable);
static void Ins_GetParInsOrder (void);
static void Ins_EditInstitutionsInternal (void); static void Ins_EditInstitutionsInternal (void);
static void Ins_PutIconsEditingInstitutions (__attribute__((unused)) void *Args); static void Ins_PutIconsEditingInstitutions (__attribute__((unused)) void *Args);
static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res, static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res,
struct Ins_Instit *Ins, struct Hie_Node *Ins,
bool GetNumUsrsWhoClaimToBelongToIns); bool GetNumUsrsWhoClaimToBelongToIns);
static void Ins_ListInstitutionsForEdition (void); static void Ins_ListInstitutionsForEdition (void);
static bool Ins_CheckIfICanEdit (struct Ins_Instit *Ins); static bool Ins_CheckIfICanEdit (struct Hie_Node *Ins);
static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewInsName); static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *NewInsName);
@ -102,7 +101,7 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status);
static void Ins_EditingInstitutionConstructor (); static void Ins_EditingInstitutionConstructor ();
static void Ins_EditingInstitutionDestructor (); static void Ins_EditingInstitutionDestructor ();
static void Ins_FormToGoToMap (struct Ins_Instit *Ins); static void Ins_FormToGoToMap (struct Hie_Node *Ins);
static void Ins_GetAndShowInssOrderedByNumCtrs (void); static void Ins_GetAndShowInssOrderedByNumCtrs (void);
static void Ins_GetAndShowInssOrderedByNumDegs (void); static void Ins_GetAndShowInssOrderedByNumDegs (void);
@ -111,7 +110,7 @@ static void Ins_GetAndShowInssOrderedByNumUsrsInCrss (void);
static void Ins_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void); static void Ins_GetAndShowInssOrderedByNumUsrsWhoClaimToBelongToThem (void);
static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss, static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
const char *TxtFigure); const char *TxtFigure);
static unsigned Ins_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res); static unsigned Ins_GetInsAndStat (struct Hie_Node *Ins,MYSQL_RES *mysql_res);
/*****************************************************************************/ /*****************************************************************************/
/***************** List institutions with pending centers ********************/ /***************** List institutions with pending centers ********************/
@ -128,7 +127,7 @@ void Ins_SeeInsWithPendingCtrs (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumInss = 0; unsigned NumInss = 0;
unsigned NumIns; unsigned NumIns;
struct Ins_Instit Ins; struct Hie_Node Ins;
const char *BgColor; const char *BgColor;
/***** Get institutions with pending centers *****/ /***** Get institutions with pending centers *****/
@ -206,7 +205,7 @@ void Ins_SeeInsWithPendingCtrs (void)
/********************** Draw institution logo with link **********************/ /********************** Draw institution logo with link **********************/
/*****************************************************************************/ /*****************************************************************************/
void Ins_DrawInstitutionLogoWithLink (struct Ins_Instit *Ins,unsigned Size) void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,unsigned Size)
{ {
bool PutLink = !Frm_CheckIfInside (); // Don't put link to institution if already inside a form bool PutLink = !Frm_CheckIfInside (); // Don't put link to institution if already inside a form
@ -228,7 +227,7 @@ void Ins_DrawInstitutionLogoWithLink (struct Ins_Instit *Ins,unsigned Size)
/****************** Draw institution logo and name with link *****************/ /****************** Draw institution logo and name with link *****************/
/*****************************************************************************/ /*****************************************************************************/
void Ins_DrawInstitLogoAndNameWithLink (struct Ins_Instit *Ins,Act_Action_t Action, void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action,
const char *ClassLogo) const char *ClassLogo)
{ {
/***** Begin form *****/ /***** Begin form *****/
@ -263,7 +262,7 @@ void Ins_ShowInssOfCurrentCty (void)
if (Gbl.Hierarchy.Cty.Cod > 0) if (Gbl.Hierarchy.Cty.Cod > 0)
{ {
/***** Get parameter with the type of order in the list of institutions *****/ /***** Get parameter with the type of order in the list of institutions *****/
Ins_GetParInsOrder (); Hie_GetParHieOrder ();
/***** Get list of institutions *****/ /***** Get list of institutions *****/
Ins_GetFullListOfInstitutions (Gbl.Hierarchy.Cty.Cod); Ins_GetFullListOfInstitutions (Gbl.Hierarchy.Cty.Cod);
@ -349,7 +348,7 @@ static void Ins_PutIconToEditInstitutions (void)
/********************** List one institution for seeing **********************/ /********************** List one institution for seeing **********************/
/*****************************************************************************/ /*****************************************************************************/
static void Ins_ListOneInstitutionForSeeing (struct Ins_Instit *Ins,unsigned NumIns) static void Ins_ListOneInstitutionForSeeing (struct Hie_Node *Ins,unsigned NumIns)
{ {
extern const char *Txt_INSTITUTION_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_INSTITUTION_STATUS[Hie_NUM_STATUS_TXT];
const char *TxtClassNormal; const char *TxtClassNormal;
@ -442,18 +441,18 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Degrees_ABBREVIATION;
extern const char *Txt_Courses_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION;
extern const char *Txt_Departments_ABBREVIATION; extern const char *Txt_Departments_ABBREVIATION;
Ins_Order_t Order; Hie_Order_t Order;
static HTM_HeadAlign Align[Ins_NUM_ORDERS] = static HTM_HeadAlign Align[Hie_NUM_ORDERS] =
{ {
[Ins_ORDER_BY_INSTITUTION] = HTM_HEAD_LEFT, [Hie_ORDER_BY_NAME ] = HTM_HEAD_LEFT,
[Ins_ORDER_BY_NUM_USRS ] = HTM_HEAD_RIGHT [Hie_ORDER_BY_NUM_USRS] = HTM_HEAD_RIGHT
}; };
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Empty (1); HTM_TH_Empty (1);
for (Order = (Ins_Order_t) 0; for (Order = (Hie_Order_t) 0;
Order <= (Ins_Order_t) (Ins_NUM_ORDERS - 1); Order <= (Hie_Order_t) (Hie_NUM_ORDERS - 1);
Order++) Order++)
{ {
HTM_TH_Begin (Align[Order]); HTM_TH_Begin (Align[Order]);
@ -490,19 +489,6 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable)
HTM_TR_End (); HTM_TR_End ();
} }
/*****************************************************************************/
/******* Get parameter with the type or order in list of institutions ********/
/*****************************************************************************/
static void Ins_GetParInsOrder (void)
{
Gbl.Hierarchy.Inss.SelectedOrder = (Ins_Order_t)
Par_GetParUnsignedLong ("Order",
0,
Ins_NUM_ORDERS - 1,
(unsigned long) Ins_ORDER_DEFAULT);
}
/*****************************************************************************/ /*****************************************************************************/
/************************ Put forms to edit institutions *********************/ /************************ Put forms to edit institutions *********************/
/*****************************************************************************/ /*****************************************************************************/
@ -639,7 +625,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
void Ins_WriteInstitutionNameAndCty (long InsCod) void Ins_WriteInstitutionNameAndCty (long InsCod)
{ {
struct Ins_Instit Ins; struct Hie_Node Ins;
char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
/***** Get institution short name and country name *****/ /***** Get institution short name and country name *****/
@ -654,7 +640,7 @@ void Ins_WriteInstitutionNameAndCty (long InsCod)
/************************* Get data of an institution ************************/ /************************* Get data of an institution ************************/
/*****************************************************************************/ /*****************************************************************************/
bool Ins_GetInstitDataByCod (struct Ins_Instit *Ins) bool Ins_GetInstitDataByCod (struct Hie_Node *Ins)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
bool InsFound = false; bool InsFound = false;
@ -694,7 +680,7 @@ bool Ins_GetInstitDataByCod (struct Ins_Instit *Ins)
/*****************************************************************************/ /*****************************************************************************/
static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res, static void Ins_GetInstitDataFromRow (MYSQL_RES *mysql_res,
struct Ins_Instit *Ins, struct Hie_Node *Ins,
bool GetNumUsrsWhoClaimToBelongToIns) bool GetNumUsrsWhoClaimToBelongToIns)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -749,7 +735,7 @@ void Ins_FlushCacheFullNameAndCtyOfInstitution (void)
Gbl.Cache.InstitutionShrtNameAndCty.CtyName[0] = '\0'; Gbl.Cache.InstitutionShrtNameAndCty.CtyName[0] = '\0';
} }
void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins, void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]) char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1])
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
@ -895,7 +881,7 @@ static void Ins_ListInstitutionsForEdition (void)
{ {
extern const char *Txt_INSTITUTION_STATUS[Hie_NUM_STATUS_TXT]; extern const char *Txt_INSTITUTION_STATUS[Hie_NUM_STATUS_TXT];
unsigned NumIns; unsigned NumIns;
struct Ins_Instit *Ins; struct Hie_Node *Ins;
char WWW[Cns_MAX_BYTES_WWW + 1]; char WWW[Cns_MAX_BYTES_WWW + 1];
struct Usr_Data UsrDat; struct Usr_Data UsrDat;
bool ICanEdit; bool ICanEdit;
@ -1055,7 +1041,7 @@ static void Ins_ListInstitutionsForEdition (void)
/************ Check if I can edit, remove, etc. an institution ***************/ /************ Check if I can edit, remove, etc. an institution ***************/
/*****************************************************************************/ /*****************************************************************************/
static bool Ins_CheckIfICanEdit (struct Ins_Instit *Ins) static bool Ins_CheckIfICanEdit (struct Hie_Node *Ins)
{ {
return Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM || // I am a superuser return Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM || // I am a superuser
((Ins->Status & Hie_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated ((Ins->Status & Hie_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated
@ -1168,7 +1154,7 @@ void Ins_RenameInsFull (void)
/******************** Change the name of an institution **********************/ /******************** Change the name of an institution **********************/
/*****************************************************************************/ /*****************************************************************************/
void Ins_RenameInstitution (struct Ins_Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName) void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFullName)
{ {
extern const char *Txt_The_institution_X_already_exists; extern const char *Txt_The_institution_X_already_exists;
extern const char *Txt_The_institution_X_has_been_renamed_as_Y; extern const char *Txt_The_institution_X_has_been_renamed_as_Y;
@ -1732,7 +1718,7 @@ void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss)
extern const char *Txt_institutions; extern const char *Txt_institutions;
char *Title; char *Title;
unsigned NumIns; unsigned NumIns;
struct Ins_Instit Ins; struct Hie_Node Ins;
/***** List the institutions (one row per institution) *****/ /***** List the institutions (one row per institution) *****/
if (NumInss) if (NumInss)
@ -1808,7 +1794,7 @@ static void Ins_EditingInstitutionDestructor (void)
/********************* Form to go to institution map *************************/ /********************* Form to go to institution map *************************/
/*****************************************************************************/ /*****************************************************************************/
static void Ins_FormToGoToMap (struct Ins_Instit *Ins) static void Ins_FormToGoToMap (struct Hie_Node *Ins)
{ {
if (Ctr_DB_CheckIfMapIsAvailableInIns (Ins->Cod)) if (Ctr_DB_CheckIfMapIsAvailableInIns (Ins->Cod))
{ {
@ -1941,7 +1927,7 @@ void Ins_FlushCacheNumUsrsWhoClaimToBelongToIns (void)
Gbl.Cache.NumUsrsWhoClaimToBelongToIns.NumUsrs = 0; Gbl.Cache.NumUsrsWhoClaimToBelongToIns.NumUsrs = 0;
} }
unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins) unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Hie_Node *Ins)
{ {
/***** 1. Fast check: Trivial case *****/ /***** 1. Fast check: Trivial case *****/
if (Ins->Cod <= 0) if (Ins->Cod <= 0)
@ -1970,7 +1956,7 @@ unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins)
return Ins->NumUsrsWhoClaimToBelong.NumUsrs; return Ins->NumUsrsWhoClaimToBelong.NumUsrs;
} }
unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins) unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Hie_Node *Ins)
{ {
unsigned NumUsrsIns; unsigned NumUsrsIns;
@ -2191,7 +2177,7 @@ static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
unsigned NumOrder; unsigned NumOrder;
unsigned NumberLastRow; unsigned NumberLastRow;
unsigned NumberThisRow; unsigned NumberThisRow;
struct Ins_Instit Ins; struct Hie_Node Ins;
bool TRIsOpen = false; bool TRIsOpen = false;
/***** Query database *****/ /***** Query database *****/
@ -2297,7 +2283,7 @@ static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
/******************** Get institution data and statistic *********************/ /******************** Get institution data and statistic *********************/
/*****************************************************************************/ /*****************************************************************************/
static unsigned Ins_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res) static unsigned Ins_GetInsAndStat (struct Hie_Node *Ins,MYSQL_RES *mysql_res)
{ {
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumberThisRow; unsigned NumberThisRow;

View File

@ -37,51 +37,14 @@
#define Ins_MAX_INSTITS_PER_USR 10 // Used in list of my institutions #define Ins_MAX_INSTITS_PER_USR 10 // Used in list of my institutions
struct Ins_Instit
{
long Cod; // Institution code
long PrtCod; // Parent (country) code
union
{
long PlcCod; // Center place code
long TypCod; // Degree type code
unsigned Year; // Course year: 0 (optatives), 1, 2, 3...
} Specific;
Hie_Status_t Status; // Institution status
long RequesterUsrCod; // User code of the person who requested the creation of this institution
char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
char WWW[Cns_MAX_BYTES_WWW + 1];
struct
{
bool Valid;
unsigned NumUsrs;
} NumUsrsWhoClaimToBelong;
};
#define Ins_NUM_ORDERS 2
typedef enum
{
Ins_ORDER_BY_INSTITUTION = 0,
Ins_ORDER_BY_NUM_USRS = 1,
} Ins_Order_t;
#define Ins_ORDER_DEFAULT Ins_ORDER_BY_NUM_USRS
struct Ins_ListInss
{
unsigned Num; // Number of institutions
struct Ins_Instit *Lst; // List of institutions
Ins_Order_t SelectedOrder; // Order of institutions
};
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Ins_SeeInsWithPendingCtrs (void); void Ins_SeeInsWithPendingCtrs (void);
void Ins_DrawInstitutionLogoWithLink (struct Ins_Instit *Ins,unsigned Size); void Ins_DrawInstitutionLogoWithLink (struct Hie_Node *Ins,unsigned Size);
void Ins_DrawInstitLogoAndNameWithLink (struct Ins_Instit *Ins,Act_Action_t Action, void Ins_DrawInstitLogoAndNameWithLink (struct Hie_Node *Ins,Act_Action_t Action,
const char *ClassLogo); const char *ClassLogo);
void Ins_ShowInssOfCurrentCty (void); void Ins_ShowInssOfCurrentCty (void);
@ -90,9 +53,9 @@ 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 Ins_Instit *Ins); bool Ins_GetInstitDataByCod (struct Hie_Node *Ins);
void Ins_FlushCacheFullNameAndCtyOfInstitution (void); void Ins_FlushCacheFullNameAndCtyOfInstitution (void);
void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins, void Ins_GetShrtNameAndCtyOfInstitution (struct Hie_Node *Ins,
char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]); char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]);
void Ins_FreeListInstitutions (void); void Ins_FreeListInstitutions (void);
@ -101,7 +64,7 @@ void Ins_WriteSelectorOfInstitution (void);
void Ins_RemoveInstitution (void); void Ins_RemoveInstitution (void);
void Ins_RenameInsShort (void); void Ins_RenameInsShort (void);
void Ins_RenameInsFull (void); void Ins_RenameInsFull (void);
void Ins_RenameInstitution (struct Ins_Instit *Ins,Cns_ShrtOrFullName_t ShrtOrFullName); void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFullName);
void Ins_ChangeInsWWW (void); void Ins_ChangeInsWWW (void);
void Ins_ChangeInsStatus (void); void Ins_ChangeInsStatus (void);
void Ins_ContEditAfterChgIns (void); void Ins_ContEditAfterChgIns (void);
@ -129,8 +92,8 @@ void Ins_FlushCacheUsrBelongsToIns (void);
bool Ins_CheckIfUsrBelongsToIns (long UsrCod,long InsCod); bool Ins_CheckIfUsrBelongsToIns (long UsrCod,long InsCod);
void Ins_FlushCacheNumUsrsWhoClaimToBelongToIns (void); void Ins_FlushCacheNumUsrsWhoClaimToBelongToIns (void);
unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins); unsigned Ins_GetNumUsrsWhoClaimToBelongToIns (struct Hie_Node *Ins);
unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Ins_Instit *Ins); unsigned Ins_GetCachedNumUsrsWhoClaimToBelongToIns (struct Hie_Node *Ins);
void Ins_PutParInsCod (void *InsCod); void Ins_PutParInsCod (void *InsCod);

View File

@ -249,7 +249,7 @@ static void InsCfg_Map (void)
unsigned Zoom; unsigned Zoom;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumCtr; unsigned NumCtr;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Map_Coordinates Coord; struct Map_Coordinates Coord;
struct Map_Coordinates InsAvgCoord; struct Map_Coordinates InsAvgCoord;
@ -313,7 +313,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
extern const char *Par_CodeStr[]; extern const char *Par_CodeStr[];
extern const char *Txt_Country; extern const char *Txt_Country;
unsigned NumCty; unsigned NumCty;
const struct Cty_Countr *CtyInLst; const struct Hie_Node *CtyInLst;
/***** Get list of countries *****/ /***** Get list of countries *****/
Cty_GetBasicListOfCountries (); Cty_GetBasicListOfCountries ();
@ -547,7 +547,7 @@ void InsCfg_ChangeInsCty (void)
{ {
extern const char *Txt_The_institution_X_already_exists; extern const char *Txt_The_institution_X_already_exists;
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y; extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
struct Cty_Countr NewCty; struct Hie_Node NewCty;
/***** Get the new country code for the institution *****/ /***** Get the new country code for the institution *****/
NewCty.Cod = ParCod_GetAndCheckPar (ParCod_OthCty); NewCty.Cod = ParCod_GetAndCheckPar (ParCod_OthCty);

View File

@ -47,7 +47,7 @@ extern struct Globals Gbl;
/************************** Create a new institution *************************/ /************************** Create a new institution *************************/
/*****************************************************************************/ /*****************************************************************************/
long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,Hie_Status_t Status) long Ins_DB_CreateInstitution (const struct Hie_Node *Ins,Hie_Status_t Status)
{ {
return return
DB_QueryINSERTandReturnCode ("can not create institution", DB_QueryINSERTandReturnCode ("can not create institution",
@ -297,11 +297,11 @@ unsigned Ins_DB_GetInssInCtyOrderedByFullName (MYSQL_RES **mysql_res,long CtyCod
unsigned Ins_DB_GetFullListOfInssInCty (MYSQL_RES **mysql_res,long CtyCod) unsigned Ins_DB_GetFullListOfInssInCty (MYSQL_RES **mysql_res,long CtyCod)
{ {
static const char *OrderBySubQuery[Ins_NUM_ORDERS] = static const char *OrderBySubQuery[Hie_NUM_ORDERS] =
{ {
[Ins_ORDER_BY_INSTITUTION] = "FullName", [Hie_ORDER_BY_NAME ] = "FullName",
[Ins_ORDER_BY_NUM_USRS ] = "NumUsrs DESC," [Hie_ORDER_BY_NUM_USRS] = "NumUsrs DESC,"
"FullName", "FullName",
}; };
/***** Get institutions from database *****/ /***** Get institutions from database *****/

View File

@ -37,7 +37,7 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
long Ins_DB_CreateInstitution (const struct Ins_Instit *Ins,Hie_Status_t Status); long Ins_DB_CreateInstitution (const struct Hie_Node *Ins,Hie_Status_t Status);
void Ins_DB_UpdateInsCty (long InsCod,long CtyCod); void Ins_DB_UpdateInsCty (long InsCod,long CtyCod);
void Ins_DB_UpdateInsStatus (long InsCod,Hie_Status_t Status); void Ins_DB_UpdateInsStatus (long InsCod,Hie_Status_t Status);
void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewInsName); void Ins_DB_UpdateInsName (long InsCod,const char *FldName,const char *NewInsName);

View File

@ -1104,7 +1104,7 @@ static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs)
static void Msg_GetParMsgsCrsCod (struct Msg_Messages *Messages) static void Msg_GetParMsgsCrsCod (struct Msg_Messages *Messages)
{ {
extern const char *Txt_any_course; extern const char *Txt_any_course;
struct Crs_Course Crs; struct Hie_Node Crs;
if ((Messages->FilterCrsCod = ParCod_GetPar (ParCod_OthCrs)) > 0) // If origin course specified if ((Messages->FilterCrsCod = ParCod_GetPar (ParCod_OthCrs)) > 0) // If origin course specified
{ {
@ -2302,7 +2302,7 @@ static bool Msg_WriteCrsOrgMsg (long CrsCod)
{ {
extern const char *Txt_from_this_course; extern const char *Txt_from_this_course;
extern const char *Txt_no_course_of_origin; extern const char *Txt_no_course_of_origin;
struct Crs_Course Crs; struct Hie_Node Crs;
bool FromThisCrs = true; bool FromThisCrs = true;
bool ThereIsOrgCrs = false; bool ThereIsOrgCrs = false;

View File

@ -128,7 +128,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
Pho_AvgPhotoSeeOrPrint_t SeeOrPrint); Pho_AvgPhotoSeeOrPrint_t SeeOrPrint);
static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto); static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto);
static void Pho_ShowDegreeAvgPhotoAndStat (const struct Deg_Degree *Deg, static void Pho_ShowDegreeAvgPhotoAndStat (const struct Hie_Node *Deg,
const struct Pho_DegPhotos *DegPhotos, const struct Pho_DegPhotos *DegPhotos,
Pho_AvgPhotoSeeOrPrint_t SeeOrPrint, Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,
Usr_Sex_t Sex, Usr_Sex_t Sex,
@ -1073,7 +1073,7 @@ void Pho_BuildHTMLUsrPhoto (const struct Usr_Data *UsrDat,const char *PhotoURL,
BrowserTabIs1stTab; // Only in main browser tab (or AJAX) BrowserTabIs1stTab; // Only in main browser tab (or AJAX)
char IdCaption[Frm_MAX_BYTES_ID + 1]; char IdCaption[Frm_MAX_BYTES_ID + 1];
char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
struct Ins_Instit Ins; struct Hie_Node Ins;
char MainDegreeShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]; char MainDegreeShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
Rol_Role_t MaxRole; // Maximum user's role in his/her main degree Rol_Role_t MaxRole; // Maximum user's role in his/her main degree
struct struct
@ -1996,9 +1996,9 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh
extern const char *Txt_Calculate_average_photo_of_THE_DEGREE_X; extern const char *Txt_Calculate_average_photo_of_THE_DEGREE_X;
extern const char *Txt_unknown_TIME; extern const char *Txt_unknown_TIME;
extern const char *Txt_time; extern const char *Txt_time;
struct Deg_ListDegs Degs; struct Hie_List Degs;
unsigned NumDeg; unsigned NumDeg;
struct Deg_Degree Deg; struct Hie_Node Deg;
long EstimatedTimeToComputeAvgPhotoInMicroseconds; long EstimatedTimeToComputeAvgPhotoInMicroseconds;
char StrEstimatedTimeToComputeAvgPhoto[Dat_MAX_BYTES_TIME + 1]; char StrEstimatedTimeToComputeAvgPhoto[Dat_MAX_BYTES_TIME + 1];
HTM_OptionSelected_t Selected; HTM_OptionSelected_t Selected;
@ -2123,7 +2123,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (struct Pho_DegPhotos *DegPhotos,
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned long NumDeg; unsigned long NumDeg;
unsigned long NumDegs; unsigned long NumDegs;
struct Deg_Degree Deg; struct Hie_Node Deg;
unsigned NumDegsNotEmpty; unsigned NumDegsNotEmpty;
int NumStds; int NumStds;
int NumStdsWithPhoto; int NumStdsWithPhoto;
@ -2207,7 +2207,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
unsigned NumDegsNotEmpty; unsigned NumDegsNotEmpty;
int NumStds; int NumStds;
int NumStdsWithPhoto; int NumStdsWithPhoto;
struct Deg_Degree Deg; struct Hie_Node Deg;
Usr_Sex_t Sex; Usr_Sex_t Sex;
/***** Get degrees from database *****/ /***** Get degrees from database *****/
@ -2351,7 +2351,7 @@ static void Pho_ShowDegreeStat (int NumStds,int NumStdsWithPhoto)
/******************* Show the average photo of a degree **********************/ /******************* Show the average photo of a degree **********************/
/*****************************************************************************/ /*****************************************************************************/
static void Pho_ShowDegreeAvgPhotoAndStat (const struct Deg_Degree *Deg, static void Pho_ShowDegreeAvgPhotoAndStat (const struct Hie_Node *Deg,
const struct Pho_DegPhotos *DegPhotos, const struct Pho_DegPhotos *DegPhotos,
Pho_AvgPhotoSeeOrPrint_t SeeOrPrint, Pho_AvgPhotoSeeOrPrint_t SeeOrPrint,
Usr_Sex_t Sex, Usr_Sex_t Sex,

View File

@ -136,7 +136,7 @@ static void Rec_PutParsStdResults (__attribute__((unused)) void *Args);
static void Rec_PutParsWorks (__attribute__((unused)) void *Args); static void Rec_PutParsWorks (__attribute__((unused)) void *Args);
static void Rec_PutParsStudent (__attribute__((unused)) void *Args); static void Rec_PutParsStudent (__attribute__((unused)) void *Args);
static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args); static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args);
static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks); static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks);
static void Rec_ShowPhoto (struct Usr_Data *UsrDat); static void Rec_ShowPhoto (struct Usr_Data *UsrDat);
static void Rec_ShowFullName (struct Usr_Data *UsrDat); static void Rec_ShowFullName (struct Usr_Data *UsrDat);
static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks); static void Rec_ShowNickname (struct Usr_Data *UsrDat,bool PutFormLinks);
@ -155,9 +155,9 @@ static void Rec_ShowDateOfBirth (struct Usr_Data *UsrDat,bool ShowData,bool PutF
static void Rec_ShowPhone (struct Usr_Data *UsrDat,bool ShowData,bool PutForm, static void Rec_ShowPhone (struct Usr_Data *UsrDat,bool ShowData,bool PutForm,
unsigned NumPhone); unsigned NumPhone);
static void Rec_ShowComments (struct Usr_Data *UsrDat,bool ShowData,bool PutForm); static void Rec_ShowComments (struct Usr_Data *UsrDat,bool ShowData,bool PutForm);
static void Rec_ShowTeacherRows (struct Usr_Data *UsrDat,struct Ins_Instit *Ins, static void Rec_ShowTeacherRows (struct Usr_Data *UsrDat,struct Hie_Node *Ins,
bool ShowData); bool ShowData);
static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData); static void Rec_ShowInstitution (struct Hie_Node *Ins,bool ShowData);
static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData); static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData);
static void Rec_ShowDepartment (struct Usr_Data *UsrDat,bool ShowData); static void Rec_ShowDepartment (struct Usr_Data *UsrDat,bool ShowData);
static void Rec_ShowOffice (struct Usr_Data *UsrDat,bool ShowData); static void Rec_ShowOffice (struct Usr_Data *UsrDat,bool ShowData);
@ -2034,7 +2034,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
bool StudentInCurrentCrs; bool StudentInCurrentCrs;
bool TeacherInCurrentCrs; bool TeacherInCurrentCrs;
bool ShowTeacherRows; bool ShowTeacherRows;
struct Ins_Instit Ins; struct Hie_Node Ins;
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Initializations *****/ /***** Initializations *****/
@ -2522,7 +2522,7 @@ static void Rec_PutParsMsgUsr (__attribute__((unused)) void *Args)
/*********************** Show institution in record card *********************/ /*********************** Show institution in record card *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks) static void Rec_ShowInstitutionInHead (struct Hie_Node *Ins,bool PutFormLinks)
{ {
/***** Institution logo *****/ /***** Institution logo *****/
HTM_TD_Begin ("rowspan=\"4\" class=\"REC_C1_TOP CM\""); HTM_TD_Begin ("rowspan=\"4\" class=\"REC_C1_TOP CM\"");
@ -3157,7 +3157,7 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm)
extern const char *Txt_Another_country; extern const char *Txt_Another_country;
char *Label; char *Label;
unsigned NumCty; unsigned NumCty;
const struct Cty_Countr *CtyInLst; const struct Hie_Node *CtyInLst;
/***** If list of countries is empty, try to get it *****/ /***** If list of countries is empty, try to get it *****/
Cty_GetBasicListOfCountries (); Cty_GetBasicListOfCountries ();
@ -3353,7 +3353,7 @@ static void Rec_ShowComments (struct Usr_Data *UsrDat,bool ShowData,bool PutForm
/************************** Show user's institution **************************/ /************************** Show user's institution **************************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_ShowTeacherRows (struct Usr_Data *UsrDat,struct Ins_Instit *Ins, static void Rec_ShowTeacherRows (struct Usr_Data *UsrDat,struct Hie_Node *Ins,
bool ShowData) bool ShowData)
{ {
/***** Institution *****/ /***** Institution *****/
@ -3376,7 +3376,7 @@ static void Rec_ShowTeacherRows (struct Usr_Data *UsrDat,struct Ins_Instit *Ins,
/************************** Show user's institution **************************/ /************************** Show user's institution **************************/
/*****************************************************************************/ /*****************************************************************************/
static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData) static void Rec_ShowInstitution (struct Hie_Node *Ins,bool ShowData)
{ {
extern const char *Txt_Institution; extern const char *Txt_Institution;
@ -3412,7 +3412,7 @@ static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData)
static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData) static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData)
{ {
extern const char *Txt_Center; extern const char *Txt_Center;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
/***** Center *****/ /***** Center *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -3778,11 +3778,11 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
extern const char *Txt_Office; extern const char *Txt_Office;
extern const char *Txt_Phone; extern const char *Txt_Phone;
unsigned NumCty; unsigned NumCty;
const struct Cty_Countr *CtyInLst; const struct Hie_Node *CtyInLst;
unsigned NumIns; unsigned NumIns;
const struct Ins_Instit *InsInLst; const struct Hie_Node *InsInLst;
unsigned NumCtr; unsigned NumCtr;
const struct Ctr_Center *CtrInLst; const struct Hie_Node *CtrInLst;
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
char *Label; char *Label;
char *SelectClass; char *SelectClass;
@ -4059,7 +4059,7 @@ void Rec_ChgCountryOfMyInstitution (void)
void Rec_UpdateMyInstitution (void) void Rec_UpdateMyInstitution (void)
{ {
struct Ins_Instit Ins; struct Hie_Node Ins;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumDpts; unsigned NumDpts;
@ -4097,7 +4097,7 @@ void Rec_UpdateMyInstitution (void)
void Rec_UpdateMyCenter (void) void Rec_UpdateMyCenter (void)
{ {
struct Ctr_Center Ctr; struct Hie_Node Ctr;
/***** Get my center *****/ /***** Get my center *****/
/* Get center code */ /* Get center code */

View File

@ -485,7 +485,7 @@ static void Rep_WriteSectionUsrInfo (void)
extern const char *Txt_Country; extern const char *Txt_Country;
extern const char *Txt_Institution; extern const char *Txt_Institution;
char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1]; char CtyName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
struct Ins_Instit Ins; struct Hie_Node Ins;
/***** Begin section *****/ /***** Begin section *****/
fprintf (Rep_File,"<section>" fprintf (Rep_File,"<section>"
@ -1036,8 +1036,8 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
extern const char *Txt_students_ABBREVIATION; extern const char *Txt_students_ABBREVIATION;
extern const char *Txt_unknown_removed_course; extern const char *Txt_unknown_removed_course;
extern const char *Txt_no_course_selected; extern const char *Txt_no_course_selected;
struct Crs_Course Crs; struct Hie_Node Crs;
struct Deg_Degree Deg; struct Hie_Node Deg;
/***** Get course data *****/ /***** Get course data *****/
Crs.Cod = CrsCod; Crs.Cod = CrsCod;

View File

@ -2959,7 +2959,7 @@ static void Sta_ShowNumHitsPerCountry (Sta_CountType_t CountType,
static void Sta_WriteCountry (long CtyCod) static void Sta_WriteCountry (long CtyCod)
{ {
struct Cty_Countr Cty; struct Hie_Node Cty;
/***** Begin cell *****/ /***** Begin cell *****/
HTM_TD_Begin ("class=\"LM LOG_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LM LOG_%s\"",The_GetSuffix ());
@ -3047,7 +3047,7 @@ static void Sta_ShowNumHitsPerInstitution (Sta_CountType_t CountType,
static void Sta_WriteInstit (long InsCod) static void Sta_WriteInstit (long InsCod)
{ {
struct Ins_Instit Ins; struct Hie_Node Ins;
/***** Begin cell *****/ /***** Begin cell *****/
if (InsCod > 0) // Hit with an institution selected if (InsCod > 0) // Hit with an institution selected
@ -3138,7 +3138,7 @@ static void Sta_ShowNumHitsPerCenter (Sta_CountType_t CountType,
static void Sta_WriteCenter (long CtrCod) static void Sta_WriteCenter (long CtrCod)
{ {
struct Ctr_Center Ctr; struct Hie_Node Ctr;
/***** Begin cell *****/ /***** Begin cell *****/
if (CtrCod > 0) // Hit with a center selected if (CtrCod > 0) // Hit with a center selected
@ -3229,7 +3229,7 @@ static void Sta_ShowNumHitsPerDegree (Sta_CountType_t CountType,
static void Sta_WriteDegree (long DegCod) static void Sta_WriteDegree (long DegCod)
{ {
struct Deg_Degree Deg; struct Hie_Node Deg;
/***** Begin cell *****/ /***** Begin cell *****/
if (DegCod > 0) // Hit with a degree selected if (DegCod > 0) // Hit with a degree selected
@ -3275,7 +3275,7 @@ static void Sta_ShowNumHitsPerCourse (Sta_CountType_t CountType,
struct Sta_Hits Hits; struct Sta_Hits Hits;
MYSQL_ROW row; MYSQL_ROW row;
bool CrsOK; bool CrsOK;
struct Crs_Course Crs; struct Hie_Node Crs;
/***** Write heading *****/ /***** Write heading *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);

View File

@ -191,8 +191,8 @@ static void SysCfg_Map (void)
unsigned Zoom; unsigned Zoom;
unsigned NumCtrs; unsigned NumCtrs;
unsigned NumCtr; unsigned NumCtr;
struct Ins_Instit Ins; struct Hie_Node Ins;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Map_Coordinates Coord; struct Map_Coordinates Coord;
struct Map_Coordinates CtyAvgCoord; struct Map_Coordinates CtyAvgCoord;

View File

@ -4715,9 +4715,9 @@ const char *Txt_centers =
"merkezler"; "merkezler";
#endif #endif
const char *Txt_CENTERS_HELP_ORDER[Ctr_NUM_ORDERS] = const char *Txt_CENTERS_HELP_ORDER[Hie_NUM_ORDERS] =
{ {
[Ctr_ORDER_BY_CENTER] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Ordenar per center" "Ordenar per center"
#elif L==2 // de #elif L==2 // de
@ -4740,7 +4740,7 @@ const char *Txt_CENTERS_HELP_ORDER[Ctr_NUM_ORDERS] =
"Sort by center" // Çeviri lazim! "Sort by center" // Çeviri lazim!
#endif #endif
, ,
[Ctr_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Ordenar per n&ordm; d'usuaris" "Ordenar per n&ordm; d'usuaris"
#elif L==2 // de #elif L==2 // de
@ -4787,9 +4787,9 @@ const char *Txt_Centers_of_INSTITUTION_X = // Warning: it is very important to i
"Centers of %s"; // Çeviri lazim! "Centers of %s"; // Çeviri lazim!
#endif #endif
const char *Txt_CENTERS_ORDER[Ctr_NUM_ORDERS] = const char *Txt_CENTERS_ORDER[Hie_NUM_ORDERS] =
{ {
[Ctr_ORDER_BY_CENTER] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Center" "Center"
#elif L==2 // de #elif L==2 // de
@ -4812,7 +4812,7 @@ const char *Txt_CENTERS_ORDER[Ctr_NUM_ORDERS] =
"Merkez" "Merkez"
#endif #endif
, ,
[Ctr_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Usuaris del center" "Usuaris del center"
#elif L==2 // de #elif L==2 // de
@ -6013,9 +6013,9 @@ const char *Txt_countries =
"countries"; // Çeviri lazim! "countries"; // Çeviri lazim!
#endif #endif
const char *Txt_COUNTRIES_HELP_ORDER[Cty_NUM_ORDERS] = const char *Txt_COUNTRIES_HELP_ORDER[Hie_NUM_ORDERS] =
{ {
[Cty_ORDER_BY_COUNTRY] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Ordenar per pa&iacute;s" "Ordenar per pa&iacute;s"
#elif L==2 // de #elif L==2 // de
@ -6038,7 +6038,7 @@ const char *Txt_COUNTRIES_HELP_ORDER[Cty_NUM_ORDERS] =
"Sort by country" // Çeviri lazim! "Sort by country" // Çeviri lazim!
#endif #endif
, ,
[Cty_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Ordenar per n&ordm; d'usuaris" "Ordenar per n&ordm; d'usuaris"
#elif L==2 // de #elif L==2 // de
@ -6085,9 +6085,9 @@ const char *Txt_Countries_with_pending_institutions =
"Countries with pending institutions"; // Çeviri lazim! "Countries with pending institutions"; // Çeviri lazim!
#endif #endif
const char *Txt_COUNTRIES_ORDER[Cty_NUM_ORDERS] = const char *Txt_COUNTRIES_ORDER[Hie_NUM_ORDERS] =
{ {
[Cty_ORDER_BY_COUNTRY] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Pa&iacute;s" "Pa&iacute;s"
#elif L==2 // de #elif L==2 // de
@ -6110,7 +6110,7 @@ const char *Txt_COUNTRIES_ORDER[Cty_NUM_ORDERS] =
"&Uuml;lke" "&Uuml;lke"
#endif #endif
, ,
[Cty_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Usuaris del pa&iacute;s" "Usuaris del pa&iacute;s"
#elif L==2 // de #elif L==2 // de
@ -18008,9 +18008,9 @@ const char *Txt_institutions =
"institutions"; // Çeviri lazim! "institutions"; // Çeviri lazim!
#endif #endif
const char *Txt_INSTITUTIONS_HELP_ORDER[Ins_NUM_ORDERS] = const char *Txt_INSTITUTIONS_HELP_ORDER[Hie_NUM_ORDERS] =
{ {
[Ins_ORDER_BY_INSTITUTION] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Ordenar per instituci&oacute;" "Ordenar per instituci&oacute;"
#elif L==2 // de #elif L==2 // de
@ -18033,7 +18033,7 @@ const char *Txt_INSTITUTIONS_HELP_ORDER[Ins_NUM_ORDERS] =
"Sort by institution" // Çeviri lazim! "Sort by institution" // Çeviri lazim!
#endif #endif
, ,
[Ins_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Ordenar per nombre d'usuaris" "Ordenar per nombre d'usuaris"
#elif L==2 // de #elif L==2 // de
@ -18195,9 +18195,9 @@ const char *Txt_Institutions_of_COUNTRY_X = // Warning: it is very important to
"Institutions of %s"; // Çeviri lazim! "Institutions of %s"; // Çeviri lazim!
#endif #endif
const char *Txt_INSTITUTIONS_ORDER[Ins_NUM_ORDERS] = const char *Txt_INSTITUTIONS_ORDER[Hie_NUM_ORDERS] =
{ {
[Ins_ORDER_BY_INSTITUTION] = [Hie_ORDER_BY_NAME] =
#if L==1 // ca #if L==1 // ca
"Instituci&oacute;" "Instituci&oacute;"
#elif L==2 // de #elif L==2 // de
@ -18220,7 +18220,7 @@ const char *Txt_INSTITUTIONS_ORDER[Ins_NUM_ORDERS] =
"Kurum" "Kurum"
#endif #endif
, ,
[Ins_ORDER_BY_NUM_USRS] = [Hie_ORDER_BY_NUM_USRS] =
#if L==1 // ca #if L==1 // ca
"Usuaris de la instituci&oacute;" "Usuaris de la instituci&oacute;"
#elif L==2 // de #elif L==2 // de

View File

@ -1422,7 +1422,7 @@ static void Tmt_TimeTableDrawCellView (const struct Tmt_Timetable *Timetable,
{ {
extern const char *Txt_unknown_removed_course; extern const char *Txt_unknown_removed_course;
extern const char *Txt_TIMETABLE_CLASS_TYPES[Tmt_NUM_CLASS_TYPES]; extern const char *Txt_TIMETABLE_CLASS_TYPES[Tmt_NUM_CLASS_TYPES];
struct Crs_Course Crs; struct Hie_Node Crs;
struct GroupData GrpDat; struct GroupData GrpDat;
/***** Begin cell *****/ /***** Begin cell *****/

View File

@ -2172,7 +2172,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct Usr_Data *UsrDat,
char BgColor[Usr_MAX_BYTES_BG_COLOR + 1]; char BgColor[Usr_MAX_BYTES_BG_COLOR + 1];
bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr && bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr &&
(UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); (UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
struct Ins_Instit Ins; struct Hie_Node Ins;
/***** Begin row *****/ /***** Begin row *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -2265,8 +2265,8 @@ static void Usr_WriteRowGstAllData (struct Usr_Data *UsrDat)
[PhoSha_SHAPE_OVAL ] = "PHOTOO21x28", [PhoSha_SHAPE_OVAL ] = "PHOTOO21x28",
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28", [PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28",
}; };
struct Ins_Instit Ins; struct Hie_Node Ins;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
/***** Begin row *****/ /***** Begin row *****/
@ -2359,7 +2359,7 @@ static void Usr_WriteRowStdAllData (struct Usr_Data *UsrDat,char *GroupNames)
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
char Text[Cns_MAX_BYTES_TEXT + 1]; char Text[Cns_MAX_BYTES_TEXT + 1];
struct Ins_Instit Ins; struct Hie_Node Ins;
bool ShowData = (Gbl.Usrs.Me.Role.Logged == Rol_TCH && UsrDat->Accepted) || bool ShowData = (Gbl.Usrs.Me.Role.Logged == Rol_TCH && UsrDat->Accepted) ||
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM; Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM;
@ -2466,8 +2466,8 @@ static void Usr_WriteRowTchAllData (struct Usr_Data *UsrDat)
[PhoSha_SHAPE_OVAL ] = "PHOTOO21x28", [PhoSha_SHAPE_OVAL ] = "PHOTOO21x28",
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28", [PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28",
}; };
struct Ins_Instit Ins; struct Hie_Node Ins;
struct Ctr_Center Ctr; struct Hie_Node Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
bool ShowData = (Usr_ItsMe (UsrDat->UsrCod) == Usr_ME || UsrDat->Accepted || bool ShowData = (Usr_ItsMe (UsrDat->UsrCod) == Usr_ME || UsrDat->Accepted ||
Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM || Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
@ -2547,7 +2547,7 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct Usr_Data *UsrDat)
[PhoSha_SHAPE_OVAL ] = "PHOTOO21x28", [PhoSha_SHAPE_OVAL ] = "PHOTOO21x28",
[PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28", [PhoSha_SHAPE_RECTANGLE] = "PHOTOR21x28",
}; };
struct Ins_Instit Ins; struct Hie_Node Ins;
/***** Begin row *****/ /***** Begin row *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);