Version 23.51: Dec 06, 2023 Code refactoring in hierarchy.

This commit is contained in:
acanas 2023-12-06 20:59:19 +01:00
parent ae559a39c2
commit 7a2be9bbe8
32 changed files with 585 additions and 498 deletions

View File

@ -853,6 +853,7 @@ int swad__loginBySessionKey (struct soap *soap,
char *sessionID,char *appKey, // input
struct swad__loginBySessionKeyOutput *loginBySessionKeyOut) // output
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
int ReturnCode;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -913,18 +914,19 @@ int swad__loginBySessionKey (struct soap *soap,
/***** Get course (row[2]) *****/
Gbl.Hierarchy.Node[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[2]);
Crs_GetCourseDataByCod (&Gbl.Hierarchy.Node[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Gbl.Hierarchy.Node[Hie_CRS]);
loginBySessionKeyOut->courseCode = (int) Gbl.Hierarchy.Node[Hie_CRS].HieCod;
Str_Copy (loginBySessionKeyOut->courseName,Gbl.Hierarchy.Node[Hie_CRS].FullName,
Nam_MAX_BYTES_FULL_NAME);
/***** Get user code (row[0]) *****/
Gbl.Usrs.Me.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
UsrFound = API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Node[Hie_CRS].HieCod); // Get some user's data from database
UsrFound = API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,
Gbl.Hierarchy.Node[Hie_CRS].HieCod); // Get some user's data from database
/***** Get degree (row[1]) *****/
Gbl.Hierarchy.Node[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[1]);
Deg_GetDegreeDataByCod (&Gbl.Hierarchy.Node[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Gbl.Hierarchy.Node[Hie_DEG]);
loginBySessionKeyOut->degreeCode = (int) Gbl.Hierarchy.Node[Hie_DEG].HieCod;
Str_Copy (loginBySessionKeyOut->degreeName,Gbl.Hierarchy.Node[Hie_DEG].FullName,
Nam_MAX_BYTES_FULL_NAME);
@ -2847,6 +2849,7 @@ int swad__getNotifications (struct soap *soap,
char *wsKey,long beginTime, // input
struct swad__getNotificationsOutput *getNotificationsOut) // output
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS];
extern const char *Txt_Forum;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
@ -2868,6 +2871,7 @@ int swad__getNotifications (struct soap *soap,
Ntf_Status_t Status;
size_t Length;
Hie_Level_t Level;
unsigned Col;
/***** Initializations *****/
API_Set_gSOAP_RuntimeEnv (soap);
@ -2926,13 +2930,19 @@ int swad__getNotifications (struct soap *soap,
sscanf (row[2],"%ld",&EventTime);
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventTime = EventTime;
/* Get course (row[7]) */
Hie[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[7]);
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
/* Get user's code of the user who caused the event (row[3]) */
Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[3]);
/* Get institution code, center code, degree code and course code
(row[4], row[5], row[6] and row[7]) */
for (Level = Hie_INS, Col = 4;
Level <= Hie_CRS;
Level++, Col++)
{
Hie[Level].HieCod = Str_ConvertStrCodToLongCod (row[Col]);
Hie_GetDataByCod[Level] (&Hie[Level]);
}
if (API_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Hie[Hie_CRS].HieCod)) // Get some user's data from database
{
getNotificationsOut->notificationsArray.__ptr[NumNotif].userNickname =
@ -2974,18 +2984,6 @@ int swad__getNotifications (struct soap *soap,
getNotificationsOut->notificationsArray.__ptr[NumNotif].userPhoto = NULL;
}
/* Get institution (row[4]) */
Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[4]);
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
/* Get center (row[5]) */
Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[5]);
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
/* Get degree (row[6]) */
Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[6]);
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
/* Get message/post/... code (row[8]) */
Cod = Str_ConvertStrCodToLongCod (row[8]);
getNotificationsOut->notificationsArray.__ptr[NumNotif].eventCode = (int) Cod;

View File

