Version 23.9.7: Sep 19, 2023 Code refactoring in hierarchy.

This commit is contained in:
acanas 2023-09-19 22:27:20 +02:00
parent 4dd1e6edfd
commit 98039765e6
20 changed files with 159 additions and 222 deletions

View File

@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/
#define Log_PLATFORM_VERSION "SWAD 23.9.6 (2023-09-19)"
#define Log_PLATFORM_VERSION "SWAD 23.9.7 (2023-09-19)"
#define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js"
/*
Version 23.9.7: Sep 19, 2023 Code refactoring in hierarchy. (337352 lines)
Version 23.9.6: Sep 19, 2023 Code refactoring in hierarchy. (337410 lines)
Version 23.9.5: Sep 19, 2023 Code refactoring in hierarchy. (337441 lines)
Version 23.9.4: Sep 19, 2023 Code refactoring in calls for exams. (337504 lines)

View File

@ -366,13 +366,13 @@ static void CtyCfg_MapImage (bool PrintView,bool PutLink)
static void CtyCfg_Platform (bool PrintView)
{
extern const char *Txt_Platform;
extern const char *Txt_System;
/***** Institution *****/
HTM_TR_Begin (NULL);
/* Label */
Frm_LabelColumn ("RT",NULL,Txt_Platform);
Frm_LabelColumn ("RT",NULL,Txt_System);
/* Data */
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());

View File