@ -5255,6 +5255,7 @@ void Brw_CopyFromFileBrowser (void)
static void Brw_WriteCurrentClipboard (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Copy_source;
extern const char *Txt_documents_management_area;
extern const char *Txt_teachers_files_area;
@ -5297,7 +5298,7 @@ static void Brw_WriteCurrentClipboard (void)
{
case Brw_ADMI_DOC_INS:
Hie[Hie_INS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
@ -5305,7 +5306,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_INS:
Hie[Hie_INS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
@ -5313,7 +5314,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_CTR:
Hie[Hie_CTR].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
@ -5321,7 +5322,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_CTR:
Hie[Hie_CTR].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
@ -5329,7 +5330,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_DEG:
Hie[Hie_DEG].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
@ -5337,7 +5338,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_DEG:
Hie[Hie_DEG].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
@ -5345,7 +5346,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_DOC_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_documents_management_area,
@ -5355,7 +5356,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.HieCod;
Grp_GetGroupDataByCod (&GrpDat);
Hie[Hie_CRS].HieCod = GrpDat.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_documents_management_area,
@ -5364,7 +5365,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_TCH_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_teachers_files_area,
@ -5374,7 +5375,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.HieCod;
Grp_GetGroupDataByCod (&GrpDat);
Hie[Hie_CRS].HieCod = GrpDat.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_teachers_files_area,
@ -5383,7 +5384,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_SHR_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_shared_files_area,
@ -5393,7 +5394,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.HieCod;
Grp_GetGroupDataByCod (&GrpDat);
Hie[Hie_CRS].HieCod = GrpDat.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_shared_files_area,
@ -5402,7 +5403,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_ASG_USR:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_assignments_area,
@ -5411,7 +5412,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_WRK_USR:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Txt_works_area,
@ -5420,7 +5421,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_ASG_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
@ -5435,7 +5436,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_WRK_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
Usr_UsrDataConstructor (&UsrDat);
UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod;
Usr_GetAllUsrDataFromUsrCod (&UsrDat,
@ -5454,7 +5455,7 @@ static void Brw_WriteCurrentClipboard (void)
Prj.PrjCod = Gbl.FileBrowser.Clipboard.HieCod;
Prj_GetProjectDataByCod (&Prj);
Hie[Hie_CRS].HieCod = Prj.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s</strong>",
Gbl.FileBrowser.Clipboard.FileBrowser == Brw_ADMI_DOC_PRJ ? Txt_project_documents :
@ -5465,7 +5466,7 @@ static void Brw_WriteCurrentClipboard (void)
break;
case Brw_ADMI_MRK_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>",
Txt_marks_management_area,
@ -5475,7 +5476,7 @@ static void Brw_WriteCurrentClipboard (void)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.HieCod;
Grp_GetGroupDataByCod (&GrpDat);
Hie[Hie_CRS].HieCod = GrpDat.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
snprintf (TxtClipboardZone,sizeof (TxtClipboardZone),
"%s, %s <strong>%s</strong>, %s <strong>%s %s</strong>",
Txt_marks_management_area,
@ -5827,6 +5828,7 @@ void Brw_PasteIntoFileBrowser (void)
static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_copy_has_been_successful;
extern const char *Txt_Files_copied;
extern const char *Txt_Links_copied;
@ -5854,7 +5856,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_DOC_INS:
case Brw_ADMI_SHR_INS:
Hie[Hie_INS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Ins_GetInstitDataByCod (&Hie[Hie_INS]))
if (Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%02u/%u/%s",
Cfg_PATH_INS_PRIVATE,
(unsigned) (Hie[Hie_INS].HieCod % 100),
@ -5866,7 +5868,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_DOC_CTR:
case Brw_ADMI_SHR_CTR:
Hie[Hie_CTR].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Ctr_GetCenterDataByCod (&Hie[Hie_CTR]))
if (Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%02u/%u/%s",
Cfg_PATH_CTR_PRIVATE,
(unsigned) (Hie[Hie_CTR].HieCod % 100),
@ -5878,7 +5880,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_DOC_DEG:
case Brw_ADMI_SHR_DEG:
Hie[Hie_DEG].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Deg_GetDegreeDataByCod (&Hie[Hie_DEG]))
if (Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%02u/%u/%s",
Cfg_PATH_DEG_PRIVATE,
(unsigned) (Hie[Hie_DEG].HieCod % 100),
@ -5892,7 +5894,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_SHR_CRS:
case Brw_ADMI_MRK_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Hie[Hie_CRS].HieCod,
Gbl.FileBrowser.Clipboard.FilFolLnk.Full);
@ -5906,7 +5908,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
GrpDat.GrpCod = Gbl.FileBrowser.Clipboard.HieCod;
Grp_GetGroupDataByCod (&GrpDat);
Hie[Hie_CRS].HieCod = GrpDat.CrsCod;
if (Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Hie[Hie_CRS].HieCod,Cfg_FOLDER_GRP,
GrpDat.GrpCod,
@ -5917,7 +5919,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_ASG_CRS:
case Brw_ADMI_WRK_CRS:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
{
Usr_UsrDataConstructor (&UsrDat);
if (Usr_DB_ChkIfUsrCodExists (Gbl.FileBrowser.Clipboard.WorksUsrCod))
@ -5939,7 +5941,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_ASG_USR:
case Brw_ADMI_WRK_USR:
Hie[Hie_CRS].HieCod = Gbl.FileBrowser.Clipboard.HieCod;
if (Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Hie[Hie_CRS].HieCod,Cfg_FOLDER_USR,
(unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100),
@ -5952,7 +5954,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size)
case Brw_ADMI_ASS_PRJ:
PrjCod = Gbl.FileBrowser.Clipboard.HieCod;
Hie[Hie_CRS].HieCod = Prj_DB_GetCrsOfPrj (PrjCod);
if (Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s/%02u/%ld/%s",
Cfg_PATH_CRS_PRIVATE,Hie[Hie_CRS].HieCod,Cfg_FOLDER_PRJ,
(unsigned) (PrjCod % 100),
@ -8617,6 +8619,7 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
long *CrsCod,
long *GrpCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Ctr;
struct Hie_Node Deg;
struct Hie_Node Crs;
@ -8640,7 +8643,7 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*CrsCod =
*DegCod = -1L;
*CtrCod = Ctr.HieCod = Cod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
*InsCod = Ctr.PrtCod;
break;
case Brw_ADMI_DOC_DEG:
@ -8649,9 +8652,9 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*GrpCod =
*CrsCod = -1L;
*DegCod = Deg.HieCod = Cod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
*CtrCod = Ctr.HieCod = Deg.PrtCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
*InsCod = Ctr.PrtCod;
break;
case Brw_ADMI_DOC_CRS:
@ -8663,11 +8666,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
/* Cod stores the course code */
*GrpCod = -1L;
*CrsCod = Crs.HieCod = Cod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
*DegCod = Deg.HieCod = Crs.PrtCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
*CtrCod = Ctr.HieCod = Deg.PrtCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
*InsCod = Ctr.PrtCod;
break;
case Brw_ADMI_DOC_GRP:
@ -8678,11 +8681,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
*GrpCod = GrpDat.GrpCod = Cod;
Grp_GetGroupDataByCod (&GrpDat);
*CrsCod = Crs.HieCod = GrpDat.CrsCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
*DegCod = Deg.HieCod = Crs.PrtCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
*CtrCod = Ctr.HieCod = Deg.PrtCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
*InsCod = Ctr.PrtCod;
break;
case Brw_ADMI_DOC_PRJ:
@ -8690,11 +8693,11 @@ void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
/* Cod stores the project code */
*GrpCod = -1L;
*CrsCod = Crs.HieCod = Prj_DB_GetCrsOfPrj (Cod);
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
*DegCod = Deg.HieCod = Crs.PrtCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
*CtrCod = Ctr.HieCod = Deg.PrtCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
*InsCod = Ctr.PrtCod;
break;
default:
@ -9074,6 +9077,7 @@ void Brw_RemoveUsrWorksInCrs (struct Usr_Data *UsrDat,struct Hie_Node *Crs)
void Brw_RemoveUsrWorksInAllCrss (struct Usr_Data *UsrDat)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumCrss;
@ -9094,7 +9098,7 @@ void Brw_RemoveUsrWorksInAllCrss (struct Usr_Data *UsrDat)
Crs.HieCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of course */
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
Brw_RemoveUsrWorksInCrs (UsrDat,&Crs);
NumCrssWorksRemoved++;
}

View File

@ -1589,6 +1589,7 @@ void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY
static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *CallsForExams,
char **ContentStr)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_CALL_FOR_EXAM_Course;
@ -1610,15 +1611,15 @@ static void Cfe_GetNotifContentCallForExam (const struct Cfe_CallsForExams *Call
/***** Get data of course *****/
Hie[Hie_CRS].HieCod = CallsForExams->CallForExam.CrsCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
/***** Get data of degree *****/
Hie[Hie_DEG].HieCod = Hie[Hie_CRS].PrtCod;
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
/***** Get data of institution *****/
Hie[Hie_INS].HieCod = Deg_DB_GetInsCodOfDegreeByCod (Hie[Hie_DEG].HieCod);
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
/***** Convert struct date to a date string *****/
Dat_ConvDateToDateStr (&CallsForExams->CallForExam.ExamDate,StrExamDate);

View File

@ -111,6 +111,7 @@ static void Ctr_PutParCtrCod (void *CtrCod);
void Ctr_SeeCtrWithPendingDegs (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_SYSTEM_Pending;
extern const char *Txt_Centers_with_pending_degrees;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
@ -151,7 +152,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
The_GetColorRows ();
/* Get data of center */
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/* Center logo and full name */
HTM_TR_Begin (NULL);
@ -917,6 +918,7 @@ static bool Ctr_CheckIfICanEditACenter (struct Hie_Node *Ctr)
void Ctr_RemoveCenter (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_To_remove_a_center_you_must_first_remove_all_degrees_and_teachers_in_the_center;
extern const char *Txt_Center_X_removed;
char PathCtr[PATH_MAX + 1];
@ -928,7 +930,7 @@ void Ctr_RemoveCenter (void)
Ctr_EditingCtr->HieCod = ParCod_GetAndCheckPar (ParCod_OthHie);
/***** Get data of the center from database *****/
Ctr_GetCenterDataByCod (Ctr_EditingCtr);
Hie_GetDataByCod[Hie_CTR] (Ctr_EditingCtr);
/***** Check if this center has teachers *****/
if (Hie_GetNumNodesInHieLvl (Hie_DEG, // Number of degrees...
@ -991,6 +993,7 @@ void Ctr_RemoveCenter (void)
void Ctr_ChangeCtrPlc (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_place_of_the_center_has_changed;
long NewPlcCod;
@ -1004,7 +1007,7 @@ void Ctr_ChangeCtrPlc (void)
NewPlcCod = ParCod_GetAndCheckParMin (ParCod_Plc,0); // 0 (another place) is allowed here
/***** Get data of center from database *****/
Ctr_GetCenterDataByCod (Ctr_EditingCtr);
Hie_GetDataByCod[Hie_CTR] (Ctr_EditingCtr);
/***** Update place in table of centers *****/
Ctr_DB_UpdateCtrPlc (Ctr_EditingCtr->HieCod,NewPlcCod);
@ -1045,6 +1048,7 @@ void Ctr_RenameCenterFull (void)
void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFull)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists;
@ -1062,7 +1066,7 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFull)
Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the center *****/
Ctr_GetCenterDataByCod (Ctr);
Hie_GetDataByCod[Hie_CTR] (Ctr);
/***** Check if new name is empty *****/
if (!NewName[0])
@ -1108,6 +1112,7 @@ void Ctr_RenameCenter (struct Hie_Node *Ctr,Nam_ShrtOrFullName_t ShrtOrFull)
void Ctr_ChangeCtrWWW (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
@ -1121,7 +1126,7 @@ void Ctr_ChangeCtrWWW (void)
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of center *****/
Ctr_GetCenterDataByCod (Ctr_EditingCtr);
Hie_GetDataByCod[Hie_CTR] (Ctr_EditingCtr);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
@ -1146,6 +1151,7 @@ void Ctr_ChangeCtrWWW (void)
void Ctr_ChangeCtrStatus (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_status_of_the_center_X_has_changed;
Hie_Status_t Status;
@ -1160,7 +1166,7 @@ void Ctr_ChangeCtrStatus (void)
Status = Hie_GetParStatus (); // New status
/***** Get data of center *****/
Ctr_GetCenterDataByCod (Ctr_EditingCtr);
Hie_GetDataByCod[Hie_CTR] (Ctr_EditingCtr);
/***** Update status *****/
Ctr_DB_UpdateCtrStatus (Ctr_EditingCtr->HieCod,Status);
@ -1588,6 +1594,7 @@ unsigned Ctr_GetCachedNumCtrsWithUsrs (Rol_Role_t Role)
void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_abc[Hie_NUM_LEVELS];
extern const char *Txt_HIERARCHY_PLURAL_abc[Hie_NUM_LEVELS];
unsigned NumCtr;
@ -1618,7 +1625,7 @@ void Ctr_ListCtrsFound (MYSQL_RES **mysql_res,unsigned NumCtrs)
Ctr.HieCod = DB_GetNextCode (*mysql_res);
/* Get data of center */
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/* Write data of this center */
Ctr_ListOneCenterForSeeing (&Ctr,NumCtr);

View File

@ -1037,6 +1037,7 @@ void CtrCfg_ChangeCtrPhotoAttr (void)
void CtrCfg_ChangeCtrIns (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_center_X_has_been_moved_to_the_institution_Y;
struct Hie_Node NewIns;
const char *Names[Nam_NUM_SHRT_FULL_NAMES];
@ -1048,7 +1049,7 @@ void CtrCfg_ChangeCtrIns (void)
if (NewIns.HieCod != Gbl.Hierarchy.Node[Hie_CTR].PrtCod)
{
/***** Get data of new institution *****/
Ins_GetInstitDataByCod (&NewIns);
Hie_GetDataByCod[Hie_INS] (&NewIns);
/***** Check if it already exists a center with the same name in the new institution *****/
Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CTR].ShrtName;

View File

@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
#define Log_PLATFORM_VERSION "SWAD 23.50.1 (2023-11-28)"
#define Log_PLATFORM_VERSION "SWAD 23.51 (2023-12-06)"
#define CSS_FILE "swad23.50.1.css"
#define JS_FILE "swad23.47.3.js"
/*
Version 23.51: Dec 06, 2023 Code refactoring in hierarchy. (335718 lines)
Version 23.50.1: Nov 28, 2023 Responsive design in announcements and notices. (335630 lines)
Version 23.50: Nov 28, 2023 Code refactoring in hierarchy. (335634 lines)
Version 23.49: Nov 27, 2023 Code refactoring in highlighting. (335774 lines)

View File

@ -105,6 +105,7 @@ void Cht_ShowChatRooms (void)
void Cht_ShowListOfAvailableChatRooms (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Chat_rooms;
extern const char *Txt_General;
extern const char *Txt_SEX_PLURAL_Abc[Usr_NUM_SEXS];
@ -178,7 +179,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
{
/* Get data of this degree */
Deg.HieCod = Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes[NumMyDeg].HieCod;
if (!Deg_GetDegreeDataByCod (&Deg))
if (!Hie_GetDataByCod[Hie_DEG] (&Deg))
Err_WrongDegreeExit ();
/* Link to the room of this degree */
@ -209,7 +210,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
if ((Crs.HieCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
{
/* Get data of this course */
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
/* Link to the room of this course */
IsLastItemInLevel[2] = (NumCrs == NumCrss - 1) ? Lay_LAST_ITEM :
@ -365,6 +366,7 @@ void Cht_WriteParsRoomCodeAndNames (const char *RoomCode,const char *RoomShrtNam
void Cht_OpenChatWindow (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_SEX_PLURAL_Abc[Usr_NUM_SEXS];
extern const char *Txt_SEX_PLURAL_abc[Usr_NUM_SEXS];
extern const char *Txt_General;
@ -474,7 +476,7 @@ void Cht_OpenChatWindow (void)
/* Get data of this degree */
Deg.HieCod = Gbl.Usrs.Me.Hierarchy[Hie_DEG].Nodes[NumMyDeg].HieCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
snprintf (ThisRoomShortName,sizeof (ThisRoomShortName),"%s",
Deg.ShrtName);
@ -501,7 +503,7 @@ void Cht_OpenChatWindow (void)
/* Get data of this course */
Crs.HieCod = Gbl.Usrs.Me.Hierarchy[Hie_CRS].Nodes[NumMyCrs].HieCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
snprintf (ThisRoomShortName,sizeof (ThisRoomShortName),
"%s",

View File

@ -100,6 +100,7 @@ static void Cty_FormToGoToMap (struct Hie_Node *Cty);
void Cty_SeeCtyWithPendingInss (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_SYSTEM_Pending;
extern const char *Txt_Countries_with_pending_institutions;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
@ -149,7 +150,7 @@ void Cty_SeeCtyWithPendingInss (void)
The_GetColorRows ();
/* Get data of country */
Cty_GetBasicCountryDataByCod (&Cty);
Hie_GetDataByCod[Hie_CTY] (&Cty);
/* Begin row for this country */
HTM_TR_Begin (NULL);
@ -897,7 +898,7 @@ void Cty_WriteCountryName (long CtyCod)
/***************** Get basic data of country given its code ******************/
/*****************************************************************************/
bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Node)
bool Cty_GetCountrDataByCod (struct Hie_Node *Node)
{
extern const char *Txt_Another_country;
MYSQL_RES *mysql_res;
@ -1163,6 +1164,7 @@ static void Cty_PutParOthCtyCod (void *CtyCod)
void Cty_RemoveCountry (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_You_can_not_remove_a_country_with_institutions_or_users;
extern const char *Txt_Country_X_removed;
@ -1173,7 +1175,7 @@ void Cty_RemoveCountry (void)
Cty_EditingCty->HieCod = ParCod_GetAndCheckPar (ParCod_OthCty);
/***** Get data of the country from database *****/
Cty_GetBasicCountryDataByCod (Cty_EditingCty);
Hie_GetDataByCod[Hie_CTY] (Cty_EditingCty);
/***** Check if this country has users *****/
if (Hie_GetNumNodesInHieLvl (Hie_INS, // Number of institutions...
@ -1221,6 +1223,7 @@ void Cty_RemoveCountry (void)
void Cty_RenameCountry (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_country_X_already_exists;
extern const char *Txt_The_country_X_has_been_renamed_as_Y;
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
@ -1243,7 +1246,7 @@ void Cty_RenameCountry (void)
Par_GetParText ("Name",NewCtyName,Cty_MAX_BYTES_NAME);
/***** Get from the database the data of the country *****/
Cty_GetBasicCountryDataByCod (Cty_EditingCty);
Hie_GetDataByCod[Hie_CTY] (Cty_EditingCty);
/***** Check if new name is empty *****/
if (NewCtyName[0])
@ -1299,8 +1302,9 @@ static void Cty_UpdateCtyName (long CtyCod,const char *FldName,const char *NewCt
void Cty_ChangeCtyWWW (void)
{
extern const char *Txt_The_new_web_address_is_X;
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
Lan_Language_t Language;
char FldName[3 + 1 + 2 + 1]; // Example: "WWW_en"
@ -1318,7 +1322,7 @@ void Cty_ChangeCtyWWW (void)
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get from the database the data of the country *****/
Cty_GetBasicCountryDataByCod (Cty_EditingCty);
Hie_GetDataByCod[Hie_CTY] (Cty_EditingCty);
/***** Update the table changing old WWW by new WWW *****/
snprintf (FldName,sizeof (FldName),"WWW_%s",
@ -1655,6 +1659,7 @@ unsigned Cty_GetCachedNumCtysWithUsrs (Rol_Role_t Role)
void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_abc[Hie_NUM_LEVELS];
extern const char *Txt_HIERARCHY_PLURAL_abc[Hie_NUM_LEVELS];
char *Title;
@ -1687,7 +1692,7 @@ void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
Cty.HieCod = DB_GetNextCode (*mysql_res);
/* Get data of country */
Cty_GetBasicCountryDataByCod (&Cty);
Hie_GetDataByCod[Hie_CTY] (&Cty);
/* Write data of this country */
Cty_ListOneCountryForSeeing (&Cty,NumCty);

View File

@ -67,7 +67,7 @@ void Cty_EditCountries (void);
void Cty_GetBasicListOfCountries (void);
void Cty_WriteSelectorOfCountry (void);
void Cty_WriteCountryName (long CtyCod);
bool Cty_GetBasicCountryDataByCod (struct Hie_Node *Node);
bool Cty_GetCountrDataByCod (struct Hie_Node *Node);
void Cty_GetNamesAndWWWsByCod (struct Hie_Node *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]);

View File

@ -256,6 +256,7 @@ static void CtyCfg_Title (Hie_PutLink_t PutLink)
static void CtyCfg_Map (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_RES *mysql_res;
struct Map_Coordinates CtyAvgCoord;
unsigned Zoom;
@ -297,14 +298,14 @@ static void CtyCfg_Map (void)
Ctr.HieCod = DB_GetNextCode (mysql_res);
/* Get data of center */
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/* Get coordinates of center */
Ctr_GetCoordByCod (Ctr.HieCod,&Coord);
/* Get data of institution */
Ins.HieCod = Ctr.PrtCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/* Add marker */
Map_AddMarker (&Coord);

View File

@ -186,20 +186,13 @@ static void Crs_WriteNodes (struct Hie_Node Hie[Hie_NUM_LEVELS],
{
extern unsigned (*Hie_GetMyNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
long PrtCod);
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
Lay_Highlight_t Highlight; // Highlight because degree, course, etc. is selected
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumNode;
unsigned NumNodes;
static bool (*GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node) =
{
[Hie_CTY] = Cty_GetBasicCountryDataByCod,
[Hie_INS] = Ins_GetInstitDataByCod,
[Hie_CTR] = Ctr_GetCenterDataByCod,
[Hie_DEG] = Deg_GetDegreeDataByCod,
[Hie_CRS] = Crs_GetCourseDataByCod,
};
if (Level > Hie_SYS)
NumNodes = Hie_GetMyNodesFromDB[Level] (&mysql_res,Hie[Level - 1].HieCod);
@ -217,7 +210,7 @@ static void Crs_WriteNodes (struct Hie_Node Hie[Hie_NUM_LEVELS],
Hie[Level].HieCod = Str_ConvertStrCodToLongCod (row[0]);
/***** Get data of this node *****/
if (!GetDataByCod[Level] (&Hie[Level]))
if (!Hie_GetDataByCod[Level] (&Hie[Level]))
Err_WrongCountrExit ();
}
else
@ -1186,6 +1179,7 @@ static void Crs_GetParsNewCourse (struct Hie_Node *Crs)
void Crs_RemoveCourse (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_To_remove_a_course_you_must_first_remove_all_users_in_the_course;
extern const char *Txt_Course_X_removed;
@ -1196,7 +1190,7 @@ void Crs_RemoveCourse (void)
Crs_EditingCrs->HieCod = ParCod_GetAndCheckPar (ParCod_OthHie);
/***** Get data of the course from database *****/
Crs_GetCourseDataByCod (Crs_EditingCrs);
Hie_GetDataByCod[Hie_CRS] (Crs_EditingCrs);
if (!Crs_CheckIfICanEdit (Crs_EditingCrs))
Err_NoPermissionExit ();
@ -1321,6 +1315,7 @@ void Crs_RemoveCourseCompletely (long CrsCod)
static void Crs_EmptyCourseCompletely (long CrsCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Crs;
char PathRelCrs[PATH_MAX + 1];
@ -1328,7 +1323,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
{
/***** Get course data *****/
Crs.HieCod = CrsCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
/***** Remove all students in the course *****/
Enr_RemAllStdsInCrs (&Crs);
@ -1422,6 +1417,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
void Crs_ChangeInsCrsCod (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
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;
char NewInstitutionalCrsCod[Hie_MAX_BYTES_INSTITUTIONAL_COD + 1];
@ -1437,7 +1433,7 @@ void Crs_ChangeInsCrsCod (void)
Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Hie_MAX_BYTES_INSTITUTIONAL_COD);
/* Get data of the course */
Crs_GetCourseDataByCod (Crs_EditingCrs);
Hie_GetDataByCod[Hie_CRS] (Crs_EditingCrs);
if (!Crs_CheckIfICanEdit (Crs_EditingCrs))
Err_NoPermissionExit ();
@ -1462,6 +1458,7 @@ void Crs_ChangeInsCrsCod (void)
void Crs_ChangeCrsYear (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_The_year_of_the_course_X_has_changed;
extern const char *Txt_The_year_X_is_not_allowed;
@ -1481,7 +1478,7 @@ void Crs_ChangeCrsYear (void)
NewYear = Deg_ConvStrToYear (YearStr);
/* Get data of the course */
Crs_GetCourseDataByCod (Crs_EditingCrs);
Hie_GetDataByCod[Hie_CRS] (Crs_EditingCrs);
if (!Crs_CheckIfICanEdit (Crs_EditingCrs))
Err_NoPermissionExit ();
@ -1568,6 +1565,7 @@ void Crs_RenameCourseFull (void)
void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFull)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists;
@ -1585,7 +1583,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFull)
Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the data of the degree *****/
Crs_GetCourseDataByCod (Crs);
Hie_GetDataByCod[Hie_CRS] (Crs);
if (!Crs_CheckIfICanEdit (Crs))
Err_NoPermissionExit ();
@ -1631,6 +1629,7 @@ void Crs_RenameCourse (struct Hie_Node *Crs,Nam_ShrtOrFullName_t ShrtOrFull)
void Crs_ChangeCrsStatus (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_status_of_the_course_X_has_changed;
Hie_Status_t Status;
@ -1645,7 +1644,7 @@ void Crs_ChangeCrsStatus (void)
Status = Hie_GetParStatus (); // New status
/***** Get data of course *****/
Crs_GetCourseDataByCod (Crs_EditingCrs);
Hie_GetDataByCod[Hie_CRS] (Crs_EditingCrs);
/***** Update status *****/
Crs_DB_UpdateCrsStatus (Crs_EditingCrs->HieCod,Status);
@ -1964,6 +1963,7 @@ void Crs_ListCrssFound (MYSQL_RES **mysql_res,unsigned NumCrss)
static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnAccepted)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Enrolment_confirmed;
extern const char *Txt_Enrolment_not_confirmed;
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
@ -1990,7 +1990,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
/***** Get degree code (row[0]) *****/
if ((Deg.HieCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Err_WrongDegreeExit ();
if (!Deg_GetDegreeDataByCod (&Deg))
if (!Hie_GetDataByCod[Hie_DEG] (&Deg))
Err_WrongDegreeExit ();
/***** Get course code (row[1]) *****/

View File

@ -482,6 +482,7 @@ static void CrsCfg_Indicators (void)
void CrsCfg_ChangeCrsDeg (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
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;
struct Hie_Node NewDeg;
@ -494,7 +495,7 @@ void CrsCfg_ChangeCrsDeg (void)
if (NewDeg.HieCod != Gbl.Hierarchy.Node[Hie_CRS].PrtCod)
{
/***** Get data of new degree *****/
Deg_GetDegreeDataByCod (&NewDeg);
Hie_GetDataByCod[Hie_DEG] (&NewDeg);
/***** If name of course was not in database in the new degree... *****/
Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_CRS].ShrtName;

View File

@ -115,6 +115,7 @@ static void Deg_PutParDegCod (void *DegCod);
void Deg_SeeDegWithPendingCrss (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_SYSTEM_Pending;
extern const char *Txt_Degrees_with_pending_courses;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
@ -155,7 +156,7 @@ void Deg_SeeDegWithPendingCrss (void)
The_GetColorRows ();
/* Get data of degree */
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/* Begin table row */
HTM_TR_Begin (NULL);
@ -1075,6 +1076,7 @@ static void Deg_ReceiveFormRequestOrCreateDeg (Hie_Status_t Status)
void Deg_RemoveDegree (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_To_remove_a_degree_you_must_first_remove_all_courses_in_the_degree;
extern const char *Txt_Degree_X_removed;
@ -1085,7 +1087,7 @@ void Deg_RemoveDegree (void)
Deg_EditingDeg->HieCod = ParCod_GetAndCheckPar (ParCod_OthHie);
/***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg_EditingDeg);
Hie_GetDataByCod[Hie_DEG] (Deg_EditingDeg);
/***** Check if this degree has courses *****/
if (Hie_GetNumNodesInHieLvl (Hie_CRS, // Number of courses...
@ -1267,6 +1269,7 @@ void Deg_RenameDegreeFull (void)
void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFull)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists;
@ -1284,7 +1287,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFull)
Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg);
Hie_GetDataByCod[Hie_DEG] (Deg);
/***** Check if new name is empty *****/
if (NewName[0])
@ -1329,6 +1332,7 @@ void Deg_RenameDegree (struct Hie_Node *Deg,Nam_ShrtOrFullName_t ShrtOrFull)
void Deg_ChangeDegreeType (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed;
long NewDegTypCod;
@ -1343,7 +1347,7 @@ void Deg_ChangeDegreeType (void)
NewDegTypCod = ParCod_GetAndCheckPar (ParCod_OthDegTyp);
/***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg_EditingDeg);
Hie_GetDataByCod[Hie_DEG] (Deg_EditingDeg);
/***** Update the table of degrees changing old type by new type *****/
Deg_DB_UpdateDegTyp (Deg_EditingDeg->HieCod,NewDegTypCod);
@ -1362,6 +1366,7 @@ void Deg_ChangeDegreeType (void)
void Deg_ChangeDegWWW (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
@ -1376,7 +1381,7 @@ void Deg_ChangeDegWWW (void)
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg_EditingDeg);
Hie_GetDataByCod[Hie_DEG] (Deg_EditingDeg);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
@ -1401,6 +1406,7 @@ void Deg_ChangeDegWWW (void)
void Deg_ChangeDegStatus (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_status_of_the_degree_X_has_changed;
Hie_Status_t Status;
@ -1415,7 +1421,7 @@ void Deg_ChangeDegStatus (void)
Status = Hie_GetParStatus (); // New status
/***** Get data of degree *****/
Deg_GetDegreeDataByCod (Deg_EditingDeg);
Hie_GetDataByCod[Hie_DEG] (Deg_EditingDeg);
/***** Update status *****/
Deg_DB_UpdateDegStatus (Deg_EditingDeg->HieCod,Status);
@ -1501,6 +1507,7 @@ unsigned Deg_GetCachedNumDegsWithUsrs (Rol_Role_t Role)
void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_abc[Hie_NUM_LEVELS];
extern const char *Txt_HIERARCHY_PLURAL_abc[Hie_NUM_LEVELS];
char *Title;
@ -1531,7 +1538,7 @@ void Deg_ListDegsFound (MYSQL_RES **mysql_res,unsigned NumDegs)
Deg.HieCod = DB_GetNextCode (*mysql_res);
/* Get data of degree */
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/* Write data of this degree */
Deg_ListOneDegreeForSeeing (&Deg,NumDeg);

View File

@ -359,6 +359,7 @@ static void DegCfg_NumCrss (void)
void DegCfg_ChangeDegCtr (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_degree_X_has_been_moved_to_the_center_Y;
struct Hie_Node NewCtr;
const char *Names[Nam_NUM_SHRT_FULL_NAMES];
@ -370,7 +371,7 @@ void DegCfg_ChangeDegCtr (void)
if (NewCtr.HieCod != Gbl.Hierarchy.Node[Hie_DEG].PrtCod)
{
/***** Get data of new center *****/
Ctr_GetCenterDataByCod (&NewCtr);
Hie_GetDataByCod[Hie_CTR] (&NewCtr);
/***** Check if it already existed a degree with the same name in the new center *****/
Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_DEG].ShrtName;

View File

@ -2093,6 +2093,7 @@ void Enr_UpdateEnrolmentRequests (void)
static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_USERS_Requests;
extern const char *Txt_Enrolment_requests;
extern const char *Txt_Scope;
@ -2253,9 +2254,9 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
/***** Link to course *****/
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
Deg.HieCod = Crs.PrtCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
Frm_BeginFormGoTo (ActSeeCrsInf);
ParCod_PutPar (ParCod_Crs,Crs.HieCod);

View File

@ -1853,6 +1853,7 @@ void For_SetForumName (const struct For_Forum *Forum,
char ForumName[For_MAX_BYTES_FORUM_NAME + 1],
Lan_Language_t Language,bool UseHTMLEntities)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_General;
extern const char *Txt_General_NO_HTML[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_only_teachers;
@ -1885,13 +1886,13 @@ void For_SetForumName (const struct For_Forum *Forum,
break;
case For_FORUM_INSTIT_USRS:
Hie[Hie_INS].HieCod = Forum->HieCod;
if (!Ins_GetInstitDataByCod (&Hie[Hie_INS]))
if (!Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]))
Err_WrongInstitExit ();
Str_Copy (ForumName,Hie[Hie_INS].ShrtName,For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_INSTIT_TCHS:
Hie[Hie_INS].HieCod = Forum->HieCod;
if (!Ins_GetInstitDataByCod (&Hie[Hie_INS]))
if (!Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]))
Err_WrongInstitExit ();
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
Hie[Hie_INS].ShrtName,
@ -1900,13 +1901,13 @@ void For_SetForumName (const struct For_Forum *Forum,
break;
case For_FORUM_CENTER_USRS:
Hie[Hie_CTR].HieCod = Forum->HieCod;
if (!Ctr_GetCenterDataByCod (&Hie[Hie_CTR]))
if (!Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]))
Err_WrongCenterExit ();
Str_Copy (ForumName,Hie[Hie_CTR].ShrtName,For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_CENTER_TCHS:
Hie[Hie_CTR].HieCod = Forum->HieCod;
if (!Ctr_GetCenterDataByCod (&Hie[Hie_CTR]))
if (!Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]))
Err_WrongCenterExit ();
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
Hie[Hie_CTR].ShrtName,
@ -1915,13 +1916,13 @@ void For_SetForumName (const struct For_Forum *Forum,
break;
case For_FORUM_DEGREE_USRS:
Hie[Hie_DEG].HieCod = Forum->HieCod;
if (!Deg_GetDegreeDataByCod (&Hie[Hie_DEG]))
if (!Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]))
Err_WrongDegreeExit ();
Str_Copy (ForumName,Hie[Hie_DEG].ShrtName,For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_DEGREE_TCHS:
Hie[Hie_DEG].HieCod = Forum->HieCod;
if (!Deg_GetDegreeDataByCod (&Hie[Hie_DEG]))
if (!Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]))
Err_WrongDegreeExit ();
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
Hie[Hie_DEG].ShrtName,
@ -1930,13 +1931,13 @@ void For_SetForumName (const struct For_Forum *Forum,
break;
case For_FORUM_COURSE_USRS:
Hie[Hie_CRS].HieCod = Forum->HieCod;
if (!Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (!Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
Err_WrongCourseExit ();
Str_Copy (ForumName,Hie[Hie_CRS].ShrtName,For_MAX_BYTES_FORUM_NAME);
break;
case For_FORUM_COURSE_TCHS:
Hie[Hie_CRS].HieCod = Forum->HieCod;
if (!Crs_GetCourseDataByCod (&Hie[Hie_CRS]))
if (!Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]))
Err_WrongCourseExit ();
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
Hie[Hie_CRS].ShrtName,

View File

@ -80,7 +80,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
extern const char *Txt_Select_or_create_one_degree_in_X;
extern const char *Txt_Select_or_create_one_center_in_X;
extern const char *Txt_Select_or_create_one_institution_in_X;
extern const char *Txt_Select_one_country;
extern const char *Txt_Select_one_country_in_X;
extern const char *Txt_Upload_my_picture;
extern const char *Txt_Upload_photo;
extern const char *Txt_Log_in;
@ -99,24 +99,19 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
[Rol_INS_ADM] = ActUnk,
[Rol_SYS_ADM] = ActUnk,
};
static const Act_Action_t ActionsSelect[Hie_NUM_LEVELS] =
static struct
{
[Hie_DEG] = ActSeeCrs,
[Hie_CTR] = ActSeeDeg,
[Hie_INS] = ActSeeCtr,
[Hie_CTY] = ActSeeIns,
[Hie_SYS] = ActSeeCty,
};
static const char **Select_or_create[Hie_NUM_LEVELS] =
Act_Action_t Action;
const char **Description;
} SelectOrCreate[Hie_NUM_LEVELS]=
{
[Hie_DEG] = &Txt_Select_or_create_one_course_in_X,
[Hie_CTR] = &Txt_Select_or_create_one_degree_in_X,
[Hie_INS] = &Txt_Select_or_create_one_center_in_X,
[Hie_CTY] = &Txt_Select_or_create_one_institution_in_X,
[Hie_SYS] = &Txt_Select_one_country,
[Hie_SYS] = {ActSeeCty,&Txt_Select_one_country_in_X },
[Hie_CTY] = {ActSeeIns,&Txt_Select_or_create_one_institution_in_X },
[Hie_INS] = {ActSeeCtr,&Txt_Select_or_create_one_center_in_X },
[Hie_CTR] = {ActSeeDeg,&Txt_Select_or_create_one_degree_in_X },
[Hie_DEG] = {ActSeeCrs,&Txt_Select_or_create_one_course_in_X },
};
char *Description;
Hie_Level_t Level;
/***** Alert message *****/
if (Gbl.Usrs.Me.Logged &&
@ -142,7 +137,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
Gbl.Action.Act != ActLogInLan) // I am not just logged
if (ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs] != ActUnk)
{
/* Request my removing from this course */
/***** Request my removing from this course *****/
if (asprintf (&Description,Txt_Remove_me_from_THE_COURSE_X,
Gbl.Hierarchy.Node[Hie_CRS].ShrtName) < 0)
Err_NotEnoughMemoryExit ();
@ -154,7 +149,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
}
else // I do not belong to this course
{
/* Request my registration in this course */
/***** Request my registration in this course *****/
if (asprintf (&Description,Txt_Register_me_in_X,
Gbl.Hierarchy.Node[Hie_CRS].ShrtName) < 0)
Err_NotEnoughMemoryExit ();
@ -172,7 +167,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
if (!Enr_GetCachedNumUsrsInCrss (Hie_CRS,Gbl.Hierarchy.Node[Hie_CRS].HieCod,
1 << Rol_STD)) // Current course probably has no students
{
/* Request students enrolment */
/***** Request students enrolment *****/
if (asprintf (&Description,Txt_Register_students_in_COURSE_X,
Gbl.Hierarchy.Node[Hie_CRS].ShrtName) < 0)
Err_NotEnoughMemoryExit ();
@ -183,41 +178,41 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
}
if (Gbl.Action.Act != ActMyCrs) // I am not seeing the action to list my courses
/* Request list my courses */
/***** Request list my courses *****/
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Txt_Go_to_one_of_my_courses,
ActMyCrs,
Btn_CONFIRM_BUTTON,Txt_My_courses);
}
for (Level = Hie_DEG;
Level >= Hie_SYS;
Level--)
if (Gbl.Hierarchy.Node[Level].HieCod > 0) // Level selected
{
if (asprintf (&Description,*Select_or_create[Level],
Gbl.Hierarchy.Node[Level].ShrtName) < 0)
Err_NotEnoughMemoryExit ();
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
ActionsSelect[Level],
Btn_CONFIRM_BUTTON,
Txt_HIERARCHY_PLURAL_Abc[Level]);
free (Description);
break;
}
/***** Go to list of hierarchy subnodes
to select or create a new one *****/
if (Gbl.Hierarchy.Level >= Hie_SYS &&
Gbl.Hierarchy.Level <= Hie_DEG)
{
if (asprintf (&Description,*(SelectOrCreate[Gbl.Hierarchy.Level].Description),
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName) < 0)
Err_NotEnoughMemoryExit ();
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
SelectOrCreate[Gbl.Hierarchy.Level].Action,
Btn_CONFIRM_BUTTON,
Txt_HIERARCHY_PLURAL_Abc[Gbl.Hierarchy.Level + 1]);
free (Description);
}
if (!Gbl.Usrs.Me.MyPhotoExists) // I have no photo
/***** Upload my photo *****/
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Txt_Upload_my_picture,
ActReqMyPho,
Btn_CREATE_BUTTON,Txt_Upload_photo);
}
else // I am not logged
{
/* Log in */
/***** Log in *****/
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Txt_Log_in,
ActFrmLogIn,
Btn_CONFIRM_BUTTON,Txt_Log_in);
/* Sign up */
/***** Sign up *****/
if (asprintf (&Description,Txt_New_on_PLATFORM_Sign_up,
Cfg_PLATFORM_SHORT_NAME) < 0)
Err_NotEnoughMemoryExit ();

View File

@ -90,6 +90,15 @@ unsigned (*Hie_GetMyNodesFromDB[Hie_NUM_LEVELS]) (MYSQL_RES **mysql_res,
[Hie_CRS] = Enr_DB_GetMyCrss,
};
bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node) =
{
[Hie_CTY] = Cty_GetCountrDataByCod,
[Hie_INS] = Ins_GetInstitDataByCod,
[Hie_CTR] = Ctr_GetCenterDataByCod,
[Hie_DEG] = Deg_GetDegreeDataByCod,
[Hie_CRS] = Crs_GetCourseDataByCod,
};
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
@ -474,10 +483,12 @@ void Hie_SetHierarchyFromUsrLastHierarchy (void)
void Hie_InitHierarchy (void)
{
Hie_Level_t Level;
/***** If course code is available, get course data *****/
if (Gbl.Hierarchy.Node[Hie_CRS].HieCod > 0)
{
if (Crs_GetCourseDataByCod (&Gbl.Hierarchy.Node[Hie_CRS])) // Course found
if (Hie_GetDataByCod[Hie_CRS] (&Gbl.Hierarchy.Node[Hie_CRS])) // Course found
Gbl.Hierarchy.Node[Hie_DEG].HieCod = Gbl.Hierarchy.Node[Hie_CRS].PrtCod;
else
Hie_ResetHierarchy ();
@ -486,7 +497,7 @@ void Hie_InitHierarchy (void)
/***** If degree code is available, get degree data *****/
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
{
if (Deg_GetDegreeDataByCod (&Gbl.Hierarchy.Node[Hie_DEG])) // Degree found
if (Hie_GetDataByCod[Hie_DEG] (&Gbl.Hierarchy.Node[Hie_DEG])) // Degree found
{
Gbl.Hierarchy.Node[Hie_CTR].HieCod = Gbl.Hierarchy.Node[Hie_DEG].PrtCod;
Gbl.Hierarchy.Node[Hie_INS].HieCod = Deg_DB_GetInsCodOfDegreeByCod (Gbl.Hierarchy.Node[Hie_DEG].HieCod);
@ -498,7 +509,7 @@ void Hie_InitHierarchy (void)
/***** If center code is available, get center data *****/
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
{
if (Ctr_GetCenterDataByCod (&Gbl.Hierarchy.Node[Hie_CTR])) // Center found
if (Hie_GetDataByCod[Hie_CTR] (&Gbl.Hierarchy.Node[Hie_CTR])) // Center found
Gbl.Hierarchy.Node[Hie_INS].HieCod = Gbl.Hierarchy.Node[Hie_CTR].PrtCod;
else
Hie_ResetHierarchy ();
@ -507,7 +518,7 @@ void Hie_InitHierarchy (void)
/***** If institution code is available, get institution data *****/
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
{
if (Ins_GetInstitDataByCod (&Gbl.Hierarchy.Node[Hie_INS])) // Institution found
if (Hie_GetDataByCod[Hie_INS] (&Gbl.Hierarchy.Node[Hie_INS])) // Institution found
Gbl.Hierarchy.Node[Hie_CTY].HieCod = Gbl.Hierarchy.Node[Hie_INS].PrtCod;
else
Hie_ResetHierarchy ();
@ -515,7 +526,7 @@ void Hie_InitHierarchy (void)
/***** If country code is available, get country data *****/
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0)
if (!Cty_GetBasicCountryDataByCod (&Gbl.Hierarchy.Node[Hie_CTY])) // Country not found
if (!Hie_GetDataByCod[Hie_CTY] (&Gbl.Hierarchy.Node[Hie_CTY])) // Country not found
Hie_ResetHierarchy ();
/***** Set system data *****/
@ -527,12 +538,15 @@ void Hie_InitHierarchy (void)
sizeof (Gbl.Hierarchy.Node[Hie_SYS].WWW ) - 1);
/***** Set current hierarchy level *****/
Gbl.Hierarchy.Level = (Gbl.Hierarchy.Node[Hie_CRS].HieCod > 0) ? Hie_CRS : // Course selected
(Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) ? Hie_DEG : // Degree selected
(Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) ? Hie_CTR : // Center selected
(Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) ? Hie_INS : // Institution selected
(Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) ? Hie_CTY : // Country selected
Hie_SYS; // System/nothing selected
Gbl.Hierarchy.Level = Hie_SYS;
for (Level = Hie_CRS;
Level >= Hie_CTY;
Level--)
if (Gbl.Hierarchy.Node[Level].HieCod > 0)
{
Gbl.Hierarchy.Level = Level;
break;
}
/***** Initialize paths *****/
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
@ -638,7 +652,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if ((Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
{
/* Get data of institution */
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
/* Write institution logo and name */
Ins_DrawInstitLogoAndNameWithLink (&Hie[Hie_INS],ActSeeInsInf,"LT ICO16x16");
@ -648,7 +662,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if ((Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
{
/* Get data of center */
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]);
/* Write center logo and name */
Ctr_DrawCenterLogoAndNameWithLink (&Hie[Hie_CTR],ActSeeCtrInf,"LT ICO16x16");
@ -658,7 +672,7 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
if ((Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[1])) > 0)
{
/* Get data of degree */
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
/* Write degree logo and name */
Deg_DrawDegreeLogoAndNameWithLink (&Hie[Hie_DEG],ActSeeDegInf,"LT ICO20x20");

View File

@ -119,6 +119,7 @@ static unsigned Ins_GetInsAndStat (struct Hie_Node *Ins,MYSQL_RES *mysql_res);
void Ins_SeeInsWithPendingCtrs (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_SYSTEM_Pending;
extern const char *Txt_Institutions_with_pending_centers;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
@ -173,7 +174,7 @@ void Ins_SeeInsWithPendingCtrs (void)
The_GetColorRows ();
/* Get data of institution */
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/* Institution logo and name */
HTM_TR_Begin (NULL);
@ -1025,6 +1026,7 @@ static bool Ins_CheckIfICanEdit (struct Hie_Node *Ins)
void Ins_RemoveInstitution (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_To_remove_an_institution_you_must_first_remove_all_centers_and_users_in_the_institution;
extern const char *Txt_Institution_X_removed;
char PathIns[PATH_MAX + 1];
@ -1036,7 +1038,7 @@ void Ins_RemoveInstitution (void)
Ins_EditingIns->HieCod = ParCod_GetAndCheckPar (ParCod_OthHie);
/***** Get data of the institution from database *****/
Ins_GetInstitDataByCod (Ins_EditingIns);
Hie_GetDataByCod[Hie_INS] (Ins_EditingIns);
/***** Check if this institution has users *****/
if (!Ins_CheckIfICanEdit (Ins_EditingIns))
@ -1129,6 +1131,7 @@ void Ins_RenameInsFull (void)
void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Nam_Fields[Nam_NUM_SHRT_FULL_NAMES];
extern unsigned Nam_MaxBytes[Nam_NUM_SHRT_FULL_NAMES];
extern const char *Txt_X_already_exists;
@ -1145,7 +1148,7 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Nam_ShrtOrFullName_t ShrtOrFull
Nam_GetParShrtOrFullName (ShrtOrFull,NewName);
/***** Get from the database the old names of the institution *****/
Ins_GetInstitDataByCod (Ins);
Hie_GetDataByCod[Hie_INS] (Ins);
/***** Check if new name is empty *****/
if (NewName[0])
@ -1204,6 +1207,7 @@ static void Ins_UpdateInsNameDB (long InsCod,const char *FldName,const char *New
void Ins_ChangeInsWWW (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_new_web_address_is_X;
char NewWWW[Cns_MAX_BYTES_WWW + 1];
@ -1218,7 +1222,7 @@ void Ins_ChangeInsWWW (void)
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get data of institution *****/
Ins_GetInstitDataByCod (Ins_EditingIns);
Hie_GetDataByCod[Hie_INS] (Ins_EditingIns);
/***** Check if new WWW is empty *****/
if (NewWWW[0])
@ -1243,6 +1247,7 @@ void Ins_ChangeInsWWW (void)
void Ins_ChangeInsStatus (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_status_of_the_institution_X_has_changed;
Hie_Status_t Status;
@ -1257,7 +1262,7 @@ void Ins_ChangeInsStatus (void)
Status = Hie_GetParStatus (); // New status
/***** Get data of institution *****/
Ins_GetInstitDataByCod (Ins_EditingIns);
Hie_GetDataByCod[Hie_INS] (Ins_EditingIns);
/***** Update status *****/
Ins_DB_UpdateInsStatus (Ins_EditingIns->HieCod,Status);
@ -1526,6 +1531,7 @@ unsigned Ins_GetCachedNumInssWithUsrs (Rol_Role_t Role)
void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_abc[Hie_NUM_LEVELS];
extern const char *Txt_HIERARCHY_PLURAL_abc[Hie_NUM_LEVELS];
char *Title;
@ -1556,7 +1562,7 @@ void Ins_ListInssFound (MYSQL_RES **mysql_res,unsigned NumInss)
Ins.HieCod = DB_GetNextCode (*mysql_res);
/* Get data of institution */
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/* Write data of this institution */
Ins_ListOneInstitutionForSeeing (&Ins,NumIns);
@ -1926,6 +1932,7 @@ static void Ins_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
static unsigned Ins_GetInsAndStat (struct Hie_Node *Ins,MYSQL_RES *mysql_res)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_ROW row;
unsigned NumberThisRow;
@ -1934,7 +1941,7 @@ static unsigned Ins_GetInsAndStat (struct Hie_Node *Ins,MYSQL_RES *mysql_res)
/***** Get data of this institution (row[0]) *****/
Ins->HieCod = Str_ConvertStrCodToLongCod (row[0]);
if (!Ins_GetInstitDataByCod (Ins))
if (!Hie_GetDataByCod[Hie_INS] (Ins))
Err_WrongInstitExit ();
/***** Get statistic (row[1]) *****/

View File

@ -240,6 +240,7 @@ static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args)
static void InsCfg_Map (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_RES *mysql_res;
unsigned Zoom;
unsigned NumCtrs;
@ -280,7 +281,7 @@ static void InsCfg_Map (void)
Ctr.HieCod = DB_GetNextCode (mysql_res);
/* Get data of center */
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/* Get coordinates of center */
Ctr_GetCoordByCod (Ctr.HieCod,&Coord);
@ -546,6 +547,7 @@ void InsCfg_RemoveLogo (void)
void InsCfg_ChangeInsCty (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_The_country_of_the_institution_X_has_changed_to_Y;
struct Hie_Node NewCty;
const char *Names[Nam_NUM_SHRT_FULL_NAMES];
@ -557,7 +559,7 @@ void InsCfg_ChangeInsCty (void)
if (NewCty.HieCod != Gbl.Hierarchy.Node[Hie_INS].PrtCod)
{
/***** Get data of the country from database *****/
Cty_GetBasicCountryDataByCod (&NewCty);
Hie_GetDataByCod[Hie_CTY] (&NewCty);
/***** Check if it already exists an institution with the same name in the new country *****/
Names[Nam_SHRT_NAME] = Gbl.Hierarchy.Node[Hie_INS].ShrtName;

View File

@ -1488,24 +1488,21 @@ static void Lay_WriteFootFromHTMLFile (void)
void Lay_WriteHeaderClassPhoto (Vie_ViewType_t ViewType)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Hie[Hie_NUM_LEVELS];
/***** Initialize institution, degree and course to show in header *****/
Hie[Hie_INS].HieCod = (Gbl.Scope.Current == Hie_CRS ||
Gbl.Scope.Current == Hie_DEG ||
Gbl.Scope.Current == Hie_CTR ||
Gbl.Scope.Current == Hie_INS) ? Gbl.Hierarchy.Node[Hie_INS].HieCod :
Hie[Hie_INS].HieCod = (Gbl.Scope.Current >= Hie_INS) ? Gbl.Hierarchy.Node[Hie_INS].HieCod :
-1L;
Hie[Hie_DEG].HieCod = (Gbl.Scope.Current == Hie_CRS ||
Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
Hie[Hie_DEG].HieCod = (Gbl.Scope.Current >= Hie_DEG) ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
-1L;
Hie[Hie_CRS].HieCod = (Gbl.Scope.Current == Hie_CRS) ? Gbl.Hierarchy.Node[Hie_CRS].HieCod :
-1L;
/***** Get data of institution, degree and course *****/
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
/***** Begin table *****/
HTM_TABLE_BeginWidePadding (10);

View File

@ -1098,6 +1098,7 @@ static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs)
static void Msg_GetParMsgsCrsCod (struct Msg_Messages *Messages)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_any_course;
struct Hie_Node Crs;
@ -1105,7 +1106,7 @@ static void Msg_GetParMsgsCrsCod (struct Msg_Messages *Messages)
{
/* Get data of course */
Crs.HieCod = Messages->FilterCrsCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
}
Str_Copy (Messages->FilterCrsShrtName,Messages->FilterCrsCod > 0 ? Crs.ShrtName :
@ -2295,6 +2296,7 @@ static void Msg_WriteSentOrReceivedMsgSubject (struct Msg_Messages *Messages,
static bool Msg_WriteCrsOrgMsg (long CrsCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_from_this_course;
extern const char *Txt_no_course_of_origin;
struct Hie_Node Crs;
@ -2307,7 +2309,7 @@ static bool Msg_WriteCrsOrgMsg (long CrsCod)
Crs.HieCod = CrsCod;
/* Get data of current degree */
if (Crs_GetCourseDataByCod (&Crs))
if (Hie_GetDataByCod[Hie_CRS] (&Crs))
{
ThereIsOrgCrs = true;
if ((FromThisCrs = (CrsCod == Gbl.Hierarchy.Node[Hie_CRS].HieCod))) // Message sent from current course

View File

@ -289,10 +289,17 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] =
static void Ntf_PutIconsNotif (__attribute__((unused)) void *Args);
static void Ntf_WriteFormAllNotifications (bool AllNotifications);
static void Ntf_WriteRowNotif (Ntf_NotifyEvent_t NotifyEvent,
struct Usr_Data *UsrDat,
const struct Hie_Node Hie[Hie_NUM_LEVELS],
long Cod,time_t DateTimeUTC,
Ntf_Status_t Status,
struct For_Forums *Forums);
static bool Ntf_GetAllNotificationsFromForm (void);
static Act_Action_t Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
long CrsCod,struct Usr_Data *UsrDat,long Cod,
long CrsCod,const struct Usr_Data *UsrDat,long Cod,
const struct For_Forums *Forums);
static void Ntf_PutParNotifyEvent (Ntf_NotifyEvent_t NotifyEvent);
@ -314,20 +321,17 @@ static void Ntf_GetParsNotifyEvents (void);
void Ntf_ShowMyNotifications (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_START_Notifications;
extern const char *Txt_Mark_all_NOTIFICATIONS_as_read;
extern const char *Txt_Settings;
extern const char *Txt_Domains;
extern const char *Txt_Mark_all_NOTIFICATIONS_as_read;
extern const char *Txt_Notifications;
extern const char *Txt_Date;
extern const char *Txt_Event;
extern const char *Txt_Location;
extern const char *Txt_MSG_From;
extern const char *Txt_Email;
extern const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS];
extern const char *Txt_Forum;
extern const char *Txt_NOTIFICATION_STATUS[Ntf_NUM_STATUS_TXT];
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_You_have_no_notifications;
extern const char *Txt_You_have_no_unread_notifications;
MYSQL_RES *mysql_res;
@ -337,25 +341,13 @@ void Ntf_ShowMyNotifications (void)
bool AllNotifications;
Ntf_NotifyEvent_t NotifyEvent = (Ntf_NotifyEvent_t) 0; // Initialized to avoid warning
struct Usr_Data UsrDat;
Hie_Level_t Level;
unsigned Col;
struct Hie_Node Hie[Hie_NUM_LEVELS];
long Cod;
struct For_Forums Forums;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
time_t DateTimeUTC; // Date-time of the event
Ntf_Status_t Status;
Ntf_StatusTxt_t StatusTxt;
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
char *ContentStr;
struct
{
const char *Txt;
const char *Link;
const char *Author;
const char *Bg;
} Class;
Frm_PutForm_t PutForm;
Act_Action_t Action = ActUnk;
Hie_Level_t Level;
/***** Get my notifications from database *****/
AllNotifications = Ntf_GetAllNotificationsFromForm ();
@ -419,245 +411,29 @@ void Ntf_ShowMyNotifications (void)
Usr_DONT_GET_PREFS,
Usr_DONT_GET_ROLE_IN_CRS);
/* Get institution code (row[2]) */
Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[2]);
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
/* Get center code (row[3]) */
Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[3]);
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
/* Get degree code (row[4]) */
Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[4]);
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
/* Get course code (row[5]) */
Hie[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[5]);
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
/* Get institution code, center code, degree code and course code
(row[2], row[3], row[4] and row[5]) */
for (Level = Hie_INS, Col = 2;
Level <= Hie_CRS;
Level++, Col++)
{
Hie[Level].HieCod = Str_ConvertStrCodToLongCod (row[Col]);
Hie_GetDataByCod[Level] (&Hie[Level]);
}
/* Get message/post/... code (row[6]) */
Cod = Str_ConvertStrCodToLongCod (row[6]);
/* Get forum type of the post */
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
For_ResetForums (&Forums);
For_GetThreadForumTypeAndHieCodOfAPost (Cod,&Forums.Forum);
For_SetForumName (&Forums.Forum,
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
}
/* Get time of the event (row[7]) */
DateTimeUTC = Dat_GetUNIXTimeFromStr (row[7]);
/* Get status (row[8]) */
if (sscanf (row[8],"%u",&Status) != 1)
Err_WrongStatusExit ();
StatusTxt = Ntf_GetStatusTxtFromStatusBits (Status);
if (Status & Ntf_STATUS_BIT_REMOVED) // The source of the notification was removed
{
Class.Txt = "MSG_TIT_REM";
Class.Link = "BT_LINK MSG_TIT_REM";
Class.Author = "MSG_AUT_LIGHT";
Class.Bg = "MSG_BG_REM";
PutForm = Frm_DONT_PUT_FORM;
}
else
{
if (Status & Ntf_STATUS_BIT_READ) // I have already seen the source of the notification
{
Class.Txt = "MSG_TIT";
Class.Link = "LT BT_LINK MSG_TIT";
Class.Author = "MSG_AUT";
Class.Bg = "MSG_BG";
}
else // I have not seen the source of the notification
{
Class.Txt = "MSG_TIT_NEW";
Class.Link = "LT BT_LINK MSG_TIT_NEW";
Class.Author = "MSG_AUT_NEW";
Class.Bg = "MSG_BG_NEW";
}
PutForm = Frm_PUT_FORM;
}
/***** Write row for this notification *****/
/* Write event icon */
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LT %s_%s\" style=\"width:25px;\"",
Class.Bg,The_GetSuffix ());
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,&UsrDat,Cod,&Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
Ico_PutIconOff (Ntf_Icons[NotifyEvent],Ico_BLACK,
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
break;
case Frm_PUT_FORM:
Ico_PutIconLink (Ntf_Icons[NotifyEvent],Ico_BLACK,Action);
Frm_EndForm ();
break;
}
HTM_TD_End ();
/* Write event type */
HTM_TD_Begin ("class=\"LT %s_%s\"",Class.Bg,The_GetSuffix ());
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s\"",Class.Txt);
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,&UsrDat,Cod,&Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
HTM_TD_End ();
/* Write user (from) */
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
Class.Author,The_GetSuffix (),
Class.Bg,The_GetSuffix ());
Usr_WriteAuthor (&UsrDat,Cns_ENABLED);
HTM_TD_End ();
/* Write location */
HTM_TD_Begin ("class=\"LT %s_%s\"",Class.Bg,The_GetSuffix ());
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,&UsrDat,Cod,&Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"",
Class.Txt,The_GetSuffix ());
break;
case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
break;
}
HTM_TxtF ("%s:&nbsp;%s",Txt_Forum,ForumName);
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
}
else
{
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,&UsrDat,Cod,&Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"",
Class.Txt,The_GetSuffix ());
break;
case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
break;
}
for (Level = Hie_CRS;
Level >= Hie_INS;
Level--)
if (Hie[Level].HieCod > 0)
{
HTM_TxtF ("%s:&nbsp;%s",
Txt_HIERARCHY_SINGUL_Abc[Level],
Hie[Level].ShrtName);
break;
}
if (Level < Hie_INS)
HTM_Hyphen ();
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
}
HTM_TD_End ();
/* Write date and time */
Msg_WriteMsgDate (DateTimeUTC,Class.Txt,Class.Bg);
/* Write status (sent by email / pending to be sent by email) */
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
Class.Txt,The_GetSuffix (),
Class.Bg,The_GetSuffix ());
HTM_Txt (Txt_NOTIFICATION_STATUS[StatusTxt]);
HTM_TD_End ();
HTM_TR_End ();
/***** Write content of the event *****/
if (PutForm == Frm_PUT_FORM)
{
ContentStr = NULL;
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
Cod,Hie[Hie_CRS].HieCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Ntf_DONT_GET_CONTENT);
HTM_TR_Begin (NULL);
HTM_TD_Begin ("colspan=\"2\"");
HTM_TD_End ();
HTM_TD_Begin ("colspan=\"4\" class=\"LT DAT_%s\""
" style=\"padding-bottom:12px;\"",
The_GetSuffix ());
HTM_Txt (SummaryStr);
HTM_TD_End ();
HTM_TR_End ();
}
/* Write row for this notification */
Ntf_WriteRowNotif (NotifyEvent,&UsrDat,Hie,Cod,DateTimeUTC,
Status,&Forums);
}
/***** End table *****/
@ -707,6 +483,248 @@ static void Ntf_WriteFormAllNotifications (bool AllNotifications)
Txt_Show_all_NOTIFICATIONS);
}
/*****************************************************************************/
/********** Write a form to select whether show all notifications ************/
/*****************************************************************************/
static void Ntf_WriteRowNotif (Ntf_NotifyEvent_t NotifyEvent,
struct Usr_Data *UsrDat,
const struct Hie_Node Hie[Hie_NUM_LEVELS],
long Cod,time_t DateTimeUTC,
Ntf_Status_t Status,
struct For_Forums *Forums)
{
extern const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS];
extern const char *Txt_Forum;
extern const char *Txt_NOTIFICATION_STATUS[Ntf_NUM_STATUS_TXT];
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_You_have_no_notifications;
extern const char *Txt_You_have_no_unread_notifications;
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1];
char *ContentStr;
struct
{
const char *Txt;
const char *Link;
const char *Author;
const char *Bg;
} Class;
Frm_PutForm_t PutForm;
Act_Action_t Action = ActUnk;
Hie_Level_t Level;
Ntf_StatusTxt_t StatusTxt;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
if (Status & Ntf_STATUS_BIT_REMOVED) // The source of the notification was removed
{
Class.Txt = "MSG_TIT_REM";
Class.Link = "BT_LINK MSG_TIT_REM";
Class.Author = "MSG_AUT_LIGHT";
Class.Bg = "MSG_BG_REM";
PutForm = Frm_DONT_PUT_FORM;
}
else
{
if (Status & Ntf_STATUS_BIT_READ) // I have already seen the source of the notification
{
Class.Txt = "MSG_TIT";
Class.Link = "LT BT_LINK MSG_TIT";
Class.Author = "MSG_AUT";
Class.Bg = "MSG_BG";
}
else // I have not seen the source of the notification
{
Class.Txt = "MSG_TIT_NEW";
Class.Link = "LT BT_LINK MSG_TIT_NEW";
Class.Author = "MSG_AUT_NEW";
Class.Bg = "MSG_BG_NEW";
}
PutForm = Frm_PUT_FORM;
}
/***** Write row for this notification *****/
/* Write event icon */
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LT %s_%s\" style=\"width:25px;\"",
Class.Bg,The_GetSuffix ());
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
Ico_PutIconOff (Ntf_Icons[NotifyEvent],Ico_BLACK,
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
break;
case Frm_PUT_FORM:
Ico_PutIconLink (Ntf_Icons[NotifyEvent],Ico_BLACK,Action);
Frm_EndForm ();
break;
}
HTM_TD_End ();
/* Write event type */
HTM_TD_Begin ("class=\"LT %s_%s\"",Class.Bg,The_GetSuffix ());
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s\"",Class.Txt);
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
HTM_Txt (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
HTM_TD_End ();
/* Write user (from) */
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
Class.Author,The_GetSuffix (),
Class.Bg,The_GetSuffix ());
Usr_WriteAuthor (UsrDat,Cns_ENABLED);
HTM_TD_End ();
/* Write location */
HTM_TD_Begin ("class=\"LT %s_%s\"",Class.Bg,The_GetSuffix ());
if (NotifyEvent == Ntf_EVENT_FORUM_POST_COURSE ||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
{
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"",
Class.Txt,The_GetSuffix ());
break;
case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
break;
}
/* Get forum type of the post */
For_ResetForums (Forums);
For_GetThreadForumTypeAndHieCodOfAPost (Cod,&Forums->Forum);
For_SetForumName (&Forums->Forum,
ForumName,Gbl.Prefs.Language,false); // Set forum name in recipient's language
HTM_TxtF ("%s:&nbsp;%s",Txt_Forum,ForumName);
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
}
else
{
if (PutForm == Frm_PUT_FORM)
{
Action = Ntf_StartFormGoToAction (NotifyEvent,Hie[Hie_CRS].HieCod,UsrDat,Cod,Forums);
PutForm = Frm_CheckIfInside () ? Frm_PUT_FORM :
Frm_DONT_PUT_FORM;
}
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_Begin ("class=\"%s_%s\"",
Class.Txt,The_GetSuffix ());
break;
case Frm_PUT_FORM:
HTM_BUTTON_Submit_Begin (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
"class=\"LT %s_%s\"",
Class.Link,The_GetSuffix ());
break;
}
for (Level = Hie_CRS;
Level >= Hie_INS;
Level--)
if (Hie[Level].HieCod > 0)
{
HTM_TxtF ("%s:&nbsp;%s",
Txt_HIERARCHY_SINGUL_Abc[Level],
Hie[Level].ShrtName);
break;
}
if (Level < Hie_INS)
HTM_Hyphen ();
switch (PutForm)
{
case Frm_DONT_PUT_FORM:
HTM_SPAN_End ();
break;
case Frm_PUT_FORM:
HTM_BUTTON_End ();
Frm_EndForm ();
break;
}
}
HTM_TD_End ();
/* Write date and time */
Msg_WriteMsgDate (DateTimeUTC,Class.Txt,Class.Bg);
/* Write status (sent by email / pending to be sent by email) */
HTM_TD_Begin ("class=\"LT %s_%s %s_%s\"",
Class.Txt,The_GetSuffix (),
Class.Bg,The_GetSuffix ());
StatusTxt = Ntf_GetStatusTxtFromStatusBits (Status);
HTM_Txt (Txt_NOTIFICATION_STATUS[StatusTxt]);
HTM_TD_End ();
HTM_TR_End ();
/***** Write content of the event *****/
if (PutForm == Frm_PUT_FORM)
{
ContentStr = NULL;
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
Cod,Hie[Hie_CRS].HieCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Ntf_DONT_GET_CONTENT);
HTM_TR_Begin (NULL);
HTM_TD_Begin ("colspan=\"2\"");
HTM_TD_End ();
HTM_TD_Begin ("colspan=\"4\" class=\"LT DAT_%s\""
" style=\"padding-bottom:12px;\"",
The_GetSuffix ());
HTM_Txt (SummaryStr);
HTM_TD_End ();
HTM_TR_End ();
}
}
/*****************************************************************************/
/************* Get whether to show all notifications from form ***************/
/*****************************************************************************/
@ -721,7 +739,7 @@ static bool Ntf_GetAllNotificationsFromForm (void)
/*****************************************************************************/
static Act_Action_t Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
long CrsCod,struct Usr_Data *UsrDat,long Cod,
long CrsCod,const struct Usr_Data *UsrDat,long Cod,
const struct For_Forums *Forums)
{
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
@ -1284,6 +1302,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (const struct Usr_Data *ToUsrDat
unsigned *NumNotif,
unsigned *NumMails)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_NOTIFY_EVENTS_There_is_a_new_event_NO_HTML[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_NOTIFY_EVENTS_There_are_X_new_events_NO_HTML[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][1 + Lan_NUM_LANGUAGES];
@ -1302,6 +1321,8 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (const struct Usr_Data *ToUsrDat
struct Usr_Data FromUsrDat;
Ntf_NotifyEvent_t NotifyEvent = (Ntf_NotifyEvent_t) 0; // Initialized to avoid warning
struct Hie_Node Hie[Hie_NUM_LEVELS];
Hie_Level_t Level;
unsigned Col;
long Cod;
struct For_Forum ForumSelected;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
@ -1364,20 +1385,15 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (const struct Usr_Data *ToUsrDat
Usr_DONT_GET_PREFS,
Usr_DONT_GET_ROLE_IN_CRS);
/* Get insti. code (row[2]),
center code (row[3]),
degree code (row[4]),
course code (row[5]) */
Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[2]);
Hie[Hie_CTR].HieCod = Str_ConvertStrCodToLongCod (row[3]);
Hie[Hie_DEG].HieCod = Str_ConvertStrCodToLongCod (row[4]);
Hie[Hie_CRS].HieCod = Str_ConvertStrCodToLongCod (row[5]);
/* Get data of institution, center, degree and course */
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
/* Get data of institution, center, degree and course
(row[2], row[3], row[4], row[5]) */
for (Level = Hie_INS, Col = 2;
Level <= Hie_CRS;
Level++, Col++)
{
Hie[Level].HieCod = Str_ConvertStrCodToLongCod (row[Col]);
Hie_GetDataByCod[Level] (&Hie[Level]);
}
/* Get message/post/... code (row[6]) */
Cod = Str_ConvertStrCodToLongCod (row[6]);

View File

@ -1994,6 +1994,7 @@ static void Pho_PutLinkToPrintViewOfDegreeStatsPars (void *DegPhotos)
static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPhotos)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Calculate_average_photo_of_THE_DEGREE_X;
extern const char *Txt_unknown_TIME;
extern const char *Txt_time;
@ -2011,7 +2012,7 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh
Deg_GetListAllDegsWithStds (&Degs);
/***** Get data of the degree from database *****/
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/***** Contextual menu *****/
HTM_DIV_Begin ("class=\"UPD\"");
@ -2121,6 +2122,7 @@ static void Pho_GetMaxStdsPerDegree (struct Pho_DegPhotos *DegPhotos)
static void Pho_ShowOrPrintClassPhotoDegrees (struct Pho_DegPhotos *DegPhotos,
Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_RES *mysql_res;
unsigned long NumDeg;
unsigned long NumDegs;
@ -2149,7 +2151,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (struct Pho_DegPhotos *DegPhotos,
Err_WrongDegreeExit ();
/* Get data of degree */
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/* Get number of students and number of students with photo in this degree */
Pho_GetNumStdsInDegree (Deg.HieCod,Usr_SEX_ALL,&NumStds,&NumStdsWithPhoto);
@ -2198,6 +2200,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (struct Pho_DegPhotos *DegPhotos,
static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_No_INDEX;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_SEX_PLURAL_Abc[Usr_NUM_SEXS];
@ -2243,7 +2246,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
Err_WrongDegreeExit ();
/* Get data of degree */
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
HTM_TR_Begin (NULL);

View File

@ -1999,6 +1999,7 @@ void Rec_ShowPublicSharedRecordOtherUsr (void)
void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
struct Usr_Data *UsrDat,const char *Anchor)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Hlp_USERS_SignUp;
extern const char *Hlp_PROFILE_Record;
extern const char *Hlp_START_Profiles_view_public_profile;
@ -2085,7 +2086,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
Ins.HieCod = UsrDat->InsCod;
if (Ins.HieCod > 0)
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/***** Begin box and table *****/
Rec_Record.UsrDat = UsrDat;
@ -3468,6 +3469,7 @@ static void Rec_ShowInstitution (struct Hie_Node *Ins,bool ShowData)
static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
struct Hie_Node Ctr;
@ -3485,7 +3487,7 @@ static void Rec_ShowCenter (struct Usr_Data *UsrDat,bool ShowData)
if (UsrDat->Tch.CtrCod > 0)
{
Ctr.HieCod = UsrDat->Tch.CtrCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
if (Ctr.WWW[0])
HTM_A_Begin ("href=\"%s\" target=\"_blank\""
" class=\"DAT_STRONG_%s\"",
@ -4140,6 +4142,7 @@ void Rec_ChgCountryOfMyInstitution (void)
void Rec_UpdateMyInstitution (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Ins;
unsigned NumCtrs;
unsigned NumDpts;
@ -4151,7 +4154,7 @@ void Rec_UpdateMyInstitution (void)
/* Get country of institution */
if (Ins.HieCod > 0)
{
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
if (Gbl.Usrs.Me.UsrDat.InsCtyCod != Ins.PrtCod)
Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.PrtCod;
}
@ -4180,6 +4183,7 @@ void Rec_UpdateMyInstitution (void)
void Rec_UpdateMyCenter (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Ctr;
/***** Get my center *****/
@ -4189,7 +4193,7 @@ void Rec_UpdateMyCenter (void)
/* Get institution of center */
if (Ctr.HieCod > 0)
{
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
if (Gbl.Usrs.Me.UsrDat.InsCod != Ctr.PrtCod)
{
Gbl.Usrs.Me.UsrDat.InsCod = Ctr.PrtCod;

View File

@ -479,6 +479,7 @@ static void Rep_WriteSectionPlatform (void)
static void Rep_WriteSectionUsrInfo (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Personal_information;
extern const char *Txt_Name;
extern const char *Txt_Email;
@ -509,7 +510,7 @@ static void Rep_WriteSectionUsrInfo (void)
/***** User's institution *****/
Ins.HieCod = Gbl.Usrs.Me.UsrDat.InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
fprintf (Rep_File,"<li>%s: %s</li>",
Txt_HIERARCHY_SINGUL_Abc[Hie_INS],Ins.FullName);
@ -1028,6 +1029,7 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
struct Rep_Report *Report,
bool WriteNumUsrs)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
extern const char *Txt_teachers_ABBREVIATION;
extern const char *Txt_students_ABBREVIATION;
@ -1038,11 +1040,11 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
/***** Get course data *****/
Crs.HieCod = CrsCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
/***** Get degree data *****/
Deg.HieCod = Crs.PrtCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/***** Begin row *****/
fprintf (Rep_File,"<li>");

View File

@ -2951,6 +2951,7 @@ static void Sta_ShowNumHitsPerCountry (Sta_CountType_t CountType,
static void Sta_WriteCountry (long CtyCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Cty;
/***** Begin cell *****/
@ -2960,7 +2961,7 @@ static void Sta_WriteCountry (long CtyCod)
{
/***** Get data of country *****/
Cty.HieCod = CtyCod;
Cty_GetBasicCountryDataByCod (&Cty);
Hie_GetDataByCod[Hie_CTY] (&Cty);
/***** Form to go to country *****/
Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf,
@ -3039,6 +3040,7 @@ static void Sta_ShowNumHitsPerInstitution (Sta_CountType_t CountType,
static void Sta_WriteInstit (long InsCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Ins;
/***** Begin cell *****/
@ -3046,7 +3048,7 @@ static void Sta_WriteInstit (long InsCod)
{
/***** Get data of institution *****/
Ins.HieCod = InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/***** Title in cell *****/
HTM_TD_Begin ("class=\"LM LOG_%s\" title=\"%s\"",
@ -3130,6 +3132,7 @@ static void Sta_ShowNumHitsPerCenter (Sta_CountType_t CountType,
static void Sta_WriteCenter (long CtrCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Ctr;
/***** Begin cell *****/
@ -3137,7 +3140,7 @@ static void Sta_WriteCenter (long CtrCod)
{
/***** Get data of center *****/
Ctr.HieCod = CtrCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/***** Title in cell *****/
HTM_TD_Begin ("class=\"LM LOG_%s\" title=\"%s\"",
@ -3221,6 +3224,7 @@ static void Sta_ShowNumHitsPerDegree (Sta_CountType_t CountType,
static void Sta_WriteDegree (long DegCod)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
struct Hie_Node Deg;
/***** Begin cell *****/
@ -3228,7 +3232,7 @@ static void Sta_WriteDegree (long DegCod)
{
/***** Get data of degree *****/
Deg.HieCod = DegCod;
Deg_GetDegreeDataByCod (&Deg);
Hie_GetDataByCod[Hie_DEG] (&Deg);
/***** Title in cell *****/
HTM_TD_Begin ("class=\"LM LOG_%s\" title=\"%s\"",
@ -3256,6 +3260,7 @@ static void Sta_ShowNumHitsPerCourse (Sta_CountType_t CountType,
unsigned NumHits,
MYSQL_RES *mysql_res)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_No_INDEX;
extern const char *Txt_HIERARCHY_SINGUL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_Year_OF_A_DEGREE;
@ -3293,7 +3298,7 @@ static void Sta_ShowNumHitsPerCourse (Sta_CountType_t CountType,
Crs.HieCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get data of current degree */
CrsOK = Crs_GetCourseDataByCod (&Crs);
CrsOK = Hie_GetDataByCod[Hie_CRS] (&Crs);
HTM_TR_Begin (NULL);

View File

@ -198,6 +198,7 @@ static void SysCfg_PutIconToPrint (__attribute__((unused)) void *Args)
static void SysCfg_Map (void)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
MYSQL_RES *mysql_res;
unsigned Zoom;
unsigned NumCtrs;
@ -239,14 +240,14 @@ static void SysCfg_Map (void)
Ctr.HieCod = DB_GetNextCode (mysql_res);
/* Get data of center */
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
/* Get coordinates of center */
Ctr_GetCoordByCod (Ctr.HieCod,&Coord);
/* Get data of institution */
Ins.HieCod = Ctr.PrtCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
/* Add marker */
Map_AddMarker (&Coord);

View File

@ -15582,7 +15582,7 @@ const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS] =
#elif L==3 // en
"Institutions"
#elif L==4 // es
"instituciones"
"Instituciones"
#elif L==5 // fr
"&Eacute;tablissements"
#elif L==6 // gn
@ -41050,27 +41050,27 @@ const char *Txt_See_the_previous_X_COMMENTS = // Warning: it is very important t
"See the previous %u"; // Çeviri lazim!
#endif
const char *Txt_Select_one_country =
const char *Txt_Select_one_country_in_X =
#if L==1 // ca
"Seleccionar un pa&iacute;s";
"Seleccionar un pa&iacute;s en <strong>%s</strong>";
#elif L==2 // de
"W&auml;hlen Sie ein Land";
"W&auml;hlen Sie ein Land von <strong>%s</strong>";
#elif L==3 // en
"Select one country";
"Select one country in <strong>%s</strong>";
#elif L==4 // es
"Seleccionar un pa&iacute;s";
"Seleccionar un pa&iacute;s en <strong>%s</strong>";
#elif L==5 // fr
"S&eacute;lectionnez un pays";
"S&eacute;lectionnez un pays dans <strong>%s</strong>";
#elif L==6 // gn
"Seleccionar un pa&iacute;s"; // Okoteve traducción
"Seleccionar un pa&iacute;s en <strong>%s</strong>"; // Okoteve traducción
#elif L==7 // it
"Selezionare un paese";
"Selezionare un paese di <strong>%s</strong>";
#elif L==8 // pl
"Wybierz jeden kraj";
"Wybierz jeden kraj w <strong>%s</strong>";
#elif L==9 // pt
"Selecionar um pa&iacute;s";
"Selecionar um pa&iacute;s de <strong>%s</strong>";
#elif L==10 // tr
"Select one country"; // Çeviri lazim!
"Select one country in <strong>%s</strong>"; // Çeviri lazim!
#endif
const char *Txt_Select_or_create_one_center_in_X = // Warning: it is very important to include %s in the following sentences
@ -41089,7 +41089,7 @@ const char *Txt_Select_or_create_one_center_in_X = // Warning: it is very import
#elif L==7 // it
"Selezionare o creare un centro di <strong>%s</strong>";
#elif L==8 // pl
"Select or create one degree in <strong>%s</strong>"; // Potrzebujesz tlumaczenie
"Wybierz lub utw&oacute;rz jeden stopie&nacute; w <strong>%s</strong>.";
#elif L==9 // pt
"Selecionar ou criar um centro de <strong>%s</strong>";
#elif L==10 // tr
@ -41112,7 +41112,7 @@ const char *Txt_Select_or_create_one_course_in_X = // Warning: it is very import
#elif L==7 // it
"Selezionare o creare un corso di <strong>%s</strong>";
#elif L==8 // pl
"Select or create one course in <strong>%s</strong>"; // Potrzebujesz tlumaczenie
"Wybierz lub utw&oacute;rz jeden kurs w <strong>%s</strong>";
#elif L==9 // pt
"Selecionar ou criar uma disciplina de <strong>%s</strong>";
#elif L==10 // tr
@ -41135,7 +41135,7 @@ const char *Txt_Select_or_create_one_degree_in_X = // Warning: it is very import
#elif L==7 // it
"Selezionare o creare una laurea di <strong>%s</strong>";
#elif L==8 // pl
"Select or create one degree in <strong>%s</strong>"; // Potrzebujesz tlumaczenie
"Wybierz lub utw&oacute;rz jeden stopie&nacute; w <strong>%s</strong>";
#elif L==9 // pt
"Selecionar ou criar um grau de <strong>%s</strong>";
#elif L==10 // tr
@ -41158,7 +41158,7 @@ const char *Txt_Select_or_create_one_institution_in_X = // Warning: it is very i
#elif L==7 // it
"Selezionare o creare una istituzione di <strong>%s</strong>";
#elif L==8 // pl
"Select or create one institution in <strong>%s</strong>"; // Potrzebujesz tlumaczenie
"Wybierz lub utw&oacute;rz jedn&aogon; instytucj&eogon; w <strong>%s</strong>";
#elif L==9 // pt
"Selecionar ou criar uma institu&ccedil;&atilde;o de <strong>%s</strong>";
#elif L==10 // tr

View File

@ -428,6 +428,8 @@ static void TmlNot_GetLocationInHierarchy (const struct TmlNot_Note *Not,
struct For_Forum *Forum,
char ForumName[For_MAX_BYTES_FORUM_NAME + 1])
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
/***** Initialize location in hierarchy *****/
Hie[Hie_CTY].HieCod =
Hie[Hie_INS].HieCod =
@ -442,19 +444,19 @@ static void TmlNot_GetLocationInHierarchy (const struct TmlNot_Note *Not,
case TmlNot_INS_SHA_PUB_FILE:
/* Get institution data */
Hie[Hie_INS].HieCod = Not->HieCod;
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
Hie_GetDataByCod[Hie_INS] (&Hie[Hie_INS]);
break;
case TmlNot_CTR_DOC_PUB_FILE:
case TmlNot_CTR_SHA_PUB_FILE:
/* Get center data */
Hie[Hie_CTR].HieCod = Not->HieCod;
Ctr_GetCenterDataByCod (&Hie[Hie_CTR]);
Hie_GetDataByCod[Hie_CTR] (&Hie[Hie_CTR]);
break;
case TmlNot_DEG_DOC_PUB_FILE:
case TmlNot_DEG_SHA_PUB_FILE:
/* Get degree data */
Hie[Hie_DEG].HieCod = Not->HieCod;
Deg_GetDegreeDataByCod (&Hie[Hie_DEG]);
Hie_GetDataByCod[Hie_DEG] (&Hie[Hie_DEG]);
break;
case TmlNot_CRS_DOC_PUB_FILE:
case TmlNot_CRS_SHA_PUB_FILE:
@ -462,7 +464,7 @@ static void TmlNot_GetLocationInHierarchy (const struct TmlNot_Note *Not,
case TmlNot_NOTICE:
/* Get course data */
Hie[Hie_CRS].HieCod = Not->HieCod;
Crs_GetCourseDataByCod (&Hie[Hie_CRS]);
Hie_GetDataByCod[Hie_CRS] (&Hie[Hie_CRS]);
break;
case TmlNot_FORUM_POST:
/* Get forum type of the post */

View File

@ -1426,6 +1426,7 @@ static void Tmt_TimeTableDrawCellView (const struct Tmt_Timetable *Timetable,
unsigned DurationNumIntervals,
const char *Info)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_unknown_removed_course;
extern const char *Txt_TIMETABLE_CLASS_TYPES[Tmt_NUM_CLASS_TYPES];
struct Hie_Node Crs;
@ -1440,7 +1441,7 @@ static void Tmt_TimeTableDrawCellView (const struct Tmt_Timetable *Timetable,
ClassType == Tmt_PRACTICAL))
{
Crs.HieCod = CrsCod;
Crs_GetCourseDataByCod (&Crs);
Hie_GetDataByCod[Hie_CRS] (&Crs);
HTM_Txt (Crs.ShrtName[0] ? Crs.ShrtName :
Txt_unknown_removed_course);
HTM_BR ();

View File

@ -2168,6 +2168,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct Usr_Data *UsrDat,
bool PutCheckBoxToSelectUsr,Rol_Role_t Role,
struct Usr_SelectedUsrs *SelectedUsrs)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
extern const char *Txt_Enrolment_confirmed;
extern const char *Txt_Enrolment_not_confirmed;
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
@ -2249,7 +2250,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct Usr_Data *UsrDat,
/***** Write rest of main user's data *****/
Ins.HieCod = UsrDat->InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor);
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
@ -2266,6 +2267,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct Usr_Data *UsrDat,
static void Usr_WriteRowGstAllData (struct Usr_Data *UsrDat)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
{
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC21x28",
@ -2299,7 +2301,7 @@ static void Usr_WriteRowGstAllData (struct Usr_Data *UsrDat)
/***** Write rest of guest's main data *****/
Ins.HieCod = UsrDat->InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,The_GetColorRows ());
Usr_WriteEmail (UsrDat,The_GetColorRows ());
Usr_WriteUsrData (The_GetColorRows (),
@ -2310,7 +2312,7 @@ static void Usr_WriteRowGstAllData (struct Usr_Data *UsrDat)
if (UsrDat->Tch.CtrCod > 0)
{
Ctr.HieCod = UsrDat->Tch.CtrCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
}
Usr_WriteUsrData (The_GetColorRows (),
UsrDat->Tch.CtrCod > 0 ? Ctr.FullName :
@ -2356,6 +2358,7 @@ static void Usr_WriteRowGstAllData (struct Usr_Data *UsrDat)
static void Usr_WriteRowStdAllData (struct Usr_Data *UsrDat,char *GroupNames)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
{
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC21x28",
@ -2395,7 +2398,7 @@ static void Usr_WriteRowStdAllData (struct Usr_Data *UsrDat,char *GroupNames)
/***** Write rest of main student's data *****/
Ins.HieCod = UsrDat->InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,The_GetColorRows ());
Usr_WriteEmail (UsrDat,The_GetColorRows ());
Usr_WriteUsrData (The_GetColorRows (),
@ -2467,6 +2470,7 @@ static void Usr_WriteRowStdAllData (struct Usr_Data *UsrDat,char *GroupNames)
static void Usr_WriteRowTchAllData (struct Usr_Data *UsrDat)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
{
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC21x28",
@ -2504,7 +2508,7 @@ static void Usr_WriteRowTchAllData (struct Usr_Data *UsrDat)
/***** Write rest of main teacher's data *****/
Ins.HieCod = UsrDat->InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,The_GetColorRows ());
Usr_WriteEmail (UsrDat,The_GetColorRows ());
Usr_WriteUsrData (The_GetColorRows (),
@ -2515,7 +2519,7 @@ static void Usr_WriteRowTchAllData (struct Usr_Data *UsrDat)
if (ShowData && UsrDat->Tch.CtrCod > 0)
{
Ctr.HieCod = UsrDat->Tch.CtrCod;
Ctr_GetCenterDataByCod (&Ctr);
Hie_GetDataByCod[Hie_CTR] (&Ctr);
}
Usr_WriteUsrData (The_GetColorRows (),
(ShowData && UsrDat->Tch.CtrCod > 0) ? Ctr.FullName :
@ -2548,6 +2552,7 @@ static void Usr_WriteRowTchAllData (struct Usr_Data *UsrDat)
static void Usr_WriteRowAdmData (unsigned NumUsr,struct Usr_Data *UsrDat)
{
extern bool (*Hie_GetDataByCod[Hie_NUM_LEVELS]) (struct Hie_Node *Node);
static const char *ClassPhoto[PhoSha_NUM_SHAPES] =
{
[PhoSha_SHAPE_CIRCLE ] = "PHOTOC21x28",
@ -2588,7 +2593,7 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct Usr_Data *UsrDat)
/***** Write rest of main administrator's data *****/
Ins.HieCod = UsrDat->InsCod;
Ins_GetInstitDataByCod (&Ins);
Hie_GetDataByCod[Hie_INS] (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,The_GetColorRows ());
HTM_TD_Begin ("class=\"LM %s\"",The_GetColorRows ());