@ -364,11 +364,17 @@ void DegCfg_ChangeDegCtr (void)
Ctr_GetCenterDataByCod (&NewCtr);
/***** Check if it already exists a degree with the same name in the new center *****/
if (Deg_DB_CheckIfDegNameExistsInCtr ("ShortName",Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,NewCtr.Cod))
if (Deg_DB_CheckIfDegNameExistsInCtr ("ShortName",
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
NewCtr.Cod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
else if (Deg_DB_CheckIfDegNameExistsInCtr ("FullName",Gbl.Hierarchy.Node[HieLvl_DEG].FullName,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,NewCtr.Cod))
else if (Deg_DB_CheckIfDegNameExistsInCtr ("FullName",
Gbl.Hierarchy.Node[HieLvl_DEG].FullName,
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
NewCtr.Cod))
Ale_CreateAlert (Ale_WARNING,
Txt_The_degree_X_already_exists,
Gbl.Hierarchy.Node[HieLvl_DEG].FullName);

View File

@ -148,7 +148,8 @@ void Dpt_SeeAllDepts (void)
Dpt_GetListDepartments (&Departments,Gbl.Hierarchy.Node[HieLvl_INS].Cod);
/***** Begin box and table *****/
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,Gbl.Hierarchy.Node[HieLvl_INS].FullName) < 0)
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,
Gbl.Hierarchy.Node[HieLvl_INS].FullName) < 0)
Err_NotEnoughMemoryExit ();
Box_BoxTableBegin (NULL,Title,
Dpt_PutIconToEditDpts,NULL,
@ -317,7 +318,8 @@ static void Dpt_EditDepartmentsInternal (void)
Dpt_GetListDepartments (&Departments,Gbl.Hierarchy.Node[HieLvl_INS].Cod);
/***** Begin box *****/
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,Gbl.Hierarchy.Node[HieLvl_INS].FullName) < 0)
if (asprintf (&Title,Txt_Departments_of_INSTITUTION_X,
Gbl.Hierarchy.Node[HieLvl_INS].FullName) < 0)
Err_NotEnoughMemoryExit ();
Box_BoxBegin (NULL,Title,
Dpt_PutIconToViewDpts,NULL,
@ -522,7 +524,7 @@ static void Dpt_ListDepartmentsForEdition (const struct Dpt_Departments *Departm
InsInLst = &Gbl.Hierarchy.List[HieLvl_CTY].Lst[NumIns];
HTM_OPTION (HTM_Type_LONG,&InsInLst->Cod,
InsInLst->Cod == DptInLst->InsCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",InsInLst->ShrtName);
}
@ -850,7 +852,7 @@ static void Dpt_PutFormToCreateDepartment (void)
InsInLst = &Gbl.Hierarchy.List[HieLvl_CTY].Lst[NumIns];
HTM_OPTION (HTM_Type_LONG,&InsInLst->Cod,
InsInLst->Cod == Dpt_EditingDpt->InsCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED,
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s",InsInLst->ShrtName);
}

View File

@ -1405,9 +1405,9 @@ bool Enr_PutActionsRegRemOneUsr (Usr_MeOrOther_t MeOrOther)
OptionsShown = true;
}
/***** Remove user as an administrator of the center *****/
if (UsrIsCtrAdmin &&
(MeOrOther == Usr_ME || Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM))
/***** Remove user as an administrator of the center *****/
if (UsrIsCtrAdmin &&
(MeOrOther == Usr_ME || Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM))
{
Enr_PutActionRemUsrAsCtrAdm (&OptionChecked,MeOrOther);
OptionsShown = true;
@ -1456,7 +1456,8 @@ static void Enr_PutActionModifyOneUsr (bool *OptionChecked,
};
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_MODIFY_ONE_USR_IN_CRS,OptionChecked);
HTM_TxtF (Txt[UsrBelongsToCrs][MeOrOther],Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
HTM_TxtF (Txt[UsrBelongsToCrs][MeOrOther],
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
Enr_RegRemOneUsrActionEnd ();
}
@ -1957,12 +1958,13 @@ void Enr_AskIfRejectSignUp (void)
{
/* User already belongs to this course */
Ale_ShowAlert (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y,
Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
Gbl.Usrs.Other.UsrDat.FullName,
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
/* Remove inscription request because it has not sense */
Enr_RemUsrEnrolmentRequestInCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
}
else // User does not belong to this course
{

View File

@ -1531,7 +1531,8 @@ static void ExaSet_ChangeValidityQst (Qst_Validity_t Validity)
QstCod = ParCod_GetAndCheckPar (ParCod_Qst);
/***** Validate/unvalidate question *****/
Exa_DB_ChangeValidityQst (QstCod,Set.SetCod,Exams.Exam.ExaCod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod,
Exa_DB_ChangeValidityQst (QstCod,Set.SetCod,Exams.Exam.ExaCod,
Gbl.Hierarchy.Node[HieLvl_CRS].Cod,
Validity);
/***** Show current exam and its sets *****/

View File

@ -202,7 +202,8 @@ void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],
snprintf (ParSession,sizeof (ParSession),
"<input type=\"hidden\" name=\"ses\" value=\"%s\" />",
Gbl.Session.Id);
else if (PutParLocationIfNoSession && Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].Cod > 0)
else if (PutParLocationIfNoSession &&
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].Cod > 0)
// Extra parameters necessary when there's no open session
/* If session is open, course/degree/... code will be get from session data,
but if there is not an open session, and next action is known,

View File

@ -56,7 +56,7 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Hie_DrawLogo (const char *ShrtText);
static void Hie_DrawLogo (void);
static Hie_StatusTxt_t Hie_GetStatusTxtFromStatusBits (Hie_Status_t Status);
static Hie_Status_t Hie_GetStatusBitsFromStatusTxt (Hie_StatusTxt_t StatusTxt);
@ -427,24 +427,6 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
[HieLvl_DEG] = TabDeg,
[HieLvl_CRS] = TabCrs,
};
const char *FullText[HieLvl_NUM_LEVELS] =
{
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Node[HieLvl_CTY].FullName,
[HieLvl_INS] = Gbl.Hierarchy.Node[HieLvl_INS].FullName,
[HieLvl_CTR] = Gbl.Hierarchy.Node[HieLvl_CTR].FullName,
[HieLvl_DEG] = Gbl.Hierarchy.Node[HieLvl_DEG].FullName,
[HieLvl_CRS] = Gbl.Hierarchy.Node[HieLvl_CRS].FullName,
};
const char *ShrtText[HieLvl_NUM_LEVELS] =
{
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Node[HieLvl_CTY].FullName,
[HieLvl_INS] = Gbl.Hierarchy.Node[HieLvl_INS].ShrtName,
[HieLvl_CTR] = Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName,
[HieLvl_DEG] = Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,
[HieLvl_CRS] = Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName,
};
HTM_TxtF ("<h1 id=\"main_title\" class=\"MAIN_TITLE_%s\">",
The_GetSuffix ());
@ -454,17 +436,17 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
Frm_BeginForm (ActMnu);
Par_PutParUnsigned (NULL,"NxtTab",(unsigned) NextTab[Gbl.Hierarchy.Level]);
HTM_BUTTON_Submit_Begin (ShrtText[Gbl.Hierarchy.Level],
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,
"class=\"BT_LINK ICO_HIGHLIGHT\"");
HTM_DIV_Begin ("id=\"big_full_name\""); // Full name
Hie_DrawLogo (ShrtText[Gbl.Hierarchy.Level]);
HTM_Txt (FullText[Gbl.Hierarchy.Level]);
Hie_DrawLogo ();
HTM_Txt (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].FullName);
HTM_DIV_End ();
HTM_DIV_Begin ("id=\"big_short_name\""); // Short name
Hie_DrawLogo (ShrtText[Gbl.Hierarchy.Level]);
HTM_Txt (ShrtText[Gbl.Hierarchy.Level]);
Hie_DrawLogo ();
HTM_Txt (Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName);
HTM_DIV_End ();
HTM_BUTTON_End ();
@ -479,7 +461,7 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
/********************** Draw logo in the top of the page *********************/
/*****************************************************************************/
static void Hie_DrawLogo (const char *ShrtText)
static void Hie_DrawLogo (void)
{
static HieLvl_Level_t LogoScope[HieLvl_NUM_LEVELS] =
{
@ -493,14 +475,15 @@ static void Hie_DrawLogo (const char *ShrtText)
[HieLvl_INS] = &Gbl.Hierarchy.Node[HieLvl_INS].Cod,
[HieLvl_CTR] = &Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
[HieLvl_DEG] = &Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
[HieLvl_CRS] = &Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
[HieLvl_CRS] = &Gbl.Hierarchy.Node[HieLvl_DEG].Cod, // Degree code
};
/***** Logo *****/
switch (Gbl.Hierarchy.Level)
{
case HieLvl_SYS: // System
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,ShrtText,"TOP_LOGO");
Ico_PutIcon ("swad64x64.png",Ico_UNCHANGED,
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,"TOP_LOGO");
break;
case HieLvl_CTY: // Country
Cty_DrawCountryMap (&Gbl.Hierarchy.Node[HieLvl_CTY],"TOP_LOGO");
@ -508,7 +491,7 @@ static void Hie_DrawLogo (const char *ShrtText)
default:
Lgo_DrawLogo (LogoScope[Gbl.Hierarchy.Level],
*LogoCode[Gbl.Hierarchy.Level],
ShrtText,
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].ShrtName,
40,"TOP_LOGO");
break;
}
@ -580,37 +563,45 @@ void Hie_InitHierarchy (void)
if (!Cty_GetBasicCountryDataByCod (&Gbl.Hierarchy.Node[HieLvl_CTY])) // Country not found
Hie_ResetHierarchy ();
/***** Set system data *****/
Str_Copy (Gbl.Hierarchy.Node[HieLvl_SYS].ShrtName,Cfg_PLATFORM_SHORT_NAME,
sizeof (Gbl.Hierarchy.Node[HieLvl_SYS].ShrtName) - 1);
Str_Copy (Gbl.Hierarchy.Node[HieLvl_SYS].FullName,Cfg_PLATFORM_FULL_NAME ,
sizeof (Gbl.Hierarchy.Node[HieLvl_SYS].FullName) - 1);
Str_Copy (Gbl.Hierarchy.Node[HieLvl_SYS].WWW ,Cfg_URL_SWAD_PUBLIC ,
sizeof (Gbl.Hierarchy.Node[HieLvl_SYS].WWW ) - 1);
/***** Set current hierarchy level and code
depending on course code, degree code, etc. *****/
if (Gbl.Hierarchy.Node[HieLvl_CRS].Cod > 0) // Course selected
{
Gbl.Hierarchy.Level = HieLvl_CRS;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CRS].Cod;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CRS].Cod;
}
else if (Gbl.Hierarchy.Node[HieLvl_DEG].Cod > 0) // Degree selected
{
Gbl.Hierarchy.Level = HieLvl_DEG;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
}
else if (Gbl.Hierarchy.Node[HieLvl_CTR].Cod > 0) // Center selected
{
Gbl.Hierarchy.Level = HieLvl_CTR;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
}
else if (Gbl.Hierarchy.Node[HieLvl_INS].Cod > 0) // Institution selected
{
Gbl.Hierarchy.Level = HieLvl_INS;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
}
else if (Gbl.Hierarchy.Node[HieLvl_CTY].Cod > 0) // Country selected
{
Gbl.Hierarchy.Level = HieLvl_CTY;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CTY].Cod;
Gbl.Hierarchy.Cod = Gbl.Hierarchy.Node[HieLvl_CTY].Cod;
}
else
{
Gbl.Hierarchy.Level = HieLvl_SYS;
Gbl.Hierarchy.Cod = -1L;
Gbl.Hierarchy.Cod = -1L;
}
/***** Initialize paths *****/

View File

@ -1512,14 +1512,10 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
/* Set institution country */
Ins_EditingIns->PrtCod = Gbl.Hierarchy.Node[HieLvl_CTY].Cod;
/* Get institution short name */
/* Get institution short name, full name and WWW */
Par_GetParText ("ShortName",Ins_EditingIns->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);
/* Get institution full name */
Par_GetParText ("FullName",Ins_EditingIns->FullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
/* Get institution WWW */
Par_GetParText ("WWW",Ins_EditingIns->WWW,Cns_MAX_BYTES_WWW);
Par_GetParText ("FullName" ,Ins_EditingIns->FullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
Par_GetParText ("WWW" ,Ins_EditingIns->WWW ,Cns_MAX_BYTES_WWW);
if (Ins_EditingIns->ShrtName[0] &&
Ins_EditingIns->FullName[0]) // If there's a institution name

View File

@ -378,7 +378,8 @@ static void InsCfg_FullName (bool PutForm)
static void InsCfg_ShrtName (bool PutForm)
{
HieCfg_ShrtName (PutForm,ActRenInsShoCfg,Gbl.Hierarchy.Node[HieLvl_INS].ShrtName);
HieCfg_ShrtName (PutForm,ActRenInsShoCfg,
Gbl.Hierarchy.Node[HieLvl_INS].ShrtName);
}
/*****************************************************************************/
@ -387,7 +388,8 @@ static void InsCfg_ShrtName (bool PutForm)
static void InsCfg_WWW (bool PrintView,bool PutForm)
{
HieCfg_WWW (PrintView,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Node[HieLvl_INS].WWW);
HieCfg_WWW (PrintView,PutForm,ActChgInsWWWCfg,
Gbl.Hierarchy.Node[HieLvl_INS].WWW);
}
/*****************************************************************************/
@ -556,7 +558,7 @@ void InsCfg_ChangeInsCty (void)
/***** Update the table changing the country of the institution *****/
Ins_DB_UpdateInsCty (Gbl.Hierarchy.Node[HieLvl_INS].Cod,NewCty.Cod);
Gbl.Hierarchy.Node[HieLvl_INS].PrtCod =
Gbl.Hierarchy.Node[HieLvl_CTY].Cod = NewCty.Cod;
Gbl.Hierarchy.Node[HieLvl_CTY].Cod = NewCty.Cod;
/***** Initialize again current course, degree, center... *****/
Hie_InitHierarchy ();
@ -603,7 +605,8 @@ void InsCfg_ChangeInsWWW (void)
{
/***** Update database changing old WWW by new WWW *****/
Ins_DB_UpdateInsWWW (Gbl.Hierarchy.Node[HieLvl_INS].Cod,NewWWW);
Str_Copy (Gbl.Hierarchy.Node[HieLvl_INS].WWW,NewWWW,sizeof (Gbl.Hierarchy.Node[HieLvl_INS].WWW) - 1);
Str_Copy (Gbl.Hierarchy.Node[HieLvl_INS].WWW,NewWWW,
sizeof (Gbl.Hierarchy.Node[HieLvl_INS].WWW) - 1);
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,

View File

@ -455,8 +455,7 @@ static void Lay_WritePageTitle (void)
HTM_TxtF (" &gt; %s",Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
}
else
HTM_TxtF ("%s: %s",
Cfg_PLATFORM_SHORT_NAME,Txt_TAGLINE);
HTM_TxtF ("%s: %s",Cfg_PLATFORM_SHORT_NAME,Txt_TAGLINE);
HTM_TITLE_End ();
}

View File

@ -43,6 +43,17 @@
#include "swad_scope.h"
#include "swad_theme.h"
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
static const char *Lgo_Folder[HieLvl_NUM_LEVELS] =
{
[HieLvl_INS] = Cfg_FOLDER_INS,
[HieLvl_CTR] = Cfg_FOLDER_CTR,
[HieLvl_DEG] = Cfg_FOLDER_DEG,
};
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
@ -214,53 +225,36 @@ void Lgo_RequestLogo (HieLvl_Level_t Level)
extern const char *Txt_Logo;
extern const char *Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y;
extern const char *Txt_File_with_the_logo;
long Cod;
const char *Folder;
Act_Action_t ActionRec;
void (*FunctionToDrawContextualIcons) (void *Args);
char PathLogo[PATH_MAX + 1];
/***** Set action depending on scope *****/
switch (Level)
static Act_Action_t ActionRec[HieLvl_NUM_LEVELS] =
{
case HieLvl_INS:
Cod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
Folder = Cfg_FOLDER_INS;
ActionRec = ActRecInsLog;
FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoIns;
break;
case HieLvl_CTR:
Cod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
Folder = Cfg_FOLDER_CTR;
ActionRec = ActRecCtrLog;
FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoCtr;
break;
case HieLvl_DEG:
Cod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
Folder = Cfg_FOLDER_DEG;
ActionRec = ActRecDegLog;
FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoDeg;
break;
default:
return; // Nothing to do
}
[HieLvl_INS] = ActRecInsLog,
[HieLvl_CTR] = ActRecCtrLog,
[HieLvl_DEG] = ActRecDegLog,
};
static void (*FunctionToDrawContextualIcons[HieLvl_NUM_LEVELS]) (void *Args) =
{
[HieLvl_INS] = Lgo_PutIconToRemoveLogoIns,
[HieLvl_CTR] = Lgo_PutIconToRemoveLogoCtr,
[HieLvl_DEG] = Lgo_PutIconToRemoveLogoDeg,
};
long Cod = Gbl.Hierarchy.Node[Level].Cod;
char PathLogo[PATH_MAX + 1];
/***** Check if logo exists *****/
snprintf (PathLogo,sizeof (PathLogo),"%s/%s/%02u/%u/logo/%u.png",
Cfg_PATH_SWAD_PUBLIC,Folder,
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100),
(unsigned) Cod,
(unsigned) Cod);
if (!Fil_CheckIfPathExists (PathLogo))
FunctionToDrawContextualIcons = NULL;
/***** Begin box *****/
Box_BoxBegin (NULL,Txt_Logo,
FunctionToDrawContextualIcons,NULL,
Fil_CheckIfPathExists (PathLogo) ? FunctionToDrawContextualIcons[Level] :
NULL,NULL,
NULL,Box_NOT_CLOSABLE);
/***** Begin form to upload logo *****/
Frm_BeginForm (ActionRec);
Frm_BeginForm (ActionRec[Level]);
/***** Write help message *****/
Ale_ShowAlert (Ale_INFO,Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y,
@ -314,8 +308,7 @@ static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem)
void Lgo_ReceiveLogo (HieLvl_Level_t Level)
{
extern const char *Txt_The_file_is_not_X;
long Cod;
const char *Folder;
long Cod = Gbl.Hierarchy.Node[Level].Cod;
char Path[PATH_MAX + 1];
struct Par_Param *Par;
char FileNameLogoSrc[PATH_MAX + 1];
@ -323,36 +316,21 @@ void Lgo_ReceiveLogo (HieLvl_Level_t Level)
char FileNameLogo[PATH_MAX + 1]; // Full name (including path and .png) of the destination file
bool WrongType = false;
/***** Set variables depending on scope *****/
switch (Level)
{
case HieLvl_INS:
Cod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
Folder = Cfg_FOLDER_INS;
break;
case HieLvl_CTR:
Cod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
Folder = Cfg_FOLDER_CTR;
break;
case HieLvl_DEG:
Cod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
Folder = Cfg_FOLDER_DEG;
break;
default:
return; // Nothing to do
}
/***** Creates directories if not exist *****/
snprintf (Path,sizeof (Path),"%s/%s",Cfg_PATH_SWAD_PUBLIC,Folder);
snprintf (Path,sizeof (Path),"%s/%s",
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level]);
Fil_CreateDirIfNotExists (Path);
snprintf (Path,sizeof (Path),"%s/%s/%02u",Cfg_PATH_SWAD_PUBLIC,Folder,
snprintf (Path,sizeof (Path),"%s/%s/%02u",
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100));
Fil_CreateDirIfNotExists (Path);
snprintf (Path,sizeof (Path),"%s/%s/%02u/%u",Cfg_PATH_SWAD_PUBLIC,Folder,
snprintf (Path,sizeof (Path),"%s/%s/%02u/%u",
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100),
(unsigned) Cod);
Fil_CreateDirIfNotExists (Path);
snprintf (Path,sizeof (Path),"%s/%s/%02u/%u/logo",Cfg_PATH_SWAD_PUBLIC,Folder,
snprintf (Path,sizeof (Path),"%s/%s/%02u/%u/logo",
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100),
(unsigned) Cod);
Fil_CreateDirIfNotExists (Path);
@ -375,7 +353,7 @@ void Lgo_ReceiveLogo (HieLvl_Level_t Level)
{
/* End the reception of logo in a temporary file */
snprintf (FileNameLogo,sizeof (FileNameLogo),"%s/%s/%02u/%u/logo/%u.png",
Cfg_PATH_SWAD_PUBLIC,Folder,
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100),
(unsigned) Cod,
(unsigned) Cod);
@ -390,32 +368,12 @@ void Lgo_ReceiveLogo (HieLvl_Level_t Level)
void Lgo_RemoveLogo (HieLvl_Level_t Level)
{
long Cod;
const char *Folder;
long Cod = Gbl.Hierarchy.Node[Level].Cod;
char FileNameLogo[PATH_MAX + 1]; // Full name (including path and .png) of the destination file
/***** Set variables depending on scope *****/
switch (Level)
{
case HieLvl_INS:
Cod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
Folder = Cfg_FOLDER_INS;
break;
case HieLvl_CTR:
Cod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
Folder = Cfg_FOLDER_CTR;
break;
case HieLvl_DEG:
Cod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
Folder = Cfg_FOLDER_DEG;
break;
default:
return; // Nothing to do
}
/***** Remove logo *****/
snprintf (FileNameLogo,sizeof (FileNameLogo),"%s/%s/%02u/%u/logo/%u.png",
Cfg_PATH_SWAD_PUBLIC,Folder,
Cfg_PATH_SWAD_PUBLIC,Lgo_Folder[Level],
(unsigned) (Cod % 100),
(unsigned) Cod,
(unsigned) Cod);

View File

@ -696,7 +696,8 @@ static void Mch_GetAndWriteNamesOfGrpsAssociatedToMatch (const struct Mch_Match
}
}
else
HTM_TxtF ("%s&nbsp;%s",Txt_The_whole_course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
HTM_TxtF ("%s&nbsp;%s",Txt_The_whole_course,
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
HTM_DIV_End ();
@ -1308,7 +1309,8 @@ static void Mch_ShowLstGrpsToEditMatch (long MchCod)
"MchCod",
MchCod) ? "" :
" checked=\"checked\"");
HTM_TxtF ("%s&nbsp;%s",Txt_The_whole_course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
HTM_TxtF ("%s&nbsp;%s",Txt_The_whole_course,
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
HTM_LABEL_End ();
HTM_TD_End ();

View File

@ -527,7 +527,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
extern const char *Txt_nicks_emails_or_IDs_separated_by_commas;
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
unsigned ColSpan;
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);

View File

@ -719,13 +719,6 @@ void Par_GetMainPars (void)
char Nick[Nck_MAX_BYTES_NICK_WITH_ARROBA + 1];
char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1];
/***** Reset codes of country, institution, center, degree and course *****/
Gbl.Hierarchy.Node[HieLvl_CTY].Cod =
Gbl.Hierarchy.Node[HieLvl_INS].Cod =
Gbl.Hierarchy.Node[HieLvl_CTR].Cod =
Gbl.Hierarchy.Node[HieLvl_DEG].Cod =
Gbl.Hierarchy.Node[HieLvl_CRS].Cod = -1L;
// First of all, get action, and session identifier.
// So, if other parameters have been stored in the database, there will be no problems to get them.

View File

@ -407,7 +407,7 @@ static void Rep_WriteHeader (const struct Rep_Report *Report)
/***** Begin header *****/
fprintf (Rep_File,"<header>"
"<h1>");
fprintf (Rep_File,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
fprintf (Rep_File,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
fprintf (Rep_File,"</h1>"
"<ul>");

View File

@ -64,15 +64,6 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
[HieLvl_DEG] = &Txt_Degree,
[HieLvl_CRS] = &Txt_Course,
};
const char *TxtName[HieLvl_NUM_LEVELS] =
{
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Node[HieLvl_CTY].FullName,
[HieLvl_INS] = Gbl.Hierarchy.Node[HieLvl_INS].ShrtName,
[HieLvl_CTR] = Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName,
[HieLvl_DEG] = Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,
[HieLvl_CRS] = Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName,
};
HTM_SELECT_Begin (SubmitOnChange,NULL,
"id=\"%s\" name=\"%s\" class=\"INPUT_%s\"",
@ -123,7 +114,8 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED,
"%s: %s",
*TxtScope[Level],TxtName[Level]);
*TxtScope[Level],
Gbl.Hierarchy.Node[Level].ShrtName);
}
}

View File

@ -397,6 +397,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
extern const char *Txt_Number_of_questions;
extern const char *Txt_Number_of_users;
extern const char *Txt_Scope;
extern const char *Txt_System;
extern const char *Txt_Country;
extern const char *Txt_Institution;
extern const char *Txt_Center;
@ -410,6 +411,15 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
extern const char *HidVis_TitleClass[HidVis_NUM_HIDDEN_VISIBLE];
extern const char *HidVis_GroupClass[HidVis_NUM_HIDDEN_VISIBLE];
extern const char *HidVis_DataClass[HidVis_NUM_HIDDEN_VISIBLE];
static const char **TxtScope[HieLvl_NUM_LEVELS] =
{
[HieLvl_SYS] = &Txt_System,
[HieLvl_CTY] = &Txt_Country,
[HieLvl_INS] = &Txt_Institution,
[HieLvl_CTR] = &Txt_Center,
[HieLvl_DEG] = &Txt_Degree,
[HieLvl_CRS] = &Txt_Course,
};
char *Anchor = NULL;
static unsigned UniqueId = 0;
char *Id;
@ -418,6 +428,8 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
/***** Get data of this survey *****/
Svy_GetSurveyDataByCod (&Surveys->Svy);
if (Surveys->Svy.Level == HieLvl_UNK)
Err_WrongHierarchyLevelExit ();
/***** Begin box *****/
if (ShowOnlyThisSvyComplete)
@ -596,30 +608,8 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
HidVis_GroupClass[Surveys->Svy.Status.HiddenOrVisible],
The_GetSuffix ());
HTM_TxtColonNBSP (Txt_Scope);
switch (Surveys->Svy.Level)
{
case HieLvl_UNK: // Unknown
Err_WrongHierarchyLevelExit ();
break;
case HieLvl_SYS: // System
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
break;
case HieLvl_CTY: // Country
HTM_TxtF ("%s&nbsp;%s",Txt_Country,Gbl.Hierarchy.Node[HieLvl_CTY].FullName);
break;
case HieLvl_INS: // Institution
HTM_TxtF ("%s&nbsp;%s",Txt_Institution,Gbl.Hierarchy.Node[HieLvl_INS].ShrtName);
break;
case HieLvl_CTR: // Center
HTM_TxtF ("%s&nbsp;%s",Txt_Center,Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName);
break;
case HieLvl_DEG: // Degree
HTM_TxtF ("%s&nbsp;%s",Txt_Degree,Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
break;
case HieLvl_CRS: // Course
HTM_TxtF ("%s&nbsp;%s",Txt_Course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
break;
}
HTM_TxtF ("%s&nbsp;%s",*TxtScope[Surveys->Svy.Level],
Gbl.Hierarchy.Node[Surveys->Svy.Level].ShrtName);
HTM_DIV_End ();
/* Users' roles who can answer the survey */

View File

@ -257,18 +257,18 @@ static void SysCfg_Map (void)
static void SysCfg_Platform (void)
{
extern const char *Txt_Platform;
extern const char *Txt_System;
/***** Institution *****/
HTM_TR_Begin (NULL);
/* Label */
Frm_LabelColumn ("RT",NULL,Txt_Platform);
/* Label */
Frm_LabelColumn ("RT",NULL,Txt_System);
/* Data */
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
HTM_TD_End ();
/* Data */
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
HTM_TD_End ();
HTM_TR_End ();
}

View File

@ -29735,29 +29735,6 @@ const char *Txt_PLACES_ORDER[Plc_NUM_ORDERS] =
#endif
};
const char *Txt_Platform =
#if L==1 // ca
"Plataforma";
#elif L==2 // de
"Plattform";
#elif L==3 // en
"Platform";
#elif L==4 // es
"Plataforma";
#elif L==5 // fr
"Plate-forme";
#elif L==6 // gn
"Plataforma"; // Okoteve traducción
#elif L==7 // it
"Piattaforma";
#elif L==8 // pl
"Platforma";
#elif L==9 // pt
"Plataforma";
#elif L==10 // tr
"Platformu";
#endif
const char *Txt_Play = // To play a game match
#if L==1 // ca
"Jugar";
@ -45722,7 +45699,30 @@ const char *Txt_System =
#elif L==10 // tr
"Platformu";
#endif
/*
const char *Txt_Platform =
#if L==1 // ca
"Plataforma";
#elif L==2 // de
"Plattform";
#elif L==3 // en
"Platform";
#elif L==4 // es
"Plataforma";
#elif L==5 // fr
"Plate-forme";
#elif L==6 // gn
"Plataforma"; // Okoteve traducción
#elif L==7 // it
"Piattaforma";
#elif L==8 // pl
"Platforma";
#elif L==9 // pt
"Plataforma";
#elif L==10 // tr
"Platformu";
#endif
*/
const char *Txt_TABLE_Footer =
#if L==1 // ca
"Peu";